@zapier/zapier-sdk 0.84.0 → 0.84.2

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.84.0" : void 0) || "unknown";
5343
+ var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.84.2" : void 0) || "unknown";
5346
5344
 
5347
5345
  // src/utils/open-url.ts
5348
5346
  var nodePrefix = "node:";
@@ -9333,7 +9331,7 @@ var getActionPlugin = defineMethod({
9333
9331
  });
9334
9332
  for await (const action of imports.listActions({ app: appKey }).items()) {
9335
9333
  if ((action.key === actionKey || action.id === actionKey) && action.action_type === actionType) {
9336
- return action;
9334
+ return { data: action };
9337
9335
  }
9338
9336
  }
9339
9337
  throw new ZapierResourceNotFoundError(
@@ -10442,7 +10440,10 @@ var getActionInputFieldsSchemaPlugin = defineMethod({
10442
10440
  connection: connectionIdResolver,
10443
10441
  inputs: inputsAllOptionalResolver
10444
10442
  },
10445
- run: async ({ imports, input }) => {
10443
+ run: async ({
10444
+ imports,
10445
+ input
10446
+ }) => {
10446
10447
  const api = imports.api;
10447
10448
  const getVersionedImplementationId = imports.manifest.getVersionedImplementationId;
10448
10449
  const resolveConnection = imports.connections.resolveConnection;
@@ -10480,7 +10481,7 @@ var getActionInputFieldsSchemaPlugin = defineMethod({
10480
10481
  connectionId: resolvedConnectionId ?? null,
10481
10482
  inputs
10482
10483
  });
10483
- return needsData.schema || {};
10484
+ return { data: needsData.schema || {} };
10484
10485
  }
10485
10486
  });
10486
10487
  var ListConnectionsQuerySchema = ListConnectionsQuerySchema$1.omit({
@@ -10771,7 +10772,7 @@ var createClientCredentialsPlugin = defineMethod({
10771
10772
  requiredScopes: ["credentials"]
10772
10773
  }
10773
10774
  );
10774
- return response.data;
10775
+ return { data: response.data };
10775
10776
  }
10776
10777
  });
10777
10778
  var DeleteClientCredentialsSchema = z.object({
@@ -10825,7 +10826,7 @@ var getAppPlugin = defineMethod({
10825
10826
  run: async ({ imports, input }) => {
10826
10827
  const appKey = "app" in input ? input.app : input.appKey;
10827
10828
  for await (const app of imports.listApps({ apps: [appKey] }).items()) {
10828
- return app;
10829
+ return { data: app };
10829
10830
  }
10830
10831
  throw new ZapierAppNotFoundError("App not found", { appKey });
10831
10832
  }
@@ -10871,7 +10872,7 @@ var getConnectionPlugin = defineMethod({
10871
10872
  }
10872
10873
  }
10873
10874
  );
10874
- return transformConnectionItem(response.data);
10875
+ return { data: transformConnectionItem(response.data) };
10875
10876
  }
10876
10877
  });
10877
10878
 
@@ -10906,7 +10907,7 @@ var findFirstConnectionPlugin = defineMethod({
10906
10907
  { resourceType: "Connection" }
10907
10908
  );
10908
10909
  }
10909
- return connectionsResponse.data[0];
10910
+ return { data: connectionsResponse.data[0] };
10910
10911
  }
10911
10912
  });
10912
10913
 
@@ -10947,7 +10948,7 @@ var findUniqueConnectionPlugin = defineMethod({
10947
10948
  "Multiple connections found matching the specified criteria. Expected exactly one."
10948
10949
  );
10949
10950
  }
10950
- return connectionsResponse.data[0];
10951
+ return { data: connectionsResponse.data[0] };
10951
10952
  }
10952
10953
  });
10953
10954
  var RelayRequestSchema = z.object({
@@ -11062,13 +11063,15 @@ var getProfilePlugin = defineMethod({
11062
11063
  authRequired: true
11063
11064
  });
11064
11065
  return {
11065
- id: String(profile.public_id ?? profile.id),
11066
- first_name: profile.first_name,
11067
- last_name: profile.last_name,
11068
- full_name: `${profile.first_name} ${profile.last_name}`,
11069
- email: profile.email,
11070
- email_confirmed: profile.email_confirmed,
11071
- 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
+ }
11072
11075
  };
11073
11076
  }
11074
11077
  });
@@ -11125,12 +11128,14 @@ var getConnectionStartUrlPlugin = defineMethod({
11125
11128
  { selected_api: selectedApi },
11126
11129
  { authRequired: true }
11127
11130
  );
11128
- return GetConnectionStartUrlItemSchema.parse({
11129
- url: response.url,
11130
- expiresAt: response.expires_at,
11131
- startedAt: response.started_at,
11132
- app: selectedApi
11133
- });
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
+ };
11134
11139
  }
