Skip to content

Commit

Permalink
Default titleProperty to displayProperty (#3134)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-codaio authored Dec 16, 2024
1 parent f880dcd commit 4a97b36
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 14 deletions.
2 changes: 1 addition & 1 deletion dist/bundle.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/helpers/migration.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions dist/helpers/migration.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions helpers/migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ class ObjectSchemaHelper<T extends ObjectSchemaDefinition<string, string>> {
get requireForUpdates() {
return this._schema.requireForUpdates;
}

get titleProperty() {
return this._schema.titleProperty ?? this._schema.displayProperty;
}
}

export function paramDefHelper<S extends UnionType, T extends ParamDef<S>>(def: T): ParamDefHelper<S, T> {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@codahq/packs-sdk",
"version": "1.8.6",
"version": "1.8.7-prerelease.1",
"license": "MIT",
"workspaces": [
"dev/eslint"
Expand Down
2 changes: 1 addition & 1 deletion schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1383,7 +1383,7 @@ export interface ObjectSchemaDefinition<K extends string, L extends string>
* TODO(ebo): Unhide this
* @hidden
*/
versionProperty? : PropertyIdentifier<K>;
versionProperty?: PropertyIdentifier<K>;

// TODO(dweitzman): Only support options in the typing when the codaType is ValueHintType.SelectList.
}
Expand Down
24 changes: 13 additions & 11 deletions test/upload_validation_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1935,7 +1935,7 @@ describe('Pack metadata Validation', async () => {
return {result: []};
},
parameters: [],
allowedAuthenticationNames: [ReservedAuthenticationNames.System]
allowedAuthenticationNames: [ReservedAuthenticationNames.System],
},
});
const syncTable4 = makeSyncTable({
Expand All @@ -1956,11 +1956,10 @@ describe('Pack metadata Validation', async () => {
return {result: []};
},
parameters: [],
allowedAuthenticationNames: [ReservedAuthenticationNames.Default]
allowedAuthenticationNames: [ReservedAuthenticationNames.Default],
},
});


let metadata = createFakePack({
syncTables: [syncTable1, syncTable2, syncTable3, syncTable4],
});
Expand Down Expand Up @@ -1994,10 +1993,10 @@ describe('Pack metadata Validation', async () => {
return {result: []};
},
parameters: [],
allowedAuthenticationNames: [ReservedAuthenticationNames.Default, ReservedAuthenticationNames.System]
allowedAuthenticationNames: [ReservedAuthenticationNames.Default, ReservedAuthenticationNames.System],
},
});
metadata = createFakePack({
metadata = createFakePack({
syncTables: [syncTable1, syncTable2, syncTable3, syncTable4, syncTable5],
});
err = await validateJsonAndAssertFails(metadata);
Expand All @@ -2007,12 +2006,14 @@ describe('Pack metadata Validation', async () => {
path: 'syncTables',
},
{
message: 'Identity "IdentityAdminAuth" is used by multiple sync tables with non-distinct allowedAuthenticationNames: defaultUserAuthentication',
path: 'syncTables'
message:
'Identity "IdentityAdminAuth" is used by multiple sync tables with non-distinct allowedAuthenticationNames: defaultUserAuthentication',
path: 'syncTables',
},
{
message: 'Identity "IdentityAdminAuth" is used by multiple sync tables with non-distinct allowedAuthenticationNames: systemAuthentication',
path: 'syncTables'
message:
'Identity "IdentityAdminAuth" is used by multiple sync tables with non-distinct allowedAuthenticationNames: systemAuthentication',
path: 'syncTables',
},
{
message: 'Sync table formula names must be unique. Found duplicate name "SyncTable".',
Expand Down Expand Up @@ -2061,7 +2062,7 @@ describe('Pack metadata Validation', async () => {
},
parameters: [],
// This will still be considered a duplicate because table 1 implicitly allows all auths.
allowedAuthenticationNames: [ReservedAuthenticationNames.Default]
allowedAuthenticationNames: [ReservedAuthenticationNames.Default],
},
});

Expand All @@ -2071,7 +2072,8 @@ describe('Pack metadata Validation', async () => {
const err = await validateJsonAndAssertFails(metadata);
assert.deepEqual(err.validationErrors, [
{
message: 'Identity "Identity" is used by multiple sync tables with non-distinct allowedAuthenticationNames: defaultUserAuthentication',
message:
'Identity "Identity" is used by multiple sync tables with non-distinct allowedAuthenticationNames: defaultUserAuthentication',
path: 'syncTables',
},
{
Expand Down

0 comments on commit 4a97b36

Please sign in to comment.