@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
|
@@ -68,6 +68,13 @@ function getNegatable(schema) {
|
|
|
68
68
|
function openEnum(values, description) {
|
|
69
69
|
return zod.z.union([zod.z.enum(values), zod.z.string()]).describe(description);
|
|
70
70
|
}
|
|
71
|
+
var STABILITY_LEVELS = ["stable", "beta", "experimental"];
|
|
72
|
+
function normalizeStability(meta) {
|
|
73
|
+
if (meta.stability !== void 0) {
|
|
74
|
+
return STABILITY_LEVELS.includes(meta.stability) ? meta.stability : "experimental";
|
|
75
|
+
}
|
|
76
|
+
return meta.experimental ? "experimental" : "stable";
|
|
77
|
+
}
|
|
71
78
|
function resolveCategoryDefinition(ref) {
|
|
72
79
|
const def = typeof ref === "string" ? { key: ref } : ref;
|
|
73
80
|
const title = def.title ?? toTitleCase(def.key);
|
|
@@ -111,6 +118,7 @@ function buildRegistry({
|
|
|
111
118
|
return typeof rootProperty === "object" && rootProperty !== null;
|
|
112
119
|
}).map((key) => {
|
|
113
120
|
const m = meta[key];
|
|
121
|
+
const stability = normalizeStability(m);
|
|
114
122
|
return {
|
|
115
123
|
name: key,
|
|
116
124
|
description: m.description,
|
|
@@ -126,7 +134,11 @@ function buildRegistry({
|
|
|
126
134
|
),
|
|
127
135
|
resolvers: resolvers?.[key],
|
|
128
136
|
formatter: formatters?.[key],
|
|
129
|
-
|
|
137
|
+
stability,
|
|
138
|
+
// Deprecated derived read, literal by name: only the experimental
|
|
139
|
+
// tier reads true. Beta reads false — the "not stable" warning duty
|
|
140
|
+
// lives in `stability` and the runtime notice, not this boolean.
|
|
141
|
+
experimental: stability === "experimental",
|
|
130
142
|
packages: m.packages,
|
|
131
143
|
confirm: m.confirm ?? (m.type === "delete" ? "delete" : void 0),
|
|
132
144
|
deprecation: m.deprecation,
|
|
@@ -211,6 +223,20 @@ function createDeprecationLogger(tag) {
|
|
|
211
223
|
};
|
|
212
224
|
}
|
|
213
225
|
var { logDeprecation} = createDeprecationLogger("core");
|
|
226
|
+
function createStabilityNoticeLogger(tag) {
|
|
227
|
+
const loggedNotices = /* @__PURE__ */ new Set();
|
|
228
|
+
return {
|
|
229
|
+
logStabilityNotice(message) {
|
|
230
|
+
if (loggedNotices.has(message)) return;
|
|
231
|
+
loggedNotices.add(message);
|
|
232
|
+
console.warn(`[${tag}] ${message}`);
|
|
233
|
+
},
|
|
234
|
+
resetStabilityNotices() {
|
|
235
|
+
loggedNotices.clear();
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
var { logStabilityNotice} = createStabilityNoticeLogger("core");
|
|
214
240
|
var CORE_ERROR_SYMBOL = Symbol.for("kitcore.error");
|
|
215
241
|
var CoreErrorCode = {
|
|
216
242
|
Validation: "VALIDATION_ERROR",
|
|
@@ -622,6 +648,19 @@ function defaultLogDeprecation({
|
|
|
622
648
|
}) {
|
|
623
649
|
logDeprecation(`${methodName}() is deprecated. ${deprecation.message}`);
|
|
624
650
|
}
|
|
651
|
+
var STABILITY_NOTICE_DETAILS = {
|
|
652
|
+
beta: "Its API shape is settled, but it is not yet covered by stable-tier guarantees.",
|
|
653
|
+
experimental: "It may change shape or disappear without notice."
|
|
654
|
+
};
|
|
655
|
+
function defaultLogStabilityNotice({
|
|
656
|
+
methodName,
|
|
657
|
+
stability
|
|
658
|
+
}) {
|
|
659
|
+
if (stability === "stable") return;
|
|
660
|
+
logStabilityNotice(
|
|
661
|
+
`${methodName}() is a ${stability} API. ${STABILITY_NOTICE_DETAILS[stability]}`
|
|
662
|
+
);
|
|
663
|
+
}
|
|
625
664
|
var CORE_OPTIONS_ID = "kitcore/coreOptions";
|
|
626
665
|
function resolveCoreOptions(context) {
|
|
627
666
|
const entry = context.plugins?.[CORE_OPTIONS_ID];
|
|
@@ -668,6 +707,18 @@ function signalDeprecation(context, methodName, getDeprecation) {
|
|
|
668
707
|
const handler = resolveCoreOptions(context)?.logDeprecation ?? defaultLogDeprecation;
|
|
669
708
|
runIsolatedObserver(() => handler(warning));
|
|
670
709
|
}
|
|
710
|
+
function signalStability(context, methodName, getStability) {
|
|
711
|
+
if (isInsideObserver()) return;
|
|
712
|
+
const stability = getStability?.();
|
|
713
|
+
if (!stability || stability === "stable") return;
|
|
714
|
+
const notice = {
|
|
715
|
+
type: "stability",
|
|
716
|
+
methodName,
|
|
717
|
+
stability
|
|
718
|
+
};
|
|
719
|
+
const handler = resolveCoreOptions(context)?.logStabilityNotice ?? defaultLogStabilityNotice;
|
|
720
|
+
runIsolatedObserver(() => handler(notice));
|
|
721
|
+
}
|
|
671
722
|
function normalizeError(error, adaptError) {
|
|
672
723
|
if (error instanceof Error) return error;
|
|
673
724
|
const message = typeof error === "object" && error !== null && "message" in error && typeof error.message === "string" ? error.message : String(error);
|
|
@@ -681,7 +732,7 @@ function normalizeError(error, adaptError) {
|
|
|
681
732
|
);
|
|
682
733
|
}
|
|
683
734
|
function createFunction(coreFn, options) {
|
|
684
|
-
const { sdk, schema, name, annotator, getDeprecation } = options;
|
|
735
|
+
const { sdk, schema, name, annotator, getDeprecation, getStability } = options;
|
|
685
736
|
const functionName = name || coreFn.name;
|
|
686
737
|
const namedFunctions = {
|
|
687
738
|
[functionName]: async function(callOptions) {
|
|
@@ -689,6 +740,7 @@ function createFunction(coreFn, options) {
|
|
|
689
740
|
const context = resolveCallContext(internal);
|
|
690
741
|
if (!isCallContext(internal) && internal !== INTERNAL_CALL) {
|
|
691
742
|
signalDeprecation(sdk.context, functionName, getDeprecation);
|
|
743
|
+
signalStability(sdk.context, functionName, getStability);
|
|
692
744
|
}
|
|
693
745
|
return runInMethodScope(async () => {
|
|
694
746
|
const startTime = Date.now();
|
|
@@ -755,12 +807,21 @@ function createFunction(coreFn, options) {
|
|
|
755
807
|
return namedFunctions[functionName];
|
|
756
808
|
}
|
|
757
809
|
function createRawFunction(coreFn, options) {
|
|
758
|
-
const {
|
|
810
|
+
const {
|
|
811
|
+
sdk,
|
|
812
|
+
name,
|
|
813
|
+
schema,
|
|
814
|
+
positional,
|
|
815
|
+
annotator,
|
|
816
|
+
getDeprecation,
|
|
817
|
+
getStability
|
|
818
|
+
} = options;
|
|
759
819
|
return function(rawInput) {
|
|
760
820
|
const internal = arguments[1];
|
|
761
821
|
const context = resolveCallContext(internal);
|
|
762
822
|
if (!isCallContext(internal) && internal !== INTERNAL_CALL) {
|
|
763
823
|
signalDeprecation(sdk.context, name, getDeprecation);
|
|
824
|
+
signalStability(sdk.context, name, getStability);
|
|
764
825
|
}
|
|
765
826
|
return runInMethodScope(() => {
|
|
766
827
|
const startTime = Date.now();
|
|
@@ -866,7 +927,8 @@ function createPaginatedFunction(coreFn, options) {
|
|
|
866
927
|
adaptPage,
|
|
867
928
|
annotator,
|
|
868
929
|
finalizePage,
|
|
869
|
-
getDeprecation
|
|
930
|
+
getDeprecation,
|
|
931
|
+
getStability
|
|
870
932
|
} = options;
|
|
871
933
|
const pageFunction = createPageFunction(coreFn, {
|
|
872
934
|
sdk,
|
|
@@ -880,6 +942,7 @@ function createPaginatedFunction(coreFn, options) {
|
|
|
880
942
|
const context = resolveCallContext(internal);
|
|
881
943
|
if (!isCallContext(internal) && internal !== INTERNAL_CALL) {
|
|
882
944
|
signalDeprecation(sdk.context, functionName, getDeprecation);
|
|
945
|
+
signalStability(sdk.context, functionName, getStability);
|
|
883
946
|
}
|
|
884
947
|
return runInMethodScope(() => {
|
|
885
948
|
const startTime = Date.now();
|
|
@@ -1318,6 +1381,7 @@ var LEAF_META_KEYS = [
|
|
|
1318
1381
|
"returnType",
|
|
1319
1382
|
"outputSchema",
|
|
1320
1383
|
"packages",
|
|
1384
|
+
"stability",
|
|
1321
1385
|
"experimental",
|
|
1322
1386
|
"confirm",
|
|
1323
1387
|
"deprecation",
|
|
@@ -2155,8 +2219,9 @@ function bindValue({
|
|
|
2155
2219
|
frameworkOrigin = false
|
|
2156
2220
|
}) {
|
|
2157
2221
|
if (entry.pluginType === "property" && entry.getValue) {
|
|
2222
|
+
const getValue = entry.getValue;
|
|
2158
2223
|
Object.defineProperty(target, key, {
|
|
2159
|
-
get:
|
|
2224
|
+
get: ctx ? () => getValue(ctx) : getValue,
|
|
2160
2225
|
enumerable: true,
|
|
2161
2226
|
configurable: true
|
|
2162
2227
|
});
|
|
@@ -2543,7 +2608,8 @@ function buildMethodEntries(descriptors, context, states) {
|
|
|
2543
2608
|
// (item mode's sibling); dropped paths surface as `[].x` in the page's
|
|
2544
2609
|
// `meta`, unioned across items.
|
|
2545
2610
|
finalizePage: (page) => applyListOutputPolicy(page, outputPolicy()),
|
|
2546
|
-
getDeprecation: () => entry.meta?.deprecation
|
|
2611
|
+
getDeprecation: () => entry.meta?.deprecation,
|
|
2612
|
+
getStability: () => entry.meta ? normalizeStability(entry.meta) : void 0
|
|
2547
2613
|
}
|
|
2548
2614
|
);
|
|
2549
2615
|
} else if (out.type === "item") {
|
|
@@ -2555,7 +2621,8 @@ function buildMethodEntries(descriptors, context, states) {
|
|
|
2555
2621
|
schema: descriptor.inputSchema,
|
|
2556
2622
|
name: descriptor.name,
|
|
2557
2623
|
annotator: boundAnnotator,
|
|
2558
|
-
getDeprecation: () => entry.meta?.deprecation
|
|
2624
|
+
getDeprecation: () => entry.meta?.deprecation,
|
|
2625
|
+
getStability: () => entry.meta ? normalizeStability(entry.meta) : void 0
|
|
2559
2626
|
}
|
|
2560
2627
|
);
|
|
2561
2628
|
} else {
|
|
@@ -2569,8 +2636,10 @@ function buildMethodEntries(descriptors, context, states) {
|
|
|
2569
2636
|
annotator: boundAnnotator,
|
|
2570
2637
|
// The boundary reads the deprecation LIVE off the entry, so a
|
|
2571
2638
|
// deprecation merged after build (defineMethodOverride, addPlugin)
|
|
2572
|
-
// fires too.
|
|
2573
|
-
|
|
2639
|
+
// fires too. Same for the stability level, normalized from the
|
|
2640
|
+
// entry meta (declared level or legacy `experimental` boolean).
|
|
2641
|
+
getDeprecation: () => entry.meta?.deprecation,
|
|
2642
|
+
getStability: () => entry.meta ? normalizeStability(entry.meta) : void 0
|
|
2574
2643
|
}
|
|
2575
2644
|
);
|
|
2576
2645
|
}
|
|
@@ -2690,9 +2759,14 @@ function buildEagerArtifacts(descriptors, context, states) {
|
|
|
2690
2759
|
plugins[id] = {
|
|
2691
2760
|
pluginType: "property",
|
|
2692
2761
|
name: descriptor.name,
|
|
2693
|
-
getValue: () => get({
|
|
2694
|
-
imports: buildImports({
|
|
2695
|
-
|
|
2762
|
+
getValue: (callContext) => get({
|
|
2763
|
+
imports: buildImports({
|
|
2764
|
+
plugins,
|
|
2765
|
+
importBindings,
|
|
2766
|
+
ctx: callContext
|
|
2767
|
+
}),
|
|
2768
|
+
state: states.get(id),
|
|
2769
|
+
callContext
|
|
2696
2770
|
}),
|
|
2697
2771
|
meta: descriptor.meta,
|
|
2698
2772
|
dynamicMembers: descriptor.dynamicMembers
|
|
@@ -5598,6 +5672,11 @@ function createSemaphore(maxPermits) {
|
|
|
5598
5672
|
}
|
|
5599
5673
|
};
|
|
5600
5674
|
}
|
|
5675
|
+
|
|
5676
|
+
// src/api/correlation.ts
|
|
5677
|
+
var CORRELATION_CALL_ID = Symbol(
|
|
5678
|
+
"zapier.correlationCallId"
|
|
5679
|
+
);
|
|
5601
5680
|
var ClientCredentialsObjectSchema = zod.z.object({
|
|
5602
5681
|
type: zod.z.enum(["client_credentials"]).optional().meta({ internal: true }),
|
|
5603
5682
|
clientId: zod.z.string().describe("OAuth client ID for authentication.").meta({ valueHint: "id" }),
|
|
@@ -6514,7 +6593,7 @@ function parseDeprecationDate(value) {
|
|
|
6514
6593
|
}
|
|
6515
6594
|
|
|
6516
6595
|
// src/sdk-version.ts
|
|
6517
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.
|
|
6596
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.98.1" : void 0) || "unknown";
|
|
6518
6597
|
|
|
6519
6598
|
// src/utils/open-url.ts
|
|
6520
6599
|
var nodePrefix = "node:";
|
|
@@ -6776,14 +6855,15 @@ var ZapierApiClient = class {
|
|
|
6776
6855
|
* directly and drifting.
|
|
6777
6856
|
*/
|
|
6778
6857
|
this.rawFetchUrl = async (url, init, pathConfig2) => {
|
|
6779
|
-
|
|
6780
|
-
|
|
6858
|
+
const { [CORRELATION_CALL_ID]: callId, ...fetchInit } = init ?? {};
|
|
6859
|
+
if (fetchInit.body && (isPlainObject(fetchInit.body) || Array.isArray(fetchInit.body))) {
|
|
6860
|
+
fetchInit.body = JSON.stringify(fetchInit.body);
|
|
6781
6861
|
}
|
|
6782
6862
|
const builtHeaders = await this.buildHeaders(
|
|
6783
|
-
|
|
6863
|
+
fetchInit,
|
|
6784
6864
|
pathConfig2
|
|
6785
6865
|
);
|
|
6786
|
-
const inputHeaders = new Headers(
|
|
6866
|
+
const inputHeaders = new Headers(fetchInit.headers ?? {});
|
|
6787
6867
|
const mergedHeaders = new Headers();
|
|
6788
6868
|
builtHeaders.forEach((value, key) => {
|
|
6789
6869
|
mergedHeaders.set(key, value);
|
|
@@ -6791,11 +6871,11 @@ var ZapierApiClient = class {
|
|
|
6791
6871
|
inputHeaders.forEach((value, key) => {
|
|
6792
6872
|
mergedHeaders.set(key, value);
|
|
6793
6873
|
});
|
|
6794
|
-
this.applyTelemetryHeaders(mergedHeaders);
|
|
6874
|
+
this.applyTelemetryHeaders({ headers: mergedHeaders, callId });
|
|
6795
6875
|
let retries = 0;
|
|
6796
6876
|
while (true) {
|
|
6797
6877
|
const response = await this.options.fetch(url, {
|
|
6798
|
-
...
|
|
6878
|
+
...fetchInit,
|
|
6799
6879
|
headers: mergedHeaders
|
|
6800
6880
|
});
|
|
6801
6881
|
if (response.status !== 429) {
|
|
@@ -6916,12 +6996,13 @@ var ZapierApiClient = class {
|
|
|
6916
6996
|
);
|
|
6917
6997
|
const askStatementIds = askStatementIdsHeader ? JSON.parse(askStatementIdsHeader) : void 0;
|
|
6918
6998
|
try {
|
|
6919
|
-
await this.runOneApprovalRound(
|
|
6920
|
-
approvalContext,
|
|
6921
|
-
approvalMode,
|
|
6922
|
-
init?.signal ?? void 0,
|
|
6923
|
-
askStatementIds
|
|
6924
|
-
|
|
6999
|
+
await this.runOneApprovalRound({
|
|
7000
|
+
buildContext: approvalContext,
|
|
7001
|
+
mode: approvalMode,
|
|
7002
|
+
signal: init?.signal ?? void 0,
|
|
7003
|
+
askStatementIds,
|
|
7004
|
+
callId: init?.[CORRELATION_CALL_ID]
|
|
7005
|
+
});
|
|
6925
7006
|
} catch (error) {
|
|
6926
7007
|
return { response, approvalRoundError: error };
|
|
6927
7008
|
}
|
|
@@ -7063,7 +7144,8 @@ var ZapierApiClient = class {
|
|
|
7063
7144
|
method: "GET",
|
|
7064
7145
|
searchParams: options.searchParams,
|
|
7065
7146
|
authRequired: options.authRequired,
|
|
7066
|
-
signal: options.signal
|
|
7147
|
+
signal: options.signal,
|
|
7148
|
+
[CORRELATION_CALL_ID]: options[CORRELATION_CALL_ID]
|
|
7067
7149
|
}),
|
|
7068
7150
|
initialDelay: options.initialDelayMilliseconds ?? options.initialDelay,
|
|
7069
7151
|
timeoutMs: options.timeoutMilliseconds ?? options.timeoutMs,
|
|
@@ -7358,7 +7440,10 @@ var ZapierApiClient = class {
|
|
|
7358
7440
|
// gateway now expects) and the legacy `x-zapier-*` names. The legacy names are
|
|
7359
7441
|
// kept for backward compatibility with consumers that haven't migrated yet;
|
|
7360
7442
|
// they can be removed once nothing reads them.
|
|
7361
|
-
applyTelemetryHeaders(
|
|
7443
|
+
applyTelemetryHeaders({
|
|
7444
|
+
headers,
|
|
7445
|
+
callId
|
|
7446
|
+
}) {
|
|
7362
7447
|
headers.set("zapier-sdk-version", SDK_VERSION);
|
|
7363
7448
|
headers.set("x-zapier-sdk-version", SDK_VERSION);
|
|
7364
7449
|
const sdkService = getZapierSdkService();
|
|
@@ -7381,6 +7466,11 @@ var ZapierApiClient = class {
|
|
|
7381
7466
|
headers.set("zapier-sdk-package-operation", packageOperation);
|
|
7382
7467
|
}
|
|
7383
7468
|
}
|
|
7469
|
+
if (callId) {
|
|
7470
|
+
headers.set("zapier-correlation-id", callId);
|
|
7471
|
+
} else {
|
|
7472
|
+
headers.delete("zapier-correlation-id");
|
|
7473
|
+
}
|
|
7384
7474
|
}
|
|
7385
7475
|
// Helper to perform HTTP requests with JSON handling
|
|
7386
7476
|
async fetchJson(method, path, data, options = {}) {
|
|
@@ -7523,7 +7613,13 @@ var ZapierApiClient = class {
|
|
|
7523
7613
|
* Caller is responsible for passing a non-"disabled" mode; this method
|
|
7524
7614
|
* unconditionally creates an approval.
|
|
7525
7615
|
*/
|
|
7526
|
-
async runOneApprovalRound(
|
|
7616
|
+
async runOneApprovalRound({
|
|
7617
|
+
buildContext,
|
|
7618
|
+
mode,
|
|
7619
|
+
signal,
|
|
7620
|
+
askStatementIds,
|
|
7621
|
+
callId
|
|
7622
|
+
}) {
|
|
7527
7623
|
const context = buildContext();
|
|
7528
7624
|
let approvalResponse;
|
|
7529
7625
|
try {
|
|
@@ -7537,7 +7633,8 @@ var ZapierApiClient = class {
|
|
|
7537
7633
|
context,
|
|
7538
7634
|
...askStatementIds?.length ? { ask_statement_ids: askStatementIds } : {}
|
|
7539
7635
|
}),
|
|
7540
|
-
signal
|
|
7636
|
+
signal,
|
|
7637
|
+
[CORRELATION_CALL_ID]: callId
|
|
7541
7638
|
});
|
|
7542
7639
|
} catch (err) {
|
|
7543
7640
|
if (isAbortError(err)) throw err;
|
|
@@ -7673,7 +7770,10 @@ var ZapierApiClient = class {
|
|
|
7673
7770
|
approvalId: approval.id,
|
|
7674
7771
|
streamUrl,
|
|
7675
7772
|
signal: streamAbortController.signal,
|
|
7676
|
-
stream: (url, streamInit) => this.streamTrustedJsonUrl(url,
|
|
7773
|
+
stream: (url, streamInit) => this.streamTrustedJsonUrl(url, {
|
|
7774
|
+
...streamInit,
|
|
7775
|
+
[CORRELATION_CALL_ID]: callId
|
|
7776
|
+
}),
|
|
7677
7777
|
emitEvent: (type, payload) => this.emitEvent(type, payload)
|
|
7678
7778
|
});
|
|
7679
7779
|
}
|
|
@@ -7682,7 +7782,8 @@ var ZapierApiClient = class {
|
|
|
7682
7782
|
() => this.rawFetchUrl(approval.poll_url, {
|
|
7683
7783
|
method: "GET",
|
|
7684
7784
|
headers: { Accept: "application/json" },
|
|
7685
|
-
signal
|
|
7785
|
+
signal,
|
|
7786
|
+
[CORRELATION_CALL_ID]: callId
|
|
7686
7787
|
})
|
|
7687
7788
|
);
|
|
7688
7789
|
const pollApprovalUntilComplete = async (isPending, deadlineMs = approvalDeadline) => {
|
|
@@ -7874,6 +7975,23 @@ var API_ID = "zapier/api";
|
|
|
7874
7975
|
var apiPluginRef = declareProperty({
|
|
7875
7976
|
id: API_ID
|
|
7876
7977
|
});
|
|
7978
|
+
function withCorrelationId({
|
|
7979
|
+
client,
|
|
7980
|
+
callId
|
|
7981
|
+
}) {
|
|
7982
|
+
const stamp = (options) => ({ ...options, [CORRELATION_CALL_ID]: callId });
|
|
7983
|
+
return {
|
|
7984
|
+
get: (path, options) => client.get(path, stamp(options)),
|
|
7985
|
+
post: (path, data, options) => client.post(path, data, stamp(options)),
|
|
7986
|
+
put: (path, data, options) => client.put(path, data, stamp(options)),
|
|
7987
|
+
patch: (path, data, options) => client.patch(path, data, stamp(options)),
|
|
7988
|
+
delete: (path, data, options) => client.delete(path, data, stamp(options)),
|
|
7989
|
+
poll: (path, options) => client.poll(path, stamp(options)),
|
|
7990
|
+
fetch: (path, init) => client.fetch(path, stamp(init)),
|
|
7991
|
+
fetchStream: (path, init) => client.fetchStream(path, stamp(init)),
|
|
7992
|
+
fetchJsonStream: (path, init) => client.fetchJsonStream(path, stamp(init))
|
|
7993
|
+
};
|
|
7994
|
+
}
|
|
7877
7995
|
var apiPlugin = defineProperty({
|
|
7878
7996
|
namespace: "zapier",
|
|
7879
7997
|
name: "api",
|
|
@@ -7914,7 +8032,7 @@ var apiPlugin = defineProperty({
|
|
|
7914
8032
|
callerPackage
|
|
7915
8033
|
});
|
|
7916
8034
|
},
|
|
7917
|
-
get: ({ state }) => state
|
|
8035
|
+
get: ({ state, callContext }) => callContext?.callId ? withCorrelationId({ client: state, callId: callContext.callId }) : state
|
|
7918
8036
|
});
|
|
7919
8037
|
var RESOLVE_CREDENTIALS_ID = "zapier/resolveCredentials";
|
|
7920
8038
|
var resolveCredentialsPluginRef = declareProperty({ id: RESOLVE_CREDENTIALS_ID });
|
|
@@ -8475,8 +8593,11 @@ var manifestPlugin = defineProperty({
|
|
|
8475
8593
|
namespace: "zapier",
|
|
8476
8594
|
name: "manifest",
|
|
8477
8595
|
imports: [sdkOptionsPluginRef, apiPluginRef],
|
|
8596
|
+
// Deliberately does not read `imports.api`: at build time that resolves to the
|
|
8597
|
+
// bare shared client, and capturing it here would strip the correlation id off
|
|
8598
|
+
// every slug-resolution request. `get` supplies the reading call's client
|
|
8599
|
+
// instead.
|
|
8478
8600
|
setup: ({ imports }) => {
|
|
8479
|
-
const api = imports.api;
|
|
8480
8601
|
const { manifestPath = DEFAULT_CONFIG_PATH, manifest } = imports.sdkOptions ?? {};
|
|
8481
8602
|
let resolvedManifest;
|
|
8482
8603
|
async function resolveManifest() {
|
|
@@ -8494,7 +8615,10 @@ var manifestPlugin = defineProperty({
|
|
|
8494
8615
|
}
|
|
8495
8616
|
return resolvedManifest;
|
|
8496
8617
|
};
|
|
8497
|
-
const getVersionedImplementationId = async (
|
|
8618
|
+
const getVersionedImplementationId = async ({
|
|
8619
|
+
appKey,
|
|
8620
|
+
api
|
|
8621
|
+
}) => {
|
|
8498
8622
|
const resolvedApps = await resolveAppKeys({
|
|
8499
8623
|
appKeys: [appKey],
|
|
8500
8624
|
api,
|
|
@@ -8504,14 +8628,14 @@ var manifestPlugin = defineProperty({
|
|
|
8504
8628
|
if (!resolvedApp) return null;
|
|
8505
8629
|
return `${resolvedApp.implementationName}@${resolvedApp.version || "latest"}`;
|
|
8506
8630
|
};
|
|
8507
|
-
const updateManifestEntry = async (
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
|
|
8512
|
-
|
|
8513
|
-
|
|
8514
|
-
|
|
8631
|
+
const updateManifestEntry = async ({
|
|
8632
|
+
api,
|
|
8633
|
+
appKey,
|
|
8634
|
+
entry,
|
|
8635
|
+
configPath = DEFAULT_CONFIG_PATH,
|
|
8636
|
+
skipWrite = false,
|
|
8637
|
+
manifest: inputManifest
|
|
8638
|
+
}) => {
|
|
8515
8639
|
const manifest2 = inputManifest || await readManifestFromFile(configPath) || { apps: {} };
|
|
8516
8640
|
let existingEntry = findManifestEntry({
|
|
8517
8641
|
appKey,
|
|
@@ -8562,7 +8686,7 @@ var manifestPlugin = defineProperty({
|
|
|
8562
8686
|
};
|
|
8563
8687
|
return {
|
|
8564
8688
|
getVersionedImplementationId,
|
|
8565
|
-
resolveAppKeys: async ({ appKeys }) => resolveAppKeys({
|
|
8689
|
+
resolveAppKeys: async ({ appKeys, api }) => resolveAppKeys({
|
|
8566
8690
|
appKeys,
|
|
8567
8691
|
api,
|
|
8568
8692
|
manifest: await getResolvedManifest() ?? { apps: {} }
|
|
@@ -8575,7 +8699,19 @@ var manifestPlugin = defineProperty({
|
|
|
8575
8699
|
updateManifestEntry
|
|
8576
8700
|
};
|
|
8577
8701
|
},
|
|
8578
|
-
|
|
8702
|
+
// Bind the reading call's API client onto the slug-resolving entry points so
|
|
8703
|
+
// their requests carry that call's correlation id. The manifest-only reads pass
|
|
8704
|
+
// straight through.
|
|
8705
|
+
get: ({ imports, state }) => {
|
|
8706
|
+
const api = imports.api;
|
|
8707
|
+
return {
|
|
8708
|
+
getVersionedImplementationId: (appKey) => state.getVersionedImplementationId({ appKey, api }),
|
|
8709
|
+
resolveAppKeys: ({ appKeys }) => state.resolveAppKeys({ appKeys, api }),
|
|
8710
|
+
getResolvedManifest: state.getResolvedManifest,
|
|
8711
|
+
getManifestConnections: state.getManifestConnections,
|
|
8712
|
+
updateManifestEntry: (options) => state.updateManifestEntry({ ...options, api })
|
|
8713
|
+
};
|
|
8714
|
+
}
|
|
8579
8715
|
});
|
|
8580
8716
|
|
|
8581
8717
|
// src/plugins/connections/index.ts
|
|
@@ -11864,14 +12000,24 @@ var ListConnectionsQuerySchema = connections.ListConnectionsQuerySchema.omit({
|
|
|
11864
12000
|
includeShared: zod.z.boolean().optional().describe(
|
|
11865
12001
|
"Include connections shared with you. By default, only your own connections are returned (owner=me). Set to true to also include shared connections."
|
|
11866
12002
|
),
|
|
11867
|
-
|
|
12003
|
+
// Filters on connection expiry. Not a mirror of a server-side status
|
|
12004
|
+
// field: the API expresses this as the is_expired filter, which we send as
|
|
12005
|
+
// false for "active", true for "expired", and omit for "all".
|
|
12006
|
+
status: zod.z.enum(["active", "expired", "all"]).optional().describe(
|
|
12007
|
+
"Filter connections by expiry: 'active' (default) returns only non-expired connections, 'expired' only expired ones, and 'all' returns both."
|
|
12008
|
+
),
|
|
12009
|
+
/** @deprecated Use `status` instead */
|
|
11868
12010
|
isExpired: zod.z.boolean().optional().describe("Filter by expired status").meta({
|
|
11869
12011
|
deprecated: true,
|
|
11870
|
-
deprecationMessage: "Use --expired instead to show only expired connections."
|
|
12012
|
+
deprecationMessage: "Use --status expired instead to show only expired connections, or --status all for both."
|
|
11871
12013
|
}),
|
|
12014
|
+
/** @deprecated Use `status` instead */
|
|
11872
12015
|
expired: zod.z.boolean().optional().describe(
|
|
11873
12016
|
"Show only expired connections (default: only non-expired connections are returned)"
|
|
11874
|
-
)
|
|
12017
|
+
).meta({
|
|
12018
|
+
deprecated: true,
|
|
12019
|
+
deprecationMessage: "Use --status expired instead to show only expired connections, or --status all for both."
|
|
12020
|
+
}),
|
|
11875
12021
|
// Override pageSize to make optional
|
|
11876
12022
|
pageSize: zod.z.number().min(1).optional().describe("Number of connections per page"),
|
|
11877
12023
|
// SDK specific property for pagination/iterable helpers
|
|
@@ -11997,10 +12143,15 @@ var listConnectionsPlugin = defineMethod({
|
|
|
11997
12143
|
if (owner) {
|
|
11998
12144
|
searchParams.owner = owner;
|
|
11999
12145
|
}
|
|
12000
|
-
|
|
12001
|
-
|
|
12002
|
-
|
|
12003
|
-
|
|
12146
|
+
const expiredFilter = input.isExpired ?? input.expired;
|
|
12147
|
+
if (input.status !== void 0 && expiredFilter !== void 0) {
|
|
12148
|
+
throw new ZapierValidationError(
|
|
12149
|
+
'The "status" option replaces "expired" and "isExpired", so it cannot be combined with either.'
|
|
12150
|
+
);
|
|
12151
|
+
}
|
|
12152
|
+
const status = input.status ?? (expiredFilter ? "expired" : "active");
|
|
12153
|
+
if (status !== "all") {
|
|
12154
|
+
searchParams.is_expired = (status === "expired").toString();
|
|
12004
12155
|
}
|
|
12005
12156
|
if (input.cursor) {
|
|
12006
12157
|
searchParams.offset = input.cursor;
|
|
@@ -15661,6 +15812,7 @@ function buildErrorEventWithContext(data, context = {}) {
|
|
|
15661
15812
|
function buildMethodCalledEvent(data, context = {}) {
|
|
15662
15813
|
return {
|
|
15663
15814
|
...createBaseEvent(context),
|
|
15815
|
+
correlation_id: data.correlation_id ?? context.correlation_id ?? null,
|
|
15664
15816
|
method_name: data.method_name ?? null,
|
|
15665
15817
|
method_module: data.method_module ?? null,
|
|
15666
15818
|
execution_duration_ms: data.execution_duration_ms,
|
|
@@ -15718,6 +15870,7 @@ function makeMethodEndHook(emitMethodCalled) {
|
|
|
15718
15870
|
args,
|
|
15719
15871
|
isPaginated,
|
|
15720
15872
|
depth,
|
|
15873
|
+
callId,
|
|
15721
15874
|
callOrigin,
|
|
15722
15875
|
annotations,
|
|
15723
15876
|
durationMs,
|
|
@@ -15727,6 +15880,9 @@ function makeMethodEndHook(emitMethodCalled) {
|
|
|
15727
15880
|
const metadata = readMethodMetadata(annotations);
|
|
15728
15881
|
emitMethodCalled({
|
|
15729
15882
|
method_name: methodName,
|
|
15883
|
+
// The per-call correlation id (also the `zapier-correlation-id` header on
|
|
15884
|
+
// this call's requests). Not the `call_context` surface label.
|
|
15885
|
+
correlation_id: callId ?? null,
|
|
15730
15886
|
execution_duration_ms: durationMs,
|
|
15731
15887
|
success_flag: !error,
|
|
15732
15888
|
error_message: error?.message ?? null,
|