@zapier/zapier-sdk 0.78.0 → 0.80.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/experimental.cjs +1232 -227
- package/dist/experimental.d.mts +2 -2
- package/dist/experimental.d.ts +2 -2
- package/dist/experimental.mjs +1226 -228
- package/dist/{index-BgbftweS.d.mts → index-Dpl8IaV9.d.mts} +647 -62
- package/dist/{index-BgbftweS.d.ts → index-Dpl8IaV9.d.ts} +647 -62
- package/dist/index.cjs +1226 -221
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1220 -222
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -51,18 +51,20 @@ function buildRegistry({
|
|
|
51
51
|
sdk,
|
|
52
52
|
meta,
|
|
53
53
|
formatters,
|
|
54
|
+
boundResolvers,
|
|
55
|
+
positional,
|
|
54
56
|
packageFilter
|
|
55
57
|
}) {
|
|
56
58
|
const definitionsByKey = /* @__PURE__ */ new Map();
|
|
57
59
|
const objectDeclaredKeys = /* @__PURE__ */ new Set();
|
|
58
60
|
for (const m of Object.values(meta)) {
|
|
59
61
|
for (const ref of m.categories ?? []) {
|
|
60
|
-
const
|
|
62
|
+
const key2 = typeof ref === "string" ? ref : ref.key;
|
|
61
63
|
if (typeof ref === "object") {
|
|
62
|
-
objectDeclaredKeys.add(
|
|
63
|
-
definitionsByKey.set(
|
|
64
|
-
} else if (!objectDeclaredKeys.has(
|
|
65
|
-
definitionsByKey.set(
|
|
64
|
+
objectDeclaredKeys.add(key2);
|
|
65
|
+
definitionsByKey.set(key2, resolveCategoryDefinition(ref));
|
|
66
|
+
} else if (!objectDeclaredKeys.has(key2)) {
|
|
67
|
+
definitionsByKey.set(key2, resolveCategoryDefinition(ref));
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
70
|
}
|
|
@@ -70,16 +72,16 @@ function buildRegistry({
|
|
|
70
72
|
definitionsByKey.set("other", resolveCategoryDefinition("other"));
|
|
71
73
|
}
|
|
72
74
|
const knownCategories = Array.from(definitionsByKey.keys());
|
|
73
|
-
const functions = Object.keys(meta).filter((
|
|
74
|
-
const property = sdk[
|
|
75
|
+
const functions = Object.keys(meta).filter((key2) => {
|
|
76
|
+
const property = sdk[key2];
|
|
75
77
|
if (typeof property === "function") return true;
|
|
76
|
-
const [rootKey] =
|
|
78
|
+
const [rootKey] = key2.split(".");
|
|
77
79
|
const rootProperty = sdk[rootKey];
|
|
78
80
|
return typeof rootProperty === "object" && rootProperty !== null;
|
|
79
|
-
}).map((
|
|
80
|
-
const m = meta[
|
|
81
|
+
}).map((key2) => {
|
|
82
|
+
const m = meta[key2];
|
|
81
83
|
return {
|
|
82
|
-
name:
|
|
84
|
+
name: key2,
|
|
83
85
|
description: m.description,
|
|
84
86
|
type: m.type,
|
|
85
87
|
itemType: m.itemType,
|
|
@@ -87,11 +89,13 @@ function buildRegistry({
|
|
|
87
89
|
inputSchema: canonicalInputSchema(m.inputSchema),
|
|
88
90
|
inputParameters: m.inputParameters,
|
|
89
91
|
outputSchema: m.outputSchema,
|
|
92
|
+
positional: positional?.[key2],
|
|
90
93
|
categories: (m.categories ?? []).map(
|
|
91
94
|
(c) => typeof c === "string" ? c : c.key
|
|
92
95
|
),
|
|
93
96
|
resolvers: m.resolvers,
|
|
94
|
-
|
|
97
|
+
boundResolvers: boundResolvers?.[key2],
|
|
98
|
+
formatter: formatters?.[key2],
|
|
95
99
|
experimental: m.experimental,
|
|
96
100
|
packages: m.packages,
|
|
97
101
|
confirm: m.confirm ?? (m.type === "delete" ? "delete" : void 0),
|
|
@@ -129,8 +133,8 @@ function composeVoid(existing, added) {
|
|
|
129
133
|
}
|
|
130
134
|
function buildHooks(existing, added) {
|
|
131
135
|
const result = {};
|
|
132
|
-
const
|
|
133
|
-
if (
|
|
136
|
+
const start2 = composeVoid(existing.onMethodStart, added.onMethodStart);
|
|
137
|
+
if (start2) result.onMethodStart = start2;
|
|
134
138
|
const end = composeVoid(existing.onMethodEnd, added.onMethodEnd);
|
|
135
139
|
if (end) result.onMethodEnd = end;
|
|
136
140
|
return result;
|
|
@@ -763,11 +767,11 @@ var RESERVED_ROOT_KEYS = /* @__PURE__ */ new Set([
|
|
|
763
767
|
"context",
|
|
764
768
|
"getRegistry"
|
|
765
769
|
]);
|
|
766
|
-
function hasOwn(obj,
|
|
767
|
-
return Object.prototype.hasOwnProperty.call(obj,
|
|
770
|
+
function hasOwn(obj, key2) {
|
|
771
|
+
return Object.prototype.hasOwnProperty.call(obj, key2);
|
|
768
772
|
}
|
|
769
|
-
function setOwn(target,
|
|
770
|
-
Object.defineProperty(target,
|
|
773
|
+
function setOwn(target, key2, value) {
|
|
774
|
+
Object.defineProperty(target, key2, {
|
|
771
775
|
value,
|
|
772
776
|
enumerable: true,
|
|
773
777
|
configurable: true,
|
|
@@ -779,31 +783,31 @@ function checkCollisions(target, source, kind, callerLabel, override) {
|
|
|
779
783
|
checkRootKeyCollisions(target, Object.keys(source), override, callerLabel);
|
|
780
784
|
return;
|
|
781
785
|
}
|
|
782
|
-
for (const
|
|
783
|
-
if (!override && hasOwn(target,
|
|
786
|
+
for (const key2 of Object.keys(source)) {
|
|
787
|
+
if (!override && hasOwn(target, key2)) {
|
|
784
788
|
throw new Error(
|
|
785
|
-
`${callerLabel}: duplicate ${kind} "${
|
|
789
|
+
`${callerLabel}: duplicate ${kind} "${key2}". If the override is intentional, pass { override: true } in the options.`
|
|
786
790
|
);
|
|
787
791
|
}
|
|
788
792
|
}
|
|
789
793
|
}
|
|
790
794
|
function checkRootKeyCollisions(target, keys, override, callerLabel) {
|
|
791
|
-
for (const
|
|
792
|
-
if (RESERVED_ROOT_KEYS.has(
|
|
795
|
+
for (const key2 of keys) {
|
|
796
|
+
if (RESERVED_ROOT_KEYS.has(key2)) {
|
|
793
797
|
throw new Error(
|
|
794
|
-
`${callerLabel}: plugin attempted to register reserved root key "${
|
|
798
|
+
`${callerLabel}: plugin attempted to register reserved root key "${key2}". The SDK uses this key for its own accessor; rename the plugin's method.`
|
|
795
799
|
);
|
|
796
800
|
}
|
|
797
|
-
if (!override && hasOwn(target,
|
|
801
|
+
if (!override && hasOwn(target, key2)) {
|
|
798
802
|
throw new Error(
|
|
799
|
-
`${callerLabel}: duplicate root key "${
|
|
803
|
+
`${callerLabel}: duplicate root key "${key2}". If the override is intentional, pass { override: true } in the options.`
|
|
800
804
|
);
|
|
801
805
|
}
|
|
802
806
|
}
|
|
803
807
|
}
|
|
804
808
|
function applyOwnProperties(target, source) {
|
|
805
|
-
for (const
|
|
806
|
-
setOwn(target,
|
|
809
|
+
for (const key2 of Object.keys(source)) {
|
|
810
|
+
setOwn(target, key2, source[key2]);
|
|
807
811
|
}
|
|
808
812
|
}
|
|
809
813
|
function createPluginAccumulator(initialProperties = {}, initialContext = {}) {
|
|
@@ -1051,8 +1055,8 @@ function normalizeImports(deps) {
|
|
|
1051
1055
|
}
|
|
1052
1056
|
function collectLeafMeta(config) {
|
|
1053
1057
|
let meta;
|
|
1054
|
-
for (const
|
|
1055
|
-
if (config[
|
|
1058
|
+
for (const key2 of LEAF_META_KEYS) {
|
|
1059
|
+
if (config[key2] !== void 0) (meta ?? (meta = {}))[key2] = config[key2];
|
|
1056
1060
|
}
|
|
1057
1061
|
return meta;
|
|
1058
1062
|
}
|
|
@@ -1075,12 +1079,66 @@ function defineMethod(config) {
|
|
|
1075
1079
|
run: config.run
|
|
1076
1080
|
};
|
|
1077
1081
|
}
|
|
1082
|
+
function defineResolver(config) {
|
|
1083
|
+
const deps = normalizeImports(config.imports);
|
|
1084
|
+
const base = { imports: deps.plugins, importBindings: deps.bindings };
|
|
1085
|
+
const gates = {
|
|
1086
|
+
requireParameters: config.requireParameters
|
|
1087
|
+
};
|
|
1088
|
+
switch (config.type) {
|
|
1089
|
+
case "static":
|
|
1090
|
+
return {
|
|
1091
|
+
...base,
|
|
1092
|
+
...gates,
|
|
1093
|
+
type: "static",
|
|
1094
|
+
inputType: config.inputType,
|
|
1095
|
+
placeholder: config.placeholder
|
|
1096
|
+
};
|
|
1097
|
+
case "constant":
|
|
1098
|
+
return { ...base, ...gates, type: "constant", value: config.value };
|
|
1099
|
+
case "info":
|
|
1100
|
+
return { ...base, type: "info", text: config.text ?? "" };
|
|
1101
|
+
case "object":
|
|
1102
|
+
return {
|
|
1103
|
+
...base,
|
|
1104
|
+
...gates,
|
|
1105
|
+
type: "object",
|
|
1106
|
+
properties: config.properties,
|
|
1107
|
+
definitions: config.definitions,
|
|
1108
|
+
getProperties: config.getProperties
|
|
1109
|
+
};
|
|
1110
|
+
case "array":
|
|
1111
|
+
return {
|
|
1112
|
+
...base,
|
|
1113
|
+
...gates,
|
|
1114
|
+
type: "array",
|
|
1115
|
+
items: config.items,
|
|
1116
|
+
minItems: config.minItems,
|
|
1117
|
+
maxItems: config.maxItems,
|
|
1118
|
+
itemValueType: config.itemValueType,
|
|
1119
|
+
definitions: config.definitions
|
|
1120
|
+
};
|
|
1121
|
+
default:
|
|
1122
|
+
return {
|
|
1123
|
+
...base,
|
|
1124
|
+
...gates,
|
|
1125
|
+
type: "dynamic",
|
|
1126
|
+
inputType: config.inputType,
|
|
1127
|
+
placeholder: config.placeholder,
|
|
1128
|
+
getContext: config.getContext,
|
|
1129
|
+
listItems: config.listItems,
|
|
1130
|
+
prompt: config.prompt,
|
|
1131
|
+
tryResolveWithoutPrompt: config.tryResolveWithoutPrompt,
|
|
1132
|
+
tryResolveFromSearch: config.tryResolveFromSearch
|
|
1133
|
+
};
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1078
1136
|
function defineFormatter(config) {
|
|
1079
1137
|
const deps = normalizeImports(config.imports);
|
|
1080
1138
|
return {
|
|
1081
1139
|
imports: deps.plugins,
|
|
1082
1140
|
importBindings: deps.bindings,
|
|
1083
|
-
|
|
1141
|
+
getContext: config.getContext,
|
|
1084
1142
|
format: config.format
|
|
1085
1143
|
};
|
|
1086
1144
|
}
|
|
@@ -1209,7 +1267,7 @@ function legacyGraphEntry(name, value, pluginMeta) {
|
|
|
1209
1267
|
function adaptLegacyFormatter(legacy, sdk) {
|
|
1210
1268
|
const legacyFetch = legacy.fetch;
|
|
1211
1269
|
return {
|
|
1212
|
-
|
|
1270
|
+
getContext: legacyFetch ? async ({ items, input, context }) => {
|
|
1213
1271
|
let ctx = context;
|
|
1214
1272
|
for (const item of items) {
|
|
1215
1273
|
ctx = await legacyFetch(sdk, input, item, ctx);
|
|
@@ -1225,6 +1283,14 @@ function normalizeFormatter(entry, sdk) {
|
|
|
1225
1283
|
const legacy = entry.meta?.formatter;
|
|
1226
1284
|
return legacy ? adaptLegacyFormatter(legacy, sdk) : void 0;
|
|
1227
1285
|
}
|
|
1286
|
+
function normalizeBoundResolvers(entry) {
|
|
1287
|
+
if (entry.pluginType !== "method") return void 0;
|
|
1288
|
+
return entry.resolvers;
|
|
1289
|
+
}
|
|
1290
|
+
function methodPositional(entry) {
|
|
1291
|
+
if (entry.pluginType !== "method") return void 0;
|
|
1292
|
+
return entry.positional;
|
|
1293
|
+
}
|
|
1228
1294
|
function pluginEntryMeta(entry) {
|
|
1229
1295
|
if (entry.pluginType === "method" && entry.meta) {
|
|
1230
1296
|
return entry.inputSchema ? { ...entry.meta, inputSchema: entry.inputSchema } : entry.meta;
|
|
@@ -1245,11 +1311,24 @@ function buildSurfaceRegistry(context, packageFilter) {
|
|
|
1245
1311
|
if (m) meta[binding] = m;
|
|
1246
1312
|
}
|
|
1247
1313
|
const formatters = {};
|
|
1314
|
+
const boundResolvers = {};
|
|
1315
|
+
const positional = {};
|
|
1248
1316
|
for (const [binding, entry] of Object.entries(entries)) {
|
|
1249
1317
|
const f = normalizeFormatter(entry, surface);
|
|
1250
1318
|
if (f) formatters[binding] = f;
|
|
1251
|
-
|
|
1252
|
-
|
|
1319
|
+
const r = normalizeBoundResolvers(entry);
|
|
1320
|
+
if (r) boundResolvers[binding] = r;
|
|
1321
|
+
const p = methodPositional(entry);
|
|
1322
|
+
if (p) positional[binding] = p;
|
|
1323
|
+
}
|
|
1324
|
+
return buildRegistry({
|
|
1325
|
+
sdk: surface,
|
|
1326
|
+
meta,
|
|
1327
|
+
formatters,
|
|
1328
|
+
boundResolvers,
|
|
1329
|
+
positional,
|
|
1330
|
+
packageFilter
|
|
1331
|
+
});
|
|
1253
1332
|
}
|
|
1254
1333
|
var dangerousContextPlugin = {
|
|
1255
1334
|
pluginType: "property",
|
|
@@ -1366,15 +1445,15 @@ function collectPlugins(root, materialized = /* @__PURE__ */ new Set()) {
|
|
|
1366
1445
|
}
|
|
1367
1446
|
return byId;
|
|
1368
1447
|
}
|
|
1369
|
-
function bindValue(target,
|
|
1448
|
+
function bindValue(target, key2, entry) {
|
|
1370
1449
|
if (entry.pluginType === "property" && entry.getValue) {
|
|
1371
|
-
Object.defineProperty(target,
|
|
1450
|
+
Object.defineProperty(target, key2, {
|
|
1372
1451
|
get: entry.getValue,
|
|
1373
1452
|
enumerable: true,
|
|
1374
1453
|
configurable: true
|
|
1375
1454
|
});
|
|
1376
1455
|
} else {
|
|
1377
|
-
Object.defineProperty(target,
|
|
1456
|
+
Object.defineProperty(target, key2, {
|
|
1378
1457
|
value: entry.value,
|
|
1379
1458
|
writable: true,
|
|
1380
1459
|
enumerable: true,
|
|
@@ -1426,8 +1505,7 @@ function bindResolver(resolver, plugins) {
|
|
|
1426
1505
|
case "static":
|
|
1427
1506
|
return {
|
|
1428
1507
|
type: "static",
|
|
1429
|
-
|
|
1430
|
-
requireCapabilities: resolver.requireCapabilities,
|
|
1508
|
+
requireParameters: resolver.requireParameters,
|
|
1431
1509
|
inputType: resolver.inputType,
|
|
1432
1510
|
placeholder: resolver.placeholder
|
|
1433
1511
|
};
|
|
@@ -1435,8 +1513,7 @@ function bindResolver(resolver, plugins) {
|
|
|
1435
1513
|
return {
|
|
1436
1514
|
type: "constant",
|
|
1437
1515
|
value: resolver.value,
|
|
1438
|
-
|
|
1439
|
-
requireCapabilities: resolver.requireCapabilities
|
|
1516
|
+
requireParameters: resolver.requireParameters
|
|
1440
1517
|
};
|
|
1441
1518
|
case "info":
|
|
1442
1519
|
return { type: "info", text: resolver.text };
|
|
@@ -1444,24 +1521,24 @@ function bindResolver(resolver, plugins) {
|
|
|
1444
1521
|
const imports = buildImports(plugins, resolver.importBindings);
|
|
1445
1522
|
const bound = {
|
|
1446
1523
|
type: "object",
|
|
1447
|
-
|
|
1448
|
-
requireCapabilities: resolver.requireCapabilities
|
|
1524
|
+
requireParameters: resolver.requireParameters
|
|
1449
1525
|
};
|
|
1450
1526
|
if (resolver.properties)
|
|
1451
1527
|
bound.properties = bindFields(resolver.properties, plugins);
|
|
1452
1528
|
if (resolver.definitions)
|
|
1453
1529
|
bound.definitions = bindDefinitions(resolver.definitions, plugins);
|
|
1454
|
-
const {
|
|
1455
|
-
if (
|
|
1530
|
+
const { getProperties } = resolver;
|
|
1531
|
+
if (getProperties)
|
|
1532
|
+
bound.getProperties = ({ input }) => getProperties({ imports, input });
|
|
1456
1533
|
return bound;
|
|
1457
1534
|
}
|
|
1458
1535
|
case "array": {
|
|
1459
1536
|
const bound = {
|
|
1460
1537
|
type: "array",
|
|
1461
|
-
|
|
1462
|
-
requireCapabilities: resolver.requireCapabilities,
|
|
1538
|
+
requireParameters: resolver.requireParameters,
|
|
1463
1539
|
minItems: resolver.minItems,
|
|
1464
1540
|
maxItems: resolver.maxItems,
|
|
1541
|
+
itemValueType: resolver.itemValueType,
|
|
1465
1542
|
items: isResolverRef(resolver.items) ? resolver.items : bindResolver(resolver.items, plugins)
|
|
1466
1543
|
};
|
|
1467
1544
|
if (resolver.definitions)
|
|
@@ -1472,17 +1549,26 @@ function bindResolver(resolver, plugins) {
|
|
|
1472
1549
|
const imports = buildImports(plugins, resolver.importBindings);
|
|
1473
1550
|
const bound = {
|
|
1474
1551
|
type: "dynamic",
|
|
1475
|
-
|
|
1476
|
-
requireCapabilities: resolver.requireCapabilities,
|
|
1552
|
+
requireParameters: resolver.requireParameters,
|
|
1477
1553
|
inputType: resolver.inputType,
|
|
1478
1554
|
placeholder: resolver.placeholder,
|
|
1479
1555
|
prompt: resolver.prompt
|
|
1480
1556
|
};
|
|
1481
|
-
const {
|
|
1482
|
-
|
|
1483
|
-
|
|
1557
|
+
const {
|
|
1558
|
+
getContext: getContext2,
|
|
1559
|
+
listItems,
|
|
1560
|
+
tryResolveWithoutPrompt,
|
|
1561
|
+
tryResolveFromSearch
|
|
1562
|
+
} = resolver;
|
|
1563
|
+
if (getContext2)
|
|
1564
|
+
bound.getContext = ({ input }) => getContext2({ imports, input });
|
|
1565
|
+
if (listItems)
|
|
1566
|
+
bound.listItems = ({ input, context, search, cursor }) => listItems({ imports, input, context, search, cursor });
|
|
1484
1567
|
if (tryResolveWithoutPrompt) {
|
|
1485
|
-
bound.tryResolveWithoutPrompt = ({
|
|
1568
|
+
bound.tryResolveWithoutPrompt = ({ input }) => tryResolveWithoutPrompt({ imports, input });
|
|
1569
|
+
}
|
|
1570
|
+
if (tryResolveFromSearch) {
|
|
1571
|
+
bound.tryResolveFromSearch = ({ input, search }) => tryResolveFromSearch({ imports, input, search });
|
|
1486
1572
|
}
|
|
1487
1573
|
return bound;
|
|
1488
1574
|
}
|
|
@@ -1490,8 +1576,8 @@ function bindResolver(resolver, plugins) {
|
|
|
1490
1576
|
}
|
|
1491
1577
|
function bindFields(fields, plugins) {
|
|
1492
1578
|
const out = {};
|
|
1493
|
-
for (const [
|
|
1494
|
-
out[
|
|
1579
|
+
for (const [key2, field] of Object.entries(fields)) {
|
|
1580
|
+
out[key2] = {
|
|
1495
1581
|
...field,
|
|
1496
1582
|
resolver: isResolverRef(field.resolver) ? field.resolver : bindResolver(field.resolver, plugins)
|
|
1497
1583
|
};
|
|
@@ -1500,17 +1586,17 @@ function bindFields(fields, plugins) {
|
|
|
1500
1586
|
}
|
|
1501
1587
|
function bindDefinitions(definitions, plugins) {
|
|
1502
1588
|
const out = {};
|
|
1503
|
-
for (const [
|
|
1504
|
-
out[
|
|
1589
|
+
for (const [key2, def] of Object.entries(definitions)) {
|
|
1590
|
+
out[key2] = bindResolver(def, plugins);
|
|
1505
1591
|
}
|
|
1506
1592
|
return out;
|
|
1507
1593
|
}
|
|
1508
1594
|
function bindFormatter(formatter, plugins) {
|
|
1509
1595
|
const imports = buildImports(plugins, formatter.importBindings);
|
|
1510
1596
|
const bound = { format: formatter.format };
|
|
1511
|
-
const {
|
|
1512
|
-
if (
|
|
1513
|
-
bound.
|
|
1597
|
+
const { getContext: getContext2 } = formatter;
|
|
1598
|
+
if (getContext2)
|
|
1599
|
+
bound.getContext = ({ items, input, context }) => getContext2({ imports, items, input, context });
|
|
1514
1600
|
return bound;
|
|
1515
1601
|
}
|
|
1516
1602
|
function bindAttachments(descriptors, context) {
|
|
@@ -1558,6 +1644,7 @@ function runLegacyPass(descriptors, context) {
|
|
|
1558
1644
|
const sdk = this ?? exports;
|
|
1559
1645
|
const meta2 = {};
|
|
1560
1646
|
const formatters = {};
|
|
1647
|
+
const boundResolvers = {};
|
|
1561
1648
|
for (const [binding, id2] of Object.entries(context.surface)) {
|
|
1562
1649
|
const entry = context.plugins[id2];
|
|
1563
1650
|
if (!entry || entry.pluginType === "aggregate") continue;
|
|
@@ -1565,12 +1652,15 @@ function runLegacyPass(descriptors, context) {
|
|
|
1565
1652
|
if (m) meta2[binding] = m;
|
|
1566
1653
|
const f = normalizeFormatter(entry, sdk);
|
|
1567
1654
|
if (f) formatters[binding] = f;
|
|
1655
|
+
const r = normalizeBoundResolvers(entry);
|
|
1656
|
+
if (r) boundResolvers[binding] = r;
|
|
1568
1657
|
}
|
|
1569
1658
|
Object.assign(meta2, context.meta);
|
|
1570
1659
|
return buildRegistry({
|
|
1571
1660
|
sdk,
|
|
1572
1661
|
meta: meta2,
|
|
1573
1662
|
formatters,
|
|
1663
|
+
boundResolvers,
|
|
1574
1664
|
packageFilter: options?.package
|
|
1575
1665
|
});
|
|
1576
1666
|
};
|
|
@@ -1786,7 +1876,7 @@ function createSdk(root) {
|
|
|
1786
1876
|
pluginSurface = {};
|
|
1787
1877
|
bindValue(pluginSurface, plugin.name, plugins2[plugin.id]);
|
|
1788
1878
|
}
|
|
1789
|
-
for (const
|
|
1879
|
+
for (const key2 of Object.keys(legacyExports)) context.surface[key2] = key2;
|
|
1790
1880
|
if (plugin.pluginType === "aggregate") {
|
|
1791
1881
|
recordExportSurface(context, plugin.exports);
|
|
1792
1882
|
} else {
|
|
@@ -1856,6 +1946,756 @@ function addPlugin(sdk, plugin, options) {
|
|
|
1856
1946
|
options ?? {}
|
|
1857
1947
|
);
|
|
1858
1948
|
}
|
|
1949
|
+
var CORE_SIGNAL_SYMBOL = Symbol.for("kitcore.signal");
|
|
1950
|
+
var CoreSignal = class extends Error {
|
|
1951
|
+
constructor(message) {
|
|
1952
|
+
super(message);
|
|
1953
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
1954
|
+
Object.defineProperty(this, CORE_SIGNAL_SYMBOL, {
|
|
1955
|
+
value: true,
|
|
1956
|
+
enumerable: false,
|
|
1957
|
+
configurable: true,
|
|
1958
|
+
writable: false
|
|
1959
|
+
});
|
|
1960
|
+
}
|
|
1961
|
+
};
|
|
1962
|
+
function isCoreSignal(value) {
|
|
1963
|
+
return Boolean(
|
|
1964
|
+
value && typeof value === "object" && value[CORE_SIGNAL_SYMBOL] === true
|
|
1965
|
+
);
|
|
1966
|
+
}
|
|
1967
|
+
var CoreCancelledSignal = class extends CoreSignal {
|
|
1968
|
+
constructor(message = "resolution cancelled") {
|
|
1969
|
+
super(message);
|
|
1970
|
+
this.name = "CoreCancelledSignal";
|
|
1971
|
+
this.code = "CANCELLED";
|
|
1972
|
+
}
|
|
1973
|
+
};
|
|
1974
|
+
function unwrap(schema) {
|
|
1975
|
+
let inner = schema;
|
|
1976
|
+
let required = true;
|
|
1977
|
+
for (; ; ) {
|
|
1978
|
+
if (inner instanceof z.ZodOptional) {
|
|
1979
|
+
required = false;
|
|
1980
|
+
inner = inner._zod.def.innerType;
|
|
1981
|
+
} else if (inner instanceof z.ZodDefault) {
|
|
1982
|
+
required = false;
|
|
1983
|
+
inner = inner._zod.def.innerType;
|
|
1984
|
+
} else if (inner instanceof z.ZodNullable) {
|
|
1985
|
+
inner = inner._zod.def.innerType;
|
|
1986
|
+
} else {
|
|
1987
|
+
break;
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
return { inner, required };
|
|
1991
|
+
}
|
|
1992
|
+
function valueTypeOf(inner) {
|
|
1993
|
+
if (inner instanceof z.ZodString) return "string";
|
|
1994
|
+
if (inner instanceof z.ZodNumber) return "number";
|
|
1995
|
+
if (inner instanceof z.ZodBoolean) return "boolean";
|
|
1996
|
+
if (inner instanceof z.ZodEnum) return "string";
|
|
1997
|
+
if (inner instanceof z.ZodArray) return "array";
|
|
1998
|
+
if (inner instanceof z.ZodObject) return "object";
|
|
1999
|
+
return void 0;
|
|
2000
|
+
}
|
|
2001
|
+
function staticChoicesOf(inner) {
|
|
2002
|
+
if (inner instanceof z.ZodEnum) {
|
|
2003
|
+
const values = inner.options;
|
|
2004
|
+
return values.map((value) => ({ label: value, value }));
|
|
2005
|
+
}
|
|
2006
|
+
return void 0;
|
|
2007
|
+
}
|
|
2008
|
+
function objectShape(schema) {
|
|
2009
|
+
const { inner } = schema ? unwrap(schema) : { inner: void 0 };
|
|
2010
|
+
if (inner instanceof z.ZodObject) {
|
|
2011
|
+
return inner.shape;
|
|
2012
|
+
}
|
|
2013
|
+
return void 0;
|
|
2014
|
+
}
|
|
2015
|
+
function topoOrder2(specs) {
|
|
2016
|
+
const byName = new Map(specs.map((s) => [s.name, s]));
|
|
2017
|
+
const ordered = [];
|
|
2018
|
+
const placed = /* @__PURE__ */ new Set();
|
|
2019
|
+
let progressed = true;
|
|
2020
|
+
while (ordered.length < specs.length && progressed) {
|
|
2021
|
+
progressed = false;
|
|
2022
|
+
for (const spec of specs) {
|
|
2023
|
+
if (placed.has(spec.name)) continue;
|
|
2024
|
+
const ready = spec.requires.every((r) => !byName.has(r) || placed.has(r));
|
|
2025
|
+
if (ready) {
|
|
2026
|
+
ordered.push(spec);
|
|
2027
|
+
placed.add(spec.name);
|
|
2028
|
+
progressed = true;
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
}
|
|
2032
|
+
for (const spec of specs) if (!placed.has(spec.name)) ordered.push(spec);
|
|
2033
|
+
return ordered;
|
|
2034
|
+
}
|
|
2035
|
+
function planParameters(entry) {
|
|
2036
|
+
const shape = objectShape(entry.inputSchema);
|
|
2037
|
+
const resolvers = entry.boundResolvers ?? {};
|
|
2038
|
+
const names = shape ? Object.keys(shape) : Object.keys(resolvers);
|
|
2039
|
+
const specs = names.map((name) => {
|
|
2040
|
+
const field = shape?.[name];
|
|
2041
|
+
const { inner, required } = field ? unwrap(field) : { inner: void 0, required: false };
|
|
2042
|
+
const resolver = resolvers[name];
|
|
2043
|
+
return {
|
|
2044
|
+
name,
|
|
2045
|
+
required,
|
|
2046
|
+
valueType: inner ? valueTypeOf(inner) : void 0,
|
|
2047
|
+
staticChoices: inner ? staticChoicesOf(inner) : void 0,
|
|
2048
|
+
resolver,
|
|
2049
|
+
requires: resolver?.requireParameters ?? []
|
|
2050
|
+
};
|
|
2051
|
+
});
|
|
2052
|
+
return { parameters: topoOrder2(specs) };
|
|
2053
|
+
}
|
|
2054
|
+
function getAtPath(root, path) {
|
|
2055
|
+
let node = root;
|
|
2056
|
+
for (const seg of path) {
|
|
2057
|
+
if (node == null || typeof node !== "object") return void 0;
|
|
2058
|
+
node = node[seg];
|
|
2059
|
+
}
|
|
2060
|
+
return node;
|
|
2061
|
+
}
|
|
2062
|
+
function setAtPath(root, path, value) {
|
|
2063
|
+
let node = root;
|
|
2064
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
2065
|
+
const seg = path[i];
|
|
2066
|
+
if (node[seg] == null || typeof node[seg] !== "object") node[seg] = {};
|
|
2067
|
+
node = node[seg];
|
|
2068
|
+
}
|
|
2069
|
+
node[path[path.length - 1]] = value;
|
|
2070
|
+
}
|
|
2071
|
+
var key = (path) => path.join(".");
|
|
2072
|
+
function isSettled(state, path) {
|
|
2073
|
+
return state.settled.includes(key(path));
|
|
2074
|
+
}
|
|
2075
|
+
function settle(state, path) {
|
|
2076
|
+
const k = key(path);
|
|
2077
|
+
if (!state.settled.includes(k)) state.settled.push(k);
|
|
2078
|
+
}
|
|
2079
|
+
function clone(state) {
|
|
2080
|
+
return JSON.parse(JSON.stringify(state));
|
|
2081
|
+
}
|
|
2082
|
+
function coerce(leaf, raw) {
|
|
2083
|
+
if (typeof raw !== "string") return raw;
|
|
2084
|
+
if (leaf.valueType === "number") {
|
|
2085
|
+
const n = Number(raw);
|
|
2086
|
+
return raw.trim() !== "" && !Number.isNaN(n) ? n : raw;
|
|
2087
|
+
}
|
|
2088
|
+
if (leaf.valueType === "boolean") {
|
|
2089
|
+
if (raw === "true") return true;
|
|
2090
|
+
if (raw === "false") return false;
|
|
2091
|
+
}
|
|
2092
|
+
return raw;
|
|
2093
|
+
}
|
|
2094
|
+
async function validationError(leaf, value, state) {
|
|
2095
|
+
const context = await resolveContext(leaf, state.resolved);
|
|
2096
|
+
const config = leaf.resolver?.prompt?.({
|
|
2097
|
+
items: state.listing?.items ?? [],
|
|
2098
|
+
input: mergeInput(state.resolved, leaf.extraInput),
|
|
2099
|
+
context
|
|
2100
|
+
});
|
|
2101
|
+
if (!config?.validate) return null;
|
|
2102
|
+
const verdict = config.validate(value);
|
|
2103
|
+
if (verdict === true) return null;
|
|
2104
|
+
return typeof verdict === "string" ? verdict : `${leaf.name}: invalid value`;
|
|
2105
|
+
}
|
|
2106
|
+
function toChoice(c) {
|
|
2107
|
+
const label = "label" in c ? c.label : c.name;
|
|
2108
|
+
const hint = Array.isArray(c.hint) ? c.hint.join(", ") : c.hint;
|
|
2109
|
+
return { label, value: String(c.value), hint };
|
|
2110
|
+
}
|
|
2111
|
+
function isRef(r) {
|
|
2112
|
+
return typeof r === "object" && r !== null && "ref" in r;
|
|
2113
|
+
}
|
|
2114
|
+
function toLeaf(name, field, definitions) {
|
|
2115
|
+
let resolver;
|
|
2116
|
+
let extraInput;
|
|
2117
|
+
if (isRef(field.resolver)) {
|
|
2118
|
+
resolver = definitions?.[field.resolver.ref];
|
|
2119
|
+
extraInput = field.resolver.input;
|
|
2120
|
+
} else {
|
|
2121
|
+
resolver = field.resolver;
|
|
2122
|
+
}
|
|
2123
|
+
return {
|
|
2124
|
+
name,
|
|
2125
|
+
required: field.required ?? false,
|
|
2126
|
+
resolver,
|
|
2127
|
+
extraInput,
|
|
2128
|
+
// Carry the field's value type so nested answers coerce (number/boolean)
|
|
2129
|
+
// the same way top-level params do. Without this a nested `z.number()`
|
|
2130
|
+
// field's typed answer stays a string and fails final validation.
|
|
2131
|
+
valueType: field.valueType,
|
|
2132
|
+
requires: resolver?.requireParameters ?? []
|
|
2133
|
+
};
|
|
2134
|
+
}
|
|
2135
|
+
async function objectChildren(resolver, input) {
|
|
2136
|
+
if (resolver.properties) {
|
|
2137
|
+
return Object.entries(resolver.properties).map(
|
|
2138
|
+
([name, field]) => toLeaf(name, field, resolver.definitions)
|
|
2139
|
+
);
|
|
2140
|
+
}
|
|
2141
|
+
if (!resolver.getProperties) return [];
|
|
2142
|
+
const fields = await resolver.getProperties({ input });
|
|
2143
|
+
return Object.entries(fields).map(([name, field]) => {
|
|
2144
|
+
if (!isRef(field.resolver) && (field.resolver.imports?.length ?? 0) > 0) {
|
|
2145
|
+
throw new Error(
|
|
2146
|
+
`dynamic object field "${name}" inlines an import-bearing resolver; use { ref } into the object's definitions so its imports bind`
|
|
2147
|
+
);
|
|
2148
|
+
}
|
|
2149
|
+
return toLeaf(name, field, resolver.definitions);
|
|
2150
|
+
});
|
|
2151
|
+
}
|
|
2152
|
+
function arrayItem(resolver) {
|
|
2153
|
+
const items = resolver.items;
|
|
2154
|
+
const valueType = resolver.itemValueType;
|
|
2155
|
+
if (isRef(items)) {
|
|
2156
|
+
return {
|
|
2157
|
+
name: "",
|
|
2158
|
+
required: true,
|
|
2159
|
+
resolver: resolver.definitions?.[items.ref],
|
|
2160
|
+
extraInput: items.input,
|
|
2161
|
+
valueType,
|
|
2162
|
+
requires: []
|
|
2163
|
+
};
|
|
2164
|
+
}
|
|
2165
|
+
return {
|
|
2166
|
+
name: "",
|
|
2167
|
+
required: true,
|
|
2168
|
+
resolver: items,
|
|
2169
|
+
valueType,
|
|
2170
|
+
requires: []
|
|
2171
|
+
};
|
|
2172
|
+
}
|
|
2173
|
+
function mergeInput(input, extra) {
|
|
2174
|
+
return extra ? { ...input, ...extra } : input;
|
|
2175
|
+
}
|
|
2176
|
+
async function childrenAt(ctx, path, resolved) {
|
|
2177
|
+
if (path.length === 0) return ctx.parameters;
|
|
2178
|
+
const leaf = await leafAt(ctx, path, resolved);
|
|
2179
|
+
if (!leaf?.resolver || leaf.resolver.type !== "object") return [];
|
|
2180
|
+
return objectChildren(leaf.resolver, mergeInput(resolved, leaf.extraInput));
|
|
2181
|
+
}
|
|
2182
|
+
async function leafAt(ctx, path, resolved) {
|
|
2183
|
+
let children = ctx.parameters;
|
|
2184
|
+
let leaf;
|
|
2185
|
+
for (let i = 0; i < path.length; i++) {
|
|
2186
|
+
const seg = path[i];
|
|
2187
|
+
if (typeof seg === "number") {
|
|
2188
|
+
if (leaf?.resolver?.type !== "array") return void 0;
|
|
2189
|
+
leaf = arrayItem(leaf.resolver);
|
|
2190
|
+
} else {
|
|
2191
|
+
leaf = children.find((c) => c.name === seg);
|
|
2192
|
+
if (!leaf) return void 0;
|
|
2193
|
+
}
|
|
2194
|
+
if (i < path.length - 1 && typeof path[i + 1] === "string") {
|
|
2195
|
+
if (leaf?.resolver?.type !== "object") return void 0;
|
|
2196
|
+
children = await objectChildren(
|
|
2197
|
+
leaf.resolver,
|
|
2198
|
+
mergeInput(resolved, leaf.extraInput)
|
|
2199
|
+
);
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2202
|
+
return leaf;
|
|
2203
|
+
}
|
|
2204
|
+
async function arrayInfoAt(ctx, path, resolved) {
|
|
2205
|
+
const leaf = await leafAt(ctx, path, resolved);
|
|
2206
|
+
const resolver = leaf?.resolver;
|
|
2207
|
+
if (resolver?.type !== "array") {
|
|
2208
|
+
throw new Error(`expected an array resolver at "${key(path)}"`);
|
|
2209
|
+
}
|
|
2210
|
+
return {
|
|
2211
|
+
min: resolver.minItems ?? 0,
|
|
2212
|
+
max: resolver.maxItems ?? Infinity,
|
|
2213
|
+
item: { ...arrayItem(resolver), name: String(path[path.length - 1]) }
|
|
2214
|
+
};
|
|
2215
|
+
}
|
|
2216
|
+
var AFFORDANCE = {
|
|
2217
|
+
choose: { action: "choose", description: "Pick one of the listed options" },
|
|
2218
|
+
custom: {
|
|
2219
|
+
action: "custom",
|
|
2220
|
+
description: "Provide a value directly",
|
|
2221
|
+
supply: "value"
|
|
2222
|
+
},
|
|
2223
|
+
search: {
|
|
2224
|
+
action: "search",
|
|
2225
|
+
description: "Filter the options by a search term",
|
|
2226
|
+
supply: "term"
|
|
2227
|
+
},
|
|
2228
|
+
more: { action: "more", description: "Load more options" },
|
|
2229
|
+
skip: { action: "skip", description: "Omit this optional parameter" },
|
|
2230
|
+
add: { action: "add", description: "Add another item" },
|
|
2231
|
+
done: { action: "done", description: "Finish the list" },
|
|
2232
|
+
retry: { action: "retry", description: "Retry loading the options" },
|
|
2233
|
+
cancel: { action: "cancel", description: "Cancel resolution" }
|
|
2234
|
+
};
|
|
2235
|
+
async function firstPage(result) {
|
|
2236
|
+
const page = await result;
|
|
2237
|
+
return {
|
|
2238
|
+
data: Array.isArray(page?.data) ? page.data : [],
|
|
2239
|
+
nextCursor: page?.nextCursor
|
|
2240
|
+
};
|
|
2241
|
+
}
|
|
2242
|
+
async function resolveContext(leaf, input) {
|
|
2243
|
+
return leaf.resolver?.getContext?.({
|
|
2244
|
+
input: mergeInput(input, leaf.extraInput)
|
|
2245
|
+
});
|
|
2246
|
+
}
|
|
2247
|
+
async function fetchListing(leaf, input, opts = {}) {
|
|
2248
|
+
const page = await firstPage(
|
|
2249
|
+
leaf.resolver?.listItems?.({
|
|
2250
|
+
input: mergeInput(input, leaf.extraInput),
|
|
2251
|
+
context: opts.context,
|
|
2252
|
+
search: opts.search,
|
|
2253
|
+
cursor: opts.cursor
|
|
2254
|
+
})
|
|
2255
|
+
);
|
|
2256
|
+
return {
|
|
2257
|
+
items: [...opts.priorItems ?? [], ...page.data],
|
|
2258
|
+
cursor: page.nextCursor,
|
|
2259
|
+
search: opts.search,
|
|
2260
|
+
exhausted: page.nextCursor == null
|
|
2261
|
+
};
|
|
2262
|
+
}
|
|
2263
|
+
function selectActions(leaf, listing, multiple) {
|
|
2264
|
+
const actions = multiple ? [AFFORDANCE.choose] : [AFFORDANCE.choose, AFFORDANCE.custom];
|
|
2265
|
+
if (leaf.resolver?.inputType === "search") actions.push(AFFORDANCE.search);
|
|
2266
|
+
if (listing.cursor) actions.push(AFFORDANCE.more);
|
|
2267
|
+
if (!leaf.required) actions.push(AFFORDANCE.skip);
|
|
2268
|
+
return actions;
|
|
2269
|
+
}
|
|
2270
|
+
function selectQuestion(leaf, input, listing, context) {
|
|
2271
|
+
const config = leaf.resolver?.prompt?.({
|
|
2272
|
+
items: listing.items,
|
|
2273
|
+
input: mergeInput(input, leaf.extraInput),
|
|
2274
|
+
context
|
|
2275
|
+
});
|
|
2276
|
+
const multiple = config?.type === "checkbox";
|
|
2277
|
+
return {
|
|
2278
|
+
type: "select",
|
|
2279
|
+
message: config?.message ?? `Select ${leaf.name}:`,
|
|
2280
|
+
choices: (config?.choices ?? []).map(toChoice),
|
|
2281
|
+
...multiple ? { multiple: true } : {},
|
|
2282
|
+
...config?.notes?.length ? { notes: config.notes } : {},
|
|
2283
|
+
actions: selectActions(leaf, listing, multiple)
|
|
2284
|
+
};
|
|
2285
|
+
}
|
|
2286
|
+
function toControllerError(error) {
|
|
2287
|
+
if (error instanceof Error) {
|
|
2288
|
+
const code = error.code;
|
|
2289
|
+
return {
|
|
2290
|
+
name: error.name,
|
|
2291
|
+
message: error.message,
|
|
2292
|
+
...typeof code === "string" ? { code } : {}
|
|
2293
|
+
};
|
|
2294
|
+
}
|
|
2295
|
+
return { name: "Error", message: String(error) };
|
|
2296
|
+
}
|
|
2297
|
+
function failedResult(state, name, error) {
|
|
2298
|
+
return {
|
|
2299
|
+
state,
|
|
2300
|
+
result: {
|
|
2301
|
+
status: "failed",
|
|
2302
|
+
error: toControllerError(error),
|
|
2303
|
+
question: {
|
|
2304
|
+
type: "select",
|
|
2305
|
+
message: `Could not load options for ${name}.`,
|
|
2306
|
+
choices: [],
|
|
2307
|
+
actions: [AFFORDANCE.retry, AFFORDANCE.cancel]
|
|
2308
|
+
}
|
|
2309
|
+
}
|
|
2310
|
+
};
|
|
2311
|
+
}
|
|
2312
|
+
async function buildQuestion(leaf, input) {
|
|
2313
|
+
const optional = !leaf.required;
|
|
2314
|
+
const resolver = leaf.resolver;
|
|
2315
|
+
if (resolver?.listItems) {
|
|
2316
|
+
const context = await resolveContext(leaf, input);
|
|
2317
|
+
const listing = await fetchListing(leaf, input, { context });
|
|
2318
|
+
return {
|
|
2319
|
+
question: selectQuestion(leaf, input, listing, context),
|
|
2320
|
+
listing
|
|
2321
|
+
};
|
|
2322
|
+
}
|
|
2323
|
+
if (leaf.staticChoices) {
|
|
2324
|
+
const actions2 = [AFFORDANCE.choose];
|
|
2325
|
+
if (optional) actions2.push(AFFORDANCE.skip);
|
|
2326
|
+
return {
|
|
2327
|
+
question: {
|
|
2328
|
+
type: "select",
|
|
2329
|
+
message: `Select ${leaf.name}:`,
|
|
2330
|
+
choices: leaf.staticChoices,
|
|
2331
|
+
actions: actions2
|
|
2332
|
+
}
|
|
2333
|
+
};
|
|
2334
|
+
}
|
|
2335
|
+
const inputType = resolver?.inputType && resolver.inputType !== "search" ? resolver.inputType : "text";
|
|
2336
|
+
const actions = [AFFORDANCE.custom];
|
|
2337
|
+
if (optional) actions.push(AFFORDANCE.skip);
|
|
2338
|
+
return {
|
|
2339
|
+
question: {
|
|
2340
|
+
type: "input",
|
|
2341
|
+
message: `Enter ${leaf.name}:`,
|
|
2342
|
+
inputType,
|
|
2343
|
+
placeholder: resolver?.placeholder,
|
|
2344
|
+
actions
|
|
2345
|
+
}
|
|
2346
|
+
};
|
|
2347
|
+
}
|
|
2348
|
+
function finalize(ctx, resolved) {
|
|
2349
|
+
if (!ctx.schema) return { status: "done", value: resolved };
|
|
2350
|
+
const parsed = ctx.schema.safeParse(resolved);
|
|
2351
|
+
if (parsed.success) {
|
|
2352
|
+
return { status: "done", value: parsed.data };
|
|
2353
|
+
}
|
|
2354
|
+
const issues = parsed.error.issues.map((i) => ({
|
|
2355
|
+
parameter: i.path.map(String).join(".") || void 0,
|
|
2356
|
+
message: i.message
|
|
2357
|
+
}));
|
|
2358
|
+
return { status: "invalid", issues };
|
|
2359
|
+
}
|
|
2360
|
+
function collectionQuestion(t) {
|
|
2361
|
+
const actions = [AFFORDANCE.add];
|
|
2362
|
+
if (t.count >= t.min) actions.push(AFFORDANCE.done);
|
|
2363
|
+
return {
|
|
2364
|
+
type: "collection",
|
|
2365
|
+
message: `Add another ${t.path[t.path.length - 1]}? (${t.count} so far)`,
|
|
2366
|
+
count: t.count,
|
|
2367
|
+
min: t.min,
|
|
2368
|
+
// An unbounded array's max is Infinity, which JSON.stringify turns to null;
|
|
2369
|
+
// omit it so the question round-trips across the wall as plain data.
|
|
2370
|
+
...Number.isFinite(t.max) ? { max: t.max } : {},
|
|
2371
|
+
actions
|
|
2372
|
+
};
|
|
2373
|
+
}
|
|
2374
|
+
async function findInArray(ctx, state, path) {
|
|
2375
|
+
if (isSettled(state, path)) return null;
|
|
2376
|
+
if (getAtPath(state.resolved, path) == null)
|
|
2377
|
+
setAtPath(state.resolved, path, []);
|
|
2378
|
+
if (!state.interactive) {
|
|
2379
|
+
settle(state, path);
|
|
2380
|
+
return null;
|
|
2381
|
+
}
|
|
2382
|
+
const { min, max, item } = await arrayInfoAt(ctx, path, state.resolved);
|
|
2383
|
+
const items = getAtPath(state.resolved, path);
|
|
2384
|
+
const len = items.length;
|
|
2385
|
+
const itemType = item.resolver?.type;
|
|
2386
|
+
if (len > 0 && (itemType === "object" || itemType === "array")) {
|
|
2387
|
+
const inner = await findNext(ctx, state, [...path, len - 1]);
|
|
2388
|
+
if (inner) return inner;
|
|
2389
|
+
}
|
|
2390
|
+
if (len < min) return descendItem(ctx, state, path, len, item);
|
|
2391
|
+
if (len < max) return { kind: "array", path, count: len, min, max };
|
|
2392
|
+
settle(state, path);
|
|
2393
|
+
return null;
|
|
2394
|
+
}
|
|
2395
|
+
function seedItemSlot(state, itemPath, item) {
|
|
2396
|
+
const type = item.resolver?.type;
|
|
2397
|
+
if (type === "object") {
|
|
2398
|
+
setAtPath(state.resolved, itemPath, {});
|
|
2399
|
+
return "object";
|
|
2400
|
+
}
|
|
2401
|
+
if (type === "array") {
|
|
2402
|
+
setAtPath(state.resolved, itemPath, []);
|
|
2403
|
+
return "array";
|
|
2404
|
+
}
|
|
2405
|
+
return "leaf";
|
|
2406
|
+
}
|
|
2407
|
+
async function descendItem(ctx, state, arrayPath, index, item) {
|
|
2408
|
+
const itemPath = [...arrayPath, index];
|
|
2409
|
+
const kind = seedItemSlot(state, itemPath, item);
|
|
2410
|
+
if (kind === "object") return findNext(ctx, state, itemPath);
|
|
2411
|
+
if (kind === "array") return findInArray(ctx, state, itemPath);
|
|
2412
|
+
return { kind: "leaf", path: itemPath, leaf: item };
|
|
2413
|
+
}
|
|
2414
|
+
async function findNext(ctx, state, path = []) {
|
|
2415
|
+
const container = getAtPath(state.resolved, path) ?? {};
|
|
2416
|
+
for (const leaf of await childrenAt(ctx, path, state.resolved)) {
|
|
2417
|
+
const childPath = [...path, leaf.name];
|
|
2418
|
+
if (!leaf.requires.every((r) => container[r] !== void 0)) continue;
|
|
2419
|
+
if (leaf.resolver?.type === "object") {
|
|
2420
|
+
if (getAtPath(state.resolved, childPath) == null)
|
|
2421
|
+
setAtPath(state.resolved, childPath, {});
|
|
2422
|
+
const inner = await findNext(ctx, state, childPath);
|
|
2423
|
+
if (inner) return inner;
|
|
2424
|
+
continue;
|
|
2425
|
+
}
|
|
2426
|
+
if (leaf.resolver?.type === "array") {
|
|
2427
|
+
const inner = await findInArray(ctx, state, childPath);
|
|
2428
|
+
if (inner) return inner;
|
|
2429
|
+
continue;
|
|
2430
|
+
}
|
|
2431
|
+
if (container[leaf.name] !== void 0 || isSettled(state, childPath))
|
|
2432
|
+
continue;
|
|
2433
|
+
return { kind: "leaf", path: childPath, leaf };
|
|
2434
|
+
}
|
|
2435
|
+
return null;
|
|
2436
|
+
}
|
|
2437
|
+
async function askLeaf(state, path, leaf, opts = {}) {
|
|
2438
|
+
state.current = path;
|
|
2439
|
+
try {
|
|
2440
|
+
const { question, listing } = await buildQuestion(leaf, state.resolved);
|
|
2441
|
+
state.listing = listing;
|
|
2442
|
+
return {
|
|
2443
|
+
state,
|
|
2444
|
+
result: {
|
|
2445
|
+
status: "ask",
|
|
2446
|
+
question,
|
|
2447
|
+
...opts.error ? { error: opts.error } : {}
|
|
2448
|
+
}
|
|
2449
|
+
};
|
|
2450
|
+
} catch (error) {
|
|
2451
|
+
state.listing = { items: [], exhausted: false };
|
|
2452
|
+
return failedResult(state, leaf.name, error);
|
|
2453
|
+
}
|
|
2454
|
+
}
|
|
2455
|
+
async function advance(ctx, state) {
|
|
2456
|
+
for (; ; ) {
|
|
2457
|
+
const target = await findNext(ctx, state);
|
|
2458
|
+
if (!target) {
|
|
2459
|
+
delete state.current;
|
|
2460
|
+
delete state.listing;
|
|
2461
|
+
return { state, result: finalize(ctx, state.resolved) };
|
|
2462
|
+
}
|
|
2463
|
+
if (target.kind === "array") {
|
|
2464
|
+
state.current = target.path;
|
|
2465
|
+
delete state.listing;
|
|
2466
|
+
return {
|
|
2467
|
+
state,
|
|
2468
|
+
result: { status: "ask", question: collectionQuestion(target) }
|
|
2469
|
+
};
|
|
2470
|
+
}
|
|
2471
|
+
const { path, leaf } = target;
|
|
2472
|
+
const auto = await leaf.resolver?.tryResolveWithoutPrompt?.({
|
|
2473
|
+
input: mergeInput(state.resolved, leaf.extraInput)
|
|
2474
|
+
});
|
|
2475
|
+
if (auto) {
|
|
2476
|
+
if (auto.resolvedValue !== void 0)
|
|
2477
|
+
setAtPath(state.resolved, path, auto.resolvedValue);
|
|
2478
|
+
settle(state, path);
|
|
2479
|
+
continue;
|
|
2480
|
+
}
|
|
2481
|
+
if (!state.interactive) {
|
|
2482
|
+
if (!leaf.required) {
|
|
2483
|
+
settle(state, path);
|
|
2484
|
+
continue;
|
|
2485
|
+
}
|
|
2486
|
+
} else if (!leaf.required && !leaf.resolver) {
|
|
2487
|
+
settle(state, path);
|
|
2488
|
+
continue;
|
|
2489
|
+
}
|
|
2490
|
+
return askLeaf(state, path, leaf);
|
|
2491
|
+
}
|
|
2492
|
+
}
|
|
2493
|
+
async function start(ctx, input = {}, interactive = true) {
|
|
2494
|
+
const resolved = {};
|
|
2495
|
+
for (const spec of ctx.parameters) {
|
|
2496
|
+
if (spec.resolver?.type === "constant")
|
|
2497
|
+
resolved[spec.name] = spec.resolver.value;
|
|
2498
|
+
}
|
|
2499
|
+
Object.assign(resolved, input);
|
|
2500
|
+
return advance(ctx, {
|
|
2501
|
+
method: ctx.method,
|
|
2502
|
+
resolved,
|
|
2503
|
+
settled: [],
|
|
2504
|
+
interactive
|
|
2505
|
+
});
|
|
2506
|
+
}
|
|
2507
|
+
async function step(ctx, prior, action) {
|
|
2508
|
+
const state = clone(prior);
|
|
2509
|
+
if (action.type === "cancel") {
|
|
2510
|
+
delete state.current;
|
|
2511
|
+
delete state.listing;
|
|
2512
|
+
return { state, result: { status: "cancelled" } };
|
|
2513
|
+
}
|
|
2514
|
+
const path = state.current;
|
|
2515
|
+
if (!path) throw new Error("step called with no outstanding question");
|
|
2516
|
+
const leaf = await leafAt(ctx, path, state.resolved);
|
|
2517
|
+
if (leaf && (action.type === "search" || action.type === "more" || action.type === "retry")) {
|
|
2518
|
+
return refine(ctx, state, leaf, path, action);
|
|
2519
|
+
}
|
|
2520
|
+
if (action.type === "add" || action.type === "done") {
|
|
2521
|
+
delete state.current;
|
|
2522
|
+
delete state.listing;
|
|
2523
|
+
if (action.type === "done") {
|
|
2524
|
+
settle(state, path);
|
|
2525
|
+
return advance(ctx, state);
|
|
2526
|
+
}
|
|
2527
|
+
const items = getAtPath(state.resolved, path) ?? [];
|
|
2528
|
+
const { item } = await arrayInfoAt(ctx, path, state.resolved);
|
|
2529
|
+
const itemPath = [...path, items.length];
|
|
2530
|
+
if (seedItemSlot(state, itemPath, item) === "leaf")
|
|
2531
|
+
return askLeaf(state, itemPath, item);
|
|
2532
|
+
return advance(ctx, state);
|
|
2533
|
+
}
|
|
2534
|
+
switch (action.type) {
|
|
2535
|
+
case "choose":
|
|
2536
|
+
case "custom": {
|
|
2537
|
+
if (leaf) {
|
|
2538
|
+
const error = await validationError(leaf, action.value, state);
|
|
2539
|
+
if (error) return askLeaf(state, path, leaf, { error });
|
|
2540
|
+
}
|
|
2541
|
+
setAtPath(
|
|
2542
|
+
state.resolved,
|
|
2543
|
+
path,
|
|
2544
|
+
leaf ? coerce(leaf, action.value) : action.value
|
|
2545
|
+
);
|
|
2546
|
+
break;
|
|
2547
|
+
}
|
|
2548
|
+
case "skip":
|
|
2549
|
+
settle(state, path);
|
|
2550
|
+
break;
|
|
2551
|
+
default:
|
|
2552
|
+
throw new Error(`action "${action.type}" is not supported here`);
|
|
2553
|
+
}
|
|
2554
|
+
delete state.current;
|
|
2555
|
+
delete state.listing;
|
|
2556
|
+
return advance(ctx, state);
|
|
2557
|
+
}
|
|
2558
|
+
async function refine(ctx, state, leaf, path, action) {
|
|
2559
|
+
const attempt = action.type === "search" ? { search: action.term, cursor: void 0, priorItems: [] } : {
|
|
2560
|
+
search: state.listing?.search,
|
|
2561
|
+
cursor: state.listing?.cursor,
|
|
2562
|
+
priorItems: state.listing?.items ?? []
|
|
2563
|
+
};
|
|
2564
|
+
try {
|
|
2565
|
+
if (action.type === "search") {
|
|
2566
|
+
const exact = await leaf.resolver?.tryResolveFromSearch?.({
|
|
2567
|
+
input: mergeInput(state.resolved, leaf.extraInput),
|
|
2568
|
+
search: action.term
|
|
2569
|
+
});
|
|
2570
|
+
if (exact) {
|
|
2571
|
+
setAtPath(state.resolved, path, coerce(leaf, exact.resolvedValue));
|
|
2572
|
+
delete state.current;
|
|
2573
|
+
delete state.listing;
|
|
2574
|
+
return advance(ctx, state);
|
|
2575
|
+
}
|
|
2576
|
+
}
|
|
2577
|
+
const context = await resolveContext(leaf, state.resolved);
|
|
2578
|
+
state.listing = await fetchListing(leaf, state.resolved, {
|
|
2579
|
+
...attempt,
|
|
2580
|
+
context
|
|
2581
|
+
});
|
|
2582
|
+
return {
|
|
2583
|
+
state,
|
|
2584
|
+
result: {
|
|
2585
|
+
status: "ask",
|
|
2586
|
+
question: selectQuestion(leaf, state.resolved, state.listing, context)
|
|
2587
|
+
}
|
|
2588
|
+
};
|
|
2589
|
+
} catch (error) {
|
|
2590
|
+
state.listing = {
|
|
2591
|
+
items: attempt.priorItems,
|
|
2592
|
+
search: attempt.search,
|
|
2593
|
+
cursor: attempt.cursor,
|
|
2594
|
+
exhausted: false
|
|
2595
|
+
};
|
|
2596
|
+
return failedResult(state, leaf.name, error);
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
function toJsonSchema(schema) {
|
|
2600
|
+
if (!schema) return void 0;
|
|
2601
|
+
try {
|
|
2602
|
+
return z.toJSONSchema(schema);
|
|
2603
|
+
} catch {
|
|
2604
|
+
return void 0;
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2607
|
+
function projectSummary(entry) {
|
|
2608
|
+
return {
|
|
2609
|
+
name: entry.name,
|
|
2610
|
+
...entry.description ? { description: entry.description } : {},
|
|
2611
|
+
...entry.categories?.length ? { categories: entry.categories } : {}
|
|
2612
|
+
};
|
|
2613
|
+
}
|
|
2614
|
+
function projectMethod(entry) {
|
|
2615
|
+
const inputProperties = toJsonSchema(entry.inputSchema)?.properties;
|
|
2616
|
+
const parameters = {};
|
|
2617
|
+
for (const spec of planParameters(entry).parameters) {
|
|
2618
|
+
parameters[spec.name] = {
|
|
2619
|
+
required: spec.required,
|
|
2620
|
+
dynamic: Boolean(spec.resolver?.listItems),
|
|
2621
|
+
...spec.resolver?.inputType === "search" ? { searchable: true } : {},
|
|
2622
|
+
...inputProperties?.[spec.name] ? { schema: inputProperties[spec.name] } : {},
|
|
2623
|
+
...spec.staticChoices ? { choices: spec.staticChoices } : {},
|
|
2624
|
+
...spec.requires.length ? { requireParameters: spec.requires } : {}
|
|
2625
|
+
};
|
|
2626
|
+
}
|
|
2627
|
+
const output = toJsonSchema(entry.outputSchema);
|
|
2628
|
+
return {
|
|
2629
|
+
name: entry.name,
|
|
2630
|
+
...entry.description ? { description: entry.description } : {},
|
|
2631
|
+
...entry.categories?.length ? { categories: entry.categories } : {},
|
|
2632
|
+
parameters,
|
|
2633
|
+
...entry.positional?.length ? { positional: entry.positional } : {},
|
|
2634
|
+
...output ? { output } : {}
|
|
2635
|
+
};
|
|
2636
|
+
}
|
|
2637
|
+
function createController(sdk) {
|
|
2638
|
+
function entryFor(method) {
|
|
2639
|
+
const entry = sdk.getRegistry().functions.find((f) => f.name === method);
|
|
2640
|
+
if (!entry) throw new Error(`unknown method "${method}"`);
|
|
2641
|
+
return entry;
|
|
2642
|
+
}
|
|
2643
|
+
function contextFor(method) {
|
|
2644
|
+
const entry = entryFor(method);
|
|
2645
|
+
return {
|
|
2646
|
+
method,
|
|
2647
|
+
schema: entry.inputSchema,
|
|
2648
|
+
parameters: planParameters(entry).parameters
|
|
2649
|
+
};
|
|
2650
|
+
}
|
|
2651
|
+
const start2 = ({ method, input, interactive }) => start(contextFor(method), input, interactive);
|
|
2652
|
+
const step2 = ({ state, action }) => step(contextFor(state.method), state, action);
|
|
2653
|
+
const resolve2 = async ({
|
|
2654
|
+
method,
|
|
2655
|
+
input,
|
|
2656
|
+
answer,
|
|
2657
|
+
interactive
|
|
2658
|
+
}) => {
|
|
2659
|
+
const ctx = contextFor(method);
|
|
2660
|
+
let { state, result } = await start(ctx, input, interactive);
|
|
2661
|
+
while (result.status === "ask" || result.status === "failed") {
|
|
2662
|
+
const action = await answer({ state, result });
|
|
2663
|
+
({ state, result } = await step(ctx, state, action));
|
|
2664
|
+
}
|
|
2665
|
+
if (result.status === "done") return result.value;
|
|
2666
|
+
if (result.status === "cancelled") {
|
|
2667
|
+
throw new CoreCancelledSignal(`resolution cancelled for "${method}"`);
|
|
2668
|
+
}
|
|
2669
|
+
const detail = result.issues.map((i) => i.parameter ? `${i.parameter}: ${i.message}` : i.message).join("; ");
|
|
2670
|
+
throw new Error(`invalid input for "${method}": ${detail}`);
|
|
2671
|
+
};
|
|
2672
|
+
const listMethods = () => ({
|
|
2673
|
+
data: sdk.getRegistry().functions.map(projectSummary)
|
|
2674
|
+
});
|
|
2675
|
+
const getMethod = ({ method }) => ({
|
|
2676
|
+
data: projectMethod(entryFor(method))
|
|
2677
|
+
});
|
|
2678
|
+
const listChoices = async ({
|
|
2679
|
+
method,
|
|
2680
|
+
parameter,
|
|
2681
|
+
input = {},
|
|
2682
|
+
search,
|
|
2683
|
+
cursor
|
|
2684
|
+
}) => {
|
|
2685
|
+
const spec = contextFor(method).parameters.find(
|
|
2686
|
+
(p) => p.name === parameter
|
|
2687
|
+
);
|
|
2688
|
+
if (!spec?.resolver?.listItems) return { data: [] };
|
|
2689
|
+
const context = await spec.resolver.getContext?.({ input });
|
|
2690
|
+
const page = await firstPage(
|
|
2691
|
+
spec.resolver.listItems({ input, context, search, cursor })
|
|
2692
|
+
);
|
|
2693
|
+
const config = spec.resolver.prompt?.({ items: page.data, input, context });
|
|
2694
|
+
const data = (config?.choices ?? []).map(toChoice);
|
|
2695
|
+
return { data, nextCursor: page.nextCursor };
|
|
2696
|
+
};
|
|
2697
|
+
return { resolve: resolve2, start: start2, step: step2, listMethods, getMethod, listChoices };
|
|
2698
|
+
}
|
|
1859
2699
|
function createCorePlugin(options) {
|
|
1860
2700
|
return () => ({
|
|
1861
2701
|
context: {
|
|
@@ -2808,8 +3648,8 @@ function normalizeHeaders(optionsHeaders) {
|
|
|
2808
3648
|
return headers;
|
|
2809
3649
|
}
|
|
2810
3650
|
const headerEntries = optionsHeaders instanceof Headers ? Array.from(optionsHeaders.entries()) : Array.isArray(optionsHeaders) ? optionsHeaders : Object.entries(optionsHeaders);
|
|
2811
|
-
for (const [
|
|
2812
|
-
headers[
|
|
3651
|
+
for (const [key2, value] of headerEntries) {
|
|
3652
|
+
headers[key2] = value;
|
|
2813
3653
|
}
|
|
2814
3654
|
return headers;
|
|
2815
3655
|
}
|
|
@@ -3083,7 +3923,7 @@ var listAppsPlugin = definePlugin(
|
|
|
3083
3923
|
locator
|
|
3084
3924
|
];
|
|
3085
3925
|
}
|
|
3086
|
-
const duplicatedLookupAppKeys = Object.keys(implementationNameToLocator).filter((
|
|
3926
|
+
const duplicatedLookupAppKeys = Object.keys(implementationNameToLocator).filter((key2) => implementationNameToLocator[key2].length > 1).map((key2) => implementationNameToLocator[key2]).flat().map((locator) => locator.lookupAppKey);
|
|
3087
3927
|
if (duplicatedLookupAppKeys.length > 0) {
|
|
3088
3928
|
throw new Error(
|
|
3089
3929
|
`Duplicate lookup app keys found: ${duplicatedLookupAppKeys.join(", ")}`
|
|
@@ -3926,7 +4766,7 @@ function formatRecordError(fieldId, err) {
|
|
|
3926
4766
|
function formatResponseError(err) {
|
|
3927
4767
|
const message = err.human_title || err.title || "Unknown error";
|
|
3928
4768
|
if (err.meta && Object.keys(err.meta).length > 0) {
|
|
3929
|
-
const metaParts = Object.entries(err.meta).map(([
|
|
4769
|
+
const metaParts = Object.entries(err.meta).map(([key2, val]) => `${key2}: ${JSON.stringify(val)}`).join(", ");
|
|
3930
4770
|
return `${message} (${metaParts})`;
|
|
3931
4771
|
}
|
|
3932
4772
|
return message;
|
|
@@ -3961,8 +4801,8 @@ var TrashSchema = z.enum(["exclude", "include", "only"]).optional().describe(
|
|
|
3961
4801
|
'Control soft-deleted item visibility. "exclude" (default) returns active items only, "include" returns both active and soft-deleted, "only" returns soft-deleted items only.'
|
|
3962
4802
|
);
|
|
3963
4803
|
var FIELD_ID_PATTERN = /^f\d+$/;
|
|
3964
|
-
function isFieldId(
|
|
3965
|
-
return FIELD_ID_PATTERN.test(
|
|
4804
|
+
function isFieldId(key2) {
|
|
4805
|
+
return FIELD_ID_PATTERN.test(key2);
|
|
3966
4806
|
}
|
|
3967
4807
|
var NESTED_COMPONENTS = {
|
|
3968
4808
|
labeled_string: /* @__PURE__ */ new Set(["value"]),
|
|
@@ -4000,7 +4840,7 @@ async function resolveFieldKeys({
|
|
|
4000
4840
|
fieldKeys
|
|
4001
4841
|
}) {
|
|
4002
4842
|
const allAreIds = fieldKeys.every(
|
|
4003
|
-
(
|
|
4843
|
+
(key2) => typeof key2 === "number" || /^(f?\d+)$/.test(key2)
|
|
4004
4844
|
);
|
|
4005
4845
|
if (allAreIds) {
|
|
4006
4846
|
return fieldKeys.map(toNumericFieldId);
|
|
@@ -4009,13 +4849,13 @@ async function resolveFieldKeys({
|
|
|
4009
4849
|
if (!mapping) {
|
|
4010
4850
|
return fieldKeys.map(toNumericFieldId);
|
|
4011
4851
|
}
|
|
4012
|
-
return fieldKeys.map((
|
|
4013
|
-
if (typeof
|
|
4014
|
-
if (FIELD_ID_PATTERN.test(
|
|
4015
|
-
const id = mapping.nameToId.get(
|
|
4852
|
+
return fieldKeys.map((key2) => {
|
|
4853
|
+
if (typeof key2 === "number") return key2;
|
|
4854
|
+
if (FIELD_ID_PATTERN.test(key2)) return toNumericFieldId(key2);
|
|
4855
|
+
const id = mapping.nameToId.get(key2);
|
|
4016
4856
|
if (!id) {
|
|
4017
4857
|
throw new ZapierValidationError(
|
|
4018
|
-
`Unknown field name: "${
|
|
4858
|
+
`Unknown field name: "${key2}". Use a valid field name or ID.`
|
|
4019
4859
|
);
|
|
4020
4860
|
}
|
|
4021
4861
|
return toNumericFieldId(id);
|
|
@@ -4031,13 +4871,13 @@ async function createFieldKeyTranslator({
|
|
|
4031
4871
|
translateInput(data) {
|
|
4032
4872
|
if (!mapping) return data;
|
|
4033
4873
|
const result = {};
|
|
4034
|
-
for (const [
|
|
4035
|
-
if (FIELD_ID_PATTERN.test(
|
|
4036
|
-
result[
|
|
4037
|
-
} else if (mapping.nameToId.has(
|
|
4038
|
-
result[mapping.nameToId.get(
|
|
4874
|
+
for (const [key2, value] of Object.entries(data)) {
|
|
4875
|
+
if (FIELD_ID_PATTERN.test(key2) && mapping.idToName.has(key2)) {
|
|
4876
|
+
result[key2] = value;
|
|
4877
|
+
} else if (mapping.nameToId.has(key2)) {
|
|
4878
|
+
result[mapping.nameToId.get(key2)] = value;
|
|
4039
4879
|
} else {
|
|
4040
|
-
result[
|
|
4880
|
+
result[key2] = value;
|
|
4041
4881
|
}
|
|
4042
4882
|
}
|
|
4043
4883
|
return result;
|
|
@@ -4045,29 +4885,29 @@ async function createFieldKeyTranslator({
|
|
|
4045
4885
|
translateOutput(data) {
|
|
4046
4886
|
if (!mapping) return data;
|
|
4047
4887
|
const result = {};
|
|
4048
|
-
for (const [
|
|
4049
|
-
if (mapping.idToName.has(
|
|
4050
|
-
result[mapping.idToName.get(
|
|
4888
|
+
for (const [key2, value] of Object.entries(data)) {
|
|
4889
|
+
if (mapping.idToName.has(key2)) {
|
|
4890
|
+
result[mapping.idToName.get(key2)] = value;
|
|
4051
4891
|
} else {
|
|
4052
|
-
result[
|
|
4892
|
+
result[key2] = value;
|
|
4053
4893
|
}
|
|
4054
4894
|
}
|
|
4055
4895
|
return result;
|
|
4056
4896
|
},
|
|
4057
|
-
translateFieldKey(
|
|
4058
|
-
if (!mapping) return
|
|
4059
|
-
if (FIELD_ID_PATTERN.test(
|
|
4060
|
-
const fieldType = mapping.idToType.get(
|
|
4897
|
+
translateFieldKey(key2) {
|
|
4898
|
+
if (!mapping) return key2;
|
|
4899
|
+
if (FIELD_ID_PATTERN.test(key2) && mapping.idToName.has(key2)) {
|
|
4900
|
+
const fieldType = mapping.idToType.get(key2);
|
|
4061
4901
|
if (fieldType) {
|
|
4062
4902
|
const components = NESTED_COMPONENTS[fieldType];
|
|
4063
4903
|
if (components?.size === 1) {
|
|
4064
|
-
return `${
|
|
4904
|
+
return `${key2}__${[...components][0]}`;
|
|
4065
4905
|
}
|
|
4066
4906
|
}
|
|
4067
|
-
return
|
|
4907
|
+
return key2;
|
|
4068
4908
|
}
|
|
4069
|
-
if (mapping.nameToId.has(
|
|
4070
|
-
const fieldId = mapping.nameToId.get(
|
|
4909
|
+
if (mapping.nameToId.has(key2)) {
|
|
4910
|
+
const fieldId = mapping.nameToId.get(key2);
|
|
4071
4911
|
const fieldType = mapping.idToType.get(fieldId);
|
|
4072
4912
|
if (fieldType) {
|
|
4073
4913
|
const components = NESTED_COMPONENTS[fieldType];
|
|
@@ -4077,10 +4917,10 @@ async function createFieldKeyTranslator({
|
|
|
4077
4917
|
}
|
|
4078
4918
|
return fieldId;
|
|
4079
4919
|
}
|
|
4080
|
-
const sepIndex =
|
|
4920
|
+
const sepIndex = key2.lastIndexOf("__");
|
|
4081
4921
|
if (sepIndex > 0) {
|
|
4082
|
-
const prefix =
|
|
4083
|
-
const component =
|
|
4922
|
+
const prefix = key2.slice(0, sepIndex);
|
|
4923
|
+
const component = key2.slice(sepIndex + 2);
|
|
4084
4924
|
let fieldId;
|
|
4085
4925
|
if (FIELD_ID_PATTERN.test(prefix) && mapping.idToName.has(prefix)) {
|
|
4086
4926
|
fieldId = prefix;
|
|
@@ -4094,7 +4934,7 @@ async function createFieldKeyTranslator({
|
|
|
4094
4934
|
}
|
|
4095
4935
|
}
|
|
4096
4936
|
}
|
|
4097
|
-
return
|
|
4937
|
+
return key2;
|
|
4098
4938
|
}
|
|
4099
4939
|
};
|
|
4100
4940
|
}
|
|
@@ -5738,9 +6578,9 @@ var RunActionSchemaDeprecated = z.object({
|
|
|
5738
6578
|
var RunActionInputSchema = z.union([RunActionSchema, RunActionSchemaDeprecated]).describe(RunActionDescription);
|
|
5739
6579
|
|
|
5740
6580
|
// src/formatters/actionResult.ts
|
|
5741
|
-
function getStringProperty(obj,
|
|
5742
|
-
if (typeof obj === "object" && obj !== null &&
|
|
5743
|
-
const value = obj[
|
|
6581
|
+
function getStringProperty(obj, key2) {
|
|
6582
|
+
if (typeof obj === "object" && obj !== null && key2 in obj) {
|
|
6583
|
+
const value = obj[key2];
|
|
5744
6584
|
return typeof value === "string" ? value : void 0;
|
|
5745
6585
|
}
|
|
5746
6586
|
return void 0;
|
|
@@ -5827,13 +6667,13 @@ var runActionPlugin = definePlugin(
|
|
|
5827
6667
|
let oldestKey;
|
|
5828
6668
|
let oldestExpiry = Infinity;
|
|
5829
6669
|
let evictedAny = false;
|
|
5830
|
-
for (const [
|
|
6670
|
+
for (const [key2, entry] of runActionContextCache) {
|
|
5831
6671
|
if (now >= entry.expiresAt) {
|
|
5832
|
-
runActionContextCache.delete(
|
|
6672
|
+
runActionContextCache.delete(key2);
|
|
5833
6673
|
evictedAny = true;
|
|
5834
6674
|
} else if (entry.expiresAt < oldestExpiry) {
|
|
5835
6675
|
oldestExpiry = entry.expiresAt;
|
|
5836
|
-
oldestKey =
|
|
6676
|
+
oldestKey = key2;
|
|
5837
6677
|
}
|
|
5838
6678
|
}
|
|
5839
6679
|
if (!evictedAny && oldestKey) {
|
|
@@ -6234,9 +7074,9 @@ function findManifestEntry({
|
|
|
6234
7074
|
return [slug, manifest.apps[slug]];
|
|
6235
7075
|
}
|
|
6236
7076
|
}
|
|
6237
|
-
for (const [
|
|
7077
|
+
for (const [key2, entry] of Object.entries(manifest.apps)) {
|
|
6238
7078
|
if (entry.implementationName === appKeyWithoutVersion) {
|
|
6239
|
-
return [
|
|
7079
|
+
return [key2, entry];
|
|
6240
7080
|
}
|
|
6241
7081
|
}
|
|
6242
7082
|
return null;
|
|
@@ -6647,28 +7487,28 @@ function censorHeaders(headers) {
|
|
|
6647
7487
|
if (!headers) return headers;
|
|
6648
7488
|
const headersObj = new Headers(headers);
|
|
6649
7489
|
const authKeys = ["authorization", "x-api-key"];
|
|
6650
|
-
for (const [
|
|
6651
|
-
if (authKeys.some((authKey) =>
|
|
7490
|
+
for (const [key2, value] of headersObj.entries()) {
|
|
7491
|
+
if (authKeys.some((authKey) => key2.toLowerCase() === authKey)) {
|
|
6652
7492
|
const spaceIndex = value.indexOf(" ");
|
|
6653
7493
|
if (spaceIndex > 0 && spaceIndex < value.length - 1) {
|
|
6654
7494
|
const prefix = value.substring(0, spaceIndex + 1);
|
|
6655
7495
|
const token = value.substring(spaceIndex + 1);
|
|
6656
7496
|
if (token.length > 12) {
|
|
6657
|
-
const
|
|
7497
|
+
const start2 = token.substring(0, 4);
|
|
6658
7498
|
const end = token.substring(token.length - 4);
|
|
6659
|
-
headersObj.set(
|
|
7499
|
+
headersObj.set(key2, `${prefix}${start2}...${end}`);
|
|
6660
7500
|
} else {
|
|
6661
7501
|
const firstChar = token.charAt(0);
|
|
6662
|
-
headersObj.set(
|
|
7502
|
+
headersObj.set(key2, `${prefix}${firstChar}...`);
|
|
6663
7503
|
}
|
|
6664
7504
|
} else {
|
|
6665
7505
|
if (value.length > 12) {
|
|
6666
|
-
const
|
|
7506
|
+
const start2 = value.substring(0, 4);
|
|
6667
7507
|
const end = value.substring(value.length - 4);
|
|
6668
|
-
headersObj.set(
|
|
7508
|
+
headersObj.set(key2, `${start2}...${end}`);
|
|
6669
7509
|
} else {
|
|
6670
7510
|
const firstChar = value.charAt(0);
|
|
6671
|
-
headersObj.set(
|
|
7511
|
+
headersObj.set(key2, `${firstChar}...`);
|
|
6672
7512
|
}
|
|
6673
7513
|
}
|
|
6674
7514
|
}
|
|
@@ -7237,21 +8077,21 @@ function getClientIdFromCredentials(credentials) {
|
|
|
7237
8077
|
function createMemoryCache() {
|
|
7238
8078
|
const store = /* @__PURE__ */ new Map();
|
|
7239
8079
|
return {
|
|
7240
|
-
async get(
|
|
7241
|
-
const entry = store.get(
|
|
8080
|
+
async get(key2) {
|
|
8081
|
+
const entry = store.get(key2);
|
|
7242
8082
|
if (!entry) return void 0;
|
|
7243
8083
|
if (entry.expiresAt !== void 0 && entry.expiresAt <= Date.now()) {
|
|
7244
|
-
store.delete(
|
|
8084
|
+
store.delete(key2);
|
|
7245
8085
|
return void 0;
|
|
7246
8086
|
}
|
|
7247
8087
|
return { value: entry.value, expiresAt: entry.expiresAt };
|
|
7248
8088
|
},
|
|
7249
|
-
async set(
|
|
8089
|
+
async set(key2, value, options) {
|
|
7250
8090
|
const expiresAt = options?.ttl ? Date.now() + options.ttl * 1e3 : void 0;
|
|
7251
|
-
store.set(
|
|
8091
|
+
store.set(key2, { value, expiresAt });
|
|
7252
8092
|
},
|
|
7253
|
-
async delete(
|
|
7254
|
-
store.delete(
|
|
8093
|
+
async delete(key2) {
|
|
8094
|
+
store.delete(key2);
|
|
7255
8095
|
}
|
|
7256
8096
|
};
|
|
7257
8097
|
}
|
|
@@ -7742,14 +8582,14 @@ function createSseParserStream() {
|
|
|
7742
8582
|
transform(chunk, controller) {
|
|
7743
8583
|
buffer += chunk;
|
|
7744
8584
|
const newline = /\r\n|\r|\n/g;
|
|
7745
|
-
let
|
|
8585
|
+
let start2 = 0;
|
|
7746
8586
|
let match;
|
|
7747
8587
|
while ((match = newline.exec(buffer)) !== null) {
|
|
7748
8588
|
if (match[0] === "\r" && match.index === buffer.length - 1) break;
|
|
7749
|
-
processLine(buffer.slice(
|
|
7750
|
-
|
|
8589
|
+
processLine(buffer.slice(start2, match.index), controller);
|
|
8590
|
+
start2 = match.index + match[0].length;
|
|
7751
8591
|
}
|
|
7752
|
-
buffer = buffer.slice(
|
|
8592
|
+
buffer = buffer.slice(start2);
|
|
7753
8593
|
},
|
|
7754
8594
|
flush(controller) {
|
|
7755
8595
|
if (buffer.endsWith("\r")) {
|
|
@@ -7851,8 +8691,63 @@ function parseApprovalReviewStreamPayload(parsed, toolNames) {
|
|
|
7851
8691
|
}
|
|
7852
8692
|
}
|
|
7853
8693
|
|
|
8694
|
+
// src/api/deprecation.ts
|
|
8695
|
+
var DEPRECATION_MESSAGE_HEADER = "zapier-sdk-deprecation-message";
|
|
8696
|
+
var DEPRECATION_ID_HEADER = "zapier-sdk-deprecation-id";
|
|
8697
|
+
var DEPRECATION_NOTICE_EVENT = "api:deprecation_notice";
|
|
8698
|
+
var displayedNoticeIds = /* @__PURE__ */ new Set();
|
|
8699
|
+
function handleDeprecationNotice({
|
|
8700
|
+
response,
|
|
8701
|
+
canSendDeprecationMessaging,
|
|
8702
|
+
onEvent
|
|
8703
|
+
}) {
|
|
8704
|
+
try {
|
|
8705
|
+
sniffDeprecationNotice({ response, canSendDeprecationMessaging, onEvent });
|
|
8706
|
+
} catch {
|
|
8707
|
+
}
|
|
8708
|
+
}
|
|
8709
|
+
function sniffDeprecationNotice({
|
|
8710
|
+
response,
|
|
8711
|
+
canSendDeprecationMessaging,
|
|
8712
|
+
onEvent
|
|
8713
|
+
}) {
|
|
8714
|
+
if (!canSendDeprecationMessaging) return;
|
|
8715
|
+
const message = response.headers?.get(DEPRECATION_MESSAGE_HEADER);
|
|
8716
|
+
if (!message) return;
|
|
8717
|
+
const id = response.headers.get(DEPRECATION_ID_HEADER) ?? message;
|
|
8718
|
+
if (!displayedNoticeIds.has(id)) {
|
|
8719
|
+
displayedNoticeIds.add(id);
|
|
8720
|
+
console.warn(`[zapier-sdk] Deprecation: ${message}`);
|
|
8721
|
+
}
|
|
8722
|
+
if (onEvent) {
|
|
8723
|
+
const payload = { id, message };
|
|
8724
|
+
const deprecation = parseDeprecationDate(
|
|
8725
|
+
response.headers.get("deprecation")
|
|
8726
|
+
);
|
|
8727
|
+
if (deprecation !== void 0) payload.deprecation = deprecation;
|
|
8728
|
+
const maybePromise = onEvent({
|
|
8729
|
+
type: DEPRECATION_NOTICE_EVENT,
|
|
8730
|
+
payload: { ...payload },
|
|
8731
|
+
timestamp: Date.now()
|
|
8732
|
+
});
|
|
8733
|
+
if (isPromiseLike(maybePromise)) {
|
|
8734
|
+
void Promise.resolve(maybePromise).catch(() => {
|
|
8735
|
+
});
|
|
8736
|
+
}
|
|
8737
|
+
}
|
|
8738
|
+
}
|
|
8739
|
+
function isPromiseLike(value) {
|
|
8740
|
+
return (typeof value === "object" || typeof value === "function") && value !== null && "then" in value && typeof value.then === "function";
|
|
8741
|
+
}
|
|
8742
|
+
function parseDeprecationDate(value) {
|
|
8743
|
+
if (!value) return void 0;
|
|
8744
|
+
const match = /^@(-?\d+)$/.exec(value.trim());
|
|
8745
|
+
if (!match) return void 0;
|
|
8746
|
+
return Number(match[1]) * 1e3;
|
|
8747
|
+
}
|
|
8748
|
+
|
|
7854
8749
|
// src/sdk-version.ts
|
|
7855
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.
|
|
8750
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.80.0" : void 0) || "unknown";
|
|
7856
8751
|
|
|
7857
8752
|
// src/utils/open-url.ts
|
|
7858
8753
|
var nodePrefix = "node:";
|
|
@@ -7964,6 +8859,30 @@ var PollApprovalResponseSchema = z.object({
|
|
|
7964
8859
|
reason: z.string().optional()
|
|
7965
8860
|
});
|
|
7966
8861
|
var APPROVAL_MAX_POLLING_INTERVAL_MS = 5e3;
|
|
8862
|
+
function validateSdkPath(path) {
|
|
8863
|
+
if (!path.startsWith("/") || path.startsWith("//")) {
|
|
8864
|
+
throw new ZapierValidationError(
|
|
8865
|
+
`fetch expects a path starting with a single '/', got: ${path}`
|
|
8866
|
+
);
|
|
8867
|
+
}
|
|
8868
|
+
}
|
|
8869
|
+
function findPathConfigEntries({
|
|
8870
|
+
path,
|
|
8871
|
+
matchResolvedGatewayPath = false
|
|
8872
|
+
}) {
|
|
8873
|
+
const pathSegments = path.split("/").filter(Boolean);
|
|
8874
|
+
return Object.entries(pathConfig).filter(([configPath, config]) => {
|
|
8875
|
+
if (!matchResolvedGatewayPath) {
|
|
8876
|
+
return path === configPath || path.startsWith(`${configPath}/`);
|
|
8877
|
+
}
|
|
8878
|
+
const prefixSegments = (config.pathPrefix ?? configPath).split("/").filter(Boolean);
|
|
8879
|
+
return pathSegments.some(
|
|
8880
|
+
(_, startIndex) => prefixSegments.every(
|
|
8881
|
+
(segment, offset) => pathSegments[startIndex + offset] === segment
|
|
8882
|
+
)
|
|
8883
|
+
);
|
|
8884
|
+
}).map(([configPath, config]) => ({ configPath, config }));
|
|
8885
|
+
}
|
|
7967
8886
|
function parseRateLimitHeaders(response) {
|
|
7968
8887
|
const info = {};
|
|
7969
8888
|
const retryAfter = response.headers.get("retry-after");
|
|
@@ -8008,8 +8927,18 @@ var pathConfig = {
|
|
|
8008
8927
|
// e.g. /relay -> https://sdkapi.zapier.com/api/v0/sdk/relay/...
|
|
8009
8928
|
"/relay": {
|
|
8010
8929
|
authHeader: "X-Relay-Authorization",
|
|
8011
|
-
pathPrefix: "/api/v0/sdk/relay"
|
|
8930
|
+
pathPrefix: "/api/v0/sdk/relay",
|
|
8931
|
+
omitDeprecationMessaging: true
|
|
8932
|
+
},
|
|
8933
|
+
// The concrete gateway form of the relay route. Callers that pass the
|
|
8934
|
+
// already-prefixed path reach the same third-party upstreams, so it must
|
|
8935
|
+
// classify as relay too; without this entry it would match nothing and
|
|
8936
|
+
// sniff deprecation headers off a relay response.
|
|
8937
|
+
"/api/v0/sdk/relay": {
|
|
8938
|
+
omitDeprecationMessaging: true
|
|
8012
8939
|
},
|
|
8940
|
+
// Concrete sdkapi routes that do not live behind /api/v0/sdk/<service>.
|
|
8941
|
+
"/api/v0": {},
|
|
8013
8942
|
// e.g. /zapier -> https://sdkapi.zapier.com/api/v0/sdk/zapier/...
|
|
8014
8943
|
"/zapier": {
|
|
8015
8944
|
authHeader: "Authorization",
|
|
@@ -8064,11 +8993,11 @@ var ZapierApiClient = class {
|
|
|
8064
8993
|
);
|
|
8065
8994
|
const inputHeaders = new Headers(init?.headers ?? {});
|
|
8066
8995
|
const mergedHeaders = new Headers();
|
|
8067
|
-
builtHeaders.forEach((value,
|
|
8068
|
-
mergedHeaders.set(
|
|
8996
|
+
builtHeaders.forEach((value, key2) => {
|
|
8997
|
+
mergedHeaders.set(key2, value);
|
|
8069
8998
|
});
|
|
8070
|
-
inputHeaders.forEach((value,
|
|
8071
|
-
mergedHeaders.set(
|
|
8999
|
+
inputHeaders.forEach((value, key2) => {
|
|
9000
|
+
mergedHeaders.set(key2, value);
|
|
8072
9001
|
});
|
|
8073
9002
|
this.applyTelemetryHeaders(mergedHeaders);
|
|
8074
9003
|
let retries = 0;
|
|
@@ -8158,17 +9087,50 @@ var ZapierApiClient = class {
|
|
|
8158
9087
|
* parallelism into the queue.
|
|
8159
9088
|
*/
|
|
8160
9089
|
this.rawFetch = async (path, init) => {
|
|
8161
|
-
|
|
8162
|
-
throw new ZapierValidationError(
|
|
8163
|
-
`fetch expects a path starting with '/', got: ${path}`
|
|
8164
|
-
);
|
|
8165
|
-
}
|
|
9090
|
+
validateSdkPath(path);
|
|
8166
9091
|
const { url, pathConfig: pathConfig2 } = this.buildUrl(path, init?.searchParams);
|
|
8167
9092
|
return this.withSemaphore(
|
|
8168
9093
|
{ url, method: init?.method ?? "GET", signal: init?.signal },
|
|
8169
9094
|
() => this.rawFetchUrl(url, init, pathConfig2)
|
|
8170
9095
|
);
|
|
8171
9096
|
};
|
|
9097
|
+
this.runApprovalFetchLoop = async ({
|
|
9098
|
+
path,
|
|
9099
|
+
init,
|
|
9100
|
+
maxRetries,
|
|
9101
|
+
approvalMode,
|
|
9102
|
+
approvalContext
|
|
9103
|
+
}) => {
|
|
9104
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
9105
|
+
const response = await this.rawFetch(path, init);
|
|
9106
|
+
if (response.status !== 403) {
|
|
9107
|
+
return { response };
|
|
9108
|
+
}
|
|
9109
|
+
const errorType = response.headers.get("x-zapier-error-type");
|
|
9110
|
+
if (errorType !== "approval_required") {
|
|
9111
|
+
return { response };
|
|
9112
|
+
}
|
|
9113
|
+
if (attempt === maxRetries) {
|
|
9114
|
+
return { response };
|
|
9115
|
+
}
|
|
9116
|
+
if (approvalMode === "disabled") {
|
|
9117
|
+
return { response };
|
|
9118
|
+
}
|
|
9119
|
+
if (!approvalContext) {
|
|
9120
|
+
return { response };
|
|
9121
|
+
}
|
|
9122
|
+
try {
|
|
9123
|
+
await this.runOneApprovalRound(
|
|
9124
|
+
approvalContext,
|
|
9125
|
+
approvalMode,
|
|
9126
|
+
init?.signal ?? void 0
|
|
9127
|
+
);
|
|
9128
|
+
} catch (error) {
|
|
9129
|
+
return { response, approvalRoundError: error };
|
|
9130
|
+
}
|
|
9131
|
+
}
|
|
9132
|
+
throw new ZapierApiError("Approval retry loop ended unexpectedly");
|
|
9133
|
+
};
|
|
8172
9134
|
/**
|
|
8173
9135
|
* Approval-aware HTTP fetch.
|
|
8174
9136
|
*
|
|
@@ -8198,46 +9160,62 @@ var ZapierApiClient = class {
|
|
|
8198
9160
|
* `max_retries_exceeded` instead.
|
|
8199
9161
|
*/
|
|
8200
9162
|
this.fetch = async (path, init) => {
|
|
9163
|
+
validateSdkPath(path);
|
|
8201
9164
|
const maxRetries = this.options.maxApprovalRetries ?? DEFAULT_MAX_APPROVAL_RETRIES;
|
|
8202
|
-
|
|
8203
|
-
|
|
8204
|
-
|
|
8205
|
-
|
|
8206
|
-
|
|
8207
|
-
|
|
8208
|
-
|
|
8209
|
-
|
|
8210
|
-
|
|
8211
|
-
|
|
8212
|
-
|
|
8213
|
-
|
|
8214
|
-
|
|
8215
|
-
|
|
8216
|
-
|
|
8217
|
-
|
|
8218
|
-
|
|
8219
|
-
|
|
8220
|
-
|
|
8221
|
-
|
|
8222
|
-
|
|
8223
|
-
|
|
8224
|
-
|
|
8225
|
-
|
|
8226
|
-
|
|
8227
|
-
|
|
8228
|
-
|
|
8229
|
-
|
|
8230
|
-
}
|
|
8231
|
-
|
|
8232
|
-
|
|
8233
|
-
|
|
8234
|
-
|
|
8235
|
-
|
|
8236
|
-
|
|
8237
|
-
|
|
8238
|
-
|
|
8239
|
-
|
|
8240
|
-
|
|
9165
|
+
const { canSendDeprecationMessaging } = this.buildUrl(
|
|
9166
|
+
path,
|
|
9167
|
+
init?.searchParams
|
|
9168
|
+
);
|
|
9169
|
+
const approvalMode = this.options.approvalMode ?? getZapierApprovalMode() ?? getZapierDefaultApprovalMode();
|
|
9170
|
+
const approvalContext = init?.approvalContext;
|
|
9171
|
+
const { response, approvalRoundError } = await this.runApprovalFetchLoop({
|
|
9172
|
+
path,
|
|
9173
|
+
init,
|
|
9174
|
+
maxRetries,
|
|
9175
|
+
approvalMode,
|
|
9176
|
+
approvalContext
|
|
9177
|
+
});
|
|
9178
|
+
handleDeprecationNotice({
|
|
9179
|
+
response,
|
|
9180
|
+
canSendDeprecationMessaging,
|
|
9181
|
+
onEvent: this.options.onEvent
|
|
9182
|
+
});
|
|
9183
|
+
if (response.status !== 403) {
|
|
9184
|
+
return response;
|
|
9185
|
+
}
|
|
9186
|
+
const errorType = response.headers.get("x-zapier-error-type");
|
|
9187
|
+
if (errorType === "request_denied_by_policy") {
|
|
9188
|
+
const { data } = await this.parseResult(response);
|
|
9189
|
+
const { message, errors } = this.parseErrorResponse({
|
|
9190
|
+
status: response.status,
|
|
9191
|
+
statusText: response.statusText,
|
|
9192
|
+
data
|
|
9193
|
+
});
|
|
9194
|
+
throw new ZapierApprovalError(
|
|
9195
|
+
message || "Request explicitly denied by policy",
|
|
9196
|
+
{
|
|
9197
|
+
status: "policy_denied",
|
|
9198
|
+
statusCode: response.status,
|
|
9199
|
+
errors
|
|
9200
|
+
}
|
|
9201
|
+
);
|
|
9202
|
+
}
|
|
9203
|
+
if (errorType !== "approval_required") {
|
|
9204
|
+
return response;
|
|
9205
|
+
}
|
|
9206
|
+
if (approvalRoundError) {
|
|
9207
|
+
throw approvalRoundError;
|
|
9208
|
+
}
|
|
9209
|
+
if (approvalMode === "disabled") {
|
|
9210
|
+
throw new ZapierApprovalError(
|
|
9211
|
+
"Approvals are disabled. Set approvalMode to 'poll' or 'throw' (or ZAPIER_APPROVAL_MODE) to enable.",
|
|
9212
|
+
{ status: "approval_required" }
|
|
9213
|
+
);
|
|
9214
|
+
}
|
|
9215
|
+
if (!approvalContext) {
|
|
9216
|
+
throw new ZapierApiError(
|
|
9217
|
+
`Received 403 approval_required for ${path}, but the caller did not provide an approvalContext builder. Every approval-capable request must pass approvalContext so the SDK can create the approval with the correct policy context.`,
|
|
9218
|
+
{ statusCode: 403 }
|
|
8241
9219
|
);
|
|
8242
9220
|
}
|
|
8243
9221
|
throw new ZapierApprovalError(
|
|
@@ -8499,40 +9477,60 @@ var ZapierApiClient = class {
|
|
|
8499
9477
|
}
|
|
8500
9478
|
// Apply any special routing logic for configured paths.
|
|
8501
9479
|
applyPathConfiguration(path) {
|
|
8502
|
-
const
|
|
8503
|
-
|
|
8504
|
-
)
|
|
8505
|
-
|
|
9480
|
+
const matchingPathEntries = findPathConfigEntries({ path });
|
|
9481
|
+
const routingMatch = matchingPathEntries[0];
|
|
9482
|
+
const buildResult = (url2) => {
|
|
9483
|
+
const resolvedPathEntries = findPathConfigEntries({
|
|
9484
|
+
path: url2.pathname,
|
|
9485
|
+
matchResolvedGatewayPath: true
|
|
9486
|
+
});
|
|
9487
|
+
const deprecationPathMatches = [
|
|
9488
|
+
...matchingPathEntries,
|
|
9489
|
+
...resolvedPathEntries
|
|
9490
|
+
];
|
|
9491
|
+
const canSendDeprecationMessaging = deprecationPathMatches.length > 0 && deprecationPathMatches.every(
|
|
9492
|
+
({ config }) => config.omitDeprecationMessaging !== true
|
|
9493
|
+
);
|
|
9494
|
+
return {
|
|
9495
|
+
url: url2,
|
|
9496
|
+
pathConfig: routingMatch?.config,
|
|
9497
|
+
canSendDeprecationMessaging
|
|
9498
|
+
};
|
|
9499
|
+
};
|
|
8506
9500
|
let finalPath = path;
|
|
8507
|
-
if (config
|
|
8508
|
-
const pathWithoutPrefix = path.slice(
|
|
8509
|
-
finalPath = `${config.pathPrefix}${pathWithoutPrefix}`;
|
|
9501
|
+
if (routingMatch?.config.pathPrefix) {
|
|
9502
|
+
const pathWithoutPrefix = path.slice(routingMatch.configPath.length) || "/";
|
|
9503
|
+
finalPath = `${routingMatch.config.pathPrefix}${pathWithoutPrefix}`;
|
|
8510
9504
|
}
|
|
8511
9505
|
const zapierBaseUrl = getZapierBaseUrl(this.options.baseUrl);
|
|
8512
9506
|
if (zapierBaseUrl === this.options.baseUrl.replace(/\/$/, "")) {
|
|
8513
9507
|
const originalBaseUrl = new URL(this.options.baseUrl);
|
|
8514
9508
|
const finalBaseUrl = `https://sdkapi.${originalBaseUrl.hostname}`;
|
|
8515
|
-
|
|
8516
|
-
|
|
8517
|
-
pathConfig: config
|
|
8518
|
-
};
|
|
9509
|
+
const url2 = new URL(finalPath, finalBaseUrl);
|
|
9510
|
+
return buildResult(url2);
|
|
8519
9511
|
}
|
|
8520
9512
|
const baseUrl = new URL(this.options.baseUrl);
|
|
8521
9513
|
const basePath = baseUrl.pathname.replace(/\/$/, "");
|
|
8522
|
-
|
|
8523
|
-
|
|
8524
|
-
pathConfig: config
|
|
8525
|
-
};
|
|
9514
|
+
const url = new URL(basePath + finalPath, baseUrl.origin);
|
|
9515
|
+
return buildResult(url);
|
|
8526
9516
|
}
|
|
8527
9517
|
// Helper to build full URLs and return routing info
|
|
8528
9518
|
buildUrl(path, searchParams) {
|
|
8529
|
-
const {
|
|
9519
|
+
const {
|
|
9520
|
+
url,
|
|
9521
|
+
pathConfig: config,
|
|
9522
|
+
canSendDeprecationMessaging
|
|
9523
|
+
} = this.applyPathConfiguration(path);
|
|
8530
9524
|
if (searchParams) {
|
|
8531
|
-
Object.entries(searchParams).forEach(([
|
|
8532
|
-
url.searchParams.set(
|
|
9525
|
+
Object.entries(searchParams).forEach(([key2, value]) => {
|
|
9526
|
+
url.searchParams.set(key2, value);
|
|
8533
9527
|
});
|
|
8534
9528
|
}
|
|
8535
|
-
return {
|
|
9529
|
+
return {
|
|
9530
|
+
url: url.toString(),
|
|
9531
|
+
pathConfig: config,
|
|
9532
|
+
canSendDeprecationMessaging
|
|
9533
|
+
};
|
|
8536
9534
|
}
|
|
8537
9535
|
// Helper to build headers
|
|
8538
9536
|
async buildHeaders(options = {}, pathConfig2) {
|
|
@@ -9322,36 +10320,36 @@ var createConnectionPlugin = definePlugin(
|
|
|
9322
10320
|
sdk: inner,
|
|
9323
10321
|
options
|
|
9324
10322
|
}) => {
|
|
9325
|
-
const { data:
|
|
10323
|
+
const { data: start2 } = await inner.getConnectionStartUrl({
|
|
9326
10324
|
app: options.app
|
|
9327
10325
|
});
|
|
9328
|
-
setMethodMetadata({ selectedApi:
|
|
10326
|
+
setMethodMetadata({ selectedApi: start2.app });
|
|
9329
10327
|
console.error(
|
|
9330
10328
|
`
|
|
9331
10329
|
Open this URL to complete the connection:
|
|
9332
|
-
${
|
|
10330
|
+
${start2.url}
|
|
9333
10331
|
`
|
|
9334
10332
|
);
|
|
9335
10333
|
const shouldOpen = options.browser === "always" || options.browser === "auto" && shouldOpenBrowser();
|
|
9336
10334
|
if (shouldOpen) {
|
|
9337
10335
|
try {
|
|
9338
|
-
await open_url_default(
|
|
10336
|
+
await open_url_default(start2.url);
|
|
9339
10337
|
} catch {
|
|
9340
10338
|
}
|
|
9341
10339
|
}
|
|
9342
10340
|
const { data: fresh } = await inner.waitForNewConnection({
|
|
9343
|
-
app:
|
|
10341
|
+
app: start2.app,
|
|
9344
10342
|
// Server-stamped mint time: measured on the same clock as a
|
|
9345
10343
|
// connection's `date`, so the freshness check is immune to
|
|
9346
10344
|
// client/server clock skew.
|
|
9347
|
-
startedAt:
|
|
10345
|
+
startedAt: start2.startedAt,
|
|
9348
10346
|
timeoutMs: options.timeoutMs,
|
|
9349
10347
|
pollIntervalMs: options.pollIntervalMs
|
|
9350
10348
|
});
|
|
9351
10349
|
return {
|
|
9352
10350
|
data: CreateConnectionItemSchema.parse({
|
|
9353
10351
|
id: fresh.id,
|
|
9354
|
-
app:
|
|
10352
|
+
app: start2.app,
|
|
9355
10353
|
title: fresh.title ?? null
|
|
9356
10354
|
})
|
|
9357
10355
|
};
|
|
@@ -10287,21 +11285,21 @@ var updateTableRecordsPlugin = definePlugin(
|
|
|
10287
11285
|
);
|
|
10288
11286
|
|
|
10289
11287
|
// src/plugins/capabilities/index.ts
|
|
10290
|
-
function toDescription(
|
|
10291
|
-
const words =
|
|
11288
|
+
function toDescription(key2) {
|
|
11289
|
+
const words = key2.replace(/^can/, "").replace(/([A-Z])/g, " $1").trim().toLowerCase();
|
|
10292
11290
|
return `To ${words}`;
|
|
10293
11291
|
}
|
|
10294
|
-
function toEnvVar(
|
|
10295
|
-
return "ZAPIER_" +
|
|
11292
|
+
function toEnvVar(key2) {
|
|
11293
|
+
return "ZAPIER_" + key2.replace(/([A-Z])/g, "_$1").toUpperCase();
|
|
10296
11294
|
}
|
|
10297
|
-
function toCliFlag(
|
|
10298
|
-
return "--" +
|
|
11295
|
+
function toCliFlag(key2) {
|
|
11296
|
+
return "--" + key2.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
10299
11297
|
}
|
|
10300
|
-
function buildCapabilityMessage(
|
|
11298
|
+
function buildCapabilityMessage(key2) {
|
|
10301
11299
|
return [
|
|
10302
|
-
`${toDescription(
|
|
10303
|
-
`set ${
|
|
10304
|
-
`or set ${toEnvVar(
|
|
11300
|
+
`${toDescription(key2)}, use ${toCliFlag(key2)} in the CLI,`,
|
|
11301
|
+
`set ${key2}: true in SDK options or .zapierrc,`,
|
|
11302
|
+
`or set ${toEnvVar(key2)}=true.`
|
|
10305
11303
|
].join(" ");
|
|
10306
11304
|
}
|
|
10307
11305
|
var GATED_FLAGS = [
|
|
@@ -10309,8 +11307,8 @@ var GATED_FLAGS = [
|
|
|
10309
11307
|
"canIncludeSharedTables",
|
|
10310
11308
|
"canDeleteTables"
|
|
10311
11309
|
];
|
|
10312
|
-
function isEnabledByEnv(
|
|
10313
|
-
const value = globalThis.process?.env?.[toEnvVar(
|
|
11310
|
+
function isEnabledByEnv(key2) {
|
|
11311
|
+
const value = globalThis.process?.env?.[toEnvVar(key2)];
|
|
10314
11312
|
if (value === void 0) return void 0;
|
|
10315
11313
|
if (value === "true" || value === "1") return true;
|
|
10316
11314
|
if (value === "false" || value === "0") return false;
|
|
@@ -10333,17 +11331,17 @@ var capabilitiesPlugin = definePlugin(
|
|
|
10333
11331
|
}
|
|
10334
11332
|
return {
|
|
10335
11333
|
context: {
|
|
10336
|
-
checkCapability: async (
|
|
11334
|
+
checkCapability: async (key2) => {
|
|
10337
11335
|
const flags = await resolveFlags();
|
|
10338
|
-
if (flags[
|
|
11336
|
+
if (flags[key2]) return;
|
|
10339
11337
|
throw new ZapierConfigurationError(
|
|
10340
|
-
buildCapabilityMessage(
|
|
10341
|
-
{ configType:
|
|
11338
|
+
buildCapabilityMessage(key2) + " (If you are an AI agent, you MUST NOT retry. Ask the user if they want to enable this.)",
|
|
11339
|
+
{ configType: key2 }
|
|
10342
11340
|
);
|
|
10343
11341
|
},
|
|
10344
|
-
hasCapability: async (
|
|
11342
|
+
hasCapability: async (key2) => {
|
|
10345
11343
|
const flags = await resolveFlags();
|
|
10346
|
-
return flags[
|
|
11344
|
+
return flags[key2];
|
|
10347
11345
|
}
|
|
10348
11346
|
}
|
|
10349
11347
|
};
|
|
@@ -10501,8 +11499,8 @@ function getOsInfo() {
|
|
|
10501
11499
|
function getPlatformVersions() {
|
|
10502
11500
|
const versions = {};
|
|
10503
11501
|
if (typeof globalThis.process?.versions === "object") {
|
|
10504
|
-
for (const [
|
|
10505
|
-
versions[
|
|
11502
|
+
for (const [key2, value] of Object.entries(globalThis.process.versions)) {
|
|
11503
|
+
versions[key2] = value || null;
|
|
10506
11504
|
}
|
|
10507
11505
|
}
|
|
10508
11506
|
return versions;
|
|
@@ -10744,9 +11742,9 @@ async function emitWithTimeout(transport, subject, event) {
|
|
|
10744
11742
|
}
|
|
10745
11743
|
function mergeUserContext(event, userContext) {
|
|
10746
11744
|
const merged = { ...event };
|
|
10747
|
-
for (const [
|
|
10748
|
-
if (merged[
|
|
10749
|
-
merged[
|
|
11745
|
+
for (const [key2, value] of Object.entries(userContext)) {
|
|
11746
|
+
if (merged[key2] == null) {
|
|
11747
|
+
merged[key2] = value;
|
|
10750
11748
|
}
|
|
10751
11749
|
}
|
|
10752
11750
|
return merged;
|
|
@@ -11249,4 +12247,4 @@ var registryPlugin = definePlugin((_sdk) => {
|
|
|
11249
12247
|
return {};
|
|
11250
12248
|
});
|
|
11251
12249
|
|
|
11252
|
-
export { ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthMechanism, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MS, CORE_ERROR_SYMBOL, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CoreErrorCode, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_APPROVAL_TIMEOUT_MS, DEFAULT_CONFIG_PATH, DEFAULT_MAX_APPROVAL_RETRIES, DEFAULT_PAGE_SIZE, DebugPropertySchema, FieldsPropertySchema, InputFieldPropertySchema, InputsPropertySchema, LeaseLimitPropertySchema, LeasePropertySchema, LeaseSecondsPropertySchema, LimitPropertySchema, MAX_CONCURRENCY_LIMIT, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, TablePropertySchema, TablesPropertySchema, TriggerInboxNamePropertySchema, TriggerInboxPropertySchema, ZAPIER_BASE_URL, ZAPIER_MAX_CONCURRENT_REQUESTS, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZapierAbortDrainSignal, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierApprovalError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierConflictError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierReleaseTriggerMessageSignal, ZapierResourceNotFoundError, ZapierSignal, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, addPlugin, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, cleanupEventListeners, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, composePlugins, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, createBaseEvent, createClientCredentialsPlugin, createCorePlugin, createFunction, createMemoryCache, createOptionsPlugin, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierApi, createZapierCoreStack, createZapierSdk, createZapierSdkStack, createZapierSdkWithoutRegistry, dangerousContextPlugin, declareMethod, declareProperty, defineLegacyMerge, defineMethod, definePlugin, defineProperty, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, durableRunIdResolver, eventEmissionPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, fromFunctionPlugin, generateEventId, getActionInputFieldsSchemaPlugin, getActionPlugin, getAgent, getAppPlugin, getBaseUrlFromCredentials, getCallerContext, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getContext, getCoreErrorCause, getCoreErrorCode, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOrCreateApiClient, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getTtyContext, getZapierApprovalMode, getZapierDefaultApprovalMode, getZapierOpenAutoModeApprovalsInBrowser, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCoreError, isCredentialsFunction, isCredentialsObject, isPermanentHttpError, isPkceCredentials, isPositional, listActionInputFieldChoicesPlugin, listActionInputFieldsPlugin, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation2 as logDeprecation, manifestPlugin, parseConcurrencyEnvVar, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings2 as resetDeprecationWarnings, resolveAuth, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, runInMethodScope, runWithCallerContext, runWithTelemetryContext, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, triggerInboxResolver, triggerMessagesResolver, updateTableRecordsPlugin, workflowIdResolver, workflowRunIdResolver, workflowVersionIdResolver, zapierAdaptError, zapierSdkPlugin };
|
|
12250
|
+
export { ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthMechanism, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MS, CORE_ERROR_SYMBOL, CORE_SIGNAL_SYMBOL, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CoreCancelledSignal, CoreErrorCode, CoreSignal, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MS, DEFAULT_APPROVAL_TIMEOUT_MS, DEFAULT_CONFIG_PATH, DEFAULT_MAX_APPROVAL_RETRIES, DEFAULT_PAGE_SIZE, DEPRECATION_NOTICE_EVENT, DebugPropertySchema, FieldsPropertySchema, InputFieldPropertySchema, InputsPropertySchema, LeaseLimitPropertySchema, LeasePropertySchema, LeaseSecondsPropertySchema, LimitPropertySchema, MAX_CONCURRENCY_LIMIT, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, TablePropertySchema, TablesPropertySchema, TriggerInboxNamePropertySchema, TriggerInboxPropertySchema, ZAPIER_BASE_URL, ZAPIER_MAX_CONCURRENT_REQUESTS, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MS, ZapierAbortDrainSignal, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierApprovalError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierConflictError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierReleaseTriggerMessageSignal, ZapierResourceNotFoundError, ZapierSignal, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, addPlugin, apiPlugin, appKeyResolver, appsPlugin, connectionIdGenericResolver as authenticationIdGenericResolver, connectionIdResolver as authenticationIdResolver, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, cleanupEventListeners, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, composePlugins, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, createBaseEvent, createClientCredentialsPlugin, createController, createCorePlugin, createFunction, createMemoryCache, createOptionsPlugin, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierApi, createZapierCoreStack, createZapierSdk, createZapierSdkStack, createZapierSdkWithoutRegistry, dangerousContextPlugin, declareMethod, declareProperty, defineLegacyMerge, defineMethod, definePlugin, defineProperty, defineResolver, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, durableRunIdResolver, eventEmissionPlugin, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, fromFunctionPlugin, generateEventId, getActionInputFieldsSchemaPlugin, getActionPlugin, getAgent, getAppPlugin, getBaseUrlFromCredentials, getCallerContext, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getContext, getCoreErrorCause, getCoreErrorCode, getCpuTime, getCurrentTimestamp, getMemoryUsage, getOrCreateApiClient, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getTtyContext, getZapierApprovalMode, getZapierDefaultApprovalMode, getZapierOpenAutoModeApprovalsInBrowser, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCoreError, isCoreSignal, isCredentialsFunction, isCredentialsObject, isPermanentHttpError, isPkceCredentials, isPositional, listActionInputFieldChoicesPlugin, listActionInputFieldsPlugin, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation2 as logDeprecation, manifestPlugin, parseConcurrencyEnvVar, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings2 as resetDeprecationWarnings, resolveAuth, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, runActionPlugin, runInMethodScope, runWithCallerContext, runWithTelemetryContext, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, triggerInboxResolver, triggerMessagesResolver, updateTableRecordsPlugin, workflowIdResolver, workflowRunIdResolver, workflowVersionIdResolver, zapierAdaptError, zapierSdkPlugin };
|