@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.mjs
CHANGED
|
@@ -2095,9 +2095,7 @@ function buildMethodEntries(descriptors, context, states) {
|
|
|
2095
2095
|
}
|
|
2096
2096
|
);
|
|
2097
2097
|
} else if (out.type === "item") {
|
|
2098
|
-
const itemCore = async (input) => (
|
|
2099
|
-
data: await callRun(input)
|
|
2100
|
-
});
|
|
2098
|
+
const itemCore = async (input) => callRun(input);
|
|
2101
2099
|
entry.value = createFunction(
|
|
2102
2100
|
fold(itemCore),
|
|
2103
2101
|
{
|
|
@@ -5196,7 +5194,7 @@ function parseDeprecationDate(value) {
|
|
|
5196
5194
|
}
|
|
5197
5195
|
|
|
5198
5196
|
// src/sdk-version.ts
|
|
5199
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.
|
|
5197
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.84.1" : void 0) || "unknown";
|
|
5200
5198
|
|
|
5201
5199
|
// src/utils/open-url.ts
|
|
5202
5200
|
var nodePrefix = "node:";
|
|
@@ -5414,6 +5412,18 @@ var pathConfig = {
|
|
|
5414
5412
|
"/durableworkflowzaps": {
|
|
5415
5413
|
authHeader: "Authorization",
|
|
5416
5414
|
pathPrefix: "/api/v0/sdk/durableworkflowzaps"
|
|
5415
|
+
},
|
|
5416
|
+
// e.g. /code-substrate-runner -> https://sdkapi.zapier.com/api/v0/sdk/code-substrate-runner/...
|
|
5417
|
+
// sdkapi proxies to the code-substrate-runner backend.
|
|
5418
|
+
"/code-substrate-runner": {
|
|
5419
|
+
authHeader: "Authorization",
|
|
5420
|
+
pathPrefix: "/api/v0/sdk/code-substrate-runner"
|
|
5421
|
+
},
|
|
5422
|
+
// e.g. /code-substrate-workflows -> https://sdkapi.zapier.com/api/v0/sdk/code-substrate-workflows/...
|
|
5423
|
+
// sdkapi proxies to the code-substrate-workflows backend.
|
|
5424
|
+
"/code-substrate-workflows": {
|
|
5425
|
+
authHeader: "Authorization",
|
|
5426
|
+
pathPrefix: "/api/v0/sdk/code-substrate-workflows"
|
|
5417
5427
|
}
|
|
5418
5428
|
};
|
|
5419
5429
|
var ZapierApiClient = class {
|
|
@@ -6608,13 +6618,15 @@ var getProfilePlugin = defineMethod({
|
|
|
6608
6618
|
authRequired: true
|
|
6609
6619
|
});
|
|
6610
6620
|
return {
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6621
|
+
data: {
|
|
6622
|
+
id: String(profile.public_id ?? profile.id),
|
|
6623
|
+
first_name: profile.first_name,
|
|
6624
|
+
last_name: profile.last_name,
|
|
6625
|
+
full_name: `${profile.first_name} ${profile.last_name}`,
|
|
6626
|
+
email: profile.email,
|
|
6627
|
+
email_confirmed: profile.email_confirmed,
|
|
6628
|
+
timezone: profile.timezone
|
|
6629
|
+
}
|
|
6618
6630
|
};
|
|
6619
6631
|
}
|
|
6620
6632
|
});
|
|
@@ -9331,7 +9343,7 @@ var getActionPlugin = defineMethod({
|
|
|
9331
9343
|
});
|
|
9332
9344
|
for await (const action of imports.listActions({ app: appKey }).items()) {
|
|
9333
9345
|
if ((action.key === actionKey || action.id === actionKey) && action.action_type === actionType) {
|
|
9334
|
-
return action;
|
|
9346
|
+
return { data: action };
|
|
9335
9347
|
}
|
|
9336
9348
|
}
|
|
9337
9349
|
throw new ZapierResourceNotFoundError(
|
|
@@ -9847,7 +9859,7 @@ var getAppPlugin = defineMethod({
|
|
|
9847
9859
|
run: async ({ imports, input }) => {
|
|
9848
9860
|
const appKey = "app" in input ? input.app : input.appKey;
|
|
9849
9861
|
for await (const app of imports.listApps({ apps: [appKey] }).items()) {
|
|
9850
|
-
return app;
|
|
9862
|
+
return { data: app };
|
|
9851
9863
|
}
|
|
9852
9864
|
throw new ZapierAppNotFoundError("App not found", { appKey });
|
|
9853
9865
|
}
|
|
@@ -10069,7 +10081,7 @@ var getConnectionPlugin = defineMethod({
|
|
|
10069
10081
|
}
|
|
10070
10082
|
}
|
|
10071
10083
|
);
|
|
10072
|
-
return transformConnectionItem(response.data);
|
|
10084
|
+
return { data: transformConnectionItem(response.data) };
|
|
10073
10085
|
}
|
|
10074
10086
|
});
|
|
10075
10087
|
|
|
@@ -10104,7 +10116,7 @@ var findFirstConnectionPlugin = defineMethod({
|
|
|
10104
10116
|
{ resourceType: "Connection" }
|
|
10105
10117
|
);
|
|
10106
10118
|
}
|
|
10107
|
-
return connectionsResponse.data[0];
|
|
10119
|
+
return { data: connectionsResponse.data[0] };
|
|
10108
10120
|
}
|
|
10109
10121
|
});
|
|
10110
10122
|
|
|
@@ -10145,7 +10157,7 @@ var findUniqueConnectionPlugin = defineMethod({
|
|
|
10145
10157
|
"Multiple connections found matching the specified criteria. Expected exactly one."
|
|
10146
10158
|
);
|
|
10147
10159
|
}
|
|
10148
|
-
return connectionsResponse.data[0];
|
|
10160
|
+
return { data: connectionsResponse.data[0] };
|
|
10149
10161
|
}
|
|
10150
10162
|
});
|
|
10151
10163
|
var GetConnectionStartUrlSchema = z.object({
|
|
@@ -10193,12 +10205,14 @@ var getConnectionStartUrlPlugin = defineMethod({
|
|
|
10193
10205
|
{ selected_api: selectedApi },
|
|
10194
10206
|
{ authRequired: true }
|
|
10195
10207
|
);
|
|
10196
|
-
return
|
|
10197
|
-
|
|
10198
|
-
|
|
10199
|
-
|
|
10200
|
-
|
|
10201
|
-
|
|
10208
|
+
return {
|
|
10209
|
+
data: GetConnectionStartUrlItemSchema.parse({
|
|
10210
|
+
url: response.url,
|
|
10211
|
+
expiresAt: response.expires_at,
|
|
10212
|
+
startedAt: response.started_at,
|
|
10213
|
+
app: selectedApi
|
|
10214
|
+
})
|
|
10215
|
+
};
|
|
10202
10216
|
}
|
|
10203
10217
|
});
|
|
10204
10218
|
var WaitForNewConnectionSchema = z.object({
|
|
@@ -10272,11 +10286,13 @@ var waitForNewConnectionPlugin = defineMethod({
|
|
|
10272
10286
|
body.data[0]
|
|
10273
10287
|
)
|
|
10274
10288
|
});
|
|
10275
|
-
return
|
|
10276
|
-
|
|
10277
|
-
|
|
10278
|
-
|
|
10279
|
-
|
|
10289
|
+
return {
|
|
10290
|
+
data: WaitForNewConnectionItemSchema.parse({
|
|
10291
|
+
id: String(top.public_id ?? top.id),
|
|
10292
|
+
app: appKey,
|
|
10293
|
+
title: top.title ?? null
|
|
10294
|
+
})
|
|
10295
|
+
};
|
|
10280
10296
|
} catch (err) {
|
|
10281
10297
|
if (err instanceof ZapierTimeoutError) {
|
|
10282
10298
|
throw new ZapierTimeoutError(
|
|
@@ -10377,11 +10393,13 @@ Open this URL to complete the connection:
|
|
|
10377
10393
|
timeoutMs: input.timeoutMs,
|
|
10378
10394
|
pollIntervalMs: input.pollIntervalMs
|
|
10379
10395
|
});
|
|
10380
|
-
return
|
|
10381
|
-
|
|
10382
|
-
|
|
10383
|
-
|
|
10384
|
-
|
|
10396
|
+
return {
|
|
10397
|
+
data: CreateConnectionItemSchema.parse({
|
|
10398
|
+
id: fresh.id,
|
|
10399
|
+
app: start2.app,
|
|
10400
|
+
title: fresh.title ?? null
|
|
10401
|
+
})
|
|
10402
|
+
};
|
|
10385
10403
|
}
|
|
10386
10404
|
});
|
|
10387
10405
|
|
|
@@ -10569,7 +10587,7 @@ var createClientCredentialsPlugin = defineMethod({
|
|
|
10569
10587
|
requiredScopes: ["credentials"]
|
|
10570
10588
|
}
|
|
10571
10589
|
);
|
|
10572
|
-
return response.data;
|
|
10590
|
+
return { data: response.data };
|
|
10573
10591
|
}
|
|
10574
10592
|
});
|
|
10575
10593
|
var DeleteClientCredentialsSchema = z.object({
|
|
@@ -11032,7 +11050,10 @@ var getActionInputFieldsSchemaPlugin = defineMethod({
|
|
|
11032
11050
|
connection: connectionIdResolver,
|
|
11033
11051
|
inputs: inputsAllOptionalResolver
|
|
11034
11052
|
},
|
|
11035
|
-
run: async ({
|
|
11053
|
+
run: async ({
|
|
11054
|
+
imports,
|
|
11055
|
+
input
|
|
11056
|
+
}) => {
|
|
11036
11057
|
const api = imports.api;
|
|
11037
11058
|
const getVersionedImplementationId = imports.manifest.getVersionedImplementationId;
|
|
11038
11059
|
const resolveConnection = imports.connections.resolveConnection;
|
|
@@ -11070,7 +11091,7 @@ var getActionInputFieldsSchemaPlugin = defineMethod({
|
|
|
11070
11091
|
connectionId: resolvedConnectionId ?? null,
|
|
11071
11092
|
inputs
|
|
11072
11093
|
});
|
|
11073
|
-
return needsData.schema || {};
|
|
11094
|
+
return { data: needsData.schema || {} };
|
|
11074
11095
|
}
|
|
11075
11096
|
});
|
|
11076
11097
|
var InputFieldChoiceItemSchema = NeedChoicesSchema;
|
|
@@ -11518,7 +11539,7 @@ var createTriggerInboxPlugin = defineMethod({
|
|
|
11518
11539
|
}
|
|
11519
11540
|
}
|
|
11520
11541
|
);
|
|
11521
|
-
return TriggerInboxItemSchema.parse(rawResponse);
|
|
11542
|
+
return { data: TriggerInboxItemSchema.parse(rawResponse) };
|
|
11522
11543
|
}
|
|
11523
11544
|
});
|
|
11524
11545
|
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.";
|
|
@@ -11619,7 +11640,7 @@ var ensureTriggerInboxPlugin = defineMethod({
|
|
|
11619
11640
|
}
|
|
11620
11641
|
}
|
|
11621
11642
|
);
|
|
11622
|
-
return TriggerInboxItemSchema.parse(rawResponse);
|
|
11643
|
+
return { data: TriggerInboxItemSchema.parse(rawResponse) };
|
|
11623
11644
|
}
|
|
11624
11645
|
});
|
|
11625
11646
|
var ListTriggerInboxesSchema = z.object({
|
|
@@ -11714,7 +11735,7 @@ var getTriggerInboxPlugin = defineMethod({
|
|
|
11714
11735
|
resource: { type: "trigger_inbox", id: inboxId }
|
|
11715
11736
|
}
|
|
11716
11737
|
);
|
|
11717
|
-
return TriggerInboxItemSchema.parse(rawResponse);
|
|
11738
|
+
return { data: TriggerInboxItemSchema.parse(rawResponse) };
|
|
11718
11739
|
}
|
|
11719
11740
|
});
|
|
11720
11741
|
var UpdateTriggerInboxSchema = z.object({
|
|
@@ -11752,7 +11773,7 @@ var updateTriggerInboxPlugin = defineMethod({
|
|
|
11752
11773
|
resource: { type: "trigger_inbox", id: inboxId }
|
|
11753
11774
|
}
|
|
11754
11775
|
);
|
|
11755
|
-
return TriggerInboxItemSchema.parse(rawResponse);
|
|
11776
|
+
return { data: TriggerInboxItemSchema.parse(rawResponse) };
|
|
11756
11777
|
}
|
|
11757
11778
|
});
|
|
11758
11779
|
var DeleteTriggerInboxSchema = z.object({
|
|
@@ -11817,7 +11838,7 @@ var pauseTriggerInboxPlugin = defineMethod({
|
|
|
11817
11838
|
resource: { type: "trigger_inbox", id: inboxId }
|
|
11818
11839
|
}
|
|
11819
11840
|
);
|
|
11820
|
-
return TriggerInboxItemSchema.parse(rawResponse);
|
|
11841
|
+
return { data: TriggerInboxItemSchema.parse(rawResponse) };
|
|
11821
11842
|
}
|
|
11822
11843
|
});
|
|
11823
11844
|
var ResumeTriggerInboxSchema = z.object({
|
|
@@ -11848,7 +11869,7 @@ var resumeTriggerInboxPlugin = defineMethod({
|
|
|
11848
11869
|
resource: { type: "trigger_inbox", id: inboxId }
|
|
11849
11870
|
}
|
|
11850
11871
|
);
|
|
11851
|
-
return TriggerInboxItemSchema.parse(rawResponse);
|
|
11872
|
+
return { data: TriggerInboxItemSchema.parse(rawResponse) };
|
|
11852
11873
|
}
|
|
11853
11874
|
});
|
|
11854
11875
|
var TriggerMessageStatusSchema = z.union([z.enum(["available", "leased", "acked", "quarantined"]), z.string()]).describe("Message lifecycle status");
|
|
@@ -12037,7 +12058,7 @@ var leaseTriggerInboxMessagesPlugin = defineMethod({
|
|
|
12037
12058
|
}
|
|
12038
12059
|
}
|
|
12039
12060
|
);
|
|
12040
|
-
return LeaseTriggerInboxMessagesItemSchema.parse(rawResponse);
|
|
12061
|
+
return { data: LeaseTriggerInboxMessagesItemSchema.parse(rawResponse) };
|
|
12041
12062
|
}
|
|
12042
12063
|
});
|
|
12043
12064
|
var AckTriggerInboxMessagesSchema = z.object({
|
|
@@ -12087,7 +12108,7 @@ var ackTriggerInboxMessagesPlugin = defineMethod({
|
|
|
12087
12108
|
requestBody,
|
|
12088
12109
|
{ authRequired: true }
|
|
12089
12110
|
);
|
|
12090
|
-
return AckTriggerInboxMessagesItemSchema.parse(rawResponse);
|
|
12111
|
+
return { data: AckTriggerInboxMessagesItemSchema.parse(rawResponse) };
|
|
12091
12112
|
}
|
|
12092
12113
|
});
|
|
12093
12114
|
var ReleaseTriggerInboxMessagesSchema = z.object({
|
|
@@ -12137,7 +12158,7 @@ var releaseTriggerInboxMessagesPlugin = defineMethod({
|
|
|
12137
12158
|
requestBody,
|
|
12138
12159
|
{ authRequired: true }
|
|
12139
12160
|
);
|
|
12140
|
-
return ReleaseTriggerInboxMessagesItemSchema.parse(rawResponse);
|
|
12161
|
+
return { data: ReleaseTriggerInboxMessagesItemSchema.parse(rawResponse) };
|
|
12141
12162
|
}
|
|
12142
12163
|
});
|
|
12143
12164
|
|
|
@@ -13165,7 +13186,7 @@ var getTablePlugin = defineMethod({
|
|
|
13165
13186
|
resource: { type: "table", id: tableId }
|
|
13166
13187
|
});
|
|
13167
13188
|
const response = GetTableApiResponseSchema.parse(rawResponse);
|
|
13168
|
-
return transformTableItem(response.data);
|
|
13189
|
+
return { data: transformTableItem(response.data) };
|
|
13169
13190
|
}
|
|
13170
13191
|
});
|
|
13171
13192
|
var DeleteTableDescription = "Delete a table by its ID";
|
|
@@ -13225,7 +13246,7 @@ var createTablePlugin = defineMethod({
|
|
|
13225
13246
|
{ authRequired: true }
|
|
13226
13247
|
);
|
|
13227
13248
|
const response = CreateTableApiResponseSchema.parse(rawResponse);
|
|
13228
|
-
return transformTableItem(response.data);
|
|
13249
|
+
return { data: transformTableItem(response.data) };
|
|
13229
13250
|
}
|
|
13230
13251
|
});
|
|
13231
13252
|
|
|
@@ -13245,10 +13266,8 @@ var listTableFieldsPlugin = defineMethod({
|
|
|
13245
13266
|
imports: [apiPluginRef],
|
|
13246
13267
|
categories: tableCategories,
|
|
13247
13268
|
itemType: "Field",
|
|
13248
|
-
// A field list, but the API returns no cursor
|
|
13249
|
-
//
|
|
13250
|
-
// not an iterator). `output: "item"` reproduces that exactly (same boundary +
|
|
13251
|
-
// hooks; run returns the bare array, framework wraps to `{ data }`); the
|
|
13269
|
+
// A field list, but the API returns no cursor, so `output: "item"` returns
|
|
13270
|
+
// `{ data: FieldItem[] }` directly instead of a paginated iterator; the
|
|
13252
13271
|
// `type: "list"` first-class field keeps the list presentation.
|
|
13253
13272
|
type: "list",
|
|
13254
13273
|
inputSchema: ListTableFieldsOptionsInputSchema,
|
|
@@ -13277,7 +13296,7 @@ var listTableFieldsPlugin = defineMethod({
|
|
|
13277
13296
|
}
|
|
13278
13297
|
);
|
|
13279
13298
|
const response = ListTableFieldsApiResponseSchema.parse(rawResponse);
|
|
13280
|
-
return response.data.map(transformFieldItem);
|
|
13299
|
+
return { data: response.data.map(transformFieldItem) };
|
|
13281
13300
|
}
|
|
13282
13301
|
});
|
|
13283
13302
|
var FieldChangesetItemSchema = z.object({
|
|
@@ -13322,8 +13341,8 @@ var createTableFieldsPlugin = defineMethod({
|
|
|
13322
13341
|
returnType: "FieldItem[]",
|
|
13323
13342
|
inputSchema: CreateTableFieldsOptionsInputSchema,
|
|
13324
13343
|
outputSchema: FieldItemSchema,
|
|
13325
|
-
//
|
|
13326
|
-
//
|
|
13344
|
+
// Item output with an array payload: callers get `{ data: FieldItem[] }`
|
|
13345
|
+
// directly rather than a paginated list.
|
|
13327
13346
|
output: "item",
|
|
13328
13347
|
formatter: tableFieldItemFormatter,
|
|
13329
13348
|
resolvers: { table: tableIdResolver, fields: tableFieldsResolver },
|
|
@@ -13336,7 +13355,9 @@ var createTableFieldsPlugin = defineMethod({
|
|
|
13336
13355
|
{ authRequired: true, resource: { type: "table", id: tableId } }
|
|
13337
13356
|
);
|
|
13338
13357
|
const response = CreateTableFieldsApiResponseSchema.parse(rawResponse);
|
|
13339
|
-
return
|
|
13358
|
+
return {
|
|
13359
|
+
data: response.data.map((changeset) => transformFieldItem(changeset.new))
|
|
13360
|
+
};
|
|
13340
13361
|
}
|
|
13341
13362
|
});
|
|
13342
13363
|
var DeleteTableFieldsDescription = "Delete one or more fields from a table";
|
|
@@ -13477,8 +13498,10 @@ var getTableRecordPlugin = defineMethod({
|
|
|
13477
13498
|
keyMode: input.keyMode
|
|
13478
13499
|
});
|
|
13479
13500
|
return {
|
|
13480
|
-
|
|
13481
|
-
|
|
13501
|
+
data: {
|
|
13502
|
+
...transformRecordItem(response.data),
|
|
13503
|
+
data: translator.translateOutput(response.data.data)
|
|
13504
|
+
}
|
|
13482
13505
|
};
|
|
13483
13506
|
}
|
|
13484
13507
|
});
|
|
@@ -13657,8 +13680,8 @@ var createTableRecordsPlugin = defineMethod({
|
|
|
13657
13680
|
returnType: "RecordItem[]",
|
|
13658
13681
|
inputSchema: CreateTableRecordsOptionsInputSchema,
|
|
13659
13682
|
outputSchema: RecordItemSchema,
|
|
13660
|
-
//
|
|
13661
|
-
//
|
|
13683
|
+
// Item output with an array payload: callers get `{ data: RecordItem[] }`
|
|
13684
|
+
// directly rather than a paginated list.
|
|
13662
13685
|
output: "item",
|
|
13663
13686
|
resolvers: { table: tableIdResolver, records: tableRecordsResolver },
|
|
13664
13687
|
formatter: tableRecordFormatter,
|
|
@@ -13684,10 +13707,12 @@ var createTableRecordsPlugin = defineMethod({
|
|
|
13684
13707
|
for (const changeset of response.data) {
|
|
13685
13708
|
throwOnRecordErrors(changeset.new);
|
|
13686
13709
|
}
|
|
13687
|
-
return
|
|
13688
|
-
|
|
13689
|
-
|
|
13690
|
-
|
|
13710
|
+
return {
|
|
13711
|
+
data: response.data.map((changeset) => ({
|
|
13712
|
+
...transformRecordItem(changeset.new),
|
|
13713
|
+
data: translator.translateOutput(changeset.new.data)
|
|
13714
|
+
}))
|
|
13715
|
+
};
|
|
13691
13716
|
}
|
|
13692
13717
|
});
|
|
13693
13718
|
var DeleteTableRecordsDescription = "Delete one or more records from a table";
|
|
@@ -13767,8 +13792,8 @@ var updateTableRecordsPlugin = defineMethod({
|
|
|
13767
13792
|
returnType: "RecordItem[]",
|
|
13768
13793
|
inputSchema: UpdateTableRecordsOptionsInputSchema,
|
|
13769
13794
|
outputSchema: RecordItemSchema,
|
|
13770
|
-
//
|
|
13771
|
-
//
|
|
13795
|
+
// Item output with an array payload: callers get `{ data: RecordItem[] }`
|
|
13796
|
+
// directly rather than a paginated list.
|
|
13772
13797
|
output: "item",
|
|
13773
13798
|
resolvers: { table: tableIdResolver, records: tableUpdateRecordsResolver },
|
|
13774
13799
|
formatter: tableRecordFormatter,
|
|
@@ -13795,10 +13820,12 @@ var updateTableRecordsPlugin = defineMethod({
|
|
|
13795
13820
|
for (const changeset of response.data) {
|
|
13796
13821
|
throwOnRecordErrors(changeset.new);
|
|
13797
13822
|
}
|
|
13798
|
-
return
|
|
13799
|
-
|
|
13800
|
-
|
|
13801
|
-
|
|
13823
|
+
return {
|
|
13824
|
+
data: response.data.map((changeset) => ({
|
|
13825
|
+
...transformRecordItem(changeset.new),
|
|
13826
|
+
data: translator.translateOutput(changeset.new.data)
|
|
13827
|
+
}))
|
|
13828
|
+
};
|
|
13802
13829
|
}
|
|
13803
13830
|
});
|
|
13804
13831
|
var RelayRequestSchema = z.object({
|
|
@@ -14673,6 +14700,8 @@ var codeSubstrateDefaults = {
|
|
|
14673
14700
|
categories: ["code-workflow"],
|
|
14674
14701
|
experimental: true
|
|
14675
14702
|
};
|
|
14703
|
+
var CODE_SUBSTRATE_RUNNER_API = "/code-substrate-runner/api/v0";
|
|
14704
|
+
var CODE_SUBSTRATE_WORKFLOWS_API = "/code-substrate-workflows/api/v0";
|
|
14676
14705
|
var JsonPayloadSchema = z.preprocess((val) => {
|
|
14677
14706
|
if (typeof val === "string") {
|
|
14678
14707
|
const trimmed = val.trim();
|
|
@@ -14865,7 +14894,7 @@ var listWorkflowsPlugin = defineMethod({
|
|
|
14865
14894
|
if (input.cursor) {
|
|
14866
14895
|
searchParams.cursor = input.cursor;
|
|
14867
14896
|
}
|
|
14868
|
-
const raw = await api.get(
|
|
14897
|
+
const raw = await api.get(`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows`, {
|
|
14869
14898
|
searchParams,
|
|
14870
14899
|
authRequired: true
|
|
14871
14900
|
});
|
|
@@ -14884,7 +14913,7 @@ var WorkflowVersionSchema = z.object({
|
|
|
14884
14913
|
"Pinned semver of @zapier/zapier-durable used by this version's runs"
|
|
14885
14914
|
),
|
|
14886
14915
|
dependencies: z.record(z.string(), z.string()).nullable().describe("Additional npm dependencies pinned for this version (or null)"),
|
|
14887
|
-
// Backend column is NOT NULL (see
|
|
14916
|
+
// Backend column is NOT NULL (see code-substrate-workflows prisma schema:
|
|
14888
14917
|
// workflow_versions.created_by_user_id), so this is always emitted.
|
|
14889
14918
|
created_by_user_id: z.string().describe("ID of the user who published this version"),
|
|
14890
14919
|
created_at: z.string().describe("When the version was published (ISO-8601)"),
|
|
@@ -14938,13 +14967,13 @@ var getWorkflowPlugin = defineMethod({
|
|
|
14938
14967
|
run: async ({ imports, input }) => {
|
|
14939
14968
|
const api = imports.api;
|
|
14940
14969
|
const raw = await api.get(
|
|
14941
|
-
|
|
14970
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows/${encodeURIComponent(input.workflow)}`,
|
|
14942
14971
|
{
|
|
14943
14972
|
authRequired: true,
|
|
14944
14973
|
resource: { type: "workflow", id: input.workflow }
|
|
14945
14974
|
}
|
|
14946
14975
|
);
|
|
14947
|
-
return GetWorkflowResponseSchema.parse(raw);
|
|
14976
|
+
return { data: GetWorkflowResponseSchema.parse(raw) };
|
|
14948
14977
|
}
|
|
14949
14978
|
});
|
|
14950
14979
|
var CreateWorkflowOptionsSchema = z.object({
|
|
@@ -14995,10 +15024,14 @@ var createWorkflowPlugin = defineMethod({
|
|
|
14995
15024
|
if (isPrivate !== void 0) {
|
|
14996
15025
|
body.is_private = isPrivate;
|
|
14997
15026
|
}
|
|
14998
|
-
const raw = await api.post(
|
|
14999
|
-
|
|
15000
|
-
|
|
15001
|
-
|
|
15027
|
+
const raw = await api.post(
|
|
15028
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows`,
|
|
15029
|
+
body,
|
|
15030
|
+
{
|
|
15031
|
+
authRequired: true
|
|
15032
|
+
}
|
|
15033
|
+
);
|
|
15034
|
+
return { data: CreateWorkflowResponseSchema.parse(raw) };
|
|
15002
15035
|
}
|
|
15003
15036
|
});
|
|
15004
15037
|
var UpdateWorkflowOptionsSchema = z.object({
|
|
@@ -15043,14 +15076,14 @@ var updateWorkflowPlugin = defineMethod({
|
|
|
15043
15076
|
body.description = input.description;
|
|
15044
15077
|
}
|
|
15045
15078
|
const raw = await api.patch(
|
|
15046
|
-
|
|
15079
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows/${encodeURIComponent(input.workflow)}`,
|
|
15047
15080
|
body,
|
|
15048
15081
|
{
|
|
15049
15082
|
authRequired: true,
|
|
15050
15083
|
resource: { type: "workflow", id: input.workflow }
|
|
15051
15084
|
}
|
|
15052
15085
|
);
|
|
15053
|
-
return UpdateWorkflowResponseSchema.parse(raw);
|
|
15086
|
+
return { data: UpdateWorkflowResponseSchema.parse(raw) };
|
|
15054
15087
|
}
|
|
15055
15088
|
});
|
|
15056
15089
|
var EnableWorkflowOptionsSchema = z.object({
|
|
@@ -15075,14 +15108,14 @@ var enableWorkflowPlugin = defineMethod({
|
|
|
15075
15108
|
run: async ({ imports, input }) => {
|
|
15076
15109
|
const api = imports.api;
|
|
15077
15110
|
const raw = await api.post(
|
|
15078
|
-
|
|
15111
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows/${encodeURIComponent(input.workflow)}/enable`,
|
|
15079
15112
|
void 0,
|
|
15080
15113
|
{
|
|
15081
15114
|
authRequired: true,
|
|
15082
15115
|
resource: { type: "workflow", id: input.workflow }
|
|
15083
15116
|
}
|
|
15084
15117
|
);
|
|
15085
|
-
return EnableWorkflowResponseSchema.parse(raw);
|
|
15118
|
+
return { data: EnableWorkflowResponseSchema.parse(raw) };
|
|
15086
15119
|
}
|
|
15087
15120
|
});
|
|
15088
15121
|
var DisableWorkflowOptionsSchema = z.object({
|
|
@@ -15109,14 +15142,14 @@ var disableWorkflowPlugin = defineMethod({
|
|
|
15109
15142
|
run: async ({ imports, input }) => {
|
|
15110
15143
|
const api = imports.api;
|
|
15111
15144
|
const raw = await api.post(
|
|
15112
|
-
|
|
15145
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows/${encodeURIComponent(input.workflow)}/disable`,
|
|
15113
15146
|
void 0,
|
|
15114
15147
|
{
|
|
15115
15148
|
authRequired: true,
|
|
15116
15149
|
resource: { type: "workflow", id: input.workflow }
|
|
15117
15150
|
}
|
|
15118
15151
|
);
|
|
15119
|
-
return DisableWorkflowResponseSchema.parse(raw);
|
|
15152
|
+
return { data: DisableWorkflowResponseSchema.parse(raw) };
|
|
15120
15153
|
}
|
|
15121
15154
|
});
|
|
15122
15155
|
var DeleteWorkflowOptionsSchema = z.object({
|
|
@@ -15143,7 +15176,7 @@ var deleteWorkflowPlugin = defineMethod({
|
|
|
15143
15176
|
run: async ({ imports, input }) => {
|
|
15144
15177
|
const api = imports.api;
|
|
15145
15178
|
await api.delete(
|
|
15146
|
-
|
|
15179
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows/${encodeURIComponent(input.workflow)}`,
|
|
15147
15180
|
void 0,
|
|
15148
15181
|
{
|
|
15149
15182
|
authRequired: true,
|
|
@@ -15220,7 +15253,7 @@ var listDurableRunsPlugin = defineMethod({
|
|
|
15220
15253
|
if (input.cursor) {
|
|
15221
15254
|
searchParams.cursor = input.cursor;
|
|
15222
15255
|
}
|
|
15223
|
-
const raw = await api.get(
|
|
15256
|
+
const raw = await api.get(`${CODE_SUBSTRATE_RUNNER_API}/runs`, {
|
|
15224
15257
|
searchParams,
|
|
15225
15258
|
authRequired: true
|
|
15226
15259
|
});
|
|
@@ -15333,13 +15366,13 @@ var getDurableRunPlugin = defineMethod({
|
|
|
15333
15366
|
run: async ({ imports, input }) => {
|
|
15334
15367
|
const api = imports.api;
|
|
15335
15368
|
const raw = await api.get(
|
|
15336
|
-
|
|
15369
|
+
`${CODE_SUBSTRATE_RUNNER_API}/runs/${encodeURIComponent(input.run)}`,
|
|
15337
15370
|
{
|
|
15338
15371
|
authRequired: true,
|
|
15339
15372
|
resource: { type: "run", id: input.run }
|
|
15340
15373
|
}
|
|
15341
15374
|
);
|
|
15342
|
-
return GetDurableRunResponseSchema.parse(raw);
|
|
15375
|
+
return { data: GetDurableRunResponseSchema.parse(raw) };
|
|
15343
15376
|
}
|
|
15344
15377
|
});
|
|
15345
15378
|
var RunNotificationEventSchema = z.enum(["started", "progress", "completed", "error", "cancelled"]).describe("Run lifecycle event this notification subscribes to");
|
|
@@ -15378,7 +15411,7 @@ var RunDurableBaseSchema = z.object({
|
|
|
15378
15411
|
"Webhook subscribers for run lifecycle events. Each entry specifies a URL and the events it subscribes to."
|
|
15379
15412
|
)
|
|
15380
15413
|
});
|
|
15381
|
-
var RunDurableDescription = "Run a workflow source file as a run-once durable run on
|
|
15414
|
+
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.";
|
|
15382
15415
|
var RunDurableSchema = z.object({ sourceFiles: SourceFilesSchema }).merge(RunDurableBaseSchema).describe(RunDurableDescription).meta({
|
|
15383
15416
|
aliases: {
|
|
15384
15417
|
source_files: "sourceFiles",
|
|
@@ -15436,10 +15469,10 @@ var runDurablePlugin = defineMethod({
|
|
|
15436
15469
|
if (input.notifications !== void 0) {
|
|
15437
15470
|
body.notifications = input.notifications;
|
|
15438
15471
|
}
|
|
15439
|
-
const raw = await api.post(
|
|
15472
|
+
const raw = await api.post(`${CODE_SUBSTRATE_RUNNER_API}/runs`, body, {
|
|
15440
15473
|
authRequired: true
|
|
15441
15474
|
});
|
|
15442
|
-
return RunDurableResponseSchema.parse(raw);
|
|
15475
|
+
return { data: RunDurableResponseSchema.parse(raw) };
|
|
15443
15476
|
}
|
|
15444
15477
|
});
|
|
15445
15478
|
var CancelDurableRunOptionsSchema = z.object({
|
|
@@ -15468,14 +15501,14 @@ var cancelDurableRunPlugin = defineMethod({
|
|
|
15468
15501
|
run: async ({ imports, input }) => {
|
|
15469
15502
|
const api = imports.api;
|
|
15470
15503
|
await api.post(
|
|
15471
|
-
|
|
15504
|
+
`${CODE_SUBSTRATE_RUNNER_API}/runs/${encodeURIComponent(input.run)}/cancel`,
|
|
15472
15505
|
void 0,
|
|
15473
15506
|
{
|
|
15474
15507
|
authRequired: true,
|
|
15475
15508
|
resource: { type: "run", id: input.run }
|
|
15476
15509
|
}
|
|
15477
15510
|
);
|
|
15478
|
-
return { id: input.run, status: "cancelled" };
|
|
15511
|
+
return { data: { id: input.run, status: "cancelled" } };
|
|
15479
15512
|
}
|
|
15480
15513
|
});
|
|
15481
15514
|
var TriggerConfigSchema = z.object({
|
|
@@ -15609,14 +15642,14 @@ var publishWorkflowVersionPlugin = defineMethod({
|
|
|
15609
15642
|
body.trigger = toWireTrigger(input.trigger);
|
|
15610
15643
|
}
|
|
15611
15644
|
const raw = await api.post(
|
|
15612
|
-
|
|
15645
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows/${encodeURIComponent(input.workflow)}/versions`,
|
|
15613
15646
|
body,
|
|
15614
15647
|
{
|
|
15615
15648
|
authRequired: true,
|
|
15616
15649
|
resource: { type: "workflow", id: input.workflow }
|
|
15617
15650
|
}
|
|
15618
15651
|
);
|
|
15619
|
-
return PublishWorkflowVersionResponseSchema.parse(raw);
|
|
15652
|
+
return { data: PublishWorkflowVersionResponseSchema.parse(raw) };
|
|
15620
15653
|
}
|
|
15621
15654
|
});
|
|
15622
15655
|
var WorkflowVersionListItemSchema = z.object({
|
|
@@ -15675,7 +15708,7 @@ var listWorkflowVersionsPlugin = defineMethod({
|
|
|
15675
15708
|
searchParams.cursor = input.cursor;
|
|
15676
15709
|
}
|
|
15677
15710
|
const raw = await api.get(
|
|
15678
|
-
|
|
15711
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows/${encodeURIComponent(input.workflow)}/versions`,
|
|
15679
15712
|
{
|
|
15680
15713
|
searchParams,
|
|
15681
15714
|
authRequired: true,
|
|
@@ -15726,13 +15759,13 @@ var getWorkflowVersionPlugin = defineMethod({
|
|
|
15726
15759
|
run: async ({ imports, input }) => {
|
|
15727
15760
|
const api = imports.api;
|
|
15728
15761
|
const raw = await api.get(
|
|
15729
|
-
|
|
15762
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows/${encodeURIComponent(input.workflow)}/versions/${encodeURIComponent(input.version)}`,
|
|
15730
15763
|
{
|
|
15731
15764
|
authRequired: true,
|
|
15732
15765
|
resource: { type: "workflow-version", id: input.version }
|
|
15733
15766
|
}
|
|
15734
15767
|
);
|
|
15735
|
-
return GetWorkflowVersionResponseSchema.parse(raw);
|
|
15768
|
+
return { data: GetWorkflowVersionResponseSchema.parse(raw) };
|
|
15736
15769
|
}
|
|
15737
15770
|
});
|
|
15738
15771
|
var WorkflowRunStatusSchema = z.union([
|
|
@@ -15747,7 +15780,7 @@ var WorkflowRunListItemSchema = z.object({
|
|
|
15747
15780
|
"ID of the trigger that fired this run, if any. Null for runs created without a trigger."
|
|
15748
15781
|
),
|
|
15749
15782
|
durable_run_id: z.string().nullable().describe(
|
|
15750
|
-
"Linked
|
|
15783
|
+
"Linked code-substrate-runner run ID. Null until the durable run is created."
|
|
15751
15784
|
),
|
|
15752
15785
|
workflow_version_id: z.string().nullable().describe("Workflow version the run is bound to. Null in rare edge cases."),
|
|
15753
15786
|
status: WorkflowRunStatusSchema,
|
|
@@ -15803,7 +15836,7 @@ var listWorkflowRunsPlugin = defineMethod({
|
|
|
15803
15836
|
searchParams.cursor = input.cursor;
|
|
15804
15837
|
}
|
|
15805
15838
|
const raw = await api.get(
|
|
15806
|
-
|
|
15839
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows/${encodeURIComponent(input.workflow)}/runs`,
|
|
15807
15840
|
{
|
|
15808
15841
|
searchParams,
|
|
15809
15842
|
authRequired: true,
|
|
@@ -15833,7 +15866,7 @@ var GetWorkflowRunResponseSchema = z.object({
|
|
|
15833
15866
|
id: z.string().describe("Workflow run ID (UUID)"),
|
|
15834
15867
|
trigger_id: z.string().nullable().describe("ID of the trigger that fired this run, if any"),
|
|
15835
15868
|
durable_run_id: z.string().nullable().describe(
|
|
15836
|
-
"Linked
|
|
15869
|
+
"Linked code-substrate-runner run ID. Null until the durable run is created."
|
|
15837
15870
|
),
|
|
15838
15871
|
workflow_version_id: z.string().nullable().describe("Workflow version the run is bound to"),
|
|
15839
15872
|
status: WorkflowRunStatusSchema,
|
|
@@ -15860,13 +15893,13 @@ var getWorkflowRunPlugin = defineMethod({
|
|
|
15860
15893
|
run: async ({ imports, input }) => {
|
|
15861
15894
|
const api = imports.api;
|
|
15862
15895
|
const raw = await api.get(
|
|
15863
|
-
|
|
15896
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows/runs/${encodeURIComponent(input.run)}`,
|
|
15864
15897
|
{
|
|
15865
15898
|
authRequired: true,
|
|
15866
15899
|
resource: { type: "workflow-run", id: input.run }
|
|
15867
15900
|
}
|
|
15868
15901
|
);
|
|
15869
|
-
return GetWorkflowRunResponseSchema.parse(raw);
|
|
15902
|
+
return { data: GetWorkflowRunResponseSchema.parse(raw) };
|
|
15870
15903
|
}
|
|
15871
15904
|
});
|
|
15872
15905
|
var GetTriggerRunOptionsSchema = z.object({
|
|
@@ -15877,7 +15910,7 @@ var GetTriggerRunOptionsSchema = z.object({
|
|
|
15877
15910
|
var GetTriggerRunResponseSchema = z.object({
|
|
15878
15911
|
id: z.string().describe("Workflow run ID (UUID)"),
|
|
15879
15912
|
durable_run_id: z.string().nullable().describe(
|
|
15880
|
-
"Linked
|
|
15913
|
+
"Linked code-substrate-runner run ID. Null until the durable run is created."
|
|
15881
15914
|
),
|
|
15882
15915
|
workflow_version_id: z.string().nullable().describe("Workflow version the run is bound to"),
|
|
15883
15916
|
status: WorkflowRunStatusSchema,
|
|
@@ -15904,13 +15937,13 @@ var getTriggerRunPlugin = defineMethod({
|
|
|
15904
15937
|
run: async ({ imports, input }) => {
|
|
15905
15938
|
const api = imports.api;
|
|
15906
15939
|
const raw = await api.get(
|
|
15907
|
-
|
|
15940
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows/triggers/${encodeURIComponent(input.trigger)}/run`,
|
|
15908
15941
|
{
|
|
15909
15942
|
authRequired: true,
|
|
15910
15943
|
resource: { type: "workflow-trigger", id: input.trigger }
|
|
15911
15944
|
}
|
|
15912
15945
|
);
|
|
15913
|
-
return GetTriggerRunResponseSchema.parse(raw);
|
|
15946
|
+
return { data: GetTriggerRunResponseSchema.parse(raw) };
|
|
15914
15947
|
}
|
|
15915
15948
|
});
|
|
15916
15949
|
var TriggerWorkflowLookupResponseSchema = z.object({
|
|
@@ -15944,7 +15977,7 @@ var triggerWorkflowPlugin = defineMethod({
|
|
|
15944
15977
|
run: async ({ imports, input }) => {
|
|
15945
15978
|
const api = imports.api;
|
|
15946
15979
|
const rawWorkflow = await api.get(
|
|
15947
|
-
|
|
15980
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows/${encodeURIComponent(input.workflow)}`,
|
|
15948
15981
|
{
|
|
15949
15982
|
authRequired: true,
|
|
15950
15983
|
resource: { type: "workflow", id: input.workflow }
|
|
@@ -15960,14 +15993,14 @@ var triggerWorkflowPlugin = defineMethod({
|
|
|
15960
15993
|
);
|
|
15961
15994
|
}
|
|
15962
15995
|
const raw = await api.post(
|
|
15963
|
-
|
|
15996
|
+
`${CODE_SUBSTRATE_WORKFLOWS_API}/workflows/trigger/${encodeURIComponent(triggerToken)}`,
|
|
15964
15997
|
input.input,
|
|
15965
15998
|
{
|
|
15966
15999
|
authRequired: true,
|
|
15967
16000
|
resource: { type: "workflow", id: input.workflow }
|
|
15968
16001
|
}
|
|
15969
16002
|
);
|
|
15970
|
-
return TriggerWorkflowResponseSchema.parse(raw);
|
|
16003
|
+
return { data: TriggerWorkflowResponseSchema.parse(raw) };
|
|
15971
16004
|
}
|
|
15972
16005
|
});
|
|
15973
16006
|
|