diff --git a/api_types.ts b/api_types.ts index 5a993e8372..e462d8f70a 100644 --- a/api_types.ts +++ b/api_types.ts @@ -339,6 +339,14 @@ export interface ParamDef { // TODO(patrick): Unhide this /** @hidden */ crawlStrategy?: CrawlStrategy; + + /** + * Whether this parameter is compatible with incremental sync. + * If not, it will be hidden from the Coda Brain setup UI. + */ + // TODO(ebo): Unhide this + /** @hidden */ + supportsIncrementalSync?: boolean; } /** diff --git a/dist/api_types.d.ts b/dist/api_types.d.ts index c290b38381..4eec940e1f 100644 --- a/dist/api_types.d.ts +++ b/dist/api_types.d.ts @@ -252,6 +252,12 @@ export interface ParamDef { suggestedValue?: SuggestedValueType; /** @hidden */ crawlStrategy?: CrawlStrategy; + /** + * Whether this parameter is compatible with incremental sync. + * If not, it will be hidden from the Coda Brain setup UI. + */ + /** @hidden */ + supportsIncrementalSync?: boolean; } /** * Marker type for an optional {@link ParamDef}, used internally. diff --git a/dist/bundle.d.ts b/dist/bundle.d.ts index f4eff421d1..6d4791372a 100644 --- a/dist/bundle.d.ts +++ b/dist/bundle.d.ts @@ -230,6 +230,12 @@ export interface ParamDef { suggestedValue?: SuggestedValueType; /** @hidden */ crawlStrategy?: CrawlStrategy; + /** + * Whether this parameter is compatible with incremental sync. + * If not, it will be hidden from the Coda Brain setup UI. + */ + /** @hidden */ + supportsIncrementalSync?: boolean; } /** * Marker type for an optional {@link ParamDef}, used internally. diff --git a/dist/testing/upload_validation.js b/dist/testing/upload_validation.js index 6a6a6665f2..a793a2e6f0 100644 --- a/dist/testing/upload_validation.js +++ b/dist/testing/upload_validation.js @@ -578,7 +578,10 @@ function buildMetadataSchema({ sdkVersion }) { defaultValue: z.unknown().optional(), suggestedValue: z.unknown().optional(), crawlStrategy: z.unknown().optional(), - }); + supportsIncrementalSync: z.boolean().optional().default(true), + }).refine(param => { + return param.optional || param.supportsIncrementalSync; + }, { message: 'Required params should support incremental sync.' }); const commonPackFormulaSchema = { // It would be preferable to use validateFormulaName here, but we have to exempt legacy packs with sync tables // whose getter names violate the validator, and those exemptions require the pack id, so this has to be diff --git a/package.json b/package.json index 96d9e38d80..8467438569 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@codahq/packs-sdk", - "version": "1.7.8", + "version": "1.7.8-prerelease.1", "license": "MIT", "workspaces": [ "dev/eslint" diff --git a/test/upload_validation_test.ts b/test/upload_validation_test.ts index 88ca51ab91..badd89b424 100644 --- a/test/upload_validation_test.ts +++ b/test/upload_validation_test.ts @@ -4471,6 +4471,37 @@ describe('Pack metadata Validation', async () => { }, ]); }); + + it('rejects required param does not support incremental sync', async () => { + const formula = makeFormula({ + resultType: ValueType.String, + name: 'Hi', + description: 'A', + examples: [], + parameters: [ + makeParameter({ + type: ParameterType.String, + name: 'myParam', + description: '', + optional: false, + supportsIncrementalSync: false, + }), + ], + execute: () => '', + }); + + const metadata = createFakePackVersionMetadata({ + formulas: [formula], + formulaNamespace: 'MyNamespace', + }); + const err = await validateJsonAndAssertFails(metadata); + assert.deepEqual(err.validationErrors, [ + { + message: `Required params should support incremental sync.`, + path: 'formulas[0].parameters[0]', + }, + ]); + }); }); describe('deprecation warnings', () => { diff --git a/testing/upload_validation.ts b/testing/upload_validation.ts index 667a33069a..52209321db 100644 --- a/testing/upload_validation.ts +++ b/testing/upload_validation.ts @@ -717,7 +717,13 @@ function buildMetadataSchema({sdkVersion}: BuildMetadataSchemaArgs): { defaultValue: z.unknown().optional(), suggestedValue: z.unknown().optional(), crawlStrategy: z.unknown().optional(), - }); + supportsIncrementalSync: z.boolean().optional().default(true), + }).refine( + param => { + return param.optional || param.supportsIncrementalSync; + }, + {message: 'Required params should support incremental sync.'}, + ); const commonPackFormulaSchema = { // It would be preferable to use validateFormulaName here, but we have to exempt legacy packs with sync tables