@zapier/zapier-sdk 0.92.1 → 0.94.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 +22 -0
- package/README.md +71 -1
- package/dist/{chunk-WFWTHI2N.cjs → chunk-TQT6EGZU.cjs} +1148 -1005
- package/dist/{chunk-6B4QZVQM.mjs → chunk-XUVZWY2D.mjs} +1145 -1006
- package/dist/experimental.cjs +395 -379
- package/dist/experimental.d.mts +149 -7
- package/dist/experimental.d.ts +149 -7
- package/dist/experimental.mjs +5 -5
- package/dist/{index-CBwO7l3J.d.mts → index-D6jpmIVn.d.mts} +322 -10
- package/dist/{index-CBwO7l3J.d.ts → index-D6jpmIVn.d.ts} +322 -10
- package/dist/index.cjs +288 -272
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
|
@@ -56,6 +56,15 @@ function isPositional(schema) {
|
|
|
56
56
|
}
|
|
57
57
|
return false;
|
|
58
58
|
}
|
|
59
|
+
function getNegatable(schema) {
|
|
60
|
+
const negatable = schema.meta?.()?.negatable;
|
|
61
|
+
if (negatable === true) return true;
|
|
62
|
+
if (typeof negatable === "string" && negatable.length > 0) return negatable;
|
|
63
|
+
if (schema instanceof zod.z.ZodOptional || schema instanceof zod.z.ZodDefault) {
|
|
64
|
+
return getNegatable(schema._zod.def.innerType);
|
|
65
|
+
}
|
|
66
|
+
return void 0;
|
|
67
|
+
}
|
|
59
68
|
function openEnum(values, description) {
|
|
60
69
|
return zod.z.union([zod.z.enum(values), zod.z.string()]).describe(description);
|
|
61
70
|
}
|
|
@@ -4210,6 +4219,7 @@ function getZapierSdkService() {
|
|
|
4210
4219
|
var MAX_PAGE_LIMIT = 1e4;
|
|
4211
4220
|
var DEFAULT_PAGE_SIZE = 100;
|
|
4212
4221
|
var DEFAULT_ACTION_TIMEOUT_MILLISECONDS = 18e4;
|
|
4222
|
+
var ACTION_RUNS_PATH = "/zapier/api/actions/v1/runs";
|
|
4213
4223
|
function parseIntEnvVar(name) {
|
|
4214
4224
|
const value = globalThis.process?.env?.[name];
|
|
4215
4225
|
if (value === void 0) return void 0;
|
|
@@ -6183,7 +6193,7 @@ function parseDeprecationDate(value) {
|
|
|
6183
6193
|
}
|
|
6184
6194
|
|
|
6185
6195
|
// src/sdk-version.ts
|
|
6186
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.
|
|
6196
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.94.0" : void 0) || "unknown";
|
|
6187
6197
|
|
|
6188
6198
|
// src/utils/open-url.ts
|
|
6189
6199
|
var nodePrefix = "node:";
|
|
@@ -7055,7 +7065,7 @@ var ZapierApiClient = class {
|
|
|
7055
7065
|
requiredScopes: options.requiredScopes
|
|
7056
7066
|
});
|
|
7057
7067
|
if (typeof result === "string") {
|
|
7058
|
-
if (result === "" && (method === "DELETE" || response.status === 204)) {
|
|
7068
|
+
if (result === "" && (method === "DELETE" || response.status === 204 || response.status === 202)) {
|
|
7059
7069
|
return void 0;
|
|
7060
7070
|
}
|
|
7061
7071
|
throw new ZapierValidationError(
|
|
@@ -8529,538 +8539,166 @@ var actionResultItemFormatter = defineFormatter({
|
|
|
8529
8539
|
};
|
|
8530
8540
|
}
|
|
8531
8541
|
});
|
|
8532
|
-
|
|
8533
|
-
|
|
8534
|
-
|
|
8535
|
-
|
|
8536
|
-
|
|
8537
|
-
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
|
|
8547
|
-
|
|
8548
|
-
|
|
8549
|
-
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
|
|
8553
|
-
|
|
8554
|
-
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
}
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
|
|
8564
|
-
)
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
|
|
8571
|
-
|
|
8542
|
+
|
|
8543
|
+
// src/resolvers/appKey.ts
|
|
8544
|
+
var getAppRef = declareMethod({ id: "getApp" });
|
|
8545
|
+
var listAppsRef = declareMethod({ id: "listApps" });
|
|
8546
|
+
var appKeyResolver = defineResolver({
|
|
8547
|
+
imports: [getAppRef, listAppsRef],
|
|
8548
|
+
inputType: "search",
|
|
8549
|
+
placeholder: "e.g., 'slack' or 'SlackCLIAPI' or 'mail'",
|
|
8550
|
+
// Try the typed string as an exact app locator (getApp accepts slug, key, or
|
|
8551
|
+
// implementation id). On a hit, resolve with the input as-is and skip the
|
|
8552
|
+
// picker — every variant the user could type is already a valid value
|
|
8553
|
+
// wherever `app` is required, so no canonicalization is needed. A 404 falls
|
|
8554
|
+
// through to the search list; any other error (auth, network, rate-limit)
|
|
8555
|
+
// propagates. ZapierAppNotFoundError and ZapierNotFoundError are independent
|
|
8556
|
+
// siblings, so both are checked.
|
|
8557
|
+
tryResolveFromSearch: async ({ imports, search }) => {
|
|
8558
|
+
if (!search) return null;
|
|
8559
|
+
try {
|
|
8560
|
+
await imports.getApp({ app: search });
|
|
8561
|
+
return { resolvedValue: search };
|
|
8562
|
+
} catch (err) {
|
|
8563
|
+
if (!isZapierAppNotFoundError(err) && !isZapierNotFoundError(err)) {
|
|
8564
|
+
throw err;
|
|
8565
|
+
}
|
|
8566
|
+
return null;
|
|
8567
|
+
}
|
|
8568
|
+
},
|
|
8569
|
+
listItems: ({
|
|
8570
|
+
imports,
|
|
8571
|
+
search,
|
|
8572
|
+
cursor
|
|
8573
|
+
}) => imports.listApps({ search, cursor }),
|
|
8574
|
+
prompt: ({ items }) => ({
|
|
8575
|
+
type: "list",
|
|
8576
|
+
message: "Select app:",
|
|
8577
|
+
choices: items.map((app) => ({
|
|
8578
|
+
label: app.title || app.key,
|
|
8579
|
+
hint: app.title ? getAppKeyList(app) : void 0,
|
|
8580
|
+
value: app.key
|
|
8581
|
+
}))
|
|
8582
|
+
})
|
|
8572
8583
|
});
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8578
|
-
|
|
8579
|
-
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
|
|
8590
|
-
|
|
8591
|
-
|
|
8592
|
-
|
|
8593
|
-
|
|
8594
|
-
searchfill: zod.z.string().optional(),
|
|
8595
|
-
send_in_json: zod.z.boolean().optional(),
|
|
8596
|
-
regex: zod.z.string().optional(),
|
|
8597
|
-
type: zod.z.enum([
|
|
8598
|
-
"integer",
|
|
8599
|
-
"string",
|
|
8600
|
-
"text",
|
|
8601
|
-
"datetime",
|
|
8602
|
-
"boolean",
|
|
8603
|
-
"file",
|
|
8604
|
-
"decimal",
|
|
8605
|
-
"copy",
|
|
8606
|
-
"password",
|
|
8607
|
-
"dict",
|
|
8608
|
-
"code",
|
|
8609
|
-
"filter",
|
|
8610
|
-
"json"
|
|
8611
|
-
]).optional(),
|
|
8612
|
-
list: zod.z.boolean().optional()
|
|
8584
|
+
|
|
8585
|
+
// src/resolvers/actionType.ts
|
|
8586
|
+
var listActionsRef = declareMethod({ id: "listActions" });
|
|
8587
|
+
var actionTypeResolver = defineResolver({
|
|
8588
|
+
imports: [listActionsRef],
|
|
8589
|
+
requireParameters: ["app"],
|
|
8590
|
+
listItems: async ({
|
|
8591
|
+
imports,
|
|
8592
|
+
input
|
|
8593
|
+
}) => {
|
|
8594
|
+
const types = /* @__PURE__ */ new Set();
|
|
8595
|
+
for await (const action of imports.listActions({ app: input.app }).items()) {
|
|
8596
|
+
types.add(action.action_type);
|
|
8597
|
+
}
|
|
8598
|
+
return { data: [...types].map((type) => ({ key: type, name: type })) };
|
|
8599
|
+
},
|
|
8600
|
+
prompt: ({ items }) => ({
|
|
8601
|
+
type: "list",
|
|
8602
|
+
message: "Select action type:",
|
|
8603
|
+
choices: items.map((type) => ({ label: type.name, value: type.key }))
|
|
8604
|
+
})
|
|
8613
8605
|
});
|
|
8614
|
-
|
|
8615
|
-
|
|
8606
|
+
|
|
8607
|
+
// src/resolvers/actionKey.ts
|
|
8608
|
+
var listActionsRef2 = declareMethod({ id: "listActions" });
|
|
8609
|
+
var actionKeyResolver = defineResolver({
|
|
8610
|
+
imports: [listActionsRef2],
|
|
8611
|
+
requireParameters: ["app", "actionType"],
|
|
8612
|
+
listItems: async ({
|
|
8613
|
+
imports,
|
|
8614
|
+
input,
|
|
8615
|
+
cursor
|
|
8616
|
+
}) => {
|
|
8617
|
+
const page = await imports.listActions({ app: input.app, cursor });
|
|
8618
|
+
return {
|
|
8619
|
+
data: page.data.filter(
|
|
8620
|
+
(action) => action.action_type === input.actionType && !action.is_hidden
|
|
8621
|
+
),
|
|
8622
|
+
nextCursor: page.nextCursor
|
|
8623
|
+
};
|
|
8624
|
+
},
|
|
8625
|
+
prompt: ({ items }) => ({
|
|
8626
|
+
type: "list",
|
|
8627
|
+
message: "Select action:",
|
|
8628
|
+
choices: items.map((action) => ({
|
|
8629
|
+
label: action.title || action.name || action.key,
|
|
8630
|
+
hint: action.description || void 0,
|
|
8631
|
+
value: action.key
|
|
8632
|
+
}))
|
|
8633
|
+
})
|
|
8616
8634
|
});
|
|
8617
|
-
|
|
8618
|
-
|
|
8619
|
-
|
|
8620
|
-
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
|
|
8639
|
-
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
|
|
8651
|
-
|
|
8652
|
-
|
|
8653
|
-
|
|
8654
|
-
|
|
8655
|
-
|
|
8656
|
-
|
|
8657
|
-
|
|
8658
|
-
|
|
8659
|
-
|
|
8660
|
-
|
|
8661
|
-
|
|
8662
|
-
|
|
8663
|
-
|
|
8664
|
-
|
|
8665
|
-
}
|
|
8666
|
-
|
|
8667
|
-
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
}
|
|
8682
|
-
|
|
8683
|
-
|
|
8684
|
-
public_id: zod.z.string().optional(),
|
|
8685
|
-
code: zod.z.string(),
|
|
8686
|
-
user_id: zod.z.number(),
|
|
8687
|
-
auto_provisioned: zod.z.boolean(),
|
|
8688
|
-
first_name: zod.z.string(),
|
|
8689
|
-
last_name: zod.z.string(),
|
|
8690
|
-
username: zod.z.string(),
|
|
8691
|
-
personas: zod.z.string(),
|
|
8692
|
-
user_generated_personas: zod.z.string(),
|
|
8693
|
-
last_login: zod.z.string(),
|
|
8694
|
-
email: zod.z.string(),
|
|
8695
|
-
email_hash: zod.z.string(),
|
|
8696
|
-
email_confirmed: zod.z.boolean(),
|
|
8697
|
-
timezone: zod.z.string(),
|
|
8698
|
-
photo_url: zod.z.string(),
|
|
8699
|
-
has_seen_notifications: zod.z.record(zod.z.string(), zod.z.boolean().nullable()),
|
|
8700
|
-
signup: zod.z.string(),
|
|
8701
|
-
since_signup: zod.z.string(),
|
|
8702
|
-
has_activated: zod.z.boolean(),
|
|
8703
|
-
enable_gz_creator: zod.z.boolean(),
|
|
8704
|
-
should_see_nps_survey: zod.z.boolean(),
|
|
8705
|
-
is_developer: zod.z.boolean(),
|
|
8706
|
-
is_expert: zod.z.boolean(),
|
|
8707
|
-
tos_agreement: zod.z.boolean(),
|
|
8708
|
-
should_renew_tos: zod.z.boolean(),
|
|
8709
|
-
is_gdpr_consented: zod.z.boolean(),
|
|
8710
|
-
disable_ssl_check: zod.z.boolean(),
|
|
8711
|
-
identity: zod.z.number(),
|
|
8712
|
-
summary_schedule: zod.z.string(),
|
|
8713
|
-
alert_triggers: zod.z.string(),
|
|
8714
|
-
alert_actions: zod.z.string(),
|
|
8715
|
-
is_staff: zod.z.boolean(),
|
|
8716
|
-
is_zt_reviewer: zod.z.boolean(),
|
|
8717
|
-
is_high_value: zod.z.boolean(),
|
|
8718
|
-
is_temporary: zod.z.boolean(),
|
|
8719
|
-
banner_message: zod.z.string(),
|
|
8720
|
-
enable_totp_2fa: zod.z.boolean(),
|
|
8721
|
-
viewed_help: zod.z.record(zod.z.string(), zod.z.boolean()),
|
|
8722
|
-
show_editor_migration_mesaging: zod.z.boolean(),
|
|
8723
|
-
switches: zod.z.record(zod.z.string(), zod.z.unknown()),
|
|
8724
|
-
organizations: zod.z.array(zod.z.record(zod.z.string(), zod.z.unknown()).nullable()),
|
|
8725
|
-
primary_organization: zod.z.record(zod.z.string(), zod.z.unknown()).nullable(),
|
|
8726
|
-
has_active_zaps: zod.z.boolean(),
|
|
8727
|
-
has_google_sso: zod.z.boolean(),
|
|
8728
|
-
auth_realm: zod.z.string(),
|
|
8729
|
-
roles: zod.z.array(
|
|
8730
|
-
zod.z.object({
|
|
8731
|
-
account_id: zod.z.number(),
|
|
8732
|
-
role: zod.z.string()
|
|
8733
|
-
})
|
|
8734
|
-
)
|
|
8735
|
-
});
|
|
8736
|
-
zod.z.object({
|
|
8737
|
-
age_in_days: zod.z.string().optional(),
|
|
8738
|
-
api_docs_url: zod.z.string().nullable().optional(),
|
|
8739
|
-
app_profile_url: zod.z.string(),
|
|
8740
|
-
banner: zod.z.string().optional(),
|
|
8741
|
-
categories: zod.z.array(zod.z.string()).optional(),
|
|
8742
|
-
// Service category names
|
|
8743
|
-
canonical_id: zod.z.string().optional(),
|
|
8744
|
-
current_implementation_id: zod.z.string(),
|
|
8745
|
-
days_since_last_update: zod.z.string().optional(),
|
|
8746
|
-
description: zod.z.string(),
|
|
8747
|
-
external_url: zod.z.string(),
|
|
8748
|
-
hashtag: zod.z.string().optional(),
|
|
8749
|
-
id: zod.z.number().optional(),
|
|
8750
|
-
image: zod.z.string().optional(),
|
|
8751
|
-
images: zod.z.string().optional(),
|
|
8752
|
-
integration_overview_html: zod.z.string().nullable().optional(),
|
|
8753
|
-
internal_id: zod.z.string(),
|
|
8754
|
-
invite_url: zod.z.string().nullable().optional(),
|
|
8755
|
-
is_beta: zod.z.string().optional(),
|
|
8756
|
-
is_built_in: zod.z.string().optional(),
|
|
8757
|
-
is_featured: zod.z.string().optional(),
|
|
8758
|
-
is_premium: zod.z.boolean().optional(),
|
|
8759
|
-
is_public: zod.z.string().optional(),
|
|
8760
|
-
is_upcoming: zod.z.string().optional(),
|
|
8761
|
-
learn_more_url: zod.z.string(),
|
|
8762
|
-
name: zod.z.string(),
|
|
8763
|
-
popularity: zod.z.number(),
|
|
8764
|
-
primary_color: zod.z.string(),
|
|
8765
|
-
request_count: zod.z.string().optional(),
|
|
8766
|
-
slug: zod.z.string(),
|
|
8767
|
-
zap_usage_count: zod.z.number().nullable().optional()
|
|
8768
|
-
});
|
|
8769
|
-
var ServiceSchema = zod.z.object({
|
|
8770
|
-
id: zod.z.number().optional(),
|
|
8771
|
-
canonical_id: zod.z.string().optional(),
|
|
8772
|
-
current_implementation_id: zod.z.string(),
|
|
8773
|
-
name: zod.z.string(),
|
|
8774
|
-
slug: zod.z.string(),
|
|
8775
|
-
app_url: zod.z.string().optional(),
|
|
8776
|
-
learn_more_url: zod.z.string().optional(),
|
|
8777
|
-
description: zod.z.string(),
|
|
8778
|
-
primary_color: zod.z.string(),
|
|
8779
|
-
popularity: zod.z.number(),
|
|
8780
|
-
image: zod.z.string().optional(),
|
|
8781
|
-
images: zod.z.string().optional()
|
|
8782
|
-
});
|
|
8783
|
-
zod.z.object({
|
|
8784
|
-
results: zod.z.array(ServiceSchema),
|
|
8785
|
-
next: zod.z.string().nullable().optional(),
|
|
8786
|
-
previous: zod.z.string().nullable().optional()
|
|
8787
|
-
});
|
|
8788
|
-
zod.z.object({
|
|
8789
|
-
selected_api: zod.z.string(),
|
|
8790
|
-
action: zod.z.string(),
|
|
8791
|
-
type_of: zod.z.string(),
|
|
8792
|
-
authentication_id: zod.z.union([zod.z.string(), zod.z.number()]).optional(),
|
|
8793
|
-
params: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
|
|
8794
|
-
});
|
|
8795
|
-
zod.z.object({
|
|
8796
|
-
success: zod.z.boolean(),
|
|
8797
|
-
needs: zod.z.array(NeedSchema).optional(),
|
|
8798
|
-
errors: zod.z.array(zod.z.string()).optional(),
|
|
8799
|
-
last_fetched_at: zod.z.string().optional(),
|
|
8800
|
-
schema: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
|
|
8801
|
-
});
|
|
8802
|
-
var ImplementationSchema = zod.z.object({
|
|
8803
|
-
selected_api: zod.z.string(),
|
|
8804
|
-
app_id: zod.z.number().optional(),
|
|
8805
|
-
auth_type: zod.z.string().optional(),
|
|
8806
|
-
auth_fields: zod.z.string().optional(),
|
|
8807
|
-
actions: zod.z.array(ActionSchema).optional(),
|
|
8808
|
-
is_deprecated: zod.z.boolean().optional(),
|
|
8809
|
-
is_private_only: zod.z.boolean().optional(),
|
|
8810
|
-
is_invite_only: zod.z.boolean().optional(),
|
|
8811
|
-
is_beta: zod.z.boolean().optional().default(false),
|
|
8812
|
-
is_premium: zod.z.boolean().optional().default(false),
|
|
8813
|
-
is_hidden: zod.z.string().optional(),
|
|
8814
|
-
name: zod.z.string().optional(),
|
|
8815
|
-
slug: zod.z.string().optional(),
|
|
8816
|
-
images: zod.z.record(zod.z.string(), zod.z.string().nullable()).optional(),
|
|
8817
|
-
primary_color: zod.z.string().optional(),
|
|
8818
|
-
secondary_color: zod.z.string().optional(),
|
|
8819
|
-
current_implementation: zod.z.string().optional(),
|
|
8820
|
-
other_implementations: zod.z.string().optional()
|
|
8821
|
-
});
|
|
8822
|
-
zod.z.object({
|
|
8823
|
-
count: zod.z.number(),
|
|
8824
|
-
next: zod.z.string().nullable().optional(),
|
|
8825
|
-
previous: zod.z.string().nullable().optional(),
|
|
8826
|
-
results: zod.z.array(ImplementationSchema)
|
|
8827
|
-
});
|
|
8828
|
-
var NeedChoicesResponseMetaSchema = zod.z.object({
|
|
8829
|
-
page: zod.z.string().nullable().optional()
|
|
8830
|
-
});
|
|
8831
|
-
var NeedChoicesResponseLinksSchema = zod.z.object({
|
|
8832
|
-
next: zod.z.string().nullable().optional(),
|
|
8833
|
-
prev: zod.z.string().nullable().optional()
|
|
8834
|
-
});
|
|
8835
|
-
zod.z.object({
|
|
8836
|
-
selected_api: zod.z.string().optional().describe(
|
|
8837
|
-
"Something like `SlackAPI` (for Python apps) or `SplitwiseCLIAPI@1.0.0` (for CLI apps). Non-public apps are fine as long as the authed user can access them."
|
|
8838
|
-
),
|
|
8839
|
-
authentication_id: zod.z.union([zod.z.string(), zod.z.number()]).optional().describe(
|
|
8840
|
-
"If the app needs auth, provide an `authentication_id` that has the `selected_api` of the app you want to run. Can be any auth visible to the user (including shared)."
|
|
8841
|
-
),
|
|
8842
|
-
params: zod.z.record(zod.z.string(), zod.z.unknown()).optional().describe(
|
|
8843
|
-
"Object that matches the input the node would normally get. Has all the same keys/types as the `needs` of the action."
|
|
8844
|
-
),
|
|
8845
|
-
page: zod.z.number().optional().default(0),
|
|
8846
|
-
prefill: zod.z.string().optional().describe(
|
|
8847
|
-
"The prefill string to indicate what we're fetching choices for. Likely something like `spreadsheet.id.title`. Must be provided alongside `selected_api` if both `action_id` and `input_field_id` are not."
|
|
8848
|
-
),
|
|
8849
|
-
action_id: zod.z.string().optional().describe(
|
|
8850
|
-
"The id that will be used to lookup the Action for prefill lookup. If provided, `input_field_id` is required, else `prefill` must be provided."
|
|
8851
|
-
),
|
|
8852
|
-
input_field_id: zod.z.string().optional().describe(
|
|
8853
|
-
"The id (key) of the input field (Need) that dynamic choices are being retrieved for. If provided, `action_id` is required, else `prefill` must be provided."
|
|
8854
|
-
)
|
|
8855
|
-
});
|
|
8856
|
-
zod.z.object({
|
|
8857
|
-
success: zod.z.boolean(),
|
|
8858
|
-
choices: zod.z.array(NeedChoicesSchema).optional(),
|
|
8859
|
-
next_page: zod.z.number().optional(),
|
|
8860
|
-
errors: zod.z.array(zod.z.string()).optional(),
|
|
8861
|
-
meta: NeedChoicesResponseMetaSchema.optional(),
|
|
8862
|
-
links: NeedChoicesResponseLinksSchema.optional()
|
|
8863
|
-
});
|
|
8864
|
-
|
|
8865
|
-
// src/schemas/Action.ts
|
|
8866
|
-
var ActionItemSchema = ActionSchema.omit({
|
|
8867
|
-
type: true,
|
|
8868
|
-
name: true,
|
|
8869
|
-
selected_api: true
|
|
8870
|
-
}).extend({
|
|
8871
|
-
app_key: zod.z.string(),
|
|
8872
|
-
// App key without version (extracted from selected_api)
|
|
8873
|
-
app_version: zod.z.string().optional(),
|
|
8874
|
-
// Version extracted from selected_api
|
|
8875
|
-
action_type: ActionSchema.shape.type,
|
|
8876
|
-
// Mapped from original 'type' field
|
|
8877
|
-
title: zod.z.string(),
|
|
8878
|
-
// Mapped from original 'name' field
|
|
8879
|
-
type: zod.z.literal("action")
|
|
8880
|
-
// Fixed type identifier
|
|
8881
|
-
});
|
|
8882
|
-
|
|
8883
|
-
// src/formatters/action.ts
|
|
8884
|
-
function formatActionItem(item) {
|
|
8885
|
-
const details = [{ text: `Type: ${item.action_type}`, style: "accent" }];
|
|
8886
|
-
if (item.app_key) {
|
|
8887
|
-
details.push({ text: `App: ${item.app_key}`, style: "normal" });
|
|
8888
|
-
}
|
|
8889
|
-
if (item.description) {
|
|
8890
|
-
details.push({ text: item.description, style: "dim" });
|
|
8891
|
-
}
|
|
8892
|
-
return {
|
|
8893
|
-
title: item.title || item.key,
|
|
8894
|
-
// `hint` is the dumb secondary string shown after the title (the action key
|
|
8895
|
-
// and, when present, its id). Replaces the deprecated `key`/`id` fields.
|
|
8896
|
-
hint: [item.key, item.id].filter((v) => Boolean(v)),
|
|
8897
|
-
description: item.description,
|
|
8898
|
-
details
|
|
8899
|
-
};
|
|
8900
|
-
}
|
|
8901
|
-
var actionItemFormatter = defineFormatter({
|
|
8902
|
-
format: ({ item }) => formatActionItem(item)
|
|
8903
|
-
});
|
|
8904
|
-
|
|
8905
|
-
// src/resolvers/appKey.ts
|
|
8906
|
-
var getAppRef = declareMethod({ id: "getApp" });
|
|
8907
|
-
var listAppsRef = declareMethod({ id: "listApps" });
|
|
8908
|
-
var appKeyResolver = defineResolver({
|
|
8909
|
-
imports: [getAppRef, listAppsRef],
|
|
8910
|
-
inputType: "search",
|
|
8911
|
-
placeholder: "e.g., 'slack' or 'SlackCLIAPI' or 'mail'",
|
|
8912
|
-
// Try the typed string as an exact app locator (getApp accepts slug, key, or
|
|
8913
|
-
// implementation id). On a hit, resolve with the input as-is and skip the
|
|
8914
|
-
// picker — every variant the user could type is already a valid value
|
|
8915
|
-
// wherever `app` is required, so no canonicalization is needed. A 404 falls
|
|
8916
|
-
// through to the search list; any other error (auth, network, rate-limit)
|
|
8917
|
-
// propagates. ZapierAppNotFoundError and ZapierNotFoundError are independent
|
|
8918
|
-
// siblings, so both are checked.
|
|
8919
|
-
tryResolveFromSearch: async ({ imports, search }) => {
|
|
8920
|
-
if (!search) return null;
|
|
8921
|
-
try {
|
|
8922
|
-
await imports.getApp({ app: search });
|
|
8923
|
-
return { resolvedValue: search };
|
|
8924
|
-
} catch (err) {
|
|
8925
|
-
if (!isZapierAppNotFoundError(err) && !isZapierNotFoundError(err)) {
|
|
8926
|
-
throw err;
|
|
8927
|
-
}
|
|
8928
|
-
return null;
|
|
8929
|
-
}
|
|
8930
|
-
},
|
|
8931
|
-
listItems: ({
|
|
8932
|
-
imports,
|
|
8933
|
-
search,
|
|
8934
|
-
cursor
|
|
8935
|
-
}) => imports.listApps({ search, cursor }),
|
|
8936
|
-
prompt: ({ items }) => ({
|
|
8937
|
-
type: "list",
|
|
8938
|
-
message: "Select app:",
|
|
8939
|
-
choices: items.map((app) => ({
|
|
8940
|
-
label: app.title || app.key,
|
|
8941
|
-
hint: app.title ? getAppKeyList(app) : void 0,
|
|
8942
|
-
value: app.key
|
|
8943
|
-
}))
|
|
8944
|
-
})
|
|
8945
|
-
});
|
|
8946
|
-
|
|
8947
|
-
// src/resolvers/actionType.ts
|
|
8948
|
-
var listActionsRef = declareMethod({ id: "listActions" });
|
|
8949
|
-
var actionTypeResolver = defineResolver({
|
|
8950
|
-
imports: [listActionsRef],
|
|
8951
|
-
requireParameters: ["app"],
|
|
8952
|
-
listItems: async ({
|
|
8953
|
-
imports,
|
|
8954
|
-
input
|
|
8955
|
-
}) => {
|
|
8956
|
-
const types = /* @__PURE__ */ new Set();
|
|
8957
|
-
for await (const action of imports.listActions({ app: input.app }).items()) {
|
|
8958
|
-
types.add(action.action_type);
|
|
8959
|
-
}
|
|
8960
|
-
return { data: [...types].map((type) => ({ key: type, name: type })) };
|
|
8961
|
-
},
|
|
8962
|
-
prompt: ({ items }) => ({
|
|
8963
|
-
type: "list",
|
|
8964
|
-
message: "Select action type:",
|
|
8965
|
-
choices: items.map((type) => ({ label: type.name, value: type.key }))
|
|
8966
|
-
})
|
|
8967
|
-
});
|
|
8968
|
-
|
|
8969
|
-
// src/resolvers/actionKey.ts
|
|
8970
|
-
var listActionsRef2 = declareMethod({ id: "listActions" });
|
|
8971
|
-
var actionKeyResolver = defineResolver({
|
|
8972
|
-
imports: [listActionsRef2],
|
|
8973
|
-
requireParameters: ["app", "actionType"],
|
|
8974
|
-
listItems: async ({
|
|
8975
|
-
imports,
|
|
8976
|
-
input,
|
|
8977
|
-
cursor
|
|
8978
|
-
}) => {
|
|
8979
|
-
const page = await imports.listActions({ app: input.app, cursor });
|
|
8980
|
-
return {
|
|
8981
|
-
data: page.data.filter(
|
|
8982
|
-
(action) => action.action_type === input.actionType && !action.is_hidden
|
|
8983
|
-
),
|
|
8984
|
-
nextCursor: page.nextCursor
|
|
8985
|
-
};
|
|
8986
|
-
},
|
|
8987
|
-
prompt: ({ items }) => ({
|
|
8988
|
-
type: "list",
|
|
8989
|
-
message: "Select action:",
|
|
8990
|
-
choices: items.map((action) => ({
|
|
8991
|
-
label: action.title || action.name || action.key,
|
|
8992
|
-
hint: action.description || void 0,
|
|
8993
|
-
value: action.key
|
|
8994
|
-
}))
|
|
8995
|
-
})
|
|
8996
|
-
});
|
|
8997
|
-
|
|
8998
|
-
// src/plugins/capabilities/index.ts
|
|
8999
|
-
function toDescription(key) {
|
|
9000
|
-
const words = key.replace(/^can/, "").replace(/([A-Z])/g, " $1").trim().toLowerCase();
|
|
9001
|
-
return `To ${words}`;
|
|
9002
|
-
}
|
|
9003
|
-
function toEnvVar(key) {
|
|
9004
|
-
return "ZAPIER_" + key.replace(/([A-Z])/g, "_$1").toUpperCase();
|
|
9005
|
-
}
|
|
9006
|
-
function toCliFlag(key) {
|
|
9007
|
-
return "--" + key.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
9008
|
-
}
|
|
9009
|
-
function buildCapabilityMessage(key) {
|
|
9010
|
-
return [
|
|
9011
|
-
`${toDescription(key)}, use ${toCliFlag(key)} in the CLI,`,
|
|
9012
|
-
`set ${key}: true in SDK options or .zapierrc,`,
|
|
9013
|
-
`or set ${toEnvVar(key)}=true.`
|
|
9014
|
-
].join(" ");
|
|
9015
|
-
}
|
|
9016
|
-
var GATED_FLAGS = [
|
|
9017
|
-
"canIncludeSharedConnections",
|
|
9018
|
-
"canIncludeSharedTables",
|
|
9019
|
-
"canDeleteTables"
|
|
9020
|
-
];
|
|
9021
|
-
function isEnabledByEnv(key) {
|
|
9022
|
-
const value = globalThis.process?.env?.[toEnvVar(key)];
|
|
9023
|
-
if (value === void 0) return void 0;
|
|
9024
|
-
if (value === "true" || value === "1") return true;
|
|
9025
|
-
if (value === "false" || value === "0") return false;
|
|
9026
|
-
return void 0;
|
|
9027
|
-
}
|
|
9028
|
-
var CAPABILITIES_ID = "zapier/capabilities";
|
|
9029
|
-
var capabilitiesPluginRef = declareProperty({ id: CAPABILITIES_ID });
|
|
9030
|
-
var capabilitiesPlugin = defineProperty({
|
|
9031
|
-
namespace: "zapier",
|
|
9032
|
-
name: "capabilities",
|
|
9033
|
-
imports: [sdkOptionsPluginRef, manifestPluginRef],
|
|
9034
|
-
setup: ({ imports }) => {
|
|
9035
|
-
const options = imports.sdkOptions ?? {};
|
|
9036
|
-
let cached;
|
|
9037
|
-
async function resolveFlags() {
|
|
9038
|
-
if (cached) return cached;
|
|
9039
|
-
const manifest = await imports.manifest.getResolvedManifest();
|
|
9040
|
-
cached = {};
|
|
9041
|
-
for (const flag of GATED_FLAGS) {
|
|
9042
|
-
cached[flag] = Boolean(
|
|
9043
|
-
options[flag] ?? isEnabledByEnv(flag) ?? manifest?.[flag]
|
|
9044
|
-
);
|
|
9045
|
-
}
|
|
9046
|
-
return cached;
|
|
9047
|
-
}
|
|
9048
|
-
return {
|
|
9049
|
-
checkCapability: async (key) => {
|
|
9050
|
-
const flags = await resolveFlags();
|
|
9051
|
-
if (flags[key]) return;
|
|
9052
|
-
throw new ZapierConfigurationError(
|
|
9053
|
-
buildCapabilityMessage(key) + " (If you are an AI agent, you MUST NOT retry. Ask the user if they want to enable this.)",
|
|
9054
|
-
{ configType: key }
|
|
9055
|
-
);
|
|
9056
|
-
},
|
|
9057
|
-
hasCapability: async (key) => {
|
|
9058
|
-
const flags = await resolveFlags();
|
|
9059
|
-
return flags[key];
|
|
9060
|
-
}
|
|
9061
|
-
};
|
|
9062
|
-
},
|
|
9063
|
-
get: ({ state }) => state
|
|
8635
|
+
|
|
8636
|
+
// src/plugins/capabilities/index.ts
|
|
8637
|
+
function toDescription(key) {
|
|
8638
|
+
const words = key.replace(/^can/, "").replace(/([A-Z])/g, " $1").trim().toLowerCase();
|
|
8639
|
+
return `To ${words}`;
|
|
8640
|
+
}
|
|
8641
|
+
function toEnvVar(key) {
|
|
8642
|
+
return "ZAPIER_" + key.replace(/([A-Z])/g, "_$1").toUpperCase();
|
|
8643
|
+
}
|
|
8644
|
+
function toCliFlag(key) {
|
|
8645
|
+
return "--" + key.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
8646
|
+
}
|
|
8647
|
+
function buildCapabilityMessage(key) {
|
|
8648
|
+
return [
|
|
8649
|
+
`${toDescription(key)}, use ${toCliFlag(key)} in the CLI,`,
|
|
8650
|
+
`set ${key}: true in SDK options or .zapierrc,`,
|
|
8651
|
+
`or set ${toEnvVar(key)}=true.`
|
|
8652
|
+
].join(" ");
|
|
8653
|
+
}
|
|
8654
|
+
var GATED_FLAGS = [
|
|
8655
|
+
"canIncludeSharedConnections",
|
|
8656
|
+
"canIncludeSharedTables",
|
|
8657
|
+
"canDeleteTables"
|
|
8658
|
+
];
|
|
8659
|
+
function isEnabledByEnv(key) {
|
|
8660
|
+
const value = globalThis.process?.env?.[toEnvVar(key)];
|
|
8661
|
+
if (value === void 0) return void 0;
|
|
8662
|
+
if (value === "true" || value === "1") return true;
|
|
8663
|
+
if (value === "false" || value === "0") return false;
|
|
8664
|
+
return void 0;
|
|
8665
|
+
}
|
|
8666
|
+
var CAPABILITIES_ID = "zapier/capabilities";
|
|
8667
|
+
var capabilitiesPluginRef = declareProperty({ id: CAPABILITIES_ID });
|
|
8668
|
+
var capabilitiesPlugin = defineProperty({
|
|
8669
|
+
namespace: "zapier",
|
|
8670
|
+
name: "capabilities",
|
|
8671
|
+
imports: [sdkOptionsPluginRef, manifestPluginRef],
|
|
8672
|
+
setup: ({ imports }) => {
|
|
8673
|
+
const options = imports.sdkOptions ?? {};
|
|
8674
|
+
let cached;
|
|
8675
|
+
async function resolveFlags() {
|
|
8676
|
+
if (cached) return cached;
|
|
8677
|
+
const manifest = await imports.manifest.getResolvedManifest();
|
|
8678
|
+
cached = {};
|
|
8679
|
+
for (const flag of GATED_FLAGS) {
|
|
8680
|
+
cached[flag] = Boolean(
|
|
8681
|
+
options[flag] ?? isEnabledByEnv(flag) ?? manifest?.[flag]
|
|
8682
|
+
);
|
|
8683
|
+
}
|
|
8684
|
+
return cached;
|
|
8685
|
+
}
|
|
8686
|
+
return {
|
|
8687
|
+
checkCapability: async (key) => {
|
|
8688
|
+
const flags = await resolveFlags();
|
|
8689
|
+
if (flags[key]) return;
|
|
8690
|
+
throw new ZapierConfigurationError(
|
|
8691
|
+
buildCapabilityMessage(key) + " (If you are an AI agent, you MUST NOT retry. Ask the user if they want to enable this.)",
|
|
8692
|
+
{ configType: key }
|
|
8693
|
+
);
|
|
8694
|
+
},
|
|
8695
|
+
hasCapability: async (key) => {
|
|
8696
|
+
const flags = await resolveFlags();
|
|
8697
|
+
return flags[key];
|
|
8698
|
+
}
|
|
8699
|
+
};
|
|
8700
|
+
},
|
|
8701
|
+
get: ({ state }) => state
|
|
9064
8702
|
});
|
|
9065
8703
|
|
|
9066
8704
|
// src/resolvers/connectionId.ts
|
|
@@ -9744,396 +9382,768 @@ async function createFieldKeyTranslator({
|
|
|
9744
9382
|
}
|
|
9745
9383
|
}
|
|
9746
9384
|
}
|
|
9747
|
-
return key;
|
|
9385
|
+
return key;
|
|
9386
|
+
}
|
|
9387
|
+
};
|
|
9388
|
+
}
|
|
9389
|
+
|
|
9390
|
+
// src/resolvers/tableRecordId.ts
|
|
9391
|
+
var listTableRecordsRef = declareMethod({ id: "listTableRecords" });
|
|
9392
|
+
function summarizeRecord(record) {
|
|
9393
|
+
const values = Object.values(record.data);
|
|
9394
|
+
const preview = values.slice(0, 3).map((v) => formatFieldValue(v).replace(/\s+/g, " ").trim()).filter((s) => s.length > 0).join(", ");
|
|
9395
|
+
if (!preview) return void 0;
|
|
9396
|
+
return preview.length > 60 ? preview.slice(0, 57) + "..." : preview;
|
|
9397
|
+
}
|
|
9398
|
+
function recordChoices(records) {
|
|
9399
|
+
return records.map((record) => ({
|
|
9400
|
+
label: summarizeRecord(record) || record.id,
|
|
9401
|
+
value: record.id
|
|
9402
|
+
}));
|
|
9403
|
+
}
|
|
9404
|
+
var tableRecordIdResolver = defineResolver({
|
|
9405
|
+
imports: [listTableRecordsRef],
|
|
9406
|
+
requireParameters: ["table"],
|
|
9407
|
+
listItems: ({ imports, input, cursor }) => imports.listTableRecords({
|
|
9408
|
+
table: input.table,
|
|
9409
|
+
keyMode: "names",
|
|
9410
|
+
cursor
|
|
9411
|
+
}),
|
|
9412
|
+
prompt: ({ items }) => ({
|
|
9413
|
+
type: "list",
|
|
9414
|
+
message: "Select a record:",
|
|
9415
|
+
choices: recordChoices(items)
|
|
9416
|
+
})
|
|
9417
|
+
});
|
|
9418
|
+
var tableRecordIdsResolver = defineResolver({
|
|
9419
|
+
imports: [listTableRecordsRef],
|
|
9420
|
+
requireParameters: ["table"],
|
|
9421
|
+
listItems: ({ imports, input, cursor }) => imports.listTableRecords({
|
|
9422
|
+
table: input.table,
|
|
9423
|
+
keyMode: "names",
|
|
9424
|
+
cursor
|
|
9425
|
+
}),
|
|
9426
|
+
prompt: ({ items }) => ({
|
|
9427
|
+
type: "checkbox",
|
|
9428
|
+
message: "Select records to delete:",
|
|
9429
|
+
choices: recordChoices(items)
|
|
9430
|
+
}),
|
|
9431
|
+
validate: ({ value }) => Array.isArray(value) && value.length > 0 ? true : "Select at least one record"
|
|
9432
|
+
});
|
|
9433
|
+
|
|
9434
|
+
// src/resolvers/tableFieldIds.ts
|
|
9435
|
+
var listTableFieldsRef = declareMethod({ id: "listTableFields" });
|
|
9436
|
+
var tableFieldIdsResolver = defineResolver({
|
|
9437
|
+
imports: [listTableFieldsRef],
|
|
9438
|
+
requireParameters: ["table"],
|
|
9439
|
+
// No cursor forwarding: the fields API is unpaginated (no cursor on the
|
|
9440
|
+
// response), so the listing is always exhausted after one page.
|
|
9441
|
+
listItems: ({ imports, input }) => imports.listTableFields({ table: input.table }),
|
|
9442
|
+
prompt: ({ items }) => ({
|
|
9443
|
+
type: "checkbox",
|
|
9444
|
+
message: "Select fields:",
|
|
9445
|
+
choices: items.map((field) => ({
|
|
9446
|
+
label: field.name,
|
|
9447
|
+
hint: [field.id, field.type],
|
|
9448
|
+
value: field.id
|
|
9449
|
+
}))
|
|
9450
|
+
}),
|
|
9451
|
+
validate: ({ value }) => Array.isArray(value) && value.length > 0 ? true : "Select at least one field"
|
|
9452
|
+
});
|
|
9453
|
+
|
|
9454
|
+
// src/resolvers/tableName.ts
|
|
9455
|
+
var tableNameResolver = defineResolver({
|
|
9456
|
+
type: "static",
|
|
9457
|
+
inputType: "text",
|
|
9458
|
+
placeholder: "Enter a name for the table"
|
|
9459
|
+
});
|
|
9460
|
+
var FieldTypeSchema = zod.z.enum([
|
|
9461
|
+
"string",
|
|
9462
|
+
"multiple_string",
|
|
9463
|
+
"labeled_string",
|
|
9464
|
+
"multiple_labeled_string",
|
|
9465
|
+
"text",
|
|
9466
|
+
"multiple_text",
|
|
9467
|
+
"boolean",
|
|
9468
|
+
"multiple_boolean",
|
|
9469
|
+
"number",
|
|
9470
|
+
"multiple_number",
|
|
9471
|
+
"decimal",
|
|
9472
|
+
"multiple_decimal",
|
|
9473
|
+
"datetime",
|
|
9474
|
+
"multiple_datetime",
|
|
9475
|
+
"uuid",
|
|
9476
|
+
"multiple_uuid",
|
|
9477
|
+
"json",
|
|
9478
|
+
"multiple_json",
|
|
9479
|
+
"formula",
|
|
9480
|
+
"button_trigger_zap",
|
|
9481
|
+
"button_continue_zap",
|
|
9482
|
+
"email",
|
|
9483
|
+
"multiple_email",
|
|
9484
|
+
"link",
|
|
9485
|
+
"multiple_link",
|
|
9486
|
+
"currency",
|
|
9487
|
+
"phone_number",
|
|
9488
|
+
"ai_formula",
|
|
9489
|
+
"linked_record",
|
|
9490
|
+
"multiple_linked_record"
|
|
9491
|
+
]);
|
|
9492
|
+
var FieldApiItemSchema = zod.z.object({
|
|
9493
|
+
id: zod.z.number(),
|
|
9494
|
+
type: FieldTypeSchema,
|
|
9495
|
+
name: zod.z.string(),
|
|
9496
|
+
created_at: zod.z.string().optional(),
|
|
9497
|
+
edited_at: zod.z.string().optional(),
|
|
9498
|
+
options: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
|
|
9499
|
+
config: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
|
|
9500
|
+
is_order_field: zod.z.boolean().optional(),
|
|
9501
|
+
is_filter_field: zod.z.boolean().optional(),
|
|
9502
|
+
is_selected_field: zod.z.boolean().optional(),
|
|
9503
|
+
deleted_at: zod.z.string().nullable().optional()
|
|
9504
|
+
});
|
|
9505
|
+
var ListTableFieldsApiResponseSchema = zod.z.object({
|
|
9506
|
+
data: zod.z.array(FieldApiItemSchema)
|
|
9507
|
+
});
|
|
9508
|
+
var FieldItemSchema = zod.z.object({
|
|
9509
|
+
id: zod.z.string(),
|
|
9510
|
+
type: FieldTypeSchema,
|
|
9511
|
+
name: zod.z.string(),
|
|
9512
|
+
created_at: zod.z.string().optional(),
|
|
9513
|
+
edited_at: zod.z.string().optional(),
|
|
9514
|
+
options: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
|
|
9515
|
+
config: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
|
|
9516
|
+
deleted_at: zod.z.string().nullable().optional()
|
|
9517
|
+
});
|
|
9518
|
+
var ListTableFieldsDescription = "List fields for a table";
|
|
9519
|
+
var ListTableFieldsOptionsBaseSchema = zod.z.object({
|
|
9520
|
+
fields: FieldsPropertySchema.optional(),
|
|
9521
|
+
fieldKeys: zod.z.array(zod.z.union([zod.z.string(), zod.z.number()])).optional().describe(
|
|
9522
|
+
'Filter by specific fields. Accepts field names (e.g., "Email") or IDs (e.g., "f6", "6", or 6).'
|
|
9523
|
+
).meta({ deprecated: true }),
|
|
9524
|
+
trash: TrashSchema
|
|
9525
|
+
});
|
|
9526
|
+
var ListTableFieldsOptionsSchema = zod.z.object({
|
|
9527
|
+
table: TablePropertySchema
|
|
9528
|
+
}).merge(ListTableFieldsOptionsBaseSchema).describe(ListTableFieldsDescription).meta({ aliases: { tableId: "table", fieldKeys: "fields" } });
|
|
9529
|
+
var ListTableFieldsOptionsSchemaDeprecated = zod.z.object({
|
|
9530
|
+
tableId: zod.z.string().regex(/^[A-Z0-9]{26}$/, "Table ID must be a valid ULID").describe("The unique identifier of the table")
|
|
9531
|
+
}).merge(ListTableFieldsOptionsBaseSchema);
|
|
9532
|
+
var ListTableFieldsOptionsInputSchema = zod.z.union([ListTableFieldsOptionsSchema, ListTableFieldsOptionsSchemaDeprecated]).describe(ListTableFieldsDescription);
|
|
9533
|
+
|
|
9534
|
+
// src/resolvers/tableFields.ts
|
|
9535
|
+
var fieldTypeChoices = FieldTypeSchema.options.map((type) => ({
|
|
9536
|
+
label: type,
|
|
9537
|
+
value: type
|
|
9538
|
+
}));
|
|
9539
|
+
var singleFieldResolver = defineResolver({
|
|
9540
|
+
type: "object",
|
|
9541
|
+
properties: {
|
|
9542
|
+
type: {
|
|
9543
|
+
label: "Field type",
|
|
9544
|
+
required: true,
|
|
9545
|
+
resolver: defineResolver({
|
|
9546
|
+
listItems: () => ({ data: fieldTypeChoices }),
|
|
9547
|
+
prompt: ({ items }) => ({
|
|
9548
|
+
type: "list",
|
|
9549
|
+
message: "Select field type:",
|
|
9550
|
+
choices: items
|
|
9551
|
+
})
|
|
9552
|
+
})
|
|
9553
|
+
},
|
|
9554
|
+
name: {
|
|
9555
|
+
label: "Field name",
|
|
9556
|
+
required: true,
|
|
9557
|
+
resolver: defineResolver({ type: "static", inputType: "text" })
|
|
9558
|
+
}
|
|
9559
|
+
}
|
|
9560
|
+
});
|
|
9561
|
+
var tableFieldsResolver = defineResolver({
|
|
9562
|
+
type: "array",
|
|
9563
|
+
items: singleFieldResolver,
|
|
9564
|
+
minItems: 1
|
|
9565
|
+
});
|
|
9566
|
+
|
|
9567
|
+
// src/resolvers/tableRecords.ts
|
|
9568
|
+
var listTableFieldsRef2 = declareMethod({ id: "listTableFields" });
|
|
9569
|
+
function tableFieldValueType(fieldType) {
|
|
9570
|
+
if (fieldType.startsWith("multiple_")) return "array";
|
|
9571
|
+
switch (fieldType) {
|
|
9572
|
+
case "number":
|
|
9573
|
+
case "decimal":
|
|
9574
|
+
case "currency":
|
|
9575
|
+
return "number";
|
|
9576
|
+
case "boolean":
|
|
9577
|
+
return "boolean";
|
|
9578
|
+
default:
|
|
9579
|
+
return void 0;
|
|
9580
|
+
}
|
|
9581
|
+
}
|
|
9582
|
+
function buildDataFields(fields) {
|
|
9583
|
+
const props = {};
|
|
9584
|
+
for (const field of fields) {
|
|
9585
|
+
const valueType = tableFieldValueType(field.type);
|
|
9586
|
+
props[field.id] = {
|
|
9587
|
+
label: field.name,
|
|
9588
|
+
required: false,
|
|
9589
|
+
...valueType ? { valueType } : {},
|
|
9590
|
+
resolver: { type: "static", inputType: "text" }
|
|
9591
|
+
};
|
|
9592
|
+
}
|
|
9593
|
+
return props;
|
|
9594
|
+
}
|
|
9595
|
+
function makeRecordsResolver(includeRecordId) {
|
|
9596
|
+
const singleRecordResolver = defineResolver({
|
|
9597
|
+
type: "object",
|
|
9598
|
+
imports: [listTableFieldsRef2],
|
|
9599
|
+
requireParameters: ["table"],
|
|
9600
|
+
// The record-id resolver is import-bearing, so it lives in `definitions` and
|
|
9601
|
+
// is reached by `{ ref }` from the built `id` field (updates only).
|
|
9602
|
+
definitions: includeRecordId ? { recordId: tableRecordIdResolver } : {},
|
|
9603
|
+
getProperties: async ({ imports, input }) => {
|
|
9604
|
+
const { data: fields } = await imports.listTableFields({
|
|
9605
|
+
table: input.table
|
|
9606
|
+
});
|
|
9607
|
+
const props = {
|
|
9608
|
+
data: {
|
|
9609
|
+
label: "Field values",
|
|
9610
|
+
resolver: { type: "object", properties: buildDataFields(fields) }
|
|
9611
|
+
}
|
|
9612
|
+
};
|
|
9613
|
+
if (includeRecordId) {
|
|
9614
|
+
props.id = {
|
|
9615
|
+
label: "Record",
|
|
9616
|
+
required: true,
|
|
9617
|
+
resolver: { ref: "recordId" }
|
|
9618
|
+
};
|
|
9619
|
+
}
|
|
9620
|
+
return props;
|
|
9748
9621
|
}
|
|
9749
|
-
};
|
|
9622
|
+
});
|
|
9623
|
+
return defineResolver({
|
|
9624
|
+
type: "array",
|
|
9625
|
+
requireParameters: ["table"],
|
|
9626
|
+
minItems: 1,
|
|
9627
|
+
items: singleRecordResolver
|
|
9628
|
+
});
|
|
9750
9629
|
}
|
|
9630
|
+
var tableRecordsResolver = makeRecordsResolver(false);
|
|
9631
|
+
var tableUpdateRecordsResolver = makeRecordsResolver(true);
|
|
9751
9632
|
|
|
9752
|
-
// src/resolvers/
|
|
9753
|
-
var
|
|
9754
|
-
|
|
9755
|
-
|
|
9756
|
-
|
|
9757
|
-
|
|
9758
|
-
|
|
9633
|
+
// src/resolvers/tableFilters.ts
|
|
9634
|
+
var listTableFieldsRef3 = declareMethod({ id: "listTableFields" });
|
|
9635
|
+
var FILTER_OPERATORS = [
|
|
9636
|
+
{ label: "equals", value: "exact" },
|
|
9637
|
+
{ label: "not equals", value: "different" },
|
|
9638
|
+
{ label: "contains", value: "contains" },
|
|
9639
|
+
{ label: "contains (case-insensitive)", value: "icontains" },
|
|
9640
|
+
{ label: "starts with", value: "startswith" },
|
|
9641
|
+
{ label: "search", value: "search" },
|
|
9642
|
+
{ label: "greater than", value: "gt" },
|
|
9643
|
+
{ label: "greater than or equal", value: "gte" },
|
|
9644
|
+
{ label: "less than", value: "lt" },
|
|
9645
|
+
{ label: "less than or equal", value: "lte" },
|
|
9646
|
+
{ label: "in range", value: "range" },
|
|
9647
|
+
{ label: "in list", value: "in" },
|
|
9648
|
+
{ label: "is empty", value: "isnull" },
|
|
9649
|
+
{ label: "is within (date)", value: "is_within" }
|
|
9650
|
+
];
|
|
9651
|
+
function fieldKeyChoices(fields) {
|
|
9652
|
+
return fields.flatMap((field) => {
|
|
9653
|
+
const components = NESTED_COMPONENTS[field.type];
|
|
9654
|
+
if (components && components.size > 1) {
|
|
9655
|
+
return [...components].map((component) => ({
|
|
9656
|
+
label: `${field.name}__${component} (${field.id}, ${field.type})`,
|
|
9657
|
+
value: `${field.name}__${component}`
|
|
9658
|
+
}));
|
|
9659
|
+
}
|
|
9660
|
+
return {
|
|
9661
|
+
label: `${field.name} (${field.id}${components ? `, ${field.type}` : ""})`,
|
|
9662
|
+
value: components ? `${field.name}__${[...components][0]}` : field.name
|
|
9663
|
+
};
|
|
9664
|
+
});
|
|
9759
9665
|
}
|
|
9760
|
-
|
|
9761
|
-
|
|
9762
|
-
|
|
9763
|
-
|
|
9764
|
-
})
|
|
9666
|
+
var singleFilterResolver = defineResolver({
|
|
9667
|
+
type: "object",
|
|
9668
|
+
imports: [listTableFieldsRef3],
|
|
9669
|
+
requireParameters: ["table"],
|
|
9670
|
+
getProperties: async ({ imports, input }) => {
|
|
9671
|
+
const { data: fields } = await imports.listTableFields({
|
|
9672
|
+
table: input.table
|
|
9673
|
+
});
|
|
9674
|
+
const choices = fieldKeyChoices(fields);
|
|
9675
|
+
const props = {
|
|
9676
|
+
fieldKey: {
|
|
9677
|
+
label: "Field",
|
|
9678
|
+
required: true,
|
|
9679
|
+
resolver: {
|
|
9680
|
+
type: "dynamic",
|
|
9681
|
+
listItems: () => ({ data: choices }),
|
|
9682
|
+
prompt: () => ({
|
|
9683
|
+
type: "list",
|
|
9684
|
+
message: "Select field:",
|
|
9685
|
+
choices
|
|
9686
|
+
})
|
|
9687
|
+
}
|
|
9688
|
+
},
|
|
9689
|
+
operator: {
|
|
9690
|
+
label: "Operator",
|
|
9691
|
+
required: true,
|
|
9692
|
+
resolver: {
|
|
9693
|
+
type: "dynamic",
|
|
9694
|
+
listItems: () => ({ data: FILTER_OPERATORS }),
|
|
9695
|
+
prompt: () => ({
|
|
9696
|
+
type: "list",
|
|
9697
|
+
message: "Select operator:",
|
|
9698
|
+
choices: FILTER_OPERATORS
|
|
9699
|
+
})
|
|
9700
|
+
}
|
|
9701
|
+
},
|
|
9702
|
+
value: {
|
|
9703
|
+
label: "Value",
|
|
9704
|
+
required: false,
|
|
9705
|
+
resolver: { type: "static", inputType: "text" }
|
|
9706
|
+
}
|
|
9707
|
+
};
|
|
9708
|
+
return props;
|
|
9709
|
+
}
|
|
9710
|
+
});
|
|
9711
|
+
var tableFiltersResolver = defineResolver({
|
|
9712
|
+
type: "array",
|
|
9713
|
+
requireParameters: ["table"],
|
|
9714
|
+
minItems: 0,
|
|
9715
|
+
items: singleFilterResolver
|
|
9716
|
+
});
|
|
9717
|
+
|
|
9718
|
+
// src/resolvers/tableSort.ts
|
|
9719
|
+
var listTableFieldsRef4 = declareMethod({ id: "listTableFields" });
|
|
9720
|
+
function fieldKeyChoices2(fields) {
|
|
9721
|
+
return fields.flatMap((field) => {
|
|
9722
|
+
const components = NESTED_COMPONENTS[field.type];
|
|
9723
|
+
if (components) {
|
|
9724
|
+
return [...components].map((component) => ({
|
|
9725
|
+
label: `${field.name}__${component} (${field.id}, ${field.type})`,
|
|
9726
|
+
value: `${field.name}__${component}`
|
|
9727
|
+
}));
|
|
9728
|
+
}
|
|
9729
|
+
return { label: `${field.name} (${field.id})`, value: field.name };
|
|
9730
|
+
});
|
|
9765
9731
|
}
|
|
9766
|
-
var
|
|
9767
|
-
|
|
9732
|
+
var DIRECTION_CHOICES = [
|
|
9733
|
+
{ label: "Ascending", value: "asc" },
|
|
9734
|
+
{ label: "Descending", value: "desc" }
|
|
9735
|
+
];
|
|
9736
|
+
var tableSortResolver = defineResolver({
|
|
9737
|
+
type: "object",
|
|
9738
|
+
imports: [listTableFieldsRef4],
|
|
9768
9739
|
requireParameters: ["table"],
|
|
9769
|
-
|
|
9770
|
-
|
|
9771
|
-
|
|
9772
|
-
|
|
9773
|
-
|
|
9774
|
-
|
|
9775
|
-
|
|
9776
|
-
|
|
9777
|
-
|
|
9778
|
-
|
|
9740
|
+
getProperties: async ({ imports, input }) => {
|
|
9741
|
+
const { data: fields } = await imports.listTableFields({
|
|
9742
|
+
table: input.table
|
|
9743
|
+
});
|
|
9744
|
+
const choices = fieldKeyChoices2(fields);
|
|
9745
|
+
const props = {
|
|
9746
|
+
fieldKey: {
|
|
9747
|
+
label: "Field",
|
|
9748
|
+
required: true,
|
|
9749
|
+
resolver: {
|
|
9750
|
+
type: "dynamic",
|
|
9751
|
+
listItems: () => ({ data: choices }),
|
|
9752
|
+
prompt: () => ({
|
|
9753
|
+
type: "list",
|
|
9754
|
+
message: "Select field:",
|
|
9755
|
+
choices
|
|
9756
|
+
})
|
|
9757
|
+
}
|
|
9758
|
+
},
|
|
9759
|
+
direction: {
|
|
9760
|
+
label: "Direction",
|
|
9761
|
+
required: true,
|
|
9762
|
+
resolver: {
|
|
9763
|
+
type: "dynamic",
|
|
9764
|
+
listItems: () => ({ data: DIRECTION_CHOICES }),
|
|
9765
|
+
prompt: () => ({
|
|
9766
|
+
type: "list",
|
|
9767
|
+
message: "Select direction:",
|
|
9768
|
+
choices: DIRECTION_CHOICES
|
|
9769
|
+
})
|
|
9770
|
+
}
|
|
9771
|
+
}
|
|
9772
|
+
};
|
|
9773
|
+
return props;
|
|
9774
|
+
}
|
|
9775
|
+
});
|
|
9776
|
+
var GetActionDescription = "Get detailed information about a specific action";
|
|
9777
|
+
var GetActionSchema = zod.z.object({
|
|
9778
|
+
app: AppPropertySchema,
|
|
9779
|
+
actionType: ActionTypePropertySchema,
|
|
9780
|
+
action: ActionPropertySchema
|
|
9781
|
+
}).describe(GetActionDescription).meta({ aliases: { appKey: "app", actionKey: "action" } });
|
|
9782
|
+
var GetActionSchemaDeprecated = zod.z.object({
|
|
9783
|
+
appKey: AppKeyPropertySchema,
|
|
9784
|
+
actionType: ActionTypePropertySchema,
|
|
9785
|
+
actionKey: ActionKeyPropertySchema
|
|
9786
|
+
});
|
|
9787
|
+
var GetActionInputSchema = zod.z.union([GetActionSchema, GetActionSchemaDeprecated]).describe(GetActionDescription);
|
|
9788
|
+
var ListActionsDescription = "List all actions for a specific app";
|
|
9789
|
+
var ListActionsBaseSchema = zod.z.object({
|
|
9790
|
+
pageSize: zod.z.number().min(1).optional().describe("Number of actions per page"),
|
|
9791
|
+
maxItems: zod.z.number().min(1).optional().describe("Maximum total items to return across all pages"),
|
|
9792
|
+
cursor: zod.z.string().optional().describe("Cursor to start from")
|
|
9793
|
+
});
|
|
9794
|
+
var ListActionsSchema = zod.z.object({
|
|
9795
|
+
app: AppPropertySchema.describe(
|
|
9796
|
+
"App key of actions to list (e.g., 'SlackCLIAPI' or slug like 'github')"
|
|
9797
|
+
),
|
|
9798
|
+
actionType: ActionTypePropertySchema.optional().describe(
|
|
9799
|
+
"Filter actions by type"
|
|
9800
|
+
)
|
|
9801
|
+
}).merge(ListActionsBaseSchema).describe(ListActionsDescription).meta({ aliases: { appKey: "app" } });
|
|
9802
|
+
var ListActionsSchemaDeprecated = zod.z.object({
|
|
9803
|
+
appKey: AppKeyPropertySchema.describe(
|
|
9804
|
+
"App key of actions to list (e.g., 'SlackCLIAPI' or slug like 'github')"
|
|
9805
|
+
),
|
|
9806
|
+
actionType: ActionTypePropertySchema.optional().describe(
|
|
9807
|
+
"Filter actions by type"
|
|
9808
|
+
)
|
|
9809
|
+
}).merge(ListActionsBaseSchema);
|
|
9810
|
+
var ListActionsInputSchema = zod.z.union([ListActionsSchema, ListActionsSchemaDeprecated]).describe(ListActionsDescription);
|
|
9811
|
+
var NeedChoicesSchema = zod.z.object({
|
|
9812
|
+
key: zod.z.string().optional(),
|
|
9813
|
+
label: zod.z.string().optional(),
|
|
9814
|
+
sample: zod.z.string().optional(),
|
|
9815
|
+
value: zod.z.string().optional()
|
|
9816
|
+
});
|
|
9817
|
+
var NeedSchema = zod.z.object({
|
|
9818
|
+
key: zod.z.string(),
|
|
9819
|
+
alters_custom_fields: zod.z.boolean().nullable().optional(),
|
|
9820
|
+
capabilities: zod.z.array(zod.z.string()).optional(),
|
|
9821
|
+
choices: zod.z.array(NeedChoicesSchema).optional(),
|
|
9822
|
+
computed: zod.z.boolean().nullable().optional(),
|
|
9823
|
+
custom_field: zod.z.boolean().optional(),
|
|
9824
|
+
default: zod.z.string().optional(),
|
|
9825
|
+
depends_on: zod.z.array(zod.z.string()).optional(),
|
|
9826
|
+
format: zod.z.literal("SELECT").optional(),
|
|
9827
|
+
from_search: zod.z.boolean().optional(),
|
|
9828
|
+
from_write: zod.z.boolean().optional(),
|
|
9829
|
+
help_text: zod.z.string().optional(),
|
|
9830
|
+
help_text_html: zod.z.string().optional(),
|
|
9831
|
+
input_format: zod.z.array(zod.z.string()).optional(),
|
|
9832
|
+
label: zod.z.string().optional(),
|
|
9833
|
+
language: zod.z.string().optional(),
|
|
9834
|
+
parent_key: zod.z.string().optional(),
|
|
9835
|
+
placeholder: zod.z.string().optional(),
|
|
9836
|
+
prefill: zod.z.string().optional(),
|
|
9837
|
+
required: zod.z.boolean().optional(),
|
|
9838
|
+
searchfill: zod.z.string().optional(),
|
|
9839
|
+
send_in_json: zod.z.boolean().optional(),
|
|
9840
|
+
regex: zod.z.string().optional(),
|
|
9841
|
+
type: zod.z.enum([
|
|
9842
|
+
"integer",
|
|
9843
|
+
"string",
|
|
9844
|
+
"text",
|
|
9845
|
+
"datetime",
|
|
9846
|
+
"boolean",
|
|
9847
|
+
"file",
|
|
9848
|
+
"decimal",
|
|
9849
|
+
"copy",
|
|
9850
|
+
"password",
|
|
9851
|
+
"dict",
|
|
9852
|
+
"code",
|
|
9853
|
+
"filter",
|
|
9854
|
+
"json"
|
|
9855
|
+
]).optional(),
|
|
9856
|
+
list: zod.z.boolean().optional()
|
|
9779
9857
|
});
|
|
9780
|
-
|
|
9781
|
-
|
|
9782
|
-
requireParameters: ["table"],
|
|
9783
|
-
listItems: ({ imports, input, cursor }) => imports.listTableRecords({
|
|
9784
|
-
table: input.table,
|
|
9785
|
-
keyMode: "names",
|
|
9786
|
-
cursor
|
|
9787
|
-
}),
|
|
9788
|
-
prompt: ({ items }) => ({
|
|
9789
|
-
type: "checkbox",
|
|
9790
|
-
message: "Select records to delete:",
|
|
9791
|
-
choices: recordChoices(items)
|
|
9792
|
-
}),
|
|
9793
|
-
validate: ({ value }) => Array.isArray(value) && value.length > 0 ? true : "Select at least one record"
|
|
9858
|
+
zod.z.object({
|
|
9859
|
+
action_url: zod.z.string().optional()
|
|
9794
9860
|
});
|
|
9795
|
-
|
|
9796
|
-
|
|
9797
|
-
var listTableFieldsRef = declareMethod({ id: "listTableFields" });
|
|
9798
|
-
var tableFieldIdsResolver = defineResolver({
|
|
9799
|
-
imports: [listTableFieldsRef],
|
|
9800
|
-
requireParameters: ["table"],
|
|
9801
|
-
// No cursor forwarding: the fields API is unpaginated (no cursor on the
|
|
9802
|
-
// response), so the listing is always exhausted after one page.
|
|
9803
|
-
listItems: ({ imports, input }) => imports.listTableFields({ table: input.table }),
|
|
9804
|
-
prompt: ({ items }) => ({
|
|
9805
|
-
type: "checkbox",
|
|
9806
|
-
message: "Select fields:",
|
|
9807
|
-
choices: items.map((field) => ({
|
|
9808
|
-
label: field.name,
|
|
9809
|
-
hint: [field.id, field.type],
|
|
9810
|
-
value: field.id
|
|
9811
|
-
}))
|
|
9812
|
-
}),
|
|
9813
|
-
validate: ({ value }) => Array.isArray(value) && value.length > 0 ? true : "Select at least one field"
|
|
9861
|
+
zod.z.object({
|
|
9862
|
+
can_use: zod.z.boolean().optional()
|
|
9814
9863
|
});
|
|
9815
|
-
|
|
9816
|
-
|
|
9817
|
-
|
|
9818
|
-
|
|
9819
|
-
|
|
9820
|
-
|
|
9864
|
+
var ActionSchema = zod.z.object({
|
|
9865
|
+
id: zod.z.string().optional(),
|
|
9866
|
+
type: zod.z.enum([
|
|
9867
|
+
"filter",
|
|
9868
|
+
"read",
|
|
9869
|
+
"read_bulk",
|
|
9870
|
+
"run",
|
|
9871
|
+
"search",
|
|
9872
|
+
"search_and_write",
|
|
9873
|
+
"search_or_write",
|
|
9874
|
+
"write"
|
|
9875
|
+
]),
|
|
9876
|
+
key: zod.z.string(),
|
|
9877
|
+
name: zod.z.string(),
|
|
9878
|
+
description: zod.z.string(),
|
|
9879
|
+
is_important: zod.z.boolean().optional(),
|
|
9880
|
+
is_hidden: zod.z.boolean().optional(),
|
|
9881
|
+
selected_api: zod.z.string().optional()
|
|
9821
9882
|
});
|
|
9822
|
-
var
|
|
9823
|
-
|
|
9824
|
-
|
|
9825
|
-
|
|
9826
|
-
|
|
9827
|
-
|
|
9828
|
-
|
|
9829
|
-
|
|
9830
|
-
|
|
9831
|
-
|
|
9832
|
-
|
|
9833
|
-
|
|
9834
|
-
|
|
9835
|
-
|
|
9836
|
-
|
|
9837
|
-
|
|
9838
|
-
|
|
9839
|
-
|
|
9840
|
-
|
|
9841
|
-
|
|
9842
|
-
|
|
9843
|
-
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
|
|
9851
|
-
|
|
9852
|
-
|
|
9853
|
-
|
|
9854
|
-
|
|
9883
|
+
var ChoiceSchema = zod.z.object({
|
|
9884
|
+
value: zod.z.union([zod.z.string(), zod.z.number()]),
|
|
9885
|
+
label: zod.z.string()
|
|
9886
|
+
});
|
|
9887
|
+
zod.z.object({
|
|
9888
|
+
key: zod.z.string(),
|
|
9889
|
+
label: zod.z.string(),
|
|
9890
|
+
type: zod.z.enum([
|
|
9891
|
+
"string",
|
|
9892
|
+
"number",
|
|
9893
|
+
"boolean",
|
|
9894
|
+
"datetime",
|
|
9895
|
+
"file",
|
|
9896
|
+
"object",
|
|
9897
|
+
"array"
|
|
9898
|
+
]),
|
|
9899
|
+
required: zod.z.boolean(),
|
|
9900
|
+
description: zod.z.string().optional(),
|
|
9901
|
+
choices: zod.z.array(ChoiceSchema).optional()
|
|
9902
|
+
});
|
|
9903
|
+
zod.z.object({
|
|
9904
|
+
data: zod.z.array(zod.z.unknown())
|
|
9905
|
+
});
|
|
9906
|
+
var ActionFieldChoiceSchema = zod.z.object({
|
|
9907
|
+
value: zod.z.union([zod.z.string(), zod.z.number()]),
|
|
9908
|
+
label: zod.z.string()
|
|
9909
|
+
});
|
|
9910
|
+
zod.z.object({
|
|
9911
|
+
key: zod.z.string(),
|
|
9912
|
+
label: zod.z.string().optional(),
|
|
9913
|
+
required: zod.z.boolean(),
|
|
9914
|
+
type: zod.z.string().optional(),
|
|
9915
|
+
helpText: zod.z.string().optional(),
|
|
9916
|
+
helpTextHtml: zod.z.string().optional(),
|
|
9917
|
+
choices: zod.z.array(ActionFieldChoiceSchema).optional(),
|
|
9918
|
+
default: zod.z.string().optional(),
|
|
9919
|
+
placeholder: zod.z.string().optional(),
|
|
9920
|
+
computed: zod.z.boolean().optional(),
|
|
9921
|
+
customField: zod.z.boolean().optional(),
|
|
9922
|
+
dependsOn: zod.z.array(zod.z.string()).optional(),
|
|
9923
|
+
format: zod.z.string().optional(),
|
|
9924
|
+
inputFormat: zod.z.array(zod.z.string()).optional()
|
|
9925
|
+
});
|
|
9926
|
+
zod.z.object({
|
|
9855
9927
|
id: zod.z.number(),
|
|
9856
|
-
|
|
9928
|
+
public_id: zod.z.string().optional(),
|
|
9929
|
+
code: zod.z.string(),
|
|
9930
|
+
user_id: zod.z.number(),
|
|
9931
|
+
auto_provisioned: zod.z.boolean(),
|
|
9932
|
+
first_name: zod.z.string(),
|
|
9933
|
+
last_name: zod.z.string(),
|
|
9934
|
+
username: zod.z.string(),
|
|
9935
|
+
personas: zod.z.string(),
|
|
9936
|
+
user_generated_personas: zod.z.string(),
|
|
9937
|
+
last_login: zod.z.string(),
|
|
9938
|
+
email: zod.z.string(),
|
|
9939
|
+
email_hash: zod.z.string(),
|
|
9940
|
+
email_confirmed: zod.z.boolean(),
|
|
9941
|
+
timezone: zod.z.string(),
|
|
9942
|
+
photo_url: zod.z.string(),
|
|
9943
|
+
has_seen_notifications: zod.z.record(zod.z.string(), zod.z.boolean().nullable()),
|
|
9944
|
+
signup: zod.z.string(),
|
|
9945
|
+
since_signup: zod.z.string(),
|
|
9946
|
+
has_activated: zod.z.boolean(),
|
|
9947
|
+
enable_gz_creator: zod.z.boolean(),
|
|
9948
|
+
should_see_nps_survey: zod.z.boolean(),
|
|
9949
|
+
is_developer: zod.z.boolean(),
|
|
9950
|
+
is_expert: zod.z.boolean(),
|
|
9951
|
+
tos_agreement: zod.z.boolean(),
|
|
9952
|
+
should_renew_tos: zod.z.boolean(),
|
|
9953
|
+
is_gdpr_consented: zod.z.boolean(),
|
|
9954
|
+
disable_ssl_check: zod.z.boolean(),
|
|
9955
|
+
identity: zod.z.number(),
|
|
9956
|
+
summary_schedule: zod.z.string(),
|
|
9957
|
+
alert_triggers: zod.z.string(),
|
|
9958
|
+
alert_actions: zod.z.string(),
|
|
9959
|
+
is_staff: zod.z.boolean(),
|
|
9960
|
+
is_zt_reviewer: zod.z.boolean(),
|
|
9961
|
+
is_high_value: zod.z.boolean(),
|
|
9962
|
+
is_temporary: zod.z.boolean(),
|
|
9963
|
+
banner_message: zod.z.string(),
|
|
9964
|
+
enable_totp_2fa: zod.z.boolean(),
|
|
9965
|
+
viewed_help: zod.z.record(zod.z.string(), zod.z.boolean()),
|
|
9966
|
+
show_editor_migration_mesaging: zod.z.boolean(),
|
|
9967
|
+
switches: zod.z.record(zod.z.string(), zod.z.unknown()),
|
|
9968
|
+
organizations: zod.z.array(zod.z.record(zod.z.string(), zod.z.unknown()).nullable()),
|
|
9969
|
+
primary_organization: zod.z.record(zod.z.string(), zod.z.unknown()).nullable(),
|
|
9970
|
+
has_active_zaps: zod.z.boolean(),
|
|
9971
|
+
has_google_sso: zod.z.boolean(),
|
|
9972
|
+
auth_realm: zod.z.string(),
|
|
9973
|
+
roles: zod.z.array(
|
|
9974
|
+
zod.z.object({
|
|
9975
|
+
account_id: zod.z.number(),
|
|
9976
|
+
role: zod.z.string()
|
|
9977
|
+
})
|
|
9978
|
+
)
|
|
9979
|
+
});
|
|
9980
|
+
zod.z.object({
|
|
9981
|
+
age_in_days: zod.z.string().optional(),
|
|
9982
|
+
api_docs_url: zod.z.string().nullable().optional(),
|
|
9983
|
+
app_profile_url: zod.z.string(),
|
|
9984
|
+
banner: zod.z.string().optional(),
|
|
9985
|
+
categories: zod.z.array(zod.z.string()).optional(),
|
|
9986
|
+
// Service category names
|
|
9987
|
+
canonical_id: zod.z.string().optional(),
|
|
9988
|
+
current_implementation_id: zod.z.string(),
|
|
9989
|
+
days_since_last_update: zod.z.string().optional(),
|
|
9990
|
+
description: zod.z.string(),
|
|
9991
|
+
external_url: zod.z.string(),
|
|
9992
|
+
hashtag: zod.z.string().optional(),
|
|
9993
|
+
id: zod.z.number().optional(),
|
|
9994
|
+
image: zod.z.string().optional(),
|
|
9995
|
+
images: zod.z.string().optional(),
|
|
9996
|
+
integration_overview_html: zod.z.string().nullable().optional(),
|
|
9997
|
+
internal_id: zod.z.string(),
|
|
9998
|
+
invite_url: zod.z.string().nullable().optional(),
|
|
9999
|
+
is_beta: zod.z.string().optional(),
|
|
10000
|
+
is_built_in: zod.z.string().optional(),
|
|
10001
|
+
is_featured: zod.z.string().optional(),
|
|
10002
|
+
is_premium: zod.z.boolean().optional(),
|
|
10003
|
+
is_public: zod.z.string().optional(),
|
|
10004
|
+
is_upcoming: zod.z.string().optional(),
|
|
10005
|
+
learn_more_url: zod.z.string(),
|
|
9857
10006
|
name: zod.z.string(),
|
|
9858
|
-
|
|
9859
|
-
|
|
9860
|
-
|
|
9861
|
-
|
|
9862
|
-
|
|
9863
|
-
|
|
9864
|
-
|
|
9865
|
-
|
|
10007
|
+
popularity: zod.z.number(),
|
|
10008
|
+
primary_color: zod.z.string(),
|
|
10009
|
+
request_count: zod.z.string().optional(),
|
|
10010
|
+
slug: zod.z.string(),
|
|
10011
|
+
zap_usage_count: zod.z.number().nullable().optional()
|
|
10012
|
+
});
|
|
10013
|
+
var ServiceSchema = zod.z.object({
|
|
10014
|
+
id: zod.z.number().optional(),
|
|
10015
|
+
canonical_id: zod.z.string().optional(),
|
|
10016
|
+
current_implementation_id: zod.z.string(),
|
|
10017
|
+
name: zod.z.string(),
|
|
10018
|
+
slug: zod.z.string(),
|
|
10019
|
+
app_url: zod.z.string().optional(),
|
|
10020
|
+
learn_more_url: zod.z.string().optional(),
|
|
10021
|
+
description: zod.z.string(),
|
|
10022
|
+
primary_color: zod.z.string(),
|
|
10023
|
+
popularity: zod.z.number(),
|
|
10024
|
+
image: zod.z.string().optional(),
|
|
10025
|
+
images: zod.z.string().optional()
|
|
9866
10026
|
});
|
|
9867
|
-
|
|
9868
|
-
|
|
10027
|
+
zod.z.object({
|
|
10028
|
+
results: zod.z.array(ServiceSchema),
|
|
10029
|
+
next: zod.z.string().nullable().optional(),
|
|
10030
|
+
previous: zod.z.string().nullable().optional()
|
|
9869
10031
|
});
|
|
9870
|
-
|
|
9871
|
-
|
|
9872
|
-
|
|
9873
|
-
|
|
9874
|
-
|
|
9875
|
-
|
|
9876
|
-
options: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
|
|
9877
|
-
config: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
|
|
9878
|
-
deleted_at: zod.z.string().nullable().optional()
|
|
10032
|
+
zod.z.object({
|
|
10033
|
+
selected_api: zod.z.string(),
|
|
10034
|
+
action: zod.z.string(),
|
|
10035
|
+
type_of: zod.z.string(),
|
|
10036
|
+
authentication_id: zod.z.union([zod.z.string(), zod.z.number()]).optional(),
|
|
10037
|
+
params: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
|
|
9879
10038
|
});
|
|
9880
|
-
|
|
9881
|
-
|
|
9882
|
-
|
|
9883
|
-
|
|
9884
|
-
|
|
9885
|
-
).
|
|
9886
|
-
trash: TrashSchema
|
|
10039
|
+
zod.z.object({
|
|
10040
|
+
success: zod.z.boolean(),
|
|
10041
|
+
needs: zod.z.array(NeedSchema).optional(),
|
|
10042
|
+
errors: zod.z.array(zod.z.string()).optional(),
|
|
10043
|
+
last_fetched_at: zod.z.string().optional(),
|
|
10044
|
+
schema: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
|
|
9887
10045
|
});
|
|
9888
|
-
var
|
|
9889
|
-
|
|
9890
|
-
|
|
9891
|
-
|
|
9892
|
-
|
|
9893
|
-
|
|
9894
|
-
|
|
9895
|
-
|
|
9896
|
-
|
|
9897
|
-
|
|
9898
|
-
|
|
9899
|
-
|
|
9900
|
-
|
|
9901
|
-
|
|
9902
|
-
|
|
9903
|
-
|
|
9904
|
-
|
|
9905
|
-
|
|
9906
|
-
|
|
9907
|
-
resolver: defineResolver({
|
|
9908
|
-
listItems: () => ({ data: fieldTypeChoices }),
|
|
9909
|
-
prompt: ({ items }) => ({
|
|
9910
|
-
type: "list",
|
|
9911
|
-
message: "Select field type:",
|
|
9912
|
-
choices: items
|
|
9913
|
-
})
|
|
9914
|
-
})
|
|
9915
|
-
},
|
|
9916
|
-
name: {
|
|
9917
|
-
label: "Field name",
|
|
9918
|
-
required: true,
|
|
9919
|
-
resolver: defineResolver({ type: "static", inputType: "text" })
|
|
9920
|
-
}
|
|
9921
|
-
}
|
|
10046
|
+
var ImplementationSchema = zod.z.object({
|
|
10047
|
+
selected_api: zod.z.string(),
|
|
10048
|
+
app_id: zod.z.number().optional(),
|
|
10049
|
+
auth_type: zod.z.string().optional(),
|
|
10050
|
+
auth_fields: zod.z.string().optional(),
|
|
10051
|
+
actions: zod.z.array(ActionSchema).optional(),
|
|
10052
|
+
is_deprecated: zod.z.boolean().optional(),
|
|
10053
|
+
is_private_only: zod.z.boolean().optional(),
|
|
10054
|
+
is_invite_only: zod.z.boolean().optional(),
|
|
10055
|
+
is_beta: zod.z.boolean().optional().default(false),
|
|
10056
|
+
is_premium: zod.z.boolean().optional().default(false),
|
|
10057
|
+
is_hidden: zod.z.string().optional(),
|
|
10058
|
+
name: zod.z.string().optional(),
|
|
10059
|
+
slug: zod.z.string().optional(),
|
|
10060
|
+
images: zod.z.record(zod.z.string(), zod.z.string().nullable()).optional(),
|
|
10061
|
+
primary_color: zod.z.string().optional(),
|
|
10062
|
+
secondary_color: zod.z.string().optional(),
|
|
10063
|
+
current_implementation: zod.z.string().optional(),
|
|
10064
|
+
other_implementations: zod.z.string().optional()
|
|
9922
10065
|
});
|
|
9923
|
-
|
|
9924
|
-
|
|
9925
|
-
|
|
9926
|
-
|
|
10066
|
+
zod.z.object({
|
|
10067
|
+
count: zod.z.number(),
|
|
10068
|
+
next: zod.z.string().nullable().optional(),
|
|
10069
|
+
previous: zod.z.string().nullable().optional(),
|
|
10070
|
+
results: zod.z.array(ImplementationSchema)
|
|
9927
10071
|
});
|
|
9928
|
-
|
|
9929
|
-
|
|
9930
|
-
|
|
9931
|
-
|
|
9932
|
-
|
|
9933
|
-
|
|
9934
|
-
|
|
9935
|
-
|
|
9936
|
-
|
|
9937
|
-
|
|
9938
|
-
|
|
9939
|
-
|
|
9940
|
-
|
|
9941
|
-
|
|
9942
|
-
|
|
9943
|
-
|
|
9944
|
-
|
|
9945
|
-
|
|
9946
|
-
|
|
9947
|
-
|
|
9948
|
-
|
|
9949
|
-
|
|
9950
|
-
|
|
9951
|
-
|
|
9952
|
-
|
|
9953
|
-
|
|
9954
|
-
|
|
9955
|
-
return props;
|
|
9956
|
-
}
|
|
9957
|
-
function makeRecordsResolver(includeRecordId) {
|
|
9958
|
-
const singleRecordResolver = defineResolver({
|
|
9959
|
-
type: "object",
|
|
9960
|
-
imports: [listTableFieldsRef2],
|
|
9961
|
-
requireParameters: ["table"],
|
|
9962
|
-
// The record-id resolver is import-bearing, so it lives in `definitions` and
|
|
9963
|
-
// is reached by `{ ref }` from the built `id` field (updates only).
|
|
9964
|
-
definitions: includeRecordId ? { recordId: tableRecordIdResolver } : {},
|
|
9965
|
-
getProperties: async ({ imports, input }) => {
|
|
9966
|
-
const { data: fields } = await imports.listTableFields({
|
|
9967
|
-
table: input.table
|
|
9968
|
-
});
|
|
9969
|
-
const props = {
|
|
9970
|
-
data: {
|
|
9971
|
-
label: "Field values",
|
|
9972
|
-
resolver: { type: "object", properties: buildDataFields(fields) }
|
|
9973
|
-
}
|
|
9974
|
-
};
|
|
9975
|
-
if (includeRecordId) {
|
|
9976
|
-
props.id = {
|
|
9977
|
-
label: "Record",
|
|
9978
|
-
required: true,
|
|
9979
|
-
resolver: { ref: "recordId" }
|
|
9980
|
-
};
|
|
9981
|
-
}
|
|
9982
|
-
return props;
|
|
9983
|
-
}
|
|
9984
|
-
});
|
|
9985
|
-
return defineResolver({
|
|
9986
|
-
type: "array",
|
|
9987
|
-
requireParameters: ["table"],
|
|
9988
|
-
minItems: 1,
|
|
9989
|
-
items: singleRecordResolver
|
|
9990
|
-
});
|
|
9991
|
-
}
|
|
9992
|
-
var tableRecordsResolver = makeRecordsResolver(false);
|
|
9993
|
-
var tableUpdateRecordsResolver = makeRecordsResolver(true);
|
|
9994
|
-
|
|
9995
|
-
// src/resolvers/tableFilters.ts
|
|
9996
|
-
var listTableFieldsRef3 = declareMethod({ id: "listTableFields" });
|
|
9997
|
-
var FILTER_OPERATORS = [
|
|
9998
|
-
{ label: "equals", value: "exact" },
|
|
9999
|
-
{ label: "not equals", value: "different" },
|
|
10000
|
-
{ label: "contains", value: "contains" },
|
|
10001
|
-
{ label: "contains (case-insensitive)", value: "icontains" },
|
|
10002
|
-
{ label: "starts with", value: "startswith" },
|
|
10003
|
-
{ label: "search", value: "search" },
|
|
10004
|
-
{ label: "greater than", value: "gt" },
|
|
10005
|
-
{ label: "greater than or equal", value: "gte" },
|
|
10006
|
-
{ label: "less than", value: "lt" },
|
|
10007
|
-
{ label: "less than or equal", value: "lte" },
|
|
10008
|
-
{ label: "in range", value: "range" },
|
|
10009
|
-
{ label: "in list", value: "in" },
|
|
10010
|
-
{ label: "is empty", value: "isnull" },
|
|
10011
|
-
{ label: "is within (date)", value: "is_within" }
|
|
10012
|
-
];
|
|
10013
|
-
function fieldKeyChoices(fields) {
|
|
10014
|
-
return fields.flatMap((field) => {
|
|
10015
|
-
const components = NESTED_COMPONENTS[field.type];
|
|
10016
|
-
if (components && components.size > 1) {
|
|
10017
|
-
return [...components].map((component) => ({
|
|
10018
|
-
label: `${field.name}__${component} (${field.id}, ${field.type})`,
|
|
10019
|
-
value: `${field.name}__${component}`
|
|
10020
|
-
}));
|
|
10021
|
-
}
|
|
10022
|
-
return {
|
|
10023
|
-
label: `${field.name} (${field.id}${components ? `, ${field.type}` : ""})`,
|
|
10024
|
-
value: components ? `${field.name}__${[...components][0]}` : field.name
|
|
10025
|
-
};
|
|
10026
|
-
});
|
|
10027
|
-
}
|
|
10028
|
-
var singleFilterResolver = defineResolver({
|
|
10029
|
-
type: "object",
|
|
10030
|
-
imports: [listTableFieldsRef3],
|
|
10031
|
-
requireParameters: ["table"],
|
|
10032
|
-
getProperties: async ({ imports, input }) => {
|
|
10033
|
-
const { data: fields } = await imports.listTableFields({
|
|
10034
|
-
table: input.table
|
|
10035
|
-
});
|
|
10036
|
-
const choices = fieldKeyChoices(fields);
|
|
10037
|
-
const props = {
|
|
10038
|
-
fieldKey: {
|
|
10039
|
-
label: "Field",
|
|
10040
|
-
required: true,
|
|
10041
|
-
resolver: {
|
|
10042
|
-
type: "dynamic",
|
|
10043
|
-
listItems: () => ({ data: choices }),
|
|
10044
|
-
prompt: () => ({
|
|
10045
|
-
type: "list",
|
|
10046
|
-
message: "Select field:",
|
|
10047
|
-
choices
|
|
10048
|
-
})
|
|
10049
|
-
}
|
|
10050
|
-
},
|
|
10051
|
-
operator: {
|
|
10052
|
-
label: "Operator",
|
|
10053
|
-
required: true,
|
|
10054
|
-
resolver: {
|
|
10055
|
-
type: "dynamic",
|
|
10056
|
-
listItems: () => ({ data: FILTER_OPERATORS }),
|
|
10057
|
-
prompt: () => ({
|
|
10058
|
-
type: "list",
|
|
10059
|
-
message: "Select operator:",
|
|
10060
|
-
choices: FILTER_OPERATORS
|
|
10061
|
-
})
|
|
10062
|
-
}
|
|
10063
|
-
},
|
|
10064
|
-
value: {
|
|
10065
|
-
label: "Value",
|
|
10066
|
-
required: false,
|
|
10067
|
-
resolver: { type: "static", inputType: "text" }
|
|
10068
|
-
}
|
|
10069
|
-
};
|
|
10070
|
-
return props;
|
|
10071
|
-
}
|
|
10072
|
+
var NeedChoicesResponseMetaSchema = zod.z.object({
|
|
10073
|
+
page: zod.z.string().nullable().optional()
|
|
10074
|
+
});
|
|
10075
|
+
var NeedChoicesResponseLinksSchema = zod.z.object({
|
|
10076
|
+
next: zod.z.string().nullable().optional(),
|
|
10077
|
+
prev: zod.z.string().nullable().optional()
|
|
10078
|
+
});
|
|
10079
|
+
zod.z.object({
|
|
10080
|
+
selected_api: zod.z.string().optional().describe(
|
|
10081
|
+
"Something like `SlackAPI` (for Python apps) or `SplitwiseCLIAPI@1.0.0` (for CLI apps). Non-public apps are fine as long as the authed user can access them."
|
|
10082
|
+
),
|
|
10083
|
+
authentication_id: zod.z.union([zod.z.string(), zod.z.number()]).optional().describe(
|
|
10084
|
+
"If the app needs auth, provide an `authentication_id` that has the `selected_api` of the app you want to run. Can be any auth visible to the user (including shared)."
|
|
10085
|
+
),
|
|
10086
|
+
params: zod.z.record(zod.z.string(), zod.z.unknown()).optional().describe(
|
|
10087
|
+
"Object that matches the input the node would normally get. Has all the same keys/types as the `needs` of the action."
|
|
10088
|
+
),
|
|
10089
|
+
page: zod.z.number().optional().default(0),
|
|
10090
|
+
prefill: zod.z.string().optional().describe(
|
|
10091
|
+
"The prefill string to indicate what we're fetching choices for. Likely something like `spreadsheet.id.title`. Must be provided alongside `selected_api` if both `action_id` and `input_field_id` are not."
|
|
10092
|
+
),
|
|
10093
|
+
action_id: zod.z.string().optional().describe(
|
|
10094
|
+
"The id that will be used to lookup the Action for prefill lookup. If provided, `input_field_id` is required, else `prefill` must be provided."
|
|
10095
|
+
),
|
|
10096
|
+
input_field_id: zod.z.string().optional().describe(
|
|
10097
|
+
"The id (key) of the input field (Need) that dynamic choices are being retrieved for. If provided, `action_id` is required, else `prefill` must be provided."
|
|
10098
|
+
)
|
|
10072
10099
|
});
|
|
10073
|
-
|
|
10074
|
-
|
|
10075
|
-
|
|
10076
|
-
|
|
10077
|
-
|
|
10100
|
+
zod.z.object({
|
|
10101
|
+
success: zod.z.boolean(),
|
|
10102
|
+
choices: zod.z.array(NeedChoicesSchema).optional(),
|
|
10103
|
+
next_page: zod.z.number().optional(),
|
|
10104
|
+
errors: zod.z.array(zod.z.string()).optional(),
|
|
10105
|
+
meta: NeedChoicesResponseMetaSchema.optional(),
|
|
10106
|
+
links: NeedChoicesResponseLinksSchema.optional()
|
|
10078
10107
|
});
|
|
10079
10108
|
|
|
10080
|
-
// src/
|
|
10081
|
-
var
|
|
10082
|
-
|
|
10083
|
-
|
|
10084
|
-
|
|
10085
|
-
|
|
10086
|
-
|
|
10087
|
-
|
|
10088
|
-
|
|
10089
|
-
|
|
10090
|
-
|
|
10091
|
-
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
|
|
10095
|
-
|
|
10096
|
-
|
|
10097
|
-
|
|
10098
|
-
|
|
10099
|
-
|
|
10100
|
-
|
|
10101
|
-
|
|
10102
|
-
|
|
10103
|
-
|
|
10104
|
-
|
|
10105
|
-
});
|
|
10106
|
-
const choices = fieldKeyChoices2(fields);
|
|
10107
|
-
const props = {
|
|
10108
|
-
fieldKey: {
|
|
10109
|
-
label: "Field",
|
|
10110
|
-
required: true,
|
|
10111
|
-
resolver: {
|
|
10112
|
-
type: "dynamic",
|
|
10113
|
-
listItems: () => ({ data: choices }),
|
|
10114
|
-
prompt: () => ({
|
|
10115
|
-
type: "list",
|
|
10116
|
-
message: "Select field:",
|
|
10117
|
-
choices
|
|
10118
|
-
})
|
|
10119
|
-
}
|
|
10120
|
-
},
|
|
10121
|
-
direction: {
|
|
10122
|
-
label: "Direction",
|
|
10123
|
-
required: true,
|
|
10124
|
-
resolver: {
|
|
10125
|
-
type: "dynamic",
|
|
10126
|
-
listItems: () => ({ data: DIRECTION_CHOICES }),
|
|
10127
|
-
prompt: () => ({
|
|
10128
|
-
type: "list",
|
|
10129
|
-
message: "Select direction:",
|
|
10130
|
-
choices: DIRECTION_CHOICES
|
|
10131
|
-
})
|
|
10132
|
-
}
|
|
10133
|
-
}
|
|
10134
|
-
};
|
|
10135
|
-
return props;
|
|
10109
|
+
// src/schemas/Action.ts
|
|
10110
|
+
var ActionItemSchema = ActionSchema.omit({
|
|
10111
|
+
type: true,
|
|
10112
|
+
name: true,
|
|
10113
|
+
selected_api: true
|
|
10114
|
+
}).extend({
|
|
10115
|
+
app_key: zod.z.string(),
|
|
10116
|
+
// App key without version (extracted from selected_api)
|
|
10117
|
+
app_version: zod.z.string().optional(),
|
|
10118
|
+
// Version extracted from selected_api
|
|
10119
|
+
action_type: ActionSchema.shape.type,
|
|
10120
|
+
// Mapped from original 'type' field
|
|
10121
|
+
title: zod.z.string(),
|
|
10122
|
+
// Mapped from original 'name' field
|
|
10123
|
+
type: zod.z.literal("action")
|
|
10124
|
+
// Fixed type identifier
|
|
10125
|
+
});
|
|
10126
|
+
|
|
10127
|
+
// src/formatters/action.ts
|
|
10128
|
+
function formatActionItem(item) {
|
|
10129
|
+
const details = [{ text: `Type: ${item.action_type}`, style: "accent" }];
|
|
10130
|
+
if (item.app_key) {
|
|
10131
|
+
details.push({ text: `App: ${item.app_key}`, style: "normal" });
|
|
10132
|
+
}
|
|
10133
|
+
if (item.description) {
|
|
10134
|
+
details.push({ text: item.description, style: "dim" });
|
|
10136
10135
|
}
|
|
10136
|
+
return {
|
|
10137
|
+
title: item.title || item.key,
|
|
10138
|
+
// `hint` is the dumb secondary string shown after the title (the action key
|
|
10139
|
+
// and, when present, its id). Replaces the deprecated `key`/`id` fields.
|
|
10140
|
+
hint: [item.key, item.id].filter((v) => Boolean(v)),
|
|
10141
|
+
description: item.description,
|
|
10142
|
+
details
|
|
10143
|
+
};
|
|
10144
|
+
}
|
|
10145
|
+
var actionItemFormatter = defineFormatter({
|
|
10146
|
+
format: ({ item }) => formatActionItem(item)
|
|
10137
10147
|
});
|
|
10138
10148
|
|
|
10139
10149
|
// src/plugins/listActions/index.ts
|
|
@@ -10232,65 +10242,37 @@ var getActionPlugin = defineMethod({
|
|
|
10232
10242
|
);
|
|
10233
10243
|
}
|
|
10234
10244
|
});
|
|
10235
|
-
|
|
10236
|
-
|
|
10237
|
-
|
|
10238
|
-
|
|
10239
|
-
|
|
10240
|
-
|
|
10241
|
-
|
|
10242
|
-
|
|
10243
|
-
|
|
10244
|
-
|
|
10245
|
-
|
|
10246
|
-
|
|
10247
|
-
|
|
10248
|
-
|
|
10249
|
-
|
|
10250
|
-
|
|
10251
|
-
|
|
10252
|
-
|
|
10253
|
-
|
|
10254
|
-
|
|
10255
|
-
|
|
10256
|
-
|
|
10257
|
-
|
|
10258
|
-
|
|
10259
|
-
|
|
10260
|
-
|
|
10261
|
-
|
|
10262
|
-
"/zapier/api/actions/v1/runs",
|
|
10263
|
-
runRequest,
|
|
10264
|
-
{
|
|
10265
|
-
approvalContext: () => policyContext.buildActionRunContext({
|
|
10266
|
-
selected_api: selectedApi,
|
|
10267
|
-
action_type: actionType,
|
|
10268
|
-
action_key: actionKey,
|
|
10269
|
-
connection_id: connectionId != null ? String(connectionId) : void 0,
|
|
10270
|
-
// Cast: inputs is Record<string, unknown> at the SDK surface;
|
|
10271
|
-
// buildActionRunContext validates it as JSON at runtime via zod
|
|
10272
|
-
// (non-JSON values like Date/undefined are rejected there).
|
|
10273
|
-
inputs: executionOptions.inputs ?? {}
|
|
10274
|
-
})
|
|
10275
|
-
}
|
|
10276
|
-
);
|
|
10277
|
-
const runId = runData.data.id;
|
|
10278
|
-
return await api.poll(`/zapier/api/actions/v1/runs/${runId}`, {
|
|
10279
|
-
successStatus: 200,
|
|
10280
|
-
pendingStatus: 202,
|
|
10281
|
-
timeoutMilliseconds: timeoutMilliseconds ?? DEFAULT_ACTION_TIMEOUT_MILLISECONDS,
|
|
10282
|
-
resource: { type: "run", id: runId },
|
|
10283
|
-
isPending: (result) => {
|
|
10284
|
-
const data = result?.data;
|
|
10285
|
-
return data?.status === "waiting";
|
|
10286
|
-
},
|
|
10287
|
-
resultExtractor: (result) => result.data
|
|
10288
|
-
});
|
|
10289
|
-
}
|
|
10245
|
+
var CreateActionRunSchema = zod.z.object({
|
|
10246
|
+
app: AppPropertySchema,
|
|
10247
|
+
actionType: ActionTypePropertySchema,
|
|
10248
|
+
action: ActionPropertySchema,
|
|
10249
|
+
connection: ConnectionPropertySchema.optional().describe(
|
|
10250
|
+
"Connection alias or connection ID (UUID or positive integer). Required if the action needs a connection to authenticate and interact with the service. Strings that match a key in the connections map are resolved against it; otherwise the value is used as a connection ID directly."
|
|
10251
|
+
),
|
|
10252
|
+
inputs: InputsPropertySchema.optional().describe(
|
|
10253
|
+
"Input parameters for the action"
|
|
10254
|
+
),
|
|
10255
|
+
page: zod.z.string().optional().describe(
|
|
10256
|
+
"Page to fetch for bulk read actions. Pass the `next_page` a previous run returned to fetch the following page."
|
|
10257
|
+
),
|
|
10258
|
+
callbackUrl: zod.z.string().url().optional().describe(
|
|
10259
|
+
"URL Zapier posts the finished run to, so you do not have to poll for it. Must use HTTPS and resolve to a public host, so a local receiver needs a tunnel. The body matches what `getActionRun` returns. Verify the `Zapier-Callback-Signature` header, and expect the same run to arrive more than once."
|
|
10260
|
+
).meta({ valueHint: "url" })
|
|
10261
|
+
}).describe(
|
|
10262
|
+
"Start an action run and return its ID without waiting for the result. Running an action is asynchronous: this hands back a run ID immediately, and `getActionRun` fetches the outcome. Reach for this pair when you want to start work and collect it later (fan out many runs, hand the ID to another process, survive a restart). `runAction` is the one-call form that starts a run and waits for its result."
|
|
10263
|
+
);
|
|
10264
|
+
var ActionRunStartedItemSchema = zod.z.object({
|
|
10265
|
+
id: zod.z.string().describe(
|
|
10266
|
+
"Action run ID. Pass it as the `run` for `getActionRun` to fetch the run's result."
|
|
10267
|
+
),
|
|
10268
|
+
implementation_id: zod.z.string().describe(
|
|
10269
|
+
"Versioned implementation ID the run was started against (e.g. 'SlackCLIAPI@1.21.1'). The versionless app key is the part before the `@`."
|
|
10270
|
+
)
|
|
10271
|
+
});
|
|
10290
10272
|
var CONTEXT_CACHE_TTL_MILLISECONDS = 6e4;
|
|
10291
10273
|
var CONTEXT_CACHE_MAX_SIZE = 500;
|
|
10292
|
-
var
|
|
10293
|
-
name: "
|
|
10274
|
+
var createActionRunPlugin = defineMethod({
|
|
10275
|
+
name: "createActionRun",
|
|
10294
10276
|
imports: [
|
|
10295
10277
|
connectionsPluginRef,
|
|
10296
10278
|
manifestPluginRef,
|
|
@@ -10298,14 +10280,11 @@ var runActionPlugin = defineMethod({
|
|
|
10298
10280
|
getActionPlugin
|
|
10299
10281
|
],
|
|
10300
10282
|
categories: ["action"],
|
|
10301
|
-
|
|
10302
|
-
|
|
10303
|
-
|
|
10304
|
-
|
|
10305
|
-
|
|
10306
|
-
// No defaultPageSize — leave the default to the Actions API rather than
|
|
10307
|
-
// eagerly running more actions than the user intends (avoids app rate limits).
|
|
10308
|
-
output: "list",
|
|
10283
|
+
type: "create",
|
|
10284
|
+
itemType: "StartedActionRun",
|
|
10285
|
+
inputSchema: CreateActionRunSchema,
|
|
10286
|
+
outputSchema: ActionRunStartedItemSchema,
|
|
10287
|
+
output: "item",
|
|
10309
10288
|
resolvers: {
|
|
10310
10289
|
app: appKeyResolver,
|
|
10311
10290
|
actionType: actionTypeResolver,
|
|
@@ -10313,14 +10292,12 @@ var runActionPlugin = defineMethod({
|
|
|
10313
10292
|
connection: connectionIdResolver,
|
|
10314
10293
|
inputs: inputsResolver
|
|
10315
10294
|
},
|
|
10316
|
-
// A per-SDK-instance TTL cache of resolved (selectedApi, actionId), built once
|
|
10317
|
-
// in setup so it persists across calls. The imports it resolves through
|
|
10318
|
-
// (`manifest.getVersionedImplementationId`, `getAction`) are threaded in per
|
|
10319
|
-
// call from `run`, not captured here.
|
|
10320
10295
|
setup: () => {
|
|
10321
10296
|
const cache = /* @__PURE__ */ new Map();
|
|
10322
10297
|
function evictIfNeeded() {
|
|
10323
|
-
if (cache.size < CONTEXT_CACHE_MAX_SIZE)
|
|
10298
|
+
if (cache.size < CONTEXT_CACHE_MAX_SIZE) {
|
|
10299
|
+
return;
|
|
10300
|
+
}
|
|
10324
10301
|
const now = Date.now();
|
|
10325
10302
|
let oldestKey;
|
|
10326
10303
|
let oldestExpiry = Infinity;
|
|
@@ -10334,13 +10311,15 @@ var runActionPlugin = defineMethod({
|
|
|
10334
10311
|
oldestKey = key;
|
|
10335
10312
|
}
|
|
10336
10313
|
}
|
|
10337
|
-
if (!evictedAny && oldestKey)
|
|
10314
|
+
if (!evictedAny && oldestKey) {
|
|
10315
|
+
cache.delete(oldestKey);
|
|
10316
|
+
}
|
|
10338
10317
|
}
|
|
10339
|
-
async function
|
|
10318
|
+
async function resolveActionRunContext(options) {
|
|
10340
10319
|
const { imports, appKey, actionKey, actionType } = options;
|
|
10341
10320
|
const getVersionedImplementationId = imports.manifest.getVersionedImplementationId;
|
|
10342
|
-
const
|
|
10343
|
-
if (!
|
|
10321
|
+
const implementationId = await getVersionedImplementationId(appKey);
|
|
10322
|
+
if (!implementationId) {
|
|
10344
10323
|
throw new ZapierConfigurationError(
|
|
10345
10324
|
"No current_implementation_id found for app",
|
|
10346
10325
|
{ configType: "current_implementation_id" }
|
|
@@ -10356,15 +10335,19 @@ var runActionPlugin = defineMethod({
|
|
|
10356
10335
|
`Action type mismatch: expected ${actionType}, got ${actionData.data.action_type}`
|
|
10357
10336
|
);
|
|
10358
10337
|
}
|
|
10359
|
-
return {
|
|
10338
|
+
return { implementationId, actionId: actionData.data.id };
|
|
10360
10339
|
}
|
|
10361
|
-
function
|
|
10340
|
+
function getActionRunContext(options) {
|
|
10362
10341
|
const contextKey = `${options.appKey}:${options.actionKey}:${options.actionType}`;
|
|
10363
10342
|
const cached = cache.get(contextKey);
|
|
10364
|
-
if (cached && Date.now() < cached.expiresAt)
|
|
10365
|
-
|
|
10343
|
+
if (cached && Date.now() < cached.expiresAt) {
|
|
10344
|
+
return cached.promise;
|
|
10345
|
+
}
|
|
10346
|
+
const pending = resolveActionRunContext(options).catch((error) => {
|
|
10366
10347
|
const current = cache.get(contextKey);
|
|
10367
|
-
if (current?.promise === pending)
|
|
10348
|
+
if (current?.promise === pending) {
|
|
10349
|
+
cache.delete(contextKey);
|
|
10350
|
+
}
|
|
10368
10351
|
throw error;
|
|
10369
10352
|
});
|
|
10370
10353
|
evictIfNeeded();
|
|
@@ -10374,11 +10357,105 @@ var runActionPlugin = defineMethod({
|
|
|
10374
10357
|
});
|
|
10375
10358
|
return pending;
|
|
10376
10359
|
}
|
|
10377
|
-
return {
|
|
10360
|
+
return { getActionRunContext };
|
|
10378
10361
|
},
|
|
10379
10362
|
run: async ({ imports, input, state, annotate }) => {
|
|
10380
10363
|
const api = imports.api;
|
|
10381
|
-
const
|
|
10364
|
+
const {
|
|
10365
|
+
app: appKey,
|
|
10366
|
+
action: actionKey,
|
|
10367
|
+
actionType,
|
|
10368
|
+
connection,
|
|
10369
|
+
inputs = {},
|
|
10370
|
+
page,
|
|
10371
|
+
callbackUrl
|
|
10372
|
+
} = input;
|
|
10373
|
+
const connectionId = await resolveConnectionId({
|
|
10374
|
+
connection,
|
|
10375
|
+
resolveConnection: imports.connections.resolveConnection
|
|
10376
|
+
});
|
|
10377
|
+
const { implementationId, actionId } = await state.getActionRunContext({
|
|
10378
|
+
imports,
|
|
10379
|
+
appKey,
|
|
10380
|
+
actionKey,
|
|
10381
|
+
actionType
|
|
10382
|
+
});
|
|
10383
|
+
annotate({ selectedApi: implementationId });
|
|
10384
|
+
const runRequestData = {
|
|
10385
|
+
selected_api: implementationId,
|
|
10386
|
+
// Some actions require the action ID, but it's not guaranteed available
|
|
10387
|
+
// at retrieval time (legacy), so pass everything through.
|
|
10388
|
+
action_id: actionId,
|
|
10389
|
+
action_key: actionKey,
|
|
10390
|
+
action_type: actionType,
|
|
10391
|
+
inputs
|
|
10392
|
+
};
|
|
10393
|
+
if (connectionId != null) {
|
|
10394
|
+
runRequestData.authentication_id = connectionId;
|
|
10395
|
+
}
|
|
10396
|
+
if (page) {
|
|
10397
|
+
runRequestData.page = page;
|
|
10398
|
+
}
|
|
10399
|
+
if (callbackUrl) {
|
|
10400
|
+
runRequestData.callback_url = callbackUrl;
|
|
10401
|
+
}
|
|
10402
|
+
const runData = await api.post(
|
|
10403
|
+
ACTION_RUNS_PATH,
|
|
10404
|
+
{ data: runRequestData },
|
|
10405
|
+
{
|
|
10406
|
+
approvalContext: () => policyContext.buildActionRunContext({
|
|
10407
|
+
selected_api: implementationId,
|
|
10408
|
+
action_type: actionType,
|
|
10409
|
+
action_key: actionKey,
|
|
10410
|
+
connection_id: connectionId != null ? String(connectionId) : void 0,
|
|
10411
|
+
// `inputs` is `Record<string, unknown>` at the SDK surface;
|
|
10412
|
+
// buildActionRunContext validates it as JSON at runtime via zod
|
|
10413
|
+
// (non-JSON values like Date/undefined are rejected there).
|
|
10414
|
+
inputs
|
|
10415
|
+
})
|
|
10416
|
+
}
|
|
10417
|
+
);
|
|
10418
|
+
return {
|
|
10419
|
+
data: {
|
|
10420
|
+
id: runData.data.id,
|
|
10421
|
+
implementation_id: implementationId
|
|
10422
|
+
}
|
|
10423
|
+
};
|
|
10424
|
+
}
|
|
10425
|
+
});
|
|
10426
|
+
|
|
10427
|
+
// src/utils/action-run-wire.ts
|
|
10428
|
+
function actionRunPath(run) {
|
|
10429
|
+
return `${ACTION_RUNS_PATH}/${encodeURIComponent(run)}`;
|
|
10430
|
+
}
|
|
10431
|
+
function actionRunPayload(body) {
|
|
10432
|
+
return body?.data;
|
|
10433
|
+
}
|
|
10434
|
+
function isActionRunPending(body) {
|
|
10435
|
+
return actionRunPayload(body)?.status === "waiting";
|
|
10436
|
+
}
|
|
10437
|
+
|
|
10438
|
+
// src/plugins/runAction/index.ts
|
|
10439
|
+
var runActionPlugin = defineMethod({
|
|
10440
|
+
name: "runAction",
|
|
10441
|
+
imports: [apiPluginRef, connectionsPluginRef, createActionRunPlugin],
|
|
10442
|
+
categories: ["action"],
|
|
10443
|
+
itemType: "ActionResult",
|
|
10444
|
+
inputSchema: RunActionInputSchema,
|
|
10445
|
+
outputSchema: ActionResultItemSchema,
|
|
10446
|
+
skipOutputValidation: true,
|
|
10447
|
+
formatter: actionResultItemFormatter,
|
|
10448
|
+
// No defaultPageSize — leave the default to the Actions API rather than
|
|
10449
|
+
// eagerly running more actions than the user intends (avoids app rate limits).
|
|
10450
|
+
output: "list",
|
|
10451
|
+
resolvers: {
|
|
10452
|
+
app: appKeyResolver,
|
|
10453
|
+
actionType: actionTypeResolver,
|
|
10454
|
+
action: actionKeyResolver,
|
|
10455
|
+
connection: connectionIdResolver,
|
|
10456
|
+
inputs: inputsResolver
|
|
10457
|
+
},
|
|
10458
|
+
run: async ({ imports, input, annotate }) => {
|
|
10382
10459
|
const appKey = "app" in input ? input.app : input.appKey;
|
|
10383
10460
|
const actionKey = "action" in input ? input.action : input.actionKey;
|
|
10384
10461
|
const {
|
|
@@ -10389,39 +10466,40 @@ var runActionPlugin = defineMethod({
|
|
|
10389
10466
|
inputs = {},
|
|
10390
10467
|
cursor
|
|
10391
10468
|
} = input;
|
|
10392
|
-
const timeoutMilliseconds = input.timeoutSeconds != null ? input.timeoutSeconds * 1e3 : input.timeoutMs;
|
|
10469
|
+
const timeoutMilliseconds = (input.timeoutSeconds != null ? input.timeoutSeconds * 1e3 : input.timeoutMs) ?? DEFAULT_ACTION_TIMEOUT_MILLISECONDS;
|
|
10393
10470
|
const resolvedConnectionId = await resolveConnectionId({
|
|
10394
10471
|
connectionId,
|
|
10395
10472
|
connection,
|
|
10396
10473
|
authenticationId,
|
|
10397
|
-
resolveConnection
|
|
10398
|
-
});
|
|
10399
|
-
const { selectedApi, actionId } = await state.getRunActionContext({
|
|
10400
|
-
imports,
|
|
10401
|
-
appKey,
|
|
10402
|
-
actionKey,
|
|
10403
|
-
actionType
|
|
10474
|
+
resolveConnection: imports.connections.resolveConnection
|
|
10404
10475
|
});
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
api,
|
|
10408
|
-
selectedApi,
|
|
10409
|
-
// Some actions require the action ID, but it's not guaranteed available at
|
|
10410
|
-
// retrieval time (legacy), so pass everything through.
|
|
10411
|
-
actionId,
|
|
10412
|
-
actionKey,
|
|
10476
|
+
const { data: started } = await imports.createActionRun({
|
|
10477
|
+
app: appKey,
|
|
10413
10478
|
actionType,
|
|
10414
|
-
|
|
10415
|
-
|
|
10416
|
-
|
|
10417
|
-
|
|
10479
|
+
action: actionKey,
|
|
10480
|
+
connection: resolvedConnectionId,
|
|
10481
|
+
inputs,
|
|
10482
|
+
page: cursor
|
|
10418
10483
|
});
|
|
10419
|
-
|
|
10420
|
-
|
|
10484
|
+
annotate({ selectedApi: started.implementation_id });
|
|
10485
|
+
const run = await imports.api.poll(
|
|
10486
|
+
actionRunPath(started.id),
|
|
10487
|
+
{
|
|
10488
|
+
resource: { type: "run", id: started.id },
|
|
10489
|
+
successStatus: 200,
|
|
10490
|
+
pendingStatus: 202,
|
|
10491
|
+
timeoutMilliseconds,
|
|
10492
|
+
isPending: isActionRunPending,
|
|
10493
|
+
resultExtractor: (body) => actionRunPayload(body) ?? {}
|
|
10494
|
+
}
|
|
10495
|
+
);
|
|
10496
|
+
const errors = run.errors ?? [];
|
|
10497
|
+
if (errors.length > 0) {
|
|
10498
|
+
const errorMessage2 = errors.map((error) => error.detail || error.title || "Unknown error").join("; ");
|
|
10421
10499
|
throw new ZapierActionError(`Action execution failed: ${errorMessage2}`, {
|
|
10422
10500
|
appKey,
|
|
10423
10501
|
actionKey,
|
|
10424
|
-
errors:
|
|
10502
|
+
errors: errors.map(
|
|
10425
10503
|
(error) => ({
|
|
10426
10504
|
status: 200,
|
|
10427
10505
|
code: error.code ?? "unknown",
|
|
@@ -10432,10 +10510,10 @@ var runActionPlugin = defineMethod({
|
|
|
10432
10510
|
});
|
|
10433
10511
|
}
|
|
10434
10512
|
return {
|
|
10435
|
-
data:
|
|
10513
|
+
data: run.results ?? [],
|
|
10436
10514
|
// Coerce to a string: the API returns a numeric page index, but
|
|
10437
10515
|
// `SdkPage.nextCursor` is a string (and the page guard enforces it).
|
|
10438
|
-
nextCursor:
|
|
10516
|
+
nextCursor: run.next_page != null ? String(run.next_page) : void 0
|
|
10439
10517
|
};
|
|
10440
10518
|
}
|
|
10441
10519
|
});
|
|
@@ -11866,6 +11944,65 @@ var findUniqueConnectionPlugin = defineMethod({
|
|
|
11866
11944
|
return { data: connectionsResponse.data[0] };
|
|
11867
11945
|
}
|
|
11868
11946
|
});
|
|
11947
|
+
var GetActionRunSchema = zod.z.object({
|
|
11948
|
+
run: zod.z.string().min(1).describe("Action run ID returned by `createActionRun`")
|
|
11949
|
+
}).describe(
|
|
11950
|
+
"Fetch the current state of an action run started by `createActionRun`. This is a point-in-time read that returns immediately: a run Zapier has not finished executing comes back with status `waiting`, so call again to check for a result. `runAction` starts a run and waits for its result in one call. Results are stored for seven days after the run was created."
|
|
11951
|
+
);
|
|
11952
|
+
var ActionRunStatusSchema = openEnum(
|
|
11953
|
+
["waiting", "success", "error", "unknown"],
|
|
11954
|
+
"Where the run is in its lifecycle. `waiting` means Zapier is still executing it; `error` means the app returned a failure (details in `errors`). `unknown` means the response carried no status, so the outcome could not be determined \u2014 treat it as inconclusive rather than as success."
|
|
11955
|
+
);
|
|
11956
|
+
var ActionRunErrorSchema = zod.z.object({
|
|
11957
|
+
code: zod.z.string().optional().describe("Machine-readable error category"),
|
|
11958
|
+
title: zod.z.string().nullable().optional().describe("Short error label"),
|
|
11959
|
+
detail: zod.z.string().optional().describe("Human-readable error detail")
|
|
11960
|
+
});
|
|
11961
|
+
var ActionRunItemSchema = zod.z.object({
|
|
11962
|
+
id: zod.z.string().describe("Action run ID"),
|
|
11963
|
+
status: ActionRunStatusSchema,
|
|
11964
|
+
results: zod.z.array(zod.z.unknown()).describe(
|
|
11965
|
+
"Records the action produced. Can be empty even on a successful run."
|
|
11966
|
+
),
|
|
11967
|
+
next_page: zod.z.string().optional().describe(
|
|
11968
|
+
"For bulk read actions, the following page. Pass it back as the `page` for `createActionRun` to fetch that page."
|
|
11969
|
+
),
|
|
11970
|
+
errors: zod.z.array(ActionRunErrorSchema).describe("Errors the app returned while running the action")
|
|
11971
|
+
});
|
|
11972
|
+
|
|
11973
|
+
// src/plugins/getActionRun/index.ts
|
|
11974
|
+
function toActionRun(runId, payload) {
|
|
11975
|
+
if (!payload) {
|
|
11976
|
+
return { id: runId, status: "waiting", results: [], errors: [] };
|
|
11977
|
+
}
|
|
11978
|
+
return {
|
|
11979
|
+
id: payload.id ?? runId,
|
|
11980
|
+
// Never infer success from an absent status.
|
|
11981
|
+
status: payload.status ?? "unknown",
|
|
11982
|
+
results: payload.results ?? [],
|
|
11983
|
+
// The API answers with either a page token or a numeric page index, but
|
|
11984
|
+
// `createActionRun` takes `page` as a string, so normalize to one type the
|
|
11985
|
+
// caller can hand straight back.
|
|
11986
|
+
...payload.next_page != null ? { next_page: String(payload.next_page) } : {},
|
|
11987
|
+
errors: payload.errors ?? []
|
|
11988
|
+
};
|
|
11989
|
+
}
|
|
11990
|
+
var getActionRunPlugin = defineMethod({
|
|
11991
|
+
name: "getActionRun",
|
|
11992
|
+
imports: [apiPluginRef],
|
|
11993
|
+
categories: ["action"],
|
|
11994
|
+
itemType: "ActionRun",
|
|
11995
|
+
inputSchema: GetActionRunSchema,
|
|
11996
|
+
outputSchema: ActionRunItemSchema,
|
|
11997
|
+
output: "item",
|
|
11998
|
+
run: async ({ imports, input }) => {
|
|
11999
|
+
const body = await imports.api.get(
|
|
12000
|
+
actionRunPath(input.run),
|
|
12001
|
+
{ resource: { type: "run", id: input.run } }
|
|
12002
|
+
);
|
|
12003
|
+
return { data: toActionRun(input.run, actionRunPayload(body)) };
|
|
12004
|
+
}
|
|
12005
|
+
});
|
|
11869
12006
|
var RelayRequestSchema = zod.z.object({
|
|
11870
12007
|
url: zod.z.string().url().describe("The URL to request (will be proxied through Relay)"),
|
|
11871
12008
|
method: zod.z.enum(["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]).optional().describe("HTTP method"),
|
|
@@ -15692,6 +15829,8 @@ var zapierSdkPlugin = definePlugin({
|
|
|
15692
15829
|
listInputFieldsDeprecatedPlugin,
|
|
15693
15830
|
getInputFieldsSchemaDeprecatedPlugin,
|
|
15694
15831
|
listInputFieldChoicesDeprecatedPlugin,
|
|
15832
|
+
createActionRunPlugin,
|
|
15833
|
+
getActionRunPlugin,
|
|
15695
15834
|
runActionPlugin,
|
|
15696
15835
|
fetchPlugin,
|
|
15697
15836
|
requestPlugin,
|
|
@@ -15906,6 +16045,7 @@ var registryPlugin = (_sdk) => {
|
|
|
15906
16045
|
return {};
|
|
15907
16046
|
};
|
|
15908
16047
|
|
|
16048
|
+
exports.ACTION_RUNS_PATH = ACTION_RUNS_PATH;
|
|
15909
16049
|
exports.API_ID = API_ID;
|
|
15910
16050
|
exports.ActionKeyPropertySchema = ActionKeyPropertySchema;
|
|
15911
16051
|
exports.ActionPropertySchema = ActionPropertySchema;
|
|
@@ -16019,6 +16159,7 @@ exports.connectionIdGenericResolver = connectionIdGenericResolver;
|
|
|
16019
16159
|
exports.connectionIdResolver = connectionIdResolver;
|
|
16020
16160
|
exports.connectionsPlugin = connectionsPlugin;
|
|
16021
16161
|
exports.connectionsPluginRef = connectionsPluginRef;
|
|
16162
|
+
exports.createActionRunPlugin = createActionRunPlugin;
|
|
16022
16163
|
exports.createBaseEvent = createBaseEvent;
|
|
16023
16164
|
exports.createClientCredentialsPlugin = createClientCredentialsPlugin;
|
|
16024
16165
|
exports.createController = createController;
|
|
@@ -16066,6 +16207,7 @@ exports.fromFunctionPlugin = fromFunctionPlugin;
|
|
|
16066
16207
|
exports.generateEventId = generateEventId;
|
|
16067
16208
|
exports.getActionInputFieldsSchemaPlugin = getActionInputFieldsSchemaPlugin;
|
|
16068
16209
|
exports.getActionPlugin = getActionPlugin;
|
|
16210
|
+
exports.getActionRunPlugin = getActionRunPlugin;
|
|
16069
16211
|
exports.getAgent = getAgent;
|
|
16070
16212
|
exports.getAppPlugin = getAppPlugin;
|
|
16071
16213
|
exports.getBaseUrlFromCredentials = getBaseUrlFromCredentials;
|
|
@@ -16079,6 +16221,7 @@ exports.getCoreErrorCode = getCoreErrorCode;
|
|
|
16079
16221
|
exports.getCpuTime = getCpuTime;
|
|
16080
16222
|
exports.getCurrentTimestamp = getCurrentTimestamp;
|
|
16081
16223
|
exports.getMemoryUsage = getMemoryUsage;
|
|
16224
|
+
exports.getNegatable = getNegatable;
|
|
16082
16225
|
exports.getOrCreateApiClient = getOrCreateApiClient;
|
|
16083
16226
|
exports.getOsInfo = getOsInfo;
|
|
16084
16227
|
exports.getPlatformVersions = getPlatformVersions;
|