11135
11140
  });
11136
11141
  var WaitForNewConnectionSchema = z.object({
@@ -11204,11 +11209,13 @@ var waitForNewConnectionPlugin = defineMethod({
11204
11209
  body.data[0]
11205
11210
  )
11206
11211
  });
11207
- return WaitForNewConnectionItemSchema.parse({
11208
- id: String(top.public_id ?? top.id),
11209
- app: appKey,
11210
- title: top.title ?? null
11211
- });
11212
+ return {
11213
+ data: WaitForNewConnectionItemSchema.parse({
11214
+ id: String(top.public_id ?? top.id),
11215
+ app: appKey,
11216
+ title: top.title ?? null
11217
+ })
11218
+ };
11212
11219
  } catch (err) {
11213
11220
  if (err instanceof ZapierTimeoutError) {
11214
11221
  throw new ZapierTimeoutError(
@@ -11309,11 +11316,13 @@ Open this URL to complete the connection:
11309
11316
  timeoutMs: input.timeoutMs,
11310
11317
  pollIntervalMs: input.pollIntervalMs
11311
11318
  });
11312
- return CreateConnectionItemSchema.parse({
11313
- id: fresh.id,
11314
- app: start2.app,
11315
- title: fresh.title ?? null
11316
- });
11319
+ return {
11320
+ data: CreateConnectionItemSchema.parse({
11321
+ id: fresh.id,
11322
+ app: start2.app,
11323
+ title: fresh.title ?? null
11324
+ })
11325
+ };
11317
11326
  }
11318
11327
  });
11319
11328
 
@@ -11650,7 +11659,7 @@ var createTriggerInboxPlugin = defineMethod({
11650
11659
  }
11651
11660
  }
11652
11661
  );
11653
- return TriggerInboxItemSchema.parse(rawResponse);
11662
+ return { data: TriggerInboxItemSchema.parse(rawResponse) };
11654
11663
  }
11655
11664
  });
11656
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.";
@@ -11751,7 +11760,7 @@ var ensureTriggerInboxPlugin = defineMethod({
11751
11760
  }
11752
11761
  }
11753
11762
  );
11754
- return TriggerInboxItemSchema.parse(rawResponse);
11763
+ return { data: TriggerInboxItemSchema.parse(rawResponse) };
11755
11764
  }
11756
11765
  });
11757
11766
  var ListTriggerInboxesSchema = z.object({
@@ -11846,7 +11855,7 @@ var getTriggerInboxPlugin = defineMethod({
11846
11855
  resource: { type: "trigger_inbox", id: inboxId }
11847
11856
  }
11848
11857
  );
11849
- return TriggerInboxItemSchema.parse(rawResponse);
11858
+ return { data: TriggerInboxItemSchema.parse(rawResponse) };
11850
11859
  }
11851
11860
  });
11852
11861
  var UpdateTriggerInboxSchema = z.object({
@@ -11884,7 +11893,7 @@ var updateTriggerInboxPlugin = defineMethod({
11884
11893
  resource: { type: "trigger_inbox", id: inboxId }
11885
11894
  }
11886
11895
  );
11887
- return TriggerInboxItemSchema.parse(rawResponse);
11896
+ return { data: TriggerInboxItemSchema.parse(rawResponse) };
11888
11897
  }
11889
11898
  });
11890
11899
  var DeleteTriggerInboxSchema = z.object({
@@ -11949,7 +11958,7 @@ var pauseTriggerInboxPlugin = defineMethod({
11949
11958
  resource: { type: "trigger_inbox", id: inboxId }
11950
11959
  }
11951
11960
  );
11952
- return TriggerInboxItemSchema.parse(rawResponse);
11961
+ return { data: TriggerInboxItemSchema.parse(rawResponse) };
11953
11962
  }
11954
11963
  });
11955
11964
  var ResumeTriggerInboxSchema = z.object({
@@ -11980,7 +11989,7 @@ var resumeTriggerInboxPlugin = defineMethod({
11980
11989
  resource: { type: "trigger_inbox", id: inboxId }
11981
11990
  }
11982
11991
  );
11983
- return TriggerInboxItemSchema.parse(rawResponse);
11992
+ return { data: TriggerInboxItemSchema.parse(rawResponse) };
11984
11993
  }
11985
11994
  });
11986
11995
  var TriggerMessageStatusSchema = z.union([z.enum(["available", "leased", "acked", "quarantined"]), z.string()]).describe("Message lifecycle status");
