@zapier/zapier-sdk 0.79.0 → 0.80.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/experimental.cjs +1015 -167
- package/dist/experimental.d.mts +2 -2
- package/dist/experimental.d.ts +2 -2
- package/dist/experimental.mjs +1010 -168
- package/dist/{index-DgX1b0Sv.d.mts → index-DEQqvs2r.d.mts} +607 -62
- package/dist/{index-DgX1b0Sv.d.ts → index-DEQqvs2r.d.ts} +607 -62
- package/dist/index.cjs +1009 -161
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1004 -162
- package/package.json +2 -2
package/dist/experimental.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: {
|
|
@@ -2823,8 +3663,8 @@ function normalizeHeaders(optionsHeaders) {
|
|
|
2823
3663
|
return headers;
|
|
2824
3664
|
}
|
|
2825
3665
|
const headerEntries = optionsHeaders instanceof Headers ? Array.from(optionsHeaders.entries()) : Array.isArray(optionsHeaders) ? optionsHeaders : Object.entries(optionsHeaders);
|
|
2826
|
-
for (const [
|
|
2827
|
-
headers[
|
|
3666
|
+
for (const [key2, value] of headerEntries) {
|
|
3667
|
+
headers[key2] = value;
|
|
2828
3668
|
}
|
|
2829
3669
|
return headers;
|
|
2830
3670
|
}
|
|
@@ -3114,28 +3954,28 @@ function censorHeaders(headers) {
|
|
|
3114
3954
|
if (!headers) return headers;
|
|
3115
3955
|
const headersObj = new Headers(headers);
|
|
3116
3956
|
const authKeys = ["authorization", "x-api-key"];
|
|
3117
|
-
for (const [
|
|
3118
|
-
if (authKeys.some((authKey) =>
|
|
3957
|
+
for (const [key2, value] of headersObj.entries()) {
|
|
3958
|
+
if (authKeys.some((authKey) => key2.toLowerCase() === authKey)) {
|
|
3119
3959
|
const spaceIndex = value.indexOf(" ");
|
|
3120
3960
|
if (spaceIndex > 0 && spaceIndex < value.length - 1) {
|
|
3121
3961
|
const prefix = value.substring(0, spaceIndex + 1);
|
|
3122
3962
|
const token = value.substring(spaceIndex + 1);
|
|
3123
3963
|
if (token.length > 12) {
|
|
3124
|
-
const
|
|
3964
|
+
const start2 = token.substring(0, 4);
|
|
3125
3965
|
const end = token.substring(token.length - 4);
|
|
3126
|
-
headersObj.set(
|
|
3966
|
+
headersObj.set(key2, `${prefix}${start2}...${end}`);
|
|
3127
3967
|
} else {
|
|
3128
3968
|
const firstChar = token.charAt(0);
|
|
3129
|
-
headersObj.set(
|
|
3969
|
+
headersObj.set(key2, `${prefix}${firstChar}...`);
|
|
3130
3970
|
}
|
|
3131
3971
|
} else {
|
|
3132
3972
|
if (value.length > 12) {
|
|
3133
|
-
const
|
|
3973
|
+
const start2 = value.substring(0, 4);
|
|
3134
3974
|
const end = value.substring(value.length - 4);
|
|
3135
|
-
headersObj.set(
|
|
3975
|
+
headersObj.set(key2, `${start2}...${end}`);
|
|
3136
3976
|
} else {
|
|
3137
3977
|
const firstChar = value.charAt(0);
|
|
3138
|
-
headersObj.set(
|
|
3978
|
+
headersObj.set(key2, `${firstChar}...`);
|
|
3139
3979
|
}
|
|
3140
3980
|
}
|
|
3141
3981
|
}
|
|
@@ -3704,21 +4544,21 @@ function getClientIdFromCredentials(credentials) {
|
|
|
3704
4544
|
function createMemoryCache() {
|
|
3705
4545
|
const store = /* @__PURE__ */ new Map();
|
|
3706
4546
|
return {
|
|
3707
|
-
async get(
|
|
3708
|
-
const entry = store.get(
|
|
4547
|
+
async get(key2) {
|
|
4548
|
+
const entry = store.get(key2);
|
|
3709
4549
|
if (!entry) return void 0;
|
|
3710
4550
|
if (entry.expiresAt !== void 0 && entry.expiresAt <= Date.now()) {
|
|
3711
|
-
store.delete(
|
|
4551
|
+
store.delete(key2);
|
|
3712
4552
|
return void 0;
|
|
3713
4553
|
}
|
|
3714
4554
|
return { value: entry.value, expiresAt: entry.expiresAt };
|
|
3715
4555
|
},
|
|
3716
|
-
async set(
|
|
4556
|
+
async set(key2, value, options) {
|
|
3717
4557
|
const expiresAt = options?.ttl ? Date.now() + options.ttl * 1e3 : void 0;
|
|
3718
|
-
store.set(
|
|
4558
|
+
store.set(key2, { value, expiresAt });
|
|
3719
4559
|
},
|
|
3720
|
-
async delete(
|
|
3721
|
-
store.delete(
|
|
4560
|
+
async delete(key2) {
|
|
4561
|
+
store.delete(key2);
|
|
3722
4562
|
}
|
|
3723
4563
|
};
|
|
3724
4564
|
}
|
|
@@ -4209,14 +5049,14 @@ function createSseParserStream() {
|
|
|
4209
5049
|
transform(chunk, controller) {
|
|
4210
5050
|
buffer += chunk;
|
|
4211
5051
|
const newline = /\r\n|\r|\n/g;
|
|
4212
|
-
let
|
|
5052
|
+
let start2 = 0;
|
|
4213
5053
|
let match;
|
|
4214
5054
|
while ((match = newline.exec(buffer)) !== null) {
|
|
4215
5055
|
if (match[0] === "\r" && match.index === buffer.length - 1) break;
|
|
4216
|
-
processLine(buffer.slice(
|
|
4217
|
-
|
|
5056
|
+
processLine(buffer.slice(start2, match.index), controller);
|
|
5057
|
+
start2 = match.index + match[0].length;
|
|
4218
5058
|
}
|
|
4219
|
-
buffer = buffer.slice(
|
|
5059
|
+
buffer = buffer.slice(start2);
|
|
4220
5060
|
},
|
|
4221
5061
|
flush(controller) {
|
|
4222
5062
|
if (buffer.endsWith("\r")) {
|
|
@@ -4374,7 +5214,7 @@ function parseDeprecationDate(value) {
|
|
|
4374
5214
|
}
|
|
4375
5215
|
|
|
4376
5216
|
// src/sdk-version.ts
|
|
4377
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.
|
|
5217
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.80.1" : void 0) || "unknown";
|
|
4378
5218
|
|
|
4379
5219
|
// src/utils/open-url.ts
|
|
4380
5220
|
var nodePrefix = "node:";
|
|
@@ -4620,11 +5460,11 @@ var ZapierApiClient = class {
|
|
|
4620
5460
|
);
|
|
4621
5461
|
const inputHeaders = new Headers(init?.headers ?? {});
|
|
4622
5462
|
const mergedHeaders = new Headers();
|
|
4623
|
-
builtHeaders.forEach((value,
|
|
4624
|
-
mergedHeaders.set(
|
|
5463
|
+
builtHeaders.forEach((value, key2) => {
|
|
5464
|
+
mergedHeaders.set(key2, value);
|
|
4625
5465
|
});
|
|
4626
|
-
inputHeaders.forEach((value,
|
|
4627
|
-
mergedHeaders.set(
|
|
5466
|
+
inputHeaders.forEach((value, key2) => {
|
|
5467
|
+
mergedHeaders.set(key2, value);
|
|
4628
5468
|
});
|
|
4629
5469
|
this.applyTelemetryHeaders(mergedHeaders);
|
|
4630
5470
|
let retries = 0;
|
|
@@ -5149,8 +5989,8 @@ var ZapierApiClient = class {
|
|
|
5149
5989
|
canSendDeprecationMessaging
|
|
5150
5990
|
} = this.applyPathConfiguration(path);
|
|
5151
5991
|
if (searchParams) {
|
|
5152
|
-
Object.entries(searchParams).forEach(([
|
|
5153
|
-
url.searchParams.set(
|
|
5992
|
+
Object.entries(searchParams).forEach(([key2, value]) => {
|
|
5993
|
+
url.searchParams.set(key2, value);
|
|
5154
5994
|
});
|
|
5155
5995
|
}
|
|
5156
5996
|
return {
|
|
@@ -5660,7 +6500,8 @@ function getOrCreateApiClient(config) {
|
|
|
5660
6500
|
token,
|
|
5661
6501
|
api: providedApi,
|
|
5662
6502
|
debug = false,
|
|
5663
|
-
fetch: customFetch
|
|
6503
|
+
fetch: customFetch,
|
|
6504
|
+
callerPackage
|
|
5664
6505
|
} = config;
|
|
5665
6506
|
if (providedApi) {
|
|
5666
6507
|
return providedApi;
|
|
@@ -5670,7 +6511,8 @@ function getOrCreateApiClient(config) {
|
|
|
5670
6511
|
credentials,
|
|
5671
6512
|
token,
|
|
5672
6513
|
debug,
|
|
5673
|
-
fetch: customFetch
|
|
6514
|
+
fetch: customFetch,
|
|
6515
|
+
callerPackage
|
|
5674
6516
|
});
|
|
5675
6517
|
}
|
|
5676
6518
|
|
|
@@ -5801,7 +6643,7 @@ var listAppsPlugin = definePlugin(
|
|
|
5801
6643
|
locator
|
|
5802
6644
|
];
|
|
5803
6645
|
}
|
|
5804
|
-
const duplicatedLookupAppKeys = Object.keys(implementationNameToLocator).filter((
|
|
6646
|
+
const duplicatedLookupAppKeys = Object.keys(implementationNameToLocator).filter((key2) => implementationNameToLocator[key2].length > 1).map((key2) => implementationNameToLocator[key2]).flat().map((locator) => locator.lookupAppKey);
|
|
5805
6647
|
if (duplicatedLookupAppKeys.length > 0) {
|
|
5806
6648
|
throw new Error(
|
|
5807
6649
|
`Duplicate lookup app keys found: ${duplicatedLookupAppKeys.join(", ")}`
|
|
@@ -6294,7 +7136,7 @@ function formatRecordError(fieldId, err) {
|
|
|
6294
7136
|
function formatResponseError(err) {
|
|
6295
7137
|
const message = err.human_title || err.title || "Unknown error";
|
|
6296
7138
|
if (err.meta && Object.keys(err.meta).length > 0) {
|
|
6297
|
-
const metaParts = Object.entries(err.meta).map(([
|
|
7139
|
+
const metaParts = Object.entries(err.meta).map(([key2, val]) => `${key2}: ${JSON.stringify(val)}`).join(", ");
|
|
6298
7140
|
return `${message} (${metaParts})`;
|
|
6299
7141
|
}
|
|
6300
7142
|
return message;
|
|
@@ -6329,8 +7171,8 @@ var TrashSchema = z.enum(["exclude", "include", "only"]).optional().describe(
|
|
|
6329
7171
|
'Control soft-deleted item visibility. "exclude" (default) returns active items only, "include" returns both active and soft-deleted, "only" returns soft-deleted items only.'
|
|
6330
7172
|
);
|
|
6331
7173
|
var FIELD_ID_PATTERN = /^f\d+$/;
|
|
6332
|
-
function isFieldId(
|
|
6333
|
-
return FIELD_ID_PATTERN.test(
|
|
7174
|
+
function isFieldId(key2) {
|
|
7175
|
+
return FIELD_ID_PATTERN.test(key2);
|
|
6334
7176
|
}
|
|
6335
7177
|
var NESTED_COMPONENTS = {
|
|
6336
7178
|
labeled_string: /* @__PURE__ */ new Set(["value"]),
|
|
@@ -6368,7 +7210,7 @@ async function resolveFieldKeys({
|
|
|
6368
7210
|
fieldKeys
|
|
6369
7211
|
}) {
|
|
6370
7212
|
const allAreIds = fieldKeys.every(
|
|
6371
|
-
(
|
|
7213
|
+
(key2) => typeof key2 === "number" || /^(f?\d+)$/.test(key2)
|
|
6372
7214
|
);
|
|
6373
7215
|
if (allAreIds) {
|
|
6374
7216
|
return fieldKeys.map(toNumericFieldId);
|
|
@@ -6377,13 +7219,13 @@ async function resolveFieldKeys({
|
|
|
6377
7219
|
if (!mapping) {
|
|
6378
7220
|
return fieldKeys.map(toNumericFieldId);
|
|
6379
7221
|
}
|
|
6380
|
-
return fieldKeys.map((
|
|
6381
|
-
if (typeof
|
|
6382
|
-
if (FIELD_ID_PATTERN.test(
|
|
6383
|
-
const id = mapping.nameToId.get(
|
|
7222
|
+
return fieldKeys.map((key2) => {
|
|
7223
|
+
if (typeof key2 === "number") return key2;
|
|
7224
|
+
if (FIELD_ID_PATTERN.test(key2)) return toNumericFieldId(key2);
|
|
7225
|
+
const id = mapping.nameToId.get(key2);
|
|
6384
7226
|
if (!id) {
|
|
6385
7227
|
throw new ZapierValidationError(
|
|
6386
|
-
`Unknown field name: "${
|
|
7228
|
+
`Unknown field name: "${key2}". Use a valid field name or ID.`
|
|
6387
7229
|
);
|
|
6388
7230
|
}
|
|
6389
7231
|
return toNumericFieldId(id);
|
|
@@ -6399,13 +7241,13 @@ async function createFieldKeyTranslator({
|
|
|
6399
7241
|
translateInput(data) {
|
|
6400
7242
|
if (!mapping) return data;
|
|
6401
7243
|
const result = {};
|
|
6402
|
-
for (const [
|
|
6403
|
-
if (FIELD_ID_PATTERN.test(
|
|
6404
|
-
result[
|
|
6405
|
-
} else if (mapping.nameToId.has(
|
|
6406
|
-
result[mapping.nameToId.get(
|
|
7244
|
+
for (const [key2, value] of Object.entries(data)) {
|
|
7245
|
+
if (FIELD_ID_PATTERN.test(key2) && mapping.idToName.has(key2)) {
|
|
7246
|
+
result[key2] = value;
|
|
7247
|
+
} else if (mapping.nameToId.has(key2)) {
|
|
7248
|
+
result[mapping.nameToId.get(key2)] = value;
|
|
6407
7249
|
} else {
|
|
6408
|
-
result[
|
|
7250
|
+
result[key2] = value;
|
|
6409
7251
|
}
|
|
6410
7252
|
}
|
|
6411
7253
|
return result;
|
|
@@ -6413,29 +7255,29 @@ async function createFieldKeyTranslator({
|
|
|
6413
7255
|
translateOutput(data) {
|
|
6414
7256
|
if (!mapping) return data;
|
|
6415
7257
|
const result = {};
|
|
6416
|
-
for (const [
|
|
6417
|
-
if (mapping.idToName.has(
|
|
6418
|
-
result[mapping.idToName.get(
|
|
7258
|
+
for (const [key2, value] of Object.entries(data)) {
|
|
7259
|
+
if (mapping.idToName.has(key2)) {
|
|
7260
|
+
result[mapping.idToName.get(key2)] = value;
|
|
6419
7261
|
} else {
|
|
6420
|
-
result[
|
|
7262
|
+
result[key2] = value;
|
|
6421
7263
|
}
|
|
6422
7264
|
}
|
|
6423
7265
|
return result;
|
|
6424
7266
|
},
|
|
6425
|
-
translateFieldKey(
|
|
6426
|
-
if (!mapping) return
|
|
6427
|
-
if (FIELD_ID_PATTERN.test(
|
|
6428
|
-
const fieldType = mapping.idToType.get(
|
|
7267
|
+
translateFieldKey(key2) {
|
|
7268
|
+
if (!mapping) return key2;
|
|
7269
|
+
if (FIELD_ID_PATTERN.test(key2) && mapping.idToName.has(key2)) {
|
|
7270
|
+
const fieldType = mapping.idToType.get(key2);
|
|
6429
7271
|
if (fieldType) {
|
|
6430
7272
|
const components = NESTED_COMPONENTS[fieldType];
|
|
6431
7273
|
if (components?.size === 1) {
|
|
6432
|
-
return `${
|
|
7274
|
+
return `${key2}__${[...components][0]}`;
|
|
6433
7275
|
}
|
|
6434
7276
|
}
|
|
6435
|
-
return
|
|
7277
|
+
return key2;
|
|
6436
7278
|
}
|
|
6437
|
-
if (mapping.nameToId.has(
|
|
6438
|
-
const fieldId = mapping.nameToId.get(
|
|
7279
|
+
if (mapping.nameToId.has(key2)) {
|
|
7280
|
+
const fieldId = mapping.nameToId.get(key2);
|
|
6439
7281
|
const fieldType = mapping.idToType.get(fieldId);
|
|
6440
7282
|
if (fieldType) {
|
|
6441
7283
|
const components = NESTED_COMPONENTS[fieldType];
|
|
@@ -6445,10 +7287,10 @@ async function createFieldKeyTranslator({
|
|
|
6445
7287
|
}
|
|
6446
7288
|
return fieldId;
|
|
6447
7289
|
}
|
|
6448
|
-
const sepIndex =
|
|
7290
|
+
const sepIndex = key2.lastIndexOf("__");
|
|
6449
7291
|
if (sepIndex > 0) {
|
|
6450
|
-
const prefix =
|
|
6451
|
-
const component =
|
|
7292
|
+
const prefix = key2.slice(0, sepIndex);
|
|
7293
|
+
const component = key2.slice(sepIndex + 2);
|
|
6452
7294
|
let fieldId;
|
|
6453
7295
|
if (FIELD_ID_PATTERN.test(prefix) && mapping.idToName.has(prefix)) {
|
|
6454
7296
|
fieldId = prefix;
|
|
@@ -6462,7 +7304,7 @@ async function createFieldKeyTranslator({
|
|
|
6462
7304
|
}
|
|
6463
7305
|
}
|
|
6464
7306
|
}
|
|
6465
|
-
return
|
|
7307
|
+
return key2;
|
|
6466
7308
|
}
|
|
6467
7309
|
};
|
|
6468
7310
|
}
|
|
@@ -7379,9 +8221,9 @@ var RunActionSchemaDeprecated = z.object({
|
|
|
7379
8221
|
var RunActionInputSchema = z.union([RunActionSchema, RunActionSchemaDeprecated]).describe(RunActionDescription);
|
|
7380
8222
|
|
|
7381
8223
|
// src/formatters/actionResult.ts
|
|
7382
|
-
function getStringProperty(obj,
|
|
7383
|
-
if (typeof obj === "object" && obj !== null &&
|
|
7384
|
-
const value = obj[
|
|
8224
|
+
function getStringProperty(obj, key2) {
|
|
8225
|
+
if (typeof obj === "object" && obj !== null && key2 in obj) {
|
|
8226
|
+
const value = obj[key2];
|
|
7385
8227
|
return typeof value === "string" ? value : void 0;
|
|
7386
8228
|
}
|
|
7387
8229
|
return void 0;
|
|
@@ -7468,13 +8310,13 @@ var runActionPlugin = definePlugin(
|
|
|
7468
8310
|
let oldestKey;
|
|
7469
8311
|
let oldestExpiry = Infinity;
|
|
7470
8312
|
let evictedAny = false;
|
|
7471
|
-
for (const [
|
|
8313
|
+
for (const [key2, entry] of runActionContextCache) {
|
|
7472
8314
|
if (now >= entry.expiresAt) {
|
|
7473
|
-
runActionContextCache.delete(
|
|
8315
|
+
runActionContextCache.delete(key2);
|
|
7474
8316
|
evictedAny = true;
|
|
7475
8317
|
} else if (entry.expiresAt < oldestExpiry) {
|
|
7476
8318
|
oldestExpiry = entry.expiresAt;
|
|
7477
|
-
oldestKey =
|
|
8319
|
+
oldestKey = key2;
|
|
7478
8320
|
}
|
|
7479
8321
|
}
|
|
7480
8322
|
if (!evictedAny && oldestKey) {
|
|
@@ -8102,36 +8944,36 @@ var createConnectionPlugin = definePlugin(
|
|
|
8102
8944
|
sdk: inner,
|
|
8103
8945
|
options
|
|
8104
8946
|
}) => {
|
|
8105
|
-
const { data:
|
|
8947
|
+
const { data: start2 } = await inner.getConnectionStartUrl({
|
|
8106
8948
|
app: options.app
|
|
8107
8949
|
});
|
|
8108
|
-
setMethodMetadata({ selectedApi:
|
|
8950
|
+
setMethodMetadata({ selectedApi: start2.app });
|
|
8109
8951
|
console.error(
|
|
8110
8952
|
`
|
|
8111
8953
|
Open this URL to complete the connection:
|
|
8112
|
-
${
|
|
8954
|
+
${start2.url}
|
|
8113
8955
|
`
|
|
8114
8956
|
);
|
|
8115
8957
|
const shouldOpen = options.browser === "always" || options.browser === "auto" && shouldOpenBrowser();
|
|
8116
8958
|
if (shouldOpen) {
|
|
8117
8959
|
try {
|
|
8118
|
-
await open_url_default(
|
|
8960
|
+
await open_url_default(start2.url);
|
|
8119
8961
|
} catch {
|
|
8120
8962
|
}
|
|
8121
8963
|
}
|
|
8122
8964
|
const { data: fresh } = await inner.waitForNewConnection({
|
|
8123
|
-
app:
|
|
8965
|
+
app: start2.app,
|
|
8124
8966
|
// Server-stamped mint time: measured on the same clock as a
|
|
8125
8967
|
// connection's `date`, so the freshness check is immune to
|
|
8126
8968
|
// client/server clock skew.
|
|
8127
|
-
startedAt:
|
|
8969
|
+
startedAt: start2.startedAt,
|
|
8128
8970
|
timeoutMs: options.timeoutMs,
|
|
8129
8971
|
pollIntervalMs: options.pollIntervalMs
|
|
8130
8972
|
});
|
|
8131
8973
|
return {
|
|
8132
8974
|
data: CreateConnectionItemSchema.parse({
|
|
8133
8975
|
id: fresh.id,
|
|
8134
|
-
app:
|
|
8976
|
+
app: start2.app,
|
|
8135
8977
|
title: fresh.title ?? null
|
|
8136
8978
|
})
|
|
8137
8979
|
};
|
|
@@ -10130,9 +10972,9 @@ function findManifestEntry({
|
|
|
10130
10972
|
return [slug, manifest.apps[slug]];
|
|
10131
10973
|
}
|
|
10132
10974
|
}
|
|
10133
|
-
for (const [
|
|
10975
|
+
for (const [key2, entry] of Object.entries(manifest.apps)) {
|
|
10134
10976
|
if (entry.implementationName === appKeyWithoutVersion) {
|
|
10135
|
-
return [
|
|
10977
|
+
return [key2, entry];
|
|
10136
10978
|
}
|
|
10137
10979
|
}
|
|
10138
10980
|
return null;
|
|
@@ -10389,21 +11231,21 @@ var manifestPlugin = definePlugin(
|
|
|
10389
11231
|
);
|
|
10390
11232
|
|
|
10391
11233
|
// src/plugins/capabilities/index.ts
|
|
10392
|
-
function toDescription(
|
|
10393
|
-
const words =
|
|
11234
|
+
function toDescription(key2) {
|
|
11235
|
+
const words = key2.replace(/^can/, "").replace(/([A-Z])/g, " $1").trim().toLowerCase();
|
|
10394
11236
|
return `To ${words}`;
|
|
10395
11237
|
}
|
|
10396
|
-
function toEnvVar(
|
|
10397
|
-
return "ZAPIER_" +
|
|
11238
|
+
function toEnvVar(key2) {
|
|
11239
|
+
return "ZAPIER_" + key2.replace(/([A-Z])/g, "_$1").toUpperCase();
|
|
10398
11240
|
}
|
|
10399
|
-
function toCliFlag(
|
|
10400
|
-
return "--" +
|
|
11241
|
+
function toCliFlag(key2) {
|
|
11242
|
+
return "--" + key2.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
10401
11243
|
}
|
|
10402
|
-
function buildCapabilityMessage(
|
|
11244
|
+
function buildCapabilityMessage(key2) {
|
|
10403
11245
|
return [
|
|
10404
|
-
`${toDescription(
|
|
10405
|
-
`set ${
|
|
10406
|
-
`or set ${toEnvVar(
|
|
11246
|
+
`${toDescription(key2)}, use ${toCliFlag(key2)} in the CLI,`,
|
|
11247
|
+
`set ${key2}: true in SDK options or .zapierrc,`,
|
|
11248
|
+
`or set ${toEnvVar(key2)}=true.`
|
|
10407
11249
|
].join(" ");
|
|
10408
11250
|
}
|
|
10409
11251
|
var GATED_FLAGS = [
|
|
@@ -10411,8 +11253,8 @@ var GATED_FLAGS = [
|
|
|
10411
11253
|
"canIncludeSharedTables",
|
|
10412
11254
|
"canDeleteTables"
|
|
10413
11255
|
];
|
|
10414
|
-
function isEnabledByEnv(
|
|
10415
|
-
const value = globalThis.process?.env?.[toEnvVar(
|
|
11256
|
+
function isEnabledByEnv(key2) {
|
|
11257
|
+
const value = globalThis.process?.env?.[toEnvVar(key2)];
|
|
10416
11258
|
if (value === void 0) return void 0;
|
|
10417
11259
|
if (value === "true" || value === "1") return true;
|
|
10418
11260
|
if (value === "false" || value === "0") return false;
|
|
@@ -10435,17 +11277,17 @@ var capabilitiesPlugin = definePlugin(
|
|
|
10435
11277
|
}
|
|
10436
11278
|
return {
|
|
10437
11279
|
context: {
|
|
10438
|
-
checkCapability: async (
|
|
11280
|
+
checkCapability: async (key2) => {
|
|
10439
11281
|
const flags = await resolveFlags();
|
|
10440
|
-
if (flags[
|
|
11282
|
+
if (flags[key2]) return;
|
|
10441
11283
|
throw new ZapierConfigurationError(
|
|
10442
|
-
buildCapabilityMessage(
|
|
10443
|
-
{ configType:
|
|
11284
|
+
buildCapabilityMessage(key2) + " (If you are an AI agent, you MUST NOT retry. Ask the user if they want to enable this.)",
|
|
11285
|
+
{ configType: key2 }
|
|
10444
11286
|
);
|
|
10445
11287
|
},
|
|
10446
|
-
hasCapability: async (
|
|
11288
|
+
hasCapability: async (key2) => {
|
|
10447
11289
|
const flags = await resolveFlags();
|
|
10448
|
-
return flags[
|
|
11290
|
+
return flags[key2];
|
|
10449
11291
|
}
|
|
10450
11292
|
}
|
|
10451
11293
|
};
|
|
@@ -10603,8 +11445,8 @@ function getOsInfo() {
|
|
|
10603
11445
|
function getPlatformVersions() {
|
|
10604
11446
|
const versions = {};
|
|
10605
11447
|
if (typeof globalThis.process?.versions === "object") {
|
|
10606
|
-
for (const [
|
|
10607
|
-
versions[
|
|
11448
|
+
for (const [key2, value] of Object.entries(globalThis.process.versions)) {
|
|
11449
|
+
versions[key2] = value || null;
|
|
10608
11450
|
}
|
|
10609
11451
|
}
|
|
10610
11452
|
return versions;
|
|
@@ -10846,9 +11688,9 @@ async function emitWithTimeout(transport, subject, event) {
|
|
|
10846
11688
|
}
|
|
10847
11689
|
function mergeUserContext(event, userContext) {
|
|
10848
11690
|
const merged = { ...event };
|
|
10849
|
-
for (const [
|
|
10850
|
-
if (merged[
|
|
10851
|
-
merged[
|
|
11691
|
+
for (const [key2, value] of Object.entries(userContext)) {
|
|
11692
|
+
if (merged[key2] == null) {
|
|
11693
|
+
merged[key2] = value;
|
|
10852
11694
|
}
|
|
10853
11695
|
}
|
|
10854
11696
|
return merged;
|
|
@@ -12121,9 +12963,9 @@ function createWaiter() {
|
|
|
12121
12963
|
}
|
|
12122
12964
|
};
|
|
12123
12965
|
}
|
|
12124
|
-
function addToMap(m,
|
|
12125
|
-
const existing = m.get(
|
|
12126
|
-
m.set(
|
|
12966
|
+
function addToMap(m, key2, value) {
|
|
12967
|
+
const existing = m.get(key2) ?? [];
|
|
12968
|
+
m.set(key2, [...existing, value]);
|
|
12127
12969
|
}
|
|
12128
12970
|
async function runBatchedDrainPipeline(options) {
|
|
12129
12971
|
const {
|
|
@@ -12926,14 +13768,14 @@ function toWireConnections(connections) {
|
|
|
12926
13768
|
}
|
|
12927
13769
|
function toWireAppVersions(appVersions) {
|
|
12928
13770
|
const wire = {};
|
|
12929
|
-
for (const [
|
|
13771
|
+
for (const [key2, entry] of Object.entries(appVersions)) {
|
|
12930
13772
|
const implementationName = entry.implementationName ?? entry.implementation_name;
|
|
12931
13773
|
if (implementationName === void 0) {
|
|
12932
13774
|
throw new ZapierValidationError(
|
|
12933
|
-
`appVersions["${
|
|
13775
|
+
`appVersions["${key2}"] is missing implementationName`
|
|
12934
13776
|
);
|
|
12935
13777
|
}
|
|
12936
|
-
wire[
|
|
13778
|
+
wire[key2] = {
|
|
12937
13779
|
implementation_name: implementationName,
|
|
12938
13780
|
...entry.version !== void 0 ? { version: entry.version } : {}
|
|
12939
13781
|
};
|
|
@@ -14342,4 +15184,4 @@ function createZapierSdk2(options = {}) {
|
|
|
14342
15184
|
);
|
|
14343
15185
|
}
|
|
14344
15186
|
|
|
14345
|
-
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, 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, createCorePlugin, createFunction, createMemoryCache, createOptionsPlugin, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierApi, createZapierCoreStack, createZapierSdk2 as createZapierSdk, createZapierSdkStack2 as 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 };
|
|
15187
|
+
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, createZapierSdk2 as createZapierSdk, createZapierSdkStack2 as 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 };
|