@zapier/zapier-sdk 0.45.2 → 0.46.1
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 +12 -0
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +24 -7
- package/dist/api/schemas.d.ts +5 -5
- package/dist/api/types.d.ts +17 -0
- package/dist/api/types.d.ts.map +1 -1
- package/dist/auth.d.ts +27 -6
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +130 -92
- package/dist/cache.d.ts +50 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +47 -0
- package/dist/index.cjs +3108 -3695
- package/dist/index.d.mts +6735 -2188
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.mjs +3105 -3696
- package/dist/plugins/api/index.d.ts +22 -10
- package/dist/plugins/api/index.d.ts.map +1 -1
- package/dist/plugins/api/index.js +4 -4
- package/dist/plugins/apps/index.d.ts +108 -7
- package/dist/plugins/apps/index.d.ts.map +1 -1
- package/dist/plugins/apps/index.js +3 -4
- package/dist/plugins/capabilities/index.d.ts +9 -6
- package/dist/plugins/capabilities/index.d.ts.map +1 -1
- package/dist/plugins/capabilities/index.js +3 -2
- package/dist/plugins/connections/index.d.ts +15 -9
- package/dist/plugins/connections/index.d.ts.map +1 -1
- package/dist/plugins/connections/index.js +3 -2
- package/dist/plugins/createClientCredentials/index.d.ts +26 -14
- package/dist/plugins/createClientCredentials/index.d.ts.map +1 -1
- package/dist/plugins/createClientCredentials/index.js +16 -39
- package/dist/plugins/createClientCredentials/schemas.d.ts +0 -2
- package/dist/plugins/createClientCredentials/schemas.d.ts.map +1 -1
- package/dist/plugins/deleteClientCredentials/index.d.ts +20 -14
- package/dist/plugins/deleteClientCredentials/index.d.ts.map +1 -1
- package/dist/plugins/deleteClientCredentials/index.js +18 -37
- package/dist/plugins/deleteClientCredentials/schemas.d.ts +0 -2
- package/dist/plugins/deleteClientCredentials/schemas.d.ts.map +1 -1
- package/dist/plugins/deprecated/authentications.d.ts +597 -41
- package/dist/plugins/deprecated/authentications.d.ts.map +1 -1
- package/dist/plugins/deprecated/authentications.js +9 -8
- package/dist/plugins/eventEmission/index.d.ts +9 -6
- package/dist/plugins/eventEmission/index.d.ts.map +1 -1
- package/dist/plugins/eventEmission/index.js +3 -2
- package/dist/plugins/fetch/index.d.ts +40 -17
- package/dist/plugins/fetch/index.d.ts.map +1 -1
- package/dist/plugins/fetch/index.js +6 -4
- package/dist/plugins/findFirstConnection/index.d.ts +109 -14
- package/dist/plugins/findFirstConnection/index.d.ts.map +1 -1
- package/dist/plugins/findFirstConnection/index.js +14 -26
- package/dist/plugins/findFirstConnection/schemas.d.ts +0 -2
- package/dist/plugins/findFirstConnection/schemas.d.ts.map +1 -1
- package/dist/plugins/findUniqueConnection/index.d.ts +109 -14
- package/dist/plugins/findUniqueConnection/index.d.ts.map +1 -1
- package/dist/plugins/findUniqueConnection/index.js +14 -26
- package/dist/plugins/findUniqueConnection/schemas.d.ts +0 -2
- package/dist/plugins/findUniqueConnection/schemas.d.ts.map +1 -1
- package/dist/plugins/getAction/index.d.ts +68 -15
- package/dist/plugins/getAction/index.d.ts.map +1 -1
- package/dist/plugins/getAction/index.js +21 -31
- package/dist/plugins/getAction/schemas.d.ts +4 -6
- package/dist/plugins/getAction/schemas.d.ts.map +1 -1
- package/dist/plugins/getApp/index.d.ts +140 -14
- package/dist/plugins/getApp/index.d.ts.map +1 -1
- package/dist/plugins/getApp/index.js +16 -38
- package/dist/plugins/getApp/schemas.d.ts +0 -2
- package/dist/plugins/getApp/schemas.d.ts.map +1 -1
- package/dist/plugins/getConnection/index.d.ts +50 -16
- package/dist/plugins/getConnection/index.d.ts.map +1 -1
- package/dist/plugins/getConnection/index.js +22 -29
- package/dist/plugins/getConnection/schemas.d.ts +0 -2
- package/dist/plugins/getConnection/schemas.d.ts.map +1 -1
- package/dist/plugins/getInputFieldsSchema/index.d.ts +59 -13
- package/dist/plugins/getInputFieldsSchema/index.d.ts.map +1 -1
- package/dist/plugins/getInputFieldsSchema/index.js +21 -32
- package/dist/plugins/getInputFieldsSchema/schemas.d.ts +4 -6
- package/dist/plugins/getInputFieldsSchema/schemas.d.ts.map +1 -1
- package/dist/plugins/getProfile/index.d.ts +25 -18
- package/dist/plugins/getProfile/index.d.ts.map +1 -1
- package/dist/plugins/getProfile/index.js +13 -26
- package/dist/plugins/getProfile/schemas.d.ts +0 -8
- package/dist/plugins/getProfile/schemas.d.ts.map +1 -1
- package/dist/plugins/getProfile/schemas.js +0 -1
- package/dist/plugins/listActions/index.d.ts +73 -23
- package/dist/plugins/listActions/index.d.ts.map +1 -1
- package/dist/plugins/listActions/index.js +25 -53
- package/dist/plugins/listActions/schemas.d.ts +4 -15
- package/dist/plugins/listActions/schemas.d.ts.map +1 -1
- package/dist/plugins/listApps/index.d.ts +121 -13
- package/dist/plugins/listApps/index.d.ts.map +1 -1
- package/dist/plugins/listApps/index.js +22 -31
- package/dist/plugins/listApps/schemas.d.ts +0 -2
- package/dist/plugins/listApps/schemas.d.ts.map +1 -1
- package/dist/plugins/listClientCredentials/index.d.ts +29 -16
- package/dist/plugins/listClientCredentials/index.d.ts.map +1 -1
- package/dist/plugins/listClientCredentials/index.js +17 -37
- package/dist/plugins/listClientCredentials/schemas.d.ts +0 -2
- package/dist/plugins/listClientCredentials/schemas.d.ts.map +1 -1
- package/dist/plugins/listConnections/index.d.ts +95 -17
- package/dist/plugins/listConnections/index.d.ts.map +1 -1
- package/dist/plugins/listConnections/index.js +25 -49
- package/dist/plugins/listConnections/schemas.d.ts +0 -2
- package/dist/plugins/listConnections/schemas.d.ts.map +1 -1
- package/dist/plugins/listInputFieldChoices/index.d.ts +77 -22
- package/dist/plugins/listInputFieldChoices/index.d.ts.map +1 -1
- package/dist/plugins/listInputFieldChoices/index.js +27 -50
- package/dist/plugins/listInputFieldChoices/schemas.d.ts +4 -6
- package/dist/plugins/listInputFieldChoices/schemas.d.ts.map +1 -1
- package/dist/plugins/listInputFields/index.d.ts +154 -22
- package/dist/plugins/listInputFields/index.d.ts.map +1 -1
- package/dist/plugins/listInputFields/index.js +28 -41
- package/dist/plugins/listInputFields/schemas.d.ts +4 -6
- package/dist/plugins/listInputFields/schemas.d.ts.map +1 -1
- package/dist/plugins/manifest/index.d.ts +40 -36
- package/dist/plugins/manifest/index.d.ts.map +1 -1
- package/dist/plugins/manifest/index.js +3 -2
- package/dist/plugins/registry/index.d.ts +11 -9
- package/dist/plugins/registry/index.d.ts.map +1 -1
- package/dist/plugins/registry/index.js +3 -2
- package/dist/plugins/request/index.d.ts +61 -15
- package/dist/plugins/request/index.d.ts.map +1 -1
- package/dist/plugins/request/index.js +14 -22
- package/dist/plugins/request/schemas.d.ts +0 -2
- package/dist/plugins/request/schemas.d.ts.map +1 -1
- package/dist/plugins/runAction/index.d.ts +137 -23
- package/dist/plugins/runAction/index.d.ts.map +1 -1
- package/dist/plugins/runAction/index.js +65 -78
- package/dist/plugins/runAction/schemas.d.ts +4 -14
- package/dist/plugins/runAction/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/createTable/index.d.ts +43 -11
- package/dist/plugins/tables/createTable/index.d.ts.map +1 -1
- package/dist/plugins/tables/createTable/index.js +16 -44
- package/dist/plugins/tables/createTable/schemas.d.ts +0 -2
- package/dist/plugins/tables/createTable/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/createTableFields/index.d.ts +54 -11
- package/dist/plugins/tables/createTableFields/index.d.ts.map +1 -1
- package/dist/plugins/tables/createTableFields/index.js +17 -41
- package/dist/plugins/tables/createTableFields/schemas.d.ts +21 -23
- package/dist/plugins/tables/createTableFields/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/createTableRecords/index.d.ts +47 -11
- package/dist/plugins/tables/createTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/createTableRecords/index.js +17 -43
- package/dist/plugins/tables/createTableRecords/schemas.d.ts +0 -2
- package/dist/plugins/tables/createTableRecords/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTable/index.d.ts +36 -13
- package/dist/plugins/tables/deleteTable/index.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTable/index.js +18 -40
- package/dist/plugins/tables/deleteTable/schemas.d.ts +0 -2
- package/dist/plugins/tables/deleteTable/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTableFields/index.d.ts +36 -11
- package/dist/plugins/tables/deleteTableFields/index.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTableFields/index.js +17 -39
- package/dist/plugins/tables/deleteTableFields/schemas.d.ts +0 -2
- package/dist/plugins/tables/deleteTableFields/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTableRecords/index.d.ts +36 -11
- package/dist/plugins/tables/deleteTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/deleteTableRecords/index.js +18 -41
- package/dist/plugins/tables/deleteTableRecords/schemas.d.ts +0 -2
- package/dist/plugins/tables/deleteTableRecords/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/getTable/index.d.ts +43 -12
- package/dist/plugins/tables/getTable/index.d.ts.map +1 -1
- package/dist/plugins/tables/getTable/index.js +18 -43
- package/dist/plugins/tables/getTable/schemas.d.ts +0 -2
- package/dist/plugins/tables/getTable/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/getTableRecord/index.d.ts +43 -11
- package/dist/plugins/tables/getTableRecord/index.d.ts.map +1 -1
- package/dist/plugins/tables/getTableRecord/index.js +18 -42
- package/dist/plugins/tables/getTableRecord/schemas.d.ts +0 -2
- package/dist/plugins/tables/getTableRecord/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/listTableFields/index.d.ts +46 -11
- package/dist/plugins/tables/listTableFields/index.d.ts.map +1 -1
- package/dist/plugins/tables/listTableFields/index.js +17 -41
- package/dist/plugins/tables/listTableFields/schemas.d.ts +12 -14
- package/dist/plugins/tables/listTableFields/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/listTableRecords/index.d.ts +66 -18
- package/dist/plugins/tables/listTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/listTableRecords/index.js +27 -50
- package/dist/plugins/tables/listTableRecords/schemas.d.ts +6 -8
- package/dist/plugins/tables/listTableRecords/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/listTables/index.d.ts +53 -20
- package/dist/plugins/tables/listTables/index.d.ts.map +1 -1
- package/dist/plugins/tables/listTables/index.js +24 -51
- package/dist/plugins/tables/listTables/schemas.d.ts +0 -2
- package/dist/plugins/tables/listTables/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/shared.d.ts +10 -0
- package/dist/plugins/tables/shared.d.ts.map +1 -0
- package/dist/plugins/tables/shared.js +9 -0
- package/dist/plugins/tables/updateTableRecords/index.d.ts +49 -11
- package/dist/plugins/tables/updateTableRecords/index.d.ts.map +1 -1
- package/dist/plugins/tables/updateTableRecords/index.js +20 -43
- package/dist/plugins/tables/updateTableRecords/schemas.d.ts +0 -2
- package/dist/plugins/tables/updateTableRecords/schemas.d.ts.map +1 -1
- package/dist/plugins/tables/utils.d.ts.map +1 -1
- package/dist/plugins/tables/utils.js +1 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +21 -1
- package/dist/resolvers/actionKey.d.ts +1 -2
- package/dist/resolvers/actionKey.d.ts.map +1 -1
- package/dist/resolvers/actionType.d.ts +1 -2
- package/dist/resolvers/actionType.d.ts.map +1 -1
- package/dist/schemas/Action.d.ts +1 -1
- package/dist/sdk.d.ts +2942 -2
- package/dist/sdk.d.ts.map +1 -1
- package/dist/types/credentials.d.ts +2 -1
- package/dist/types/credentials.d.ts.map +1 -1
- package/dist/types/credentials.js +2 -1
- package/dist/types/errors.d.ts +13 -10
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +15 -12
- package/dist/types/functions.d.ts +18 -2
- package/dist/types/functions.d.ts.map +1 -1
- package/dist/types/plugin.d.ts +1 -1
- package/dist/types/plugin.d.ts.map +1 -1
- package/dist/types/properties.d.ts +1 -1
- package/dist/types/registry.d.ts +1 -1
- package/dist/types/registry.d.ts.map +1 -1
- package/dist/types/sdk.d.ts +2 -0
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/types/sdk.js +1 -0
- package/dist/utils/function-utils.d.ts +11 -12
- package/dist/utils/function-utils.d.ts.map +1 -1
- package/dist/utils/plugin-utils.d.ts +168 -0
- package/dist/utils/plugin-utils.d.ts.map +1 -0
- package/dist/utils/plugin-utils.js +132 -0
- package/package.json +2 -4
package/dist/cache.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Best-effort cache for the SDK.
|
|
3
|
+
*
|
|
4
|
+
* The SDK uses this to avoid re-fetching values it can recreate, primarily
|
|
5
|
+
* client_credentials access tokens. Cache entries may disappear at any time:
|
|
6
|
+
* a miss is normal and callers must be able to rebuild the value.
|
|
7
|
+
*
|
|
8
|
+
* The default cache is in-memory. When the CLI package is installed, the SDK
|
|
9
|
+
* can opportunistically use its filesystem + keychain cache. Browser and
|
|
10
|
+
* minimal server deployments fall back to memory unless a caller injects a
|
|
11
|
+
* Redis, database, or environment-specific cache.
|
|
12
|
+
*
|
|
13
|
+
* Secrets: adapters receive a `secret: true` flag on `set` and decide
|
|
14
|
+
* what to do with it (keychain for the filesystem adapter; ignored for
|
|
15
|
+
* the in-memory adapter; user adapters can throw, plaintext, encrypt —
|
|
16
|
+
* their call). The value returned by `get` is always the plain secret.
|
|
17
|
+
*/
|
|
18
|
+
export interface ZapierCacheEntry {
|
|
19
|
+
value: string;
|
|
20
|
+
/** Millisecond epoch. Undefined means "no expiration recorded." */
|
|
21
|
+
expiresAt?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface ZapierCacheSetOptions {
|
|
24
|
+
/**
|
|
25
|
+
* Hint that this value is sensitive. Adapters may use a more secure
|
|
26
|
+
* backend (e.g. the OS keychain for the filesystem adapter); adapters
|
|
27
|
+
* without a secure backend may throw, warn, or accept — their call.
|
|
28
|
+
*/
|
|
29
|
+
secret?: boolean;
|
|
30
|
+
/** Time-to-live in seconds from now. */
|
|
31
|
+
ttl?: number;
|
|
32
|
+
}
|
|
33
|
+
export interface ZapierCache {
|
|
34
|
+
get(key: string): Promise<ZapierCacheEntry | undefined>;
|
|
35
|
+
set(key: string, value: string, options?: ZapierCacheSetOptions): Promise<void>;
|
|
36
|
+
delete(key: string): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Optional mutex for caches that can coordinate beyond one JavaScript
|
|
39
|
+
* process. The SDK re-checks the cache inside the lock before rebuilding.
|
|
40
|
+
*/
|
|
41
|
+
withLock?<T>(key: string, fn: () => Promise<T>): Promise<T>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Simplest possible adapter: a Map. No persistence, no locking (single
|
|
45
|
+
* process only), no differentiation between secrets and non-secrets.
|
|
46
|
+
* This is the default when cli-login isn't installed and no custom
|
|
47
|
+
* cache is provided.
|
|
48
|
+
*/
|
|
49
|
+
export declare function createMemoryCache(): ZapierCache;
|
|
50
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,wCAAwC;IACxC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAAC;IACxD,GAAG,CACD,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC;;;OAGG;IACH,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAC7D;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,IAAI,WAAW,CAsB/C"}
|
package/dist/cache.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Best-effort cache for the SDK.
|
|
3
|
+
*
|
|
4
|
+
* The SDK uses this to avoid re-fetching values it can recreate, primarily
|
|
5
|
+
* client_credentials access tokens. Cache entries may disappear at any time:
|
|
6
|
+
* a miss is normal and callers must be able to rebuild the value.
|
|
7
|
+
*
|
|
8
|
+
* The default cache is in-memory. When the CLI package is installed, the SDK
|
|
9
|
+
* can opportunistically use its filesystem + keychain cache. Browser and
|
|
10
|
+
* minimal server deployments fall back to memory unless a caller injects a
|
|
11
|
+
* Redis, database, or environment-specific cache.
|
|
12
|
+
*
|
|
13
|
+
* Secrets: adapters receive a `secret: true` flag on `set` and decide
|
|
14
|
+
* what to do with it (keychain for the filesystem adapter; ignored for
|
|
15
|
+
* the in-memory adapter; user adapters can throw, plaintext, encrypt —
|
|
16
|
+
* their call). The value returned by `get` is always the plain secret.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Simplest possible adapter: a Map. No persistence, no locking (single
|
|
20
|
+
* process only), no differentiation between secrets and non-secrets.
|
|
21
|
+
* This is the default when cli-login isn't installed and no custom
|
|
22
|
+
* cache is provided.
|
|
23
|
+
*/
|
|
24
|
+
export function createMemoryCache() {
|
|
25
|
+
const store = new Map();
|
|
26
|
+
return {
|
|
27
|
+
async get(key) {
|
|
28
|
+
const entry = store.get(key);
|
|
29
|
+
if (!entry)
|
|
30
|
+
return undefined;
|
|
31
|
+
if (entry.expiresAt !== undefined && entry.expiresAt <= Date.now()) {
|
|
32
|
+
store.delete(key);
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
return { value: entry.value, expiresAt: entry.expiresAt };
|
|
36
|
+
},
|
|
37
|
+
async set(key, value, options) {
|
|
38
|
+
const expiresAt = options?.ttl
|
|
39
|
+
? Date.now() + options.ttl * 1000
|
|
40
|
+
: undefined;
|
|
41
|
+
store.set(key, { value, expiresAt });
|
|
42
|
+
},
|
|
43
|
+
async delete(key) {
|
|
44
|
+
store.delete(key);
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|