@@ -12169,7 +12178,7 @@ var leaseTriggerInboxMessagesPlugin = defineMethod({
12169
12178
  }
12170
12179
  }
12171
12180
  );
12172
- return LeaseTriggerInboxMessagesItemSchema.parse(rawResponse);
12181
+ return { data: LeaseTriggerInboxMessagesItemSchema.parse(rawResponse) };
12173
12182
  }
12174
12183
  });
12175
12184
  var AckTriggerInboxMessagesSchema = z.object({
@@ -12219,7 +12228,7 @@ var ackTriggerInboxMessagesPlugin = defineMethod({
12219
12228
  requestBody,
12220
12229
  { authRequired: true }
12221
12230
  );
12222
- return AckTriggerInboxMessagesItemSchema.parse(rawResponse);
12231
+ return { data: AckTriggerInboxMessagesItemSchema.parse(rawResponse) };
12223
12232
  }
12224
12233
  });
12225
12234
  var ReleaseTriggerInboxMessagesSchema = z.object({
@@ -12269,7 +12278,7 @@ var releaseTriggerInboxMessagesPlugin = defineMethod({
12269
12278
  requestBody,
12270
12279
  { authRequired: true }
12271
12280
  );
12272
- return ReleaseTriggerInboxMessagesItemSchema.parse(rawResponse);
12281
+ return { data: ReleaseTriggerInboxMessagesItemSchema.parse(rawResponse) };
12273
12282
  }
12274
12283
  });
12275
12284
 
@@ -13234,7 +13243,7 @@ var getTablePlugin = defineMethod({
13234
13243
  resource: { type: "table", id: tableId }
13235
13244
  });
13236
13245
  const response = GetTableApiResponseSchema.parse(rawResponse);
13237
- return transformTableItem(response.data);
13246
+ return { data: transformTableItem(response.data) };
13238
13247
  }
13239
13248
  });
13240
13249
  var DeleteTableDescription = "Delete a table by its ID";
@@ -13294,7 +13303,7 @@ var createTablePlugin = defineMethod({
13294
13303
  { authRequired: true }
13295
13304
  );
13296
13305
  const response = CreateTableApiResponseSchema.parse(rawResponse);
13297
- return transformTableItem(response.data);
13306
+ return { data: transformTableItem(response.data) };
13298
13307
  }
13299
13308
  });
13300
13309
 
@@ -13314,10 +13323,8 @@ var listTableFieldsPlugin = defineMethod({
13314
13323
  imports: [apiPluginRef],
13315
13324
  categories: tableCategories,
13316
13325
  itemType: "Field",
13317
- // A field list, but the API returns no cursor: legacy used the non-paginated
13318
- // createPluginMethod (a `createFunction` boundary returning a bare `{ data }`,
13319
- // not an iterator). `output: "item"` reproduces that exactly (same boundary +
13320
- // 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
13321
13328
  // `type: "list"` first-class field keeps the list presentation.
13322
13329
  type: "list",
13323
13330
  inputSchema: ListTableFieldsOptionsInputSchema,
@@ -13346,7 +13353,7 @@ var listTableFieldsPlugin = defineMethod({
13346
13353
  }
13347
13354
  );
13348
13355
  const response = ListTableFieldsApiResponseSchema.parse(rawResponse);
13349
- return response.data.map(transformFieldItem);
13356
+ return { data: response.data.map(transformFieldItem) };
13350
13357
  }
13351
13358
  });
13352
13359
  var FieldChangesetItemSchema = z.object({
@@ -13391,8 +13398,8 @@ var createTableFieldsPlugin = defineMethod({
13391
13398
  returnType: "FieldItem[]",
13392
13399
  inputSchema: CreateTableFieldsOptionsInputSchema,
13393
13400
  outputSchema: FieldItemSchema,
13394
- // `run` returns the field array; `output: "item"` wraps it in `{ data }` to
13395
- // match the legacy `{ data: FieldItem[] }` surface.
13401
+ // Item output with an array payload: callers get `{ data: FieldItem[] }`
13402
+ // directly rather than a paginated list.
13396
13403
  output: "item",
13397
13404
  formatter: tableFieldItemFormatter,
13398
13405
  resolvers: { table: tableIdResolver, fields: tableFieldsResolver },
@@ -13405,7 +13412,9 @@ var createTableFieldsPlugin = defineMethod({
13405
13412
  { authRequired: true, resource: { type: "table", id: tableId } }
13406
13413
  );
13407
13414
  const response = CreateTableFieldsApiResponseSchema.parse(rawResponse);
13408
- return response.data.map((changeset) => transformFieldItem(changeset.new));
13415
+ return {
13416
+ data: response.data.map((changeset) => transformFieldItem(changeset.new))
13417
+ };
13409
13418
  }
13410
13419
  });
13411
13420
  var DeleteTableFieldsDescription = "Delete one or more fields from a table";
@@ -13546,8 +13555,10 @@ var getTableRecordPlugin = defineMethod({
13546
13555
  keyMode: input.keyMode
13547
13556
  });
13548
13557
  return {
13549
- ...transformRecordItem(response.data),
13550
- data: translator.translateOutput(response.data.data)
13558
+ data: {
13559
+ ...transformRecordItem(response.data),
13560
+ data: translator.translateOutput(response.data.data)
13561
+ }
13551
13562
  };
13552
13563
  }
13553
13564
  });
