@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/dist/index.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
  {
@@ -5342,7 +5340,7 @@ function parseDeprecationDate(value) {
5342
5340
  }
5343
5341
 
5344
5342
  // src/sdk-version.ts
5345
- var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.83.3" : void 0) || "unknown";
5343
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.84.1" : void 0) || "unknown";
5346
5344
 
5347
5345
  // src/utils/open-url.ts
5348
5346
  var nodePrefix = "node:";
@@ -5560,6 +5558,18 @@ var pathConfig = {
5560
5558
  "/durableworkflowzaps": {
5561
5559
  authHeader: "Authorization",
5562
5560
  pathPrefix: "/api/v0/sdk/durableworkflowzaps"
5561
+ },
5562
+ // e.g. /code-substrate-runner -> https://sdkapi.zapier.com/api/v0/sdk/code-substrate-runner/...
5563
+ // sdkapi proxies to the code-substrate-runner backend.
5564
+ "/code-substrate-runner": {
5565
+ authHeader: "Authorization",
5566
+ pathPrefix: "/api/v0/sdk/code-substrate-runner"
5567
+ },
5568
+ // e.g. /code-substrate-workflows -> https://sdkapi.zapier.com/api/v0/sdk/code-substrate-workflows/...
5569
+ // sdkapi proxies to the code-substrate-workflows backend.
5570
+ "/code-substrate-workflows": {
5571
+ authHeader: "Authorization",
5572
+ pathPrefix: "/api/v0/sdk/code-substrate-workflows"
5563
5573
  }
5564
5574
  };
5565
5575
  var ZapierApiClient = class {
@@ -9321,7 +9331,7 @@ var getActionPlugin = defineMethod({
9321
9331
  });
9322
9332
  for await (const action of imports.listActions({ app: appKey }).items()) {
9323
9333
  if ((action.key === actionKey || action.id === actionKey) && action.action_type === actionType) {
9324
- return action;
9334
+ return { data: action };
9325
9335
  }
9326
9336
  }
9327
9337
  throw new ZapierResourceNotFoundError(
@@ -10430,7 +10440,10 @@ var getActionInputFieldsSchemaPlugin = defineMethod({
10430
10440
  connection: connectionIdResolver,
10431
10441
  inputs: inputsAllOptionalResolver
10432
10442
  },
10433
- run: async ({ imports, input }) => {
10443
+ run: async ({
10444
+ imports,
10445
+ input
10446
+ }) => {
10434
10447
  const api = imports.api;
10435
10448
  const getVersionedImplementationId = imports.manifest.getVersionedImplementationId;
10436
10449
  const resolveConnection = imports.connections.resolveConnection;
@@ -10468,7 +10481,7 @@ var getActionInputFieldsSchemaPlugin = defineMethod({
10468
10481
  connectionId: resolvedConnectionId ?? null,
10469
10482
  inputs
10470
10483
  });
10471
- return needsData.schema || {};
10484
+ return { data: needsData.schema || {} };
10472
10485
  }
10473
10486
  });
10474
10487
  var ListConnectionsQuerySchema = ListConnectionsQuerySchema$1.omit({
@@ -10759,7 +10772,7 @@ var createClientCredentialsPlugin = defineMethod({
10759
10772
  requiredScopes: ["credentials"]
10760
10773
  }
10761
10774
  );
10762
- return response.data;
10775
+ return { data: response.data };
10763
10776
  }
10764
10777
  });
10765
10778
  var DeleteClientCredentialsSchema = z.object({
@@ -10813,7 +10826,7 @@ var getAppPlugin = defineMethod({
10813
10826
  run: async ({ imports, input }) => {
10814
10827
  const appKey = "app" in input ? input.app : input.appKey;
10815
10828
  for await (const app of imports.listApps({ apps: [appKey] }).items()) {
10816
- return app;
10829
+ return { data: app };
10817
10830
  }
10818
10831
  throw new ZapierAppNotFoundError("App not found", { appKey });
10819
10832
  }
@@ -10859,7 +10872,7 @@ var getConnectionPlugin = defineMethod({
10859
10872
  }
10860
10873
  }
10861
10874
  );
10862
- return transformConnectionItem(response.data);
10875
+ return { data: transformConnectionItem(response.data) };
10863
10876
  }
10864
10877
  });
10865
10878
 
@@ -10894,7 +10907,7 @@ var findFirstConnectionPlugin = defineMethod({
10894
10907
  { resourceType: "Connection" }
10895
10908
  );
10896
10909
  }
10897
- return connectionsResponse.data[0];
10910
+ return { data: connectionsResponse.data[0] };
10898
10911
  }
10899
10912
  });
