@zapier/zapier-sdk 0.83.3 → 0.84.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +4 -4
- package/dist/experimental.cjs +140 -107
- package/dist/experimental.d.mts +2 -2
- package/dist/experimental.d.ts +2 -2
- package/dist/experimental.mjs +140 -107
- package/dist/{index--H-bce1q.d.mts → index-BTKFTcSZ.d.mts} +20 -5
- package/dist/{index--H-bce1q.d.ts → index-BTKFTcSZ.d.ts} +20 -5
- package/dist/index.cjs +95 -68
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +95 -68
- package/package.json +2 -2
package/dist/experimental.cjs
CHANGED
|
@@ -2097,9 +2097,7 @@ function buildMethodEntries(descriptors, context, states) {
|
|
|
2097
2097
|
}
|
|
2098
2098
|
);
|
|
2099
2099
|
} else if (out.type === "item") {
|
|
2100
|
-
const itemCore = async (input) => (
|
|
2101
|
-
data: await callRun(input)
|
|
2102
|
-
});
|
|
2100
|
+
const itemCore = async (input) => callRun(input);
|
|
2103
2101
|
entry.value = createFunction(
|
|
2104
2102
|
fold(itemCore),
|
|
2105
2103
|
{
|
|
@@ -5198,7 +5196,7 @@ function parseDeprecationDate(value) {
|
|
|
5198
5196
|
}
|
|
5199
5197
|
|
|
5200
5198
|
// src/sdk-version.ts
|
|
5201
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.
|
|
5199
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.84.1" : void 0) || "unknown";
|
|
5202
5200
|
|
|
5203
5201
|
// src/utils/open-url.ts
|
|
5204
5202
|
var nodePrefix = "node:";
|
|
@@ -5416,6 +5414,18 @@ var pathConfig = {
|
|
|
5416
5414
|
"/durableworkflowzaps": {
|
|
5417
5415
|
authHeader: "Authorization",
|
|
5418
5416
|
pathPrefix: "/api/v0/sdk/durableworkflowzaps"
|
|
5417
|
+
},
|
|
5418
|
+
// e.g. /code-substrate-runner -> https://sdkapi.zapier.com/api/v0/sdk/code-substrate-runner/...
|
|
5419
|
+
// sdkapi proxies to the code-substrate-runner backend.
|
|
5420
|
+
"/code-substrate-runner": {
|
|
5421
|
+
authHeader: "Authorization",
|
|
5422
|
+
pathPrefix: "/api/v0/sdk/code-substrate-runner"
|
|
5423
|
+
},
|
|
5424
|
+
// e.g. /code-substrate-workflows -> https://sdkapi.zapier.com/api/v0/sdk/code-substrate-workflows/...
|
|
5425
|
+
// sdkapi proxies to the code-substrate-workflows backend.
|
|
5426
|
+
"/code-substrate-workflows": {
|
|
5427
|
+
authHeader: "Authorization",
|
|
5428
|
+
pathPrefix: "/api/v0/sdk/code-substrate-workflows"
|
|
5419
5429
|
}
|
|
5420
5430
|
};
|
|
5421
5431
|
var ZapierApiClient = class {
|
|
@@ -6610,13 +6620,15 @@ var getProfilePlugin = defineMethod({
|
|
|
6610
6620
|
authRequired: true
|
|
6611
6621
|
});
|
|
6612
6622
|
return {
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6623
|
+
data: {
|
|
6624
|
+
id: String(profile.public_id ?? profile.id),
|
|
6625
|
+
first_name: profile.first_name,
|
|
6626
|
+
last_name: profile.last_name,
|
|
6627
|
+
full_name: `${profile.first_name} ${profile.last_name}`,
|
|
6628
|
+
email: profile.email,
|
|
6629
|
+
email_confirmed: profile.email_confirmed,
|
|
6630
|
+
timezone: profile.timezone
|
|
6631
|
+
}
|
|
6620
6632
|
};
|
|
6621
6633
|
}
|
|
6622
6634
|
});
|
|
@@ -9333,7 +9345,7 @@ var getActionPlugin = defineMethod({
|
|
|
9333
9345
|
});
|
|
9334
9346
|
for await (const action of imports.listActions({ app: appKey }).items()) {
|
|
9335
9347
|
if ((action.key === actionKey || action.id === actionKey) && action.action_type === actionType) {
|
|
9336
|
-
return action;
|
|
9348
|
+
return { data: action };
|
|
9337
9349
|
}
|
|
9338
9350
|
}
|
|
9339
9351
|
throw new ZapierResourceNotFoundError(
|
|
@@ -9849,7 +9861,7 @@ var getAppPlugin = defineMethod({
|
|
|
9849
9861
|
run: async ({ imports, input }) => {
|
|
9850
9862
|
const appKey = "app" in input ? input.app : input.appKey;
|
|
9851
9863
|
for await (const app of imports.listApps({ apps: [appKey] }).items()) {
|
|
9852
|
-
return app;
|
|
9864
|
+
return { data: app };
|
|
9853
9865
|
}
|
|
9854
9866
|
throw new ZapierAppNotFoundError("App not found", { appKey });
|
|
9855
9867
|
}
|
|
@@ -10071,7 +10083,7 @@ var getConnectionPlugin = defineMethod({
|
|
|
10071
10083
|
}
|
|
10072
10084
|
}
|
|
10073
10085
|
);
|
|
10074
|
-
return transformConnectionItem(response.data);
|
|
10086
|
+
return { data: transformConnectionItem(response.data) };
|
|
10075
10087
|
}
|
|
10076
10088
|
});
|
|
10077
10089
|
|
|
@@ -10106,7 +10118,7 @@ var findFirstConnectionPlugin = defineMethod({
|
|
|
10106
10118
|
{ resourceType: "Connection" }
|
|
10107
10119
|
);
|
|
10108
10120
|
}
|
|
10109
|
-
return connectionsResponse.data[0];
|
|
10121
|
+
return { data: connectionsResponse.data[0] };
|
|
10110
10122
|
}
|
|
10111
10123
|
});
|
|
10112
10124
|
|
|
@@ -10147,7 +10159,7 @@ var findUniqueConnectionPlugin = defineMethod({
|
|
|
10147
10159
|
"Multiple connections found matching the specified criteria. Expected exactly one."
|
|
10148
10160
|
);
|
|
10149
10161
|
}
|
|
10150
|
-
return connectionsResponse.data[0];
|
|
10162
|
+
return { data: connectionsResponse.data[0] };
|
|
10151
10163
|
}
|
|
10152
10164
|
});
|
|
10153
10165
|
var GetConnectionStartUrlSchema = zod.z.object({
|
|
@@ -10195,12 +10207,14 @@ var getConnectionStartUrlPlugin = defineMethod({
|
|
|
10195
10207
|
{ selected_api: selectedApi },
|
|
10196
10208
|
{ authRequired: true }
|
|
10197
10209
|
);
|
|
10198
|
-
return
|
|
10199
|
-
|
|
10200
|
-
|
|
10201
|
-
|
|
10202
|
-
|
|
10203
|
-
|
|
10210
|
+
return {
|
|
10211
|
+
data: GetConnectionStartUrlItemSchema.parse({
|
|
10212
|
+
url: response.url,
|
|
10213
|
+
expiresAt: response.expires_at,
|
|
10214
|
+
startedAt: response.started_at,
|
|
10215
|
+
app: selectedApi
|
|
10216
|
+
})
|
|
10217
|
+
};
|
|
10204
10218
|
}
|
|
10205
10219
|
});
|
|
10206
10220
|
var WaitForNewConnectionSchema = zod.z.object({
|
|
@@ -10274,11 +10288,13 @@ var waitForNewConnectionPlugin = defineMethod({
|
|
|
10274
10288
|
body.data[0]
|
|
10275
10289
|
)
|
|
10276
10290
|
});
|
|
10277
|
-
return
|
|
10278
|
-
|
|
10279
|
-
|
|
10280
|
-
|
|
10281
|
-
|
|
10291
|
+
return {
|
|
10292
|
+
data: WaitForNewConnectionItemSchema.parse({
|
|
10293
|
+
id: String(top.public_id ?? top.id),
|
|
10294
|
+
app: appKey,
|
|
10295
|
+
title: top.title ?? null
|
|
10296
|
+
})
|
|
10297
|
+
};
|
|
10282
10298
|
} catch (err) {
|
|
10283
10299
|
if (err instanceof ZapierTimeoutError) {
|
|
10284
10300
|
throw new ZapierTimeoutError(
|
|
@@ -10379,11 +10395,13 @@ Open this URL to complete the connection:
|
|
|
10379
10395
|
timeoutMs: input.timeoutMs,
|
|
10380
10396
|
pollIntervalMs: input.pollIntervalMs
|
|
10381
10397
|
});
|
|
10382
|
-
return
|
|
10383
|
-
|
|
10384
|
-
|
|
10385
|
-
|
|
10386
|
-
|
|
10398
|
+
return {
|
|
10399
|
+
data: CreateConnectionItemSchema.parse({
|
|
10400
|
+
id: fresh.id,
|
|
10401
|
+
app: start2.app,
|
|
10402
|
+
title: fresh.title ?? null
|
|
10403
|
+
})
|
|
10404
|
+
};
|
|
10387
10405
|
}
|
|
10388
10406
|
});
|
|
10389
10407
|
|
|
@@ -10571,7 +10589,7 @@ var createClientCredentialsPlugin = defineMethod({
|
|
|
10571
10589
|
requiredScopes: ["credentials"]
|
|
10572
10590
|
}
|
|
10573
10591
|
);
|
|
10574
|
-
return response.data;
|
|
10592
|
+
return { data: response.data };
|
|
10575
10593
|
}
|
|
10576
10594
|
});
|
|
10577
10595
|
var DeleteClientCredentialsSchema = zod.z.object({
|
|
@@ -11034,7 +11052,10 @@ var getActionInputFieldsSchemaPlugin = defineMethod({
|
|
|
11034
11052
|
connection: connectionIdResolver,
|
|
11035
11053
|
inputs: inputsAllOptionalResolver
|
|
11036
11054
|
},
|
|
11037
|
-
run: async ({
|
|
11055
|
+
run: async ({
|
|
11056
|
+
imports,
|
|
11057
|
+
input
|
|
11058
|
+
}) => {
|
|
11038
11059
|
const api = imports.api;
|
|
11039
11060
|
const getVersionedImplementationId = imports.manifest.getVersionedImplementationId;
|
|
11040
11061
|
const resolveConnection = imports.connections.resolveConnection;
|
|
@@ -11072,7 +11093,7 @@ var getActionInputFieldsSchemaPlugin = defineMethod({
|
|
|
11072
11093
|
connectionId: resolvedConnectionId ?? null,
|
|
11073
11094
|
inputs
|
|
11074
11095
|
});
|
|
11075
|
-
return needsData.schema || {};
|
|
11096
|
+
return { data: needsData.schema || {} };
|
|
11076
11097
|
}
|
|
11077
11098
|
});
|
|
11078
11099
|
var InputFieldChoiceItemSchema = NeedChoicesSchema;
|
|
@@ -11520,7 +11541,7 @@ var createTriggerInboxPlugin = defineMethod({
|
|
|
11520
11541
|
}
|
|
11521
11542
|
}
|
|
11522
11543
|
);
|
|
11523
|
-
return TriggerInboxItemSchema.parse(rawResponse);
|
|
11544
|
+
return { data: TriggerInboxItemSchema.parse(rawResponse) };
|
|
11524
11545
|
}
|
|
11525
11546
|
});
|
|
11526
11547
|
var EnsureTriggerInboxDescription = "Get-or-create a trigger inbox by key. Idempotent on (user, account, key): returns the existing inbox if a matching subscription is registered, creates a new one otherwise. Throws ZapierConflictError if the key exists with a different subscription.";
|
|
@@ -11621,7 +11642,7 @@ var ensureTriggerInboxPlugin = defineMethod({
|
|
|
11621
11642
|
}
|
|
11622
11643
|
}
|
|
11623
11644
|
);
|
|
11624
|
-
return TriggerInboxItemSchema.parse(rawResponse);
|
|
11645
|
+
return { data: TriggerInboxItemSchema.parse(rawResponse) };
|
|
11625
11646
|
}
|
|
11626
11647
|
});
|
|
11627
11648
|
var ListTriggerInboxesSchema = zod.z.object({
|
|
@@ -11716,7 +11737,7 @@ var getTriggerInboxPlugin = defineMethod({
|
|
|
11716
11737
|
resource: { type: "trigger_inbox", id: inboxId }
|
|
11717
11738
|
}
|
|
11718
11739
|
);
|
|
11719
|
-
return TriggerInboxItemSchema.parse(rawResponse);
|
|
11740
|
+
return { data: TriggerInboxItemSchema.parse(rawResponse) };
|
|
11720
11741
|
}
|
|
11721
11742
|
});
|
|
11722
11743
|
var UpdateTriggerInboxSchema = zod.z.object({
|
|
@@ -11754,7 +11775,7 @@ var updateTriggerInboxPlugin = defineMethod({
|
|
|
11754
11775
|
resource: { type: "trigger_inbox", id: inboxId }
|
|
11755
11776
|
}
|
|
11756
11777
|
);
|
|
11757
|
-
return TriggerInboxItemSchema.parse(rawResponse);
|
|
11778
|
+
return { data: TriggerInboxItemSchema.parse(rawResponse) };
|
|
11758
11779
|
}
|
|
11759
11780
|
});
|
|
11760
11781
|
var DeleteTriggerInboxSchema = zod.z.object({
|
|
@@ -11819,7 +11840,7 @@ var pauseTriggerInboxPlugin = defineMethod({
|
|
|
11819
11840
|
resource: { type: "trigger_inbox", id: inboxId }
|
|
11820
11841
|
}
|
|
11821
11842
|
);
|
|
11822
|
-
return TriggerInboxItemSchema.parse(rawResponse);
|
|
11843
|
+
return { data: TriggerInboxItemSchema.parse(rawResponse) };
|
|
11823
11844
|
}
|
|
11824
11845
|
});
|
|
11825
11846
|
var ResumeTriggerInboxSchema = zod.z.object({
|
|
@@ -11850,7 +11871,7 @@ var resumeTriggerInboxPlugin = defineMethod({
|
|
|
11850
11871
|
resource: { type: "trigger_inbox", id: inboxId }
|
|
11851
11872
|
}
|
|
11852
11873
|
);
|
|
11853
|
-
return TriggerInboxItemSchema.parse(rawResponse);
|
|
11874
|
+
return { data: TriggerInboxItemSchema.parse(rawResponse) };
|
|
11854
11875
|
}
|
|
11855
11876
|
});
|
|
11856
11877
|
var TriggerMessageStatusSchema = zod.z.union([zod.z.enum(["available", "leased", "acked", "quarantined"]), zod.z.string()]).describe("Message lifecycle status");
|
|
@@ -12039,7 +12060,7 @@ var leaseTriggerInboxMessagesPlugin = defineMethod({
|
|
|
12039
12060
|
}
|
|
12040
12061
|
}
|
|
12041
12062
|
);
|
|
12042
|
-
return LeaseTriggerInboxMessagesItemSchema.parse(rawResponse);
|
|
12063
|
+
return { data: LeaseTriggerInboxMessagesItemSchema.parse(rawResponse) };
|
|
12043
12064
|
}
|
|
12044
12065
|
});
|
|
12045
12066
|
var AckTriggerInboxMessagesSchema = zod.z.object({
|
|
@@ -12089,7 +12110,7 @@ var ackTriggerInboxMessagesPlugin = defineMethod({
|
|
|
12089
12110
|
requestBody,
|
|
12090
12111
|
{ authRequired: true }
|
|
12091
12112
|
);
|
|
12092
|
-
return AckTriggerInboxMessagesItemSchema.parse(rawResponse);
|
|
12113
|
+
return { data: AckTriggerInboxMessagesItemSchema.parse(rawResponse) };
|
|
12093
12114
|
}
|
|
12094
12115
|
});
|
|
12095
12116
|
var ReleaseTriggerInboxMessagesSchema = zod.z.object({
|
|
@@ -12139,7 +12160,7 @@ var releaseTriggerInboxMessagesPlugin = defineMethod({
|
|
|
12139
12160
|
requestBody,
|
|
12140
12161
|
{ authRequired: true }
|
|
12141
12162
|
);
|
|
12142
|
-
return ReleaseTriggerInboxMessagesItemSchema.parse(rawResponse);
|
|
12163
|
+
return { data: ReleaseTriggerInboxMessagesItemSchema.parse(rawResponse) };
|
|
12143
12164
|
}
|
|
12144
12165
|
});
|
|
12145
12166
|
|
|
@@ -13167,7 +13188,7 @@ var getTablePlugin = defineMethod({
|
|
|
13167
13188
|
resource: { type: "table", id: tableId }
|
|
13168
13189
|
});
|
|
13169
13190
|
const response = GetTableApiResponseSchema.parse(rawResponse);
|
|
13170
|
-
return transformTableItem(response.data);
|
|
13191
|
+
return { data: transformTableItem(response.data) };
|
|
13171
13192
|
}
|
|
13172
13193
|
});
|
|
13173
13194
|
var DeleteTableDescription = "Delete a table by its ID";
|
|
@@ -13227,7 +13248,7 @@ var createTablePlugin = defineMethod({
|
|
|
13227
13248
|
{ authRequired: true }
|
|
13228
13249
|
);
|
|
13229
13250
|
const response = CreateTableApiResponseSchema.parse(rawResponse);
|
|
13230
|
-
return transformTableItem(response.data);
|
|
13251
|
+
return { data: transformTableItem(response.data) };
|
|
13231
13252
|
}
|
|
13232
13253
|
});
|
|
13233
13254
|
|
|
@@ -13247,10 +13268,8 @@ var listTableFieldsPlugin = defineMethod({
|
|
|
13247
13268
|
imports: [apiPluginRef],
|
|
13248
13269
|
categories: tableCategories,
|
|
13249
13270
|
itemType: "Field",
|
|
13250
|
-
// A field list, but the API returns no cursor
|
|
13251
|
-
//
|
|
13252
|
-
// not an iterator). `output: "item"` reproduces that exactly (same boundary +
|
|
13253
|
-
// hooks; run returns the bare array, framework wraps to `{ data }`); the
|
|
13271
|
+
// A field list, but the API returns no cursor, so `output: "item"` returns
|
|
13272
|
+
// `{ data: FieldItem[] }` directly instead of a paginated iterator; the
|
|
13254
13273
|
// `type: "list"` first-class field keeps the list presentation.
|
|
13255
13274
|
type: "list",
|
|
13256
13275
|
inputSchema: ListTableFieldsOptionsInputSchema,
|
|
@@ -13279,7 +13298,7 @@ var listTableFieldsPlugin = defineMethod({
|
|
|
13279
13298
|
}
|
|
13280
13299
|
);
|
|
13281
13300
|
const response = ListTableFieldsApiResponseSchema.parse(rawResponse);
|
|
13282
|
-
return response.data.map(transformFieldItem);
|
|
13301
|
+
return { data: response.data.map(transformFieldItem) };
|
|
13283
13302
|
}
|
|
13284
13303
|
});
|
|
13285
13304
|
var FieldChangesetItemSchema = zod.z.object({
|
|
@@ -13324,8 +13343,8 @@ var createTableFieldsPlugin = defineMethod({
|
|
|
13324
13343
|
returnType: "FieldItem[]",
|
|
13325
13344
|
inputSchema: CreateTableFieldsOptionsInputSchema,
|
|
13326
13345
|
outputSchema: FieldItemSchema,
|
|
13327
|
-
//
|
|
13328
|
-
//
|
|
13346
|
+
// Item output with an array payload: callers get `{ data: FieldItem[] }`
|
|
13347
|
+
// directly rather than a paginated list.
|
|
13329
13348
|
output: "item",
|
|
13330
13349
|
formatter: tableFieldItemFormatter,
|
|
13331
13350
|
resolvers: { table: tableIdResolver, fields: tableFieldsResolver },
|
|
@@ -13338,7 +13357,9 @@ var createTableFieldsPlugin = defineMethod({
|
|
|
13338
13357
|
{ authRequired: true, resource: { type: "table", id: tableId } }
|
|
13339
13358
|
);
|
|
13340
13359
|
const response = CreateTableFieldsApiResponseSchema.parse(rawResponse);
|
|
13341
|
-
return
|
|
13360
|
+
return {
|
|
13361
|
+
data: response.data.map((changeset) => transformFieldItem(changeset.new))
|
|
13362
|
+
};
|
|
13342
13363
|
}
|
|
13343
13364
|
});
|
|
13344
13365
|
var DeleteTableFieldsDescription = "Delete one or more fields from a table";
|
|
@@ -13479,8 +13500,10 @@ var getTableRecordPlugin = defineMethod({
|
|
|
13479
13500
|
keyMode: input.keyMode
|
|
13480
13501
|
});
|
|
13481
13502
|
return {
|
|
13482
|
-
|
|
13483
|
-
|
|
13503
|
+
data: {
|
|
13504
|
+
...transformRecordItem(response.data),
|
|
13505
|
+
data: translator.translateOutput(response.data.data)
|
|
13506
|
+
}
|
|
13484
13507
|
};
|
|
13485
13508
|
}
|
|
13486
13509
|
});
|
|
@@ -13659,8 +13682,8 @@ var createTableRecordsPlugin = defineMethod({
|
|
|
13659
13682
|
returnType: "RecordItem[]",
|
|
13660
13683
|
inputSchema: CreateTableRecordsOptionsInputSchema,
|
|
13661
13684
|
outputSchema: RecordItemSchema,
|
|
13662
|
-
//
|
|
13663
|
-
//
|
|
13685
|
+
// Item output with an array payload: callers get `{ data: RecordItem[] }`
|
|
13686
|
+
// directly rather than a paginated list.
|
|
13664
13687
|
output: "item",
|
|
13665
13688
|
resolvers: { table: tableIdResolver, records: tableRecordsResolver },
|
|
13666
13689
|
formatter: tableRecordFormatter,
|
|
@@ -13686,10 +13709,12 @@ var createTableRecordsPlugin = defineMethod({
|
|
|
13686
13709
|
for (const changeset of response.data) {
|
|
13687
13710
|
throwOnRecordErrors(changeset.new);
|
|
13688
13711
|
}
|
|
13689
|
-
return
|
|
13690
|
-
|
|
13691
|
-
|
|
13692
|
-
|
|
13712
|
+
return {
|
|
13713
|
+
data: response.data.map((changeset) => ({
|
|
13714
|
+
...transformRecordItem(changeset.new),
|
|
13715
|
+
data: translator.translateOutput(changeset.new.data)
|
|
13716
|
+
}))
|
|
13717
|
+
};
|
|
13693
13718
|
}
|
|
13694
13719
|
});
|
|
13695
13720
|
var DeleteTableRecordsDescription = "Delete one or more records from a table";
|
|
@@ -13769,8 +13794,8 @@ var updateTableRecordsPlugin = defineMethod({
|
|
|
13769
13794
|
returnType: "RecordItem[]",
|
|
13770
13795
|
inputSchema: UpdateTableRecordsOptionsInputSchema,
|
|
13771
13796
|
outputSchema: RecordItemSchema,
|
|
13772
|
-
//
|
|
13773
|
-
//
|
|
13797
|
+
// Item output with an array payload: callers get `{ data: RecordItem[] }`
|
|
13798
|
+
// directly rather than a paginated list.
|
|
13774
13799
|
output: "item",
|
|
13775
13800
|
resolvers: { table: tableIdResolver, records: tableUpdateRecordsResolver },
|
|
13776
13801
|
formatter: tableRecordFormatter,
|
|
@@ -13797,10 +13822,12 @@ var updateTableRecordsPlugin = defineMethod({
|
|
|
13797
13822
|
for (const changeset of response.data) {
|
|
13798
13823
|
throwOnRecordErrors(changeset.new);
|
|
13799
13824
|
}
|
|
13800
|
-
return
|
|
13801
|
-
|
|
13802
|
-
|
|
13803
|
-
|
|
13825
|
+
return {
|
|
13826
|
+
data: response.data.map((changeset) => ({
|
|
13827
|
+
...transformRecordItem(changeset.new),
|
|
13828
|
+
data: translator.translateOutput(changeset.new.data)
|
|
13829
|
+
}))
|
|
13830
|
+
};
|
|
13804
13831
|
}
|
|
13805
13832
|
});
|
|
13806
13833
|
var RelayRequestSchema = zod.z.object({
|
|
@@ -14675,6 +14702,8 @@ var codeSubstrateDefaults = {
|
|
|
14675
14702
|
categories: ["code-workflow"],
|
|
14676
14703
|
experimental: true
|
|
14677
14704
|
};
|
|
14705
|
+
var CODE_SUBSTRATE_RUNNER_API = "/code-substrate-runner/api/v0";
|
|
14706
|
+
var CODE_SUBSTRATE_WORKFLOWS_API = "/code-substrate-workflows/api/v0";
|
|
14678
14707
|
var JsonPayloadSchema = zod.z.preprocess((val) => {
|
|
14679
14708
|
if (typeof val === "string") {
|
|
14680
14709
|
const trimmed = val.trim();
|
|
@@ -14867,7 +14896,7 @@ var listWorkflowsPlugin = defineMethod({
|
|
|
14867
14896
|
if (input.cursor) {
|
|
14868
14897
|
searchParams.cursor = input.cursor;
|
|
14869
14898
|
}
|
|
14870
|
-
const raw = await api.get(
|
|
14899
|
+
const raw = await api.get(`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows`, {
|
|
14871
14900
|
searchParams,
|
|
14872
14901
|
authRequired: true
|
|
14873
14902
|
});
|
|
@@ -14886,7 +14915,7 @@ var WorkflowVersionSchema = zod.z.object({
|
|
|
14886
14915
|
"Pinned semver of @zapier/zapier-durable used by this version's runs"
|
|
14887
14916
|
),
|
|
14888
14917
|
dependencies: zod.z.record(zod.z.string(), zod.z.string()).nullable().describe("Additional npm dependencies pinned for this version (or null)"),
|
|
14889
|
-
// Backend column is NOT NULL (see
|
|
14918
|
+
// Backend column is NOT NULL (see code-substrate-workflows prisma schema:
|
|
14890
14919
|
// workflow_versions.created_by_user_id), so this is always emitted.
|
|
14891
14920
|
created_by_user_id: zod.z.string().describe("ID of the user who published this version"),
|
|
14892
14921
|
created_at: zod.z.string().describe("When the version was published (ISO-8601)"),
|
|
@@ -14940,13 +14969,13 @@ var getWorkflowPlugin = defineMethod({
|
|
|
14940
14969
|
run: async ({ imports, input }) => {
|
|
14941
14970
|
const api = imports.api;
|
|
14942
14971
|
const raw = await api.get(
|
|
14943
|
-
|
|
14972
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows/${encodeURIComponent(input.workflow)}`,
|
|
14944
14973
|
{
|
|
14945
14974
|
authRequired: true,
|
|
14946
14975
|
resource: { type: "workflow", id: input.workflow }
|
|
14947
14976
|
}
|
|
14948
14977
|
);
|
|
14949
|
-
return GetWorkflowResponseSchema.parse(raw);
|
|
14978
|
+
return { data: GetWorkflowResponseSchema.parse(raw) };
|
|
14950
14979
|
}
|
|
14951
14980
|
});
|
|
14952
14981
|
var CreateWorkflowOptionsSchema = zod.z.object({
|
|
@@ -14997,10 +15026,14 @@ var createWorkflowPlugin = defineMethod({
|
|
|
14997
15026
|
if (isPrivate !== void 0) {
|
|
14998
15027
|
body.is_private = isPrivate;
|
|
14999
15028
|
}
|
|
15000
|
-
const raw = await api.post(
|
|
15001
|
-
|
|
15002
|
-
|
|
15003
|
-
|
|
15029
|
+
const raw = await api.post(
|
|
15030
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows`,
|
|
15031
|
+
body,
|
|
15032
|
+
{
|
|
15033
|
+
authRequired: true
|
|
15034
|
+
}
|
|
15035
|
+
);
|
|
15036
|
+
return { data: CreateWorkflowResponseSchema.parse(raw) };
|
|
15004
15037
|
}
|
|
15005
15038
|
});
|
|
15006
15039
|
var UpdateWorkflowOptionsSchema = zod.z.object({
|
|
@@ -15045,14 +15078,14 @@ var updateWorkflowPlugin = defineMethod({
|
|
|
15045
15078
|
body.description = input.description;
|
|
15046
15079
|
}
|
|
15047
15080
|
const raw = await api.patch(
|
|
15048
|
-
|
|
15081
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows/${encodeURIComponent(input.workflow)}`,
|
|
15049
15082
|
body,
|
|
15050
15083
|
{
|
|
15051
15084
|
authRequired: true,
|
|
15052
15085
|
resource: { type: "workflow", id: input.workflow }
|
|
15053
15086
|
}
|
|
15054
15087
|
);
|
|
15055
|
-
return UpdateWorkflowResponseSchema.parse(raw);
|
|
15088
|
+
return { data: UpdateWorkflowResponseSchema.parse(raw) };
|
|
15056
15089
|
}
|
|
15057
15090
|
});
|
|
15058
15091
|
var EnableWorkflowOptionsSchema = zod.z.object({
|
|
@@ -15077,14 +15110,14 @@ var enableWorkflowPlugin = defineMethod({
|
|
|
15077
15110
|
run: async ({ imports, input }) => {
|
|
15078
15111
|
const api = imports.api;
|
|
15079
15112
|
const raw = await api.post(
|
|
15080
|
-
|
|
15113
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows/${encodeURIComponent(input.workflow)}/enable`,
|
|
15081
15114
|
void 0,
|
|
15082
15115
|
{
|
|
15083
15116
|
authRequired: true,
|
|
15084
15117
|
resource: { type: "workflow", id: input.workflow }
|
|
15085
15118
|
}
|
|
15086
15119
|
);
|
|
15087
|
-
return EnableWorkflowResponseSchema.parse(raw);
|
|
15120
|
+
return { data: EnableWorkflowResponseSchema.parse(raw) };
|
|
15088
15121
|
}
|
|
15089
15122
|
});
|
|
15090
15123
|
var DisableWorkflowOptionsSchema = zod.z.object({
|
|
@@ -15111,14 +15144,14 @@ var disableWorkflowPlugin = defineMethod({
|
|
|
15111
15144
|
run: async ({ imports, input }) => {
|
|
15112
15145
|
const api = imports.api;
|
|
15113
15146
|
const raw = await api.post(
|
|
15114
|
-
|
|
15147
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows/${encodeURIComponent(input.workflow)}/disable`,
|
|
15115
15148
|
void 0,
|
|
15116
15149
|
{
|
|
15117
15150
|
authRequired: true,
|
|
15118
15151
|
resource: { type: "workflow", id: input.workflow }
|
|
15119
15152
|
}
|
|
15120
15153
|
);
|
|
15121
|
-
return DisableWorkflowResponseSchema.parse(raw);
|
|
15154
|
+
return { data: DisableWorkflowResponseSchema.parse(raw) };
|
|
15122
15155
|
}
|
|
15123
15156
|
});
|
|
15124
15157
|
var DeleteWorkflowOptionsSchema = zod.z.object({
|
|
@@ -15145,7 +15178,7 @@ var deleteWorkflowPlugin = defineMethod({
|
|
|
15145
15178
|
run: async ({ imports, input }) => {
|
|
15146
15179
|
const api = imports.api;
|
|
15147
15180
|
await api.delete(
|
|
15148
|
-
|
|
15181
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows/${encodeURIComponent(input.workflow)}`,
|
|
15149
15182
|
void 0,
|
|
15150
15183
|
{
|
|
15151
15184
|
authRequired: true,
|
|
@@ -15222,7 +15255,7 @@ var listDurableRunsPlugin = defineMethod({
|
|
|
15222
15255
|
if (input.cursor) {
|
|
15223
15256
|
searchParams.cursor = input.cursor;
|
|
15224
15257
|
}
|
|
15225
|
-
const raw = await api.get(
|
|
15258
|
+
const raw = await api.get(`${CODE_SUBSTRATE_RUNNER_API}/runs`, {
|
|
15226
15259
|
searchParams,
|
|
15227
15260
|
authRequired: true
|
|
15228
15261
|
});
|
|
@@ -15335,13 +15368,13 @@ var getDurableRunPlugin = defineMethod({
|
|
|
15335
15368
|
run: async ({ imports, input }) => {
|
|
15336
15369
|
const api = imports.api;
|
|
15337
15370
|
const raw = await api.get(
|
|
15338
|
-
|
|
15371
|
+
`${CODE_SUBSTRATE_RUNNER_API}/runs/${encodeURIComponent(input.run)}`,
|
|
15339
15372
|
{
|
|
15340
15373
|
authRequired: true,
|
|
15341
15374
|
resource: { type: "run", id: input.run }
|
|
15342
15375
|
}
|
|
15343
15376
|
);
|
|
15344
|
-
return GetDurableRunResponseSchema.parse(raw);
|
|
15377
|
+
return { data: GetDurableRunResponseSchema.parse(raw) };
|
|
15345
15378
|
}
|
|
15346
15379
|
});
|
|
15347
15380
|
var RunNotificationEventSchema = zod.z.enum(["started", "progress", "completed", "error", "cancelled"]).describe("Run lifecycle event this notification subscribes to");
|
|
@@ -15380,7 +15413,7 @@ var RunDurableBaseSchema = zod.z.object({
|
|
|
15380
15413
|
"Webhook subscribers for run lifecycle events. Each entry specifies a URL and the events it subscribes to."
|
|
15381
15414
|
)
|
|
15382
15415
|
});
|
|
15383
|
-
var RunDurableDescription = "Run a workflow source file as a run-once durable run on
|
|
15416
|
+
var RunDurableDescription = "Run a workflow source file as a run-once durable run on code-substrate-runner (no deployed workflow required). Returns the run ID immediately; poll via getDurableRun for terminal status.";
|
|
15384
15417
|
var RunDurableSchema = zod.z.object({ sourceFiles: SourceFilesSchema }).merge(RunDurableBaseSchema).describe(RunDurableDescription).meta({
|
|
15385
15418
|
aliases: {
|
|
15386
15419
|
source_files: "sourceFiles",
|
|
@@ -15438,10 +15471,10 @@ var runDurablePlugin = defineMethod({
|
|
|
15438
15471
|
if (input.notifications !== void 0) {
|
|
15439
15472
|
body.notifications = input.notifications;
|
|
15440
15473
|
}
|
|
15441
|
-
const raw = await api.post(
|
|
15474
|
+
const raw = await api.post(`${CODE_SUBSTRATE_RUNNER_API}/runs`, body, {
|
|
15442
15475
|
authRequired: true
|
|
15443
15476
|
});
|
|
15444
|
-
return RunDurableResponseSchema.parse(raw);
|
|
15477
|
+
return { data: RunDurableResponseSchema.parse(raw) };
|
|
15445
15478
|
}
|
|
15446
15479
|
});
|
|
15447
15480
|
var CancelDurableRunOptionsSchema = zod.z.object({
|
|
@@ -15470,14 +15503,14 @@ var cancelDurableRunPlugin = defineMethod({
|
|
|
15470
15503
|
run: async ({ imports, input }) => {
|
|
15471
15504
|
const api = imports.api;
|
|
15472
15505
|
await api.post(
|
|
15473
|
-
|
|
15506
|
+
`${CODE_SUBSTRATE_RUNNER_API}/runs/${encodeURIComponent(input.run)}/cancel`,
|
|
15474
15507
|
void 0,
|
|
15475
15508
|
{
|
|
15476
15509
|
authRequired: true,
|
|
15477
15510
|
resource: { type: "run", id: input.run }
|
|
15478
15511
|
}
|
|
15479
15512
|
);
|
|
15480
|
-
return { id: input.run, status: "cancelled" };
|
|
15513
|
+
return { data: { id: input.run, status: "cancelled" } };
|
|
15481
15514
|
}
|
|
15482
15515
|
});
|
|
15483
15516
|
var TriggerConfigSchema = zod.z.object({
|
|
@@ -15611,14 +15644,14 @@ var publishWorkflowVersionPlugin = defineMethod({
|
|
|
15611
15644
|
body.trigger = toWireTrigger(input.trigger);
|
|
15612
15645
|
}
|
|
15613
15646
|
const raw = await api.post(
|
|
15614
|
-
|
|
15647
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows/${encodeURIComponent(input.workflow)}/versions`,
|
|
15615
15648
|
body,
|
|
15616
15649
|
{
|
|
15617
15650
|
authRequired: true,
|
|
15618
15651
|
resource: { type: "workflow", id: input.workflow }
|
|
15619
15652
|
}
|
|
15620
15653
|
);
|
|
15621
|
-
return PublishWorkflowVersionResponseSchema.parse(raw);
|
|
15654
|
+
return { data: PublishWorkflowVersionResponseSchema.parse(raw) };
|
|
15622
15655
|
}
|
|
15623
15656
|
});
|
|
15624
15657
|
var WorkflowVersionListItemSchema = zod.z.object({
|
|
@@ -15677,7 +15710,7 @@ var listWorkflowVersionsPlugin = defineMethod({
|
|
|
15677
15710
|
searchParams.cursor = input.cursor;
|
|
15678
15711
|
}
|
|
15679
15712
|
const raw = await api.get(
|
|
15680
|
-
|
|
15713
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows/${encodeURIComponent(input.workflow)}/versions`,
|
|
15681
15714
|
{
|
|
15682
15715
|
searchParams,
|
|
15683
15716
|
authRequired: true,
|
|
@@ -15728,13 +15761,13 @@ var getWorkflowVersionPlugin = defineMethod({
|
|
|
15728
15761
|
run: async ({ imports, input }) => {
|
|
15729
15762
|
const api = imports.api;
|
|
15730
15763
|
const raw = await api.get(
|
|
15731
|
-
|
|
15764
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows/${encodeURIComponent(input.workflow)}/versions/${encodeURIComponent(input.version)}`,
|
|
15732
15765
|
{
|
|
15733
15766
|
authRequired: true,
|
|
15734
15767
|
resource: { type: "workflow-version", id: input.version }
|
|
15735
15768
|
}
|
|
15736
15769
|
);
|
|
15737
|
-
return GetWorkflowVersionResponseSchema.parse(raw);
|
|
15770
|
+
return { data: GetWorkflowVersionResponseSchema.parse(raw) };
|
|
15738
15771
|
}
|
|
15739
15772
|
});
|
|
15740
15773
|
var WorkflowRunStatusSchema = zod.z.union([
|
|
@@ -15749,7 +15782,7 @@ var WorkflowRunListItemSchema = zod.z.object({
|
|
|
15749
15782
|
"ID of the trigger that fired this run, if any. Null for runs created without a trigger."
|
|
15750
15783
|
),
|
|
15751
15784
|
durable_run_id: zod.z.string().nullable().describe(
|
|
15752
|
-
"Linked
|
|
15785
|
+
"Linked code-substrate-runner run ID. Null until the durable run is created."
|
|
15753
15786
|
),
|
|
15754
15787
|
workflow_version_id: zod.z.string().nullable().describe("Workflow version the run is bound to. Null in rare edge cases."),
|
|
15755
15788
|
status: WorkflowRunStatusSchema,
|
|
@@ -15805,7 +15838,7 @@ var listWorkflowRunsPlugin = defineMethod({
|
|
|
15805
15838
|
searchParams.cursor = input.cursor;
|
|
15806
15839
|
}
|
|
15807
15840
|
const raw = await api.get(
|
|
15808
|
-
|
|
15841
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows/${encodeURIComponent(input.workflow)}/runs`,
|
|
15809
15842
|
{
|
|
15810
15843
|
searchParams,
|
|
15811
15844
|
authRequired: true,
|
|
@@ -15835,7 +15868,7 @@ var GetWorkflowRunResponseSchema = zod.z.object({
|
|
|
15835
15868
|
id: zod.z.string().describe("Workflow run ID (UUID)"),
|
|
15836
15869
|
trigger_id: zod.z.string().nullable().describe("ID of the trigger that fired this run, if any"),
|
|
15837
15870
|
durable_run_id: zod.z.string().nullable().describe(
|
|
15838
|
-
"Linked
|
|
15871
|
+
"Linked code-substrate-runner run ID. Null until the durable run is created."
|
|
15839
15872
|
),
|
|
15840
15873
|
workflow_version_id: zod.z.string().nullable().describe("Workflow version the run is bound to"),
|
|
15841
15874
|
status: WorkflowRunStatusSchema,
|
|
@@ -15862,13 +15895,13 @@ var getWorkflowRunPlugin = defineMethod({
|
|
|
15862
15895
|
run: async ({ imports, input }) => {
|
|
15863
15896
|
const api = imports.api;
|
|
15864
15897
|
const raw = await api.get(
|
|
15865
|
-
|
|
15898
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows/runs/${encodeURIComponent(input.run)}`,
|
|
15866
15899
|
{
|
|
15867
15900
|
authRequired: true,
|
|
15868
15901
|
resource: { type: "workflow-run", id: input.run }
|
|
15869
15902
|
}
|
|
15870
15903
|
);
|
|
15871
|
-
return GetWorkflowRunResponseSchema.parse(raw);
|
|
15904
|
+
return { data: GetWorkflowRunResponseSchema.parse(raw) };
|
|
15872
15905
|
}
|
|
15873
15906
|
});
|
|
15874
15907
|
var GetTriggerRunOptionsSchema = zod.z.object({
|
|
@@ -15879,7 +15912,7 @@ var GetTriggerRunOptionsSchema = zod.z.object({
|
|
|
15879
15912
|
var GetTriggerRunResponseSchema = zod.z.object({
|
|
15880
15913
|
id: zod.z.string().describe("Workflow run ID (UUID)"),
|
|
15881
15914
|
durable_run_id: zod.z.string().nullable().describe(
|
|
15882
|
-
"Linked
|
|
15915
|
+
"Linked code-substrate-runner run ID. Null until the durable run is created."
|
|
15883
15916
|
),
|
|
15884
15917
|
workflow_version_id: zod.z.string().nullable().describe("Workflow version the run is bound to"),
|
|
15885
15918
|
status: WorkflowRunStatusSchema,
|
|
@@ -15906,13 +15939,13 @@ var getTriggerRunPlugin = defineMethod({
|
|
|
15906
15939
|
run: async ({ imports, input }) => {
|
|
15907
15940
|
const api = imports.api;
|
|
15908
15941
|
const raw = await api.get(
|
|
15909
|
-
|
|
15942
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows/triggers/${encodeURIComponent(input.trigger)}/run`,
|
|
15910
15943
|
{
|
|
15911
15944
|
authRequired: true,
|
|
15912
15945
|
resource: { type: "workflow-trigger", id: input.trigger }
|
|
15913
15946
|
}
|
|
15914
15947
|
);
|
|
15915
|
-
return GetTriggerRunResponseSchema.parse(raw);
|
|
15948
|
+
return { data: GetTriggerRunResponseSchema.parse(raw) };
|
|
15916
15949
|
}
|
|
15917
15950
|
});
|
|
15918
15951
|
var TriggerWorkflowLookupResponseSchema = zod.z.object({
|
|
@@ -15946,7 +15979,7 @@ var triggerWorkflowPlugin = defineMethod({
|
|
|
15946
15979
|
run: async ({ imports, input }) => {
|
|
15947
15980
|
const api = imports.api;
|
|
15948
15981
|
const rawWorkflow = await api.get(
|
|
15949
|
-
|
|
15982
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows/${encodeURIComponent(input.workflow)}`,
|
|
15950
15983
|
{
|
|
15951
15984
|
authRequired: true,
|
|
15952
15985
|
resource: { type: "workflow", id: input.workflow }
|
|
@@ -15962,14 +15995,14 @@ var triggerWorkflowPlugin = defineMethod({
|
|
|
15962
15995
|
);
|
|
15963
15996
|
}
|
|
15964
15997
|
const raw = await api.post(
|
|
15965
|
-
|
|
15998
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows/trigger/${encodeURIComponent(triggerToken)}`,
|
|
15966
15999
|
input.input,
|
|
15967
16000
|
{
|
|
15968
16001
|
authRequired: true,
|
|
15969
16002
|
resource: { type: "workflow", id: input.workflow }
|
|
15970
16003
|
}
|
|
15971
16004
|
);
|
|
15972
|
-
return TriggerWorkflowResponseSchema.parse(raw);
|
|
16005
|
+
return { data: TriggerWorkflowResponseSchema.parse(raw) };
|
|
15973
16006
|
}
|
|
15974
16007
|
});
|
|
15975
16008
|
|