zitejs 0.10.0-start.2 → 0.10.0-start.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/auth/actions.d.ts +28 -0
- package/dist/cjs/auth/actions.js +93 -0
- package/dist/cjs/auth/client.d.ts +357 -0
- package/dist/cjs/auth/client.js +66 -0
- package/dist/cjs/auth/index.d.ts +2 -249
- package/dist/cjs/auth/index.js +11 -108
- package/dist/cjs/auth/index.test.js +48 -0
- package/dist/cjs/auth/previewClaim.d.ts +7 -0
- package/dist/cjs/auth/previewClaim.js +16 -0
- package/dist/cjs/auth/profileUpdates.d.ts +9 -0
- package/dist/cjs/auth/profileUpdates.js +11 -0
- package/dist/cjs/backend/index.d.ts +121 -3
- package/dist/cjs/backend/index.test.js +58 -0
- package/dist/cjs/bundle/index.d.ts +8 -0
- package/dist/cjs/bundle/index.js +9 -8
- package/dist/cjs/check/index.d.ts +45 -1
- package/dist/cjs/check/index.js +198 -109
- package/dist/cjs/check/start/problem.d.ts +11 -0
- package/dist/cjs/check/start/problem.js +5 -0
- package/dist/cjs/check/start/routeTree.d.ts +9 -0
- package/dist/cjs/check/start/routeTree.js +111 -0
- package/dist/cjs/check/start/sourceRules.d.ts +8 -0
- package/dist/cjs/check/start/sourceRules.js +1159 -0
- package/dist/cjs/check/start/tsgo.d.ts +2 -0
- package/dist/cjs/check/start/tsgo.js +35 -0
- package/dist/cjs/cli.js +1 -1
- package/dist/cjs/client/index.d.ts +24 -0
- package/dist/cjs/dev/index.js +14 -4
- package/dist/cjs/integrations/rules.d.ts +13 -0
- package/dist/cjs/integrations/rules.js +31 -0
- package/dist/cjs/integrations/rules.test.js +1 -0
- package/dist/cjs/internal/appMode.d.ts +3 -0
- package/dist/cjs/internal/appMode.js +15 -0
- package/dist/cjs/runtime/index.d.ts +64 -25
- package/dist/cjs/runtime/sendEmailParamsTypes.test-d.d.ts +1 -0
- package/dist/cjs/runtime/sendEmailParamsTypes.test-d.js +33 -0
- package/dist/cjs/start/entries.d.ts +10 -4
- package/dist/cjs/start/entries.js +23 -6
- package/dist/cjs/steps/index.d.ts +78 -0
- package/dist/cjs/steps/index.js +507 -0
- package/dist/cjs/steps/index.test.d.ts +1 -0
- package/dist/cjs/steps/index.test.js +635 -0
- package/dist/cjs/sync/index.js +2 -1
- package/dist/cjs/sync/lib.d.ts +10 -3
- package/dist/cjs/sync/lib.js +44 -25
- package/dist/cjs/sync/lib.test.js +116 -36
- package/dist/cjs/types/fields.d.ts +8 -1
- package/dist/cjs/types/fields.js +7 -1
- package/dist/cjs/types/tables.d.ts +16 -0
- package/dist/cjs/upload/index.js +12 -2
- package/dist/cjs/upload/index.test.js +39 -0
- package/dist/cjs/vite/index.js +8 -3
- package/dist/cjs/vite/index.test.js +10 -2
- package/dist/esm/auth/actions.d.ts +28 -0
- package/dist/esm/auth/actions.js +55 -0
- package/dist/esm/auth/client.d.ts +357 -0
- package/dist/esm/auth/client.js +62 -0
- package/dist/esm/auth/index.d.ts +2 -249
- package/dist/esm/auth/index.js +2 -103
- package/dist/esm/auth/index.test.js +48 -0
- package/dist/esm/auth/previewClaim.d.ts +7 -0
- package/dist/esm/auth/previewClaim.js +12 -0
- package/dist/esm/auth/profileUpdates.d.ts +9 -0
- package/dist/esm/auth/profileUpdates.js +6 -0
- package/dist/esm/backend/index.d.ts +121 -3
- package/dist/esm/backend/index.test.js +58 -0
- package/dist/esm/bundle/index.d.ts +8 -0
- package/dist/esm/bundle/index.js +8 -8
- package/dist/esm/check/index.d.ts +45 -1
- package/dist/esm/check/index.js +198 -113
- package/dist/esm/check/start/problem.d.ts +11 -0
- package/dist/esm/check/start/problem.js +1 -0
- package/dist/esm/check/start/routeTree.d.ts +9 -0
- package/dist/esm/check/start/routeTree.js +70 -0
- package/dist/esm/check/start/sourceRules.d.ts +8 -0
- package/dist/esm/check/start/sourceRules.js +1156 -0
- package/dist/esm/check/start/tsgo.d.ts +2 -0
- package/dist/esm/check/start/tsgo.js +29 -0
- package/dist/esm/cli.js +1 -1
- package/dist/esm/client/index.d.ts +24 -0
- package/dist/esm/dev/index.js +16 -6
- package/dist/esm/integrations/rules.d.ts +13 -0
- package/dist/esm/integrations/rules.js +31 -0
- package/dist/esm/integrations/rules.test.js +1 -0
- package/dist/esm/internal/appMode.d.ts +3 -0
- package/dist/esm/internal/appMode.js +10 -0
- package/dist/esm/runtime/index.d.ts +64 -25
- package/dist/esm/runtime/sendEmailParamsTypes.test-d.d.ts +1 -0
- package/dist/esm/runtime/sendEmailParamsTypes.test-d.js +31 -0
- package/dist/esm/start/aiUsage.d.ts +23 -0
- package/dist/esm/start/aiUsage.js +146 -0
- package/dist/esm/start/airtable/arrayFields.d.ts +10 -0
- package/dist/esm/start/airtable/arrayFields.js +30 -0
- package/dist/esm/start/airtable/dispatch.d.ts +54 -0
- package/dist/esm/start/airtable/dispatch.js +483 -0
- package/dist/esm/start/airtable/formulas.d.ts +70 -0
- package/dist/esm/start/airtable/formulas.js +260 -0
- package/dist/esm/start/airtable/index.d.ts +8 -0
- package/dist/esm/start/airtable/index.js +54 -0
- package/dist/esm/start/authHooks.d.ts +7 -0
- package/dist/esm/start/authHooks.js +10 -0
- package/dist/esm/start/authHooksModule.d.ts +1 -0
- package/dist/esm/start/authHooksModule.js +3 -0
- package/dist/esm/start/clientErrorMessage.test.d.ts +1 -0
- package/dist/esm/start/clientErrorMessage.test.js +105 -0
- package/dist/esm/start/credentials.d.ts +2 -0
- package/dist/esm/start/credentials.js +2 -0
- package/dist/esm/start/data/baseRunner.d.ts +92 -0
- package/dist/esm/start/data/baseRunner.js +83 -0
- package/dist/esm/start/data/dispatch.d.ts +16 -0
- package/dist/esm/start/data/dispatch.js +198 -0
- package/dist/esm/start/data/index.d.ts +15 -0
- package/dist/esm/start/data/index.js +58 -0
- package/dist/esm/start/data/sqlNameMappings.d.ts +58 -0
- package/dist/esm/start/data/sqlNameMappings.js +92 -0
- package/dist/esm/start/data/transformations.d.ts +97 -0
- package/dist/esm/start/data/transformations.js +262 -0
- package/dist/esm/start/data/types.d.ts +91 -0
- package/dist/esm/start/data/types.js +14 -0
- package/dist/esm/start/describe.d.ts +42 -5
- package/dist/esm/start/describe.js +77 -23
- package/dist/esm/start/entries.d.ts +10 -4
- package/dist/esm/start/entries.js +21 -5
- package/dist/esm/start/errors.d.ts +63 -0
- package/dist/esm/start/errors.js +146 -0
- package/dist/esm/start/errors.test.d.ts +1 -0
- package/dist/esm/start/errors.test.js +23 -0
- package/dist/esm/start/factories.test-d.d.ts +2 -0
- package/dist/esm/start/factories.test-d.js +20 -0
- package/dist/esm/start/host.d.ts +2 -2
- package/dist/esm/start/index.d.ts +32 -27
- package/dist/esm/start/index.js +79 -47
- package/dist/esm/start/instance.d.ts +4 -4
- package/dist/esm/start/instance.js +54 -11
- package/dist/esm/start/outbound.d.ts +11 -0
- package/dist/esm/start/outbound.js +400 -0
- package/dist/esm/start/previewClaim.d.ts +7 -0
- package/dist/esm/start/previewClaim.js +23 -0
- package/dist/esm/start/problems.js +1 -1
- package/dist/esm/start/quiet.d.ts +2 -0
- package/dist/esm/start/quiet.js +27 -0
- package/dist/esm/start/redactSecrets.d.ts +15 -0
- package/dist/esm/start/redactSecrets.js +154 -0
- package/dist/esm/start/redactSecrets.test.d.ts +1 -0
- package/dist/esm/start/redactSecrets.test.js +151 -0
- package/dist/esm/start/registration.d.ts +13 -0
- package/dist/esm/start/registration.js +21 -0
- package/dist/esm/start/registrationHash.d.ts +22 -0
- package/dist/esm/start/registrationHash.js +470 -0
- package/dist/esm/start/router.d.ts +25 -4
- package/dist/esm/start/router.js +169 -11
- package/dist/esm/start/runLog.d.ts +7 -4
- package/dist/esm/start/runLog.js +64 -6
- package/dist/esm/start/scope.d.ts +4 -4
- package/dist/esm/start/server.d.ts +40 -36
- package/dist/esm/start/server.js +322 -49
- package/dist/esm/start/steps.d.ts +28 -0
- package/dist/esm/start/steps.js +97 -0
- package/dist/esm/start/types.d.ts +179 -6
- package/dist/esm/start/version.d.ts +1 -0
- package/dist/esm/start/version.js +2 -0
- package/dist/esm/start/vite.js +91 -14
- package/dist/esm/start/worker.d.ts +6 -0
- package/dist/esm/start/worker.js +12 -0
- package/dist/esm/start/workflow.d.ts +46 -12
- package/dist/esm/start/workflow.js +10 -3
- package/dist/esm/start/workflow.test-d.js +50 -8
- package/dist/esm/start/workflowModules.js +1 -1
- package/dist/esm/start/workflowRun.d.ts +26 -8
- package/dist/esm/start/workflowRun.js +39 -8
- package/dist/esm/steps/index.d.ts +78 -0
- package/dist/esm/steps/index.js +502 -0
- package/dist/esm/steps/index.test.d.ts +1 -0
- package/dist/esm/steps/index.test.js +633 -0
- package/dist/esm/sync/index.js +2 -1
- package/dist/esm/sync/lib.d.ts +10 -3
- package/dist/esm/sync/lib.js +44 -25
- package/dist/esm/sync/lib.test.js +116 -36
- package/dist/esm/types/fields.d.ts +8 -1
- package/dist/esm/types/fields.js +6 -0
- package/dist/esm/types/tables.d.ts +16 -0
- package/dist/esm/upload/index.js +12 -2
- package/dist/esm/upload/index.test.js +39 -0
- package/dist/esm/vite/index.js +8 -3
- package/dist/esm/vite/index.test.js +10 -2
- package/package.json +37 -16
- package/dist/cjs/start/problems.d.ts +0 -19
- package/dist/cjs/start/problems.js +0 -11
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const ARRAY_VALUED_AIRTABLE_FIELD_TYPES = new Set([
|
|
3
|
+
'multipleLookupValues',
|
|
4
|
+
'multipleSelects',
|
|
5
|
+
'multipleRecordLinks',
|
|
6
|
+
'multipleCollaborators',
|
|
7
|
+
'multipleAttachments',
|
|
8
|
+
]);
|
|
9
|
+
const resultTypeOptionsSchema = z.object({
|
|
10
|
+
result: z.object({ type: z.string().optional() }).optional(),
|
|
11
|
+
});
|
|
12
|
+
export const isArrayValuedAirtableField = (field) => {
|
|
13
|
+
if (field.type === 'formula' || field.type === 'rollup') {
|
|
14
|
+
const resultType = resultTypeOptionsSchema.safeParse(field.options).data
|
|
15
|
+
?.result?.type;
|
|
16
|
+
return resultType
|
|
17
|
+
? ARRAY_VALUED_AIRTABLE_FIELD_TYPES.has(resultType)
|
|
18
|
+
: false;
|
|
19
|
+
}
|
|
20
|
+
return ARRAY_VALUED_AIRTABLE_FIELD_TYPES.has(field.type);
|
|
21
|
+
};
|
|
22
|
+
const ELEMENT_SEPARATOR = ', ';
|
|
23
|
+
export const airtableEqualsFormula = ({ field, fieldName, value, }) => {
|
|
24
|
+
if (!isArrayValuedAirtableField(field)) {
|
|
25
|
+
return `${fieldName}=${value}`;
|
|
26
|
+
}
|
|
27
|
+
const needle = `"${ELEMENT_SEPARATOR}" & ${value} & "${ELEMENT_SEPARATOR}"`;
|
|
28
|
+
const haystack = `"${ELEMENT_SEPARATOR}" & ARRAYJOIN(${fieldName}) & "${ELEMENT_SEPARATOR}"`;
|
|
29
|
+
return `SEARCH(${needle}, ${haystack}) != ""`;
|
|
30
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** As `@fillout/zite`'s `IntegrationFieldMappingType`, from zite.lock. */
|
|
2
|
+
export type AirtableFieldMapping = {
|
|
3
|
+
mapping: {
|
|
4
|
+
sdkName: string;
|
|
5
|
+
};
|
|
6
|
+
fieldType?: string;
|
|
7
|
+
fieldName?: string;
|
|
8
|
+
fieldOptions?: Record<string, unknown>;
|
|
9
|
+
};
|
|
10
|
+
export type AirtableFieldMappings = Record<string, AirtableFieldMapping>;
|
|
11
|
+
export type AirtableNameMappings = {
|
|
12
|
+
bases: Record<string, {
|
|
13
|
+
mapping: {
|
|
14
|
+
sdkName: string;
|
|
15
|
+
};
|
|
16
|
+
tables: Record<string, {
|
|
17
|
+
mapping: {
|
|
18
|
+
sdkName: string;
|
|
19
|
+
};
|
|
20
|
+
primaryFieldId?: string;
|
|
21
|
+
fields: AirtableFieldMappings;
|
|
22
|
+
}>;
|
|
23
|
+
}>;
|
|
24
|
+
};
|
|
25
|
+
/** An app's Airtable integration as its build declares it. */
|
|
26
|
+
export type AirtableSettings = {
|
|
27
|
+
baseId: string;
|
|
28
|
+
nameMappings: AirtableNameMappings | null;
|
|
29
|
+
};
|
|
30
|
+
/** Answers one Airtable request; the platform puts the connection's token on it. */
|
|
31
|
+
export type AirtableFetch = (path: string, init: {
|
|
32
|
+
method: string;
|
|
33
|
+
body?: unknown;
|
|
34
|
+
}) => Promise<Response>;
|
|
35
|
+
export type AirtableContext = {
|
|
36
|
+
settings: AirtableSettings;
|
|
37
|
+
fetch: AirtableFetch;
|
|
38
|
+
/** One request's reads, so the same read twice in a request goes to Airtable once. */
|
|
39
|
+
reads?: Map<string, Promise<unknown>>;
|
|
40
|
+
sleep?: (ms: number) => Promise<void>;
|
|
41
|
+
};
|
|
42
|
+
/** The npm SDK's error, whose shape apps (and the goldens) see: not an `Error`. */
|
|
43
|
+
export declare class AirtableError {
|
|
44
|
+
error: string;
|
|
45
|
+
message: string;
|
|
46
|
+
statusCode: number;
|
|
47
|
+
constructor(error: string, message: string, statusCode: number);
|
|
48
|
+
toString(): string;
|
|
49
|
+
}
|
|
50
|
+
export declare function airtableRecordToSdkNames(record: Record<string, any> | undefined, fieldMappings: AirtableFieldMappings | undefined): Record<string, any> | undefined;
|
|
51
|
+
/** A Duration cell (seconds) as HH:mm:ss, keeping seconds and fractions (ZIT-3889). */
|
|
52
|
+
export declare function formatAirtableDuration(durationSeconds: number): string;
|
|
53
|
+
/** One Airtable table call, as classic's dispatch runs it. */
|
|
54
|
+
export declare function executeAirtableCall(context: AirtableContext, methodName: string, params: any): Promise<any>;
|
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
// Ported from restly's apps/cloudflare-lambda/src/integrations/airtable.ts (`executeAirtableCall`), classic's
|
|
2
|
+
// dispatch, with a fetch client in place of the npm SDK. Keep the two in step. Differences: fields come back by id
|
|
3
|
+
// from every request, so a rename since the lock never unmaps one; the schema is the lock's (`nameMappings`), as the
|
|
4
|
+
// build bakes it; the per-base limiter is gone.
|
|
5
|
+
import { filtersToFormula as buildFiltersFormula, isRecordId } from "./formulas.js";
|
|
6
|
+
const SDK_ID_FIELD = "id";
|
|
7
|
+
const UNIQUE_RECORD_ID_KEY = "recordID";
|
|
8
|
+
const AIRTABLE_BATCH_SIZE = 10;
|
|
9
|
+
/** The npm SDK's error, whose shape apps (and the goldens) see: not an `Error`. */
|
|
10
|
+
export class AirtableError {
|
|
11
|
+
error;
|
|
12
|
+
message;
|
|
13
|
+
statusCode;
|
|
14
|
+
constructor(error, message, statusCode) {
|
|
15
|
+
this.error = error;
|
|
16
|
+
this.message = message;
|
|
17
|
+
this.statusCode = statusCode;
|
|
18
|
+
}
|
|
19
|
+
toString() {
|
|
20
|
+
return [this.message, "(", this.error, ")", this.statusCode ? `[Http code ${this.statusCode}]` : ""].join("");
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
// =============================================================================
|
|
24
|
+
// Field mapping
|
|
25
|
+
// =============================================================================
|
|
26
|
+
const sdkNameToFieldId = (fieldMappings) => {
|
|
27
|
+
const map = {};
|
|
28
|
+
for (const [fieldId, info] of Object.entries(fieldMappings ?? {})) {
|
|
29
|
+
if (info?.mapping?.sdkName)
|
|
30
|
+
map[info.mapping.sdkName] = fieldId;
|
|
31
|
+
}
|
|
32
|
+
return map;
|
|
33
|
+
};
|
|
34
|
+
const fieldIdToSdkName = (fieldMappings) => {
|
|
35
|
+
const map = {};
|
|
36
|
+
for (const [fieldId, info] of Object.entries(fieldMappings ?? {})) {
|
|
37
|
+
if (info?.mapping?.sdkName)
|
|
38
|
+
map[fieldId] = info.mapping.sdkName;
|
|
39
|
+
}
|
|
40
|
+
return map;
|
|
41
|
+
};
|
|
42
|
+
function transformFiltersToFieldIds(filters, fieldMappings) {
|
|
43
|
+
if (!filters || !fieldMappings)
|
|
44
|
+
return filters;
|
|
45
|
+
const ids = sdkNameToFieldId(fieldMappings);
|
|
46
|
+
const result = {};
|
|
47
|
+
for (const [key, value] of Object.entries(filters)) {
|
|
48
|
+
result[key === "id" || key === SDK_ID_FIELD ? key : (ids[key] ?? key)] = value;
|
|
49
|
+
}
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
function transformRecordToFieldIds(record, fieldMappings) {
|
|
53
|
+
if (!record || !fieldMappings)
|
|
54
|
+
return record;
|
|
55
|
+
const ids = sdkNameToFieldId(fieldMappings);
|
|
56
|
+
const result = {};
|
|
57
|
+
for (const [key, value] of Object.entries(record)) {
|
|
58
|
+
if (key === "id" || key === SDK_ID_FIELD || key === UNIQUE_RECORD_ID_KEY)
|
|
59
|
+
continue;
|
|
60
|
+
result[ids[key] ?? key] = value;
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
export function airtableRecordToSdkNames(record, fieldMappings) {
|
|
65
|
+
if (!record)
|
|
66
|
+
return undefined;
|
|
67
|
+
if (!fieldMappings)
|
|
68
|
+
return record;
|
|
69
|
+
const names = fieldIdToSdkName(fieldMappings);
|
|
70
|
+
const result = {};
|
|
71
|
+
for (const [key, value] of Object.entries(record)) {
|
|
72
|
+
if (key === "id" || key === UNIQUE_RECORD_ID_KEY) {
|
|
73
|
+
result[key] = value;
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
result[names[key] ?? key] = value;
|
|
77
|
+
}
|
|
78
|
+
return result;
|
|
79
|
+
}
|
|
80
|
+
/** The table's fields as zite.lock records them; fields a legacy lock names no further are left out. */
|
|
81
|
+
const lockSchema = (tableId, table) => {
|
|
82
|
+
if (!table)
|
|
83
|
+
return undefined;
|
|
84
|
+
const fields = Object.entries(table.fields).flatMap(([id, field]) => field.fieldName
|
|
85
|
+
? [
|
|
86
|
+
{
|
|
87
|
+
id,
|
|
88
|
+
name: field.fieldName,
|
|
89
|
+
type: field.fieldType ?? "singleLineText",
|
|
90
|
+
...(field.fieldOptions ? { options: field.fieldOptions } : {}),
|
|
91
|
+
},
|
|
92
|
+
]
|
|
93
|
+
: []);
|
|
94
|
+
return fields.length ? { id: tableId, primaryFieldId: table.primaryFieldId, fields } : undefined;
|
|
95
|
+
};
|
|
96
|
+
// =============================================================================
|
|
97
|
+
// Values
|
|
98
|
+
// =============================================================================
|
|
99
|
+
/** For writes: dates, linked records, attachments, ratings, text. */
|
|
100
|
+
function processColumnValues(columnValues, tableSchema) {
|
|
101
|
+
if (!tableSchema)
|
|
102
|
+
return columnValues;
|
|
103
|
+
const result = { ...columnValues };
|
|
104
|
+
for (const columnId of Object.keys(columnValues)) {
|
|
105
|
+
const field = tableSchema.fields.find((f) => f.id === columnId || f.name === columnId);
|
|
106
|
+
if (!field)
|
|
107
|
+
continue;
|
|
108
|
+
const value = columnValues[columnId];
|
|
109
|
+
if (value === undefined || value === null)
|
|
110
|
+
continue;
|
|
111
|
+
// An empty object means an unmapped field.
|
|
112
|
+
if (typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0) {
|
|
113
|
+
result[columnId] = undefined;
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
if (field.type === "multipleRecordLinks") {
|
|
117
|
+
if (!Array.isArray(value))
|
|
118
|
+
result[columnId] = value === "" ? [] : [value];
|
|
119
|
+
}
|
|
120
|
+
else if (field.type === "date" || field.type === "dateTime") {
|
|
121
|
+
if (value === "") {
|
|
122
|
+
result[columnId] = undefined;
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
const dateValue = new Date(value);
|
|
126
|
+
if (isNaN(dateValue.getTime())) {
|
|
127
|
+
throw new Error(`Invalid date provided for field ${field.name}: ${value}`);
|
|
128
|
+
}
|
|
129
|
+
if (field.type === "date") {
|
|
130
|
+
const startOfDay = new Date(dateValue);
|
|
131
|
+
startOfDay.setUTCHours(0, 0, 0, 0);
|
|
132
|
+
result[columnId] = startOfDay.toISOString();
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
result[columnId] = dateValue.toISOString();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
else if (field.type === "multipleAttachments") {
|
|
140
|
+
if (Array.isArray(value) && value.length !== 0) {
|
|
141
|
+
const attachments = value
|
|
142
|
+
.map((v) => {
|
|
143
|
+
if (!v || typeof v !== "object" || !v.url)
|
|
144
|
+
return undefined;
|
|
145
|
+
return { url: v.url, filename: v.filename || v.url.split("/").pop() };
|
|
146
|
+
})
|
|
147
|
+
.filter((v) => v !== undefined);
|
|
148
|
+
if (attachments.length > 0)
|
|
149
|
+
result[columnId] = attachments;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
else if (field.type === "rating") {
|
|
153
|
+
const max = field.options?.max;
|
|
154
|
+
if (max && typeof value === "number" && value > max) {
|
|
155
|
+
throw new Error(`Value ${value} surpasses Airtable max value setting on the rating field "${field.name}"`);
|
|
156
|
+
}
|
|
157
|
+
if (typeof value === "number" && value <= 0)
|
|
158
|
+
result[columnId] = undefined;
|
|
159
|
+
}
|
|
160
|
+
else if (field.type === "singleLineText" || field.type === "multilineText") {
|
|
161
|
+
if (Array.isArray(value))
|
|
162
|
+
result[columnId] = value.join(", ");
|
|
163
|
+
else if (typeof value !== "string")
|
|
164
|
+
result[columnId] = String(value);
|
|
165
|
+
}
|
|
166
|
+
else if (field.type === "barcode") {
|
|
167
|
+
result[columnId] = String(value);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return result;
|
|
171
|
+
}
|
|
172
|
+
/** A Duration cell (seconds) as HH:mm:ss, keeping seconds and fractions (ZIT-3889). */
|
|
173
|
+
export function formatAirtableDuration(durationSeconds) {
|
|
174
|
+
const duration = Math.abs(durationSeconds);
|
|
175
|
+
const pad = (n) => (n < 10 ? `0${n}` : `${n}`);
|
|
176
|
+
const hours = Math.floor(duration / 3600);
|
|
177
|
+
const minutes = Math.floor((duration % 3600) / 60);
|
|
178
|
+
const seconds = Math.floor(duration % 60);
|
|
179
|
+
const milliseconds = Math.round((duration % 1) * 1000);
|
|
180
|
+
const fraction = milliseconds > 0 ? `.${`${milliseconds}`.padStart(3, "0").replace(/0+$/, "")}` : "";
|
|
181
|
+
return `${durationSeconds < 0 ? "-" : ""}${pad(hours)}:${pad(minutes)}:${pad(seconds)}${fraction}`;
|
|
182
|
+
}
|
|
183
|
+
const isErrorObject = (value) => typeof value === "object" && value !== null && typeof value.error === "string";
|
|
184
|
+
const isNaNValue = (value) => typeof value === "object" && value !== null && value.specialValue === "NaN";
|
|
185
|
+
/** For reads: durations, barcodes, AI text, buttons, broken formulas and rollups. */
|
|
186
|
+
function getRecordFields(rawRecord, tableSchema) {
|
|
187
|
+
const fields = { ...rawRecord.fields };
|
|
188
|
+
if (tableSchema) {
|
|
189
|
+
for (const fieldId of Object.keys(fields)) {
|
|
190
|
+
const value = fields[fieldId];
|
|
191
|
+
const field = tableSchema.fields.find((f) => f.id === fieldId);
|
|
192
|
+
if (!field)
|
|
193
|
+
continue;
|
|
194
|
+
if (field.type === "multilineText" || field.type === "richText") {
|
|
195
|
+
if (value === "\n")
|
|
196
|
+
fields[fieldId] = "";
|
|
197
|
+
}
|
|
198
|
+
else if (field.type === "barcode" && value && typeof value === "object") {
|
|
199
|
+
fields[fieldId] = value.text || "";
|
|
200
|
+
}
|
|
201
|
+
else if (field.type === "duration" && typeof value === "number") {
|
|
202
|
+
fields[fieldId] = formatAirtableDuration(value);
|
|
203
|
+
}
|
|
204
|
+
else if (field.type === "button" && value && typeof value === "object") {
|
|
205
|
+
fields[fieldId] = value.url;
|
|
206
|
+
}
|
|
207
|
+
else if (field.type === "aiText" && value && typeof value === "object") {
|
|
208
|
+
const text = value.value;
|
|
209
|
+
fields[fieldId] = text !== undefined && text !== null && text !== "" ? text : undefined;
|
|
210
|
+
}
|
|
211
|
+
else if (field.type === "formula") {
|
|
212
|
+
const numeric = field.options?.result?.type === "number";
|
|
213
|
+
if ((numeric && typeof value !== "number") || isNaNValue(value) || isErrorObject(value)) {
|
|
214
|
+
fields[fieldId] = undefined;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
else if (field.type === "rollup") {
|
|
218
|
+
const numeric = field.options?.rollup?.type === "number";
|
|
219
|
+
if ((numeric && typeof value !== "number") || isNaNValue(value) || isErrorObject(value) || value === null) {
|
|
220
|
+
fields[fieldId] = undefined;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return { ...fields, [UNIQUE_RECORD_ID_KEY]: rawRecord.id, id: rawRecord.id };
|
|
226
|
+
}
|
|
227
|
+
// =============================================================================
|
|
228
|
+
// Requests
|
|
229
|
+
// =============================================================================
|
|
230
|
+
const sleepMs = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
231
|
+
// As the npm SDK raises it (`_checkStatusForError`, `_getErrorForNonObjectBody`).
|
|
232
|
+
const sdkError = async (response) => {
|
|
233
|
+
const status = response.status;
|
|
234
|
+
const body = await response.json().catch(() => undefined);
|
|
235
|
+
const { type, message } = (body?.error ?? {});
|
|
236
|
+
if (status === 401) {
|
|
237
|
+
return new AirtableError("AUTHENTICATION_REQUIRED", "You should provide valid api key to perform this operation", status);
|
|
238
|
+
}
|
|
239
|
+
if (status === 403)
|
|
240
|
+
return new AirtableError("NOT_AUTHORIZED", "You are not authorized to perform this operation", status);
|
|
241
|
+
if (status === 404)
|
|
242
|
+
return new AirtableError("NOT_FOUND", message ?? "Could not find what you are looking for", status);
|
|
243
|
+
if (status === 413)
|
|
244
|
+
return new AirtableError("REQUEST_TOO_LARGE", "Request body is too large", status);
|
|
245
|
+
if (status === 422) {
|
|
246
|
+
return new AirtableError(type ?? "UNPROCESSABLE_ENTITY", message ?? "The operation cannot be processed", status);
|
|
247
|
+
}
|
|
248
|
+
if (status === 429) {
|
|
249
|
+
return new AirtableError("TOO_MANY_REQUESTS", "You have made too many requests in a short period of time. Please retry your request later", status);
|
|
250
|
+
}
|
|
251
|
+
if (status === 500)
|
|
252
|
+
return new AirtableError("SERVER_ERROR", "Try again. If the problem persists, contact support.", status);
|
|
253
|
+
if (status === 503) {
|
|
254
|
+
return new AirtableError("SERVICE_UNAVAILABLE", "The service is temporarily unavailable. Please retry shortly.", status);
|
|
255
|
+
}
|
|
256
|
+
if (typeof body !== "object" || body === null || Array.isArray(body)) {
|
|
257
|
+
return new AirtableError("UNEXPECTED_ERROR", "The response from Airtable was invalid JSON. Please try again soon.", status);
|
|
258
|
+
}
|
|
259
|
+
return new AirtableError(type ?? "UNEXPECTED_ERROR", message ?? "An unexpected error occurred", status);
|
|
260
|
+
};
|
|
261
|
+
const MIN_RETRY_DELAY_MS = 200;
|
|
262
|
+
/** One bounded backoff on 429s, as classic's: five attempts, jittered over a doubling delay. */
|
|
263
|
+
async function withBackoff(operation, name, sleep, maxAttempts = 5, startingDelay = 1000, maxDelay = 600_000) {
|
|
264
|
+
let attempt = 0;
|
|
265
|
+
let delay = startingDelay;
|
|
266
|
+
while (attempt < maxAttempts) {
|
|
267
|
+
try {
|
|
268
|
+
return await operation();
|
|
269
|
+
}
|
|
270
|
+
catch (error) {
|
|
271
|
+
const rateLimited = error?.statusCode === 429 ||
|
|
272
|
+
error?.status === 429 ||
|
|
273
|
+
error?.message?.includes("429") ||
|
|
274
|
+
error?.message?.toLowerCase().includes("rate limit");
|
|
275
|
+
if (!rateLimited)
|
|
276
|
+
throw error;
|
|
277
|
+
attempt++;
|
|
278
|
+
if (attempt >= maxAttempts) {
|
|
279
|
+
console.warn(`[Airtable429] ${name} attempt ${attempt}/${maxAttempts}: max retries exhausted, giving up`);
|
|
280
|
+
throw Object.assign(new Error("Airtable rate limit exceeded after maximum retries"), {
|
|
281
|
+
status: 429,
|
|
282
|
+
originalError: error,
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
const jittered = MIN_RETRY_DELAY_MS + Math.floor(Math.random() * (delay - MIN_RETRY_DELAY_MS));
|
|
286
|
+
console.warn(`[Airtable429] ${name} attempt ${attempt}/${maxAttempts}: retrying in ${jittered}ms`);
|
|
287
|
+
await sleep(jittered);
|
|
288
|
+
delay = Math.min(delay * 2, maxDelay);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
throw new Error("Unexpected end of Airtable backoff loop");
|
|
292
|
+
}
|
|
293
|
+
const segment = (id) => encodeURIComponent(id);
|
|
294
|
+
// A record id is a path segment, where `..` would reach past the table, to another one. A linked record's value is a
|
|
295
|
+
// one-item list of its id, which stands for it.
|
|
296
|
+
function asRecordId(id) {
|
|
297
|
+
const single = Array.isArray(id) && id.length === 1 ? id[0] : id;
|
|
298
|
+
return isRecordId(single) ? single : undefined;
|
|
299
|
+
}
|
|
300
|
+
function recordIdFor(action, id) {
|
|
301
|
+
const recordId = asRecordId(id);
|
|
302
|
+
if (!recordId)
|
|
303
|
+
throw new Error(`Can't ${action} Airtable record ${JSON.stringify(id)}: it isn't a record id.`);
|
|
304
|
+
return recordId;
|
|
305
|
+
}
|
|
306
|
+
// =============================================================================
|
|
307
|
+
// Dispatch
|
|
308
|
+
// =============================================================================
|
|
309
|
+
/** One Airtable table call, as classic's dispatch runs it. */
|
|
310
|
+
export async function executeAirtableCall(context, methodName, params) {
|
|
311
|
+
const tableId = params?.tableId;
|
|
312
|
+
if (!tableId)
|
|
313
|
+
throw new Error("Airtable calls require tableId in params");
|
|
314
|
+
const baseId = context.settings.baseId || params.baseId;
|
|
315
|
+
if (!baseId)
|
|
316
|
+
throw new Error("Airtable calls require baseId (from integration settings or params)");
|
|
317
|
+
const tables = context.settings.nameMappings?.bases?.[baseId]?.tables;
|
|
318
|
+
const fieldMappings = tables?.[tableId]?.fields;
|
|
319
|
+
const tableSchema = lockSchema(tableId, tables?.[tableId]);
|
|
320
|
+
const sleep = context.sleep ?? sleepMs;
|
|
321
|
+
const tablePath = `/v0/${segment(baseId)}/${segment(tableId)}`;
|
|
322
|
+
// A write makes any read this request already made stale.
|
|
323
|
+
const send = async (path, init) => {
|
|
324
|
+
if (init.method !== "GET" && !path.endsWith("/listRecords"))
|
|
325
|
+
context.reads?.clear();
|
|
326
|
+
return context.fetch(path, init);
|
|
327
|
+
};
|
|
328
|
+
const read = (key, load) => {
|
|
329
|
+
if (!context.reads)
|
|
330
|
+
return load();
|
|
331
|
+
const held = context.reads.get(key);
|
|
332
|
+
if (held)
|
|
333
|
+
return held;
|
|
334
|
+
const loading = load();
|
|
335
|
+
context.reads.set(key, loading);
|
|
336
|
+
loading.catch(() => context.reads?.delete(key));
|
|
337
|
+
return loading;
|
|
338
|
+
};
|
|
339
|
+
const getRecord = (recordTableId, recordId) => read(`get:${baseId}:${recordTableId}:${recordId}`, async () => {
|
|
340
|
+
const response = await send(`/v0/${segment(baseId)}/${segment(recordTableId)}/${segment(recordId)}?returnFieldsByFieldId=true`, { method: "GET" });
|
|
341
|
+
if (!response.ok)
|
|
342
|
+
throw await sdkError(response);
|
|
343
|
+
return (await response.json());
|
|
344
|
+
});
|
|
345
|
+
const filterFormula = async (filters) => {
|
|
346
|
+
if (!filters || Object.keys(filters).length === 0)
|
|
347
|
+
return undefined;
|
|
348
|
+
const transformed = transformFiltersToFieldIds(filters, fieldMappings);
|
|
349
|
+
if (!transformed)
|
|
350
|
+
return undefined;
|
|
351
|
+
// A linked-record filter names the record by its primary field, which costs a lookup each.
|
|
352
|
+
const getPrimaryFieldForRecord = async (linkedTableId, recordId) => {
|
|
353
|
+
try {
|
|
354
|
+
const record = await withBackoff(() => getRecord(linkedTableId, recordId), "linkedRecord", sleep);
|
|
355
|
+
const primaryFieldId = tables?.[linkedTableId]?.primaryFieldId;
|
|
356
|
+
const value = primaryFieldId !== undefined ? record.fields[primaryFieldId] : Object.values(record.fields)[0];
|
|
357
|
+
return value !== undefined && value !== null ? String(value) : undefined;
|
|
358
|
+
}
|
|
359
|
+
catch {
|
|
360
|
+
return undefined;
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
return buildFiltersFormula({
|
|
364
|
+
filters: transformed,
|
|
365
|
+
tableSchema: tableSchema,
|
|
366
|
+
getPrimaryFieldForRecord,
|
|
367
|
+
});
|
|
368
|
+
};
|
|
369
|
+
const toSdk = (record) => airtableRecordToSdkNames(getRecordFields(record, tableSchema), fieldMappings);
|
|
370
|
+
switch (methodName) {
|
|
371
|
+
case "findOne": {
|
|
372
|
+
const { id, filters } = params;
|
|
373
|
+
if (id) {
|
|
374
|
+
// Any other id names no record, and in the path could name another table's.
|
|
375
|
+
const recordId = asRecordId(id);
|
|
376
|
+
if (!recordId)
|
|
377
|
+
return undefined;
|
|
378
|
+
return withBackoff(async () => {
|
|
379
|
+
try {
|
|
380
|
+
return toSdk(await getRecord(tableId, recordId));
|
|
381
|
+
}
|
|
382
|
+
catch (error) {
|
|
383
|
+
// A missing record is no record; 401 and 403 go up, where the platform refreshes a token.
|
|
384
|
+
if (error?.statusCode === 404)
|
|
385
|
+
return undefined;
|
|
386
|
+
throw error;
|
|
387
|
+
}
|
|
388
|
+
}, "findOne", sleep);
|
|
389
|
+
}
|
|
390
|
+
const filterByFormula = await filterFormula(filters);
|
|
391
|
+
return withBackoff(async () => {
|
|
392
|
+
const list = await listRecords({ maxRecords: 1, ...(filterByFormula ? { filterByFormula } : {}) });
|
|
393
|
+
return list.records.length === 0 ? undefined : toSdk(list.records[0]);
|
|
394
|
+
}, "findOne", sleep);
|
|
395
|
+
}
|
|
396
|
+
case "findAll": {
|
|
397
|
+
const { filters, limit, offset } = params;
|
|
398
|
+
const filterByFormula = await filterFormula(filters);
|
|
399
|
+
return withBackoff(async () => {
|
|
400
|
+
const json = await listRecords({
|
|
401
|
+
...(filterByFormula ? { filterByFormula } : {}),
|
|
402
|
+
...(limit ? { pageSize: limit } : {}),
|
|
403
|
+
...(offset ? { offset } : {}),
|
|
404
|
+
});
|
|
405
|
+
return {
|
|
406
|
+
records: (json.records || []).map(toSdk).filter((r) => r !== undefined),
|
|
407
|
+
offset: json.offset,
|
|
408
|
+
hasMore: json.offset !== undefined,
|
|
409
|
+
};
|
|
410
|
+
}, "findAll", sleep);
|
|
411
|
+
}
|
|
412
|
+
case "create": {
|
|
413
|
+
const { record } = params;
|
|
414
|
+
if (!record)
|
|
415
|
+
return undefined;
|
|
416
|
+
return withBackoff(async () => {
|
|
417
|
+
const fields = processColumnValues(transformRecordToFieldIds(record, fieldMappings) || record, tableSchema);
|
|
418
|
+
const [created] = await writeRecords("POST", [{ fields }]);
|
|
419
|
+
return toSdk(created);
|
|
420
|
+
}, "create", sleep);
|
|
421
|
+
}
|
|
422
|
+
case "bulkCreate": {
|
|
423
|
+
const { records } = params;
|
|
424
|
+
if (!records || records.length === 0)
|
|
425
|
+
return [];
|
|
426
|
+
// Airtable takes at most 10 records a request.
|
|
427
|
+
const prepared = records.map((r) => ({
|
|
428
|
+
fields: processColumnValues(transformRecordToFieldIds(r, fieldMappings) || r, tableSchema),
|
|
429
|
+
}));
|
|
430
|
+
const results = [];
|
|
431
|
+
for (let i = 0; i < prepared.length; i += AIRTABLE_BATCH_SIZE) {
|
|
432
|
+
const created = await withBackoff(() => writeRecords("POST", prepared.slice(i, i + AIRTABLE_BATCH_SIZE)), "bulkCreate", sleep);
|
|
433
|
+
for (const r of created)
|
|
434
|
+
results.push(toSdk(r));
|
|
435
|
+
}
|
|
436
|
+
return results;
|
|
437
|
+
}
|
|
438
|
+
case "update": {
|
|
439
|
+
const { id, record } = params;
|
|
440
|
+
if (!id || !record)
|
|
441
|
+
return undefined;
|
|
442
|
+
const recordId = recordIdFor("update", id);
|
|
443
|
+
return withBackoff(async () => {
|
|
444
|
+
const fields = processColumnValues(transformRecordToFieldIds(record, fieldMappings) || record, tableSchema);
|
|
445
|
+
const [updated] = await writeRecords("PATCH", [{ id: recordId, fields }]);
|
|
446
|
+
return { id: recordId, fields: toSdk(updated) };
|
|
447
|
+
}, "update", sleep);
|
|
448
|
+
}
|
|
449
|
+
case "delete": {
|
|
450
|
+
const { id } = params;
|
|
451
|
+
if (!id)
|
|
452
|
+
throw new Error("Delete requires id parameter");
|
|
453
|
+
const recordId = recordIdFor("delete", id);
|
|
454
|
+
return withBackoff(async () => {
|
|
455
|
+
const response = await send(`${tablePath}/${segment(recordId)}`, { method: "DELETE" });
|
|
456
|
+
if (!response.ok)
|
|
457
|
+
throw await sdkError(response);
|
|
458
|
+
const deleted = (await response.json());
|
|
459
|
+
return { success: true, id: deleted.id };
|
|
460
|
+
}, "delete", sleep);
|
|
461
|
+
}
|
|
462
|
+
default:
|
|
463
|
+
throw new Error(`Unknown Airtable method: ${methodName}`);
|
|
464
|
+
}
|
|
465
|
+
async function listRecords(body) {
|
|
466
|
+
const request = { returnFieldsByFieldId: true, ...body };
|
|
467
|
+
return read(`list:${baseId}:${tableId}:${JSON.stringify(request)}`, async () => {
|
|
468
|
+
const response = await send(`${tablePath}/listRecords`, { method: "POST", body: request });
|
|
469
|
+
if (!response.ok) {
|
|
470
|
+
const error = new Error(`Airtable API error: ${await response.text()}`);
|
|
471
|
+
error.statusCode = response.status;
|
|
472
|
+
throw error;
|
|
473
|
+
}
|
|
474
|
+
return (await response.json());
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
async function writeRecords(method, records) {
|
|
478
|
+
const response = await send(tablePath, { method, body: { records, typecast: true, returnFieldsByFieldId: true } });
|
|
479
|
+
if (!response.ok)
|
|
480
|
+
throw await sdkError(response);
|
|
481
|
+
return (await response.json()).records;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { AirtableFieldShape } from './arrayFields.js';
|
|
3
|
+
/**
|
|
4
|
+
* Supported filter operators for Airtable queries
|
|
5
|
+
*/
|
|
6
|
+
export declare const WhereConditionOperators: z.ZodEnum<{
|
|
7
|
+
in: "in";
|
|
8
|
+
not: "not";
|
|
9
|
+
contains: "contains";
|
|
10
|
+
gt: "gt";
|
|
11
|
+
gte: "gte";
|
|
12
|
+
lt: "lt";
|
|
13
|
+
lte: "lte";
|
|
14
|
+
notIn: "notIn";
|
|
15
|
+
ilike: "ilike";
|
|
16
|
+
}>;
|
|
17
|
+
export type WhereConditionOperatorType = z.infer<typeof WhereConditionOperators>;
|
|
18
|
+
/**
|
|
19
|
+
* Check if a key is a condition operator
|
|
20
|
+
*/
|
|
21
|
+
export declare const isConditionOperator: (key: string) => key is WhereConditionOperatorType;
|
|
22
|
+
/**
|
|
23
|
+
* Check if a value is a nested condition object (e.g., { contains: 'value' })
|
|
24
|
+
*/
|
|
25
|
+
export declare const isNestedCondition: (value: unknown) => value is Partial<Record<WhereConditionOperatorType, unknown>>;
|
|
26
|
+
/**
|
|
27
|
+
* Check if a string is a valid Airtable record ID
|
|
28
|
+
*/
|
|
29
|
+
export declare const isValidRecordId: (value: unknown) => value is string;
|
|
30
|
+
export declare const isRecordId: (value: unknown) => value is string;
|
|
31
|
+
export type FiltersToFormulaOptions = {
|
|
32
|
+
/**
|
|
33
|
+
* Filters object with field names as keys.
|
|
34
|
+
* Values can be direct values (equality) or operator objects like { contains: 'value' }
|
|
35
|
+
*/
|
|
36
|
+
filters: Record<string, unknown> | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Table schema for field lookups (optional).
|
|
39
|
+
* If provided, field IDs will be resolved to field names.
|
|
40
|
+
*/
|
|
41
|
+
tableSchema?: {
|
|
42
|
+
fields: Array<AirtableFieldShape & {
|
|
43
|
+
id: string;
|
|
44
|
+
name: string;
|
|
45
|
+
}>;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Callback to resolve a linked record ID to its primary field value.
|
|
49
|
+
* Required for filtering on multipleRecordLinks fields by record ID.
|
|
50
|
+
*/
|
|
51
|
+
getPrimaryFieldForRecord?: (tableId: string, recordId: string) => Promise<string | undefined>;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Convert filters to Airtable filterByFormula string.
|
|
55
|
+
*
|
|
56
|
+
* Supports operators: contains, not, in, notIn, lt, lte, gt, gte, ilike
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* // Equality
|
|
60
|
+
* { name: 'John' } -> {Name}="John"
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* // Contains
|
|
64
|
+
* { name: { contains: 'john' } } -> SEARCH("john", {Name}) != ""
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* // Multiple conditions
|
|
68
|
+
* { status: 'active', age: { gte: 18 } } -> AND({Status}="active", {Age}>=18)
|
|
69
|
+
*/
|
|
70
|
+
export declare const filtersToFormula: ({ filters, tableSchema, getPrimaryFieldForRecord, }: FiltersToFormulaOptions) => Promise<string | undefined>;
|