10900
10913
 
@@ -10935,7 +10948,7 @@ var findUniqueConnectionPlugin = defineMethod({
10935
10948
  "Multiple connections found matching the specified criteria. Expected exactly one."
10936
10949
  );
10937
10950
  }
10938
- return connectionsResponse.data[0];
10951
+ return { data: connectionsResponse.data[0] };
10939
10952
  }
10940
10953
  });
10941
10954
  var RelayRequestSchema = z.object({
@@ -11050,13 +11063,15 @@ var getProfilePlugin = defineMethod({
11050
11063
  authRequired: true
11051
11064
  });
11052
11065
  return {
11053
- id: String(profile.public_id ?? profile.id),
11054
- first_name: profile.first_name,
11055
- last_name: profile.last_name,
11056
- full_name: `${profile.first_name} ${profile.last_name}`,
11057
- email: profile.email,
11058
- email_confirmed: profile.email_confirmed,
11059
- timezone: profile.timezone
11066
+ data: {
11067
+ id: String(profile.public_id ?? profile.id),
11068
+ first_name: profile.first_name,
11069
+ last_name: profile.last_name,
11070
+ full_name: `${profile.first_name} ${profile.last_name}`,
11071
+ email: profile.email,
11072
+ email_confirmed: profile.email_confirmed,
11073
+ timezone: profile.timezone
11074
+ }
11060
11075
  };
11061
11076
  }
11062
11077
  });
@@ -11113,12 +11128,14 @@ var getConnectionStartUrlPlugin = defineMethod({
11113
11128
  { selected_api: selectedApi },
11114
11129
  { authRequired: true }
11115
11130
  );
11116
- return GetConnectionStartUrlItemSchema.parse({
11117
- url: response.url,
11118
- expiresAt: response.expires_at,
11119
- startedAt: response.started_at,
11120
- app: selectedApi
11121
- });
11131
+ return {
11132
+ data: GetConnectionStartUrlItemSchema.parse({
11133
+ url: response.url,
11134
+ expiresAt: response.expires_at,
11135
+ startedAt: response.started_at,
11136
+ app: selectedApi
11137
+ })
11138
+ };
11122
11139
  }
11123
11140
  });
11124
11141
  var WaitForNewConnectionSchema = z.object({
@@ -11192,11 +11209,13 @@ var waitForNewConnectionPlugin = defineMethod({
11192
11209
  body.data[0]
11193
11210
  )
11194
11211
  });
11195
- return WaitForNewConnectionItemSchema.parse({
11196
- id: String(top.public_id ?? top.id),
11197
- app: appKey,
11198
- title: top.title ?? null
11199
- });
11212
+ return {
11213
+ data: WaitForNewConnectionItemSchema.parse({
11214
+ id: String(top.public_id ?? top.id),
11215
+ app: appKey,
11216
+ title: top.title ?? null
11217
+ })
11218
+ };
11200
11219
  } catch (err) {
11201
11220
  if (err instanceof ZapierTimeoutError) {
11202
11221
  throw new ZapierTimeoutError(
@@ -11297,11 +11316,13 @@ Open this URL to complete the connection:
11297
11316
  timeoutMs: input.timeoutMs,
11298
11317
  pollIntervalMs: input.pollIntervalMs
11299
11318
  });
11300
- return CreateConnectionItemSchema.parse({
11301
- id: fresh.id,
11302
- app: start2.app,
11303
- title: fresh.title ?? null
11304
- });
11319
+ return {
11320
+ data: CreateConnectionItemSchema.parse({
11321
+ id: fresh.id,
11322
+ app: start2.app,
11323
+ title: fresh.title ?? null
11324
+ })
11325
+ };
11305
11326
  }
