@zapier/zapier-sdk 0.30.0 → 0.31.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 +23 -9
- package/dist/api/schemas.d.ts +2 -2
- package/dist/index.cjs +120 -18
- package/dist/index.d.mts +206 -56
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.mjs +114 -19
- package/dist/plugins/eventEmission/builders.js +3 -3
- package/dist/plugins/eventEmission/builders.test.d.ts +2 -0
- package/dist/plugins/eventEmission/builders.test.d.ts.map +1 -0
- package/dist/plugins/eventEmission/builders.test.js +56 -0
- package/dist/plugins/eventEmission/types.d.ts +3 -0
- package/dist/plugins/eventEmission/types.d.ts.map +1 -1
- package/dist/plugins/findFirstConnection/schemas.d.ts +1 -1
- package/dist/plugins/findUniqueConnection/schemas.d.ts +1 -1
- package/dist/plugins/getAction/index.d.ts.map +1 -1
- package/dist/plugins/getAction/index.js +7 -0
- package/dist/plugins/getInputFieldsSchema/index.d.ts.map +1 -1
- package/dist/plugins/getInputFieldsSchema/index.js +6 -0
- package/dist/plugins/listActions/index.d.ts.map +1 -1
- package/dist/plugins/listActions/index.js +6 -0
- package/dist/plugins/listConnections/index.d.ts.map +1 -1
- package/dist/plugins/listConnections/index.js +2 -0
- package/dist/plugins/listConnections/schemas.d.ts +1 -1
- package/dist/plugins/listInputFieldChoices/index.d.ts.map +1 -1
- package/dist/plugins/listInputFieldChoices/index.js +6 -0
- package/dist/plugins/listInputFields/index.d.ts.map +1 -1
- package/dist/plugins/listInputFields/index.js +6 -0
- package/dist/plugins/runAction/index.d.ts.map +1 -1
- package/dist/plugins/runAction/index.js +12 -8
- package/dist/schemas/Action.d.ts +2 -2
- package/dist/types/credentials.d.ts +137 -17
- package/dist/types/credentials.d.ts.map +1 -1
- package/dist/types/credentials.js +80 -0
- package/dist/types/meta.d.ts +9 -0
- package/dist/types/meta.d.ts.map +1 -0
- package/dist/types/meta.js +3 -0
- package/dist/types/sdk.d.ts +61 -35
- package/dist/types/sdk.d.ts.map +1 -1
- package/dist/types/sdk.js +55 -1
- package/dist/utils/telemetry-context.d.ts +12 -0
- package/dist/utils/telemetry-context.d.ts.map +1 -1
- package/dist/utils/telemetry-context.js +18 -0
- package/dist/utils/telemetry-context.test.js +63 -1
- package/dist/utils/telemetry-utils.d.ts.map +1 -1
- package/dist/utils/telemetry-utils.js +5 -0
- package/dist/utils/telemetry-utils.test.js +61 -0
- package/package.json +1 -1
|
@@ -88,13 +88,13 @@ export function buildMethodCalledEvent(data, context = {}) {
|
|
|
88
88
|
is_paginated: data.is_paginated ?? false,
|
|
89
89
|
sdk_version: sdkPackageJson.version,
|
|
90
90
|
environment: context.environment ?? (process?.env?.NODE_ENV || null),
|
|
91
|
-
selected_api: context.selected_api ?? null,
|
|
91
|
+
selected_api: data.selected_api ?? context.selected_api ?? null,
|
|
92
92
|
app_id: context.app_id ?? null,
|
|
93
93
|
app_version_id: context.app_version_id ?? null,
|
|
94
94
|
zap_id: context.zap_id ?? null,
|
|
95
95
|
node_id: context.node_id ?? null,
|
|
96
|
-
operation_type: null,
|
|
97
|
-
operation_key: null,
|
|
96
|
+
operation_type: data.operation_type ?? null,
|
|
97
|
+
operation_key: data.operation_key ?? null,
|
|
98
98
|
call_context: null,
|
|
99
99
|
is_retry: false,
|
|
100
100
|
retry_attempt: null,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builders.test.d.ts","sourceRoot":"","sources":["../../../src/plugins/eventEmission/builders.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { buildMethodCalledEvent } from "./builders";
|
|
3
|
+
describe("buildMethodCalledEvent", () => {
|
|
4
|
+
it("should use data.selected_api when provided", () => {
|
|
5
|
+
const event = buildMethodCalledEvent({
|
|
6
|
+
method_name: "runAction",
|
|
7
|
+
execution_duration_ms: 100,
|
|
8
|
+
success_flag: true,
|
|
9
|
+
argument_count: 1,
|
|
10
|
+
selected_api: "SlackCLIAPI@1.0.0",
|
|
11
|
+
});
|
|
12
|
+
expect(event.selected_api).toBe("SlackCLIAPI@1.0.0");
|
|
13
|
+
});
|
|
14
|
+
it("should use data.operation_type and data.operation_key when provided", () => {
|
|
15
|
+
const event = buildMethodCalledEvent({
|
|
16
|
+
method_name: "runAction",
|
|
17
|
+
execution_duration_ms: 100,
|
|
18
|
+
success_flag: true,
|
|
19
|
+
argument_count: 1,
|
|
20
|
+
operation_type: "write",
|
|
21
|
+
operation_key: "send_message",
|
|
22
|
+
});
|
|
23
|
+
expect(event.operation_type).toBe("write");
|
|
24
|
+
expect(event.operation_key).toBe("send_message");
|
|
25
|
+
});
|
|
26
|
+
it("should fall back to null when data fields are not provided", () => {
|
|
27
|
+
const event = buildMethodCalledEvent({
|
|
28
|
+
method_name: "listApps",
|
|
29
|
+
execution_duration_ms: 50,
|
|
30
|
+
success_flag: true,
|
|
31
|
+
argument_count: 0,
|
|
32
|
+
});
|
|
33
|
+
expect(event.selected_api).toBeNull();
|
|
34
|
+
expect(event.operation_type).toBeNull();
|
|
35
|
+
expect(event.operation_key).toBeNull();
|
|
36
|
+
});
|
|
37
|
+
it("should prefer data.selected_api over context.selected_api", () => {
|
|
38
|
+
const event = buildMethodCalledEvent({
|
|
39
|
+
method_name: "runAction",
|
|
40
|
+
execution_duration_ms: 100,
|
|
41
|
+
success_flag: true,
|
|
42
|
+
argument_count: 1,
|
|
43
|
+
selected_api: "SlackCLIAPI@2.0.0",
|
|
44
|
+
}, { selected_api: "SlackCLIAPI@1.0.0" });
|
|
45
|
+
expect(event.selected_api).toBe("SlackCLIAPI@2.0.0");
|
|
46
|
+
});
|
|
47
|
+
it("should fall back to context.selected_api when data.selected_api is not provided", () => {
|
|
48
|
+
const event = buildMethodCalledEvent({
|
|
49
|
+
method_name: "runAction",
|
|
50
|
+
execution_duration_ms: 100,
|
|
51
|
+
success_flag: true,
|
|
52
|
+
argument_count: 1,
|
|
53
|
+
}, { selected_api: "SlackCLIAPI@1.0.0" });
|
|
54
|
+
expect(event.selected_api).toBe("SlackCLIAPI@1.0.0");
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -59,5 +59,8 @@ export interface MethodCalledEventData {
|
|
|
59
59
|
error_type?: string | null;
|
|
60
60
|
argument_count: number;
|
|
61
61
|
is_paginated?: boolean;
|
|
62
|
+
selected_api?: string | null;
|
|
63
|
+
operation_type?: string | null;
|
|
64
|
+
operation_key?: string | null;
|
|
62
65
|
}
|
|
63
66
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/eventEmission/types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,YAAY;IAC3B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,cAAc;IAC7B,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
|
import type { ConnectionItem } from "../../types/domain";
|
|
3
3
|
import type { ZapierAuthenticationError, ZapierApiError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
|
|
4
4
|
export declare const FindFirstConnectionSchema: z.ZodObject<{
|
|
5
|
-
search: z.ZodOptional<z.ZodString>;
|
|
6
5
|
title: z.ZodOptional<z.ZodString>;
|
|
6
|
+
search: z.ZodOptional<z.ZodString>;
|
|
7
7
|
appKey: z.ZodOptional<z.ZodString & {
|
|
8
8
|
_def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
|
|
9
9
|
}>;
|
|
@@ -2,8 +2,8 @@ import type { z } from "zod";
|
|
|
2
2
|
import type { ConnectionItem } from "../../types/domain";
|
|
3
3
|
import type { ZapierAuthenticationError, ZapierApiError, ZapierResourceNotFoundError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
|
|
4
4
|
export declare const FindUniqueConnectionSchema: z.ZodObject<{
|
|
5
|
-
search: z.ZodOptional<z.ZodString>;
|
|
6
5
|
title: z.ZodOptional<z.ZodString>;
|
|
6
|
+
search: z.ZodOptional<z.ZodString>;
|
|
7
7
|
appKey: z.ZodOptional<z.ZodString & {
|
|
8
8
|
_def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
|
|
9
9
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getAction/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAGnE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAOhE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getAction/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAGnE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAOhE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAI7D,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE,CAAC,CAAC;IACxE,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,SAAS,EAAE;gBACT,WAAW,EAAE,OAAO,eAAe,CAAC;aACrC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,eAAe,EAAE,MAAM,CAClC,UAAU,CAAC,yBAAyB,CAAC,EAAE,8BAA8B;AACrE,AADuC,8BAA8B;AACrE;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,GAAG,oBAAoB,EAAE,0BAA0B;AACrE,uBAAuB,CAyDxB,CAAC"}
|
|
@@ -4,9 +4,16 @@ import { createFunction } from "../../utils/function-utils";
|
|
|
4
4
|
import { appKeyResolver, actionTypeResolver, actionKeyResolver, } from "../../resolvers";
|
|
5
5
|
import { ActionItemSchema } from "../../schemas/Action";
|
|
6
6
|
import { createTelemetryCallback } from "../../utils/telemetry-utils";
|
|
7
|
+
import { setMethodMetadata } from "../../utils/telemetry-context";
|
|
7
8
|
export const getActionPlugin = ({ sdk, context }) => {
|
|
8
9
|
async function getAction(options) {
|
|
9
10
|
const { actionKey, actionType, appKey } = options;
|
|
11
|
+
// selectedApi is intentionally omitted — getAction doesn't resolve a versioned
|
|
12
|
+
// implementation ID; it delegates to sdk.listActions, which sets selectedApi in its own scope.
|
|
13
|
+
setMethodMetadata({
|
|
14
|
+
operationType: actionType,
|
|
15
|
+
operationKey: actionKey,
|
|
16
|
+
});
|
|
10
17
|
// Use the listActions function from the SDK to search for the specific action across all pages
|
|
11
18
|
for await (const action of sdk.listActions({ appKey }).items()) {
|
|
12
19
|
if ((action.key === actionKey || action.id === actionKey) &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getInputFieldsSchema/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EACL,0BAA0B,EAC1B,KAAK,2BAA2B,IAAI,2BAA2B,EAChE,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAUxE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getInputFieldsSchema/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EACL,0BAA0B,EAC1B,KAAK,2BAA2B,IAAI,2BAA2B,EAChE,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAUxE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG7D,MAAM,WAAW,kCAAkC;IACjD,oBAAoB,EAAE,CACpB,OAAO,EAAE,2BAA2B,KACjC,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAAC;IAChD,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,oBAAoB,EAAE;gBACpB,WAAW,EAAE,OAAO,0BAA0B,CAAC;aAChD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAC7C,UAAU,CAAC,uBAAuB,CAAC,EACnC;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,GAAG,oBAAoB,EACxB,kCAAkC,CAoFnC,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { createFunction } from "../../utils/function-utils";
|
|
|
4
4
|
import { appKeyResolver, actionTypeResolver, actionKeyResolver, connectionIdResolver, inputsAllOptionalResolver, } from "../../resolvers";
|
|
5
5
|
import { fetchImplementationNeeds } from "../../services/implementations";
|
|
6
6
|
import { createTelemetryCallback } from "../../utils/telemetry-utils";
|
|
7
|
+
import { setMethodMetadata } from "../../utils/telemetry-context";
|
|
7
8
|
export const getInputFieldsSchemaPlugin = ({ sdk, context }) => {
|
|
8
9
|
async function getInputFieldsSchema(options) {
|
|
9
10
|
const { api, getVersionedImplementationId } = context;
|
|
@@ -14,6 +15,11 @@ export const getInputFieldsSchemaPlugin = ({ sdk, context }) => {
|
|
|
14
15
|
if (!selectedApi) {
|
|
15
16
|
throw new ZapierConfigurationError("No current_implementation_id found for app", { configType: "current_implementation_id" });
|
|
16
17
|
}
|
|
18
|
+
setMethodMetadata({
|
|
19
|
+
selectedApi,
|
|
20
|
+
operationType: actionType,
|
|
21
|
+
operationKey: actionKey,
|
|
22
|
+
});
|
|
17
23
|
const { data: action } = await sdk.getAction({
|
|
18
24
|
appKey,
|
|
19
25
|
actionType,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listActions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,WAAW,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EACL,iBAAiB,EACjB,KAAK,kBAAkB,EAExB,MAAM,WAAW,CAAC;AAOnB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAExE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listActions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,WAAW,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EACL,iBAAiB,EACjB,KAAK,kBAAkB,EAExB,MAAM,WAAW,CAAC;AAOnB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAExE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAK7D,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,CAAC,OAAO,CAAC,EAAE,kBAAkB,KAAK,OAAO,CAAC;QACrD,IAAI,EAAE,UAAU,EAAE,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,UAAU,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QAC3D,KAAK,IAAI,aAAa,CAAC,UAAU,CAAC,CAAC;KACpC,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,WAAW,EAAE,OAAO,iBAAiB,CAAC;aACvC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,CACpC,UAAU,CAAC,sBAAsB,CAAC,EAClC;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,GAAG,oBAAoB,EACxB,yBAAyB,CA0G1B,CAAC"}
|
|
@@ -6,6 +6,7 @@ import { createPaginatedFunction } from "../../utils/function-utils";
|
|
|
6
6
|
import { appKeyResolver, actionTypeResolver } from "../../resolvers";
|
|
7
7
|
import { createTelemetryCallback } from "../../utils/telemetry-utils";
|
|
8
8
|
import { stripPageSuffix } from "../../utils/string-utils";
|
|
9
|
+
import { setMethodMetadata } from "../../utils/telemetry-context";
|
|
9
10
|
export const listActionsPlugin = ({ context }) => {
|
|
10
11
|
const methodMeta = {
|
|
11
12
|
categories: ["action"],
|
|
@@ -25,6 +26,11 @@ export const listActionsPlugin = ({ context }) => {
|
|
|
25
26
|
if (!selectedApi) {
|
|
26
27
|
throw new ZapierConfigurationError("No current_implementation_id found for app", { configType: "current_implementation_id" });
|
|
27
28
|
}
|
|
29
|
+
// operationKey is intentionally omitted — listActions is a list-level operation with no specific action key.
|
|
30
|
+
setMethodMetadata({
|
|
31
|
+
selectedApi,
|
|
32
|
+
operationType: options.actionType ?? null,
|
|
33
|
+
});
|
|
28
34
|
const searchParams = {
|
|
29
35
|
global: "true",
|
|
30
36
|
public_only: "true",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listConnections/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AACrF,OAAO,EACL,0BAA0B,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACzB,MAAM,WAAW,CAAC;AAInB,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAG1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listConnections/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AACrF,OAAO,EACL,0BAA0B,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACzB,MAAM,WAAW,CAAC;AAInB,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAG1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAM7D,MAAM,WAAW,6BAA6B;IAC5C,eAAe,EAAE,CACf,OAAO,CAAC,EAAE,sBAAsB,KAC7B,OAAO,CAAC,mBAAmB,CAAC,GAC/B,aAAa,CAAC,mBAAmB,CAAC,GAAG;QACnC,KAAK,IAAI,aAAa,CAAC,cAAc,CAAC,CAAC;KACxC,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,eAAe,EAAE;gBACf,WAAW,EAAE,OAAO,0BAA0B,CAAC;aAChD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,qBAAqB,EAAE,MAAM,CACxC,UAAU,CAAC,sBAAsB,CAAC,EAClC;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,GAAG,oBAAoB,EACxB,6BAA6B,CA4G9B,CAAC"}
|
|
@@ -6,6 +6,7 @@ import { ConnectionItemSchema } from "../../schemas/Connection";
|
|
|
6
6
|
import { createTelemetryCallback } from "../../utils/telemetry-utils";
|
|
7
7
|
import { stripPageSuffix } from "../../utils/string-utils";
|
|
8
8
|
import { ZapierAuthenticationError } from "../../types/errors";
|
|
9
|
+
import { setMethodMetadata } from "../../utils/telemetry-context";
|
|
9
10
|
export const listConnectionsPlugin = ({ context }) => {
|
|
10
11
|
async function listConnectionsPage(options) {
|
|
11
12
|
const { api, getVersionedImplementationId } = context;
|
|
@@ -16,6 +17,7 @@ export const listConnectionsPlugin = ({ context }) => {
|
|
|
16
17
|
if (options.appKey) {
|
|
17
18
|
const implementationId = await getVersionedImplementationId(options.appKey);
|
|
18
19
|
if (implementationId) {
|
|
20
|
+
setMethodMetadata({ selectedApi: implementationId });
|
|
19
21
|
// Extract versionless app key to pass to handler
|
|
20
22
|
const [versionlessSelectedApi] = splitVersionedKey(implementationId);
|
|
21
23
|
searchParams.app_key = versionlessSelectedApi;
|
|
@@ -3,8 +3,8 @@ import type { PaginatedSdkFunction } from "../../types/functions";
|
|
|
3
3
|
import type { ConnectionItem } from "@zapier/zapier-sdk-core/v0/schemas/connections";
|
|
4
4
|
import type { ZapierAuthenticationError, ZapierApiError, ZapierAppNotFoundError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
|
|
5
5
|
export declare const ListConnectionsQuerySchema: z.ZodObject<{
|
|
6
|
-
search: z.ZodOptional<z.ZodString>;
|
|
7
6
|
title: z.ZodOptional<z.ZodString>;
|
|
7
|
+
search: z.ZodOptional<z.ZodString>;
|
|
8
8
|
owner: z.ZodOptional<z.ZodString>;
|
|
9
9
|
appKey: z.ZodOptional<z.ZodString & {
|
|
10
10
|
_def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listInputFieldChoices/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EACL,2BAA2B,EAC3B,KAAK,4BAA4B,EAGlC,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAcxE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listInputFieldChoices/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EACL,2BAA2B,EAC3B,KAAK,4BAA4B,EAGlC,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAcxE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAgB7D,MAAM,WAAW,mCAAmC;IAClD,qBAAqB,EAAE,CAAC,OAAO,EAAE,4BAA4B,KAAK,OAAO,CAAC;QACxE,IAAI,EAAE,oBAAoB,EAAE,CAAC;QAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,oBAAoB,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QACrE,KAAK,IAAI,aAAa,CAAC,oBAAoB,CAAC,CAAC;KAC9C,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,qBAAqB,EAAE;gBACrB,WAAW,EAAE,OAAO,2BAA2B,CAAC;aACjD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAC9C,UAAU,CAAC,uBAAuB,CAAC,EAAE,4BAA4B;AACjE,AADqC,4BAA4B;AACjE;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,GAAG,oBAAoB,EAAE,2EAA2E;AACrG,mCAAmC,CA6JpC,CAAC"}
|
|
@@ -5,6 +5,7 @@ import { appKeyResolver, actionTypeResolver, actionKeyResolver, connectionIdReso
|
|
|
5
5
|
import { fetchImplementationNeeds, fetchImplementationChoices, } from "../../services/implementations";
|
|
6
6
|
import { createTelemetryCallback } from "../../utils/telemetry-utils";
|
|
7
7
|
import { stripPageSuffix } from "../../utils/string-utils";
|
|
8
|
+
import { setMethodMetadata } from "../../utils/telemetry-context";
|
|
8
9
|
// Transform NeedChoices to InputFieldChoiceItem
|
|
9
10
|
function transformNeedChoicesToInputFieldChoiceItem(choice) {
|
|
10
11
|
return {
|
|
@@ -26,6 +27,11 @@ export const listInputFieldChoicesPlugin = ({ context, sdk }) => {
|
|
|
26
27
|
if (!selectedApi) {
|
|
27
28
|
throw new ZapierConfigurationError("No current_implementation_id found for app", { configType: "current_implementation_id" });
|
|
28
29
|
}
|
|
30
|
+
setMethodMetadata({
|
|
31
|
+
selectedApi,
|
|
32
|
+
operationType: actionType,
|
|
33
|
+
operationKey: actionKey,
|
|
34
|
+
});
|
|
29
35
|
// Get action details
|
|
30
36
|
const { data: action } = await sdk.getAction({
|
|
31
37
|
appKey,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listInputFields/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,YAAY,EACZ,aAAa,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,qBAAqB,EACrB,KAAK,sBAAsB,EAE5B,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAYxE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listInputFields/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EACV,cAAc,EACd,aA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
7
7
|
import { fetchImplementationNeeds } from "../../services/implementations";
|
|
8
8
|
import { createTelemetryCallback } from "../../utils/telemetry-utils";
|
|
9
|
+
import { setMethodMetadata } from "../../utils/telemetry-context";
|
|
9
10
|
// Enums for input field transformation
|
|
10
11
|
var InputFieldType;
|
|
11
12
|
(function (InputFieldType) {
|
|
@@ -157,6 +158,11 @@ export const listInputFieldsPlugin = ({ sdk, context }) => {
|
|
|
157
158
|
if (!selectedApi) {
|
|
158
159
|
throw new ZapierConfigurationError("No current_implementation_id found for app", { configType: "current_implementation_id" });
|
|
159
160
|
}
|
|
161
|
+
setMethodMetadata({
|
|
162
|
+
selectedApi,
|
|
163
|
+
operationType: actionType,
|
|
164
|
+
operationKey: actionKey,
|
|
165
|
+
});
|
|
160
166
|
// Need to call getAction here because it resolves both action.key AND action.id
|
|
161
167
|
// eg: `create_report` or `core:39487493`
|
|
162
168
|
const { data: action } = await sdk.getAction({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/runAction/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EACL,eAAe,EACf,KAAK,gBAAgB,EAEtB,MAAM,WAAW,CAAC;AAQnB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAQtD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAExE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/runAction/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EACL,eAAe,EACf,KAAK,gBAAgB,EAEtB,MAAM,WAAW,CAAC;AAQnB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAQtD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAExE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAK7D,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,CAAC,OAAO,CAAC,EAAE,gBAAgB,KAAK,OAAO,CAAC;QACjD,IAAI,EAAE,GAAG,EAAE,CAAC;QACZ,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,GAAG,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QACpD,KAAK,IAAI,aAAa,CAAC,GAAG,CAAC,CAAC;KAC7B,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,SAAS,EAAE;gBACT,WAAW,EAAE,OAAO,eAAe,CAAC;aACrC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAyED,eAAO,MAAM,eAAe,EAAE,MAAM,CAClC,UAAU,CAAC,uBAAuB,GAAG,oBAAoB,CAAC,EAAE,uCAAuC;AACnG,AAD4D,uCAAuC;AACnG;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,GAAG,oBAAoB,EAAE,4CAA4C;AACtE,uBAAuB,CAqHxB,CAAC"}
|
|
@@ -6,13 +6,9 @@ import { appKeyResolver, actionTypeResolver, actionKeyResolver, connectionIdReso
|
|
|
6
6
|
import { createTelemetryCallback } from "../../utils/telemetry-utils";
|
|
7
7
|
import { stripPageSuffix } from "../../utils/string-utils";
|
|
8
8
|
import { DEFAULT_ACTION_TIMEOUT_MS } from "../../constants";
|
|
9
|
+
import { setMethodMetadata } from "../../utils/telemetry-context";
|
|
9
10
|
async function executeAction(actionOptions) {
|
|
10
|
-
const { api,
|
|
11
|
-
// Use the manifest plugin to get the current implementation ID
|
|
12
|
-
const selectedApi = await context.getVersionedImplementationId(appKey);
|
|
13
|
-
if (!selectedApi) {
|
|
14
|
-
throw new ZapierConfigurationError("No current_implementation_id found for app", { configType: "current_implementation_id" });
|
|
15
|
-
}
|
|
11
|
+
const { api, selectedApi, actionId, actionKey, actionType, executionOptions, connectionId, timeoutMs, } = actionOptions;
|
|
16
12
|
// Step 1: POST to /actions/v1/runs to start execution
|
|
17
13
|
const runRequestData = {
|
|
18
14
|
selected_api: selectedApi,
|
|
@@ -49,6 +45,15 @@ export const runActionPlugin = ({ sdk, context }) => {
|
|
|
49
45
|
const { appKey, actionKey, actionType, connectionId, authenticationId, inputs = {}, timeoutMs, } = options;
|
|
50
46
|
// Support both connectionId (new) and authenticationId (deprecated)
|
|
51
47
|
const resolvedConnectionId = connectionId ?? authenticationId;
|
|
48
|
+
const selectedApi = await context.getVersionedImplementationId(appKey);
|
|
49
|
+
if (!selectedApi) {
|
|
50
|
+
throw new ZapierConfigurationError("No current_implementation_id found for app", { configType: "current_implementation_id" });
|
|
51
|
+
}
|
|
52
|
+
setMethodMetadata({
|
|
53
|
+
selectedApi,
|
|
54
|
+
operationType: actionType,
|
|
55
|
+
operationKey: actionKey,
|
|
56
|
+
});
|
|
52
57
|
// Validate that the action exists using the getAction plugin
|
|
53
58
|
const actionData = await sdk.getAction({
|
|
54
59
|
appKey: appKey,
|
|
@@ -63,8 +68,7 @@ export const runActionPlugin = ({ sdk, context }) => {
|
|
|
63
68
|
// Execute the action using the Actions API (supports all action types)
|
|
64
69
|
const result = await executeAction({
|
|
65
70
|
api,
|
|
66
|
-
|
|
67
|
-
appKey,
|
|
71
|
+
selectedApi,
|
|
68
72
|
// Some actions require the action ID to run them, but technically the ID is not guaranteed to be available when
|
|
69
73
|
// we retrieve actions (probably legacy reasons), so we just pass along all the things!
|
|
70
74
|
actionId,
|
package/dist/schemas/Action.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const ActionItemSchema: z.ZodObject<{
|
|
3
|
-
key: z.ZodString;
|
|
4
|
-
description: z.ZodString;
|
|
5
3
|
id: z.ZodOptional<z.ZodString>;
|
|
4
|
+
description: z.ZodString;
|
|
5
|
+
key: z.ZodString;
|
|
6
6
|
is_important: z.ZodOptional<z.ZodBoolean>;
|
|
7
7
|
is_hidden: z.ZodOptional<z.ZodBoolean>;
|
|
8
8
|
app_key: z.ZodString;
|
|
@@ -8,44 +8,164 @@
|
|
|
8
8
|
* - PKCE: OAuth client ID for interactive login (CLI only)
|
|
9
9
|
* - Function: Lazy/dynamic credential resolution
|
|
10
10
|
*/
|
|
11
|
+
import { z } from "zod";
|
|
11
12
|
/**
|
|
12
13
|
* Client credentials for OAuth client_credentials flow.
|
|
13
14
|
* The SDK will exchange these for an access token.
|
|
14
15
|
*/
|
|
15
|
-
export
|
|
16
|
-
type
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
export declare const ClientCredentialsObjectSchema: z.ZodObject<{
|
|
17
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
18
|
+
client_credentials: "client_credentials";
|
|
19
|
+
}>>;
|
|
20
|
+
clientId: z.ZodString;
|
|
21
|
+
clientSecret: z.ZodString;
|
|
22
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
23
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
export type ClientCredentialsObject = z.infer<typeof ClientCredentialsObjectSchema>;
|
|
22
26
|
/**
|
|
23
27
|
* PKCE credentials for interactive OAuth flow.
|
|
24
28
|
* Only works when @zapier/zapier-sdk-cli-login is available.
|
|
25
29
|
*/
|
|
26
|
-
export
|
|
27
|
-
type
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
export declare const PkceCredentialsObjectSchema: z.ZodObject<{
|
|
31
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
32
|
+
pkce: "pkce";
|
|
33
|
+
}>>;
|
|
34
|
+
clientId: z.ZodString;
|
|
35
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
36
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
export type PkceCredentialsObject = z.infer<typeof PkceCredentialsObjectSchema>;
|
|
32
39
|
/**
|
|
33
40
|
* Union of all credential object types.
|
|
34
41
|
*/
|
|
35
|
-
export
|
|
42
|
+
export declare const CredentialsObjectSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
43
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
44
|
+
client_credentials: "client_credentials";
|
|
45
|
+
}>>;
|
|
46
|
+
clientId: z.ZodString;
|
|
47
|
+
clientSecret: z.ZodString;
|
|
48
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
49
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
50
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
51
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
52
|
+
pkce: "pkce";
|
|
53
|
+
}>>;
|
|
54
|
+
clientId: z.ZodString;
|
|
55
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
56
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
57
|
+
}, z.core.$strip>]>;
|
|
58
|
+
export type CredentialsObject = z.infer<typeof CredentialsObjectSchema>;
|
|
36
59
|
/**
|
|
37
60
|
* Resolved credentials - what a credentials function must return.
|
|
38
61
|
* Either a string (token) or a credentials object.
|
|
39
62
|
* Functions are not allowed to return other functions.
|
|
40
63
|
*/
|
|
41
|
-
export
|
|
64
|
+
export declare const ResolvedCredentialsSchema: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
65
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
66
|
+
client_credentials: "client_credentials";
|
|
67
|
+
}>>;
|
|
68
|
+
clientId: z.ZodString;
|
|
69
|
+
clientSecret: z.ZodString;
|
|
70
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
71
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
72
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
73
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
74
|
+
pkce: "pkce";
|
|
75
|
+
}>>;
|
|
76
|
+
clientId: z.ZodString;
|
|
77
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
78
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
79
|
+
}, z.core.$strip>]>]>;
|
|
80
|
+
export type ResolvedCredentials = z.infer<typeof ResolvedCredentialsSchema>;
|
|
81
|
+
/**
|
|
82
|
+
* Lazy/dynamic credential resolution — a function returning resolved credentials.
|
|
83
|
+
*/
|
|
84
|
+
export declare const CredentialsFunctionSchema: z.ZodFunction<z.core.$ZodTuple<readonly [], z.core.$ZodFunctionOut>, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
85
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
86
|
+
client_credentials: "client_credentials";
|
|
87
|
+
}>>;
|
|
88
|
+
clientId: z.ZodString;
|
|
89
|
+
clientSecret: z.ZodString;
|
|
90
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
91
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
92
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
93
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
94
|
+
pkce: "pkce";
|
|
95
|
+
}>>;
|
|
96
|
+
clientId: z.ZodString;
|
|
97
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
98
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
99
|
+
}, z.core.$strip>]>]>, z.ZodPromise<z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
100
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
101
|
+
client_credentials: "client_credentials";
|
|
102
|
+
}>>;
|
|
103
|
+
clientId: z.ZodString;
|
|
104
|
+
clientSecret: z.ZodString;
|
|
105
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
106
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
107
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
108
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
109
|
+
pkce: "pkce";
|
|
110
|
+
}>>;
|
|
111
|
+
clientId: z.ZodString;
|
|
112
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
113
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
114
|
+
}, z.core.$strip>]>]>>]>>;
|
|
115
|
+
export type CredentialsFunction = z.infer<typeof CredentialsFunctionSchema>;
|
|
42
116
|
/**
|
|
43
117
|
* Credentials can be:
|
|
44
118
|
* - A string (token or API key)
|
|
45
119
|
* - A credentials object (client_credentials or pkce)
|
|
46
120
|
* - A function that returns credentials (sync or async)
|
|
47
121
|
*/
|
|
48
|
-
export
|
|
122
|
+
export declare const CredentialsSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
123
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
124
|
+
client_credentials: "client_credentials";
|
|
125
|
+
}>>;
|
|
126
|
+
clientId: z.ZodString;
|
|
127
|
+
clientSecret: z.ZodString;
|
|
128
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
129
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
130
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
131
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
132
|
+
pkce: "pkce";
|
|
133
|
+
}>>;
|
|
134
|
+
clientId: z.ZodString;
|
|
135
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
136
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
137
|
+
}, z.core.$strip>]>]>, z.ZodFunction<z.core.$ZodTuple<readonly [], z.core.$ZodFunctionOut>, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
138
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
139
|
+
client_credentials: "client_credentials";
|
|
140
|
+
}>>;
|
|
141
|
+
clientId: z.ZodString;
|
|
142
|
+
clientSecret: z.ZodString;
|
|
143
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
144
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
145
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
146
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
147
|
+
pkce: "pkce";
|
|
148
|
+
}>>;
|
|
149
|
+
clientId: z.ZodString;
|
|
150
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
151
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
152
|
+
}, z.core.$strip>]>]>, z.ZodPromise<z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
|
|
153
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
154
|
+
client_credentials: "client_credentials";
|
|
155
|
+
}>>;
|
|
156
|
+
clientId: z.ZodString;
|
|
157
|
+
clientSecret: z.ZodString;
|
|
158
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
159
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
160
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
161
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
162
|
+
pkce: "pkce";
|
|
163
|
+
}>>;
|
|
164
|
+
clientId: z.ZodString;
|
|
165
|
+
baseUrl: z.ZodOptional<z.ZodString>;
|
|
166
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
167
|
+
}, z.core.$strip>]>]>>]>>]>;
|
|
168
|
+
export type Credentials = z.infer<typeof CredentialsSchema>;
|
|
49
169
|
/**
|
|
50
170
|
* Type guard for client credentials objects.
|
|
51
171
|
*/
|
|
@@ -61,5 +181,5 @@ export declare function isCredentialsObject(credentials: ResolvedCredentials): c
|
|
|
61
181
|
/**
|
|
62
182
|
* Type guard for credentials functions.
|
|
63
183
|
*/
|
|
64
|
-
export declare function isCredentialsFunction(credentials: Credentials): credentials is
|
|
184
|
+
export declare function isCredentialsFunction(credentials: Credentials): credentials is CredentialsFunction;
|
|
65
185
|
//# sourceMappingURL=credentials.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/types/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/types/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;iBAoBxC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,2BAA2B;;;;;;;iBAgBtC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;mBAGlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE;;;;GAIG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;q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