@zapier/zapier-sdk 0.107.0 → 0.107.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 +14 -0
- package/dist/{chunk-XGSFXI2W.mjs → chunk-MRDFD4MP.mjs} +90 -6
- package/dist/{chunk-I2QKGDAX.cjs → chunk-PFNHJW2F.cjs} +89 -5
- package/dist/experimental.cjs +369 -369
- package/dist/experimental.d.mts +4 -4
- package/dist/experimental.d.ts +4 -4
- package/dist/experimental.mjs +2 -2
- package/dist/{index-CPD7PuKo.d.mts → index-wTDIVpGJ.d.mts} +3 -3
- package/dist/{index-CPD7PuKo.d.ts → index-wTDIVpGJ.d.ts} +3 -3
- package/dist/index.cjs +279 -279
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @zapier/zapier-sdk
|
|
2
2
|
|
|
3
|
+
## 0.107.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 274d411: `getConnection` now:
|
|
8
|
+
- Raises a `ZapierValidationError` (`ZAPIER_VALIDATION_ERROR`) when the response
|
|
9
|
+
does not match the connection schema; previously some malformed responses
|
|
10
|
+
surfaced as `ZapierApiError`.
|
|
11
|
+
- Preserves error status codes and messages. Previously, some 4xx messages were
|
|
12
|
+
replaced with generic text and some 5xx responses were reported as generic
|
|
13
|
+
502 errors.
|
|
14
|
+
|
|
15
|
+
Output is unchanged for conforming responses.
|
|
16
|
+
|
|
3
17
|
## 0.107.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -4,7 +4,7 @@ import { withPositional, declareOptionalProperty, defineProperty, createDeprecat
|
|
|
4
4
|
export { CONTEXT, CORE_ERROR_SYMBOL, CORE_OPTIONS_ID, CORE_SIGNAL_SYMBOL, CoreCancelledSignal, CoreDisposeError, CoreErrorCode, CoreSignal, addPlugin, composePlugins, createController, createCorePlugin, createFunction, createPaginatedFunction, createPaginatedPluginMethod, createPluginMethod, createPluginStack, createSdk, declareMethod, declareOptionalProperty, declarePlugin, declareProperty, defineFormatter, defineLegacyMerge, defineMethod, defineMethodOverride, defineOverride, definePlugin, defineProperty, defineResolver, disposeSdk, fromFunctionPlugin, getContext, getCoreErrorCause, getCoreErrorCode, getNegatable, getRegistryPlugin, isCoreCancelledSignal, isCoreError, isCoreSignal, isPositional, omitExports, resolvePlugin, runInMethodScope, runWithTelemetryContext, selectExports, toSnakeCase, toTitleCase } from '@zapier/kitcore';
|
|
5
5
|
import { buildHttpRequestContext, buildActionRunContext } from '@zapier/policy-context';
|
|
6
6
|
import { ListAppsQuerySchema, AppItemSchema as AppItemSchema$1 } from '@zapier/zapier-sdk-core/v0/schemas/apps';
|
|
7
|
-
import { ListConnectionsQuerySchema as ListConnectionsQuerySchema$1, ConnectionItemSchema } from '@zapier/zapier-sdk-core/v0/schemas/connections';
|
|
7
|
+
import { ListConnectionsQuerySchema as ListConnectionsQuerySchema$1, ConnectionSchema, ConnectionItemSchema } from '@zapier/zapier-sdk-core/v0/schemas/connections';
|
|
8
8
|
import { ListClientCredentialsQuerySchema as ListClientCredentialsQuerySchema$1, ClientCredentialsItemSchema as ClientCredentialsItemSchema$1, CreateClientCredentialsRequestSchema, ClientCredentialsCreatedItemSchema as ClientCredentialsCreatedItemSchema$1 } from '@zapier/zapier-sdk-core/v0/schemas/client-credentials';
|
|
9
9
|
|
|
10
10
|
// src/constants.ts
|
|
@@ -2684,7 +2684,7 @@ function logRouteOverride({
|
|
|
2684
2684
|
}
|
|
2685
2685
|
|
|
2686
2686
|
// src/sdk-version.ts
|
|
2687
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.107.
|
|
2687
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.107.1" : void 0) || "unknown";
|
|
2688
2688
|
|
|
2689
2689
|
// src/utils/open-url.ts
|
|
2690
2690
|
var nodePrefix = "node:";
|
|
@@ -7977,6 +7977,13 @@ var ListConnectionsQuerySchema = ListConnectionsQuerySchema$1.omit({
|
|
|
7977
7977
|
// SDK specific property for pagination/iterable helpers
|
|
7978
7978
|
cursor: z.string().optional().describe("Cursor to start from")
|
|
7979
7979
|
}).describe("List available connections with optional filtering");
|
|
7980
|
+
ConnectionSchema.extend({
|
|
7981
|
+
is_stale: z.boolean().optional(),
|
|
7982
|
+
is_shared: z.boolean().optional(),
|
|
7983
|
+
members: z.array(z.record(z.string(), z.any())).optional(),
|
|
7984
|
+
customuser_id: z.number().nullable().optional(),
|
|
7985
|
+
customuser_public_id: z.string().nullable().optional()
|
|
7986
|
+
});
|
|
7980
7987
|
function formatConnectionItem(item) {
|
|
7981
7988
|
const details = [];
|
|
7982
7989
|
const appKey = item.app_key ?? "unknown";
|
|
@@ -8288,6 +8295,76 @@ var getAppPlugin = defineMethod({
|
|
|
8288
8295
|
throw new ZapierAppNotFoundError("App not found", { appKey });
|
|
8289
8296
|
}
|
|
8290
8297
|
});
|
|
8298
|
+
|
|
8299
|
+
// src/normalizers/shared.ts
|
|
8300
|
+
function fastifyToString(value) {
|
|
8301
|
+
if (value === void 0) {
|
|
8302
|
+
return void 0;
|
|
8303
|
+
}
|
|
8304
|
+
if (typeof value === "string") {
|
|
8305
|
+
return value;
|
|
8306
|
+
}
|
|
8307
|
+
if (value === null) {
|
|
8308
|
+
return "";
|
|
8309
|
+
}
|
|
8310
|
+
if (value instanceof Date) {
|
|
8311
|
+
return value.toISOString();
|
|
8312
|
+
}
|
|
8313
|
+
if (value instanceof RegExp) {
|
|
8314
|
+
return value.source;
|
|
8315
|
+
}
|
|
8316
|
+
try {
|
|
8317
|
+
return String(value.toString());
|
|
8318
|
+
} catch {
|
|
8319
|
+
return "[unserializable]";
|
|
8320
|
+
}
|
|
8321
|
+
}
|
|
8322
|
+
|
|
8323
|
+
// src/normalizers/connection.ts
|
|
8324
|
+
function normalizeConnectionItem({
|
|
8325
|
+
connection,
|
|
8326
|
+
appKey: providedAppKey,
|
|
8327
|
+
appVersion: providedAppVersion,
|
|
8328
|
+
adaptError
|
|
8329
|
+
}) {
|
|
8330
|
+
let appKey = providedAppKey;
|
|
8331
|
+
let appVersion = providedAppVersion;
|
|
8332
|
+
if (connection.selected_api && typeof connection.selected_api === "string") {
|
|
8333
|
+
const [extractedAppKey, extractedVersion] = splitVersionedKey(
|
|
8334
|
+
connection.selected_api
|
|
8335
|
+
);
|
|
8336
|
+
if (!appKey) {
|
|
8337
|
+
appKey = extractedAppKey;
|
|
8338
|
+
}
|
|
8339
|
+
if (!appVersion) {
|
|
8340
|
+
appVersion = extractedVersion;
|
|
8341
|
+
}
|
|
8342
|
+
}
|
|
8343
|
+
const {
|
|
8344
|
+
selected_api: selectedApi,
|
|
8345
|
+
customuser_id: profileId,
|
|
8346
|
+
id,
|
|
8347
|
+
account_id: accountId,
|
|
8348
|
+
...restOfConnection
|
|
8349
|
+
} = connection;
|
|
8350
|
+
const normalized = {
|
|
8351
|
+
...restOfConnection,
|
|
8352
|
+
id: String(id),
|
|
8353
|
+
account_id: String(accountId),
|
|
8354
|
+
implementation_id: selectedApi,
|
|
8355
|
+
title: connection.title || connection.label || void 0,
|
|
8356
|
+
is_stale: fastifyToString(connection.is_stale),
|
|
8357
|
+
is_expired: fastifyToString(connection.is_stale),
|
|
8358
|
+
is_shared: fastifyToString(connection.is_shared),
|
|
8359
|
+
members: fastifyToString(connection.members),
|
|
8360
|
+
customuser_public_id: fastifyToString(connection.customuser_public_id),
|
|
8361
|
+
expired_at: connection.marked_stale_at,
|
|
8362
|
+
app_key: appKey,
|
|
8363
|
+
app_version: appVersion,
|
|
8364
|
+
profile_id: profileId != null ? String(profileId) : void 0
|
|
8365
|
+
};
|
|
8366
|
+
return createValidator(ConnectionItemSchema, { adaptError })(normalized);
|
|
8367
|
+
}
|
|
8291
8368
|
var GetConnectionDescription = "Get details for a specific connection";
|
|
8292
8369
|
var GetConnectionSchema = z.object({
|
|
8293
8370
|
connection: ConnectionPropertySchema
|
|
@@ -8309,7 +8386,7 @@ var GetConnectionInputSchema = z.union([
|
|
|
8309
8386
|
// src/plugins/getConnection/index.ts
|
|
8310
8387
|
var getConnectionPlugin = defineMethod({
|
|
8311
8388
|
name: "getConnection",
|
|
8312
|
-
imports: [apiPluginRef],
|
|
8389
|
+
imports: [apiPluginRef, coreOptionsPluginRef],
|
|
8313
8390
|
categories: ["connection"],
|
|
8314
8391
|
itemType: "Connection",
|
|
8315
8392
|
inputSchema: GetConnectionInputSchema,
|
|
@@ -8321,8 +8398,8 @@ var getConnectionPlugin = defineMethod({
|
|
|
8321
8398
|
run: async ({ imports, input }) => {
|
|
8322
8399
|
const api = imports.api;
|
|
8323
8400
|
const resolvedConnectionId = "connection" in input ? input.connection : "connectionId" in input ? input.connectionId : input.authenticationId;
|
|
8324
|
-
const
|
|
8325
|
-
`/api/
|
|
8401
|
+
const raw = await api.get(
|
|
8402
|
+
`/zapier/api/v4/authentications/${encodeURIComponent(String(resolvedConnectionId))}/`,
|
|
8326
8403
|
{
|
|
8327
8404
|
resource: {
|
|
8328
8405
|
type: "connection",
|
|
@@ -8330,7 +8407,14 @@ var getConnectionPlugin = defineMethod({
|
|
|
8330
8407
|
}
|
|
8331
8408
|
}
|
|
8332
8409
|
);
|
|
8333
|
-
return {
|
|
8410
|
+
return {
|
|
8411
|
+
data: transformConnectionItem(
|
|
8412
|
+
normalizeConnectionItem({
|
|
8413
|
+
connection: raw,
|
|
8414
|
+
adaptError: imports.coreOptions?.adaptError
|
|
8415
|
+
})
|
|
8416
|
+
)
|
|
8417
|
+
};
|
|
8334
8418
|
}
|
|
8335
8419
|
});
|
|
8336
8420
|
|
|
@@ -2685,7 +2685,7 @@ function logRouteOverride({
|
|
|
2685
2685
|
}
|
|
2686
2686
|
|
|
2687
2687
|
// src/sdk-version.ts
|
|
2688
|
-
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.107.
|
|
2688
|
+
var SDK_VERSION = (typeof process !== "undefined" && process.env ? "0.107.1" : void 0) || "unknown";
|
|
2689
2689
|
|
|
2690
2690
|
// src/utils/open-url.ts
|
|
2691
2691
|
var nodePrefix = "node:";
|
|
@@ -7978,6 +7978,13 @@ var ListConnectionsQuerySchema = connections.ListConnectionsQuerySchema.omit({
|
|
|
7978
7978
|
// SDK specific property for pagination/iterable helpers
|
|
7979
7979
|
cursor: zod.z.string().optional().describe("Cursor to start from")
|
|
7980
7980
|
}).describe("List available connections with optional filtering");
|
|
7981
|
+
connections.ConnectionSchema.extend({
|
|
7982
|
+
is_stale: zod.z.boolean().optional(),
|
|
7983
|
+
is_shared: zod.z.boolean().optional(),
|
|
7984
|
+
members: zod.z.array(zod.z.record(zod.z.string(), zod.z.any())).optional(),
|
|
7985
|
+
customuser_id: zod.z.number().nullable().optional(),
|
|
7986
|
+
customuser_public_id: zod.z.string().nullable().optional()
|
|
7987
|
+
});
|
|
7981
7988
|
function formatConnectionItem(item) {
|
|
7982
7989
|
const details = [];
|
|
7983
7990
|
const appKey = item.app_key ?? "unknown";
|
|
@@ -8289,6 +8296,76 @@ var getAppPlugin = kitcore.defineMethod({
|
|
|
8289
8296
|
throw new ZapierAppNotFoundError("App not found", { appKey });
|
|
8290
8297
|
}
|
|
8291
8298
|
});
|
|
8299
|
+
|
|
8300
|
+
// src/normalizers/shared.ts
|
|
8301
|
+
function fastifyToString(value) {
|
|
8302
|
+
if (value === void 0) {
|
|
8303
|
+
return void 0;
|
|
8304
|
+
}
|
|
8305
|
+
if (typeof value === "string") {
|
|
8306
|
+
return value;
|
|
8307
|
+
}
|
|
8308
|
+
if (value === null) {
|
|
8309
|
+
return "";
|
|
8310
|
+
}
|
|
8311
|
+
if (value instanceof Date) {
|
|
8312
|
+
return value.toISOString();
|
|
8313
|
+
}
|
|
8314
|
+
if (value instanceof RegExp) {
|
|
8315
|
+
return value.source;
|
|
8316
|
+
}
|
|
8317
|
+
try {
|
|
8318
|
+
return String(value.toString());
|
|
8319
|
+
} catch {
|
|
8320
|
+
return "[unserializable]";
|
|
8321
|
+
}
|
|
8322
|
+
}
|
|
8323
|
+
|
|
8324
|
+
// src/normalizers/connection.ts
|
|
8325
|
+
function normalizeConnectionItem({
|
|
8326
|
+
connection,
|
|
8327
|
+
appKey: providedAppKey,
|
|
8328
|
+
appVersion: providedAppVersion,
|
|
8329
|
+
adaptError
|
|
8330
|
+
}) {
|
|
8331
|
+
let appKey = providedAppKey;
|
|
8332
|
+
let appVersion = providedAppVersion;
|
|
8333
|
+
if (connection.selected_api && typeof connection.selected_api === "string") {
|
|
8334
|
+
const [extractedAppKey, extractedVersion] = splitVersionedKey(
|
|
8335
|
+
connection.selected_api
|
|
8336
|
+
);
|
|
8337
|
+
if (!appKey) {
|
|
8338
|
+
appKey = extractedAppKey;
|
|
8339
|
+
}
|
|
8340
|
+
if (!appVersion) {
|
|
8341
|
+
appVersion = extractedVersion;
|
|
8342
|
+
}
|
|
8343
|
+
}
|
|
8344
|
+
const {
|
|
8345
|
+
selected_api: selectedApi,
|
|
8346
|
+
customuser_id: profileId,
|
|
8347
|
+
id,
|
|
8348
|
+
account_id: accountId,
|
|
8349
|
+
...restOfConnection
|
|
8350
|
+
} = connection;
|
|
8351
|
+
const normalized = {
|
|
8352
|
+
...restOfConnection,
|
|
8353
|
+
id: String(id),
|
|
8354
|
+
account_id: String(accountId),
|
|
8355
|
+
implementation_id: selectedApi,
|
|
8356
|
+
title: connection.title || connection.label || void 0,
|
|
8357
|
+
is_stale: fastifyToString(connection.is_stale),
|
|
8358
|
+
is_expired: fastifyToString(connection.is_stale),
|
|
8359
|
+
is_shared: fastifyToString(connection.is_shared),
|
|
8360
|
+
members: fastifyToString(connection.members),
|
|
8361
|
+
customuser_public_id: fastifyToString(connection.customuser_public_id),
|
|
8362
|
+
expired_at: connection.marked_stale_at,
|
|
8363
|
+
app_key: appKey,
|
|
8364
|
+
app_version: appVersion,
|
|
8365
|
+
profile_id: profileId != null ? String(profileId) : void 0
|
|
8366
|
+
};
|
|
8367
|
+
return kitcore.createValidator(connections.ConnectionItemSchema, { adaptError })(normalized);
|
|
8368
|
+
}
|
|
8292
8369
|
var GetConnectionDescription = "Get details for a specific connection";
|
|
8293
8370
|
var GetConnectionSchema = zod.z.object({
|
|
8294
8371
|
connection: ConnectionPropertySchema
|
|
@@ -8310,7 +8387,7 @@ var GetConnectionInputSchema = zod.z.union([
|
|
|
8310
8387
|
// src/plugins/getConnection/index.ts
|
|
8311
8388
|
var getConnectionPlugin = kitcore.defineMethod({
|
|
8312
8389
|
name: "getConnection",
|
|
8313
|
-
imports: [apiPluginRef],
|
|
8390
|
+
imports: [apiPluginRef, kitcore.coreOptionsPluginRef],
|
|
8314
8391
|
categories: ["connection"],
|
|
8315
8392
|
itemType: "Connection",
|
|
8316
8393
|
inputSchema: GetConnectionInputSchema,
|
|
@@ -8322,8 +8399,8 @@ var getConnectionPlugin = kitcore.defineMethod({
|
|
|
8322
8399
|
run: async ({ imports, input }) => {
|
|
8323
8400
|
const api = imports.api;
|
|
8324
8401
|
const resolvedConnectionId = "connection" in input ? input.connection : "connectionId" in input ? input.connectionId : input.authenticationId;
|
|
8325
|
-
const
|
|
8326
|
-
`/api/
|
|
8402
|
+
const raw = await api.get(
|
|
8403
|
+
`/zapier/api/v4/authentications/${encodeURIComponent(String(resolvedConnectionId))}/`,
|
|
8327
8404
|
{
|
|
8328
8405
|
resource: {
|
|
8329
8406
|
type: "connection",
|
|
@@ -8331,7 +8408,14 @@ var getConnectionPlugin = kitcore.defineMethod({
|
|
|
8331
8408
|
}
|
|
8332
8409
|
}
|
|
8333
8410
|
);
|
|
8334
|
-
return {
|
|
8411
|
+
return {
|
|
8412
|
+
data: transformConnectionItem(
|
|
8413
|
+
normalizeConnectionItem({
|
|
8414
|
+
connection: raw,
|
|
8415
|
+
adaptError: imports.coreOptions?.adaptError
|
|
8416
|
+
})
|
|
8417
|
+
)
|
|
8418
|
+
};
|
|
8335
8419
|
}
|
|
8336
8420
|
});
|
|
8337
8421
|
|