11306
11327
  });
11307
11328
 
@@ -11638,7 +11659,7 @@ var createTriggerInboxPlugin = defineMethod({
11638
11659
  }
11639
11660
  }
11640
11661
  );
11641
- return TriggerInboxItemSchema.parse(rawResponse);
11662
+ return { data: TriggerInboxItemSchema.parse(rawResponse) };
11642
11663
  }
11643
11664
  });
11644
11665
  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.";
@@ -11739,7 +11760,7 @@ var ensureTriggerInboxPlugin = defineMethod({
11739
11760
  }
11740
11761
  }
11741
11762
  );
11742
- return TriggerInboxItemSchema.parse(rawResponse);
11763
+ return { data: TriggerInboxItemSchema.parse(rawResponse) };
11743
11764
  }
11744
11765
  });
11745
11766
  var ListTriggerInboxesSchema = z.object({
@@ -11834,7 +11855,7 @@ var getTriggerInboxPlugin = defineMethod({
11834
11855
  resource: { type: "trigger_inbox", id: inboxId }
11835
11856
  }
11836
11857
  );
11837
- return TriggerInboxItemSchema.parse(rawResponse);
11858
+ return { data: TriggerInboxItemSchema.parse(rawResponse) };
11838
11859
  }
11839
11860
  });
11840
11861
  var UpdateTriggerInboxSchema = z.object({
@@ -11872,7 +11893,7 @@ var updateTriggerInboxPlugin = defineMethod({
11872
11893
  resource: { type: "trigger_inbox", id: inboxId }
11873
11894
  }
11874
11895
  );
11875
- return TriggerInboxItemSchema.parse(rawResponse);
11896
+ return { data: TriggerInboxItemSchema.parse(rawResponse) };
11876
11897
  }
11877
11898
  });
11878
11899
  var DeleteTriggerInboxSchema = z.object({
@@ -11937,7 +11958,7 @@ var pauseTriggerInboxPlugin = defineMethod({
11937
11958
  resource: { type: "trigger_inbox", id: inboxId }
11938
11959
  }
11939
11960
  );
11940
- return TriggerInboxItemSchema.parse(rawResponse);
11961
+ return { data: TriggerInboxItemSchema.parse(rawResponse) };
11941
11962
  }
11942
11963
  });
11943
11964
  var ResumeTriggerInboxSchema = z.object({
@@ -11968,7 +11989,7 @@ var resumeTriggerInboxPlugin = defineMethod({
11968
11989
  resource: { type: "trigger_inbox", id: inboxId }
11969
11990
  }
11970
11991
  );
11971
- return TriggerInboxItemSchema.parse(rawResponse);
11992
+ return { data: TriggerInboxItemSchema.parse(rawResponse) };
11972
11993
  }
11973
11994
  });
11974
11995
  var TriggerMessageStatusSchema = z.union([z.enum(["available", "leased", "acked", "quarantined"]), z.string()]).describe("Message lifecycle status");
@@ -12157,7 +12178,7 @@ var leaseTriggerInboxMessagesPlugin = defineMethod({
12157
12178
  }
12158
12179
  }
12159
12180
  );
12160
- return LeaseTriggerInboxMessagesItemSchema.parse(rawResponse);
12181
+ return { data: LeaseTriggerInboxMessagesItemSchema.parse(rawResponse) };
12161
12182
  }
12162
12183
  });
12163
12184
  var AckTriggerInboxMessagesSchema = z.object({
@@ -12207,7 +12228,7 @@ var ackTriggerInboxMessagesPlugin = defineMethod({
12207
12228
  requestBody,
12208
12229
  { authRequired: true }
12209
12230
  );
12210
- return AckTriggerInboxMessagesItemSchema.parse(rawResponse);
12231
+ return { data: AckTriggerInboxMessagesItemSchema.parse(rawResponse) };
12211
12232
  }
12212
12233
  });
