@zapier/zapier-sdk 0.97.1 → 0.98.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/README.md +34 -34
- package/dist/{chunk-X7NGRS4I.mjs → chunk-CHT6AJG3.mjs} +207 -51
- package/dist/{chunk-MAEVVN2L.cjs → chunk-IZRPXHWO.cjs} +207 -51
- package/dist/experimental.cjs +384 -384
- package/dist/experimental.d.mts +31 -12
- package/dist/experimental.d.ts +31 -12
- package/dist/experimental.mjs +2 -2
- package/dist/{index-DsMsmowr.d.mts → index-BcUDdHo2.d.mts} +189 -44
- package/dist/{index-DsMsmowr.d.ts → index-BcUDdHo2.d.ts} +189 -44
- package/dist/index.cjs +276 -276
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
|
@@ -66,6 +66,13 @@ function getNegatable(schema) {
|
|
|
66
66
|
function openEnum(values, description) {
|
|
67
67
|
return z.union([z.enum(values), z.string()]).describe(description);
|
|
68
68
|
}
|
|
69
|
+
var STABILITY_LEVELS = ["stable", "beta", "experimental"];
|
|
70
|
+
function normalizeStability(meta) {
|
|
71
|
+
if (meta.stability !== void 0) {
|
|
72
|
+
return STABILITY_LEVELS.includes(meta.stability) ? meta.stability : "experimental";
|
|
73
|
+
}
|
|
74
|
+
return meta.experimental ? "experimental" : "stable";
|
|
75
|
+
}
|
|
69
76
|
function resolveCategoryDefinition(ref) {
|
|
70
77
|
const def = typeof ref === "string" ? { key: ref } : ref;
|
|
71
78
|
const title = def.title ?? toTitleCase(def.key);
|
|
@@ -109,6 +116,7 @@ function buildRegistry({
|
|
|
109
116
|
return typeof rootProperty === "object" && rootProperty !== null;
|
|
110
117
|
}).map((key) => {
|
|
111
118
|
const m = meta[key];
|
|
119
|
+
const stability = normalizeStability(m);
|
|
112
120
|
return {
|
|
113
121
|
name: key,
|
|
114
122
|
description: m.description,
|
|
@@ -124,7 +132,11 @@ function buildRegistry({
|
|
|
124
132
|
),
|
|
125
133
|
resolvers: resolvers?.[key],
|
|
126
134
|
formatter: formatters?.[key],
|
|
127
|
-
|
|
135
|
+
stability,
|
|
136
|
+
// Deprecated derived read, literal by name: only the experimental
|
|
137
|
+
// tier reads true. Beta reads false — the "not stable" warning duty
|
|
138
|
+
// lives in `stability` and the runtime notice, not this boolean.
|
|
139
|
+
experimental: stability === "experimental",
|
|
128
140
|
packages: m.packages,
|
|
129
141
|
confirm: m.confirm ?? (m.type === "delete" ? "delete" : void 0),
|
|
130
142
|
deprecation: m.deprecation,
|
|
@@ -209,6 +221,20 @@ function createDeprecationLogger(tag) {
|
|
|
209
221
|
};
|
|
210
222
|
}
|
|
211
223
|
var { logDeprecation} = createDeprecationLogger("core");
|
|
224
|
+
function createStabilityNoticeLogger(tag) {
|
|
225
|
+
const loggedNotices = /* @__PURE__ */ new Set();
|
|
226
|
+
return {
|
|
227
|
+
logStabilityNotice(message) {
|
|
228
|
+
if (loggedNotices.has(message)) return;
|
|
229
|
+
loggedNotices.add(message);
|
|
230
|
+
console.warn(`[${tag}] ${message}`);
|
|
231
|
+
},
|
|
232
|
+
resetStabilityNotices() {
|
|
233
|
+
loggedNotices.clear();
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
var { logStabilityNotice} = createStabilityNoticeLogger("core");
|
|
212
238
|
var CORE_ERROR_SYMBOL = Symbol.for("kitcore.error");
|
|
213
239
|
var CoreErrorCode = {
|
|
214
240
|
Validation: "VALIDATION_ERROR",
|
|
@@ -620,6 +646,19 @@ function defaultLogDeprecation({
|
|
|
620
646
|
}) {
|
|
621
647
|
logDeprecation(`${methodName}() is deprecated. ${deprecation.message}`);
|
|
622
648
|
}
|
|
649
|
+
var STABILITY_NOTICE_DETAILS = {
|
|
650
|
+
beta: "Its API shape is settled, but it is not yet covered by stable-tier guarantees.",
|
|
651
|
+
experimental: "It may change shape or disappear without notice."
|
|
652
|
+
};
|
|
653
|
+
function defaultLogStabilityNotice({
|
|
654
|
+
methodName,
|
|
655
|
+
stability
|
|
656
|
+
}) {
|
|
657
|
+
if (stability === "stable") return;
|
|
658
|
+
logStabilityNotice(
|
|
659
|
+
`${methodName}() is a ${stability} API. ${STABILITY_NOTICE_DETAILS[stability]}`
|
|
660
|
+
);
|
|
661
|
+
}
|
|
623
662
|
var CORE_OPTIONS_ID = "kitcore/coreOptions";
|
|
624
663
|
function resolveCoreOptions(context) {
|
|
625
664
|
const entry = context.plugins?.[CORE_OPTIONS_ID];
|
|
@@ -666,6 +705,18 @@ function signalDeprecation(context, methodName, getDeprecation) {
|
|
|
666
705
|
const handler = resolveCoreOptions(context)?.logDeprecation ?? defaultLogDeprecation;
|
|
667
706
|
runIsolatedObserver(() => handler(warning));
|
|
668
707
|
}
|
|
708
|
+
function signalStability(context, methodName, getStability) {
|
|
709
|
+
if (isInsideObserver()) return;
|
|
710
|
+
const stability = getStability?.();
|
|
711
|
+
if (!stability || stability === "stable") return;
|
|
712
|
+
const notice = {
|
|
713
|
+
type: "stability",
|
|
714
|
+
methodName,
|
|
715
|
+
stability
|
|
716
|
+
};
|
|
717
|
+
const handler = resolveCoreOptions(context)?.logStabilityNotice ?? defaultLogStabilityNotice;
|
|
718
|
+
runIsolatedObserver(() => handler(notice));
|
|
719
|
+
}
|
|
669
720
|
function normalizeError(error, adaptError) {
|
|
670
721
|
if (error instanceof Error) return error;
|
|
671
722
|
const message = typeof error === "object" && error !== null && "message" in error && typeof error.message === "string" ? error.message : String(error);
|
|
@@ -679,7 +730,7 @@ function normalizeError(error, adaptError) {
|
|
|
679
730
|
);
|
|
680
731
|
}
|
|
681
732
|
function createFunction(coreFn, options) {
|
|
682
|
-
const { sdk, schema, name, annotator, getDeprecation } = options;
|
|
733
|
+
const { sdk, schema, name, annotator, getDeprecation, getStability } = options;
|
|
683
734
|
const functionName = name || coreFn.name;
|
|
684
735
|
const namedFunctions = {
|
|
685
736
|
[functionName]: async function(callOptions) {
|
|
@@ -687,6 +738,7 @@ function createFunction(coreFn, options) {
|
|
|
687
738
|
const context = resolveCallContext(internal);
|
|
688
739
|
if (!isCallContext(internal) && internal !== INTERNAL_CALL) {
|
|
689
740
|
signalDeprecation(sdk.context, functionName, getDeprecation);
|
|
741
|
+
signalStability(sdk.context, functionName, getStability);
|
|
690
742
|
}
|
|
691
743
|
return runInMethodScope(async () => {
|
|
692
744
|
const startTime = Date.now();
|
|
@@ -753,12 +805,21 @@ function createFunction(coreFn, options) {
|
|
|
753
805
|
return namedFunctions[functionName];
|
|
754
806
|
}
|
|
755
807
|
function createRawFunction(coreFn, options) {
|
|
756
|
-
const {
|
|
808
|
+
const {
|
|
809
|
+
sdk,
|
|
810
|
+
name,
|
|
811
|
+
schema,
|
|
812
|
+
positional,
|
|
813
|
+
annotator,
|
|
814
|
+
getDeprecation,
|
|
815
|
+
getStability
|
|
816
|
+
} = options;
|
|
757
817
|
return function(rawInput) {
|
|
758
818
|
const internal = arguments[1];
|
|
759
819
|
const context = resolveCallContext(internal);
|
|
760
820
|
if (!isCallContext(internal) && internal !== INTERNAL_CALL) {
|
|
761
821
|
signalDeprecation(sdk.context, name, getDeprecation);
|
|
822
|
+
signalStability(sdk.context, name, getStability);
|
|
762
823
|
}
|
|
763
824
|
return runInMethodScope(() => {
|
|
764
825
|
const startTime = Date.now();
|
|
@@ -864,7 +925,8 @@ function createPaginatedFunction(coreFn, options) {
|
|
|
864
925
|
adaptPage,
|
|
865
926
|
annotator,
|
|
866
927
|
finalizePage,
|
|
867
|
-
getDeprecation
|
|
928
|
+
getDeprecation,
|
|
929
|
+
getStability
|
|
868
930
|
} = options;
|
|
869
931
|
const pageFunction = createPageFunction(coreFn, {
|
|
870
932
|
sdk,
|
|
@@ -878,6 +940,7 @@ function createPaginatedFunction(coreFn, options) {
|
|
|
878
940
|
const context = resolveCallContext(internal);
|
|
879
941
|
if (!isCallContext(internal) && internal !== INTERNAL_CALL) {
|
|
880
942
|
signalDeprecation(sdk.context, functionName, getDeprecation);
|
|
943
|
+
signalStability(sdk.context, functionName, getStability);
|
|
881
944
|
}
|
|
882
945
|
return runInMethodScope(() => {
|
|
883
946
|
const startTime = Date.now();
|
|
@@ -1316,6 +1379,7 @@ var LEAF_META_KEYS = [
|
|
|
1316
1379
|
"returnType",
|
|
1317
1380
|
"outputSchema",
|
|
1318
1381
|
"packages",
|
|
1382
|
+
"stability",
|
|
1319
1383
|
"experimental",
|
|
1320
1384
|
"confirm",
|
|
1321
1385
|
"deprecation",
|
|
@@ -2153,8 +2217,9 @@ function bindValue({
|
|
|
2153
2217
|
frameworkOrigin = false
|
|
2154
2218
|
}) {
|
|
2155
2219
|
if (entry.pluginType === "property" && entry.getValue) {
|
|
2220
|
+
const getValue = entry.getValue;
|
|
2156
2221
|
Object.defineProperty(target, key, {
|
|
2157
|
-
get:
|
|
2222
|
+
get: ctx ? () => getValue(ctx) : getValue,
|
|
2158
2223
|
enumerable: true,
|
|
2159
2224
|
configurable: true
|
|
2160
2225
|
});
|
|
@@ -2541,7 +2606,8 @@ function buildMethodEntries(descriptors, context, states) {
|
|
|
2541
2606
|
// (item mode's sibling); dropped paths surface as `[].x` in the page's
|
|
2542
2607
|
// `meta`, unioned across items.
|
|
2543
2608
|
finalizePage: (page) => applyListOutputPolicy(page, outputPolicy()),
|
|
2544
|
-
getDeprecation: () => entry.meta?.deprecation
|
|
2609
|
+
getDeprecation: () => entry.meta?.deprecation,
|
|
2610
|
+
getStability: () => entry.meta ? normalizeStability(entry.meta) : void 0
|
|
2545
2611
|
}
|
|
2546
2612
|
);
|
|
2547
2613
|
} else if (out.type === "item") {
|
|
@@ -2553,7 +2619,8 @@ function buildMethodEntries(descriptors, context, states) {
|
|
|
2553
2619
|
schema: descriptor.inputSchema,
|
|
2554
2620
|
name: descriptor.name,
|
|
2555
2621
|
annotator: boundAnnotator,
|
|
2556
|
-
getDeprecation: () => entry.meta?.deprecation
|
|
2622
|
+
getDeprecation: () => entry.meta?.deprecation,
|
|
2623
|
+
getStability: () => entry.meta ? normalizeStability(entry.meta) : void 0
|
|
2557
2624
|
}
|
|
2558
2625
|
);
|
|
2559
2626
|
} else {
|
|
@@ -2567,8 +2634,10 @@ function buildMethodEntries(descriptors, context, states) {
|
|
|
2567
2634
|
annotator: boundAnnotator,
|
|
2568
2635
|
// The boundary reads the deprecation LIVE off the entry, so a
|
|
2569
2636
|
// deprecation merged after build (defineMethodOverride, addPlugin)
|
|
2570
|
-
// fires too.
|
|
2571
|
-
|
|
2637
|
+
// fires too. Same for the stability level, normalized from the
|
|
2638
|
+
// entry meta (declared level or legacy `experimental` boolean).
|
|
2639
|
+
getDeprecation: () => entry.meta?.deprecation,
|
|
2640
|
+
getStability: () => entry.meta ? normalizeStability(entry.meta) : void 0
|
|
2572
2641
|
}
|
|
2573
2642
|
);
|
|
2574
2643
|
}
|
|
@@ -2688,9 +2757,14 @@ function buildEagerArtifacts(descriptors, context, states) {
|
|
|
2688
2757
|
plugins[id] = {
|
|
2689
2758
|
pluginType: "property",
|
|
2690
2759
|
name: descriptor.name,
|
|
2691
|
-
getValue: () => get({
|
|
2692
|
-
imports: buildImports({
|
|
2693
|
-
|
|
2760
|
+
getValue: (callContext) => get({
|
|
2761
|
+
imports: buildImports({
|
|
2762
|
+
plugins,
|
|
2763
|
+
importBindings,
|
|
2764
|
+
ctx: callContext
|
|
2765
|
+
}),
|
|
2766
|
+
state: states.get(id),
|
|
2767
|
+
callContext
|
|
2694
2768
|
}),
|
|
2695
2769
|
meta: descriptor.meta,
|
|
2696
2770
|
dynamicMembers: descriptor.dynamicMembers
|
|
@@ -5596,6 +5670,11 @@ function createSemaphore(maxPermits) {
|
|
|
5596
5670
|
}
|
|
5597
5671
|
};
|
|
5598
5672
|
}
|
|
5673
|
+
|
|
5674
|
+
// src/api/correlation.ts
|
|
5675
|
+
var CORRELATION_CALL_ID = Symbol(
|
|
5676
|
+
"zapier.correlationCallId"
|
|
5677
|
+
);
|
|
5599
5678
|
var ClientCredentialsObjectSchema = z.object({
|
|
5600
5679
|
type: z.enum(["client_credentials"]).optional().meta({ internal: true }),
|
|
5601
5680
|
clientId: z.string().describe("OAuth client ID for authentication.").meta({ valueHint: "id" }),
|
|
@@ -6512,7 +6591,7 @@ function parseDeprecationDate(value) {
|
|
|
6512
6591
|
}
|
|
6513
6592
|
|
|
6514
6593
|
// src/sdk-version.ts
|
|
6515
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.
|
|
6594
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.98.1" : void 0) || "unknown";
|
|
6516
6595
|
|
|
6517
6596
|
// src/utils/open-url.ts
|
|
6518
6597
|
var nodePrefix = "node:";
|
|
@@ -6774,14 +6853,15 @@ var ZapierApiClient = class {
|
|
|
6774
6853
|
* directly and drifting.
|
|
6775
6854
|
*/
|
|
6776
6855
|
this.rawFetchUrl = async (url, init, pathConfig2) => {
|
|
6777
|
-
|
|
6778
|
-
|
|
6856
|
+
const { [CORRELATION_CALL_ID]: callId, ...fetchInit } = init ?? {};
|
|
6857
|
+
if (fetchInit.body && (isPlainObject(fetchInit.body) || Array.isArray(fetchInit.body))) {
|
|
6858
|
+
fetchInit.body = JSON.stringify(fetchInit.body);
|
|
6779
6859
|
}
|
|
6780
6860
|
const builtHeaders = await this.buildHeaders(
|
|
6781
|
-
|
|
6861
|
+
fetchInit,
|
|
6782
6862
|
pathConfig2
|
|
6783
6863
|
);
|
|
6784
|
-
const inputHeaders = new Headers(
|
|
6864
|
+
const inputHeaders = new Headers(fetchInit.headers ?? {});
|
|
6785
6865
|
const mergedHeaders = new Headers();
|
|
6786
6866
|
builtHeaders.forEach((value, key) => {
|
|
6787
6867
|
mergedHeaders.set(key, value);
|
|
@@ -6789,11 +6869,11 @@ var ZapierApiClient = class {
|
|
|
6789
6869
|
inputHeaders.forEach((value, key) => {
|
|
6790
6870
|
mergedHeaders.set(key, value);
|
|
6791
6871
|
});
|
|
6792
|
-
this.applyTelemetryHeaders(mergedHeaders);
|
|
6872
|
+
this.applyTelemetryHeaders({ headers: mergedHeaders, callId });
|
|
6793
6873
|
let retries = 0;
|
|
6794
6874
|
while (true) {
|
|
6795
6875
|
const response = await this.options.fetch(url, {
|
|
6796
|
-
...
|
|
6876
|
+
...fetchInit,
|
|
6797
6877
|
headers: mergedHeaders
|
|
6798
6878
|
});
|
|
6799
6879
|
if (response.status !== 429) {
|
|
@@ -6914,12 +6994,13 @@ var ZapierApiClient = class {
|
|
|
6914
6994
|
);
|
|
6915
6995
|
const askStatementIds = askStatementIdsHeader ? JSON.parse(askStatementIdsHeader) : void 0;
|
|
6916
6996
|
try {
|
|
6917
|
-
await this.runOneApprovalRound(
|
|
6918
|
-
approvalContext,
|
|
6919
|
-
approvalMode,
|
|
6920
|
-
init?.signal ?? void 0,
|
|
6921
|
-
askStatementIds
|
|
6922
|
-
|
|
6997
|
+
await this.runOneApprovalRound({
|
|
6998
|
+
buildContext: approvalContext,
|
|
6999
|
+
mode: approvalMode,
|
|
7000
|
+
signal: init?.signal ?? void 0,
|
|
7001
|
+
askStatementIds,
|
|
7002
|
+
callId: init?.[CORRELATION_CALL_ID]
|
|
7003
|
+
});
|
|
6923
7004
|
} catch (error) {
|
|
6924
7005
|
return { response, approvalRoundError: error };
|
|
6925
7006
|
}
|
|
@@ -7061,7 +7142,8 @@ var ZapierApiClient = class {
|
|
|
7061
7142
|
method: "GET",
|
|
7062
7143
|
searchParams: options.searchParams,
|
|
7063
7144
|
authRequired: options.authRequired,
|
|
7064
|
-
signal: options.signal
|
|
7145
|
+
signal: options.signal,
|
|
7146
|
+
[CORRELATION_CALL_ID]: options[CORRELATION_CALL_ID]
|
|
7065
7147
|
}),
|
|
7066
7148
|
initialDelay: options.initialDelayMilliseconds ?? options.initialDelay,
|
|
7067
7149
|
timeoutMs: options.timeoutMilliseconds ?? options.timeoutMs,
|
|
@@ -7356,7 +7438,10 @@ var ZapierApiClient = class {
|
|
|
7356
7438
|
// gateway now expects) and the legacy `x-zapier-*` names. The legacy names are
|
|
7357
7439
|
// kept for backward compatibility with consumers that haven't migrated yet;
|
|
7358
7440
|
// they can be removed once nothing reads them.
|
|
7359
|
-
applyTelemetryHeaders(
|
|
7441
|
+
applyTelemetryHeaders({
|
|
7442
|
+
headers,
|
|
7443
|
+
callId
|
|
7444
|
+
}) {
|
|
7360
7445
|
headers.set("zapier-sdk-version", SDK_VERSION);
|
|
7361
7446
|
headers.set("x-zapier-sdk-version", SDK_VERSION);
|
|
7362
7447
|
const sdkService = getZapierSdkService();
|
|
@@ -7379,6 +7464,11 @@ var ZapierApiClient = class {
|
|
|
7379
7464
|
headers.set("zapier-sdk-package-operation", packageOperation);
|
|
7380
7465
|
}
|
|
7381
7466
|
}
|
|
7467
|
+
if (callId) {
|
|
7468
|
+
headers.set("zapier-correlation-id", callId);
|
|
7469
|
+
} else {
|
|
7470
|
+
headers.delete("zapier-correlation-id");
|
|
7471
|
+
}
|
|
7382
7472
|
}
|
|
7383
7473
|
// Helper to perform HTTP requests with JSON handling
|
|
7384
7474
|
async fetchJson(method, path, data, options = {}) {
|
|
@@ -7521,7 +7611,13 @@ var ZapierApiClient = class {
|
|
|
7521
7611
|
* Caller is responsible for passing a non-"disabled" mode; this method
|
|
7522
7612
|
* unconditionally creates an approval.
|
|
7523
7613
|
*/
|
|
7524
|
-
async runOneApprovalRound(
|
|
7614
|
+
async runOneApprovalRound({
|
|
7615
|
+
buildContext,
|
|
7616
|
+
mode,
|
|
7617
|
+
signal,
|
|
7618
|
+
askStatementIds,
|
|
7619
|
+
callId
|
|
7620
|
+
}) {
|
|
7525
7621
|
const context = buildContext();
|
|
7526
7622
|
let approvalResponse;
|
|
7527
7623
|
try {
|
|
@@ -7535,7 +7631,8 @@ var ZapierApiClient = class {
|
|
|
7535
7631
|
context,
|
|
7536
7632
|
...askStatementIds?.length ? { ask_statement_ids: askStatementIds } : {}
|
|
7537
7633
|
}),
|
|
7538
|
-
signal
|
|
7634
|
+
signal,
|
|
7635
|
+
[CORRELATION_CALL_ID]: callId
|
|
7539
7636
|
});
|
|
7540
7637
|
} catch (err) {
|
|
7541
7638
|
if (isAbortError(err)) throw err;
|
|
@@ -7671,7 +7768,10 @@ var ZapierApiClient = class {
|
|
|
7671
7768
|
approvalId: approval.id,
|
|
7672
7769
|
streamUrl,
|
|
7673
7770
|
signal: streamAbortController.signal,
|
|
7674
|
-
stream: (url, streamInit) => this.streamTrustedJsonUrl(url,
|
|
7771
|
+
stream: (url, streamInit) => this.streamTrustedJsonUrl(url, {
|
|
7772
|
+
...streamInit,
|
|
7773
|
+
[CORRELATION_CALL_ID]: callId
|
|
7774
|
+
}),
|
|
7675
7775
|
emitEvent: (type, payload) => this.emitEvent(type, payload)
|
|
7676
7776
|
});
|
|
7677
7777
|
}
|
|
@@ -7680,7 +7780,8 @@ var ZapierApiClient = class {
|
|
|
7680
7780
|
() => this.rawFetchUrl(approval.poll_url, {
|
|
7681
7781
|
method: "GET",
|
|
7682
7782
|
headers: { Accept: "application/json" },
|
|
7683
|
-
signal
|
|
7783
|
+
signal,
|
|
7784
|
+
[CORRELATION_CALL_ID]: callId
|
|
7684
7785
|
})
|
|
7685
7786
|
);
|
|
7686
7787
|
const pollApprovalUntilComplete = async (isPending, deadlineMs = approvalDeadline) => {
|
|
@@ -7872,6 +7973,23 @@ var API_ID = "zapier/api";
|
|
|
7872
7973
|
var apiPluginRef = declareProperty({
|
|
7873
7974
|
id: API_ID
|
|
7874
7975
|
});
|
|
7976
|
+
function withCorrelationId({
|
|
7977
|
+
client,
|
|
7978
|
+
callId
|
|
7979
|
+
}) {
|
|
7980
|
+
const stamp = (options) => ({ ...options, [CORRELATION_CALL_ID]: callId });
|
|
7981
|
+
return {
|
|
7982
|
+
get: (path, options) => client.get(path, stamp(options)),
|
|
7983
|
+
post: (path, data, options) => client.post(path, data, stamp(options)),
|
|
7984
|
+
put: (path, data, options) => client.put(path, data, stamp(options)),
|
|
7985
|
+
patch: (path, data, options) => client.patch(path, data, stamp(options)),
|
|
7986
|
+
delete: (path, data, options) => client.delete(path, data, stamp(options)),
|
|
7987
|
+
poll: (path, options) => client.poll(path, stamp(options)),
|
|
7988
|
+
fetch: (path, init) => client.fetch(path, stamp(init)),
|
|
7989
|
+
fetchStream: (path, init) => client.fetchStream(path, stamp(init)),
|
|
7990
|
+
fetchJsonStream: (path, init) => client.fetchJsonStream(path, stamp(init))
|
|
7991
|
+
};
|
|
7992
|
+
}
|
|
7875
7993
|
var apiPlugin = defineProperty({
|
|
7876
7994
|
namespace: "zapier",
|
|
7877
7995
|
name: "api",
|
|
@@ -7912,7 +8030,7 @@ var apiPlugin = defineProperty({
|
|
|
7912
8030
|
callerPackage
|
|
7913
8031
|
});
|
|
7914
8032
|
},
|
|
7915
|
-
get: ({ state }) => state
|
|
8033
|
+
get: ({ state, callContext }) => callContext?.callId ? withCorrelationId({ client: state, callId: callContext.callId }) : state
|
|
7916
8034
|
});
|
|
7917
8035
|
var RESOLVE_CREDENTIALS_ID = "zapier/resolveCredentials";
|
|
7918
8036
|
var resolveCredentialsPluginRef = declareProperty({ id: RESOLVE_CREDENTIALS_ID });
|
|
@@ -8473,8 +8591,11 @@ var manifestPlugin = defineProperty({
|
|
|
8473
8591
|
namespace: "zapier",
|
|
8474
8592
|
name: "manifest",
|
|
8475
8593
|
imports: [sdkOptionsPluginRef, apiPluginRef],
|
|
8594
|
+
// Deliberately does not read `imports.api`: at build time that resolves to the
|
|
8595
|
+
// bare shared client, and capturing it here would strip the correlation id off
|
|
8596
|
+
// every slug-resolution request. `get` supplies the reading call's client
|
|
8597
|
+
// instead.
|
|
8476
8598
|
setup: ({ imports }) => {
|
|
8477
|
-
const api = imports.api;
|
|
8478
8599
|
const { manifestPath = DEFAULT_CONFIG_PATH, manifest } = imports.sdkOptions ?? {};
|
|
8479
8600
|
let resolvedManifest;
|
|
8480
8601
|
async function resolveManifest() {
|
|
@@ -8492,7 +8613,10 @@ var manifestPlugin = defineProperty({
|
|
|
8492
8613
|
}
|
|
8493
8614
|
return resolvedManifest;
|
|
8494
8615
|
};
|
|
8495
|
-
const getVersionedImplementationId = async (
|
|
8616
|
+
const getVersionedImplementationId = async ({
|
|
8617
|
+
appKey,
|
|
8618
|
+
api
|
|
8619
|
+
}) => {
|
|
8496
8620
|
const resolvedApps = await resolveAppKeys({
|
|
8497
8621
|
appKeys: [appKey],
|
|
8498
8622
|
api,
|
|
@@ -8502,14 +8626,14 @@ var manifestPlugin = defineProperty({
|
|
|
8502
8626
|
if (!resolvedApp) return null;
|
|
8503
8627
|
return `${resolvedApp.implementationName}@${resolvedApp.version || "latest"}`;
|
|
8504
8628
|
};
|
|
8505
|
-
const updateManifestEntry = async (
|
|
8506
|
-
|
|
8507
|
-
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
|
|
8512
|
-
|
|
8629
|
+
const updateManifestEntry = async ({
|
|
8630
|
+
api,
|
|
8631
|
+
appKey,
|
|
8632
|
+
entry,
|
|
8633
|
+
configPath = DEFAULT_CONFIG_PATH,
|
|
8634
|
+
skipWrite = false,
|
|
8635
|
+
manifest: inputManifest
|
|
8636
|
+
}) => {
|
|
8513
8637
|
const manifest2 = inputManifest || await readManifestFromFile(configPath) || { apps: {} };
|
|
8514
8638
|
let existingEntry = findManifestEntry({
|
|
8515
8639
|
appKey,
|
|
@@ -8560,7 +8684,7 @@ var manifestPlugin = defineProperty({
|
|
|
8560
8684
|
};
|
|
8561
8685
|
return {
|
|
8562
8686
|
getVersionedImplementationId,
|
|
8563
|
-
resolveAppKeys: async ({ appKeys }) => resolveAppKeys({
|
|
8687
|
+
resolveAppKeys: async ({ appKeys, api }) => resolveAppKeys({
|
|
8564
8688
|
appKeys,
|
|
8565
8689
|
api,
|
|
8566
8690
|
manifest: await getResolvedManifest() ?? { apps: {} }
|
|
@@ -8573,7 +8697,19 @@ var manifestPlugin = defineProperty({
|
|
|
8573
8697
|
updateManifestEntry
|
|
8574
8698
|
};
|
|
8575
8699
|
},
|
|
8576
|
-
|
|
8700
|
+
// Bind the reading call's API client onto the slug-resolving entry points so
|
|
8701
|
+
// their requests carry that call's correlation id. The manifest-only reads pass
|
|
8702
|
+
// straight through.
|
|
8703
|
+
get: ({ imports, state }) => {
|
|
8704
|
+
const api = imports.api;
|
|
8705
|
+
return {
|
|
8706
|
+
getVersionedImplementationId: (appKey) => state.getVersionedImplementationId({ appKey, api }),
|
|
8707
|
+
resolveAppKeys: ({ appKeys }) => state.resolveAppKeys({ appKeys, api }),
|
|
8708
|
+
getResolvedManifest: state.getResolvedManifest,
|
|
8709
|
+
getManifestConnections: state.getManifestConnections,
|
|
8710
|
+
updateManifestEntry: (options) => state.updateManifestEntry({ ...options, api })
|
|
8711
|
+
};
|
|
8712
|
+
}
|
|
8577
8713
|
});
|
|
8578
8714
|
|
|
8579
8715
|
// src/plugins/connections/index.ts
|
|
@@ -11862,14 +11998,24 @@ var ListConnectionsQuerySchema = ListConnectionsQuerySchema$1.omit({
|
|
|
11862
11998
|
includeShared: z.boolean().optional().describe(
|
|
11863
11999
|
"Include connections shared with you. By default, only your own connections are returned (owner=me). Set to true to also include shared connections."
|
|
11864
12000
|
),
|
|
11865
|
-
|
|
12001
|
+
// Filters on connection expiry. Not a mirror of a server-side status
|
|
12002
|
+
// field: the API expresses this as the is_expired filter, which we send as
|
|
12003
|
+
// false for "active", true for "expired", and omit for "all".
|
|
12004
|
+
status: z.enum(["active", "expired", "all"]).optional().describe(
|
|
12005
|
+
"Filter connections by expiry: 'active' (default) returns only non-expired connections, 'expired' only expired ones, and 'all' returns both."
|
|
12006
|
+
),
|
|
12007
|
+
/** @deprecated Use `status` instead */
|
|
11866
12008
|
isExpired: z.boolean().optional().describe("Filter by expired status").meta({
|
|
11867
12009
|
deprecated: true,
|
|
11868
|
-
deprecationMessage: "Use --expired instead to show only expired connections."
|
|
12010
|
+
deprecationMessage: "Use --status expired instead to show only expired connections, or --status all for both."
|
|
11869
12011
|
}),
|
|
12012
|
+
/** @deprecated Use `status` instead */
|
|
11870
12013
|
expired: z.boolean().optional().describe(
|
|
11871
12014
|
"Show only expired connections (default: only non-expired connections are returned)"
|
|
11872
|
-
)
|
|
12015
|
+
).meta({
|
|
12016
|
+
deprecated: true,
|
|
12017
|
+
deprecationMessage: "Use --status expired instead to show only expired connections, or --status all for both."
|
|
12018
|
+
}),
|
|
11873
12019
|
// Override pageSize to make optional
|
|
11874
12020
|
pageSize: z.number().min(1).optional().describe("Number of connections per page"),
|
|
11875
12021
|
// SDK specific property for pagination/iterable helpers
|
|
@@ -11995,10 +12141,15 @@ var listConnectionsPlugin = defineMethod({
|
|
|
11995
12141
|
if (owner) {
|
|
11996
12142
|
searchParams.owner = owner;
|
|
11997
12143
|
}
|
|
11998
|
-
|
|
11999
|
-
|
|
12000
|
-
|
|
12001
|
-
|
|
12144
|
+
const expiredFilter = input.isExpired ?? input.expired;
|
|
12145
|
+
if (input.status !== void 0 && expiredFilter !== void 0) {
|
|
12146
|
+
throw new ZapierValidationError(
|
|
12147
|
+
'The "status" option replaces "expired" and "isExpired", so it cannot be combined with either.'
|
|
12148
|
+
);
|
|
12149
|
+
}
|
|
12150
|
+
const status = input.status ?? (expiredFilter ? "expired" : "active");
|
|
12151
|
+
if (status !== "all") {
|
|
12152
|
+
searchParams.is_expired = (status === "expired").toString();
|
|
12002
12153
|
}
|
|
12003
12154
|
if (input.cursor) {
|
|
12004
12155
|
searchParams.offset = input.cursor;
|
|
@@ -15659,6 +15810,7 @@ function buildErrorEventWithContext(data, context = {}) {
|
|
|
15659
15810
|
function buildMethodCalledEvent(data, context = {}) {
|
|
15660
15811
|
return {
|
|
15661
15812
|
...createBaseEvent(context),
|
|
15813
|
+
correlation_id: data.correlation_id ?? context.correlation_id ?? null,
|
|
15662
15814
|
method_name: data.method_name ?? null,
|
|
15663
15815
|
method_module: data.method_module ?? null,
|
|
15664
15816
|
execution_duration_ms: data.execution_duration_ms,
|
|
@@ -15716,6 +15868,7 @@ function makeMethodEndHook(emitMethodCalled) {
|
|
|
15716
15868
|
args,
|
|
15717
15869
|
isPaginated,
|
|
15718
15870
|
depth,
|
|
15871
|
+
callId,
|
|
15719
15872
|
callOrigin,
|
|
15720
15873
|
annotations,
|
|
15721
15874
|
durationMs,
|
|
@@ -15725,6 +15878,9 @@ function makeMethodEndHook(emitMethodCalled) {
|
|
|
15725
15878
|
const metadata = readMethodMetadata(annotations);
|
|
15726
15879
|
emitMethodCalled({
|
|
15727
15880
|
method_name: methodName,
|
|
15881
|
+
// The per-call correlation id (also the `zapier-correlation-id` header on
|
|
15882
|
+
// this call's requests). Not the `call_context` surface label.
|
|
15883
|
+
correlation_id: callId ?? null,
|
|
15728
15884
|
execution_duration_ms: durationMs,
|
|
15729
15885
|
success_flag: !error,
|
|
15730
15886
|
error_message: error?.message ?? null,
|