Skip to content

Commit

Permalink
Renaming sync/crawl fields (#3113)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-codaio authored Dec 10, 2024
1 parent 74834b0 commit 8943acd
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 41 deletions.
33 changes: 24 additions & 9 deletions api_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,13 +339,18 @@ export interface ParamDef<T extends UnionType> {
suggestedValue?: SuggestedValueType<T>;

/**
* In certain contexts (like Coda Brain), Coda's default behavior is to sync *all* data available, in which case
* the {@link ParamDef.suggestedValue} will not be ideal, as most use cases will prefer efficiency
* over completeness. Use this field to specify a default value when Coda is syncing all data.
* In ingestions, where we want to load *all* data available, the {@link ParamDef.suggestedValue}
* will not be ideal, as most use cases will prefer efficiency over completeness.
* Use this field to specify a default value for ingestions.
*
* @hidden
*/
// TODO(patrick): Unhide this
ingestionSuggestedValue?: SuggestedValueType<T>;
/**
* @deprecated Use {@link ParamDef.ingestionSuggestedValue} instead.
* @hidden
*/
fullSyncSuggestedValue?: SuggestedValueType<T>;

/**
Expand Down Expand Up @@ -382,7 +387,7 @@ export interface ParamDef<T extends UnionType> {

/**
* Whether this parameter is compatible with incremental sync.
* If not, it will be hidden from the Coda Brain setup UI.
* If not, it will be hidden from crawl setup UIs.
*/
// TODO(ebo): Unhide this
/** @hidden */
Expand Down Expand Up @@ -839,6 +844,20 @@ export interface SyncBase {
*/
readonly parameters?: MetadataContext;

/**
* If this invocation is a part of an ingestion, then this ID will be provided to all invocations.
* It may be a full sync execution ID or an incremental sync execution ID.
*
* This includes invocations of sync `execute` and `executeGetPermissions`, as well as
* dynamic table features like `listDynamicUrls`, `getSchema`, and `getName`.
*
* TODO(patrick): May want to support this in doc syncs too.
*
* TODO(patrick): Unhide this
* @hidden
*/
executionId?: string;

/**
* This is only populated when `context.invocationLocation.source === InvocationSource.Brain`.
*
Expand Down Expand Up @@ -1015,11 +1034,7 @@ export interface ExecutionContext {
readonly authenticationName?: string;

/**
* If this invocation is a part of a crawling execution, like in Coda Brain, then this ID will be provided
* to all invocations. That includes invocations of sync `execute` and `executeGetPermissions`, as well as
* dynamic table features like `listDynamicUrls`, `getSchema`, and `getName`.
*
* TODO(patrick): Unhide this
* @deprecated Replace this with {@link SyncBase.executionId}
* @hidden
*/
readonly executionId?: string;
Expand Down
32 changes: 23 additions & 9 deletions dist/api_types.d.ts

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

32 changes: 23 additions & 9 deletions dist/bundle.d.ts

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

13 changes: 9 additions & 4 deletions dist/testing/upload_validation.js

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

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.5",
"version": "1.8.6-prerelease.1",
"license": "MIT",
"workspaces": [
"dev/eslint"
Expand Down
19 changes: 10 additions & 9 deletions testing/upload_validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -750,8 +750,7 @@ ${endpointKey ? 'endpointKey is set' : `requiresEndpointUrl is ${requiresEndpoin

const reservedAuthenticationNames = Object.values(ReservedAuthenticationNames).map(value => value.toString());
const adminAuthenticationValidator = zodCompleteObject<AdminAuthentication>({
authentication: z
.union(zodUnionInput(Object.values(adminAuthenticationValidators))),
authentication: z.union(zodUnionInput(Object.values(adminAuthenticationValidators))),
name: z
.string()
.min(1)
Expand Down Expand Up @@ -794,6 +793,7 @@ ${endpointKey ? 'endpointKey is set' : `requiresEndpointUrl is ${requiresEndpoin
autocomplete: z.unknown().optional(),
defaultValue: z.unknown().optional(),
suggestedValue: z.unknown().optional(),
ingestionSuggestedValue: z.unknown().optional(),
fullSyncSuggestedValue: z.unknown().optional(),
allowedPresetValues: z.array(z.unknown()).optional(),
allowManualInput: z.boolean().optional(),
Expand Down Expand Up @@ -1976,15 +1976,14 @@ ${endpointKey ? 'endpointKey is set' : `requiresEndpointUrl is ${requiresEndpoin
// only add identity names that are not undefined to check for dupes
if (tableDef.schema.identity) {
const allowedAuthenticationNames = identityInfo.get(tableDef.schema.identity.name) || [];
identityInfo.set(
tableDef.schema.identity.name,
[...allowedAuthenticationNames, ...(tableDef.getter?.allowedAuthenticationNames || [undefined])],
);

identityInfo.set(tableDef.schema.identity.name, [
...allowedAuthenticationNames,
...(tableDef.getter?.allowedAuthenticationNames || [undefined]),
]);
}
formulaNames.push(tableDef.getter.name);
}

validateIdentityNames(context, identityInfo);
for (const dupe of getNonUniqueElements(formulaNames)) {
context.addIssue({
Expand All @@ -2010,7 +2009,9 @@ ${endpointKey ? 'endpointKey is set' : `requiresEndpointUrl is ${requiresEndpoin
if (seenAuthNames.has(allowedAuthName) || seenAuthNames.has(undefined)) {
context.addIssue({
code: z.ZodIssueCode.custom,
message: allowedAuthName ? `Identity "${identityName}" is used by multiple sync tables with non-distinct allowedAuthenticationNames: ${allowedAuthName}`: `Sync table identity names must be unique. Found duplicate name "${identityName}".` ,
message: allowedAuthName
? `Identity "${identityName}" is used by multiple sync tables with non-distinct allowedAuthenticationNames: ${allowedAuthName}`
: `Sync table identity names must be unique. Found duplicate name "${identityName}".`,
});
}
seenAuthNames.add(allowedAuthName);
Expand Down

0 comments on commit 8943acd

Please sign in to comment.