@zapier/zapier-sdk 0.35.0 → 0.36.0
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/CHANGELOG.md +6 -0
- package/dist/constants.d.ts +4 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +4 -0
- package/dist/index.cjs +114 -44
- package/dist/index.d.mts +7 -1
- package/dist/index.mjs +112 -45
- package/dist/plugins/listActions/index.d.ts.map +1 -1
- package/dist/plugins/listActions/index.js +2 -1
- package/dist/plugins/listApps/index.d.ts.map +1 -1
- package/dist/plugins/listApps/index.js +5 -2
- package/dist/plugins/listClientCredentials/index.d.ts.map +1 -1
- package/dist/plugins/listClientCredentials/index.js +6 -4
- package/dist/plugins/listConnections/index.d.ts.map +1 -1
- package/dist/plugins/listConnections/index.js +6 -4
- package/dist/plugins/listInputFieldChoices/index.d.ts.map +1 -1
- package/dist/plugins/listInputFieldChoices/index.js +2 -1
- package/dist/plugins/listInputFields/index.d.ts.map +1 -1
- package/dist/plugins/listInputFields/index.js +2 -1
- package/dist/plugins/runAction/index.d.ts +2 -0
- package/dist/plugins/runAction/index.d.ts.map +1 -1
- package/dist/plugins/runAction/index.js +73 -14
- package/dist/plugins/tables/listTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/listTableRecords/index.js +6 -4
- package/dist/plugins/tables/listTables/index.d.ts.map +1 -1
- package/dist/plugins/tables/listTables/index.js +6 -4
- package/dist/utils/function-utils.d.ts +2 -2
- package/dist/utils/function-utils.d.ts.map +1 -1
- package/dist/utils/function-utils.js +2 -3
- package/package.json +6 -1
package/CHANGELOG.md
CHANGED
package/dist/constants.d.ts
CHANGED
|
@@ -11,6 +11,10 @@ export declare const ZAPIER_BASE_URL: string;
|
|
|
11
11
|
* Maximum number of items that can be requested per page across all paginated functions
|
|
12
12
|
*/
|
|
13
13
|
export declare const MAX_PAGE_LIMIT = 10000;
|
|
14
|
+
/**
|
|
15
|
+
* Default number of items per page for paginated functions
|
|
16
|
+
*/
|
|
17
|
+
export declare const DEFAULT_PAGE_SIZE = 100;
|
|
14
18
|
/**
|
|
15
19
|
* Default timeout for action execution (in milliseconds)
|
|
16
20
|
*/
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe,QACyB,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,cAAc,QAAQ,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,yBAAyB,SAAU,CAAC;AAejD;;GAEG;AACH,eAAO,MAAM,0BAA0B,QACY,CAAC;AACpD,eAAO,MAAM,iCAAiC,QACiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe,QACyB,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,cAAc,QAAQ,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,yBAAyB,SAAU,CAAC;AAejD;;GAEG;AACH,eAAO,MAAM,0BAA0B,QACY,CAAC;AACpD,eAAO,MAAM,iCAAiC,QACiB,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -11,6 +11,10 @@ export const ZAPIER_BASE_URL = process.env.ZAPIER_BASE_URL || "https://zapier.co
|
|
|
11
11
|
* Maximum number of items that can be requested per page across all paginated functions
|
|
12
12
|
*/
|
|
13
13
|
export const MAX_PAGE_LIMIT = 10000;
|
|
14
|
+
/**
|
|
15
|
+
* Default number of items per page for paginated functions
|
|
16
|
+
*/
|
|
17
|
+
export const DEFAULT_PAGE_SIZE = 100;
|
|
14
18
|
/**
|
|
15
19
|
* Default timeout for action execution (in milliseconds)
|
|
16
20
|
*/
|
package/dist/index.cjs
CHANGED
|
@@ -64,6 +64,7 @@ function isPositional(schema) {
|
|
|
64
64
|
// src/constants.ts
|
|
65
65
|
var ZAPIER_BASE_URL = process.env.ZAPIER_BASE_URL || "https://zapier.com";
|
|
66
66
|
var MAX_PAGE_LIMIT = 1e4;
|
|
67
|
+
var DEFAULT_PAGE_SIZE = 100;
|
|
67
68
|
var DEFAULT_ACTION_TIMEOUT_MS = 18e4;
|
|
68
69
|
function parseIntEnvVar(name) {
|
|
69
70
|
const value = process.env[name];
|
|
@@ -1044,7 +1045,7 @@ function createPageFunction(coreFn) {
|
|
|
1044
1045
|
};
|
|
1045
1046
|
return namedFunctions[functionName];
|
|
1046
1047
|
}
|
|
1047
|
-
function createPaginatedFunction(coreFn, schema, telemetry, explicitFunctionName) {
|
|
1048
|
+
function createPaginatedFunction(coreFn, schema, telemetry, explicitFunctionName, defaultPageSize) {
|
|
1048
1049
|
const pageFunction = createPageFunction(coreFn);
|
|
1049
1050
|
const functionName = explicitFunctionName || coreFn.name;
|
|
1050
1051
|
const validator = schema ? createValidator(schema) : null;
|
|
@@ -1058,7 +1059,7 @@ function createPaginatedFunction(coreFn, schema, telemetry, explicitFunctionName
|
|
|
1058
1059
|
...normalizedOptions,
|
|
1059
1060
|
...validator ? validator(normalizedOptions) : normalizedOptions
|
|
1060
1061
|
};
|
|
1061
|
-
const pageSize = validatedOptions.pageSize
|
|
1062
|
+
const pageSize = validatedOptions.pageSize ?? defaultPageSize;
|
|
1062
1063
|
const optimizedOptions = {
|
|
1063
1064
|
...validatedOptions,
|
|
1064
1065
|
pageSize
|
|
@@ -1232,7 +1233,9 @@ var listAppsPlugin = ({ context }) => {
|
|
|
1232
1233
|
searchParams: {
|
|
1233
1234
|
appKeys: implementationIds.join(","),
|
|
1234
1235
|
...options.search && { search: options.search },
|
|
1235
|
-
|
|
1236
|
+
...options.pageSize !== void 0 && {
|
|
1237
|
+
pageSize: options.pageSize.toString()
|
|
1238
|
+
},
|
|
1236
1239
|
...options.cursor && { offset: options.cursor }
|
|
1237
1240
|
}
|
|
1238
1241
|
});
|
|
@@ -1242,7 +1245,8 @@ var listAppsPlugin = ({ context }) => {
|
|
|
1242
1245
|
listAppsPage,
|
|
1243
1246
|
ListAppsSchema,
|
|
1244
1247
|
createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName),
|
|
1245
|
-
methodName
|
|
1248
|
+
methodName,
|
|
1249
|
+
DEFAULT_PAGE_SIZE
|
|
1246
1250
|
);
|
|
1247
1251
|
return {
|
|
1248
1252
|
listApps: listAppsDefinition,
|
|
@@ -2623,7 +2627,8 @@ var listActionsPlugin = ({ context }) => {
|
|
|
2623
2627
|
listActionsPage,
|
|
2624
2628
|
ListActionsSchema,
|
|
2625
2629
|
createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName),
|
|
2626
|
-
methodName
|
|
2630
|
+
methodName,
|
|
2631
|
+
DEFAULT_PAGE_SIZE
|
|
2627
2632
|
);
|
|
2628
2633
|
return {
|
|
2629
2634
|
listActions: listActionsDefinition,
|
|
@@ -2980,7 +2985,8 @@ var listInputFieldsPlugin = ({ sdk, context }) => {
|
|
|
2980
2985
|
listInputFieldsPage,
|
|
2981
2986
|
ListInputFieldsSchema,
|
|
2982
2987
|
createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName),
|
|
2983
|
-
methodName
|
|
2988
|
+
methodName,
|
|
2989
|
+
DEFAULT_PAGE_SIZE
|
|
2984
2990
|
);
|
|
2985
2991
|
return {
|
|
2986
2992
|
listInputFields: listInputFieldsDefinition,
|
|
@@ -3066,9 +3072,10 @@ var ConnectionItemSchema = withFormatter(connections.ConnectionItemSchema, {
|
|
|
3066
3072
|
var listConnectionsPlugin = ({ context }) => {
|
|
3067
3073
|
async function listConnectionsPage(options) {
|
|
3068
3074
|
const { api, getVersionedImplementationId } = context;
|
|
3069
|
-
const searchParams = {
|
|
3070
|
-
|
|
3071
|
-
|
|
3075
|
+
const searchParams = {};
|
|
3076
|
+
if (options.pageSize !== void 0) {
|
|
3077
|
+
searchParams.page_size = options.pageSize.toString();
|
|
3078
|
+
}
|
|
3072
3079
|
if (options.appKey) {
|
|
3073
3080
|
const implementationId = await getVersionedImplementationId(
|
|
3074
3081
|
options.appKey
|
|
@@ -3132,7 +3139,8 @@ var listConnectionsPlugin = ({ context }) => {
|
|
|
3132
3139
|
listConnectionsPage,
|
|
3133
3140
|
ListConnectionsQuerySchema,
|
|
3134
3141
|
createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName),
|
|
3135
|
-
methodName
|
|
3142
|
+
methodName,
|
|
3143
|
+
DEFAULT_PAGE_SIZE
|
|
3136
3144
|
);
|
|
3137
3145
|
return {
|
|
3138
3146
|
listConnections: listConnectionsDefinition,
|
|
@@ -3210,9 +3218,10 @@ var ClientCredentialsCreatedItemSchema = withFormatter(
|
|
|
3210
3218
|
var listClientCredentialsPlugin = ({ context }) => {
|
|
3211
3219
|
async function listClientCredentialsPage(options) {
|
|
3212
3220
|
const { api } = context;
|
|
3213
|
-
const searchParams = {
|
|
3214
|
-
|
|
3215
|
-
|
|
3221
|
+
const searchParams = {};
|
|
3222
|
+
if (options.pageSize !== void 0) {
|
|
3223
|
+
searchParams.pageSize = options.pageSize.toString();
|
|
3224
|
+
}
|
|
3216
3225
|
if (options.cursor) {
|
|
3217
3226
|
searchParams.offset = options.cursor;
|
|
3218
3227
|
}
|
|
@@ -3246,7 +3255,8 @@ var listClientCredentialsPlugin = ({ context }) => {
|
|
|
3246
3255
|
listClientCredentialsPage,
|
|
3247
3256
|
ListClientCredentialsQuerySchema,
|
|
3248
3257
|
createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName),
|
|
3249
|
-
methodName
|
|
3258
|
+
methodName,
|
|
3259
|
+
DEFAULT_PAGE_SIZE
|
|
3250
3260
|
);
|
|
3251
3261
|
return {
|
|
3252
3262
|
listClientCredentials: listClientCredentialsDefinition,
|
|
@@ -3665,6 +3675,7 @@ async function executeAction(actionOptions) {
|
|
|
3665
3675
|
actionKey,
|
|
3666
3676
|
actionType,
|
|
3667
3677
|
executionOptions,
|
|
3678
|
+
cursor,
|
|
3668
3679
|
connectionId,
|
|
3669
3680
|
timeoutMs
|
|
3670
3681
|
} = actionOptions;
|
|
@@ -3678,6 +3689,9 @@ async function executeAction(actionOptions) {
|
|
|
3678
3689
|
if (connectionId !== null && connectionId !== void 0) {
|
|
3679
3690
|
runRequestData.authentication_id = connectionId;
|
|
3680
3691
|
}
|
|
3692
|
+
if (cursor) {
|
|
3693
|
+
runRequestData.page = cursor;
|
|
3694
|
+
}
|
|
3681
3695
|
const runRequest = {
|
|
3682
3696
|
data: runRequestData
|
|
3683
3697
|
};
|
|
@@ -3697,19 +3711,52 @@ async function executeAction(actionOptions) {
|
|
|
3697
3711
|
resultExtractor: (result) => result.data
|
|
3698
3712
|
});
|
|
3699
3713
|
}
|
|
3714
|
+
var CONTEXT_CACHE_TTL_MS = 6e4;
|
|
3715
|
+
var CONTEXT_CACHE_MAX_SIZE = 500;
|
|
3700
3716
|
var runActionPlugin = ({ sdk, context }) => {
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3717
|
+
const runActionContextCache = /* @__PURE__ */ new Map();
|
|
3718
|
+
function evictIfNeeded() {
|
|
3719
|
+
if (runActionContextCache.size < CONTEXT_CACHE_MAX_SIZE) return;
|
|
3720
|
+
const now = Date.now();
|
|
3721
|
+
let oldestKey;
|
|
3722
|
+
let oldestExpiry = Infinity;
|
|
3723
|
+
let evictedAny = false;
|
|
3724
|
+
for (const [key, entry] of runActionContextCache) {
|
|
3725
|
+
if (now >= entry.expiresAt) {
|
|
3726
|
+
runActionContextCache.delete(key);
|
|
3727
|
+
evictedAny = true;
|
|
3728
|
+
} else if (entry.expiresAt < oldestExpiry) {
|
|
3729
|
+
oldestExpiry = entry.expiresAt;
|
|
3730
|
+
oldestKey = key;
|
|
3731
|
+
}
|
|
3732
|
+
}
|
|
3733
|
+
if (!evictedAny && oldestKey) {
|
|
3734
|
+
runActionContextCache.delete(oldestKey);
|
|
3735
|
+
}
|
|
3736
|
+
}
|
|
3737
|
+
function getRunActionContext(options) {
|
|
3738
|
+
const { appKey, actionKey, actionType } = options;
|
|
3739
|
+
const contextKey = `${appKey}:${actionKey}:${actionType}`;
|
|
3740
|
+
const cached = runActionContextCache.get(contextKey);
|
|
3741
|
+
if (cached && Date.now() < cached.expiresAt) {
|
|
3742
|
+
return cached.promise;
|
|
3743
|
+
}
|
|
3744
|
+
const pendingContext = resolveRunActionContext(options).catch((error) => {
|
|
3745
|
+
const current = runActionContextCache.get(contextKey);
|
|
3746
|
+
if (current?.promise === pendingContext) {
|
|
3747
|
+
runActionContextCache.delete(contextKey);
|
|
3748
|
+
}
|
|
3749
|
+
throw error;
|
|
3750
|
+
});
|
|
3751
|
+
evictIfNeeded();
|
|
3752
|
+
runActionContextCache.set(contextKey, {
|
|
3753
|
+
promise: pendingContext,
|
|
3754
|
+
expiresAt: Date.now() + CONTEXT_CACHE_TTL_MS
|
|
3755
|
+
});
|
|
3756
|
+
return pendingContext;
|
|
3757
|
+
}
|
|
3758
|
+
async function resolveRunActionContext(options) {
|
|
3759
|
+
const { appKey, actionKey, actionType } = options;
|
|
3713
3760
|
const selectedApi = await context.getVersionedImplementationId(appKey);
|
|
3714
3761
|
if (!selectedApi) {
|
|
3715
3762
|
throw new ZapierConfigurationError(
|
|
@@ -3717,11 +3764,6 @@ var runActionPlugin = ({ sdk, context }) => {
|
|
|
3717
3764
|
{ configType: "current_implementation_id" }
|
|
3718
3765
|
);
|
|
3719
3766
|
}
|
|
3720
|
-
setMethodMetadata({
|
|
3721
|
-
selectedApi,
|
|
3722
|
-
operationType: actionType,
|
|
3723
|
-
operationKey: actionKey
|
|
3724
|
-
});
|
|
3725
3767
|
const actionData = await sdk.getAction({
|
|
3726
3768
|
appKey,
|
|
3727
3769
|
actionKey,
|
|
@@ -3732,7 +3774,27 @@ var runActionPlugin = ({ sdk, context }) => {
|
|
|
3732
3774
|
`Action type mismatch: expected ${actionType}, got ${actionData.data.action_type}`
|
|
3733
3775
|
);
|
|
3734
3776
|
}
|
|
3735
|
-
|
|
3777
|
+
return { selectedApi, actionId: actionData.data.id };
|
|
3778
|
+
}
|
|
3779
|
+
async function runActionPage(options) {
|
|
3780
|
+
const { api } = context;
|
|
3781
|
+
const {
|
|
3782
|
+
appKey,
|
|
3783
|
+
actionKey,
|
|
3784
|
+
actionType,
|
|
3785
|
+
connectionId,
|
|
3786
|
+
authenticationId,
|
|
3787
|
+
inputs = {},
|
|
3788
|
+
cursor,
|
|
3789
|
+
timeoutMs
|
|
3790
|
+
} = options;
|
|
3791
|
+
const resolvedConnectionId = connectionId ?? authenticationId;
|
|
3792
|
+
const { selectedApi, actionId } = await getRunActionContext(options);
|
|
3793
|
+
setMethodMetadata({
|
|
3794
|
+
selectedApi,
|
|
3795
|
+
operationType: actionType,
|
|
3796
|
+
operationKey: actionKey
|
|
3797
|
+
});
|
|
3736
3798
|
const result = await executeAction({
|
|
3737
3799
|
api,
|
|
3738
3800
|
selectedApi,
|
|
@@ -3742,6 +3804,7 @@ var runActionPlugin = ({ sdk, context }) => {
|
|
|
3742
3804
|
actionKey,
|
|
3743
3805
|
actionType,
|
|
3744
3806
|
executionOptions: { inputs },
|
|
3807
|
+
cursor,
|
|
3745
3808
|
connectionId: resolvedConnectionId,
|
|
3746
3809
|
timeoutMs
|
|
3747
3810
|
});
|
|
@@ -3756,8 +3819,7 @@ var runActionPlugin = ({ sdk, context }) => {
|
|
|
3756
3819
|
}
|
|
3757
3820
|
return {
|
|
3758
3821
|
data: result.results || [],
|
|
3759
|
-
nextCursor:
|
|
3760
|
-
// No pagination implemented yet
|
|
3822
|
+
nextCursor: result.next_page
|
|
3761
3823
|
};
|
|
3762
3824
|
}
|
|
3763
3825
|
const methodName = stripPageSuffix(runActionPage.name);
|
|
@@ -5732,9 +5794,10 @@ function extractNextCursor(links) {
|
|
|
5732
5794
|
var listTablesPlugin = ({ context }) => {
|
|
5733
5795
|
async function listTablesPage(options) {
|
|
5734
5796
|
const { api } = context;
|
|
5735
|
-
const searchParams = {
|
|
5736
|
-
|
|
5737
|
-
|
|
5797
|
+
const searchParams = {};
|
|
5798
|
+
if (options.pageSize !== void 0) {
|
|
5799
|
+
searchParams.limit = options.pageSize.toString();
|
|
5800
|
+
}
|
|
5738
5801
|
if (options?.tableIds && options.tableIds.length > 0) {
|
|
5739
5802
|
searchParams.ids = options.tableIds.join(",");
|
|
5740
5803
|
}
|
|
@@ -5787,7 +5850,8 @@ var listTablesPlugin = ({ context }) => {
|
|
|
5787
5850
|
listTablesPage,
|
|
5788
5851
|
ListTablesOptionsSchema,
|
|
5789
5852
|
createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName),
|
|
5790
|
-
methodName
|
|
5853
|
+
methodName,
|
|
5854
|
+
DEFAULT_PAGE_SIZE
|
|
5791
5855
|
);
|
|
5792
5856
|
return {
|
|
5793
5857
|
listTables: listTablesDefinition,
|
|
@@ -6401,9 +6465,10 @@ var listTableRecordsPlugin = ({ context }) => {
|
|
|
6401
6465
|
tableId: options.tableId,
|
|
6402
6466
|
keyMode: options.keyMode
|
|
6403
6467
|
});
|
|
6404
|
-
const body = {
|
|
6405
|
-
|
|
6406
|
-
|
|
6468
|
+
const body = {};
|
|
6469
|
+
if (options.pageSize !== void 0) {
|
|
6470
|
+
body.limit = options.pageSize;
|
|
6471
|
+
}
|
|
6407
6472
|
if (options.filters) {
|
|
6408
6473
|
body.filters = options.filters.map((f) => ({
|
|
6409
6474
|
key: translator.translateFieldKey(f.fieldKey),
|
|
@@ -6466,7 +6531,8 @@ var listTableRecordsPlugin = ({ context }) => {
|
|
|
6466
6531
|
listTableRecordsPage,
|
|
6467
6532
|
ListTableRecordsOptionsSchema,
|
|
6468
6533
|
createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName),
|
|
6469
|
-
methodName
|
|
6534
|
+
methodName,
|
|
6535
|
+
DEFAULT_PAGE_SIZE
|
|
6470
6536
|
);
|
|
6471
6537
|
return {
|
|
6472
6538
|
listTableRecords: listTableRecordsDefinition,
|
|
@@ -7166,7 +7232,8 @@ var listInputFieldChoicesPlugin = ({ context, sdk }) => {
|
|
|
7166
7232
|
listInputFieldChoicesPage,
|
|
7167
7233
|
ListInputFieldChoicesSchema,
|
|
7168
7234
|
createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName),
|
|
7169
|
-
methodName
|
|
7235
|
+
methodName,
|
|
7236
|
+
DEFAULT_PAGE_SIZE
|
|
7170
7237
|
);
|
|
7171
7238
|
return {
|
|
7172
7239
|
listInputFieldChoices: listInputFieldChoicesDefinition,
|
|
@@ -7351,7 +7418,7 @@ function getCpuTime() {
|
|
|
7351
7418
|
}
|
|
7352
7419
|
|
|
7353
7420
|
// src/plugins/eventEmission/builders.ts
|
|
7354
|
-
var SDK_VERSION = "0.
|
|
7421
|
+
var SDK_VERSION = "0.36.0";
|
|
7355
7422
|
function createBaseEvent(context = {}) {
|
|
7356
7423
|
return {
|
|
7357
7424
|
event_id: generateEventId(),
|
|
@@ -7884,6 +7951,8 @@ exports.ActionTypePropertySchema = ActionTypePropertySchema;
|
|
|
7884
7951
|
exports.AppKeyPropertySchema = AppKeyPropertySchema;
|
|
7885
7952
|
exports.AuthenticationIdPropertySchema = AuthenticationIdPropertySchema;
|
|
7886
7953
|
exports.BaseSdkOptionsSchema = BaseSdkOptionsSchema;
|
|
7954
|
+
exports.CONTEXT_CACHE_MAX_SIZE = CONTEXT_CACHE_MAX_SIZE;
|
|
7955
|
+
exports.CONTEXT_CACHE_TTL_MS = CONTEXT_CACHE_TTL_MS;
|
|
7887
7956
|
exports.ClientCredentialsObjectSchema = ClientCredentialsObjectSchema;
|
|
7888
7957
|
exports.ConnectionIdPropertySchema = ConnectionIdPropertySchema;
|
|
7889
7958
|
exports.CredentialsFunctionSchema = CredentialsFunctionSchema;
|
|
@@ -7891,6 +7960,7 @@ exports.CredentialsObjectSchema = CredentialsObjectSchema;
|
|
|
7891
7960
|
exports.CredentialsSchema = CredentialsSchema;
|
|
7892
7961
|
exports.DEFAULT_ACTION_TIMEOUT_MS = DEFAULT_ACTION_TIMEOUT_MS;
|
|
7893
7962
|
exports.DEFAULT_CONFIG_PATH = DEFAULT_CONFIG_PATH;
|
|
7963
|
+
exports.DEFAULT_PAGE_SIZE = DEFAULT_PAGE_SIZE;
|
|
7894
7964
|
exports.DebugPropertySchema = DebugPropertySchema;
|
|
7895
7965
|
exports.InputsPropertySchema = InputsPropertySchema;
|
|
7896
7966
|
exports.LimitPropertySchema = LimitPropertySchema;
|
package/dist/index.d.mts
CHANGED
|
@@ -1697,6 +1697,8 @@ interface RunActionPluginProvides {
|
|
|
1697
1697
|
};
|
|
1698
1698
|
};
|
|
1699
1699
|
}
|
|
1700
|
+
declare const CONTEXT_CACHE_TTL_MS = 60000;
|
|
1701
|
+
declare const CONTEXT_CACHE_MAX_SIZE = 500;
|
|
1700
1702
|
declare const runActionPlugin: Plugin<GetSdkType<GetActionPluginProvides & GetAppPluginProvides>, // requires getAction and getApp in SDK
|
|
1701
1703
|
// requires getAction and getApp in SDK
|
|
1702
1704
|
{
|
|
@@ -3291,6 +3293,10 @@ declare const ZAPIER_BASE_URL: string;
|
|
|
3291
3293
|
* Maximum number of items that can be requested per page across all paginated functions
|
|
3292
3294
|
*/
|
|
3293
3295
|
declare const MAX_PAGE_LIMIT = 10000;
|
|
3296
|
+
/**
|
|
3297
|
+
* Default number of items per page for paginated functions
|
|
3298
|
+
*/
|
|
3299
|
+
declare const DEFAULT_PAGE_SIZE = 100;
|
|
3294
3300
|
/**
|
|
3295
3301
|
* Default timeout for action execution (in milliseconds)
|
|
3296
3302
|
*/
|
|
@@ -3558,4 +3564,4 @@ declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOptions): Sdk
|
|
|
3558
3564
|
}>;
|
|
3559
3565
|
declare function createZapierSdk(options?: ZapierSdkOptions): ZapierSdk;
|
|
3560
3566
|
|
|
3561
|
-
export { type Action, type ActionEntry, type ActionExecutionOptions, type ActionExecutionResult, type ActionField, type ActionFieldChoice, type ActionItem$1 as ActionItem, type ActionKeyProperty, ActionKeyPropertySchema, type ActionTimeoutMsProperty, ActionTimeoutMsPropertySchema, type ActionTypeProperty, ActionTypePropertySchema, type AddActionEntryOptions, type AddActionEntryResult, type ApiError, type ApiEvent, type ApiPluginOptions, type ApiPluginProvides, type App, type AppItem, type AppKeyProperty, AppKeyPropertySchema, type ApplicationLifecycleEventData, type AppsPluginProvides, type ArrayResolver, type AuthEvent, type AuthenticationIdProperty, AuthenticationIdPropertySchema, type BaseEvent, BaseSdkOptionsSchema, type BatchOptions, type Choice, type ClientCredentialsObject, ClientCredentialsObjectSchema, type Connection, type ConnectionIdProperty, ConnectionIdPropertySchema, type ConnectionItem, type ConnectionsResponse, type CreateClientCredentialsPluginProvides, type CreateTableFieldsPluginProvides, type CreateTablePluginProvides, type CreateTableRecordsPluginProvides, type Credentials, type CredentialsFunction, CredentialsFunctionSchema, type CredentialsObject, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_CONFIG_PATH, type DebugProperty, DebugPropertySchema, type DeleteClientCredentialsPluginProvides, type DeleteTableFieldsPluginProvides, type DeleteTablePluginProvides, type DeleteTableRecordsPluginProvides, type DynamicResolver, type EnhancedErrorEventData, type ErrorOptions, type EventCallback, type EventContext, type EventEmissionContext, type FetchPluginProvides, type Field, type FieldsResolver, type FieldsetItem, type FindFirstAuthenticationPluginProvides, type FindFirstConnectionPluginProvides, type FindUniqueAuthenticationPluginProvides, type FindUniqueConnectionPluginProvides, type FormatMetadata, type FormattedItem, type FunctionDeprecation, type FunctionOptions, type FunctionRegistryEntry, type GetActionPluginProvides, type GetAppPluginProvides, type GetAuthenticationPluginProvides, type GetConnectionPluginProvides, type GetContextType, type GetProfilePluginProvides, type GetSdkType, type GetTablePluginProvides, type GetTableRecordPluginProvides, type InfoFieldItem, type InputFieldItem, type InputsProperty, InputsPropertySchema, type LimitProperty, LimitPropertySchema, type ListActionsPluginProvides, type ListAppsPluginProvides, type ListAuthenticationsPluginProvides, type ListClientCredentialsPluginProvides, type ListConnectionsPluginProvides, type ListInputFieldsPluginProvides, type ListTableFieldsPluginProvides, type ListTableRecordsPluginProvides, type ListTablesPluginProvides, type LoadingEvent, MAX_PAGE_LIMIT, type Manifest, type ManifestEntry, type ManifestPluginOptions, type ManifestPluginProvides, type MethodCalledEvent, type MethodCalledEventData, type Need, type NeedsRequest, type NeedsResponse, type OffsetProperty, OffsetPropertySchema, type OutputFormatter, type OutputProperty, OutputPropertySchema, type PaginatedSdkFunction, type ParamsProperty, ParamsPropertySchema, type PkceCredentialsObject, PkceCredentialsObjectSchema, type Plugin, type PluginDependencies, type PluginOptions, type PluginProvides, type PositionalMetadata, type RateLimitInfo, RelayFetchSchema, RelayRequestSchema, type RequestPluginProvides, type ResolveAuthTokenOptions, type ResolveCredentialsOptions, type ResolvedCredentials, ResolvedCredentialsSchema, type Resolver, type ResolverMetadata, type RootFieldItem, type RunActionPluginProvides, type Sdk, type SdkEvent, type SdkPage, type StaticResolver, type UpdateManifestEntryOptions, type UpdateManifestEntryResult, type UpdateTableRecordsPluginProvides, type UserProfile, type UserProfileItem, ZAPIER_BASE_URL, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierError, type ZapierFetchInitOptions, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierResourceNotFoundError, type ZapierSdk, type ZapierSdkApps, type ZapierSdkOptions, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, connectionIdGenericResolver, connectionIdResolver, createBaseEvent, createClientCredentialsPlugin, createFunction, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierSdk, createZapierSdkWithoutRegistry, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionPlugin, getAppPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCredentialsFunction, isCredentialsObject, isPkceCredentials, isPositional, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listInputFieldsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation, manifestPlugin, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, runWithTelemetryContext, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, updateTableRecordsPlugin };
|
|
3567
|
+
export { type Action, type ActionEntry, type ActionExecutionOptions, type ActionExecutionResult, type ActionField, type ActionFieldChoice, type ActionItem$1 as ActionItem, type ActionKeyProperty, ActionKeyPropertySchema, type ActionTimeoutMsProperty, ActionTimeoutMsPropertySchema, type ActionTypeProperty, ActionTypePropertySchema, type AddActionEntryOptions, type AddActionEntryResult, type ApiError, type ApiEvent, type ApiPluginOptions, type ApiPluginProvides, type App, type AppItem, type AppKeyProperty, AppKeyPropertySchema, type ApplicationLifecycleEventData, type AppsPluginProvides, type ArrayResolver, type AuthEvent, type AuthenticationIdProperty, AuthenticationIdPropertySchema, type BaseEvent, BaseSdkOptionsSchema, type BatchOptions, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MS, type Choice, type ClientCredentialsObject, ClientCredentialsObjectSchema, type Connection, type ConnectionIdProperty, ConnectionIdPropertySchema, type ConnectionItem, type ConnectionsResponse, type CreateClientCredentialsPluginProvides, type CreateTableFieldsPluginProvides, type CreateTablePluginProvides, type CreateTableRecordsPluginProvides, type Credentials, type CredentialsFunction, CredentialsFunctionSchema, type CredentialsObject, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_CONFIG_PATH, DEFAULT_PAGE_SIZE, type DebugProperty, DebugPropertySchema, type DeleteClientCredentialsPluginProvides, type DeleteTableFieldsPluginProvides, type DeleteTablePluginProvides, type DeleteTableRecordsPluginProvides, type DynamicResolver, type EnhancedErrorEventData, type ErrorOptions, type EventCallback, type EventContext, type EventEmissionContext, type FetchPluginProvides, type Field, type FieldsResolver, type FieldsetItem, type FindFirstAuthenticationPluginProvides, type FindFirstConnectionPluginProvides, type FindUniqueAuthenticationPluginProvides, type FindUniqueConnectionPluginProvides, type FormatMetadata, type FormattedItem, type FunctionDeprecation, type FunctionOptions, type FunctionRegistryEntry, type GetActionPluginProvides, type GetAppPluginProvides, type GetAuthenticationPluginProvides, type GetConnectionPluginProvides, type GetContextType, type GetProfilePluginProvides, type GetSdkType, type GetTablePluginProvides, type GetTableRecordPluginProvides, type InfoFieldItem, type InputFieldItem, type InputsProperty, InputsPropertySchema, type LimitProperty, LimitPropertySchema, type ListActionsPluginProvides, type ListAppsPluginProvides, type ListAuthenticationsPluginProvides, type ListClientCredentialsPluginProvides, type ListConnectionsPluginProvides, type ListInputFieldsPluginProvides, type ListTableFieldsPluginProvides, type ListTableRecordsPluginProvides, type ListTablesPluginProvides, type LoadingEvent, MAX_PAGE_LIMIT, type Manifest, type ManifestEntry, type ManifestPluginOptions, type ManifestPluginProvides, type MethodCalledEvent, type MethodCalledEventData, type Need, type NeedsRequest, type NeedsResponse, type OffsetProperty, OffsetPropertySchema, type OutputFormatter, type OutputProperty, OutputPropertySchema, type PaginatedSdkFunction, type ParamsProperty, ParamsPropertySchema, type PkceCredentialsObject, PkceCredentialsObjectSchema, type Plugin, type PluginDependencies, type PluginOptions, type PluginProvides, type PositionalMetadata, type RateLimitInfo, RelayFetchSchema, RelayRequestSchema, type RequestPluginProvides, type ResolveAuthTokenOptions, type ResolveCredentialsOptions, type ResolvedCredentials, ResolvedCredentialsSchema, type Resolver, type ResolverMetadata, type RootFieldItem, type RunActionPluginProvides, type Sdk, type SdkEvent, type SdkPage, type StaticResolver, type UpdateManifestEntryOptions, type UpdateManifestEntryResult, type UpdateTableRecordsPluginProvides, type UserProfile, type UserProfileItem, ZAPIER_BASE_URL, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierError, type ZapierFetchInitOptions, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierResourceNotFoundError, type ZapierSdk, type ZapierSdkApps, type ZapierSdkOptions, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, connectionIdGenericResolver, connectionIdResolver, createBaseEvent, createClientCredentialsPlugin, createFunction, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierSdk, createZapierSdkWithoutRegistry, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionPlugin, getAppPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCredentialsFunction, isCredentialsObject, isPkceCredentials, isPositional, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listInputFieldsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation, manifestPlugin, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, runWithTelemetryContext, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, updateTableRecordsPlugin };
|
package/dist/index.mjs
CHANGED
|
@@ -42,6 +42,7 @@ function isPositional(schema) {
|
|
|
42
42
|
// src/constants.ts
|
|
43
43
|
var ZAPIER_BASE_URL = process.env.ZAPIER_BASE_URL || "https://zapier.com";
|
|
44
44
|
var MAX_PAGE_LIMIT = 1e4;
|
|
45
|
+
var DEFAULT_PAGE_SIZE = 100;
|
|
45
46
|
var DEFAULT_ACTION_TIMEOUT_MS = 18e4;
|
|
46
47
|
function parseIntEnvVar(name) {
|
|
47
48
|
const value = process.env[name];
|
|
@@ -1022,7 +1023,7 @@ function createPageFunction(coreFn) {
|
|
|
1022
1023
|
};
|
|
1023
1024
|
return namedFunctions[functionName];
|
|
1024
1025
|
}
|
|
1025
|
-
function createPaginatedFunction(coreFn, schema, telemetry, explicitFunctionName) {
|
|
1026
|
+
function createPaginatedFunction(coreFn, schema, telemetry, explicitFunctionName, defaultPageSize) {
|
|
1026
1027
|
const pageFunction = createPageFunction(coreFn);
|
|
1027
1028
|
const functionName = explicitFunctionName || coreFn.name;
|
|
1028
1029
|
const validator = schema ? createValidator(schema) : null;
|
|
@@ -1036,7 +1037,7 @@ function createPaginatedFunction(coreFn, schema, telemetry, explicitFunctionName
|
|
|
1036
1037
|
...normalizedOptions,
|
|
1037
1038
|
...validator ? validator(normalizedOptions) : normalizedOptions
|
|
1038
1039
|
};
|
|
1039
|
-
const pageSize = validatedOptions.pageSize
|
|
1040
|
+
const pageSize = validatedOptions.pageSize ?? defaultPageSize;
|
|
1040
1041
|
const optimizedOptions = {
|
|
1041
1042
|
...validatedOptions,
|
|
1042
1043
|
pageSize
|
|
@@ -1210,7 +1211,9 @@ var listAppsPlugin = ({ context }) => {
|
|
|
1210
1211
|
searchParams: {
|
|
1211
1212
|
appKeys: implementationIds.join(","),
|
|
1212
1213
|
...options.search && { search: options.search },
|
|
1213
|
-
|
|
1214
|
+
...options.pageSize !== void 0 && {
|
|
1215
|
+
pageSize: options.pageSize.toString()
|
|
1216
|
+
},
|
|
1214
1217
|
...options.cursor && { offset: options.cursor }
|
|
1215
1218
|
}
|
|
1216
1219
|
});
|
|
@@ -1220,7 +1223,8 @@ var listAppsPlugin = ({ context }) => {
|
|
|
1220
1223
|
listAppsPage,
|
|
1221
1224
|
ListAppsSchema,
|
|
1222
1225
|
createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName),
|
|
1223
|
-
methodName
|
|
1226
|
+
methodName,
|
|
1227
|
+
DEFAULT_PAGE_SIZE
|
|
1224
1228
|
);
|
|
1225
1229
|
return {
|
|
1226
1230
|
listApps: listAppsDefinition,
|
|
@@ -2601,7 +2605,8 @@ var listActionsPlugin = ({ context }) => {
|
|
|
2601
2605
|
listActionsPage,
|
|
2602
2606
|
ListActionsSchema,
|
|
2603
2607
|
createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName),
|
|
2604
|
-
methodName
|
|
2608
|
+
methodName,
|
|
2609
|
+
DEFAULT_PAGE_SIZE
|
|
2605
2610
|
);
|
|
2606
2611
|
return {
|
|
2607
2612
|
listActions: listActionsDefinition,
|
|
@@ -2958,7 +2963,8 @@ var listInputFieldsPlugin = ({ sdk, context }) => {
|
|
|
2958
2963
|
listInputFieldsPage,
|
|
2959
2964
|
ListInputFieldsSchema,
|
|
2960
2965
|
createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName),
|
|
2961
|
-
methodName
|
|
2966
|
+
methodName,
|
|
2967
|
+
DEFAULT_PAGE_SIZE
|
|
2962
2968
|
);
|
|
2963
2969
|
return {
|
|
2964
2970
|
listInputFields: listInputFieldsDefinition,
|
|
@@ -3044,9 +3050,10 @@ var ConnectionItemSchema = withFormatter(ConnectionItemSchema$1, {
|
|
|
3044
3050
|
var listConnectionsPlugin = ({ context }) => {
|
|
3045
3051
|
async function listConnectionsPage(options) {
|
|
3046
3052
|
const { api, getVersionedImplementationId } = context;
|
|
3047
|
-
const searchParams = {
|
|
3048
|
-
|
|
3049
|
-
|
|
3053
|
+
const searchParams = {};
|
|
3054
|
+
if (options.pageSize !== void 0) {
|
|
3055
|
+
searchParams.page_size = options.pageSize.toString();
|
|
3056
|
+
}
|
|
3050
3057
|
if (options.appKey) {
|
|
3051
3058
|
const implementationId = await getVersionedImplementationId(
|
|
3052
3059
|
options.appKey
|
|
@@ -3110,7 +3117,8 @@ var listConnectionsPlugin = ({ context }) => {
|
|
|
3110
3117
|
listConnectionsPage,
|
|
3111
3118
|
ListConnectionsQuerySchema,
|
|
3112
3119
|
createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName),
|
|
3113
|
-
methodName
|
|
3120
|
+
methodName,
|
|
3121
|
+
DEFAULT_PAGE_SIZE
|
|
3114
3122
|
);
|
|
3115
3123
|
return {
|
|
3116
3124
|
listConnections: listConnectionsDefinition,
|
|
@@ -3188,9 +3196,10 @@ var ClientCredentialsCreatedItemSchema = withFormatter(
|
|
|
3188
3196
|
var listClientCredentialsPlugin = ({ context }) => {
|
|
3189
3197
|
async function listClientCredentialsPage(options) {
|
|
3190
3198
|
const { api } = context;
|
|
3191
|
-
const searchParams = {
|
|
3192
|
-
|
|
3193
|
-
|
|
3199
|
+
const searchParams = {};
|
|
3200
|
+
if (options.pageSize !== void 0) {
|
|
3201
|
+
searchParams.pageSize = options.pageSize.toString();
|
|
3202
|
+
}
|
|
3194
3203
|
if (options.cursor) {
|
|
3195
3204
|
searchParams.offset = options.cursor;
|
|
3196
3205
|
}
|
|
@@ -3224,7 +3233,8 @@ var listClientCredentialsPlugin = ({ context }) => {
|
|
|
3224
3233
|
listClientCredentialsPage,
|
|
3225
3234
|
ListClientCredentialsQuerySchema,
|
|
3226
3235
|
createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName),
|
|
3227
|
-
methodName
|
|
3236
|
+
methodName,
|
|
3237
|
+
DEFAULT_PAGE_SIZE
|
|
3228
3238
|
);
|
|
3229
3239
|
return {
|
|
3230
3240
|
listClientCredentials: listClientCredentialsDefinition,
|
|
@@ -3643,6 +3653,7 @@ async function executeAction(actionOptions) {
|
|
|
3643
3653
|
actionKey,
|
|
3644
3654
|
actionType,
|
|
3645
3655
|
executionOptions,
|
|
3656
|
+
cursor,
|
|
3646
3657
|
connectionId,
|
|
3647
3658
|
timeoutMs
|
|
3648
3659
|
} = actionOptions;
|
|
@@ -3656,6 +3667,9 @@ async function executeAction(actionOptions) {
|
|
|
3656
3667
|
if (connectionId !== null && connectionId !== void 0) {
|
|
3657
3668
|
runRequestData.authentication_id = connectionId;
|
|
3658
3669
|
}
|
|
3670
|
+
if (cursor) {
|
|
3671
|
+
runRequestData.page = cursor;
|
|
3672
|
+
}
|
|
3659
3673
|
const runRequest = {
|
|
3660
3674
|
data: runRequestData
|
|
3661
3675
|
};
|
|
@@ -3675,19 +3689,52 @@ async function executeAction(actionOptions) {
|
|
|
3675
3689
|
resultExtractor: (result) => result.data
|
|
3676
3690
|
});
|
|
3677
3691
|
}
|
|
3692
|
+
var CONTEXT_CACHE_TTL_MS = 6e4;
|
|
3693
|
+
var CONTEXT_CACHE_MAX_SIZE = 500;
|
|
3678
3694
|
var runActionPlugin = ({ sdk, context }) => {
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3695
|
+
const runActionContextCache = /* @__PURE__ */ new Map();
|
|
3696
|
+
function evictIfNeeded() {
|
|
3697
|
+
if (runActionContextCache.size < CONTEXT_CACHE_MAX_SIZE) return;
|
|
3698
|
+
const now = Date.now();
|
|
3699
|
+
let oldestKey;
|
|
3700
|
+
let oldestExpiry = Infinity;
|
|
3701
|
+
let evictedAny = false;
|
|
3702
|
+
for (const [key, entry] of runActionContextCache) {
|
|
3703
|
+
if (now >= entry.expiresAt) {
|
|
3704
|
+
runActionContextCache.delete(key);
|
|
3705
|
+
evictedAny = true;
|
|
3706
|
+
} else if (entry.expiresAt < oldestExpiry) {
|
|
3707
|
+
oldestExpiry = entry.expiresAt;
|
|
3708
|
+
oldestKey = key;
|
|
3709
|
+
}
|
|
3710
|
+
}
|
|
3711
|
+
if (!evictedAny && oldestKey) {
|
|
3712
|
+
runActionContextCache.delete(oldestKey);
|
|
3713
|
+
}
|
|
3714
|
+
}
|
|
3715
|
+
function getRunActionContext(options) {
|
|
3716
|
+
const { appKey, actionKey, actionType } = options;
|
|
3717
|
+
const contextKey = `${appKey}:${actionKey}:${actionType}`;
|
|
3718
|
+
const cached = runActionContextCache.get(contextKey);
|
|
3719
|
+
if (cached && Date.now() < cached.expiresAt) {
|
|
3720
|
+
return cached.promise;
|
|
3721
|
+
}
|
|
3722
|
+
const pendingContext = resolveRunActionContext(options).catch((error) => {
|
|
3723
|
+
const current = runActionContextCache.get(contextKey);
|
|
3724
|
+
if (current?.promise === pendingContext) {
|
|
3725
|
+
runActionContextCache.delete(contextKey);
|
|
3726
|
+
}
|
|
3727
|
+
throw error;
|
|
3728
|
+
});
|
|
3729
|
+
evictIfNeeded();
|
|
3730
|
+
runActionContextCache.set(contextKey, {
|
|
3731
|
+
promise: pendingContext,
|
|
3732
|
+
expiresAt: Date.now() + CONTEXT_CACHE_TTL_MS
|
|
3733
|
+
});
|
|
3734
|
+
return pendingContext;
|
|
3735
|
+
}
|
|
3736
|
+
async function resolveRunActionContext(options) {
|
|
3737
|
+
const { appKey, actionKey, actionType } = options;
|
|
3691
3738
|
const selectedApi = await context.getVersionedImplementationId(appKey);
|
|
3692
3739
|
if (!selectedApi) {
|
|
3693
3740
|
throw new ZapierConfigurationError(
|
|
@@ -3695,11 +3742,6 @@ var runActionPlugin = ({ sdk, context }) => {
|
|
|
3695
3742
|
{ configType: "current_implementation_id" }
|
|
3696
3743
|
);
|
|
3697
3744
|
}
|
|
3698
|
-
setMethodMetadata({
|
|
3699
|
-
selectedApi,
|
|
3700
|
-
operationType: actionType,
|
|
3701
|
-
operationKey: actionKey
|
|
3702
|
-
});
|
|
3703
3745
|
const actionData = await sdk.getAction({
|
|
3704
3746
|
appKey,
|
|
3705
3747
|
actionKey,
|
|
@@ -3710,7 +3752,27 @@ var runActionPlugin = ({ sdk, context }) => {
|
|
|
3710
3752
|
`Action type mismatch: expected ${actionType}, got ${actionData.data.action_type}`
|
|
3711
3753
|
);
|
|
3712
3754
|
}
|
|
3713
|
-
|
|
3755
|
+
return { selectedApi, actionId: actionData.data.id };
|
|
3756
|
+
}
|
|
3757
|
+
async function runActionPage(options) {
|
|
3758
|
+
const { api } = context;
|
|
3759
|
+
const {
|
|
3760
|
+
appKey,
|
|
3761
|
+
actionKey,
|
|
3762
|
+
actionType,
|
|
3763
|
+
connectionId,
|
|
3764
|
+
authenticationId,
|
|
3765
|
+
inputs = {},
|
|
3766
|
+
cursor,
|
|
3767
|
+
timeoutMs
|
|
3768
|
+
} = options;
|
|
3769
|
+
const resolvedConnectionId = connectionId ?? authenticationId;
|
|
3770
|
+
const { selectedApi, actionId } = await getRunActionContext(options);
|
|
3771
|
+
setMethodMetadata({
|
|
3772
|
+
selectedApi,
|
|
3773
|
+
operationType: actionType,
|
|
3774
|
+
operationKey: actionKey
|
|
3775
|
+
});
|
|
3714
3776
|
const result = await executeAction({
|
|
3715
3777
|
api,
|
|
3716
3778
|
selectedApi,
|
|
@@ -3720,6 +3782,7 @@ var runActionPlugin = ({ sdk, context }) => {
|
|
|
3720
3782
|
actionKey,
|
|
3721
3783
|
actionType,
|
|
3722
3784
|
executionOptions: { inputs },
|
|
3785
|
+
cursor,
|
|
3723
3786
|
connectionId: resolvedConnectionId,
|
|
3724
3787
|
timeoutMs
|
|
3725
3788
|
});
|
|
@@ -3734,8 +3797,7 @@ var runActionPlugin = ({ sdk, context }) => {
|
|
|
3734
3797
|
}
|
|
3735
3798
|
return {
|
|
3736
3799
|
data: result.results || [],
|
|
3737
|
-
nextCursor:
|
|
3738
|
-
// No pagination implemented yet
|
|
3800
|
+
nextCursor: result.next_page
|
|
3739
3801
|
};
|
|
3740
3802
|
}
|
|
3741
3803
|
const methodName = stripPageSuffix(runActionPage.name);
|
|
@@ -5710,9 +5772,10 @@ function extractNextCursor(links) {
|
|
|
5710
5772
|
var listTablesPlugin = ({ context }) => {
|
|
5711
5773
|
async function listTablesPage(options) {
|
|
5712
5774
|
const { api } = context;
|
|
5713
|
-
const searchParams = {
|
|
5714
|
-
|
|
5715
|
-
|
|
5775
|
+
const searchParams = {};
|
|
5776
|
+
if (options.pageSize !== void 0) {
|
|
5777
|
+
searchParams.limit = options.pageSize.toString();
|
|
5778
|
+
}
|
|
5716
5779
|
if (options?.tableIds && options.tableIds.length > 0) {
|
|
5717
5780
|
searchParams.ids = options.tableIds.join(",");
|
|
5718
5781
|
}
|
|
@@ -5765,7 +5828,8 @@ var listTablesPlugin = ({ context }) => {
|
|
|
5765
5828
|
listTablesPage,
|
|
5766
5829
|
ListTablesOptionsSchema,
|
|
5767
5830
|
createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName),
|
|
5768
|
-
methodName
|
|
5831
|
+
methodName,
|
|
5832
|
+
DEFAULT_PAGE_SIZE
|
|
5769
5833
|
);
|
|
5770
5834
|
return {
|
|
5771
5835
|
listTables: listTablesDefinition,
|
|
@@ -6379,9 +6443,10 @@ var listTableRecordsPlugin = ({ context }) => {
|
|
|
6379
6443
|
tableId: options.tableId,
|
|
6380
6444
|
keyMode: options.keyMode
|
|
6381
6445
|
});
|
|
6382
|
-
const body = {
|
|
6383
|
-
|
|
6384
|
-
|
|
6446
|
+
const body = {};
|
|
6447
|
+
if (options.pageSize !== void 0) {
|
|
6448
|
+
body.limit = options.pageSize;
|
|
6449
|
+
}
|
|
6385
6450
|
if (options.filters) {
|
|
6386
6451
|
body.filters = options.filters.map((f) => ({
|
|
6387
6452
|
key: translator.translateFieldKey(f.fieldKey),
|
|
@@ -6444,7 +6509,8 @@ var listTableRecordsPlugin = ({ context }) => {
|
|
|
6444
6509
|
listTableRecordsPage,
|
|
6445
6510
|
ListTableRecordsOptionsSchema,
|
|
6446
6511
|
createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName),
|
|
6447
|
-
methodName
|
|
6512
|
+
methodName,
|
|
6513
|
+
DEFAULT_PAGE_SIZE
|
|
6448
6514
|
);
|
|
6449
6515
|
return {
|
|
6450
6516
|
listTableRecords: listTableRecordsDefinition,
|
|
@@ -7144,7 +7210,8 @@ var listInputFieldChoicesPlugin = ({ context, sdk }) => {
|
|
|
7144
7210
|
listInputFieldChoicesPage,
|
|
7145
7211
|
ListInputFieldChoicesSchema,
|
|
7146
7212
|
createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName),
|
|
7147
|
-
methodName
|
|
7213
|
+
methodName,
|
|
7214
|
+
DEFAULT_PAGE_SIZE
|
|
7148
7215
|
);
|
|
7149
7216
|
return {
|
|
7150
7217
|
listInputFieldChoices: listInputFieldChoicesDefinition,
|
|
@@ -7329,7 +7396,7 @@ function getCpuTime() {
|
|
|
7329
7396
|
}
|
|
7330
7397
|
|
|
7331
7398
|
// src/plugins/eventEmission/builders.ts
|
|
7332
|
-
var SDK_VERSION = "0.
|
|
7399
|
+
var SDK_VERSION = "0.36.0";
|
|
7333
7400
|
function createBaseEvent(context = {}) {
|
|
7334
7401
|
return {
|
|
7335
7402
|
event_id: generateEventId(),
|
|
@@ -7856,4 +7923,4 @@ var BaseSdkOptionsSchema = z.object({
|
|
|
7856
7923
|
// Use credentials instead
|
|
7857
7924
|
});
|
|
7858
7925
|
|
|
7859
|
-
export { ActionKeyPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, ClientCredentialsObjectSchema, ConnectionIdPropertySchema, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_CONFIG_PATH, DebugPropertySchema, InputsPropertySchema, LimitPropertySchema, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, ZAPIER_BASE_URL, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierResourceNotFoundError, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, connectionIdGenericResolver, connectionIdResolver, createBaseEvent, createClientCredentialsPlugin, createFunction, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierSdk, createZapierSdkWithoutRegistry, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionPlugin, getAppPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCredentialsFunction, isCredentialsObject, isPkceCredentials, isPositional, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listInputFieldsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation, manifestPlugin, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, runWithTelemetryContext, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, updateTableRecordsPlugin };
|
|
7926
|
+
export { ActionKeyPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MS, ClientCredentialsObjectSchema, ConnectionIdPropertySchema, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_CONFIG_PATH, DEFAULT_PAGE_SIZE, DebugPropertySchema, InputsPropertySchema, LimitPropertySchema, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, ZAPIER_BASE_URL, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierResourceNotFoundError, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, connectionIdGenericResolver, connectionIdResolver, createBaseEvent, createClientCredentialsPlugin, createFunction, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierSdk, createZapierSdkWithoutRegistry, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, generateEventId, getActionPlugin, getAppPlugin, getBaseUrlFromCredentials, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCredentialsFunction, isCredentialsObject, isPkceCredentials, isPositional, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listInputFieldsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation, manifestPlugin, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, runWithTelemetryContext, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, updateTableRecordsPlugin };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listActions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,WAAW,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EACL,iBAAiB,EACjB,KAAK,kBAAkB,EAExB,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listActions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,WAAW,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EACL,iBAAiB,EACjB,KAAK,kBAAkB,EAExB,MAAM,WAAW,CAAC;AAQnB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAExE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAK7D,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,CAAC,OAAO,CAAC,EAAE,kBAAkB,KAAK,OAAO,CAAC;QACrD,IAAI,EAAE,UAAU,EAAE,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,UAAU,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QAC3D,KAAK,IAAI,aAAa,CAAC,UAAU,CAAC,CAAC;KACpC,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,WAAW,EAAE,OAAO,iBAAiB,CAAC;aACvC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,CACpC,UAAU,CAAC,sBAAsB,CAAC,EAClC;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,GAAG,oBAAoB,EACxB,yBAAyB,CA2G1B,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { ListActionsSchema, } from "./schemas";
|
|
|
3
3
|
import { ActionItemSchema } from "../../schemas/Action";
|
|
4
4
|
import { ZapierConfigurationError, ZapierAuthenticationError, } from "../../types/errors";
|
|
5
5
|
import { createPaginatedFunction } from "../../utils/function-utils";
|
|
6
|
+
import { DEFAULT_PAGE_SIZE } from "../../constants";
|
|
6
7
|
import { appKeyResolver, actionTypeResolver } from "../../resolvers";
|
|
7
8
|
import { createTelemetryCallback } from "../../utils/telemetry-utils";
|
|
8
9
|
import { stripPageSuffix } from "../../utils/string-utils";
|
|
@@ -69,7 +70,7 @@ export const listActionsPlugin = ({ context }) => {
|
|
|
69
70
|
};
|
|
70
71
|
}
|
|
71
72
|
const methodName = stripPageSuffix(listActionsPage.name);
|
|
72
|
-
const listActionsDefinition = createPaginatedFunction(listActionsPage, ListActionsSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName), methodName);
|
|
73
|
+
const listActionsDefinition = createPaginatedFunction(listActionsPage, ListActionsSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName), methodName, DEFAULT_PAGE_SIZE);
|
|
73
74
|
return {
|
|
74
75
|
listActions: listActionsDefinition,
|
|
75
76
|
context: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listApps/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listApps/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGjE,OAAO,EACL,cAAc,EACd,KAAK,eAAe,EAEpB,KAAK,YAAY,EACjB,KAAK,OAAO,EACb,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAI7D,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,eAAe,KAAK,OAAO,CAAC,YAAY,CAAC,GAC5D,aAAa,CAAC,YAAY,CAAC,GAAG;QAC5B,KAAK,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC;KACjC,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,QAAQ,EAAE;gBACR,WAAW,EAAE,OAAO,cAAc,CAAC;aACpC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,cAAc,EAAE,MAAM,CACjC,EAAE,EACF,cAAc,CAAC,iBAAiB,GAAG,sBAAsB,CAAC,GACxD,oBAAoB,EACtB,sBAAsB,CAkFvB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createPaginatedFunction } from "../../utils/function-utils";
|
|
2
|
+
import { DEFAULT_PAGE_SIZE } from "../../constants";
|
|
2
3
|
import { ListAppsSchema, } from "./schemas";
|
|
3
4
|
import { AppItemSchema } from "../../schemas/App";
|
|
4
5
|
import { createTelemetryCallback } from "../../utils/telemetry-utils";
|
|
@@ -43,13 +44,15 @@ export const listAppsPlugin = ({ context }) => {
|
|
|
43
44
|
searchParams: {
|
|
44
45
|
appKeys: implementationIds.join(","),
|
|
45
46
|
...(options.search && { search: options.search }),
|
|
46
|
-
|
|
47
|
+
...(options.pageSize !== undefined && {
|
|
48
|
+
pageSize: options.pageSize.toString(),
|
|
49
|
+
}),
|
|
47
50
|
...(options.cursor && { offset: options.cursor }),
|
|
48
51
|
},
|
|
49
52
|
});
|
|
50
53
|
}
|
|
51
54
|
const methodName = stripPageSuffix(listAppsPage.name);
|
|
52
|
-
const listAppsDefinition = createPaginatedFunction(listAppsPage, ListAppsSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName), methodName);
|
|
55
|
+
const listAppsDefinition = createPaginatedFunction(listAppsPage, ListAppsSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName), methodName, DEFAULT_PAGE_SIZE);
|
|
53
56
|
return {
|
|
54
57
|
listApps: listAppsDefinition,
|
|
55
58
|
context: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listClientCredentials/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uDAAuD,CAAC;AACnG,OAAO,EACL,gCAAgC,EAChC,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC/B,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listClientCredentials/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uDAAuD,CAAC;AACnG,OAAO,EACL,gCAAgC,EAChC,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC/B,MAAM,WAAW,CAAC;AAKnB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAK7D,MAAM,WAAW,mCAAmC;IAClD,qBAAqB,EAAE,CACrB,OAAO,CAAC,EAAE,4BAA4B,KACnC,OAAO,CAAC,yBAAyB,CAAC,GACrC,aAAa,CAAC,yBAAyB,CAAC,GAAG;QACzC,KAAK,IAAI,aAAa,CAAC,qBAAqB,CAAC,CAAC;KAC/C,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,qBAAqB,EAAE;gBACrB,WAAW,EAAE,OAAO,gCAAgC,CAAC;aACtD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAC9C,EAAE,EACF;IACE,GAAG,EAAE,SAAS,CAAC;CAChB,GAAG,oBAAoB,EACxB,mCAAmC,CAsEpC,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ListClientCredentialsQuerySchema, } from "./schemas";
|
|
2
2
|
import { createPaginatedFunction } from "../../utils/function-utils";
|
|
3
|
+
import { DEFAULT_PAGE_SIZE } from "../../constants";
|
|
3
4
|
import { ClientCredentialsItemSchema } from "../../schemas/ClientCredentials";
|
|
4
5
|
import { createTelemetryCallback } from "../../utils/telemetry-utils";
|
|
5
6
|
import { stripPageSuffix } from "../../utils/string-utils";
|
|
@@ -7,9 +8,10 @@ import { ZapierAuthenticationError } from "../../types/errors";
|
|
|
7
8
|
export const listClientCredentialsPlugin = ({ context }) => {
|
|
8
9
|
async function listClientCredentialsPage(options) {
|
|
9
10
|
const { api } = context;
|
|
10
|
-
const searchParams = {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const searchParams = {};
|
|
12
|
+
if (options.pageSize !== undefined) {
|
|
13
|
+
searchParams.pageSize = options.pageSize.toString();
|
|
14
|
+
}
|
|
13
15
|
if (options.cursor) {
|
|
14
16
|
searchParams.offset = options.cursor;
|
|
15
17
|
}
|
|
@@ -30,7 +32,7 @@ export const listClientCredentialsPlugin = ({ context }) => {
|
|
|
30
32
|
return response;
|
|
31
33
|
}
|
|
32
34
|
const methodName = stripPageSuffix(listClientCredentialsPage.name);
|
|
33
|
-
const listClientCredentialsDefinition = createPaginatedFunction(listClientCredentialsPage, ListClientCredentialsQuerySchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName), methodName);
|
|
35
|
+
const listClientCredentialsDefinition = createPaginatedFunction(listClientCredentialsPage, ListClientCredentialsQuerySchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName), methodName, DEFAULT_PAGE_SIZE);
|
|
34
36
|
return {
|
|
35
37
|
listClientCredentials: listClientCredentialsDefinition,
|
|
36
38
|
context: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listConnections/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AACrF,OAAO,EACL,0BAA0B,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACzB,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listConnections/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AACrF,OAAO,EACL,0BAA0B,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACzB,MAAM,WAAW,CAAC;AAKnB,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAG1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAM7D,MAAM,WAAW,6BAA6B;IAC5C,eAAe,EAAE,CACf,OAAO,CAAC,EAAE,sBAAsB,KAC7B,OAAO,CAAC,mBAAmB,CAAC,GAC/B,aAAa,CAAC,mBAAmB,CAAC,GAAG;QACnC,KAAK,IAAI,aAAa,CAAC,cAAc,CAAC,CAAC;KACxC,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,eAAe,EAAE;gBACf,WAAW,EAAE,OAAO,0BAA0B,CAAC;aAChD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,qBAAqB,EAAE,MAAM,CACxC,UAAU,CAAC,sBAAsB,CAAC,EAClC;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,GAAG,oBAAoB,EACxB,6BAA6B,CA+G9B,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ListConnectionsQuerySchema, } from "./schemas";
|
|
2
2
|
import { splitVersionedKey } from "../../utils/domain-utils";
|
|
3
3
|
import { createPaginatedFunction } from "../../utils/function-utils";
|
|
4
|
+
import { DEFAULT_PAGE_SIZE } from "../../constants";
|
|
4
5
|
import { appKeyResolver } from "../../resolvers";
|
|
5
6
|
import { ConnectionItemSchema } from "../../schemas/Connection";
|
|
6
7
|
import { createTelemetryCallback } from "../../utils/telemetry-utils";
|
|
@@ -10,9 +11,10 @@ import { setMethodMetadata } from "../../utils/telemetry-context";
|
|
|
10
11
|
export const listConnectionsPlugin = ({ context }) => {
|
|
11
12
|
async function listConnectionsPage(options) {
|
|
12
13
|
const { api, getVersionedImplementationId } = context;
|
|
13
|
-
const searchParams = {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const searchParams = {};
|
|
15
|
+
if (options.pageSize !== undefined) {
|
|
16
|
+
searchParams.page_size = options.pageSize.toString();
|
|
17
|
+
}
|
|
16
18
|
// Resolve appKey to implementationId if provided
|
|
17
19
|
if (options.appKey) {
|
|
18
20
|
const implementationId = await getVersionedImplementationId(options.appKey);
|
|
@@ -67,7 +69,7 @@ export const listConnectionsPlugin = ({ context }) => {
|
|
|
67
69
|
return response;
|
|
68
70
|
}
|
|
69
71
|
const methodName = stripPageSuffix(listConnectionsPage.name);
|
|
70
|
-
const listConnectionsDefinition = createPaginatedFunction(listConnectionsPage, ListConnectionsQuerySchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName), methodName);
|
|
72
|
+
const listConnectionsDefinition = createPaginatedFunction(listConnectionsPage, ListConnectionsQuerySchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName), methodName, DEFAULT_PAGE_SIZE);
|
|
71
73
|
return {
|
|
72
74
|
listConnections: listConnectionsDefinition,
|
|
73
75
|
context: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listInputFieldChoices/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EACL,2BAA2B,EAC3B,KAAK,4BAA4B,EAGlC,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listInputFieldChoices/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EACL,2BAA2B,EAC3B,KAAK,4BAA4B,EAGlC,MAAM,WAAW,CAAC;AAInB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAcxE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAgB7D,MAAM,WAAW,mCAAmC;IAClD,qBAAqB,EAAE,CAAC,OAAO,EAAE,4BAA4B,KAAK,OAAO,CAAC;QACxE,IAAI,EAAE,oBAAoB,EAAE,CAAC;QAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QACrE,KAAK,IAAI,aAAa,CAAC,oBAAoB,CAAC,CAAC;KAC9C,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,qBAAqB,EAAE;gBACrB,WAAW,EAAE,OAAO,2BAA2B,CAAC;aACjD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAC9C,UAAU,CAAC,uBAAuB,CAAC,EAAE,4BAA4B;AACjE,AADqC,4BAA4B;AACjE;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,GAAG,oBAAoB,EAAE,2EAA2E;AACrG,mCAAmC,CA8JpC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ListInputFieldChoicesSchema, InputFieldChoiceItemSchema, } from "./schemas";
|
|
2
2
|
import { ZapierApiError, ZapierConfigurationError } from "../../types/errors";
|
|
3
3
|
import { createPaginatedFunction } from "../../utils/function-utils";
|
|
4
|
+
import { DEFAULT_PAGE_SIZE } from "../../constants";
|
|
4
5
|
import { appKeyResolver, actionTypeResolver, actionKeyResolver, connectionIdResolver, inputFieldKeyResolver, inputsAllOptionalResolver, } from "../../resolvers";
|
|
5
6
|
import { fetchImplementationNeeds, fetchImplementationChoices, } from "../../services/implementations";
|
|
6
7
|
import { createTelemetryCallback } from "../../utils/telemetry-utils";
|
|
@@ -97,7 +98,7 @@ export const listInputFieldChoicesPlugin = ({ context, sdk }) => {
|
|
|
97
98
|
};
|
|
98
99
|
}
|
|
99
100
|
const methodName = stripPageSuffix(listInputFieldChoicesPage.name);
|
|
100
|
-
const listInputFieldChoicesDefinition = createPaginatedFunction(listInputFieldChoicesPage, ListInputFieldChoicesSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName), methodName);
|
|
101
|
+
const listInputFieldChoicesDefinition = createPaginatedFunction(listInputFieldChoicesPage, ListInputFieldChoicesSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName), methodName, DEFAULT_PAGE_SIZE);
|
|
101
102
|
return {
|
|
102
103
|
listInputFieldChoices: listInputFieldChoicesDefinition,
|
|
103
104
|
context: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listInputFields/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,YAAY,EACZ,aAAa,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,qBAAqB,EACrB,KAAK,sBAAsB,EAE5B,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listInputFields/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,YAAY,EACZ,aAAa,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,qBAAqB,EACrB,KAAK,sBAAsB,EAE5B,MAAM,WAAW,CAAC;AAInB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAYxE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AA2J7D,MAAM,WAAW,6BAA6B;IAC5C,eAAe,EAAE,CAAC,OAAO,CAAC,EAAE,sBAAsB,KAAK,OAAO,CAAC;QAC7D,IAAI,EAAE,aAAa,EAAE,CAAC;QACtB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,aAAa,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QAC9D,KAAK,IAAI,aAAa,CAAC,cAAc,GAAG,aAAa,GAAG,YAAY,CAAC,CAAC;KACvE,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,eAAe,EAAE;gBACf,WAAW,EAAE,OAAO,qBAAqB,CAAC;aAC3C,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,qBAAqB,EAAE,MAAM,CACxC,UAAU,CAAC,oBAAoB,GAAG,uBAAuB,CAAC,EAAE,uCAAuC;AACnG,AAD4D,uCAAuC;AACnG;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,GAAG,oBAAoB,EAAE,2EAA2E;AACrG,6BAA6B,CAkG9B,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ListInputFieldsSchema, } from "./schemas";
|
|
2
2
|
import { ZapierConfigurationError } from "../../types/errors";
|
|
3
3
|
import { createPaginatedFunction } from "../../utils/function-utils";
|
|
4
|
+
import { DEFAULT_PAGE_SIZE } from "../../constants";
|
|
4
5
|
import { appKeyResolver, actionTypeResolver, actionKeyResolver, connectionIdResolver, inputsAllOptionalResolver, } from "../../resolvers";
|
|
5
6
|
import { RootFieldItemSchema } from "../../schemas/Field";
|
|
6
7
|
import { toTitleCase, stripPageSuffix } from "../../utils/string-utils";
|
|
@@ -187,7 +188,7 @@ export const listInputFieldsPlugin = ({ sdk, context }) => {
|
|
|
187
188
|
};
|
|
188
189
|
}
|
|
189
190
|
const methodName = stripPageSuffix(listInputFieldsPage.name);
|
|
190
|
-
const listInputFieldsDefinition = createPaginatedFunction(listInputFieldsPage, ListInputFieldsSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName), methodName);
|
|
191
|
+
const listInputFieldsDefinition = createPaginatedFunction(listInputFieldsPage, ListInputFieldsSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName), methodName, DEFAULT_PAGE_SIZE);
|
|
191
192
|
return {
|
|
192
193
|
listInputFields: listInputFieldsDefinition,
|
|
193
194
|
context: {
|
|
@@ -23,6 +23,8 @@ export interface RunActionPluginProvides {
|
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
+
export declare const CONTEXT_CACHE_TTL_MS = 60000;
|
|
27
|
+
export declare const CONTEXT_CACHE_MAX_SIZE = 500;
|
|
26
28
|
export declare const runActionPlugin: Plugin<GetSdkType<GetActionPluginProvides & GetAppPluginProvides>, // requires getAction and getApp in SDK
|
|
27
29
|
// requires getAction and getApp in SDK
|
|
28
30
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/runAction/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EACL,eAAe,EACf,KAAK,gBAAgB,EAEtB,MAAM,WAAW,CAAC;AAQnB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAQtD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAExE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAK7D,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,CAAC,OAAO,CAAC,EAAE,gBAAgB,KAAK,OAAO,CAAC;QACjD,IAAI,EAAE,GAAG,EAAE,CAAC;QACZ,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,GAAG,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QACpD,KAAK,IAAI,aAAa,CAAC,GAAG,CAAC,CAAC;KAC7B,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,SAAS,EAAE;gBACT,WAAW,EAAE,OAAO,eAAe,CAAC;aACrC,CAAC;SACH,CAAC;KACH,CAAC;CACH;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/runAction/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EACL,eAAe,EACf,KAAK,gBAAgB,EAEtB,MAAM,WAAW,CAAC;AAQnB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAQtD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAExE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAK7D,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,CAAC,OAAO,CAAC,EAAE,gBAAgB,KAAK,OAAO,CAAC;QACjD,IAAI,EAAE,GAAG,EAAE,CAAC;QACZ,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,GAAG,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QACpD,KAAK,IAAI,aAAa,CAAC,GAAG,CAAC,CAAC;KAC7B,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,SAAS,EAAE;gBACT,WAAW,EAAE,OAAO,eAAe,CAAC;aACrC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAsFD,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAC3C,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C,eAAO,MAAM,eAAe,EAAE,MAAM,CAClC,UAAU,CAAC,uBAAuB,GAAG,oBAAoB,CAAC,EAAE,uCAAuC;AACnG,AAD4D,uCAAuC;AACnG;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,GAAG,oBAAoB,EAAE,4CAA4C;AACtE,uBAAuB,CAyLxB,CAAC"}
|
|
@@ -8,7 +8,7 @@ import { stripPageSuffix } from "../../utils/string-utils";
|
|
|
8
8
|
import { DEFAULT_ACTION_TIMEOUT_MS } from "../../constants";
|
|
9
9
|
import { setMethodMetadata } from "../../utils/telemetry-context";
|
|
10
10
|
async function executeAction(actionOptions) {
|
|
11
|
-
const { api, selectedApi, actionId, actionKey, actionType, executionOptions, connectionId, timeoutMs, } = actionOptions;
|
|
11
|
+
const { api, selectedApi, actionId, actionKey, actionType, executionOptions, cursor, connectionId, timeoutMs, } = actionOptions;
|
|
12
12
|
// Step 1: POST to /actions/v1/runs to start execution
|
|
13
13
|
const runRequestData = {
|
|
14
14
|
selected_api: selectedApi,
|
|
@@ -22,6 +22,9 @@ async function executeAction(actionOptions) {
|
|
|
22
22
|
if (connectionId !== null && connectionId !== undefined) {
|
|
23
23
|
runRequestData.authentication_id = connectionId;
|
|
24
24
|
}
|
|
25
|
+
if (cursor) {
|
|
26
|
+
runRequestData.page = cursor;
|
|
27
|
+
}
|
|
25
28
|
const runRequest = {
|
|
26
29
|
data: runRequestData,
|
|
27
30
|
};
|
|
@@ -39,21 +42,62 @@ async function executeAction(actionOptions) {
|
|
|
39
42
|
resultExtractor: (result) => result.data,
|
|
40
43
|
});
|
|
41
44
|
}
|
|
45
|
+
export const CONTEXT_CACHE_TTL_MS = 60000;
|
|
46
|
+
export const CONTEXT_CACHE_MAX_SIZE = 500;
|
|
42
47
|
export const runActionPlugin = ({ sdk, context }) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
// Intentionally kept inline — only this plugin needs this pattern today.
|
|
49
|
+
// If a second plugin needs a bounded TTL cache, extract to a shared utility.
|
|
50
|
+
const runActionContextCache = new Map();
|
|
51
|
+
function evictIfNeeded() {
|
|
52
|
+
if (runActionContextCache.size < CONTEXT_CACHE_MAX_SIZE)
|
|
53
|
+
return;
|
|
54
|
+
const now = Date.now();
|
|
55
|
+
let oldestKey;
|
|
56
|
+
let oldestExpiry = Infinity;
|
|
57
|
+
let evictedAny = false;
|
|
58
|
+
for (const [key, entry] of runActionContextCache) {
|
|
59
|
+
if (now >= entry.expiresAt) {
|
|
60
|
+
runActionContextCache.delete(key);
|
|
61
|
+
evictedAny = true;
|
|
62
|
+
}
|
|
63
|
+
else if (entry.expiresAt < oldestExpiry) {
|
|
64
|
+
oldestExpiry = entry.expiresAt;
|
|
65
|
+
oldestKey = key;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (!evictedAny && oldestKey) {
|
|
69
|
+
runActionContextCache.delete(oldestKey);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function getRunActionContext(options) {
|
|
73
|
+
const { appKey, actionKey, actionType } = options;
|
|
74
|
+
const contextKey = `${appKey}:${actionKey}:${actionType}`;
|
|
75
|
+
const cached = runActionContextCache.get(contextKey);
|
|
76
|
+
if (cached && Date.now() < cached.expiresAt) {
|
|
77
|
+
return cached.promise;
|
|
78
|
+
}
|
|
79
|
+
const pendingContext = resolveRunActionContext(options).catch((error) => {
|
|
80
|
+
// Only delete our own entry — a later interleaved call for the same key
|
|
81
|
+
// may have already replaced it with a fresh promise.
|
|
82
|
+
const current = runActionContextCache.get(contextKey);
|
|
83
|
+
if (current?.promise === pendingContext) {
|
|
84
|
+
runActionContextCache.delete(contextKey);
|
|
85
|
+
}
|
|
86
|
+
throw error;
|
|
87
|
+
});
|
|
88
|
+
evictIfNeeded();
|
|
89
|
+
runActionContextCache.set(contextKey, {
|
|
90
|
+
promise: pendingContext,
|
|
91
|
+
expiresAt: Date.now() + CONTEXT_CACHE_TTL_MS,
|
|
92
|
+
});
|
|
93
|
+
return pendingContext;
|
|
94
|
+
}
|
|
95
|
+
async function resolveRunActionContext(options) {
|
|
96
|
+
const { appKey, actionKey, actionType } = options;
|
|
48
97
|
const selectedApi = await context.getVersionedImplementationId(appKey);
|
|
49
98
|
if (!selectedApi) {
|
|
50
99
|
throw new ZapierConfigurationError("No current_implementation_id found for app", { configType: "current_implementation_id" });
|
|
51
100
|
}
|
|
52
|
-
setMethodMetadata({
|
|
53
|
-
selectedApi,
|
|
54
|
-
operationType: actionType,
|
|
55
|
-
operationKey: actionKey,
|
|
56
|
-
});
|
|
57
101
|
// Validate that the action exists using the getAction plugin
|
|
58
102
|
const actionData = await sdk.getAction({
|
|
59
103
|
appKey: appKey,
|
|
@@ -64,7 +108,19 @@ export const runActionPlugin = ({ sdk, context }) => {
|
|
|
64
108
|
if (actionData.data.action_type !== actionType) {
|
|
65
109
|
throw new ZapierValidationError(`Action type mismatch: expected ${actionType}, got ${actionData.data.action_type}`);
|
|
66
110
|
}
|
|
67
|
-
|
|
111
|
+
return { selectedApi, actionId: actionData.data.id };
|
|
112
|
+
}
|
|
113
|
+
async function runActionPage(options) {
|
|
114
|
+
const { api } = context;
|
|
115
|
+
const { appKey, actionKey, actionType, connectionId, authenticationId, inputs = {}, cursor, timeoutMs, } = options;
|
|
116
|
+
// Support both connectionId (new) and authenticationId (deprecated)
|
|
117
|
+
const resolvedConnectionId = connectionId ?? authenticationId;
|
|
118
|
+
const { selectedApi, actionId } = await getRunActionContext(options);
|
|
119
|
+
setMethodMetadata({
|
|
120
|
+
selectedApi,
|
|
121
|
+
operationType: actionType,
|
|
122
|
+
operationKey: actionKey,
|
|
123
|
+
});
|
|
68
124
|
// Execute the action using the Actions API (supports all action types)
|
|
69
125
|
const result = await executeAction({
|
|
70
126
|
api,
|
|
@@ -75,6 +131,7 @@ export const runActionPlugin = ({ sdk, context }) => {
|
|
|
75
131
|
actionKey,
|
|
76
132
|
actionType,
|
|
77
133
|
executionOptions: { inputs },
|
|
134
|
+
cursor,
|
|
78
135
|
connectionId: resolvedConnectionId,
|
|
79
136
|
timeoutMs,
|
|
80
137
|
});
|
|
@@ -88,13 +145,15 @@ export const runActionPlugin = ({ sdk, context }) => {
|
|
|
88
145
|
actionKey,
|
|
89
146
|
});
|
|
90
147
|
}
|
|
91
|
-
// Return the results array wrapped in data with empty nextCursor (no pagination for action execution)
|
|
92
148
|
return {
|
|
93
149
|
data: result.results || [],
|
|
94
|
-
nextCursor:
|
|
150
|
+
nextCursor: result.next_page,
|
|
95
151
|
};
|
|
96
152
|
}
|
|
97
153
|
const methodName = stripPageSuffix(runActionPage.name);
|
|
154
|
+
// No defaultPageSize — we leave the default to the Actions API rather than
|
|
155
|
+
// eagerly running more actions than the user intends to
|
|
156
|
+
// (and avoid potentially hitting app rate limits).
|
|
98
157
|
const runActionDefinition = createPaginatedFunction(runActionPage, RunActionSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName), methodName);
|
|
99
158
|
return {
|
|
100
159
|
runAction: runActionDefinition,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/listTableRecords/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpE,OAAO,EAEL,6BAA6B,EAE7B,KAAK,uBAAuB,EAC5B,KAAK,UAAU,EAChB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/listTableRecords/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpE,OAAO,EAEL,6BAA6B,EAE7B,KAAK,uBAAuB,EAC5B,KAAK,UAAU,EAChB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AA6BhE,MAAM,WAAW,8BAA8B;IAC7C,gBAAgB,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,OAAO,CAAC;QAC9D,IAAI,EAAE,UAAU,EAAE,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,UAAU,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QAC3D,KAAK,IAAI,aAAa,CAAC,UAAU,CAAC,CAAC;KACpC,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,gBAAgB,EAAE;gBAChB,WAAW,EAAE,OAAO,6BAA6B,CAAC;aACnD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,sBAAsB,EAAE,MAAM,CACzC,EAAE,EACF,cAAc,CAAC,iBAAiB,CAAC,GAAG,oBAAoB,EACxD,8BAA8B,CA+G/B,CAAC"}
|
|
@@ -6,6 +6,7 @@ import { ZapierAuthenticationError } from "../../../types/errors";
|
|
|
6
6
|
import { tableIdResolver, tableFiltersResolver, tableSortResolver, } from "../../../resolvers";
|
|
7
7
|
import { tableRecordFormatter } from "../../../formatters";
|
|
8
8
|
import { createFieldKeyTranslator, transformRecordItem, throwOnResponseErrors, } from "../utils";
|
|
9
|
+
import { DEFAULT_PAGE_SIZE } from "../../../constants";
|
|
9
10
|
function extractNextCursor(meta) {
|
|
10
11
|
if (!meta?.pagination?.has_more || !meta.pagination.end_cursor) {
|
|
11
12
|
return undefined;
|
|
@@ -20,9 +21,10 @@ export const listTableRecordsPlugin = ({ context }) => {
|
|
|
20
21
|
tableId: options.tableId,
|
|
21
22
|
keyMode: options.keyMode,
|
|
22
23
|
});
|
|
23
|
-
const body = {
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
const body = {};
|
|
25
|
+
if (options.pageSize !== undefined) {
|
|
26
|
+
body.limit = options.pageSize;
|
|
27
|
+
}
|
|
26
28
|
if (options.filters) {
|
|
27
29
|
body.filters = options.filters.map((f) => ({
|
|
28
30
|
key: translator.translateFieldKey(f.fieldKey),
|
|
@@ -71,7 +73,7 @@ export const listTableRecordsPlugin = ({ context }) => {
|
|
|
71
73
|
};
|
|
72
74
|
}
|
|
73
75
|
const methodName = stripPageSuffix(listTableRecordsPage.name);
|
|
74
|
-
const listTableRecordsDefinition = createPaginatedFunction(listTableRecordsPage, ListTableRecordsOptionsSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName), methodName);
|
|
76
|
+
const listTableRecordsDefinition = createPaginatedFunction(listTableRecordsPage, ListTableRecordsOptionsSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName), methodName, DEFAULT_PAGE_SIZE);
|
|
75
77
|
return {
|
|
76
78
|
listTableRecords: listTableRecordsDefinition,
|
|
77
79
|
context: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/listTables/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpE,OAAO,EAEL,uBAAuB,EAEvB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACf,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/tables/listTables/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpE,OAAO,EAEL,uBAAuB,EAEvB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACf,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAsBhE,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,CAAC,OAAO,CAAC,EAAE,iBAAiB,KAAK,OAAO,CAAC;QACnD,IAAI,EAAE,SAAS,EAAE,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QAC1D,KAAK,IAAI,aAAa,CAAC,SAAS,CAAC,CAAC;KACnC,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,UAAU,EAAE;gBACV,WAAW,EAAE,OAAO,uBAAuB,CAAC;aAC7C,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,gBAAgB,EAAE,MAAM,CACnC,EAAE,EACF,cAAc,CAAC,iBAAiB,CAAC,GAAG,oBAAoB,EACxD,wBAAwB,CAsFzB,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { createTelemetryCallback } from "../../../utils/telemetry-utils";
|
|
|
4
4
|
import { stripPageSuffix } from "../../../utils/string-utils";
|
|
5
5
|
import { ZapierAuthenticationError } from "../../../types/errors";
|
|
6
6
|
import { transformTableItem } from "../utils";
|
|
7
|
+
import { DEFAULT_PAGE_SIZE } from "../../../constants";
|
|
7
8
|
function extractNextCursor(links) {
|
|
8
9
|
if (!links?.next) {
|
|
9
10
|
return undefined;
|
|
@@ -20,9 +21,10 @@ function extractNextCursor(links) {
|
|
|
20
21
|
export const listTablesPlugin = ({ context }) => {
|
|
21
22
|
async function listTablesPage(options) {
|
|
22
23
|
const { api } = context;
|
|
23
|
-
const searchParams = {
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
const searchParams = {};
|
|
25
|
+
if (options.pageSize !== undefined) {
|
|
26
|
+
searchParams.limit = options.pageSize.toString();
|
|
27
|
+
}
|
|
26
28
|
if (options?.tableIds && options.tableIds.length > 0) {
|
|
27
29
|
searchParams.ids = options.tableIds.join(",");
|
|
28
30
|
}
|
|
@@ -65,7 +67,7 @@ export const listTablesPlugin = ({ context }) => {
|
|
|
65
67
|
};
|
|
66
68
|
}
|
|
67
69
|
const methodName = stripPageSuffix(listTablesPage.name);
|
|
68
|
-
const listTablesDefinition = createPaginatedFunction(listTablesPage, ListTablesOptionsSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName), methodName);
|
|
70
|
+
const listTablesDefinition = createPaginatedFunction(listTablesPage, ListTablesOptionsSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, methodName), methodName, DEFAULT_PAGE_SIZE);
|
|
69
71
|
return {
|
|
70
72
|
listTables: listTablesDefinition,
|
|
71
73
|
context: {
|
|
@@ -48,8 +48,8 @@ type ItemType<TResult> = TResult extends {
|
|
|
48
48
|
data: infer TData;
|
|
49
49
|
} ? TData extends readonly (infer TItem)[] ? TItem : TData : TResult extends readonly (infer TItem)[] ? TItem : TResult;
|
|
50
50
|
export declare function createPaginatedFunction<TOptions, TResult, TSchemaOptions extends TOptions = TOptions>(coreFn: (options: TOptions & {
|
|
51
|
-
pageSize
|
|
52
|
-
}) => Promise<TResult>, schema?: z.ZodSchema<TSchemaOptions>, telemetry?: TelemetryCallbacks, explicitFunctionName?: string): (options?: TOptions & {
|
|
51
|
+
pageSize?: number;
|
|
52
|
+
}) => Promise<TResult>, schema?: z.ZodSchema<TSchemaOptions>, telemetry?: TelemetryCallbacks, explicitFunctionName?: string, defaultPageSize?: number): (options?: TOptions & {
|
|
53
53
|
cursor?: string;
|
|
54
54
|
pageSize?: number;
|
|
55
55
|
maxItems?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function-utils.d.ts","sourceRoot":"","sources":["../../src/utils/function-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAa7B;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE;QACtB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,OAAO,CAAC;QACjB,KAAK,CAAC,EAAE,KAAK,CAAC;QACd,aAAa,EAAE,MAAM,CAAC;QACtB,WAAW,EAAE,OAAO,CAAC;KACtB,KAAK,IAAI,CAAC;CACZ;AAUD;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,GAChD,MAAM,GAAG,SAAS,CAYpB;AAyBD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EACR,OAAO,EACP,cAAc,SAAS,QAAQ,GAAG,QAAQ,EAE1C,MAAM,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,OAAO,CAAC,EAC/C,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,EACpC,SAAS,CAAC,EAAE,kBAAkB,cAMc,QAAQ,KAAG,OAAO,CAAC,OAAO,CAAC,CAsExE;AA6DD;;;;;GAKG;AACH,KAAK,eAAe,CAAC,OAAO,IAAI,OAAO,SAAS;IAC9C,IAAI,EAAE,GAAG,CAAC;IACV,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GACG,OAAO,GACP;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3C,KAAK,QAAQ,CAAC,OAAO,IAAI,OAAO,SAAS;IAAE,IAAI,EAAE,MAAM,KAAK,CAAA;CAAE,GAC1D,KAAK,SAAS,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,GACpC,KAAK,GACL,KAAK,GACP,OAAO,SAAS,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,GACtC,KAAK,GACL,OAAO,CAAC;AAEd,wBAAgB,uBAAuB,CACrC,QAAQ,EACR,OAAO,EACP,cAAc,SAAS,QAAQ,GAAG,QAAQ,EAE1C,MAAM,EAAE,CAAC,OAAO,EAAE,QAAQ,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"function-utils.d.ts","sourceRoot":"","sources":["../../src/utils/function-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAa7B;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE;QACtB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,OAAO,CAAC;QACjB,KAAK,CAAC,EAAE,KAAK,CAAC;QACd,aAAa,EAAE,MAAM,CAAC;QACtB,WAAW,EAAE,OAAO,CAAC;KACtB,KAAK,IAAI,CAAC;CACZ;AAUD;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,GAChD,MAAM,GAAG,SAAS,CAYpB;AAyBD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EACR,OAAO,EACP,cAAc,SAAS,QAAQ,GAAG,QAAQ,EAE1C,MAAM,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,OAAO,CAAC,EAC/C,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,EACpC,SAAS,CAAC,EAAE,kBAAkB,cAMc,QAAQ,KAAG,OAAO,CAAC,OAAO,CAAC,CAsExE;AA6DD;;;;;GAKG;AACH,KAAK,eAAe,CAAC,OAAO,IAAI,OAAO,SAAS;IAC9C,IAAI,EAAE,GAAG,CAAC;IACV,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GACG,OAAO,GACP;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3C,KAAK,QAAQ,CAAC,OAAO,IAAI,OAAO,SAAS;IAAE,IAAI,EAAE,MAAM,KAAK,CAAA;CAAE,GAC1D,KAAK,SAAS,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,GACpC,KAAK,GACL,KAAK,GACP,OAAO,SAAS,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,GACtC,KAAK,GACL,OAAO,CAAC;AAEd,wBAAgB,uBAAuB,CACrC,QAAQ,EACR,OAAO,EACP,cAAc,SAAS,QAAQ,GAAG,QAAQ,EAE1C,MAAM,EAAE,CAAC,OAAO,EAAE,QAAQ,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAAC,OAAO,CAAC,EACvE,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,EACpC,SAAS,CAAC,EAAE,kBAAkB,EAC9B,oBAAoB,CAAC,EAAE,MAAM,EAC7B,eAAe,CAAC,EAAE,MAAM,GACvB,CACD,OAAO,CAAC,EAAE,QAAQ,GAAG;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,KACE,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,GACpC,aAAa,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,GAAG;IACxC,KAAK,IAAI,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;CAC3C,CAiHF"}
|
|
@@ -155,7 +155,7 @@ function createPageFunction(coreFn) {
|
|
|
155
155
|
};
|
|
156
156
|
return namedFunctions[functionName];
|
|
157
157
|
}
|
|
158
|
-
export function createPaginatedFunction(coreFn, schema, telemetry, explicitFunctionName) {
|
|
158
|
+
export function createPaginatedFunction(coreFn, schema, telemetry, explicitFunctionName, defaultPageSize) {
|
|
159
159
|
const pageFunction = createPageFunction(coreFn);
|
|
160
160
|
const functionName = explicitFunctionName || coreFn.name;
|
|
161
161
|
const validator = schema ? createValidator(schema) : null;
|
|
@@ -172,8 +172,7 @@ export function createPaginatedFunction(coreFn, schema, telemetry, explicitFunct
|
|
|
172
172
|
...normalizedOptions,
|
|
173
173
|
...(validator ? validator(normalizedOptions) : normalizedOptions),
|
|
174
174
|
};
|
|
175
|
-
|
|
176
|
-
const pageSize = validatedOptions.pageSize || 100;
|
|
175
|
+
const pageSize = validatedOptions.pageSize ?? defaultPageSize;
|
|
177
176
|
const optimizedOptions = {
|
|
178
177
|
...validatedOptions,
|
|
179
178
|
pageSize,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zapier/zapier-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.0",
|
|
4
4
|
"description": "Complete Zapier SDK - combines all Zapier SDK packages",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -34,6 +34,11 @@
|
|
|
34
34
|
],
|
|
35
35
|
"author": "",
|
|
36
36
|
"license": "SEE LICENSE IN LICENSE",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "https://gitlab.com/zapier/zapier-sdk/zapier-sdk.git",
|
|
40
|
+
"directory": "packages/zapier-sdk"
|
|
41
|
+
},
|
|
37
42
|
"publishConfig": {
|
|
38
43
|
"access": "public"
|
|
39
44
|
},
|