12213
12234
  var ReleaseTriggerInboxMessagesSchema = z.object({
@@ -12257,7 +12278,7 @@ var releaseTriggerInboxMessagesPlugin = defineMethod({
12257
12278
  requestBody,
12258
12279
  { authRequired: true }
12259
12280
  );
12260
- return ReleaseTriggerInboxMessagesItemSchema.parse(rawResponse);
12281
+ return { data: ReleaseTriggerInboxMessagesItemSchema.parse(rawResponse) };
12261
12282
  }
12262
12283
  });
12263
12284
 
@@ -13222,7 +13243,7 @@ var getTablePlugin = defineMethod({
13222
13243
  resource: { type: "table", id: tableId }
13223
13244
  });
13224
13245
  const response = GetTableApiResponseSchema.parse(rawResponse);
13225
- return transformTableItem(response.data);
13246
+ return { data: transformTableItem(response.data) };
13226
13247
  }
13227
13248
  });
13228
13249
  var DeleteTableDescription = "Delete a table by its ID";
@@ -13282,7 +13303,7 @@ var createTablePlugin = defineMethod({
13282
13303
  { authRequired: true }
13283
13304
  );
13284
13305
  const response = CreateTableApiResponseSchema.parse(rawResponse);
13285
- return transformTableItem(response.data);
13306
+ return { data: transformTableItem(response.data) };
13286
13307
  }
13287
13308
  });
13288
13309
 
@@ -13302,10 +13323,8 @@ var listTableFieldsPlugin = defineMethod({
13302
13323
  imports: [apiPluginRef],
13303
13324
  categories: tableCategories,
13304
13325
  itemType: "Field",
13305
- // A field list, but the API returns no cursor: legacy used the non-paginated
13306
- // createPluginMethod (a `createFunction` boundary returning a bare `{ data }`,
13307
- // not an iterator). `output: "item"` reproduces that exactly (same boundary +
13308
- // hooks; run returns the bare array, framework wraps to `{ data }`); the
13326
+ // A field list, but the API returns no cursor, so `output: "item"` returns
13327
+ // `{ data: FieldItem[] }` directly instead of a paginated iterator; the
13309
13328
  // `type: "list"` first-class field keeps the list presentation.
13310
13329
  type: "list",
13311
13330
  inputSchema: ListTableFieldsOptionsInputSchema,
@@ -13334,7 +13353,7 @@ var listTableFieldsPlugin = defineMethod({
13334
13353
  }
13335
13354
  );
13336
13355
  const response = ListTableFieldsApiResponseSchema.parse(rawResponse);
13337
- return response.data.map(transformFieldItem);
13356
+ return { data: response.data.map(transformFieldItem) };
13338
13357
  }
13339
13358
  });
13340
13359
  var FieldChangesetItemSchema = z.object({
@@ -13379,8 +13398,8 @@ var createTableFieldsPlugin = defineMethod({
13379
13398
  returnType: "FieldItem[]",
13380
13399
  inputSchema: CreateTableFieldsOptionsInputSchema,
13381
13400
  outputSchema: FieldItemSchema,
13382
- // `run` returns the field array; `output: "item"` wraps it in `{ data }` to
13383
- // match the legacy `{ data: FieldItem[] }` surface.
13401
+ // Item output with an array payload: callers get `{ data: FieldItem[] }`
13402
+ // directly rather than a paginated list.
13384
13403
  output: "item",
13385
13404
  formatter: tableFieldItemFormatter,
13386
13405
  resolvers: { table: tableIdResolver, fields: tableFieldsResolver },
@@ -13393,7 +13412,9 @@ var createTableFieldsPlugin = defineMethod({
13393
13412
  { authRequired: true, resource: { type: "table", id: tableId } }
13394
13413
  );
13395
13414
  const response = CreateTableFieldsApiResponseSchema.parse(rawResponse);
13396
- return response.data.map((changeset) => transformFieldItem(changeset.new));
13415
+ return {
13416
+ data: response.data.map((changeset) => transformFieldItem(changeset.new))
13417
+ };
13397
13418
  }
13398
13419
  });
13399
13420
  var DeleteTableFieldsDescription = "Delete one or more fields from a table";
@@ -13534,8 +13555,10 @@ var getTableRecordPlugin = defineMethod({
13534
13555
  keyMode: input.keyMode
13535
13556
  });
13536
13557
  return {
13537
- ...transformRecordItem(response.data),
13538
- data: translator.translateOutput(response.data.data)
13558
+ data: {
13559
+ ...transformRecordItem(response.data),
13560
+ data: translator.translateOutput(response.data.data)
13561
+ }
13539
13562
  };
13540
13563
  }
13541
13564
  });
