@zapier/zapier-sdk 0.44.0 → 0.45.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 +19 -1
- package/dist/api/types.d.ts +11 -0
- package/dist/api/types.d.ts.map +1 -1
- package/dist/constants.d.ts +6 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +8 -0
- package/dist/index.cjs +125 -114
- package/dist/index.d.mts +2490 -2458
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +125 -115
- package/dist/plugins/api/index.d.ts.map +1 -1
- package/dist/plugins/api/index.js +2 -1
- package/dist/plugins/apps/index.d.ts +1 -1
- package/dist/plugins/apps/index.d.ts.map +1 -1
- package/dist/plugins/apps/index.js +4 -0
- package/dist/plugins/eventEmission/builders.js +1 -1
- package/dist/plugins/registry/index.d.ts +11 -16
- package/dist/plugins/registry/index.d.ts.map +1 -1
- package/dist/plugins/registry/index.js +9 -130
- package/dist/registry.d.ts +9 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +77 -0
- package/dist/sdk-version.d.ts +28 -0
- package/dist/sdk-version.d.ts.map +1 -0
- package/dist/sdk-version.js +29 -0
- package/dist/sdk.d.ts +20 -2
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +25 -9
- package/dist/types/plugin.d.ts +7 -1
- package/dist/types/plugin.d.ts.map +1 -1
- package/dist/types/registry.d.ts +49 -0
- package/dist/types/registry.d.ts.map +1 -0
- package/dist/types/registry.js +1 -0
- package/dist/types/sdk.d.ts +8 -78
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/types/sdk.js +4 -0
- package/dist/utils/schema-utils.d.ts +1 -1
- package/dist/utils/schema-utils.d.ts.map +1 -1
- package/dist/utils/telemetry-context.d.ts.map +1 -1
- package/dist/utils/telemetry-context.js +13 -6
- package/package.json +6 -2
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PluginMeta } from "./types/plugin";
|
|
2
|
+
import type { RegistryResult } from "./types/registry";
|
|
3
|
+
export type { RegistryResult } from "./types/registry";
|
|
4
|
+
export declare function buildRegistry({ sdk, meta, packageFilter, }: {
|
|
5
|
+
sdk: Record<string, unknown>;
|
|
6
|
+
meta: Record<string, PluginMeta>;
|
|
7
|
+
packageFilter?: string;
|
|
8
|
+
}): RegistryResult;
|
|
9
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAsBvD,wBAAgB,aAAa,CAAC,EAC5B,GAAG,EACH,IAAI,EACJ,aAAa,GACd,EAAE;IACD,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG,cAAc,CAmEjB"}
|
package/dist/registry.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const categoryDefinitions = {
|
|
2
|
+
account: { title: "Account" },
|
|
3
|
+
app: { title: "App", titlePlural: "Apps" },
|
|
4
|
+
connection: { title: "Connection" },
|
|
5
|
+
action: { title: "Action" },
|
|
6
|
+
"client-credentials": {
|
|
7
|
+
title: "Client Credentials",
|
|
8
|
+
titlePlural: "Client Credentials",
|
|
9
|
+
},
|
|
10
|
+
table: { title: "Table" },
|
|
11
|
+
http: { title: "HTTP Request" },
|
|
12
|
+
utility: { title: "Utility", titlePlural: "Utilities" },
|
|
13
|
+
other: { title: "Other" },
|
|
14
|
+
};
|
|
15
|
+
const knownCategories = Object.keys(categoryDefinitions);
|
|
16
|
+
export function buildRegistry({ sdk, meta, packageFilter, }) {
|
|
17
|
+
const functions = Object.keys(meta)
|
|
18
|
+
.filter((key) => {
|
|
19
|
+
const property = sdk[key];
|
|
20
|
+
if (typeof property === "function")
|
|
21
|
+
return true;
|
|
22
|
+
const [rootKey] = key.split(".");
|
|
23
|
+
const rootProperty = sdk[rootKey];
|
|
24
|
+
return typeof rootProperty === "object" && rootProperty !== null;
|
|
25
|
+
})
|
|
26
|
+
.map((key) => {
|
|
27
|
+
const m = meta[key];
|
|
28
|
+
return {
|
|
29
|
+
name: key,
|
|
30
|
+
description: m.description,
|
|
31
|
+
type: m.type,
|
|
32
|
+
itemType: m.itemType,
|
|
33
|
+
returnType: m.returnType,
|
|
34
|
+
inputSchema: m.inputSchema,
|
|
35
|
+
inputParameters: m.inputParameters,
|
|
36
|
+
outputSchema: m.outputSchema,
|
|
37
|
+
categories: m.categories || [],
|
|
38
|
+
resolvers: m.resolvers,
|
|
39
|
+
formatter: m.formatter,
|
|
40
|
+
packages: m.packages,
|
|
41
|
+
confirm: m.confirm ?? (m.type === "delete" ? "delete" : undefined),
|
|
42
|
+
deprecation: m.deprecation,
|
|
43
|
+
aliases: m.aliases,
|
|
44
|
+
supportsJsonOutput: m.supportsJsonOutput ?? true,
|
|
45
|
+
};
|
|
46
|
+
})
|
|
47
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
48
|
+
const filteredFunctions = packageFilter
|
|
49
|
+
? functions.filter((f) => !f.packages || f.packages.includes(packageFilter))
|
|
50
|
+
: functions;
|
|
51
|
+
const filteredCategories = knownCategories
|
|
52
|
+
.slice()
|
|
53
|
+
.sort((a, b) => {
|
|
54
|
+
if (a === "other")
|
|
55
|
+
return 1;
|
|
56
|
+
if (b === "other")
|
|
57
|
+
return -1;
|
|
58
|
+
return categoryDefinitions[a].title.localeCompare(categoryDefinitions[b].title);
|
|
59
|
+
})
|
|
60
|
+
.map((categoryKey) => {
|
|
61
|
+
const categoryFunctions = filteredFunctions
|
|
62
|
+
.filter((f) => f.categories.includes(categoryKey) ||
|
|
63
|
+
(categoryKey === "other" &&
|
|
64
|
+
!f.categories.some((c) => knownCategories.includes(c))))
|
|
65
|
+
.map((f) => f.name)
|
|
66
|
+
.sort();
|
|
67
|
+
const definition = categoryDefinitions[categoryKey];
|
|
68
|
+
return {
|
|
69
|
+
key: categoryKey,
|
|
70
|
+
title: definition.title,
|
|
71
|
+
titlePlural: definition.titlePlural ?? `${definition.title}s`,
|
|
72
|
+
functions: categoryFunctions,
|
|
73
|
+
};
|
|
74
|
+
})
|
|
75
|
+
.filter((category) => category.functions.length > 0);
|
|
76
|
+
return { functions: filteredFunctions, categories: filteredCategories };
|
|
77
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK package version, injected at build time.
|
|
3
|
+
*
|
|
4
|
+
* tsup's `define` (see `tsup.config.ts`) replaces the literal
|
|
5
|
+
* `process.env.SDK_VERSION` token with the package version string when the
|
|
6
|
+
* dist bundle is produced. That dist is what NPM publishes and what external
|
|
7
|
+
* consumers resolve via the `main`/`module` exports.
|
|
8
|
+
*
|
|
9
|
+
* In source-mode consumers (anything resolving the `source` export
|
|
10
|
+
* condition) tsup never runs, so the read falls through to a real
|
|
11
|
+
* `process.env.SDK_VERSION` env-var lookup — usually unset, hence the
|
|
12
|
+
* "unknown" fallback. The `typeof process` guard keeps the source-mode read
|
|
13
|
+
* safe in browsers where `process` is undefined; the additional
|
|
14
|
+
* `process.env` check covers oddly-shimmed environments where `process`
|
|
15
|
+
* exists but `process.env` doesn't (some bundler polyfills), preventing a
|
|
16
|
+
* TypeError on member access.
|
|
17
|
+
*
|
|
18
|
+
* The literal `process.env.SDK_VERSION` member access has to stay textually
|
|
19
|
+
* intact in this expression so esbuild's `define` matches and substitutes
|
|
20
|
+
* it; the surrounding guards don't interfere with that match.
|
|
21
|
+
*
|
|
22
|
+
* This pattern is intentionally different from the runtime env reads in
|
|
23
|
+
* `constants.ts` (`globalThis.process?.env?.X`): those must NOT be inlined
|
|
24
|
+
* because they're per-consumer config; this one MUST be inlined because
|
|
25
|
+
* it's a fixed, package-published value.
|
|
26
|
+
*/
|
|
27
|
+
export declare const SDK_VERSION: string;
|
|
28
|
+
//# sourceMappingURL=sdk-version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk-version.d.ts","sourceRoot":"","sources":["../src/sdk-version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,WAAW,QAGK,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK package version, injected at build time.
|
|
3
|
+
*
|
|
4
|
+
* tsup's `define` (see `tsup.config.ts`) replaces the literal
|
|
5
|
+
* `process.env.SDK_VERSION` token with the package version string when the
|
|
6
|
+
* dist bundle is produced. That dist is what NPM publishes and what external
|
|
7
|
+
* consumers resolve via the `main`/`module` exports.
|
|
8
|
+
*
|
|
9
|
+
* In source-mode consumers (anything resolving the `source` export
|
|
10
|
+
* condition) tsup never runs, so the read falls through to a real
|
|
11
|
+
* `process.env.SDK_VERSION` env-var lookup — usually unset, hence the
|
|
12
|
+
* "unknown" fallback. The `typeof process` guard keeps the source-mode read
|
|
13
|
+
* safe in browsers where `process` is undefined; the additional
|
|
14
|
+
* `process.env` check covers oddly-shimmed environments where `process`
|
|
15
|
+
* exists but `process.env` doesn't (some bundler polyfills), preventing a
|
|
16
|
+
* TypeError on member access.
|
|
17
|
+
*
|
|
18
|
+
* The literal `process.env.SDK_VERSION` member access has to stay textually
|
|
19
|
+
* intact in this expression so esbuild's `define` matches and substitutes
|
|
20
|
+
* it; the surrounding guards don't interfere with that match.
|
|
21
|
+
*
|
|
22
|
+
* This pattern is intentionally different from the runtime env reads in
|
|
23
|
+
* `constants.ts` (`globalThis.process?.env?.X`): those must NOT be inlined
|
|
24
|
+
* because they're per-consumer config; this one MUST be inlined because
|
|
25
|
+
* it's a fixed, package-published value.
|
|
26
|
+
*/
|
|
27
|
+
export const SDK_VERSION = (typeof process !== "undefined" && process.env
|
|
28
|
+
? process.env.SDK_VERSION
|
|
29
|
+
: undefined) || "unknown";
|
package/dist/sdk.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { BaseSdkOptions
|
|
1
|
+
import type { BaseSdkOptions } from "./types/sdk";
|
|
2
2
|
import type { WithAddPlugin, Plugin, PluginProvides, PluginMeta } from "./types/plugin";
|
|
3
|
+
import { type RegistryResult } from "./registry";
|
|
3
4
|
export interface ZapierSdkOptions extends BaseSdkOptions {
|
|
4
5
|
}
|
|
5
6
|
export declare function createOptionsPlugin(options: ZapierSdkOptions): () => {
|
|
@@ -14,6 +15,9 @@ export declare function createSdk(): {
|
|
|
14
15
|
getContext: () => Readonly<{
|
|
15
16
|
meta: Record<string, PluginMeta>;
|
|
16
17
|
}>;
|
|
18
|
+
getRegistry(options?: {
|
|
19
|
+
package?: string;
|
|
20
|
+
} | undefined): RegistryResult;
|
|
17
21
|
addPlugin<TProvides extends PluginProvides>(plugin: Plugin<{
|
|
18
22
|
context: {
|
|
19
23
|
meta: Record<string, PluginMeta>;
|
|
@@ -24,6 +28,11 @@ export declare function createSdk(): {
|
|
|
24
28
|
};
|
|
25
29
|
} & TProvides>;
|
|
26
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated `getRegistry` is now built into every sdk, so the "without
|
|
33
|
+
* registry" form has no behavioral difference from {@link createZapierSdk}.
|
|
34
|
+
* Use {@link createZapierSdk} instead.
|
|
35
|
+
*/
|
|
27
36
|
export declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOptions): WithAddPlugin<{
|
|
28
37
|
context: {
|
|
29
38
|
meta: Record<string, PluginMeta>;
|
|
@@ -33,5 +42,14 @@ export declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOption
|
|
|
33
42
|
options: ZapierSdkOptions;
|
|
34
43
|
};
|
|
35
44
|
} & import(".").EventEmissionProvides & import(".").ApiPluginProvides & import(".").ManifestPluginProvides & import("./plugins/capabilities").CapabilitiesPluginProvides & import(".").ConnectionsPluginProvides & import(".").ListAppsPluginProvides & import(".").GetAppPluginProvides & import(".").ListActionsPluginProvides & import(".").GetActionPluginProvides & import(".").ListInputFieldsPluginProvides & import("./plugins/getInputFieldsSchema").GetInputFieldsSchemaPluginProvides & import("./plugins/listInputFieldChoices").ListInputFieldChoicesPluginProvides & import(".").RunActionPluginProvides & import(".").ListConnectionsPluginProvides & import(".").GetConnectionPluginProvides & import(".").FindFirstConnectionPluginProvides & import(".").FindUniqueConnectionPluginProvides & import(".").ListAuthenticationsPluginProvides & import(".").GetAuthenticationPluginProvides & import(".").FindFirstAuthenticationPluginProvides & import(".").FindUniqueAuthenticationPluginProvides & import(".").ListClientCredentialsPluginProvides & import(".").CreateClientCredentialsPluginProvides & import(".").DeleteClientCredentialsPluginProvides & import(".").FetchPluginProvides & import(".").RequestPluginProvides & import(".").ListTablesPluginProvides & import(".").GetTablePluginProvides & import(".").DeleteTablePluginProvides & import(".").CreateTablePluginProvides & import(".").ListTableFieldsPluginProvides & import(".").CreateTableFieldsPluginProvides & import(".").DeleteTableFieldsPluginProvides & import(".").GetTableRecordPluginProvides & import(".").ListTableRecordsPluginProvides & import(".").CreateTableRecordsPluginProvides & import(".").DeleteTableRecordsPluginProvides & import(".").UpdateTableRecordsPluginProvides & import(".").AppsPluginProvides & import(".").GetProfilePluginProvides>;
|
|
36
|
-
export declare function createZapierSdk(options?: ZapierSdkOptions):
|
|
45
|
+
export declare function createZapierSdk(options?: ZapierSdkOptions): WithAddPlugin<{
|
|
46
|
+
context: {
|
|
47
|
+
meta: Record<string, PluginMeta>;
|
|
48
|
+
};
|
|
49
|
+
} & {
|
|
50
|
+
context: {
|
|
51
|
+
options: ZapierSdkOptions;
|
|
52
|
+
};
|
|
53
|
+
} & import(".").EventEmissionProvides & import(".").ApiPluginProvides & import(".").ManifestPluginProvides & import("./plugins/capabilities").CapabilitiesPluginProvides & import(".").ConnectionsPluginProvides & import(".").ListAppsPluginProvides & import(".").GetAppPluginProvides & import(".").ListActionsPluginProvides & import(".").GetActionPluginProvides & import(".").ListInputFieldsPluginProvides & import("./plugins/getInputFieldsSchema").GetInputFieldsSchemaPluginProvides & import("./plugins/listInputFieldChoices").ListInputFieldChoicesPluginProvides & import(".").RunActionPluginProvides & import(".").ListConnectionsPluginProvides & import(".").GetConnectionPluginProvides & import(".").FindFirstConnectionPluginProvides & import(".").FindUniqueConnectionPluginProvides & import(".").ListAuthenticationsPluginProvides & import(".").GetAuthenticationPluginProvides & import(".").FindFirstAuthenticationPluginProvides & import(".").FindUniqueAuthenticationPluginProvides & import(".").ListClientCredentialsPluginProvides & import(".").CreateClientCredentialsPluginProvides & import(".").DeleteClientCredentialsPluginProvides & import(".").FetchPluginProvides & import(".").RequestPluginProvides & import(".").ListTablesPluginProvides & import(".").GetTablePluginProvides & import(".").DeleteTablePluginProvides & import(".").CreateTablePluginProvides & import(".").ListTableFieldsPluginProvides & import(".").CreateTableFieldsPluginProvides & import(".").DeleteTableFieldsPluginProvides & import(".").GetTableRecordPluginProvides & import(".").ListTableRecordsPluginProvides & import(".").CreateTableRecordsPluginProvides & import(".").DeleteTableRecordsPluginProvides & import(".").UpdateTableRecordsPluginProvides & import(".").AppsPluginProvides & import(".").GetProfilePluginProvides>;
|
|
54
|
+
export type ZapierSdk = ReturnType<typeof createZapierSdk>;
|
|
37
55
|
//# sourceMappingURL=sdk.d.ts.map
|
package/dist/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EACV,aAAa,EACb,MAAM,EACN,cAAc,EACd,UAAU,EACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AA8ChE,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CAAG;AAE3D,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,gBAAgB;;;;EAE5D;AAED,wBAAgB,SAAS;;cACW,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;;;cAA1B,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;;;kBAqBxB,MAAM;oBAAK,cAAc;cAcjD,SAAS,SAAS,cAAc;;kBAnCV,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;;;;kBAA1B,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;;;EAC7D;AA4ED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,GAAE,gBAAqB;;cAlFzC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;;;;;;uwDAuF7D;AAED,wBAAgB,eAAe,CAAC,OAAO,GAAE,gBAAqB;;cAzF1B,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;;;;;;uwDAiK7D;AAED,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
package/dist/sdk.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { buildRegistry } from "./registry";
|
|
2
|
+
import { logDeprecation } from "./utils/logging";
|
|
2
3
|
import { appsPlugin } from "./plugins/apps/index";
|
|
3
4
|
import { fetchPlugin } from "./plugins/fetch/index";
|
|
4
|
-
import { registryPlugin } from "./plugins/registry/index";
|
|
5
5
|
import { apiPlugin } from "./plugins/api/index";
|
|
6
6
|
import { getProfilePlugin } from "./plugins/getProfile";
|
|
7
7
|
import { listAppsPlugin } from "./plugins/listApps";
|
|
@@ -13,7 +13,6 @@ import { listConnectionsPlugin } from "./plugins/listConnections";
|
|
|
13
13
|
import { getConnectionPlugin } from "./plugins/getConnection";
|
|
14
14
|
import { findFirstConnectionPlugin } from "./plugins/findFirstConnection";
|
|
15
15
|
import { findUniqueConnectionPlugin } from "./plugins/findUniqueConnection";
|
|
16
|
-
// Deprecated authentication plugins (thin wrappers for backward compatibility)
|
|
17
16
|
import { listAuthenticationsPlugin, getAuthenticationPlugin, findFirstAuthenticationPlugin, findUniqueAuthenticationPlugin, } from "./plugins/deprecated/authentications";
|
|
18
17
|
import { listClientCredentialsPlugin } from "./plugins/listClientCredentials";
|
|
19
18
|
import { createClientCredentialsPlugin } from "./plugins/createClientCredentials";
|
|
@@ -48,12 +47,24 @@ export function createSdk() {
|
|
|
48
47
|
// and its meta sub-property is deep-merged across plugins
|
|
49
48
|
function buildSdk(properties, context) {
|
|
50
49
|
const frozenContext = Object.freeze(context);
|
|
51
|
-
|
|
50
|
+
const registryCache = new Map();
|
|
51
|
+
const sdk = {
|
|
52
52
|
...properties,
|
|
53
53
|
get context() {
|
|
54
54
|
return frozenContext;
|
|
55
55
|
},
|
|
56
56
|
getContext: () => frozenContext, // runtime compat shim, not in types
|
|
57
|
+
getRegistry(options) {
|
|
58
|
+
const cacheKey = options?.package ?? "__all__";
|
|
59
|
+
if (!registryCache.has(cacheKey)) {
|
|
60
|
+
registryCache.set(cacheKey, buildRegistry({
|
|
61
|
+
sdk: sdk,
|
|
62
|
+
meta: frozenContext.meta,
|
|
63
|
+
packageFilter: options?.package,
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
return registryCache.get(cacheKey);
|
|
67
|
+
},
|
|
57
68
|
addPlugin(plugin) {
|
|
58
69
|
const pluginResult = plugin({
|
|
59
70
|
...properties,
|
|
@@ -81,8 +92,18 @@ function buildSdk(properties, context) {
|
|
|
81
92
|
return buildSdk(mergedProperties, mergedContext);
|
|
82
93
|
},
|
|
83
94
|
};
|
|
95
|
+
return sdk;
|
|
84
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* @deprecated `getRegistry` is now built into every sdk, so the "without
|
|
99
|
+
* registry" form has no behavioral difference from {@link createZapierSdk}.
|
|
100
|
+
* Use {@link createZapierSdk} instead.
|
|
101
|
+
*/
|
|
85
102
|
export function createZapierSdkWithoutRegistry(options = {}) {
|
|
103
|
+
logDeprecation("createZapierSdkWithoutRegistry is deprecated; use createZapierSdk instead. getRegistry is now available on every sdk.");
|
|
104
|
+
return createZapierSdk(options);
|
|
105
|
+
}
|
|
106
|
+
export function createZapierSdk(options = {}) {
|
|
86
107
|
return (createSdk()
|
|
87
108
|
.addPlugin(createOptionsPlugin(options))
|
|
88
109
|
// Event emission (must be first to be available to other plugins)
|
|
@@ -140,8 +161,3 @@ export function createZapierSdkWithoutRegistry(options = {}) {
|
|
|
140
161
|
// Profile
|
|
141
162
|
.addPlugin(getProfilePlugin));
|
|
142
163
|
}
|
|
143
|
-
export function createZapierSdk(options = {}) {
|
|
144
|
-
return (createZapierSdkWithoutRegistry(options)
|
|
145
|
-
// Register plugins for CLI/MCP metadata
|
|
146
|
-
.addPlugin(registryPlugin));
|
|
147
|
-
}
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* merges the plugin's result into the SDK, producing a new SDK.
|
|
12
12
|
*/
|
|
13
13
|
import type { z } from "zod";
|
|
14
|
+
import type { RegistryResult } from "./registry";
|
|
14
15
|
export interface PluginProvides extends Record<string, any> {
|
|
15
16
|
context?: {
|
|
16
17
|
meta?: Record<string, PluginMeta>;
|
|
@@ -51,8 +52,10 @@ export interface Plugin<TSdk = {}, TProvides extends PluginProvides = PluginProv
|
|
|
51
52
|
}): TProvides;
|
|
52
53
|
}
|
|
53
54
|
/**
|
|
54
|
-
* Takes an SDK shape and adds
|
|
55
|
+
* Takes an SDK shape and adds addPlugin and getRegistry methods to it.
|
|
55
56
|
* addPlugin merges a plugin's result into the shape, producing a new SDK.
|
|
57
|
+
* getRegistry is a lazy view over context.meta, available on every sdk
|
|
58
|
+
* produced by buildSdk regardless of plugin order.
|
|
56
59
|
*/
|
|
57
60
|
export type WithAddPlugin<T = {
|
|
58
61
|
context: {
|
|
@@ -60,5 +63,8 @@ export type WithAddPlugin<T = {
|
|
|
60
63
|
};
|
|
61
64
|
}> = T & {
|
|
62
65
|
addPlugin<TProvides extends PluginProvides>(plugin: Plugin<T, TProvides>): WithAddPlugin<T & TProvides>;
|
|
66
|
+
getRegistry(options?: {
|
|
67
|
+
package?: string;
|
|
68
|
+
}): RegistryResult;
|
|
63
69
|
};
|
|
64
70
|
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/types/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/types/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD,MAAM,WAAW,cAAe,SAAQ,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACzD,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QAClC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACH;AAED,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC;IAC1B,YAAY,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChC,+DAA+D;IAC/D,OAAO,CAAC,EAAE,eAAe,GAAG,QAAQ,CAAC;IACrC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,MAAM,CACrB,IAAI,GAAG,EAAE,EACT,SAAS,SAAS,cAAc,GAAG,cAAc;IAEjD,CACE,GAAG,EAAE,IAAI,GAAG;QACV,OAAO,EAAE;YACP,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;SAClC,CAAC;KACH,GACA,SAAS,CAAC;CACd;AAED;;;;;GAKG;AACH,MAAM,MAAM,aAAa,CACvB,CAAC,GAAG;IAAE,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;KAAE,CAAA;CAAE,IACnD,CAAC,GAAG;IACN,SAAS,CAAC,SAAS,SAAS,cAAc,EACxC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC,GAC3B,aAAa,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IAChC,WAAW,CAAC,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,cAAc,CAAC;CAC7D,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type { OutputFormatter } from "../utils/schema-utils";
|
|
3
|
+
export interface FunctionRegistryEntry {
|
|
4
|
+
name: string;
|
|
5
|
+
/**
|
|
6
|
+
* Human-readable description of the function. Surfaced as CLI help text,
|
|
7
|
+
* MCP tool description, and README documentation. Prefer providing this
|
|
8
|
+
* directly rather than relying solely on inputSchema.describe().
|
|
9
|
+
*/
|
|
10
|
+
description?: string;
|
|
11
|
+
type?: "list" | "item" | "create" | "delete";
|
|
12
|
+
itemType?: string;
|
|
13
|
+
returnType?: string;
|
|
14
|
+
inputSchema?: z.ZodSchema;
|
|
15
|
+
inputParameters?: Array<{
|
|
16
|
+
name: string;
|
|
17
|
+
schema: z.ZodSchema;
|
|
18
|
+
}>;
|
|
19
|
+
outputSchema?: z.ZodSchema;
|
|
20
|
+
categories: string[];
|
|
21
|
+
resolvers?: Record<string, any>;
|
|
22
|
+
packages?: string[];
|
|
23
|
+
/** Confirmation prompt type - prompts user before executing */
|
|
24
|
+
confirm?: "create-secret" | "delete";
|
|
25
|
+
/**
|
|
26
|
+
* Optional deprecation metadata for commands.
|
|
27
|
+
*/
|
|
28
|
+
deprecation?: FunctionDeprecation;
|
|
29
|
+
/** Short flag aliases for CLI options (e.g., { request: "X", header: "H" }) */
|
|
30
|
+
aliases?: Record<string, string>;
|
|
31
|
+
/** Output formatter with optional page-level enrichment (mirrors resolvers for output) */
|
|
32
|
+
formatter?: OutputFormatter;
|
|
33
|
+
/** Defaults to true. Set to false to suppress --json (e.g. login/logout/init). */
|
|
34
|
+
supportsJsonOutput: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface FunctionDeprecation {
|
|
37
|
+
/** User-facing deprecation message for why/how to migrate */
|
|
38
|
+
message: string;
|
|
39
|
+
}
|
|
40
|
+
export interface RegistryResult {
|
|
41
|
+
functions: FunctionRegistryEntry[];
|
|
42
|
+
categories: {
|
|
43
|
+
key: string;
|
|
44
|
+
title: string;
|
|
45
|
+
titlePlural: string;
|
|
46
|
+
functions: string[];
|
|
47
|
+
}[];
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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AqB,EAAE,CAAC;IACnC,UAAU,EAAE;QACV,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,EAAE,CAAC;KACrB,EAAE,CAAC;CACL"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types/sdk.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { z } from "zod";
|
|
|
5
5
|
import type { EventCallback } from "./events";
|
|
6
6
|
import type { EventEmissionConfig } from "../plugins/eventEmission";
|
|
7
7
|
import type { Manifest } from "../plugins/manifest";
|
|
8
|
-
import type { OutputFormatter } from "../utils/schema-utils";
|
|
9
8
|
export declare const BaseSdkOptionsSchema: z.ZodObject<{
|
|
10
9
|
credentials: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
11
10
|
type: z.ZodOptional<z.ZodEnum<{
|
|
@@ -70,6 +69,13 @@ export declare const BaseSdkOptionsSchema: z.ZodObject<{
|
|
|
70
69
|
onEvent: z.ZodOptional<z.ZodCustom<EventCallback, EventCallback>>;
|
|
71
70
|
fetch: z.ZodOptional<z.ZodCustom<typeof fetch, typeof fetch>>;
|
|
72
71
|
eventEmission: z.ZodOptional<z.ZodCustom<EventEmissionConfig, EventEmissionConfig>>;
|
|
72
|
+
callerPackage: z.ZodOptional<z.ZodCustom<{
|
|
73
|
+
name: string;
|
|
74
|
+
version: string;
|
|
75
|
+
}, {
|
|
76
|
+
name: string;
|
|
77
|
+
version: string;
|
|
78
|
+
}>>;
|
|
73
79
|
canIncludeSharedConnections: z.ZodOptional<z.ZodBoolean>;
|
|
74
80
|
canIncludeSharedTables: z.ZodOptional<z.ZodBoolean>;
|
|
75
81
|
canDeleteTables: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -81,83 +87,7 @@ import type { GetConnectionSdkFunction } from "../plugins/getConnection/schemas"
|
|
|
81
87
|
import type { FindFirstConnectionSdkFunction } from "../plugins/findFirstConnection/schemas";
|
|
82
88
|
import type { FindUniqueConnectionSdkFunction } from "../plugins/findUniqueConnection/schemas";
|
|
83
89
|
import type { RelayRequestSdkFunction } from "../plugins/request/schemas";
|
|
84
|
-
|
|
85
|
-
import type { GetProfilePluginProvides } from "../plugins/getProfile";
|
|
86
|
-
import type { EventEmissionProvides } from "../plugins/eventEmission";
|
|
87
|
-
import type { ApiPluginProvides } from "../plugins/api";
|
|
88
|
-
import type { AppsPluginProvides, ZapierSdkApps } from "../plugins/apps";
|
|
89
|
-
import type { ActionProxy } from "../plugins/apps/schemas";
|
|
90
|
-
import type { FetchPluginProvides } from "../plugins/fetch";
|
|
91
|
-
import type { ListAppsPluginProvides } from "../plugins/listApps";
|
|
92
|
-
import type { GetAppPluginProvides } from "../plugins/getApp";
|
|
93
|
-
import type { ListActionsPluginProvides } from "../plugins/listActions";
|
|
94
|
-
import type { GetActionPluginProvides } from "../plugins/getAction";
|
|
95
|
-
import type { RunActionPluginProvides } from "../plugins/runAction";
|
|
96
|
-
import type { ListConnectionsPluginProvides } from "../plugins/listConnections";
|
|
97
|
-
import type { GetConnectionPluginProvides } from "../plugins/getConnection";
|
|
98
|
-
import type { FindFirstConnectionPluginProvides } from "../plugins/findFirstConnection";
|
|
99
|
-
import type { FindUniqueConnectionPluginProvides } from "../plugins/findUniqueConnection";
|
|
100
|
-
import type { ListAuthenticationsPluginProvides, GetAuthenticationPluginProvides, FindFirstAuthenticationPluginProvides, FindUniqueAuthenticationPluginProvides } from "../plugins/deprecated/authentications";
|
|
101
|
-
import type { ListClientCredentialsPluginProvides } from "../plugins/listClientCredentials";
|
|
102
|
-
import type { CreateClientCredentialsPluginProvides } from "../plugins/createClientCredentials";
|
|
103
|
-
import type { DeleteClientCredentialsPluginProvides } from "../plugins/deleteClientCredentials";
|
|
104
|
-
import type { ListInputFieldsPluginProvides } from "../plugins/listInputFields";
|
|
105
|
-
import type { GetInputFieldsSchemaPluginProvides } from "../plugins/getInputFieldsSchema";
|
|
106
|
-
import type { ListInputFieldChoicesPluginProvides } from "../plugins/listInputFieldChoices";
|
|
107
|
-
import type { RequestPluginProvides } from "../plugins/request";
|
|
108
|
-
import type { ManifestPluginProvides } from "../plugins/manifest";
|
|
109
|
-
import type { ListTablesPluginProvides } from "../plugins/tables/listTables";
|
|
110
|
-
import type { GetTablePluginProvides } from "../plugins/tables/getTable";
|
|
111
|
-
import type { DeleteTablePluginProvides } from "../plugins/tables/deleteTable";
|
|
112
|
-
import type { CreateTablePluginProvides } from "../plugins/tables/createTable";
|
|
113
|
-
import type { ListTableFieldsPluginProvides } from "../plugins/tables/listTableFields";
|
|
114
|
-
import type { CreateTableFieldsPluginProvides } from "../plugins/tables/createTableFields";
|
|
115
|
-
import type { DeleteTableFieldsPluginProvides } from "../plugins/tables/deleteTableFields";
|
|
116
|
-
import type { GetTableRecordPluginProvides } from "../plugins/tables/getTableRecord";
|
|
117
|
-
import type { ListTableRecordsPluginProvides } from "../plugins/tables/listTableRecords";
|
|
118
|
-
import type { CreateTableRecordsPluginProvides } from "../plugins/tables/createTableRecords";
|
|
119
|
-
import type { DeleteTableRecordsPluginProvides } from "../plugins/tables/deleteTableRecords";
|
|
120
|
-
import type { UpdateTableRecordsPluginProvides } from "../plugins/tables/updateTableRecords";
|
|
121
|
-
export interface FunctionRegistryEntry {
|
|
122
|
-
name: string;
|
|
123
|
-
/**
|
|
124
|
-
* Human-readable description of the function. Surfaced as CLI help text,
|
|
125
|
-
* MCP tool description, and README documentation. Prefer providing this
|
|
126
|
-
* directly rather than relying solely on inputSchema.describe().
|
|
127
|
-
*/
|
|
128
|
-
description?: string;
|
|
129
|
-
type?: "list" | "item" | "create" | "delete";
|
|
130
|
-
itemType?: string;
|
|
131
|
-
returnType?: string;
|
|
132
|
-
inputSchema?: z.ZodSchema;
|
|
133
|
-
inputParameters?: Array<{
|
|
134
|
-
name: string;
|
|
135
|
-
schema: z.ZodSchema;
|
|
136
|
-
}>;
|
|
137
|
-
outputSchema?: z.ZodSchema;
|
|
138
|
-
categories: string[];
|
|
139
|
-
resolvers?: Record<string, any>;
|
|
140
|
-
packages?: string[];
|
|
141
|
-
/** Confirmation prompt type - prompts user before executing */
|
|
142
|
-
confirm?: "create-secret" | "delete";
|
|
143
|
-
/**
|
|
144
|
-
* Optional deprecation metadata for commands.
|
|
145
|
-
*/
|
|
146
|
-
deprecation?: FunctionDeprecation;
|
|
147
|
-
/** Short flag aliases for CLI options (e.g., { request: "X", header: "H" }) */
|
|
148
|
-
aliases?: Record<string, string>;
|
|
149
|
-
/** Output formatter with optional page-level enrichment (mirrors resolvers for output) */
|
|
150
|
-
formatter?: OutputFormatter;
|
|
151
|
-
/** Defaults to true. Set to false to suppress --json (e.g. login/logout/init). */
|
|
152
|
-
supportsJsonOutput: boolean;
|
|
153
|
-
}
|
|
154
|
-
export interface FunctionDeprecation {
|
|
155
|
-
/** User-facing deprecation message for why/how to migrate */
|
|
156
|
-
message: string;
|
|
157
|
-
}
|
|
90
|
+
export type { FunctionRegistryEntry, FunctionDeprecation } from "./registry";
|
|
158
91
|
export interface ZapierSdkFunctions extends ListInputFieldsSdkFunction, GetConnectionSdkFunction, FindFirstConnectionSdkFunction, FindUniqueConnectionSdkFunction, RelayRequestSdkFunction {
|
|
159
92
|
}
|
|
160
|
-
export type ZapierSdk = RegistryPluginProvides & FetchPluginProvides & AppsPluginProvides & ListAppsPluginProvides & ManifestPluginProvides & GetAppPluginProvides & ListActionsPluginProvides & GetActionPluginProvides & RunActionPluginProvides & ListConnectionsPluginProvides & GetConnectionPluginProvides & FindFirstConnectionPluginProvides & FindUniqueConnectionPluginProvides & ListAuthenticationsPluginProvides & GetAuthenticationPluginProvides & FindFirstAuthenticationPluginProvides & FindUniqueAuthenticationPluginProvides & ListClientCredentialsPluginProvides & CreateClientCredentialsPluginProvides & DeleteClientCredentialsPluginProvides & ListInputFieldsPluginProvides & GetInputFieldsSchemaPluginProvides & ListInputFieldChoicesPluginProvides & RequestPluginProvides & GetProfilePluginProvides & EventEmissionProvides & ApiPluginProvides & ListTablesPluginProvides & GetTablePluginProvides & DeleteTablePluginProvides & CreateTablePluginProvides & ListTableFieldsPluginProvides & CreateTableFieldsPluginProvides & DeleteTableFieldsPluginProvides & GetTableRecordPluginProvides & ListTableRecordsPluginProvides & CreateTableRecordsPluginProvides & DeleteTableRecordsPluginProvides & UpdateTableRecordsPluginProvides & {
|
|
161
|
-
apps: ActionProxy & ZapierSdkApps;
|
|
162
|
-
};
|
|
163
93
|
//# sourceMappingURL=sdk.d.ts.map
|
package/dist/types/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/types/sdk.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/types/sdk.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAIpD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAgFb,MAAM;iBAAW,MAAM;;cAAvB,MAAM;iBAAW,MAAM;;;;;;iBAgBzC,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAGlE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AACrF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACjF,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC;AAC7F,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,yCAAyC,CAAC;AAC/F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAE1E,YAAY,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAG7E,MAAM,WAAW,kBACf,SAAQ,0BAA0B,EAChC,wBAAwB,EACxB,8BAA8B,EAC9B,+BAA+B,EAC/B,uBAAuB;CAAG"}
|
package/dist/types/sdk.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-utils.d.ts","sourceRoot":"","sources":["../../src/utils/schema-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"schema-utils.d.ts","sourceRoot":"","sources":["../../src/utils/schema-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAMxC,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,KAAK,CAAC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AC,CAAC,MAAM,CAAC,GAAG,kBAAkB,CAAC;CACtC,CAQA;AAWD,wBAAgB,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,GAAG,OAAO,CAqBvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry-context.d.ts","sourceRoot":"","sources":["../../src/utils/telemetry-context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"telemetry-context.d.ts","sourceRoot":"","sources":["../../src/utils/telemetry-context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,MAAM,WAAW,cAAc;IAC7B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAwBD,wBAAgB,iBAAiB,IAAI,OAAO,CAI3C;AAED,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAIzD;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAKhE;AAED,wBAAgB,iBAAiB,IAAI,cAAc,GAAG,SAAS,CAG9D"}
|
|
@@ -3,16 +3,23 @@
|
|
|
3
3
|
* SDK method call runs in its own ALS scope (via runWithTelemetryContext), isolating
|
|
4
4
|
* its depth counter and method metadata from concurrent calls.
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
//
|
|
6
|
+
import { AsyncLocalStorage, } from "node:async_hooks";
|
|
7
|
+
// Static import of `AsyncLocalStorage` works in both CJS and ESM tsup bundles
|
|
8
|
+
// because tsup converts the import statement directly (to `require()` in CJS,
|
|
9
|
+
// kept as native `import` in ESM), bypassing the `__require` shim that
|
|
10
|
+
// silently broke the previous `require("node:async_hooks")` pattern in ESM —
|
|
11
|
+
// the bug that left ESM consumers (notably the CLI) without a telemetry
|
|
12
|
+
// store and dropped nested-call detection on every call.
|
|
13
|
+
//
|
|
14
|
+
// Browsers can't resolve `node:async_hooks` at bundle time; consumers who
|
|
15
|
+
// bundle the SDK for browsers need to mark this module external or polyfill
|
|
16
|
+
// it. The try/catch covers any other instantiation failure.
|
|
8
17
|
let telemetryStore = null;
|
|
9
18
|
try {
|
|
10
|
-
|
|
11
|
-
telemetryStore = new mod.AsyncLocalStorage();
|
|
19
|
+
telemetryStore = new AsyncLocalStorage();
|
|
12
20
|
}
|
|
13
21
|
catch {
|
|
14
|
-
//
|
|
15
|
-
// always returns true) since we can't reliably deduplicate nested calls.
|
|
22
|
+
// Non-Node environment (browser, etc.) — telemetry context disabled.
|
|
16
23
|
}
|
|
17
24
|
export function isTelemetryNested() {
|
|
18
25
|
if (!telemetryStore)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zapier/zapier-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.1",
|
|
4
4
|
"description": "Complete Zapier SDK - combines all Zapier SDK packages",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -42,7 +42,11 @@
|
|
|
42
42
|
},
|
|
43
43
|
"browser": {
|
|
44
44
|
"@zapier/zapier-sdk-cli/login": false,
|
|
45
|
-
"@zapier/zapier-sdk-cli-login": false
|
|
45
|
+
"@zapier/zapier-sdk-cli-login": false,
|
|
46
|
+
"async_hooks": false,
|
|
47
|
+
"node:async_hooks": false,
|
|
48
|
+
"os": false,
|
|
49
|
+
"node:os": false
|
|
46
50
|
},
|
|
47
51
|
"files": [
|
|
48
52
|
"dist",
|