@@ -13726,8 +13737,8 @@ var createTableRecordsPlugin = defineMethod({
13726
13737
  returnType: "RecordItem[]",
13727
13738
  inputSchema: CreateTableRecordsOptionsInputSchema,
13728
13739
  outputSchema: RecordItemSchema,
13729
- // `run` returns the record array; `output: "item"` wraps it in `{ data }` to
13730
- // match the legacy `{ data: RecordItem[] }` surface.
13740
+ // Item output with an array payload: callers get `{ data: RecordItem[] }`
13741
+ // directly rather than a paginated list.
13731
13742
  output: "item",
13732
13743
  resolvers: { table: tableIdResolver, records: tableRecordsResolver },
13733
13744
  formatter: tableRecordFormatter,
@@ -13753,10 +13764,12 @@ var createTableRecordsPlugin = defineMethod({
13753
13764
  for (const changeset of response.data) {
13754
13765
  throwOnRecordErrors(changeset.new);
13755
13766
  }
13756
- return response.data.map((changeset) => ({
13757
- ...transformRecordItem(changeset.new),
13758
- data: translator.translateOutput(changeset.new.data)
13759
- }));
13767
+ return {
13768
+ data: response.data.map((changeset) => ({
13769
+ ...transformRecordItem(changeset.new),
13770
+ data: translator.translateOutput(changeset.new.data)
13771
+ }))
13772
+ };
13760
13773
  }
13761
13774
  });
13762
13775
  var DeleteTableRecordsDescription = "Delete one or more records from a table";
@@ -13836,8 +13849,8 @@ var updateTableRecordsPlugin = defineMethod({
13836
13849
  returnType: "RecordItem[]",
13837
13850
  inputSchema: UpdateTableRecordsOptionsInputSchema,
13838
13851
  outputSchema: RecordItemSchema,
13839
- // `run` returns the record array; `output: "item"` wraps it in `{ data }` to
13840
- // match the legacy `{ data: RecordItem[] }` surface.
13852
+ // Item output with an array payload: callers get `{ data: RecordItem[] }`
13853
+ // directly rather than a paginated list.
13841
13854
  output: "item",
13842
13855
  resolvers: { table: tableIdResolver, records: tableUpdateRecordsResolver },
13843
13856
  formatter: tableRecordFormatter,
@@ -13864,10 +13877,12 @@ var updateTableRecordsPlugin = defineMethod({
13864
13877
  for (const changeset of response.data) {
13865
13878
  throwOnRecordErrors(changeset.new);
13866
13879
  }
13867
- return response.data.map((changeset) => ({
13868
- ...transformRecordItem(changeset.new),
13869
- data: translator.translateOutput(changeset.new.data)
13870
- }));
13880
+ return {
13881
+ data: response.data.map((changeset) => ({
13882
+ ...transformRecordItem(changeset.new),
13883
+ data: translator.translateOutput(changeset.new.data)
13884
+ }))
13885
+ };
13871
13886
  }
13872
13887
  });
13873
13888
 
@@ -14073,6 +14088,7 @@ function buildErrorEvent(data, context = {}) {
14073
14088
  app_version_id: context.app_version_id,
14074
14089
  environment: context.environment,
14075
14090
  ...data,
14091
+ ...getTtyContext(),
14076
14092
  agent: getAgent(),
14077
14093
  caller_package: context.caller_package ?? null,
14078
14094
  caller_package_version: context.caller_package_version ?? null,
@@ -14122,6 +14138,7 @@ function buildErrorEventWithContext(data, context = {}) {
14122
14138
  environment: context.environment ?? (globalThis.process?.env?.NODE_ENV || null),
14123
14139
  execution_time_before_error_ms: executionTime,
14124
14140
  ...data,
14141
+ ...getTtyContext(),
14125
14142
  agent: getAgent(),
14126
14143
  caller_package: context.caller_package ?? null,
14127
14144
  caller_package_version: context.caller_package_version ?? null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk",
3
- "version": "0.84.0",
3
+ "version": "0.84.2",
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",