@@ -13714,8 +13737,8 @@ var createTableRecordsPlugin = defineMethod({
13714
13737
  returnType: "RecordItem[]",
13715
13738
  inputSchema: CreateTableRecordsOptionsInputSchema,
13716
13739
  outputSchema: RecordItemSchema,
13717
- // `run` returns the record array; `output: "item"` wraps it in `{ data }` to
13718
- // match the legacy `{ data: RecordItem[] }` surface.
13740
+ // Item output with an array payload: callers get `{ data: RecordItem[] }`
13741
+ // directly rather than a paginated list.
13719
13742
  output: "item",
13720
13743
  resolvers: { table: tableIdResolver, records: tableRecordsResolver },
13721
13744
  formatter: tableRecordFormatter,
@@ -13741,10 +13764,12 @@ var createTableRecordsPlugin = defineMethod({
13741
13764
  for (const changeset of response.data) {
13742
13765
  throwOnRecordErrors(changeset.new);
13743
13766
  }
13744
- return response.data.map((changeset) => ({
13745
- ...transformRecordItem(changeset.new),
13746
- data: translator.translateOutput(changeset.new.data)
13747
- }));
13767
+ return {
13768
+ data: response.data.map((changeset) => ({
13769
+ ...transformRecordItem(changeset.new),
13770
+ data: translator.translateOutput(changeset.new.data)
13771
+ }))
13772
+ };
13748
13773
  }
13749
13774
  });
13750
13775
  var DeleteTableRecordsDescription = "Delete one or more records from a table";
@@ -13824,8 +13849,8 @@ var updateTableRecordsPlugin = defineMethod({
13824
13849
  returnType: "RecordItem[]",
13825
13850
  inputSchema: UpdateTableRecordsOptionsInputSchema,
13826
13851
  outputSchema: RecordItemSchema,
13827
- // `run` returns the record array; `output: "item"` wraps it in `{ data }` to
13828
- // match the legacy `{ data: RecordItem[] }` surface.
13852
+ // Item output with an array payload: callers get `{ data: RecordItem[] }`
13853
+ // directly rather than a paginated list.
13829
13854
  output: "item",
13830
13855
  resolvers: { table: tableIdResolver, records: tableUpdateRecordsResolver },
13831
13856
  formatter: tableRecordFormatter,
@@ -13852,10 +13877,12 @@ var updateTableRecordsPlugin = defineMethod({
13852
13877
  for (const changeset of response.data) {
13853
13878
  throwOnRecordErrors(changeset.new);
13854
13879
  }
13855
- return response.data.map((changeset) => ({
13856
- ...transformRecordItem(changeset.new),
13857
- data: translator.translateOutput(changeset.new.data)
13858
- }));
13880
+ return {
13881
+ data: response.data.map((changeset) => ({
13882
+ ...transformRecordItem(changeset.new),
13883
+ data: translator.translateOutput(changeset.new.data)
13884
+ }))
13885
+ };
13859
13886
  }
13860
13887
  });
13861
13888
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk",
3
- "version": "0.83.3",
3
+ "version": "0.84.1",
4
4
  "description": "Complete Zapier SDK - combines all Zapier SDK packages",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -95,7 +95,7 @@
95
95
  "tsup": "^8.5.0",
96
96
  "typescript": "^5.8.3",
97
97
  "vitest": "^4.1.4",
98
- "@zapier/kitcore": "0.5.1"
98
+ "@zapier/kitcore": "0.6.0"
99
99
  },
100
100
  "scripts": {
101
101
  "build": "tsup",