@zapier/zapier-sdk 0.93.0 → 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 +14 -0
- package/README.md +70 -0
- package/dist/{chunk-S2WSKNCP.cjs → chunk-TQT6EGZU.cjs} +981 -848
- package/dist/{chunk-DSWOSGEW.mjs → chunk-XUVZWY2D.mjs} +979 -849
- package/dist/experimental.cjs +389 -377
- package/dist/experimental.d.mts +149 -7
- package/dist/experimental.d.ts +149 -7
- package/dist/experimental.mjs +2 -2
- package/dist/{index-BUPBfgvQ.d.mts → index-D6jpmIVn.d.mts} +300 -10
- package/dist/{index-BUPBfgvQ.d.ts → index-D6jpmIVn.d.ts} +300 -10
- package/dist/index.cjs +285 -273
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -4217,6 +4217,7 @@ function getZapierSdkService() {
|
|
|
4217
4217
|
var MAX_PAGE_LIMIT = 1e4;
|
|
4218
4218
|
var DEFAULT_PAGE_SIZE = 100;
|
|
4219
4219
|
var DEFAULT_ACTION_TIMEOUT_MILLISECONDS = 18e4;
|
|
4220
|
+
var ACTION_RUNS_PATH = "/zapier/api/actions/v1/runs";
|
|
4220
4221
|
function parseIntEnvVar(name) {
|
|
4221
4222
|
const value = globalThis.process?.env?.[name];
|
|
4222
4223
|
if (value === void 0) return void 0;
|
|
@@ -6190,7 +6191,7 @@ function parseDeprecationDate(value) {
|
|
|
6190
6191
|
}
|
|
6191
6192
|
|
|
6192
6193
|
// src/sdk-version.ts
|
|
6193
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.
|
|
6194
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.94.0" : void 0) || "unknown";
|
|
6194
6195
|
|
|
6195
6196
|
// src/utils/open-url.ts
|
|
6196
6197
|
var nodePrefix = "node:";
|
|
@@ -7062,7 +7063,7 @@ var ZapierApiClient = class {
|
|
|
7062
7063
|
requiredScopes: options.requiredScopes
|
|
7063
7064
|
});
|
|
7064
7065
|
if (typeof result === "string") {
|
|
7065
|
-
if (result === "" && (method === "DELETE" || response.status === 204)) {
|
|
7066
|
+
if (result === "" && (method === "DELETE" || response.status === 204 || response.status === 202)) {
|
|
7066
7067
|
return void 0;
|
|
7067
7068
|
}
|
|
7068
7069
|
throw new ZapierValidationError(
|
|
@@ -8536,378 +8537,6 @@ var actionResultItemFormatter = defineFormatter({
|
|
|
8536
8537
|
};
|
|
8537
8538
|
}
|
|
8538
8539
|
});
|
|
8539
|
-
var GetActionDescription = "Get detailed information about a specific action";
|
|
8540
|
-
var GetActionSchema = z.object({
|
|
8541
|
-
app: AppPropertySchema,
|
|
8542
|
-
actionType: ActionTypePropertySchema,
|
|
8543
|
-
action: ActionPropertySchema
|
|
8544
|
-
}).describe(GetActionDescription).meta({ aliases: { appKey: "app", actionKey: "action" } });
|
|
8545
|
-
var GetActionSchemaDeprecated = z.object({
|
|
8546
|
-
appKey: AppKeyPropertySchema,
|
|
8547
|
-
actionType: ActionTypePropertySchema,
|
|
8548
|
-
actionKey: ActionKeyPropertySchema
|
|
8549
|
-
});
|
|
8550
|
-
var GetActionInputSchema = z.union([GetActionSchema, GetActionSchemaDeprecated]).describe(GetActionDescription);
|
|
8551
|
-
var ListActionsDescription = "List all actions for a specific app";
|
|
8552
|
-
var ListActionsBaseSchema = z.object({
|
|
8553
|
-
pageSize: z.number().min(1).optional().describe("Number of actions per page"),
|
|
8554
|
-
maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages"),
|
|
8555
|
-
cursor: z.string().optional().describe("Cursor to start from")
|
|
8556
|
-
});
|
|
8557
|
-
var ListActionsSchema = z.object({
|
|
8558
|
-
app: AppPropertySchema.describe(
|
|
8559
|
-
"App key of actions to list (e.g., 'SlackCLIAPI' or slug like 'github')"
|
|
8560
|
-
),
|
|
8561
|
-
actionType: ActionTypePropertySchema.optional().describe(
|
|
8562
|
-
"Filter actions by type"
|
|
8563
|
-
)
|
|
8564
|
-
}).merge(ListActionsBaseSchema).describe(ListActionsDescription).meta({ aliases: { appKey: "app" } });
|
|
8565
|
-
var ListActionsSchemaDeprecated = z.object({
|
|
8566
|
-
appKey: AppKeyPropertySchema.describe(
|
|
8567
|
-
"App key of actions to list (e.g., 'SlackCLIAPI' or slug like 'github')"
|
|
8568
|
-
),
|
|
8569
|
-
actionType: ActionTypePropertySchema.optional().describe(
|
|
8570
|
-
"Filter actions by type"
|
|
8571
|
-
)
|
|
8572
|
-
}).merge(ListActionsBaseSchema);
|
|
8573
|
-
var ListActionsInputSchema = z.union([ListActionsSchema, ListActionsSchemaDeprecated]).describe(ListActionsDescription);
|
|
8574
|
-
var NeedChoicesSchema = z.object({
|
|
8575
|
-
key: z.string().optional(),
|
|
8576
|
-
label: z.string().optional(),
|
|
8577
|
-
sample: z.string().optional(),
|
|
8578
|
-
value: z.string().optional()
|
|
8579
|
-
});
|
|
8580
|
-
var NeedSchema = z.object({
|
|
8581
|
-
key: z.string(),
|
|
8582
|
-
alters_custom_fields: z.boolean().nullable().optional(),
|
|
8583
|
-
capabilities: z.array(z.string()).optional(),
|
|
8584
|
-
choices: z.array(NeedChoicesSchema).optional(),
|
|
8585
|
-
computed: z.boolean().nullable().optional(),
|
|
8586
|
-
custom_field: z.boolean().optional(),
|
|
8587
|
-
default: z.string().optional(),
|
|
8588
|
-
depends_on: z.array(z.string()).optional(),
|
|
8589
|
-
format: z.literal("SELECT").optional(),
|
|
8590
|
-
from_search: z.boolean().optional(),
|
|
8591
|
-
from_write: z.boolean().optional(),
|
|
8592
|
-
help_text: z.string().optional(),
|
|
8593
|
-
help_text_html: z.string().optional(),
|
|
8594
|
-
input_format: z.array(z.string()).optional(),
|
|
8595
|
-
label: z.string().optional(),
|
|
8596
|
-
language: z.string().optional(),
|
|
8597
|
-
parent_key: z.string().optional(),
|
|
8598
|
-
placeholder: z.string().optional(),
|
|
8599
|
-
prefill: z.string().optional(),
|
|
8600
|
-
required: z.boolean().optional(),
|
|
8601
|
-
searchfill: z.string().optional(),
|
|
8602
|
-
send_in_json: z.boolean().optional(),
|
|
8603
|
-
regex: z.string().optional(),
|
|
8604
|
-
type: z.enum([
|
|
8605
|
-
"integer",
|
|
8606
|
-
"string",
|
|
8607
|
-
"text",
|
|
8608
|
-
"datetime",
|
|
8609
|
-
"boolean",
|
|
8610
|
-
"file",
|
|
8611
|
-
"decimal",
|
|
8612
|
-
"copy",
|
|
8613
|
-
"password",
|
|
8614
|
-
"dict",
|
|
8615
|
-
"code",
|
|
8616
|
-
"filter",
|
|
8617
|
-
"json"
|
|
8618
|
-
]).optional(),
|
|
8619
|
-
list: z.boolean().optional()
|
|
8620
|
-
});
|
|
8621
|
-
z.object({
|
|
8622
|
-
action_url: z.string().optional()
|
|
8623
|
-
});
|
|
8624
|
-
z.object({
|
|
8625
|
-
can_use: z.boolean().optional()
|
|
8626
|
-
});
|
|
8627
|
-
var ActionSchema = z.object({
|
|
8628
|
-
id: z.string().optional(),
|
|
8629
|
-
type: z.enum([
|
|
8630
|
-
"filter",
|
|
8631
|
-
"read",
|
|
8632
|
-
"read_bulk",
|
|
8633
|
-
"run",
|
|
8634
|
-
"search",
|
|
8635
|
-
"search_and_write",
|
|
8636
|
-
"search_or_write",
|
|
8637
|
-
"write"
|
|
8638
|
-
]),
|
|
8639
|
-
key: z.string(),
|
|
8640
|
-
name: z.string(),
|
|
8641
|
-
description: z.string(),
|
|
8642
|
-
is_important: z.boolean().optional(),
|
|
8643
|
-
is_hidden: z.boolean().optional(),
|
|
8644
|
-
selected_api: z.string().optional()
|
|
8645
|
-
});
|
|
8646
|
-
var ChoiceSchema = z.object({
|
|
8647
|
-
value: z.union([z.string(), z.number()]),
|
|
8648
|
-
label: z.string()
|
|
8649
|
-
});
|
|
8650
|
-
z.object({
|
|
8651
|
-
key: z.string(),
|
|
8652
|
-
label: z.string(),
|
|
8653
|
-
type: z.enum([
|
|
8654
|
-
"string",
|
|
8655
|
-
"number",
|
|
8656
|
-
"boolean",
|
|
8657
|
-
"datetime",
|
|
8658
|
-
"file",
|
|
8659
|
-
"object",
|
|
8660
|
-
"array"
|
|
8661
|
-
]),
|
|
8662
|
-
required: z.boolean(),
|
|
8663
|
-
description: z.string().optional(),
|
|
8664
|
-
choices: z.array(ChoiceSchema).optional()
|
|
8665
|
-
});
|
|
8666
|
-
z.object({
|
|
8667
|
-
data: z.array(z.unknown())
|
|
8668
|
-
});
|
|
8669
|
-
var ActionFieldChoiceSchema = z.object({
|
|
8670
|
-
value: z.union([z.string(), z.number()]),
|
|
8671
|
-
label: z.string()
|
|
8672
|
-
});
|
|
8673
|
-
z.object({
|
|
8674
|
-
key: z.string(),
|
|
8675
|
-
label: z.string().optional(),
|
|
8676
|
-
required: z.boolean(),
|
|
8677
|
-
type: z.string().optional(),
|
|
8678
|
-
helpText: z.string().optional(),
|
|
8679
|
-
helpTextHtml: z.string().optional(),
|
|
8680
|
-
choices: z.array(ActionFieldChoiceSchema).optional(),
|
|
8681
|
-
default: z.string().optional(),
|
|
8682
|
-
placeholder: z.string().optional(),
|
|
8683
|
-
computed: z.boolean().optional(),
|
|
8684
|
-
customField: z.boolean().optional(),
|
|
8685
|
-
dependsOn: z.array(z.string()).optional(),
|
|
8686
|
-
format: z.string().optional(),
|
|
8687
|
-
inputFormat: z.array(z.string()).optional()
|
|
8688
|
-
});
|
|
8689
|
-
z.object({
|
|
8690
|
-
id: z.number(),
|
|
8691
|
-
public_id: z.string().optional(),
|
|
8692
|
-
code: z.string(),
|
|
8693
|
-
user_id: z.number(),
|
|
8694
|
-
auto_provisioned: z.boolean(),
|
|
8695
|
-
first_name: z.string(),
|
|
8696
|
-
last_name: z.string(),
|
|
8697
|
-
username: z.string(),
|
|
8698
|
-
personas: z.string(),
|
|
8699
|
-
user_generated_personas: z.string(),
|
|
8700
|
-
last_login: z.string(),
|
|
8701
|
-
email: z.string(),
|
|
8702
|
-
email_hash: z.string(),
|
|
8703
|
-
email_confirmed: z.boolean(),
|
|
8704
|
-
timezone: z.string(),
|
|
8705
|
-
photo_url: z.string(),
|
|
8706
|
-
has_seen_notifications: z.record(z.string(), z.boolean().nullable()),
|
|
8707
|
-
signup: z.string(),
|
|
8708
|
-
since_signup: z.string(),
|
|
8709
|
-
has_activated: z.boolean(),
|
|
8710
|
-
enable_gz_creator: z.boolean(),
|
|
8711
|
-
should_see_nps_survey: z.boolean(),
|
|
8712
|
-
is_developer: z.boolean(),
|
|
8713
|
-
is_expert: z.boolean(),
|
|
8714
|
-
tos_agreement: z.boolean(),
|
|
8715
|
-
should_renew_tos: z.boolean(),
|
|
8716
|
-
is_gdpr_consented: z.boolean(),
|
|
8717
|
-
disable_ssl_check: z.boolean(),
|
|
8718
|
-
identity: z.number(),
|
|
8719
|
-
summary_schedule: z.string(),
|
|
8720
|
-
alert_triggers: z.string(),
|
|
8721
|
-
alert_actions: z.string(),
|
|
8722
|
-
is_staff: z.boolean(),
|
|
8723
|
-
is_zt_reviewer: z.boolean(),
|
|
8724
|
-
is_high_value: z.boolean(),
|
|
8725
|
-
is_temporary: z.boolean(),
|
|
8726
|
-
banner_message: z.string(),
|
|
8727
|
-
enable_totp_2fa: z.boolean(),
|
|
8728
|
-
viewed_help: z.record(z.string(), z.boolean()),
|
|
8729
|
-
show_editor_migration_mesaging: z.boolean(),
|
|
8730
|
-
switches: z.record(z.string(), z.unknown()),
|
|
8731
|
-
organizations: z.array(z.record(z.string(), z.unknown()).nullable()),
|
|
8732
|
-
primary_organization: z.record(z.string(), z.unknown()).nullable(),
|
|
8733
|
-
has_active_zaps: z.boolean(),
|
|
8734
|
-
has_google_sso: z.boolean(),
|
|
8735
|
-
auth_realm: z.string(),
|
|
8736
|
-
roles: z.array(
|
|
8737
|
-
z.object({
|
|
8738
|
-
account_id: z.number(),
|
|
8739
|
-
role: z.string()
|
|
8740
|
-
})
|
|
8741
|
-
)
|
|
8742
|
-
});
|
|
8743
|
-
z.object({
|
|
8744
|
-
age_in_days: z.string().optional(),
|
|
8745
|
-
api_docs_url: z.string().nullable().optional(),
|
|
8746
|
-
app_profile_url: z.string(),
|
|
8747
|
-
banner: z.string().optional(),
|
|
8748
|
-
categories: z.array(z.string()).optional(),
|
|
8749
|
-
// Service category names
|
|
8750
|
-
canonical_id: z.string().optional(),
|
|
8751
|
-
current_implementation_id: z.string(),
|
|
8752
|
-
days_since_last_update: z.string().optional(),
|
|
8753
|
-
description: z.string(),
|
|
8754
|
-
external_url: z.string(),
|
|
8755
|
-
hashtag: z.string().optional(),
|
|
8756
|
-
id: z.number().optional(),
|
|
8757
|
-
image: z.string().optional(),
|
|
8758
|
-
images: z.string().optional(),
|
|
8759
|
-
integration_overview_html: z.string().nullable().optional(),
|
|
8760
|
-
internal_id: z.string(),
|
|
8761
|
-
invite_url: z.string().nullable().optional(),
|
|
8762
|
-
is_beta: z.string().optional(),
|
|
8763
|
-
is_built_in: z.string().optional(),
|
|
8764
|
-
is_featured: z.string().optional(),
|
|
8765
|
-
is_premium: z.boolean().optional(),
|
|
8766
|
-
is_public: z.string().optional(),
|
|
8767
|
-
is_upcoming: z.string().optional(),
|
|
8768
|
-
learn_more_url: z.string(),
|
|
8769
|
-
name: z.string(),
|
|
8770
|
-
popularity: z.number(),
|
|
8771
|
-
primary_color: z.string(),
|
|
8772
|
-
request_count: z.string().optional(),
|
|
8773
|
-
slug: z.string(),
|
|
8774
|
-
zap_usage_count: z.number().nullable().optional()
|
|
8775
|
-
});
|
|
8776
|
-
var ServiceSchema = z.object({
|
|
8777
|
-
id: z.number().optional(),
|
|
8778
|
-
canonical_id: z.string().optional(),
|
|
8779
|
-
current_implementation_id: z.string(),
|
|
8780
|
-
name: z.string(),
|
|
8781
|
-
slug: z.string(),
|
|
8782
|
-
app_url: z.string().optional(),
|
|
8783
|
-
learn_more_url: z.string().optional(),
|
|
8784
|
-
description: z.string(),
|
|
8785
|
-
primary_color: z.string(),
|
|
8786
|
-
popularity: z.number(),
|
|
8787
|
-
image: z.string().optional(),
|
|
8788
|
-
images: z.string().optional()
|
|
8789
|
-
});
|
|
8790
|
-
z.object({
|
|
8791
|
-
results: z.array(ServiceSchema),
|
|
8792
|
-
next: z.string().nullable().optional(),
|
|
8793
|
-
previous: z.string().nullable().optional()
|
|
8794
|
-
});
|
|
8795
|
-
z.object({
|
|
8796
|
-
selected_api: z.string(),
|
|
8797
|
-
action: z.string(),
|
|
8798
|
-
type_of: z.string(),
|
|
8799
|
-
authentication_id: z.union([z.string(), z.number()]).optional(),
|
|
8800
|
-
params: z.record(z.string(), z.unknown()).optional()
|
|
8801
|
-
});
|
|
8802
|
-
z.object({
|
|
8803
|
-
success: z.boolean(),
|
|
8804
|
-
needs: z.array(NeedSchema).optional(),
|
|
8805
|
-
errors: z.array(z.string()).optional(),
|
|
8806
|
-
last_fetched_at: z.string().optional(),
|
|
8807
|
-
schema: z.record(z.string(), z.unknown()).optional()
|
|
8808
|
-
});
|
|
8809
|
-
var ImplementationSchema = z.object({
|
|
8810
|
-
selected_api: z.string(),
|
|
8811
|
-
app_id: z.number().optional(),
|
|
8812
|
-
auth_type: z.string().optional(),
|
|
8813
|
-
auth_fields: z.string().optional(),
|
|
8814
|
-
actions: z.array(ActionSchema).optional(),
|
|
8815
|
-
is_deprecated: z.boolean().optional(),
|
|
8816
|
-
is_private_only: z.boolean().optional(),
|
|
8817
|
-
is_invite_only: z.boolean().optional(),
|
|
8818
|
-
is_beta: z.boolean().optional().default(false),
|
|
8819
|
-
is_premium: z.boolean().optional().default(false),
|
|
8820
|
-
is_hidden: z.string().optional(),
|
|
8821
|
-
name: z.string().optional(),
|
|
8822
|
-
slug: z.string().optional(),
|
|
8823
|
-
images: z.record(z.string(), z.string().nullable()).optional(),
|
|
8824
|
-
primary_color: z.string().optional(),
|
|
8825
|
-
secondary_color: z.string().optional(),
|
|
8826
|
-
current_implementation: z.string().optional(),
|
|
8827
|
-
other_implementations: z.string().optional()
|
|
8828
|
-
});
|
|
8829
|
-
z.object({
|
|
8830
|
-
count: z.number(),
|
|
8831
|
-
next: z.string().nullable().optional(),
|
|
8832
|
-
previous: z.string().nullable().optional(),
|
|
8833
|
-
results: z.array(ImplementationSchema)
|
|
8834
|
-
});
|
|
8835
|
-
var NeedChoicesResponseMetaSchema = z.object({
|
|
8836
|
-
page: z.string().nullable().optional()
|
|
8837
|
-
});
|
|
8838
|
-
var NeedChoicesResponseLinksSchema = z.object({
|
|
8839
|
-
next: z.string().nullable().optional(),
|
|
8840
|
-
prev: z.string().nullable().optional()
|
|
8841
|
-
});
|
|
8842
|
-
z.object({
|
|
8843
|
-
selected_api: z.string().optional().describe(
|
|
8844
|
-
"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."
|
|
8845
|
-
),
|
|
8846
|
-
authentication_id: z.union([z.string(), z.number()]).optional().describe(
|
|
8847
|
-
"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)."
|
|
8848
|
-
),
|
|
8849
|
-
params: z.record(z.string(), z.unknown()).optional().describe(
|
|
8850
|
-
"Object that matches the input the node would normally get. Has all the same keys/types as the `needs` of the action."
|
|
8851
|
-
),
|
|
8852
|
-
page: z.number().optional().default(0),
|
|
8853
|
-
prefill: z.string().optional().describe(
|
|
8854
|
-
"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."
|
|
8855
|
-
),
|
|
8856
|
-
action_id: z.string().optional().describe(
|
|
8857
|
-
"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."
|
|
8858
|
-
),
|
|
8859
|
-
input_field_id: z.string().optional().describe(
|
|
8860
|
-
"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."
|
|
8861
|
-
)
|
|
8862
|
-
});
|
|
8863
|
-
z.object({
|
|
8864
|
-
success: z.boolean(),
|
|
8865
|
-
choices: z.array(NeedChoicesSchema).optional(),
|
|
8866
|
-
next_page: z.number().optional(),
|
|
8867
|
-
errors: z.array(z.string()).optional(),
|
|
8868
|
-
meta: NeedChoicesResponseMetaSchema.optional(),
|
|
8869
|
-
links: NeedChoicesResponseLinksSchema.optional()
|
|
8870
|
-
});
|
|
8871
|
-
|
|
8872
|
-
// src/schemas/Action.ts
|
|
8873
|
-
var ActionItemSchema = ActionSchema.omit({
|
|
8874
|
-
type: true,
|
|
8875
|
-
name: true,
|
|
8876
|
-
selected_api: true
|
|
8877
|
-
}).extend({
|
|
8878
|
-
app_key: z.string(),
|
|
8879
|
-
// App key without version (extracted from selected_api)
|
|
8880
|
-
app_version: z.string().optional(),
|
|
8881
|
-
// Version extracted from selected_api
|
|
8882
|
-
action_type: ActionSchema.shape.type,
|
|
8883
|
-
// Mapped from original 'type' field
|
|
8884
|
-
title: z.string(),
|
|
8885
|
-
// Mapped from original 'name' field
|
|
8886
|
-
type: z.literal("action")
|
|
8887
|
-
// Fixed type identifier
|
|
8888
|
-
});
|
|
8889
|
-
|
|
8890
|
-
// src/formatters/action.ts
|
|
8891
|
-
function formatActionItem(item) {
|
|
8892
|
-
const details = [{ text: `Type: ${item.action_type}`, style: "accent" }];
|
|
8893
|
-
if (item.app_key) {
|
|
8894
|
-
details.push({ text: `App: ${item.app_key}`, style: "normal" });
|
|
8895
|
-
}
|
|
8896
|
-
if (item.description) {
|
|
8897
|
-
details.push({ text: item.description, style: "dim" });
|
|
8898
|
-
}
|
|
8899
|
-
return {
|
|
8900
|
-
title: item.title || item.key,
|
|
8901
|
-
// `hint` is the dumb secondary string shown after the title (the action key
|
|
8902
|
-
// and, when present, its id). Replaces the deprecated `key`/`id` fields.
|
|
8903
|
-
hint: [item.key, item.id].filter((v) => Boolean(v)),
|
|
8904
|
-
description: item.description,
|
|
8905
|
-
details
|
|
8906
|
-
};
|
|
8907
|
-
}
|
|
8908
|
-
var actionItemFormatter = defineFormatter({
|
|
8909
|
-
format: ({ item }) => formatActionItem(item)
|
|
8910
|
-
});
|
|
8911
8540
|
|
|
8912
8541
|
// src/resolvers/appKey.ts
|
|
8913
8542
|
var getAppRef = declareMethod({ id: "getApp" });
|
|
@@ -9751,396 +9380,768 @@ async function createFieldKeyTranslator({
|
|
|
9751
9380
|
}
|
|
9752
9381
|
}
|
|
9753
9382
|
}
|
|
9754
|
-
return key;
|
|
9383
|
+
return key;
|
|
9384
|
+
}
|
|
9385
|
+
};
|
|
9386
|
+
}
|
|
9387
|
+
|
|
9388
|
+
// src/resolvers/tableRecordId.ts
|
|
9389
|
+
var listTableRecordsRef = declareMethod({ id: "listTableRecords" });
|
|
9390
|
+
function summarizeRecord(record) {
|
|
9391
|
+
const values = Object.values(record.data);
|
|
9392
|
+
const preview = values.slice(0, 3).map((v) => formatFieldValue(v).replace(/\s+/g, " ").trim()).filter((s) => s.length > 0).join(", ");
|
|
9393
|
+
if (!preview) return void 0;
|
|
9394
|
+
return preview.length > 60 ? preview.slice(0, 57) + "..." : preview;
|
|
9395
|
+
}
|
|
9396
|
+
function recordChoices(records) {
|
|
9397
|
+
return records.map((record) => ({
|
|
9398
|
+
label: summarizeRecord(record) || record.id,
|
|
9399
|
+
value: record.id
|
|
9400
|
+
}));
|
|
9401
|
+
}
|
|
9402
|
+
var tableRecordIdResolver = defineResolver({
|
|
9403
|
+
imports: [listTableRecordsRef],
|
|
9404
|
+
requireParameters: ["table"],
|
|
9405
|
+
listItems: ({ imports, input, cursor }) => imports.listTableRecords({
|
|
9406
|
+
table: input.table,
|
|
9407
|
+
keyMode: "names",
|
|
9408
|
+
cursor
|
|
9409
|
+
}),
|
|
9410
|
+
prompt: ({ items }) => ({
|
|
9411
|
+
type: "list",
|
|
9412
|
+
message: "Select a record:",
|
|
9413
|
+
choices: recordChoices(items)
|
|
9414
|
+
})
|
|
9415
|
+
});
|
|
9416
|
+
var tableRecordIdsResolver = defineResolver({
|
|
9417
|
+
imports: [listTableRecordsRef],
|
|
9418
|
+
requireParameters: ["table"],
|
|
9419
|
+
listItems: ({ imports, input, cursor }) => imports.listTableRecords({
|
|
9420
|
+
table: input.table,
|
|
9421
|
+
keyMode: "names",
|
|
9422
|
+
cursor
|
|
9423
|
+
}),
|
|
9424
|
+
prompt: ({ items }) => ({
|
|
9425
|
+
type: "checkbox",
|
|
9426
|
+
message: "Select records to delete:",
|
|
9427
|
+
choices: recordChoices(items)
|
|
9428
|
+
}),
|
|
9429
|
+
validate: ({ value }) => Array.isArray(value) && value.length > 0 ? true : "Select at least one record"
|
|
9430
|
+
});
|
|
9431
|
+
|
|
9432
|
+
// src/resolvers/tableFieldIds.ts
|
|
9433
|
+
var listTableFieldsRef = declareMethod({ id: "listTableFields" });
|
|
9434
|
+
var tableFieldIdsResolver = defineResolver({
|
|
9435
|
+
imports: [listTableFieldsRef],
|
|
9436
|
+
requireParameters: ["table"],
|
|
9437
|
+
// No cursor forwarding: the fields API is unpaginated (no cursor on the
|
|
9438
|
+
// response), so the listing is always exhausted after one page.
|
|
9439
|
+
listItems: ({ imports, input }) => imports.listTableFields({ table: input.table }),
|
|
9440
|
+
prompt: ({ items }) => ({
|
|
9441
|
+
type: "checkbox",
|
|
9442
|
+
message: "Select fields:",
|
|
9443
|
+
choices: items.map((field) => ({
|
|
9444
|
+
label: field.name,
|
|
9445
|
+
hint: [field.id, field.type],
|
|
9446
|
+
value: field.id
|
|
9447
|
+
}))
|
|
9448
|
+
}),
|
|
9449
|
+
validate: ({ value }) => Array.isArray(value) && value.length > 0 ? true : "Select at least one field"
|
|
9450
|
+
});
|
|
9451
|
+
|
|
9452
|
+
// src/resolvers/tableName.ts
|
|
9453
|
+
var tableNameResolver = defineResolver({
|
|
9454
|
+
type: "static",
|
|
9455
|
+
inputType: "text",
|
|
9456
|
+
placeholder: "Enter a name for the table"
|
|
9457
|
+
});
|
|
9458
|
+
var FieldTypeSchema = z.enum([
|
|
9459
|
+
"string",
|
|
9460
|
+
"multiple_string",
|
|
9461
|
+
"labeled_string",
|
|
9462
|
+
"multiple_labeled_string",
|
|
9463
|
+
"text",
|
|
9464
|
+
"multiple_text",
|
|
9465
|
+
"boolean",
|
|
9466
|
+
"multiple_boolean",
|
|
9467
|
+
"number",
|
|
9468
|
+
"multiple_number",
|
|
9469
|
+
"decimal",
|
|
9470
|
+
"multiple_decimal",
|
|
9471
|
+
"datetime",
|
|
9472
|
+
"multiple_datetime",
|
|
9473
|
+
"uuid",
|
|
9474
|
+
"multiple_uuid",
|
|
9475
|
+
"json",
|
|
9476
|
+
"multiple_json",
|
|
9477
|
+
"formula",
|
|
9478
|
+
"button_trigger_zap",
|
|
9479
|
+
"button_continue_zap",
|
|
9480
|
+
"email",
|
|
9481
|
+
"multiple_email",
|
|
9482
|
+
"link",
|
|
9483
|
+
"multiple_link",
|
|
9484
|
+
"currency",
|
|
9485
|
+
"phone_number",
|
|
9486
|
+
"ai_formula",
|
|
9487
|
+
"linked_record",
|
|
9488
|
+
"multiple_linked_record"
|
|
9489
|
+
]);
|
|
9490
|
+
var FieldApiItemSchema = z.object({
|
|
9491
|
+
id: z.number(),
|
|
9492
|
+
type: FieldTypeSchema,
|
|
9493
|
+
name: z.string(),
|
|
9494
|
+
created_at: z.string().optional(),
|
|
9495
|
+
edited_at: z.string().optional(),
|
|
9496
|
+
options: z.record(z.string(), z.unknown()).optional(),
|
|
9497
|
+
config: z.record(z.string(), z.unknown()).optional(),
|
|
9498
|
+
is_order_field: z.boolean().optional(),
|
|
9499
|
+
is_filter_field: z.boolean().optional(),
|
|
9500
|
+
is_selected_field: z.boolean().optional(),
|
|
9501
|
+
deleted_at: z.string().nullable().optional()
|
|
9502
|
+
});
|
|
9503
|
+
var ListTableFieldsApiResponseSchema = z.object({
|
|
9504
|
+
data: z.array(FieldApiItemSchema)
|
|
9505
|
+
});
|
|
9506
|
+
var FieldItemSchema = z.object({
|
|
9507
|
+
id: z.string(),
|
|
9508
|
+
type: FieldTypeSchema,
|
|
9509
|
+
name: z.string(),
|
|
9510
|
+
created_at: z.string().optional(),
|
|
9511
|
+
edited_at: z.string().optional(),
|
|
9512
|
+
options: z.record(z.string(), z.unknown()).optional(),
|
|
9513
|
+
config: z.record(z.string(), z.unknown()).optional(),
|
|
9514
|
+
deleted_at: z.string().nullable().optional()
|
|
9515
|
+
});
|
|
9516
|
+
var ListTableFieldsDescription = "List fields for a table";
|
|
9517
|
+
var ListTableFieldsOptionsBaseSchema = z.object({
|
|
9518
|
+
fields: FieldsPropertySchema.optional(),
|
|
9519
|
+
fieldKeys: z.array(z.union([z.string(), z.number()])).optional().describe(
|
|
9520
|
+
'Filter by specific fields. Accepts field names (e.g., "Email") or IDs (e.g., "f6", "6", or 6).'
|
|
9521
|
+
).meta({ deprecated: true }),
|
|
9522
|
+
trash: TrashSchema
|
|
9523
|
+
});
|
|
9524
|
+
var ListTableFieldsOptionsSchema = z.object({
|
|
9525
|
+
table: TablePropertySchema
|
|
9526
|
+
}).merge(ListTableFieldsOptionsBaseSchema).describe(ListTableFieldsDescription).meta({ aliases: { tableId: "table", fieldKeys: "fields" } });
|
|
9527
|
+
var ListTableFieldsOptionsSchemaDeprecated = z.object({
|
|
9528
|
+
tableId: z.string().regex(/^[A-Z0-9]{26}$/, "Table ID must be a valid ULID").describe("The unique identifier of the table")
|
|
9529
|
+
}).merge(ListTableFieldsOptionsBaseSchema);
|
|
9530
|
+
var ListTableFieldsOptionsInputSchema = z.union([ListTableFieldsOptionsSchema, ListTableFieldsOptionsSchemaDeprecated]).describe(ListTableFieldsDescription);
|
|
9531
|
+
|
|
9532
|
+
// src/resolvers/tableFields.ts
|
|
9533
|
+
var fieldTypeChoices = FieldTypeSchema.options.map((type) => ({
|
|
9534
|
+
label: type,
|
|
9535
|
+
value: type
|
|
9536
|
+
}));
|
|
9537
|
+
var singleFieldResolver = defineResolver({
|
|
9538
|
+
type: "object",
|
|
9539
|
+
properties: {
|
|
9540
|
+
type: {
|
|
9541
|
+
label: "Field type",
|
|
9542
|
+
required: true,
|
|
9543
|
+
resolver: defineResolver({
|
|
9544
|
+
listItems: () => ({ data: fieldTypeChoices }),
|
|
9545
|
+
prompt: ({ items }) => ({
|
|
9546
|
+
type: "list",
|
|
9547
|
+
message: "Select field type:",
|
|
9548
|
+
choices: items
|
|
9549
|
+
})
|
|
9550
|
+
})
|
|
9551
|
+
},
|
|
9552
|
+
name: {
|
|
9553
|
+
label: "Field name",
|
|
9554
|
+
required: true,
|
|
9555
|
+
resolver: defineResolver({ type: "static", inputType: "text" })
|
|
9556
|
+
}
|
|
9557
|
+
}
|
|
9558
|
+
});
|
|
9559
|
+
var tableFieldsResolver = defineResolver({
|
|
9560
|
+
type: "array",
|
|
9561
|
+
items: singleFieldResolver,
|
|
9562
|
+
minItems: 1
|
|
9563
|
+
});
|
|
9564
|
+
|
|
9565
|
+
// src/resolvers/tableRecords.ts
|
|
9566
|
+
var listTableFieldsRef2 = declareMethod({ id: "listTableFields" });
|
|
9567
|
+
function tableFieldValueType(fieldType) {
|
|
9568
|
+
if (fieldType.startsWith("multiple_")) return "array";
|
|
9569
|
+
switch (fieldType) {
|
|
9570
|
+
case "number":
|
|
9571
|
+
case "decimal":
|
|
9572
|
+
case "currency":
|
|
9573
|
+
return "number";
|
|
9574
|
+
case "boolean":
|
|
9575
|
+
return "boolean";
|
|
9576
|
+
default:
|
|
9577
|
+
return void 0;
|
|
9578
|
+
}
|
|
9579
|
+
}
|
|
9580
|
+
function buildDataFields(fields) {
|
|
9581
|
+
const props = {};
|
|
9582
|
+
for (const field of fields) {
|
|
9583
|
+
const valueType = tableFieldValueType(field.type);
|
|
9584
|
+
props[field.id] = {
|
|
9585
|
+
label: field.name,
|
|
9586
|
+
required: false,
|
|
9587
|
+
...valueType ? { valueType } : {},
|
|
9588
|
+
resolver: { type: "static", inputType: "text" }
|
|
9589
|
+
};
|
|
9590
|
+
}
|
|
9591
|
+
return props;
|
|
9592
|
+
}
|
|
9593
|
+
function makeRecordsResolver(includeRecordId) {
|
|
9594
|
+
const singleRecordResolver = defineResolver({
|
|
9595
|
+
type: "object",
|
|
9596
|
+
imports: [listTableFieldsRef2],
|
|
9597
|
+
requireParameters: ["table"],
|
|
9598
|
+
// The record-id resolver is import-bearing, so it lives in `definitions` and
|
|
9599
|
+
// is reached by `{ ref }` from the built `id` field (updates only).
|
|
9600
|
+
definitions: includeRecordId ? { recordId: tableRecordIdResolver } : {},
|
|
9601
|
+
getProperties: async ({ imports, input }) => {
|
|
9602
|
+
const { data: fields } = await imports.listTableFields({
|
|
9603
|
+
table: input.table
|
|
9604
|
+
});
|
|
9605
|
+
const props = {
|
|
9606
|
+
data: {
|
|
9607
|
+
label: "Field values",
|
|
9608
|
+
resolver: { type: "object", properties: buildDataFields(fields) }
|
|
9609
|
+
}
|
|
9610
|
+
};
|
|
9611
|
+
if (includeRecordId) {
|
|
9612
|
+
props.id = {
|
|
9613
|
+
label: "Record",
|
|
9614
|
+
required: true,
|
|
9615
|
+
resolver: { ref: "recordId" }
|
|
9616
|
+
};
|
|
9617
|
+
}
|
|
9618
|
+
return props;
|
|
9755
9619
|
}
|
|
9756
|
-
};
|
|
9620
|
+
});
|
|
9621
|
+
return defineResolver({
|
|
9622
|
+
type: "array",
|
|
9623
|
+
requireParameters: ["table"],
|
|
9624
|
+
minItems: 1,
|
|
9625
|
+
items: singleRecordResolver
|
|
9626
|
+
});
|
|
9757
9627
|
}
|
|
9628
|
+
var tableRecordsResolver = makeRecordsResolver(false);
|
|
9629
|
+
var tableUpdateRecordsResolver = makeRecordsResolver(true);
|
|
9758
9630
|
|
|
9759
|
-
// src/resolvers/
|
|
9760
|
-
var
|
|
9761
|
-
|
|
9762
|
-
|
|
9763
|
-
|
|
9764
|
-
|
|
9765
|
-
|
|
9631
|
+
// src/resolvers/tableFilters.ts
|
|
9632
|
+
var listTableFieldsRef3 = declareMethod({ id: "listTableFields" });
|
|
9633
|
+
var FILTER_OPERATORS = [
|
|
9634
|
+
{ label: "equals", value: "exact" },
|
|
9635
|
+
{ label: "not equals", value: "different" },
|
|
9636
|
+
{ label: "contains", value: "contains" },
|
|
9637
|
+
{ label: "contains (case-insensitive)", value: "icontains" },
|
|
9638
|
+
{ label: "starts with", value: "startswith" },
|
|
9639
|
+
{ label: "search", value: "search" },
|
|
9640
|
+
{ label: "greater than", value: "gt" },
|
|
9641
|
+
{ label: "greater than or equal", value: "gte" },
|
|
9642
|
+
{ label: "less than", value: "lt" },
|
|
9643
|
+
{ label: "less than or equal", value: "lte" },
|
|
9644
|
+
{ label: "in range", value: "range" },
|
|
9645
|
+
{ label: "in list", value: "in" },
|
|
9646
|
+
{ label: "is empty", value: "isnull" },
|
|
9647
|
+
{ label: "is within (date)", value: "is_within" }
|
|
9648
|
+
];
|
|
9649
|
+
function fieldKeyChoices(fields) {
|
|
9650
|
+
return fields.flatMap((field) => {
|
|
9651
|
+
const components = NESTED_COMPONENTS[field.type];
|
|
9652
|
+
if (components && components.size > 1) {
|
|
9653
|
+
return [...components].map((component) => ({
|
|
9654
|
+
label: `${field.name}__${component} (${field.id}, ${field.type})`,
|
|
9655
|
+
value: `${field.name}__${component}`
|
|
9656
|
+
}));
|
|
9657
|
+
}
|
|
9658
|
+
return {
|
|
9659
|
+
label: `${field.name} (${field.id}${components ? `, ${field.type}` : ""})`,
|
|
9660
|
+
value: components ? `${field.name}__${[...components][0]}` : field.name
|
|
9661
|
+
};
|
|
9662
|
+
});
|
|
9766
9663
|
}
|
|
9767
|
-
|
|
9768
|
-
|
|
9769
|
-
|
|
9770
|
-
|
|
9771
|
-
})
|
|
9664
|
+
var singleFilterResolver = defineResolver({
|
|
9665
|
+
type: "object",
|
|
9666
|
+
imports: [listTableFieldsRef3],
|
|
9667
|
+
requireParameters: ["table"],
|
|
9668
|
+
getProperties: async ({ imports, input }) => {
|
|
9669
|
+
const { data: fields } = await imports.listTableFields({
|
|
9670
|
+
table: input.table
|
|
9671
|
+
});
|
|
9672
|
+
const choices = fieldKeyChoices(fields);
|
|
9673
|
+
const props = {
|
|
9674
|
+
fieldKey: {
|
|
9675
|
+
label: "Field",
|
|
9676
|
+
required: true,
|
|
9677
|
+
resolver: {
|
|
9678
|
+
type: "dynamic",
|
|
9679
|
+
listItems: () => ({ data: choices }),
|
|
9680
|
+
prompt: () => ({
|
|
9681
|
+
type: "list",
|
|
9682
|
+
message: "Select field:",
|
|
9683
|
+
choices
|
|
9684
|
+
})
|
|
9685
|
+
}
|
|
9686
|
+
},
|
|
9687
|
+
operator: {
|
|
9688
|
+
label: "Operator",
|
|
9689
|
+
required: true,
|
|
9690
|
+
resolver: {
|
|
9691
|
+
type: "dynamic",
|
|
9692
|
+
listItems: () => ({ data: FILTER_OPERATORS }),
|
|
9693
|
+
prompt: () => ({
|
|
9694
|
+
type: "list",
|
|
9695
|
+
message: "Select operator:",
|
|
9696
|
+
choices: FILTER_OPERATORS
|
|
9697
|
+
})
|
|
9698
|
+
}
|
|
9699
|
+
},
|
|
9700
|
+
value: {
|
|
9701
|
+
label: "Value",
|
|
9702
|
+
required: false,
|
|
9703
|
+
resolver: { type: "static", inputType: "text" }
|
|
9704
|
+
}
|
|
9705
|
+
};
|
|
9706
|
+
return props;
|
|
9707
|
+
}
|
|
9708
|
+
});
|
|
9709
|
+
var tableFiltersResolver = defineResolver({
|
|
9710
|
+
type: "array",
|
|
9711
|
+
requireParameters: ["table"],
|
|
9712
|
+
minItems: 0,
|
|
9713
|
+
items: singleFilterResolver
|
|
9714
|
+
});
|
|
9715
|
+
|
|
9716
|
+
// src/resolvers/tableSort.ts
|
|
9717
|
+
var listTableFieldsRef4 = declareMethod({ id: "listTableFields" });
|
|
9718
|
+
function fieldKeyChoices2(fields) {
|
|
9719
|
+
return fields.flatMap((field) => {
|
|
9720
|
+
const components = NESTED_COMPONENTS[field.type];
|
|
9721
|
+
if (components) {
|
|
9722
|
+
return [...components].map((component) => ({
|
|
9723
|
+
label: `${field.name}__${component} (${field.id}, ${field.type})`,
|
|
9724
|
+
value: `${field.name}__${component}`
|
|
9725
|
+
}));
|
|
9726
|
+
}
|
|
9727
|
+
return { label: `${field.name} (${field.id})`, value: field.name };
|
|
9728
|
+
});
|
|
9772
9729
|
}
|
|
9773
|
-
var
|
|
9774
|
-
|
|
9730
|
+
var DIRECTION_CHOICES = [
|
|
9731
|
+
{ label: "Ascending", value: "asc" },
|
|
9732
|
+
{ label: "Descending", value: "desc" }
|
|
9733
|
+
];
|
|
9734
|
+
var tableSortResolver = defineResolver({
|
|
9735
|
+
type: "object",
|
|
9736
|
+
imports: [listTableFieldsRef4],
|
|
9775
9737
|
requireParameters: ["table"],
|
|
9776
|
-
|
|
9777
|
-
|
|
9778
|
-
|
|
9779
|
-
|
|
9780
|
-
|
|
9781
|
-
|
|
9782
|
-
|
|
9783
|
-
|
|
9784
|
-
|
|
9785
|
-
|
|
9738
|
+
getProperties: async ({ imports, input }) => {
|
|
9739
|
+
const { data: fields } = await imports.listTableFields({
|
|
9740
|
+
table: input.table
|
|
9741
|
+
});
|
|
9742
|
+
const choices = fieldKeyChoices2(fields);
|
|
9743
|
+
const props = {
|
|
9744
|
+
fieldKey: {
|
|
9745
|
+
label: "Field",
|
|
9746
|
+
required: true,
|
|
9747
|
+
resolver: {
|
|
9748
|
+
type: "dynamic",
|
|
9749
|
+
listItems: () => ({ data: choices }),
|
|
9750
|
+
prompt: () => ({
|
|
9751
|
+
type: "list",
|
|
9752
|
+
message: "Select field:",
|
|
9753
|
+
choices
|
|
9754
|
+
})
|
|
9755
|
+
}
|
|
9756
|
+
},
|
|
9757
|
+
direction: {
|
|
9758
|
+
label: "Direction",
|
|
9759
|
+
required: true,
|
|
9760
|
+
resolver: {
|
|
9761
|
+
type: "dynamic",
|
|
9762
|
+
listItems: () => ({ data: DIRECTION_CHOICES }),
|
|
9763
|
+
prompt: () => ({
|
|
9764
|
+
type: "list",
|
|
9765
|
+
message: "Select direction:",
|
|
9766
|
+
choices: DIRECTION_CHOICES
|
|
9767
|
+
})
|
|
9768
|
+
}
|
|
9769
|
+
}
|
|
9770
|
+
};
|
|
9771
|
+
return props;
|
|
9772
|
+
}
|
|
9773
|
+
});
|
|
9774
|
+
var GetActionDescription = "Get detailed information about a specific action";
|
|
9775
|
+
var GetActionSchema = z.object({
|
|
9776
|
+
app: AppPropertySchema,
|
|
9777
|
+
actionType: ActionTypePropertySchema,
|
|
9778
|
+
action: ActionPropertySchema
|
|
9779
|
+
}).describe(GetActionDescription).meta({ aliases: { appKey: "app", actionKey: "action" } });
|
|
9780
|
+
var GetActionSchemaDeprecated = z.object({
|
|
9781
|
+
appKey: AppKeyPropertySchema,
|
|
9782
|
+
actionType: ActionTypePropertySchema,
|
|
9783
|
+
actionKey: ActionKeyPropertySchema
|
|
9784
|
+
});
|
|
9785
|
+
var GetActionInputSchema = z.union([GetActionSchema, GetActionSchemaDeprecated]).describe(GetActionDescription);
|
|
9786
|
+
var ListActionsDescription = "List all actions for a specific app";
|
|
9787
|
+
var ListActionsBaseSchema = z.object({
|
|
9788
|
+
pageSize: z.number().min(1).optional().describe("Number of actions per page"),
|
|
9789
|
+
maxItems: z.number().min(1).optional().describe("Maximum total items to return across all pages"),
|
|
9790
|
+
cursor: z.string().optional().describe("Cursor to start from")
|
|
9791
|
+
});
|
|
9792
|
+
var ListActionsSchema = z.object({
|
|
9793
|
+
app: AppPropertySchema.describe(
|
|
9794
|
+
"App key of actions to list (e.g., 'SlackCLIAPI' or slug like 'github')"
|
|
9795
|
+
),
|
|
9796
|
+
actionType: ActionTypePropertySchema.optional().describe(
|
|
9797
|
+
"Filter actions by type"
|
|
9798
|
+
)
|
|
9799
|
+
}).merge(ListActionsBaseSchema).describe(ListActionsDescription).meta({ aliases: { appKey: "app" } });
|
|
9800
|
+
var ListActionsSchemaDeprecated = z.object({
|
|
9801
|
+
appKey: AppKeyPropertySchema.describe(
|
|
9802
|
+
"App key of actions to list (e.g., 'SlackCLIAPI' or slug like 'github')"
|
|
9803
|
+
),
|
|
9804
|
+
actionType: ActionTypePropertySchema.optional().describe(
|
|
9805
|
+
"Filter actions by type"
|
|
9806
|
+
)
|
|
9807
|
+
}).merge(ListActionsBaseSchema);
|
|
9808
|
+
var ListActionsInputSchema = z.union([ListActionsSchema, ListActionsSchemaDeprecated]).describe(ListActionsDescription);
|
|
9809
|
+
var NeedChoicesSchema = z.object({
|
|
9810
|
+
key: z.string().optional(),
|
|
9811
|
+
label: z.string().optional(),
|
|
9812
|
+
sample: z.string().optional(),
|
|
9813
|
+
value: z.string().optional()
|
|
9814
|
+
});
|
|
9815
|
+
var NeedSchema = z.object({
|
|
9816
|
+
key: z.string(),
|
|
9817
|
+
alters_custom_fields: z.boolean().nullable().optional(),
|
|
9818
|
+
capabilities: z.array(z.string()).optional(),
|
|
9819
|
+
choices: z.array(NeedChoicesSchema).optional(),
|
|
9820
|
+
computed: z.boolean().nullable().optional(),
|
|
9821
|
+
custom_field: z.boolean().optional(),
|
|
9822
|
+
default: z.string().optional(),
|
|
9823
|
+
depends_on: z.array(z.string()).optional(),
|
|
9824
|
+
format: z.literal("SELECT").optional(),
|
|
9825
|
+
from_search: z.boolean().optional(),
|
|
9826
|
+
from_write: z.boolean().optional(),
|
|
9827
|
+
help_text: z.string().optional(),
|
|
9828
|
+
help_text_html: z.string().optional(),
|
|
9829
|
+
input_format: z.array(z.string()).optional(),
|
|
9830
|
+
label: z.string().optional(),
|
|
9831
|
+
language: z.string().optional(),
|
|
9832
|
+
parent_key: z.string().optional(),
|
|
9833
|
+
placeholder: z.string().optional(),
|
|
9834
|
+
prefill: z.string().optional(),
|
|
9835
|
+
required: z.boolean().optional(),
|
|
9836
|
+
searchfill: z.string().optional(),
|
|
9837
|
+
send_in_json: z.boolean().optional(),
|
|
9838
|
+
regex: z.string().optional(),
|
|
9839
|
+
type: z.enum([
|
|
9840
|
+
"integer",
|
|
9841
|
+
"string",
|
|
9842
|
+
"text",
|
|
9843
|
+
"datetime",
|
|
9844
|
+
"boolean",
|
|
9845
|
+
"file",
|
|
9846
|
+
"decimal",
|
|
9847
|
+
"copy",
|
|
9848
|
+
"password",
|
|
9849
|
+
"dict",
|
|
9850
|
+
"code",
|
|
9851
|
+
"filter",
|
|
9852
|
+
"json"
|
|
9853
|
+
]).optional(),
|
|
9854
|
+
list: z.boolean().optional()
|
|
9786
9855
|
});
|
|
9787
|
-
|
|
9788
|
-
|
|
9789
|
-
requireParameters: ["table"],
|
|
9790
|
-
listItems: ({ imports, input, cursor }) => imports.listTableRecords({
|
|
9791
|
-
table: input.table,
|
|
9792
|
-
keyMode: "names",
|
|
9793
|
-
cursor
|
|
9794
|
-
}),
|
|
9795
|
-
prompt: ({ items }) => ({
|
|
9796
|
-
type: "checkbox",
|
|
9797
|
-
message: "Select records to delete:",
|
|
9798
|
-
choices: recordChoices(items)
|
|
9799
|
-
}),
|
|
9800
|
-
validate: ({ value }) => Array.isArray(value) && value.length > 0 ? true : "Select at least one record"
|
|
9856
|
+
z.object({
|
|
9857
|
+
action_url: z.string().optional()
|
|
9801
9858
|
});
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
-
var listTableFieldsRef = declareMethod({ id: "listTableFields" });
|
|
9805
|
-
var tableFieldIdsResolver = defineResolver({
|
|
9806
|
-
imports: [listTableFieldsRef],
|
|
9807
|
-
requireParameters: ["table"],
|
|
9808
|
-
// No cursor forwarding: the fields API is unpaginated (no cursor on the
|
|
9809
|
-
// response), so the listing is always exhausted after one page.
|
|
9810
|
-
listItems: ({ imports, input }) => imports.listTableFields({ table: input.table }),
|
|
9811
|
-
prompt: ({ items }) => ({
|
|
9812
|
-
type: "checkbox",
|
|
9813
|
-
message: "Select fields:",
|
|
9814
|
-
choices: items.map((field) => ({
|
|
9815
|
-
label: field.name,
|
|
9816
|
-
hint: [field.id, field.type],
|
|
9817
|
-
value: field.id
|
|
9818
|
-
}))
|
|
9819
|
-
}),
|
|
9820
|
-
validate: ({ value }) => Array.isArray(value) && value.length > 0 ? true : "Select at least one field"
|
|
9859
|
+
z.object({
|
|
9860
|
+
can_use: z.boolean().optional()
|
|
9821
9861
|
});
|
|
9822
|
-
|
|
9823
|
-
|
|
9824
|
-
|
|
9825
|
-
|
|
9826
|
-
|
|
9827
|
-
|
|
9862
|
+
var ActionSchema = z.object({
|
|
9863
|
+
id: z.string().optional(),
|
|
9864
|
+
type: z.enum([
|
|
9865
|
+
"filter",
|
|
9866
|
+
"read",
|
|
9867
|
+
"read_bulk",
|
|
9868
|
+
"run",
|
|
9869
|
+
"search",
|
|
9870
|
+
"search_and_write",
|
|
9871
|
+
"search_or_write",
|
|
9872
|
+
"write"
|
|
9873
|
+
]),
|
|
9874
|
+
key: z.string(),
|
|
9875
|
+
name: z.string(),
|
|
9876
|
+
description: z.string(),
|
|
9877
|
+
is_important: z.boolean().optional(),
|
|
9878
|
+
is_hidden: z.boolean().optional(),
|
|
9879
|
+
selected_api: z.string().optional()
|
|
9828
9880
|
});
|
|
9829
|
-
var
|
|
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
|
-
|
|
9855
|
-
|
|
9856
|
-
|
|
9857
|
-
|
|
9858
|
-
|
|
9859
|
-
|
|
9860
|
-
|
|
9861
|
-
|
|
9881
|
+
var ChoiceSchema = z.object({
|
|
9882
|
+
value: z.union([z.string(), z.number()]),
|
|
9883
|
+
label: z.string()
|
|
9884
|
+
});
|
|
9885
|
+
z.object({
|
|
9886
|
+
key: z.string(),
|
|
9887
|
+
label: z.string(),
|
|
9888
|
+
type: z.enum([
|
|
9889
|
+
"string",
|
|
9890
|
+
"number",
|
|
9891
|
+
"boolean",
|
|
9892
|
+
"datetime",
|
|
9893
|
+
"file",
|
|
9894
|
+
"object",
|
|
9895
|
+
"array"
|
|
9896
|
+
]),
|
|
9897
|
+
required: z.boolean(),
|
|
9898
|
+
description: z.string().optional(),
|
|
9899
|
+
choices: z.array(ChoiceSchema).optional()
|
|
9900
|
+
});
|
|
9901
|
+
z.object({
|
|
9902
|
+
data: z.array(z.unknown())
|
|
9903
|
+
});
|
|
9904
|
+
var ActionFieldChoiceSchema = z.object({
|
|
9905
|
+
value: z.union([z.string(), z.number()]),
|
|
9906
|
+
label: z.string()
|
|
9907
|
+
});
|
|
9908
|
+
z.object({
|
|
9909
|
+
key: z.string(),
|
|
9910
|
+
label: z.string().optional(),
|
|
9911
|
+
required: z.boolean(),
|
|
9912
|
+
type: z.string().optional(),
|
|
9913
|
+
helpText: z.string().optional(),
|
|
9914
|
+
helpTextHtml: z.string().optional(),
|
|
9915
|
+
choices: z.array(ActionFieldChoiceSchema).optional(),
|
|
9916
|
+
default: z.string().optional(),
|
|
9917
|
+
placeholder: z.string().optional(),
|
|
9918
|
+
computed: z.boolean().optional(),
|
|
9919
|
+
customField: z.boolean().optional(),
|
|
9920
|
+
dependsOn: z.array(z.string()).optional(),
|
|
9921
|
+
format: z.string().optional(),
|
|
9922
|
+
inputFormat: z.array(z.string()).optional()
|
|
9923
|
+
});
|
|
9924
|
+
z.object({
|
|
9862
9925
|
id: z.number(),
|
|
9863
|
-
|
|
9926
|
+
public_id: z.string().optional(),
|
|
9927
|
+
code: z.string(),
|
|
9928
|
+
user_id: z.number(),
|
|
9929
|
+
auto_provisioned: z.boolean(),
|
|
9930
|
+
first_name: z.string(),
|
|
9931
|
+
last_name: z.string(),
|
|
9932
|
+
username: z.string(),
|
|
9933
|
+
personas: z.string(),
|
|
9934
|
+
user_generated_personas: z.string(),
|
|
9935
|
+
last_login: z.string(),
|
|
9936
|
+
email: z.string(),
|
|
9937
|
+
email_hash: z.string(),
|
|
9938
|
+
email_confirmed: z.boolean(),
|
|
9939
|
+
timezone: z.string(),
|
|
9940
|
+
photo_url: z.string(),
|
|
9941
|
+
has_seen_notifications: z.record(z.string(), z.boolean().nullable()),
|
|
9942
|
+
signup: z.string(),
|
|
9943
|
+
since_signup: z.string(),
|
|
9944
|
+
has_activated: z.boolean(),
|
|
9945
|
+
enable_gz_creator: z.boolean(),
|
|
9946
|
+
should_see_nps_survey: z.boolean(),
|
|
9947
|
+
is_developer: z.boolean(),
|
|
9948
|
+
is_expert: z.boolean(),
|
|
9949
|
+
tos_agreement: z.boolean(),
|
|
9950
|
+
should_renew_tos: z.boolean(),
|
|
9951
|
+
is_gdpr_consented: z.boolean(),
|
|
9952
|
+
disable_ssl_check: z.boolean(),
|
|
9953
|
+
identity: z.number(),
|
|
9954
|
+
summary_schedule: z.string(),
|
|
9955
|
+
alert_triggers: z.string(),
|
|
9956
|
+
alert_actions: z.string(),
|
|
9957
|
+
is_staff: z.boolean(),
|
|
9958
|
+
is_zt_reviewer: z.boolean(),
|
|
9959
|
+
is_high_value: z.boolean(),
|
|
9960
|
+
is_temporary: z.boolean(),
|
|
9961
|
+
banner_message: z.string(),
|
|
9962
|
+
enable_totp_2fa: z.boolean(),
|
|
9963
|
+
viewed_help: z.record(z.string(), z.boolean()),
|
|
9964
|
+
show_editor_migration_mesaging: z.boolean(),
|
|
9965
|
+
switches: z.record(z.string(), z.unknown()),
|
|
9966
|
+
organizations: z.array(z.record(z.string(), z.unknown()).nullable()),
|
|
9967
|
+
primary_organization: z.record(z.string(), z.unknown()).nullable(),
|
|
9968
|
+
has_active_zaps: z.boolean(),
|
|
9969
|
+
has_google_sso: z.boolean(),
|
|
9970
|
+
auth_realm: z.string(),
|
|
9971
|
+
roles: z.array(
|
|
9972
|
+
z.object({
|
|
9973
|
+
account_id: z.number(),
|
|
9974
|
+
role: z.string()
|
|
9975
|
+
})
|
|
9976
|
+
)
|
|
9977
|
+
});
|
|
9978
|
+
z.object({
|
|
9979
|
+
age_in_days: z.string().optional(),
|
|
9980
|
+
api_docs_url: z.string().nullable().optional(),
|
|
9981
|
+
app_profile_url: z.string(),
|
|
9982
|
+
banner: z.string().optional(),
|
|
9983
|
+
categories: z.array(z.string()).optional(),
|
|
9984
|
+
// Service category names
|
|
9985
|
+
canonical_id: z.string().optional(),
|
|
9986
|
+
current_implementation_id: z.string(),
|
|
9987
|
+
days_since_last_update: z.string().optional(),
|
|
9988
|
+
description: z.string(),
|
|
9989
|
+
external_url: z.string(),
|
|
9990
|
+
hashtag: z.string().optional(),
|
|
9991
|
+
id: z.number().optional(),
|
|
9992
|
+
image: z.string().optional(),
|
|
9993
|
+
images: z.string().optional(),
|
|
9994
|
+
integration_overview_html: z.string().nullable().optional(),
|
|
9995
|
+
internal_id: z.string(),
|
|
9996
|
+
invite_url: z.string().nullable().optional(),
|
|
9997
|
+
is_beta: z.string().optional(),
|
|
9998
|
+
is_built_in: z.string().optional(),
|
|
9999
|
+
is_featured: z.string().optional(),
|
|
10000
|
+
is_premium: z.boolean().optional(),
|
|
10001
|
+
is_public: z.string().optional(),
|
|
10002
|
+
is_upcoming: z.string().optional(),
|
|
10003
|
+
learn_more_url: z.string(),
|
|
9864
10004
|
name: z.string(),
|
|
9865
|
-
|
|
9866
|
-
|
|
9867
|
-
|
|
9868
|
-
|
|
9869
|
-
|
|
9870
|
-
|
|
9871
|
-
|
|
9872
|
-
|
|
10005
|
+
popularity: z.number(),
|
|
10006
|
+
primary_color: z.string(),
|
|
10007
|
+
request_count: z.string().optional(),
|
|
10008
|
+
slug: z.string(),
|
|
10009
|
+
zap_usage_count: z.number().nullable().optional()
|
|
10010
|
+
});
|
|
10011
|
+
var ServiceSchema = z.object({
|
|
10012
|
+
id: z.number().optional(),
|
|
10013
|
+
canonical_id: z.string().optional(),
|
|
10014
|
+
current_implementation_id: z.string(),
|
|
10015
|
+
name: z.string(),
|
|
10016
|
+
slug: z.string(),
|
|
10017
|
+
app_url: z.string().optional(),
|
|
10018
|
+
learn_more_url: z.string().optional(),
|
|
10019
|
+
description: z.string(),
|
|
10020
|
+
primary_color: z.string(),
|
|
10021
|
+
popularity: z.number(),
|
|
10022
|
+
image: z.string().optional(),
|
|
10023
|
+
images: z.string().optional()
|
|
9873
10024
|
});
|
|
9874
|
-
|
|
9875
|
-
|
|
10025
|
+
z.object({
|
|
10026
|
+
results: z.array(ServiceSchema),
|
|
10027
|
+
next: z.string().nullable().optional(),
|
|
10028
|
+
previous: z.string().nullable().optional()
|
|
9876
10029
|
});
|
|
9877
|
-
|
|
9878
|
-
|
|
9879
|
-
|
|
9880
|
-
|
|
9881
|
-
|
|
9882
|
-
|
|
9883
|
-
options: z.record(z.string(), z.unknown()).optional(),
|
|
9884
|
-
config: z.record(z.string(), z.unknown()).optional(),
|
|
9885
|
-
deleted_at: z.string().nullable().optional()
|
|
10030
|
+
z.object({
|
|
10031
|
+
selected_api: z.string(),
|
|
10032
|
+
action: z.string(),
|
|
10033
|
+
type_of: z.string(),
|
|
10034
|
+
authentication_id: z.union([z.string(), z.number()]).optional(),
|
|
10035
|
+
params: z.record(z.string(), z.unknown()).optional()
|
|
9886
10036
|
});
|
|
9887
|
-
|
|
9888
|
-
|
|
9889
|
-
|
|
9890
|
-
|
|
9891
|
-
|
|
9892
|
-
).
|
|
9893
|
-
trash: TrashSchema
|
|
10037
|
+
z.object({
|
|
10038
|
+
success: z.boolean(),
|
|
10039
|
+
needs: z.array(NeedSchema).optional(),
|
|
10040
|
+
errors: z.array(z.string()).optional(),
|
|
10041
|
+
last_fetched_at: z.string().optional(),
|
|
10042
|
+
schema: z.record(z.string(), z.unknown()).optional()
|
|
9894
10043
|
});
|
|
9895
|
-
var
|
|
9896
|
-
|
|
9897
|
-
|
|
9898
|
-
|
|
9899
|
-
|
|
9900
|
-
|
|
9901
|
-
|
|
9902
|
-
|
|
9903
|
-
|
|
9904
|
-
|
|
9905
|
-
|
|
9906
|
-
|
|
9907
|
-
|
|
9908
|
-
|
|
9909
|
-
|
|
9910
|
-
|
|
9911
|
-
|
|
9912
|
-
|
|
9913
|
-
|
|
9914
|
-
resolver: defineResolver({
|
|
9915
|
-
listItems: () => ({ data: fieldTypeChoices }),
|
|
9916
|
-
prompt: ({ items }) => ({
|
|
9917
|
-
type: "list",
|
|
9918
|
-
message: "Select field type:",
|
|
9919
|
-
choices: items
|
|
9920
|
-
})
|
|
9921
|
-
})
|
|
9922
|
-
},
|
|
9923
|
-
name: {
|
|
9924
|
-
label: "Field name",
|
|
9925
|
-
required: true,
|
|
9926
|
-
resolver: defineResolver({ type: "static", inputType: "text" })
|
|
9927
|
-
}
|
|
9928
|
-
}
|
|
10044
|
+
var ImplementationSchema = z.object({
|
|
10045
|
+
selected_api: z.string(),
|
|
10046
|
+
app_id: z.number().optional(),
|
|
10047
|
+
auth_type: z.string().optional(),
|
|
10048
|
+
auth_fields: z.string().optional(),
|
|
10049
|
+
actions: z.array(ActionSchema).optional(),
|
|
10050
|
+
is_deprecated: z.boolean().optional(),
|
|
10051
|
+
is_private_only: z.boolean().optional(),
|
|
10052
|
+
is_invite_only: z.boolean().optional(),
|
|
10053
|
+
is_beta: z.boolean().optional().default(false),
|
|
10054
|
+
is_premium: z.boolean().optional().default(false),
|
|
10055
|
+
is_hidden: z.string().optional(),
|
|
10056
|
+
name: z.string().optional(),
|
|
10057
|
+
slug: z.string().optional(),
|
|
10058
|
+
images: z.record(z.string(), z.string().nullable()).optional(),
|
|
10059
|
+
primary_color: z.string().optional(),
|
|
10060
|
+
secondary_color: z.string().optional(),
|
|
10061
|
+
current_implementation: z.string().optional(),
|
|
10062
|
+
other_implementations: z.string().optional()
|
|
9929
10063
|
});
|
|
9930
|
-
|
|
9931
|
-
|
|
9932
|
-
|
|
9933
|
-
|
|
10064
|
+
z.object({
|
|
10065
|
+
count: z.number(),
|
|
10066
|
+
next: z.string().nullable().optional(),
|
|
10067
|
+
previous: z.string().nullable().optional(),
|
|
10068
|
+
results: z.array(ImplementationSchema)
|
|
9934
10069
|
});
|
|
9935
|
-
|
|
9936
|
-
|
|
9937
|
-
|
|
9938
|
-
|
|
9939
|
-
|
|
9940
|
-
|
|
9941
|
-
|
|
9942
|
-
|
|
9943
|
-
|
|
9944
|
-
|
|
9945
|
-
|
|
9946
|
-
|
|
9947
|
-
|
|
9948
|
-
|
|
9949
|
-
|
|
9950
|
-
|
|
9951
|
-
|
|
9952
|
-
|
|
9953
|
-
|
|
9954
|
-
|
|
9955
|
-
|
|
9956
|
-
|
|
9957
|
-
|
|
9958
|
-
|
|
9959
|
-
|
|
9960
|
-
|
|
9961
|
-
|
|
9962
|
-
return props;
|
|
9963
|
-
}
|
|
9964
|
-
function makeRecordsResolver(includeRecordId) {
|
|
9965
|
-
const singleRecordResolver = defineResolver({
|
|
9966
|
-
type: "object",
|
|
9967
|
-
imports: [listTableFieldsRef2],
|
|
9968
|
-
requireParameters: ["table"],
|
|
9969
|
-
// The record-id resolver is import-bearing, so it lives in `definitions` and
|
|
9970
|
-
// is reached by `{ ref }` from the built `id` field (updates only).
|
|
9971
|
-
definitions: includeRecordId ? { recordId: tableRecordIdResolver } : {},
|
|
9972
|
-
getProperties: async ({ imports, input }) => {
|
|
9973
|
-
const { data: fields } = await imports.listTableFields({
|
|
9974
|
-
table: input.table
|
|
9975
|
-
});
|
|
9976
|
-
const props = {
|
|
9977
|
-
data: {
|
|
9978
|
-
label: "Field values",
|
|
9979
|
-
resolver: { type: "object", properties: buildDataFields(fields) }
|
|
9980
|
-
}
|
|
9981
|
-
};
|
|
9982
|
-
if (includeRecordId) {
|
|
9983
|
-
props.id = {
|
|
9984
|
-
label: "Record",
|
|
9985
|
-
required: true,
|
|
9986
|
-
resolver: { ref: "recordId" }
|
|
9987
|
-
};
|
|
9988
|
-
}
|
|
9989
|
-
return props;
|
|
9990
|
-
}
|
|
9991
|
-
});
|
|
9992
|
-
return defineResolver({
|
|
9993
|
-
type: "array",
|
|
9994
|
-
requireParameters: ["table"],
|
|
9995
|
-
minItems: 1,
|
|
9996
|
-
items: singleRecordResolver
|
|
9997
|
-
});
|
|
9998
|
-
}
|
|
9999
|
-
var tableRecordsResolver = makeRecordsResolver(false);
|
|
10000
|
-
var tableUpdateRecordsResolver = makeRecordsResolver(true);
|
|
10001
|
-
|
|
10002
|
-
// src/resolvers/tableFilters.ts
|
|
10003
|
-
var listTableFieldsRef3 = declareMethod({ id: "listTableFields" });
|
|
10004
|
-
var FILTER_OPERATORS = [
|
|
10005
|
-
{ label: "equals", value: "exact" },
|
|
10006
|
-
{ label: "not equals", value: "different" },
|
|
10007
|
-
{ label: "contains", value: "contains" },
|
|
10008
|
-
{ label: "contains (case-insensitive)", value: "icontains" },
|
|
10009
|
-
{ label: "starts with", value: "startswith" },
|
|
10010
|
-
{ label: "search", value: "search" },
|
|
10011
|
-
{ label: "greater than", value: "gt" },
|
|
10012
|
-
{ label: "greater than or equal", value: "gte" },
|
|
10013
|
-
{ label: "less than", value: "lt" },
|
|
10014
|
-
{ label: "less than or equal", value: "lte" },
|
|
10015
|
-
{ label: "in range", value: "range" },
|
|
10016
|
-
{ label: "in list", value: "in" },
|
|
10017
|
-
{ label: "is empty", value: "isnull" },
|
|
10018
|
-
{ label: "is within (date)", value: "is_within" }
|
|
10019
|
-
];
|
|
10020
|
-
function fieldKeyChoices(fields) {
|
|
10021
|
-
return fields.flatMap((field) => {
|
|
10022
|
-
const components = NESTED_COMPONENTS[field.type];
|
|
10023
|
-
if (components && components.size > 1) {
|
|
10024
|
-
return [...components].map((component) => ({
|
|
10025
|
-
label: `${field.name}__${component} (${field.id}, ${field.type})`,
|
|
10026
|
-
value: `${field.name}__${component}`
|
|
10027
|
-
}));
|
|
10028
|
-
}
|
|
10029
|
-
return {
|
|
10030
|
-
label: `${field.name} (${field.id}${components ? `, ${field.type}` : ""})`,
|
|
10031
|
-
value: components ? `${field.name}__${[...components][0]}` : field.name
|
|
10032
|
-
};
|
|
10033
|
-
});
|
|
10034
|
-
}
|
|
10035
|
-
var singleFilterResolver = defineResolver({
|
|
10036
|
-
type: "object",
|
|
10037
|
-
imports: [listTableFieldsRef3],
|
|
10038
|
-
requireParameters: ["table"],
|
|
10039
|
-
getProperties: async ({ imports, input }) => {
|
|
10040
|
-
const { data: fields } = await imports.listTableFields({
|
|
10041
|
-
table: input.table
|
|
10042
|
-
});
|
|
10043
|
-
const choices = fieldKeyChoices(fields);
|
|
10044
|
-
const props = {
|
|
10045
|
-
fieldKey: {
|
|
10046
|
-
label: "Field",
|
|
10047
|
-
required: true,
|
|
10048
|
-
resolver: {
|
|
10049
|
-
type: "dynamic",
|
|
10050
|
-
listItems: () => ({ data: choices }),
|
|
10051
|
-
prompt: () => ({
|
|
10052
|
-
type: "list",
|
|
10053
|
-
message: "Select field:",
|
|
10054
|
-
choices
|
|
10055
|
-
})
|
|
10056
|
-
}
|
|
10057
|
-
},
|
|
10058
|
-
operator: {
|
|
10059
|
-
label: "Operator",
|
|
10060
|
-
required: true,
|
|
10061
|
-
resolver: {
|
|
10062
|
-
type: "dynamic",
|
|
10063
|
-
listItems: () => ({ data: FILTER_OPERATORS }),
|
|
10064
|
-
prompt: () => ({
|
|
10065
|
-
type: "list",
|
|
10066
|
-
message: "Select operator:",
|
|
10067
|
-
choices: FILTER_OPERATORS
|
|
10068
|
-
})
|
|
10069
|
-
}
|
|
10070
|
-
},
|
|
10071
|
-
value: {
|
|
10072
|
-
label: "Value",
|
|
10073
|
-
required: false,
|
|
10074
|
-
resolver: { type: "static", inputType: "text" }
|
|
10075
|
-
}
|
|
10076
|
-
};
|
|
10077
|
-
return props;
|
|
10078
|
-
}
|
|
10070
|
+
var NeedChoicesResponseMetaSchema = z.object({
|
|
10071
|
+
page: z.string().nullable().optional()
|
|
10072
|
+
});
|
|
10073
|
+
var NeedChoicesResponseLinksSchema = z.object({
|
|
10074
|
+
next: z.string().nullable().optional(),
|
|
10075
|
+
prev: z.string().nullable().optional()
|
|
10076
|
+
});
|
|
10077
|
+
z.object({
|
|
10078
|
+
selected_api: z.string().optional().describe(
|
|
10079
|
+
"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."
|
|
10080
|
+
),
|
|
10081
|
+
authentication_id: z.union([z.string(), z.number()]).optional().describe(
|
|
10082
|
+
"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)."
|
|
10083
|
+
),
|
|
10084
|
+
params: z.record(z.string(), z.unknown()).optional().describe(
|
|
10085
|
+
"Object that matches the input the node would normally get. Has all the same keys/types as the `needs` of the action."
|
|
10086
|
+
),
|
|
10087
|
+
page: z.number().optional().default(0),
|
|
10088
|
+
prefill: z.string().optional().describe(
|
|
10089
|
+
"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."
|
|
10090
|
+
),
|
|
10091
|
+
action_id: z.string().optional().describe(
|
|
10092
|
+
"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."
|
|
10093
|
+
),
|
|
10094
|
+
input_field_id: z.string().optional().describe(
|
|
10095
|
+
"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."
|
|
10096
|
+
)
|
|
10079
10097
|
});
|
|
10080
|
-
|
|
10081
|
-
|
|
10082
|
-
|
|
10083
|
-
|
|
10084
|
-
|
|
10098
|
+
z.object({
|
|
10099
|
+
success: z.boolean(),
|
|
10100
|
+
choices: z.array(NeedChoicesSchema).optional(),
|
|
10101
|
+
next_page: z.number().optional(),
|
|
10102
|
+
errors: z.array(z.string()).optional(),
|
|
10103
|
+
meta: NeedChoicesResponseMetaSchema.optional(),
|
|
10104
|
+
links: NeedChoicesResponseLinksSchema.optional()
|
|
10085
10105
|
});
|
|
10086
10106
|
|
|
10087
|
-
// src/
|
|
10088
|
-
var
|
|
10089
|
-
|
|
10090
|
-
|
|
10091
|
-
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
|
|
10095
|
-
|
|
10096
|
-
|
|
10097
|
-
|
|
10098
|
-
|
|
10099
|
-
|
|
10100
|
-
|
|
10101
|
-
|
|
10102
|
-
|
|
10103
|
-
|
|
10104
|
-
|
|
10105
|
-
|
|
10106
|
-
|
|
10107
|
-
|
|
10108
|
-
|
|
10109
|
-
|
|
10110
|
-
|
|
10111
|
-
|
|
10112
|
-
});
|
|
10113
|
-
const choices = fieldKeyChoices2(fields);
|
|
10114
|
-
const props = {
|
|
10115
|
-
fieldKey: {
|
|
10116
|
-
label: "Field",
|
|
10117
|
-
required: true,
|
|
10118
|
-
resolver: {
|
|
10119
|
-
type: "dynamic",
|
|
10120
|
-
listItems: () => ({ data: choices }),
|
|
10121
|
-
prompt: () => ({
|
|
10122
|
-
type: "list",
|
|
10123
|
-
message: "Select field:",
|
|
10124
|
-
choices
|
|
10125
|
-
})
|
|
10126
|
-
}
|
|
10127
|
-
},
|
|
10128
|
-
direction: {
|
|
10129
|
-
label: "Direction",
|
|
10130
|
-
required: true,
|
|
10131
|
-
resolver: {
|
|
10132
|
-
type: "dynamic",
|
|
10133
|
-
listItems: () => ({ data: DIRECTION_CHOICES }),
|
|
10134
|
-
prompt: () => ({
|
|
10135
|
-
type: "list",
|
|
10136
|
-
message: "Select direction:",
|
|
10137
|
-
choices: DIRECTION_CHOICES
|
|
10138
|
-
})
|
|
10139
|
-
}
|
|
10140
|
-
}
|
|
10141
|
-
};
|
|
10142
|
-
return props;
|
|
10107
|
+
// src/schemas/Action.ts
|
|
10108
|
+
var ActionItemSchema = ActionSchema.omit({
|
|
10109
|
+
type: true,
|
|
10110
|
+
name: true,
|
|
10111
|
+
selected_api: true
|
|
10112
|
+
}).extend({
|
|
10113
|
+
app_key: z.string(),
|
|
10114
|
+
// App key without version (extracted from selected_api)
|
|
10115
|
+
app_version: z.string().optional(),
|
|
10116
|
+
// Version extracted from selected_api
|
|
10117
|
+
action_type: ActionSchema.shape.type,
|
|
10118
|
+
// Mapped from original 'type' field
|
|
10119
|
+
title: z.string(),
|
|
10120
|
+
// Mapped from original 'name' field
|
|
10121
|
+
type: z.literal("action")
|
|
10122
|
+
// Fixed type identifier
|
|
10123
|
+
});
|
|
10124
|
+
|
|
10125
|
+
// src/formatters/action.ts
|
|
10126
|
+
function formatActionItem(item) {
|
|
10127
|
+
const details = [{ text: `Type: ${item.action_type}`, style: "accent" }];
|
|
10128
|
+
if (item.app_key) {
|
|
10129
|
+
details.push({ text: `App: ${item.app_key}`, style: "normal" });
|
|
10130
|
+
}
|
|
10131
|
+
if (item.description) {
|
|
10132
|
+
details.push({ text: item.description, style: "dim" });
|
|
10143
10133
|
}
|
|
10134
|
+
return {
|
|
10135
|
+
title: item.title || item.key,
|
|
10136
|
+
// `hint` is the dumb secondary string shown after the title (the action key
|
|
10137
|
+
// and, when present, its id). Replaces the deprecated `key`/`id` fields.
|
|
10138
|
+
hint: [item.key, item.id].filter((v) => Boolean(v)),
|
|
10139
|
+
description: item.description,
|
|
10140
|
+
details
|
|
10141
|
+
};
|
|
10142
|
+
}
|
|
10143
|
+
var actionItemFormatter = defineFormatter({
|
|
10144
|
+
format: ({ item }) => formatActionItem(item)
|
|
10144
10145
|
});
|
|
10145
10146
|
|
|
10146
10147
|
// src/plugins/listActions/index.ts
|
|
@@ -10239,65 +10240,37 @@ var getActionPlugin = defineMethod({
|
|
|
10239
10240
|
);
|
|
10240
10241
|
}
|
|
10241
10242
|
});
|
|
10242
|
-
|
|
10243
|
-
|
|
10244
|
-
|
|
10245
|
-
|
|
10246
|
-
|
|
10247
|
-
|
|
10248
|
-
|
|
10249
|
-
|
|
10250
|
-
|
|
10251
|
-
|
|
10252
|
-
|
|
10253
|
-
|
|
10254
|
-
|
|
10255
|
-
|
|
10256
|
-
|
|
10257
|
-
|
|
10258
|
-
|
|
10259
|
-
|
|
10260
|
-
|
|
10261
|
-
|
|
10262
|
-
|
|
10263
|
-
|
|
10264
|
-
|
|
10265
|
-
|
|
10266
|
-
|
|
10267
|
-
|
|
10268
|
-
|
|
10269
|
-
"/zapier/api/actions/v1/runs",
|
|
10270
|
-
runRequest,
|
|
10271
|
-
{
|
|
10272
|
-
approvalContext: () => buildActionRunContext({
|
|
10273
|
-
selected_api: selectedApi,
|
|
10274
|
-
action_type: actionType,
|
|
10275
|
-
action_key: actionKey,
|
|
10276
|
-
connection_id: connectionId != null ? String(connectionId) : void 0,
|
|
10277
|
-
// Cast: inputs is Record<string, unknown> at the SDK surface;
|
|
10278
|
-
// buildActionRunContext validates it as JSON at runtime via zod
|
|
10279
|
-
// (non-JSON values like Date/undefined are rejected there).
|
|
10280
|
-
inputs: executionOptions.inputs ?? {}
|
|
10281
|
-
})
|
|
10282
|
-
}
|
|
10283
|
-
);
|
|
10284
|
-
const runId = runData.data.id;
|
|
10285
|
-
return await api.poll(`/zapier/api/actions/v1/runs/${runId}`, {
|
|
10286
|
-
successStatus: 200,
|
|
10287
|
-
pendingStatus: 202,
|
|
10288
|
-
timeoutMilliseconds: timeoutMilliseconds ?? DEFAULT_ACTION_TIMEOUT_MILLISECONDS,
|
|
10289
|
-
resource: { type: "run", id: runId },
|
|
10290
|
-
isPending: (result) => {
|
|
10291
|
-
const data = result?.data;
|
|
10292
|
-
return data?.status === "waiting";
|
|
10293
|
-
},
|
|
10294
|
-
resultExtractor: (result) => result.data
|
|
10295
|
-
});
|
|
10296
|
-
}
|
|
10243
|
+
var CreateActionRunSchema = z.object({
|
|
10244
|
+
app: AppPropertySchema,
|
|
10245
|
+
actionType: ActionTypePropertySchema,
|
|
10246
|
+
action: ActionPropertySchema,
|
|
10247
|
+
connection: ConnectionPropertySchema.optional().describe(
|
|
10248
|
+
"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."
|
|
10249
|
+
),
|
|
10250
|
+
inputs: InputsPropertySchema.optional().describe(
|
|
10251
|
+
"Input parameters for the action"
|
|
10252
|
+
),
|
|
10253
|
+
page: z.string().optional().describe(
|
|
10254
|
+
"Page to fetch for bulk read actions. Pass the `next_page` a previous run returned to fetch the following page."
|
|
10255
|
+
),
|
|
10256
|
+
callbackUrl: z.string().url().optional().describe(
|
|
10257
|
+
"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."
|
|
10258
|
+
).meta({ valueHint: "url" })
|
|
10259
|
+
}).describe(
|
|
10260
|
+
"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."
|
|
10261
|
+
);
|
|
10262
|
+
var ActionRunStartedItemSchema = z.object({
|
|
10263
|
+
id: z.string().describe(
|
|
10264
|
+
"Action run ID. Pass it as the `run` for `getActionRun` to fetch the run's result."
|
|
10265
|
+
),
|
|
10266
|
+
implementation_id: z.string().describe(
|
|
10267
|
+
"Versioned implementation ID the run was started against (e.g. 'SlackCLIAPI@1.21.1'). The versionless app key is the part before the `@`."
|
|
10268
|
+
)
|
|
10269
|
+
});
|
|
10297
10270
|
var CONTEXT_CACHE_TTL_MILLISECONDS = 6e4;
|
|
10298
10271
|
var CONTEXT_CACHE_MAX_SIZE = 500;
|
|
10299
|
-
var
|
|
10300
|
-
name: "
|
|
10272
|
+
var createActionRunPlugin = defineMethod({
|
|
10273
|
+
name: "createActionRun",
|
|
10301
10274
|
imports: [
|
|
10302
10275
|
connectionsPluginRef,
|
|
10303
10276
|
manifestPluginRef,
|
|
@@ -10305,14 +10278,11 @@ var runActionPlugin = defineMethod({
|
|
|
10305
10278
|
getActionPlugin
|
|
10306
10279
|
],
|
|
10307
10280
|
categories: ["action"],
|
|
10308
|
-
|
|
10309
|
-
|
|
10310
|
-
|
|
10311
|
-
|
|
10312
|
-
|
|
10313
|
-
// No defaultPageSize — leave the default to the Actions API rather than
|
|
10314
|
-
// eagerly running more actions than the user intends (avoids app rate limits).
|
|
10315
|
-
output: "list",
|
|
10281
|
+
type: "create",
|
|
10282
|
+
itemType: "StartedActionRun",
|
|
10283
|
+
inputSchema: CreateActionRunSchema,
|
|
10284
|
+
outputSchema: ActionRunStartedItemSchema,
|
|
10285
|
+
output: "item",
|
|
10316
10286
|
resolvers: {
|
|
10317
10287
|
app: appKeyResolver,
|
|
10318
10288
|
actionType: actionTypeResolver,
|
|
@@ -10320,14 +10290,12 @@ var runActionPlugin = defineMethod({
|
|
|
10320
10290
|
connection: connectionIdResolver,
|
|
10321
10291
|
inputs: inputsResolver
|
|
10322
10292
|
},
|
|
10323
|
-
// A per-SDK-instance TTL cache of resolved (selectedApi, actionId), built once
|
|
10324
|
-
// in setup so it persists across calls. The imports it resolves through
|
|
10325
|
-
// (`manifest.getVersionedImplementationId`, `getAction`) are threaded in per
|
|
10326
|
-
// call from `run`, not captured here.
|
|
10327
10293
|
setup: () => {
|
|
10328
10294
|
const cache = /* @__PURE__ */ new Map();
|
|
10329
10295
|
function evictIfNeeded() {
|
|
10330
|
-
if (cache.size < CONTEXT_CACHE_MAX_SIZE)
|
|
10296
|
+
if (cache.size < CONTEXT_CACHE_MAX_SIZE) {
|
|
10297
|
+
return;
|
|
10298
|
+
}
|
|
10331
10299
|
const now = Date.now();
|
|
10332
10300
|
let oldestKey;
|
|
10333
10301
|
let oldestExpiry = Infinity;
|
|
@@ -10341,13 +10309,15 @@ var runActionPlugin = defineMethod({
|
|
|
10341
10309
|
oldestKey = key;
|
|
10342
10310
|
}
|
|
10343
10311
|
}
|
|
10344
|
-
if (!evictedAny && oldestKey)
|
|
10312
|
+
if (!evictedAny && oldestKey) {
|
|
10313
|
+
cache.delete(oldestKey);
|
|
10314
|
+
}
|
|
10345
10315
|
}
|
|
10346
|
-
async function
|
|
10316
|
+
async function resolveActionRunContext(options) {
|
|
10347
10317
|
const { imports, appKey, actionKey, actionType } = options;
|
|
10348
10318
|
const getVersionedImplementationId = imports.manifest.getVersionedImplementationId;
|
|
10349
|
-
const
|
|
10350
|
-
if (!
|
|
10319
|
+
const implementationId = await getVersionedImplementationId(appKey);
|
|
10320
|
+
if (!implementationId) {
|
|
10351
10321
|
throw new ZapierConfigurationError(
|
|
10352
10322
|
"No current_implementation_id found for app",
|
|
10353
10323
|
{ configType: "current_implementation_id" }
|
|
@@ -10363,15 +10333,19 @@ var runActionPlugin = defineMethod({
|
|
|
10363
10333
|
`Action type mismatch: expected ${actionType}, got ${actionData.data.action_type}`
|
|
10364
10334
|
);
|
|
10365
10335
|
}
|
|
10366
|
-
return {
|
|
10336
|
+
return { implementationId, actionId: actionData.data.id };
|
|
10367
10337
|
}
|
|
10368
|
-
function
|
|
10338
|
+
function getActionRunContext(options) {
|
|
10369
10339
|
const contextKey = `${options.appKey}:${options.actionKey}:${options.actionType}`;
|
|
10370
10340
|
const cached = cache.get(contextKey);
|
|
10371
|
-
if (cached && Date.now() < cached.expiresAt)
|
|
10372
|
-
|
|
10341
|
+
if (cached && Date.now() < cached.expiresAt) {
|
|
10342
|
+
return cached.promise;
|
|
10343
|
+
}
|
|
10344
|
+
const pending = resolveActionRunContext(options).catch((error) => {
|
|
10373
10345
|
const current = cache.get(contextKey);
|
|
10374
|
-
if (current?.promise === pending)
|
|
10346
|
+
if (current?.promise === pending) {
|
|
10347
|
+
cache.delete(contextKey);
|
|
10348
|
+
}
|
|
10375
10349
|
throw error;
|
|
10376
10350
|
});
|
|
10377
10351
|
evictIfNeeded();
|
|
@@ -10381,11 +10355,105 @@ var runActionPlugin = defineMethod({
|
|
|
10381
10355
|
});
|
|
10382
10356
|
return pending;
|
|
10383
10357
|
}
|
|
10384
|
-
return {
|
|
10358
|
+
return { getActionRunContext };
|
|
10385
10359
|
},
|
|
10386
10360
|
run: async ({ imports, input, state, annotate }) => {
|
|
10387
10361
|
const api = imports.api;
|
|
10388
|
-
const
|
|
10362
|
+
const {
|
|
10363
|
+
app: appKey,
|
|
10364
|
+
action: actionKey,
|
|
10365
|
+
actionType,
|
|
10366
|
+
connection,
|
|
10367
|
+
inputs = {},
|
|
10368
|
+
page,
|
|
10369
|
+
callbackUrl
|
|
10370
|
+
} = input;
|
|
10371
|
+
const connectionId = await resolveConnectionId({
|
|
10372
|
+
connection,
|
|
10373
|
+
resolveConnection: imports.connections.resolveConnection
|
|
10374
|
+
});
|
|
10375
|
+
const { implementationId, actionId } = await state.getActionRunContext({
|
|
10376
|
+
imports,
|
|
10377
|
+
appKey,
|
|
10378
|
+
actionKey,
|
|
10379
|
+
actionType
|
|
10380
|
+
});
|
|
10381
|
+
annotate({ selectedApi: implementationId });
|
|
10382
|
+
const runRequestData = {
|
|
10383
|
+
selected_api: implementationId,
|
|
10384
|
+
// Some actions require the action ID, but it's not guaranteed available
|
|
10385
|
+
// at retrieval time (legacy), so pass everything through.
|
|
10386
|
+
action_id: actionId,
|
|
10387
|
+
action_key: actionKey,
|
|
10388
|
+
action_type: actionType,
|
|
10389
|
+
inputs
|
|
10390
|
+
};
|
|
10391
|
+
if (connectionId != null) {
|
|
10392
|
+
runRequestData.authentication_id = connectionId;
|
|
10393
|
+
}
|
|
10394
|
+
if (page) {
|
|
10395
|
+
runRequestData.page = page;
|
|
10396
|
+
}
|
|
10397
|
+
if (callbackUrl) {
|
|
10398
|
+
runRequestData.callback_url = callbackUrl;
|
|
10399
|
+
}
|
|
10400
|
+
const runData = await api.post(
|
|
10401
|
+
ACTION_RUNS_PATH,
|
|
10402
|
+
{ data: runRequestData },
|
|
10403
|
+
{
|
|
10404
|
+
approvalContext: () => buildActionRunContext({
|
|
10405
|
+
selected_api: implementationId,
|
|
10406
|
+
action_type: actionType,
|
|
10407
|
+
action_key: actionKey,
|
|
10408
|
+
connection_id: connectionId != null ? String(connectionId) : void 0,
|
|
10409
|
+
// `inputs` is `Record<string, unknown>` at the SDK surface;
|
|
10410
|
+
// buildActionRunContext validates it as JSON at runtime via zod
|
|
10411
|
+
// (non-JSON values like Date/undefined are rejected there).
|
|
10412
|
+
inputs
|
|
10413
|
+
})
|
|
10414
|
+
}
|
|
10415
|
+
);
|
|
10416
|
+
return {
|
|
10417
|
+
data: {
|
|
10418
|
+
id: runData.data.id,
|
|
10419
|
+
implementation_id: implementationId
|
|
10420
|
+
}
|
|
10421
|
+
};
|
|
10422
|
+
}
|
|
10423
|
+
});
|
|
10424
|
+
|
|
10425
|
+
// src/utils/action-run-wire.ts
|
|
10426
|
+
function actionRunPath(run) {
|
|
10427
|
+
return `${ACTION_RUNS_PATH}/${encodeURIComponent(run)}`;
|
|
10428
|
+
}
|
|
10429
|
+
function actionRunPayload(body) {
|
|
10430
|
+
return body?.data;
|
|
10431
|
+
}
|
|
10432
|
+
function isActionRunPending(body) {
|
|
10433
|
+
return actionRunPayload(body)?.status === "waiting";
|
|
10434
|
+
}
|
|
10435
|
+
|
|
10436
|
+
// src/plugins/runAction/index.ts
|
|
10437
|
+
var runActionPlugin = defineMethod({
|
|
10438
|
+
name: "runAction",
|
|
10439
|
+
imports: [apiPluginRef, connectionsPluginRef, createActionRunPlugin],
|
|
10440
|
+
categories: ["action"],
|
|
10441
|
+
itemType: "ActionResult",
|
|
10442
|
+
inputSchema: RunActionInputSchema,
|
|
10443
|
+
outputSchema: ActionResultItemSchema,
|
|
10444
|
+
skipOutputValidation: true,
|
|
10445
|
+
formatter: actionResultItemFormatter,
|
|
10446
|
+
// No defaultPageSize — leave the default to the Actions API rather than
|
|
10447
|
+
// eagerly running more actions than the user intends (avoids app rate limits).
|
|
10448
|
+
output: "list",
|
|
10449
|
+
resolvers: {
|
|
10450
|
+
app: appKeyResolver,
|
|
10451
|
+
actionType: actionTypeResolver,
|
|
10452
|
+
action: actionKeyResolver,
|
|
10453
|
+
connection: connectionIdResolver,
|
|
10454
|
+
inputs: inputsResolver
|
|
10455
|
+
},
|
|
10456
|
+
run: async ({ imports, input, annotate }) => {
|
|
10389
10457
|
const appKey = "app" in input ? input.app : input.appKey;
|
|
10390
10458
|
const actionKey = "action" in input ? input.action : input.actionKey;
|
|
10391
10459
|
const {
|
|
@@ -10396,39 +10464,40 @@ var runActionPlugin = defineMethod({
|
|
|
10396
10464
|
inputs = {},
|
|
10397
10465
|
cursor
|
|
10398
10466
|
} = input;
|
|
10399
|
-
const timeoutMilliseconds = input.timeoutSeconds != null ? input.timeoutSeconds * 1e3 : input.timeoutMs;
|
|
10467
|
+
const timeoutMilliseconds = (input.timeoutSeconds != null ? input.timeoutSeconds * 1e3 : input.timeoutMs) ?? DEFAULT_ACTION_TIMEOUT_MILLISECONDS;
|
|
10400
10468
|
const resolvedConnectionId = await resolveConnectionId({
|
|
10401
10469
|
connectionId,
|
|
10402
10470
|
connection,
|
|
10403
10471
|
authenticationId,
|
|
10404
|
-
resolveConnection
|
|
10405
|
-
});
|
|
10406
|
-
const { selectedApi, actionId } = await state.getRunActionContext({
|
|
10407
|
-
imports,
|
|
10408
|
-
appKey,
|
|
10409
|
-
actionKey,
|
|
10410
|
-
actionType
|
|
10472
|
+
resolveConnection: imports.connections.resolveConnection
|
|
10411
10473
|
});
|
|
10412
|
-
|
|
10413
|
-
|
|
10414
|
-
api,
|
|
10415
|
-
selectedApi,
|
|
10416
|
-
// Some actions require the action ID, but it's not guaranteed available at
|
|
10417
|
-
// retrieval time (legacy), so pass everything through.
|
|
10418
|
-
actionId,
|
|
10419
|
-
actionKey,
|
|
10474
|
+
const { data: started } = await imports.createActionRun({
|
|
10475
|
+
app: appKey,
|
|
10420
10476
|
actionType,
|
|
10421
|
-
|
|
10422
|
-
|
|
10423
|
-
|
|
10424
|
-
|
|
10477
|
+
action: actionKey,
|
|
10478
|
+
connection: resolvedConnectionId,
|
|
10479
|
+
inputs,
|
|
10480
|
+
page: cursor
|
|
10425
10481
|
});
|
|
10426
|
-
|
|
10427
|
-
|
|
10482
|
+
annotate({ selectedApi: started.implementation_id });
|
|
10483
|
+
const run = await imports.api.poll(
|
|
10484
|
+
actionRunPath(started.id),
|
|
10485
|
+
{
|
|
10486
|
+
resource: { type: "run", id: started.id },
|
|
10487
|
+
successStatus: 200,
|
|
10488
|
+
pendingStatus: 202,
|
|
10489
|
+
timeoutMilliseconds,
|
|
10490
|
+
isPending: isActionRunPending,
|
|
10491
|
+
resultExtractor: (body) => actionRunPayload(body) ?? {}
|
|
10492
|
+
}
|
|
10493
|
+
);
|
|
10494
|
+
const errors = run.errors ?? [];
|
|
10495
|
+
if (errors.length > 0) {
|
|
10496
|
+
const errorMessage2 = errors.map((error) => error.detail || error.title || "Unknown error").join("; ");
|
|
10428
10497
|
throw new ZapierActionError(`Action execution failed: ${errorMessage2}`, {
|
|
10429
10498
|
appKey,
|
|
10430
10499
|
actionKey,
|
|
10431
|
-
errors:
|
|
10500
|
+
errors: errors.map(
|
|
10432
10501
|
(error) => ({
|
|
10433
10502
|
status: 200,
|
|
10434
10503
|
code: error.code ?? "unknown",
|
|
@@ -10439,10 +10508,10 @@ var runActionPlugin = defineMethod({
|
|
|
10439
10508
|
});
|
|
10440
10509
|
}
|
|
10441
10510
|
return {
|
|
10442
|
-
data:
|
|
10511
|
+
data: run.results ?? [],
|
|
10443
10512
|
// Coerce to a string: the API returns a numeric page index, but
|
|
10444
10513
|
// `SdkPage.nextCursor` is a string (and the page guard enforces it).
|
|
10445
|
-
nextCursor:
|
|
10514
|
+
nextCursor: run.next_page != null ? String(run.next_page) : void 0
|
|
10446
10515
|
};
|
|
10447
10516
|
}
|
|
10448
10517
|
});
|
|
@@ -11873,6 +11942,65 @@ var findUniqueConnectionPlugin = defineMethod({
|
|
|
11873
11942
|
return { data: connectionsResponse.data[0] };
|
|
11874
11943
|
}
|
|
11875
11944
|
});
|
|
11945
|
+
var GetActionRunSchema = z.object({
|
|
11946
|
+
run: z.string().min(1).describe("Action run ID returned by `createActionRun`")
|
|
11947
|
+
}).describe(
|
|
11948
|
+
"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."
|
|
11949
|
+
);
|
|
11950
|
+
var ActionRunStatusSchema = openEnum(
|
|
11951
|
+
["waiting", "success", "error", "unknown"],
|
|
11952
|
+
"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."
|
|
11953
|
+
);
|
|
11954
|
+
var ActionRunErrorSchema = z.object({
|
|
11955
|
+
code: z.string().optional().describe("Machine-readable error category"),
|
|
11956
|
+
title: z.string().nullable().optional().describe("Short error label"),
|
|
11957
|
+
detail: z.string().optional().describe("Human-readable error detail")
|
|
11958
|
+
});
|
|
11959
|
+
var ActionRunItemSchema = z.object({
|
|
11960
|
+
id: z.string().describe("Action run ID"),
|
|
11961
|
+
status: ActionRunStatusSchema,
|
|
11962
|
+
results: z.array(z.unknown()).describe(
|
|
11963
|
+
"Records the action produced. Can be empty even on a successful run."
|
|
11964
|
+
),
|
|
11965
|
+
next_page: z.string().optional().describe(
|
|
11966
|
+
"For bulk read actions, the following page. Pass it back as the `page` for `createActionRun` to fetch that page."
|
|
11967
|
+
),
|
|
11968
|
+
errors: z.array(ActionRunErrorSchema).describe("Errors the app returned while running the action")
|
|
11969
|
+
});
|
|
11970
|
+
|
|
11971
|
+
// src/plugins/getActionRun/index.ts
|
|
11972
|
+
function toActionRun(runId, payload) {
|
|
11973
|
+
if (!payload) {
|
|
11974
|
+
return { id: runId, status: "waiting", results: [], errors: [] };
|
|
11975
|
+
}
|
|
11976
|
+
return {
|
|
11977
|
+
id: payload.id ?? runId,
|
|
11978
|
+
// Never infer success from an absent status.
|
|
11979
|
+
status: payload.status ?? "unknown",
|
|
11980
|
+
results: payload.results ?? [],
|
|
11981
|
+
// The API answers with either a page token or a numeric page index, but
|
|
11982
|
+
// `createActionRun` takes `page` as a string, so normalize to one type the
|
|
11983
|
+
// caller can hand straight back.
|
|
11984
|
+
...payload.next_page != null ? { next_page: String(payload.next_page) } : {},
|
|
11985
|
+
errors: payload.errors ?? []
|
|
11986
|
+
};
|
|
11987
|
+
}
|
|
11988
|
+
var getActionRunPlugin = defineMethod({
|
|
11989
|
+
name: "getActionRun",
|
|
11990
|
+
imports: [apiPluginRef],
|
|
11991
|
+
categories: ["action"],
|
|
11992
|
+
itemType: "ActionRun",
|
|
11993
|
+
inputSchema: GetActionRunSchema,
|
|
11994
|
+
outputSchema: ActionRunItemSchema,
|
|
11995
|
+
output: "item",
|
|
11996
|
+
run: async ({ imports, input }) => {
|
|
11997
|
+
const body = await imports.api.get(
|
|
11998
|
+
actionRunPath(input.run),
|
|
11999
|
+
{ resource: { type: "run", id: input.run } }
|
|
12000
|
+
);
|
|
12001
|
+
return { data: toActionRun(input.run, actionRunPayload(body)) };
|
|
12002
|
+
}
|
|
12003
|
+
});
|
|
11876
12004
|
var RelayRequestSchema = z.object({
|
|
11877
12005
|
url: z.string().url().describe("The URL to request (will be proxied through Relay)"),
|
|
11878
12006
|
method: z.enum(["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]).optional().describe("HTTP method"),
|
|
@@ -15699,6 +15827,8 @@ var zapierSdkPlugin = definePlugin({
|
|
|
15699
15827
|
listInputFieldsDeprecatedPlugin,
|
|
15700
15828
|
getInputFieldsSchemaDeprecatedPlugin,
|
|
15701
15829
|
listInputFieldChoicesDeprecatedPlugin,
|
|
15830
|
+
createActionRunPlugin,
|
|
15831
|
+
getActionRunPlugin,
|
|
15702
15832
|
runActionPlugin,
|
|
15703
15833
|
fetchPlugin,
|
|
15704
15834
|
requestPlugin,
|
|
@@ -15913,4 +16043,4 @@ var registryPlugin = (_sdk) => {
|
|
|
15913
16043
|
return {};
|
|
15914
16044
|
};
|
|
15915
16045
|
|
|
15916
|
-
export { API_ID, ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMillisecondsPropertySchema, ActionTimeoutSecondsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthMechanism, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONNECTIONS_ID, CONTEXT, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MILLISECONDS, CORE_ERROR_SYMBOL, CORE_OPTIONS_ID, CORE_SIGNAL_SYMBOL, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CoreCancelledSignal, CoreDisposeError, CoreErrorCode, CoreSignal, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MILLISECONDS, DEFAULT_APPROVAL_TIMEOUT_MILLISECONDS, DEFAULT_CONFIG_PATH, DEFAULT_MAX_APPROVAL_RETRIES, DEFAULT_PAGE_SIZE, DEPRECATION_NOTICE_EVENT, DebugPropertySchema, DrainTriggerInboxSchema, EVENT_EMISSION_ID, FieldsPropertySchema, InputFieldPropertySchema, InputsPropertySchema, LeaseLimitPropertySchema, LeasePropertySchema, LeaseSecondsPropertySchema, LimitPropertySchema, MANIFEST_ID, MAX_CONCURRENCY_LIMIT, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RESOLVE_CREDENTIALS_ID, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, SDK_OPTIONS_ID, TablePropertySchema, TablesPropertySchema, TriggerInboxKeyPropertySchema, TriggerInboxNamePropertySchema, TriggerInboxPropertySchema, WatchTriggerInboxSchema, ZAPIER_BASE_URL, ZAPIER_MAX_CONCURRENT_REQUESTS, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MILLISECONDS, ZapierAbortDrainSignal, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierApprovalError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierConflictError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierReleaseTriggerMessageSignal, ZapierResourceNotFoundError, ZapierSignal, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, addPlugin, apiPlugin, apiPluginRef, appKeyResolver, appsPlugin, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, cleanupEventListeners, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, composePlugins, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, connectionsPluginRef, createBaseEvent, createClientCredentialsPlugin, createController, createCorePlugin, createFunction, createMemoryCache, createPaginatedFunction, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierApi, createZapierSdk, createZapierSdkWithoutRegistry, declareMethod, declareOptionalProperty, declarePlugin, declareProperty, defineFormatter, defineLegacyMerge, defineMethod, defineMethodOverride, definePlugin, defineProperty, defineResolver, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, disposeSdk, durableRunIdResolver, eventEmissionHookPlugin, eventEmissionPlugin, eventEmissionPluginRef, extractErrorDetail, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, fromFunctionPlugin, generateEventId, getActionInputFieldsSchemaPlugin, getActionPlugin, getAgent, getAppPlugin, getBaseUrlFromCredentials, getCallerContext, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getContext, getCoreErrorCause, getCoreErrorCode, getCpuTime, getCurrentTimestamp, getMemoryUsage, getNegatable, getOrCreateApiClient, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getRegistryPlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getTtyContext, getZapierApprovalMode, getZapierDefaultApprovalMode, getZapierOpenAutoModeApprovalsInBrowser, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCoreCancelledSignal, isCoreError, isCoreSignal, isCredentialsFunction, isCredentialsObject, isPermanentHttpError, isPkceCredentials, isPositional, isZapierAbortDrainSignal, isZapierActionError, isZapierAppNotFoundError, isZapierApprovalError, isZapierAuthenticationError, isZapierBundleError, isZapierConflictError, isZapierError, isZapierNotFoundError, isZapierRateLimitError, isZapierReleaseTriggerMessageSignal, isZapierResourceNotFoundError, isZapierSignal, isZapierTimeoutError, isZapierValidationError, listActionInputFieldChoicesPlugin, listActionInputFieldsPlugin, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation2 as logDeprecation, manifestPlugin, manifestPluginRef, omitExports, openEnum, operationAnnotatorPlugin, parseConcurrencyEnvVar, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings2 as resetDeprecationWarnings, resolveAuth, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, resolveCredentialsPlugin, resolveCredentialsPluginRef, resolvePlugin, runActionPlugin, runInMethodScope, runWithCallerContext, runWithTelemetryContext, sdkOptionsPluginRef, selectExports, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, triggerInboxResolver, triggerMessagesResolver, updateTableRecordsPlugin, workflowDraftIdResolver, workflowIdResolver, workflowRunIdResolver, workflowVersionIdResolver, zapierAdaptError, zapierCoreOptions, zapierSdkPlugin };
|
|
16046
|
+
export { ACTION_RUNS_PATH, API_ID, ActionKeyPropertySchema, ActionPropertySchema, ActionTimeoutMillisecondsPropertySchema, ActionTimeoutSecondsPropertySchema, ActionTypePropertySchema, AppKeyPropertySchema, AppPropertySchema, AppsPropertySchema, AuthMechanism, AuthenticationIdPropertySchema, BaseSdkOptionsSchema, CONNECTIONS_ID, CONTEXT, CONTEXT_CACHE_MAX_SIZE, CONTEXT_CACHE_TTL_MILLISECONDS, CORE_ERROR_SYMBOL, CORE_OPTIONS_ID, CORE_SIGNAL_SYMBOL, ClientCredentialsObjectSchema, ConnectionEntrySchema, ConnectionIdPropertySchema, ConnectionPropertySchema, ConnectionsMapSchema, ConnectionsPropertySchema, CoreCancelledSignal, CoreDisposeError, CoreErrorCode, CoreSignal, CredentialsFunctionSchema, CredentialsObjectSchema, CredentialsSchema, DEFAULT_ACTION_TIMEOUT_MILLISECONDS, DEFAULT_APPROVAL_TIMEOUT_MILLISECONDS, DEFAULT_CONFIG_PATH, DEFAULT_MAX_APPROVAL_RETRIES, DEFAULT_PAGE_SIZE, DEPRECATION_NOTICE_EVENT, DebugPropertySchema, DrainTriggerInboxSchema, EVENT_EMISSION_ID, FieldsPropertySchema, InputFieldPropertySchema, InputsPropertySchema, LeaseLimitPropertySchema, LeasePropertySchema, LeaseSecondsPropertySchema, LimitPropertySchema, MANIFEST_ID, MAX_CONCURRENCY_LIMIT, MAX_PAGE_LIMIT, OffsetPropertySchema, OutputPropertySchema, ParamsPropertySchema, PkceCredentialsObjectSchema, RESOLVE_CREDENTIALS_ID, RecordPropertySchema, RecordsPropertySchema, RelayFetchSchema, RelayRequestSchema, ResolvedCredentialsSchema, SDK_OPTIONS_ID, TablePropertySchema, TablesPropertySchema, TriggerInboxKeyPropertySchema, TriggerInboxNamePropertySchema, TriggerInboxPropertySchema, WatchTriggerInboxSchema, ZAPIER_BASE_URL, ZAPIER_MAX_CONCURRENT_REQUESTS, ZAPIER_MAX_NETWORK_RETRIES, ZAPIER_MAX_NETWORK_RETRY_DELAY_MILLISECONDS, ZapierAbortDrainSignal, ZapierActionError, ZapierApiError, ZapierAppNotFoundError, ZapierApprovalError, ZapierAuthenticationError, ZapierBundleError, ZapierConfigurationError, ZapierConflictError, ZapierError, ZapierNotFoundError, ZapierRateLimitError, ZapierRelayError, ZapierReleaseTriggerMessageSignal, ZapierResourceNotFoundError, ZapierSignal, ZapierTimeoutError, ZapierUnknownError, ZapierValidationError, actionKeyResolver, actionTypeResolver, addPlugin, apiPlugin, apiPluginRef, appKeyResolver, appsPlugin, batch, buildApplicationLifecycleEvent, buildCapabilityMessage, buildErrorEvent, buildErrorEventWithContext, buildMethodCalledEvent, cleanupEventListeners, clearTokenCache, clientCredentialsNameResolver, clientIdResolver, composePlugins, connectionIdGenericResolver, connectionIdResolver, connectionsPlugin, connectionsPluginRef, createActionRunPlugin, createBaseEvent, createClientCredentialsPlugin, createController, createCorePlugin, createFunction, createMemoryCache, createPaginatedFunction, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createSdk, createTableFieldsPlugin, createTablePlugin, createTableRecordsPlugin, createZapierApi, createZapierSdk, createZapierSdkWithoutRegistry, declareMethod, declareOptionalProperty, declarePlugin, declareProperty, defineFormatter, defineLegacyMerge, defineMethod, defineMethodOverride, definePlugin, defineProperty, defineResolver, deleteClientCredentialsPlugin, deleteTableFieldsPlugin, deleteTablePlugin, deleteTableRecordsPlugin, disposeSdk, durableRunIdResolver, eventEmissionHookPlugin, eventEmissionPlugin, eventEmissionPluginRef, extractErrorDetail, fetchPlugin, findFirstConnectionPlugin, findManifestEntry, findUniqueConnectionPlugin, formatErrorMessage, fromFunctionPlugin, generateEventId, getActionInputFieldsSchemaPlugin, getActionPlugin, getActionRunPlugin, getAgent, getAppPlugin, getBaseUrlFromCredentials, getCallerContext, getCiPlatform, getClientIdFromCredentials, getConnectionPlugin, getContext, getCoreErrorCause, getCoreErrorCode, getCpuTime, getCurrentTimestamp, getMemoryUsage, getNegatable, getOrCreateApiClient, getOsInfo, getPlatformVersions, getPreferredManifestEntryKey, getProfilePlugin, getRegistryPlugin, getReleaseId, getTablePlugin, getTableRecordPlugin, getTokenFromCliLogin, getTtyContext, getZapierApprovalMode, getZapierDefaultApprovalMode, getZapierOpenAutoModeApprovalsInBrowser, getZapierSdkService, injectCliLogin, inputFieldKeyResolver, inputsAllOptionalResolver, inputsResolver, invalidateCachedToken, invalidateCredentialsToken, isCi, isCliLoginAvailable, isClientCredentials, isCoreCancelledSignal, isCoreError, isCoreSignal, isCredentialsFunction, isCredentialsObject, isPermanentHttpError, isPkceCredentials, isPositional, isZapierAbortDrainSignal, isZapierActionError, isZapierAppNotFoundError, isZapierApprovalError, isZapierAuthenticationError, isZapierBundleError, isZapierConflictError, isZapierError, isZapierNotFoundError, isZapierRateLimitError, isZapierReleaseTriggerMessageSignal, isZapierResourceNotFoundError, isZapierSignal, isZapierTimeoutError, isZapierValidationError, listActionInputFieldChoicesPlugin, listActionInputFieldsPlugin, listActionsPlugin, listAppsPlugin, listClientCredentialsPlugin, listConnectionsPlugin, listTableFieldsPlugin, listTableRecordsPlugin, listTablesPlugin, logDeprecation2 as logDeprecation, manifestPlugin, manifestPluginRef, omitExports, openEnum, operationAnnotatorPlugin, parseConcurrencyEnvVar, readManifestFromFile, registryPlugin, requestPlugin, resetDeprecationWarnings2 as resetDeprecationWarnings, resolveAuth, resolveAuthToken, resolveCredentials, resolveCredentialsFromEnv, resolveCredentialsPlugin, resolveCredentialsPluginRef, resolvePlugin, runActionPlugin, runInMethodScope, runWithCallerContext, runWithTelemetryContext, sdkOptionsPluginRef, selectExports, tableFieldIdsResolver, tableFieldsResolver, tableFiltersResolver, tableIdResolver, tableNameResolver, tableRecordIdResolver, tableRecordIdsResolver, tableRecordsResolver, tableSortResolver, tableUpdateRecordsResolver, toSnakeCase, toTitleCase, triggerInboxResolver, triggerMessagesResolver, updateTableRecordsPlugin, workflowDraftIdResolver, workflowIdResolver, workflowRunIdResolver, workflowVersionIdResolver, zapierAdaptError, zapierCoreOptions, zapierSdkPlugin };
|