@zapier/zapier-sdk 0.18.1 → 0.18.3

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.
Files changed (57) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +17 -17
  3. package/dist/api/router.d.ts.map +1 -1
  4. package/dist/api/router.js +1 -7
  5. package/dist/api/router.test.js +1 -7
  6. package/dist/api/schemas.d.ts +0 -49
  7. package/dist/api/schemas.d.ts.map +1 -1
  8. package/dist/api/schemas.js +0 -28
  9. package/dist/api/types.d.ts +2 -1
  10. package/dist/api/types.d.ts.map +1 -1
  11. package/dist/api/types.js +0 -10
  12. package/dist/index.cjs +38 -301
  13. package/dist/index.d.mts +114 -207
  14. package/dist/index.mjs +38 -301
  15. package/dist/plugins/findFirstAuthentication/index.test.js +2 -2
  16. package/dist/plugins/findUniqueAuthentication/index.test.js +2 -2
  17. package/dist/plugins/getAuthentication/index.d.ts +3 -3
  18. package/dist/plugins/getAuthentication/index.d.ts.map +1 -1
  19. package/dist/plugins/getAuthentication/index.js +3 -5
  20. package/dist/plugins/getAuthentication/index.test.js +4 -16
  21. package/dist/plugins/getAuthentication/schemas.d.ts +2 -4
  22. package/dist/plugins/getAuthentication/schemas.d.ts.map +1 -1
  23. package/dist/plugins/getAuthentication/schemas.js +1 -1
  24. package/dist/plugins/listAuthentications/index.d.ts +4 -10
  25. package/dist/plugins/listAuthentications/index.d.ts.map +1 -1
  26. package/dist/plugins/listAuthentications/index.js +19 -31
  27. package/dist/plugins/listAuthentications/index.test.js +347 -127
  28. package/dist/plugins/listAuthentications/schemas.d.ts +7 -7
  29. package/dist/plugins/listAuthentications/schemas.d.ts.map +1 -1
  30. package/dist/plugins/listAuthentications/schemas.js +10 -16
  31. package/dist/schemas/Auth.d.ts +11 -11
  32. package/dist/schemas/Auth.d.ts.map +1 -1
  33. package/dist/schemas/Auth.js +2 -12
  34. package/dist/sdk.d.ts +4 -2
  35. package/dist/sdk.d.ts.map +1 -1
  36. package/dist/temporary-internal-core/index.d.ts +0 -2
  37. package/dist/temporary-internal-core/index.d.ts.map +1 -1
  38. package/dist/temporary-internal-core/index.js +0 -2
  39. package/dist/temporary-internal-core/utils/transformations.d.ts +0 -14
  40. package/dist/temporary-internal-core/utils/transformations.d.ts.map +1 -1
  41. package/dist/temporary-internal-core/utils/transformations.js +0 -38
  42. package/dist/utils/domain-utils.d.ts +2 -15
  43. package/dist/utils/domain-utils.d.ts.map +1 -1
  44. package/dist/utils/domain-utils.js +0 -38
  45. package/dist/utils/function-utils.d.ts +1 -0
  46. package/dist/utils/function-utils.d.ts.map +1 -1
  47. package/dist/utils/function-utils.js +15 -3
  48. package/package.json +2 -1
  49. package/dist/temporary-internal-core/handlers/getAuthentication.d.ts +0 -94
  50. package/dist/temporary-internal-core/handlers/getAuthentication.d.ts.map +0 -1
  51. package/dist/temporary-internal-core/handlers/getAuthentication.js +0 -68
  52. package/dist/temporary-internal-core/handlers/getAuthentication.test.d.ts +0 -2
  53. package/dist/temporary-internal-core/handlers/getAuthentication.test.d.ts.map +0 -1
  54. package/dist/temporary-internal-core/handlers/getAuthentication.test.js +0 -248
  55. package/dist/temporary-internal-core/schemas/authentications/index.d.ts +0 -150
  56. package/dist/temporary-internal-core/schemas/authentications/index.d.ts.map +0 -1
  57. package/dist/temporary-internal-core/schemas/authentications/index.js +0 -97
@@ -1,16 +1,16 @@
1
1
  import { z } from "zod";
2
2
  import type { PaginatedSdkFunction } from "../../types/functions";
3
- import type { AuthenticationItem } from "../../types/domain";
3
+ import type { AuthenticationItem } from "@zapier/zapier-sdk-core/v0/schemas/authentications";
4
4
  import type { ZapierAuthenticationError, ZapierApiError, ZapierAppNotFoundError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
5
- export declare const ListAuthenticationsSchema: z.ZodObject<{
5
+ export declare const ListAuthenticationsQuerySchema: z.ZodObject<{
6
+ search: z.ZodOptional<z.ZodString>;
7
+ title: z.ZodOptional<z.ZodString>;
8
+ accountId: z.ZodOptional<z.ZodString>;
9
+ owner: z.ZodOptional<z.ZodString>;
6
10
  appKey: z.ZodOptional<z.ZodString & {
7
11
  _def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
8
12
  }>;
9
13
  authenticationIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
10
- search: z.ZodOptional<z.ZodString>;
11
- title: z.ZodOptional<z.ZodString>;
12
- accountId: z.ZodOptional<z.ZodString>;
13
- owner: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"me">]>>;
14
14
  pageSize: z.ZodOptional<z.ZodNumber>;
15
15
  maxItems: z.ZodOptional<z.ZodNumber>;
16
16
  cursor: z.ZodOptional<z.ZodString>;
@@ -18,7 +18,7 @@ export declare const ListAuthenticationsSchema: z.ZodObject<{
18
18
  isNested: z.ZodOptional<z.ZodBoolean>;
19
19
  }, z.core.$strip>>;
20
20
  }, z.core.$strip>;
21
- export type ListAuthenticationsOptions = z.infer<typeof ListAuthenticationsSchema>;
21
+ export type ListAuthenticationsOptions = z.infer<typeof ListAuthenticationsQuerySchema>;
22
22
  export interface ListAuthenticationsPage {
23
23
  data: AuthenticationItem[];
24
24
  nextCursor?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/listAuthentications/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAI5B,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;iBAqC+B,CAAC;AAGtE,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAC9C,OAAO,yBAAyB,CACjC,CAAC;AAGF,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,kBAAkB,EAAE,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAGD,MAAM,MAAM,wBAAwB,GAChC,yBAAyB,GACzB,cAAc,GACd,sBAAsB,GACtB,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,8BAA8B;IAC7C,mBAAmB,EAAE,oBAAoB,CACvC,0BAA0B,EAC1B,kBAAkB,CACnB,CAAC;CACH"}
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/listAuthentications/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AAE7F,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;iBA+B0B,CAAC;AAGtE,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAC9C,OAAO,8BAA8B,CACtC,CAAC;AAGF,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,kBAAkB,EAAE,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAGD,MAAM,MAAM,wBAAwB,GAChC,yBAAyB,GACzB,cAAc,GACd,sBAAsB,GACtB,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,8BAA8B;IAC7C,mBAAmB,EAAE,oBAAoB,CACvC,0BAA0B,EAC1B,kBAAkB,CACnB,CAAC;CACH"}
@@ -1,37 +1,31 @@
1
1
  import { z } from "zod";
2
2
  import { AppKeyPropertySchema } from "../../types/properties";
3
+ import { ListAuthenticationsQuerySchema as ListAuthenticationsQueryBase } from "@zapier/zapier-sdk-core/v0/schemas/authentications";
3
4
  import { TelemetryMarkerSchema } from "../../utils/function-utils";
4
- // Pure Zod schema - no resolver metadata!
5
- export const ListAuthenticationsSchema = z
6
- .object({
5
+ export const ListAuthenticationsQuerySchema = ListAuthenticationsQueryBase.omit({
6
+ offset: true,
7
+ })
8
+ .extend({
9
+ // Override appKey with our custom schema (array type, different description)
7
10
  appKey: AppKeyPropertySchema.optional().describe("App key of authentications to list (e.g., 'SlackCLIAPI' or slug like 'github')"),
11
+ // Override authenticationIds to be an array instead of comma-separated string
8
12
  authenticationIds: z
9
13
  .array(z.string())
10
14
  .optional()
11
15
  .describe("List of authentication IDs to filter by"),
12
- search: z
13
- .string()
14
- .optional()
15
- .describe("Search term to filter authentications by title"),
16
- title: z
17
- .string()
18
- .optional()
19
- .describe("Filter authentications by exact title match"),
20
- accountId: z.string().optional().describe("Filter by account ID"),
21
- owner: z
22
- .union([z.string(), z.literal("me")])
23
- .optional()
24
- .describe("Filter by owner, 'me' for your own authentications or a specific user ID"),
16
+ // Override pageSize to make optional (needs to be fixed in `zapier-sdk-core`)
25
17
  pageSize: z
26
18
  .number()
27
19
  .min(1)
28
20
  .optional()
29
21
  .describe("Number of authentications per page"),
22
+ // SDK specific property for pagination/iterator helpers
30
23
  maxItems: z
31
24
  .number()
32
25
  .min(1)
33
26
  .optional()
34
27
  .describe("Maximum total items to return across all pages"),
28
+ // SDK specific property for pagination/iterator helpers
35
29
  cursor: z.string().optional().describe("Cursor to start from"),
36
30
  })
37
31
  .merge(TelemetryMarkerSchema)
@@ -1,8 +1,5 @@
1
- import { z } from "zod";
1
+ import type { z } from "zod";
2
2
  export declare const AuthenticationItemSchema: z.ZodObject<{
3
- url: z.ZodOptional<z.ZodString>;
4
- members: z.ZodOptional<z.ZodString>;
5
- label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6
3
  date: z.ZodString;
7
4
  lastchanged: z.ZodOptional<z.ZodString>;
8
5
  destination_selected_api: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -12,23 +9,23 @@ export declare const AuthenticationItemSchema: z.ZodObject<{
12
9
  is_stale: z.ZodOptional<z.ZodString>;
13
10
  is_shared: z.ZodOptional<z.ZodString>;
14
11
  marked_stale_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12
+ label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
15
13
  identifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
16
14
  title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
17
- groups: z.ZodOptional<z.ZodString>;
15
+ url: z.ZodOptional<z.ZodString>;
16
+ groups: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
17
+ members: z.ZodOptional<z.ZodString>;
18
18
  permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
19
19
  id: z.ZodString;
20
20
  account_id: z.ZodString;
21
21
  implementation_id: z.ZodOptional<z.ZodString>;
22
+ profile_id: z.ZodOptional<z.ZodString>;
22
23
  is_expired: z.ZodOptional<z.ZodString>;
23
24
  expired_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
24
25
  app_key: z.ZodOptional<z.ZodString>;
25
26
  app_version: z.ZodOptional<z.ZodString>;
26
- profile_id: z.ZodOptional<z.ZodString>;
27
27
  }, z.core.$strip>;
28
28
  export declare const AuthItemSchema: z.ZodObject<{
29
- url: z.ZodOptional<z.ZodString>;
30
- members: z.ZodOptional<z.ZodString>;
31
- label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
32
29
  date: z.ZodString;
33
30
  lastchanged: z.ZodOptional<z.ZodString>;
34
31
  destination_selected_api: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -38,18 +35,21 @@ export declare const AuthItemSchema: z.ZodObject<{
38
35
  is_stale: z.ZodOptional<z.ZodString>;
39
36
  is_shared: z.ZodOptional<z.ZodString>;
40
37
  marked_stale_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
38
+ label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
41
39
  identifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
42
40
  title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
43
- groups: z.ZodOptional<z.ZodString>;
41
+ url: z.ZodOptional<z.ZodString>;
42
+ groups: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
43
+ members: z.ZodOptional<z.ZodString>;
44
44
  permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
45
45
  id: z.ZodString;
46
46
  account_id: z.ZodString;
47
47
  implementation_id: z.ZodOptional<z.ZodString>;
48
+ profile_id: z.ZodOptional<z.ZodString>;
48
49
  is_expired: z.ZodOptional<z.ZodString>;
49
50
  expired_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
51
  app_key: z.ZodOptional<z.ZodString>;
51
52
  app_version: z.ZodOptional<z.ZodString>;
52
- profile_id: z.ZodOptional<z.ZodString>;
53
53
  }, z.core.$strip>;
54
54
  export type AuthItem = z.infer<typeof AuthItemSchema>;
55
55
  //# sourceMappingURL=Auth.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Auth.d.ts","sourceRoot":"","sources":["../../src/schemas/Auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;iBA2CpC,CAAC;AAGF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;iBAA2B,CAAC;AAMvD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
1
+ {"version":3,"file":"Auth.d.ts","sourceRoot":"","sources":["../../src/schemas/Auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQ7B,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;iBAgCpC,CAAC;AAGF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;iBAA2B,CAAC;AAMvD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
@@ -1,19 +1,9 @@
1
- import { z } from "zod";
2
1
  import { withFormatter } from "../utils/schema-utils";
3
- import { AuthenticationSchema } from "../api/schemas";
2
+ import { AuthenticationItemSchema as AuthenticationItemSchemaBase } from "@zapier/zapier-sdk-core/v0/schemas/authentications";
4
3
  // ============================================================================
5
4
  // Authentication Item Schema (extends API schema with computed fields and formatting)
6
5
  // ============================================================================
7
- export const AuthenticationItemSchema = withFormatter(AuthenticationSchema.omit({ selected_api: true, customuser_id: true }).extend({
8
- id: z.string(), // Converted from number
9
- account_id: z.string(), // Converted from number
10
- implementation_id: z.string().optional(), // Renamed from selected_api
11
- is_expired: z.string().optional(), // Mapped from is_stale
12
- expired_at: z.string().nullable().optional(), // Mapped from marked_stale_at
13
- app_key: z.string().optional(), // App key from implementations endpoint
14
- app_version: z.string().optional(), // Version extracted from implementation_id
15
- profile_id: z.string().optional(), // Mapped from customuser_id, converted from number
16
- }), {
6
+ export const AuthenticationItemSchema = withFormatter(AuthenticationItemSchemaBase, {
17
7
  format: (item) => {
18
8
  const details = [];
19
9
  if (item.identifier) {
package/dist/sdk.d.ts CHANGED
@@ -94,13 +94,15 @@ export declare function createZapierSdkWithoutRegistry(options?: ZapierSdkOption
94
94
  } & {
95
95
  meta: {
96
96
  listAuthentications: {
97
- inputSchema: typeof import("./plugins/listAuthentications/schemas").ListAuthenticationsSchema;
97
+ inputSchema: typeof import("./plugins/listAuthentications/schemas").ListAuthenticationsQuerySchema;
98
98
  };
99
99
  };
100
100
  } & {
101
101
  meta: {
102
102
  getAuthentication: {
103
- inputSchema: typeof import("./temporary-internal-core").GetAuthenticationOptionsSchema;
103
+ inputSchema: import("zod").ZodObject<{
104
+ authenticationId: import("zod").ZodString;
105
+ }, import("zod/v4/core").$strip>;
104
106
  };
105
107
  };
106
108
  } & {
package/dist/sdk.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAMlD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EACV,GAAG,EACH,MAAM,EACN,wBAAwB,EACxB,oBAAoB,EACpB,cAAc,EACd,UAAU,EACX,MAAM,gBAAgB,CAAC;AA2BxB,MAAM,WAAW,gBAAiB,SAAQ,cAAc;CAAG;AAG3D,wBAAgB,SAAS,CACvB,WAAW,GAAG,EAAE,EAChB,eAAe,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;CAAE,GAAG;IAC7D,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CAClC,EAED,OAAO,GAAE,gBAAqB,EAC9B,UAAU,GAAE,WAA+B,EAC3C,cAAc,GAAE,eAAiD;;cAKrD,gBAAgB,EAAE,SAAS,SAAS,cAAc,UAClD,MAAM,CACZ,WAAW,GAAG;QAAE,UAAU,IAAI,eAAe,CAAA;KAAE,EAC/C,gBAAgB,EAChB,SAAS,CACV,qBACiB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACxC,GAAG,CACJ,WAAW,GAAG,oBAAoB,CAAC,SAAS,CAAC,EAC7C,eAAe,GAAG,WAAW,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC,CACnE;EA8DJ;AAED,wBAAgB,8BAA8B,CAAC,OAAO,GAAE,gBAAqB;UApFnE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;;;;;;;;;;;;+BAD2B,CAAC;kBAC/C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;UApFnE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;;;;;;;;;;;;+BAD2B,CAAC;kBAC/C,CAAC;;;;kBAKG,CAAC;iBAAyB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuH/C;AAED,wBAAgB,eAAe,CAAC,OAAO,GAAE,gBAAqB,GAAG,SAAS,CAMzE"}
@@ -14,7 +14,5 @@
14
14
  export type { HandlerDeps, Handler, ValidatedHandler } from "./types";
15
15
  export * from "./schemas/apps";
16
16
  export * from "./schemas/implementations";
17
- export * from "./schemas/authentications";
18
17
  export { handleListApps, type ListAppsHandlerDeps } from "./handlers/listApps";
19
- export { handleGetAuthentication, type GetAuthenticationHandlerDeps, } from "./handlers/getAuthentication";
20
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/temporary-internal-core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAGtE,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAG1C,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EACL,uBAAuB,EACvB,KAAK,4BAA4B,GAClC,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/temporary-internal-core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAGtE,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAG1C,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -14,7 +14,5 @@
14
14
  // Schemas
15
15
  export * from "./schemas/apps";
16
16
  export * from "./schemas/implementations";
17
- export * from "./schemas/authentications";
18
17
  // Handlers
19
18
  export { handleListApps } from "./handlers/listApps";
20
- export { handleGetAuthentication, } from "./handlers/getAuthentication";
@@ -5,7 +5,6 @@
5
5
  */
6
6
  import type { ImplementationMeta } from "../schemas/implementations";
7
7
  import type { AppItem } from "../schemas/apps";
8
- import { type Authentication, type AuthenticationItem } from "../schemas/authentications";
9
8
  /**
10
9
  * Transforms ImplementationMeta from internal API to AppItem for SDK responses
11
10
  */
@@ -16,17 +15,4 @@ export declare function transformImplementationMetaToAppItem(implementationMeta:
16
15
  export declare function extractPaginationCursor(response: {
17
16
  next?: string | null;
18
17
  }): string | undefined;
19
- /**
20
- * Converts an API Authentication to an AuthenticationItem with normalized field names
21
- *
22
- * @param auth - Raw Authentication from API
23
- * @param options - Additional fields to include
24
- * @param options.app_key - selected_api from implementations endpoint
25
- * @param options.app_version - Version extracted from selected_api
26
- * @returns Normalized AuthenticationItem
27
- */
28
- export declare function normalizeAuthenticationItem(auth: Authentication, options?: {
29
- app_key?: string;
30
- app_version?: string;
31
- }): AuthenticationItem;
32
18
  //# sourceMappingURL=transformations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transformations.d.ts","sourceRoot":"","sources":["../../../src/temporary-internal-core/utils/transformations.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACxB,MAAM,4BAA4B,CAAC;AAEpC;;GAEG;AACH,wBAAgB,oCAAoC,CAClD,kBAAkB,EAAE,kBAAkB,GACrC,OAAO,CAYT;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE;IAChD,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,GAAG,MAAM,GAAG,SAAS,CAYrB;AAED;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,cAAc,EACpB,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAO,GACvD,kBAAkB,CAyCpB"}
1
+ {"version":3,"file":"transformations.d.ts","sourceRoot":"","sources":["../../../src/temporary-internal-core/utils/transformations.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG/C;;GAEG;AACH,wBAAgB,oCAAoC,CAClD,kBAAkB,EAAE,kBAAkB,GACrC,OAAO,CAYT;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE;IAChD,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,GAAG,MAAM,GAAG,SAAS,CAYrB"}
@@ -34,41 +34,3 @@ export function extractPaginationCursor(response) {
34
34
  return undefined;
35
35
  }
36
36
  }
37
- /**
38
- * Converts an API Authentication to an AuthenticationItem with normalized field names
39
- *
40
- * @param auth - Raw Authentication from API
41
- * @param options - Additional fields to include
42
- * @param options.app_key - selected_api from implementations endpoint
43
- * @param options.app_version - Version extracted from selected_api
44
- * @returns Normalized AuthenticationItem
45
- */
46
- export function normalizeAuthenticationItem(auth, options = {}) {
47
- // Extract app key and version from selected_api if not provided
48
- let appKey = options.app_key;
49
- let appVersion = options.app_version;
50
- if (auth.selected_api) {
51
- const [extractedAppKey, extractedVersion] = splitVersionedKey(auth.selected_api);
52
- // Use extracted app key if not provided in options
53
- if (!appKey) {
54
- appKey = extractedAppKey;
55
- }
56
- // Use extracted version if not provided in options
57
- if (!appVersion) {
58
- appVersion = extractedVersion;
59
- }
60
- }
61
- const { selected_api: selectedApi, customuser_id: profileId, id, account_id: accountId, ...restOfAuth } = auth;
62
- return {
63
- ...restOfAuth, // Pass through all other API response fields except selected_api
64
- id: String(id), // Convert to string
65
- account_id: String(accountId), // Convert to string
66
- implementation_id: selectedApi, // Rename selected_api to implementation_id
67
- title: auth.title || auth.label || undefined, // Coerce title from label if missing
68
- is_expired: auth.is_stale, // Map is_stale to is_expired
69
- expired_at: auth.marked_stale_at, // Map marked_stale_at to expired_at
70
- app_key: appKey, // App key from implementations endpoint or parsed from selected_api
71
- app_version: appVersion, // Version from selected_api or provided
72
- profile_id: profileId != null ? String(profileId) : undefined, // Map customuser_id to profile_id, convert to string
73
- };
74
- }
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Domain utility functions for working with app identifiers and data normalization
3
3
  */
4
- import type { Action, Authentication, ImplementationMeta } from "../api/types";
5
- import type { ActionItem, AppItem, AuthenticationItem } from "../types/domain";
4
+ import type { Action, ImplementationMeta } from "../api/types";
5
+ import type { ActionItem, AppItem } from "../types/domain";
6
6
  /**
7
7
  * Splits a versioned key to extract the base key and version
8
8
  *
@@ -21,19 +21,6 @@ export declare function splitVersionedKey(versionedKey: string): [string, string
21
21
  * @returns Normalized AppItem with essential fields only
22
22
  */
23
23
  export declare function normalizeImplementationMetaToAppItem(implementationMeta: ImplementationMeta): AppItem;
24
- /**
25
- * Converts an API Authentication to an AuthenticationItem with normalized field names
26
- *
27
- * @param auth - Raw Authentication from API
28
- * @param options - Additional fields to include
29
- * @param options.app_key - selected_api from implementations endpoint
30
- * @param options.app_version - Version extracted from selected_api
31
- * @returns Normalized AuthenticationItem
32
- */
33
- export declare function normalizeAuthenticationItem(auth: Authentication, options?: {
34
- app_key?: string;
35
- app_version?: string;
36
- }): AuthenticationItem;
37
24
  export declare function normalizeActionItem(action: Action): ActionItem;
38
25
  /**
39
26
  * Groups app keys by their type based on format patterns
@@ -1 +1 @@
1
- {"version":3,"file":"domain-utils.d.ts","sourceRoot":"","sources":["../../src/utils/domain-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE/E;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,MAAM,GACnB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAQ9B;AAED;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAClD,kBAAkB,EAAE,kBAAkB,GACrC,OAAO,CAYT;AAED;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,cAAc,EACpB,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAO,GACvD,kBAAkB,CAyCpB;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAsB9D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG;IAC9D,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAgCA;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG;IACrD,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAUA;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE5C;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOtD;AAED,wBAAgB,qBAAqB,CAAC,IAA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gCA;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG;IACrD,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAUA;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE5C;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOtD;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAY1D;AAED,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AACD,MAAM,WAAW,kBAAmB,SAAQ,UAAU;IACpD,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAI9C;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAkBvD;AAED,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,UAAU,GACrB,UAAU,IAAI,kBAAkB,CAElC;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,kBAAkB,GAAG,MAAM,CAEzE"}
@@ -37,44 +37,6 @@ export function normalizeImplementationMetaToAppItem(implementationMeta) {
37
37
  version: appVersion,
38
38
  };
39
39
  }
40
- /**
41
- * Converts an API Authentication to an AuthenticationItem with normalized field names
42
- *
43
- * @param auth - Raw Authentication from API
44
- * @param options - Additional fields to include
45
- * @param options.app_key - selected_api from implementations endpoint
46
- * @param options.app_version - Version extracted from selected_api
47
- * @returns Normalized AuthenticationItem
48
- */
49
- export function normalizeAuthenticationItem(auth, options = {}) {
50
- // Extract app key and version from selected_api if not provided
51
- let appKey = options.app_key;
52
- let appVersion = options.app_version;
53
- if (auth.selected_api) {
54
- const [extractedAppKey, extractedVersion] = splitVersionedKey(auth.selected_api);
55
- // Use extracted app key if not provided in options
56
- if (!appKey) {
57
- appKey = extractedAppKey;
58
- }
59
- // Use extracted version if not provided in options
60
- if (!appVersion) {
61
- appVersion = extractedVersion;
62
- }
63
- }
64
- const { selected_api: selectedApi, customuser_id: profileId, id, account_id: accountId, ...restOfAuth } = auth;
65
- return {
66
- ...restOfAuth, // Pass through all other API response fields except selected_api
67
- id: String(id), // Convert to string
68
- account_id: String(accountId), // Convert to string
69
- implementation_id: selectedApi, // Rename selected_api to implementation_id
70
- title: auth.title || auth.label || undefined, // Coerce title from label if missing
71
- is_expired: auth.is_stale, // Map is_stale to is_expired
72
- expired_at: auth.marked_stale_at, // Map marked_stale_at to expired_at
73
- app_key: appKey, // App key from implementations endpoint or parsed from selected_api
74
- app_version: appVersion, // Version from selected_api or provided
75
- profile_id: profileId != null ? String(profileId) : undefined, // Map customuser_id to profile_id, convert to string
76
- };
77
- }
78
40
  export function normalizeActionItem(action) {
79
41
  const { name, type, selected_api: selectedApi } = action;
80
42
  // Split version from selected_api
@@ -30,6 +30,7 @@ export interface TelemetryCallbacks {
30
30
  }
31
31
  /**
32
32
  * Helper function to extract cursor from pagination data
33
+ * Supports JSON:API style `links.next` URLs by extracting the `offset` parameter.
33
34
  */
34
35
  export declare function extractCursor(data: {
35
36
  next?: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"function-utils.d.ts","sourceRoot":"","sources":["../../src/utils/function-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;iBAMhC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,cAAc,CAAC,EAAE,CAAC,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C,EAAE,kBAAkB,EAC9B,oBAAoB,CAAC,EAAE,MAAM,GAC5B,CACD,OAAO,CAAC,EAAE,QAAQ,GAAG;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,KACE,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,GACpC,aAAa,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,GAAG;IACxC,KAAK,IAAI,aAAa,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;CAC3C,CAgHF"}
@@ -18,6 +18,7 @@ export const TelemetryMarkerSchema = z.object({
18
18
  });
19
19
  /**
20
20
  * Helper function to extract cursor from pagination data
21
+ * Supports JSON:API style `links.next` URLs by extracting the `offset` parameter.
21
22
  */
22
23
  export function extractCursor(data) {
23
24
  if (!data?.next) {
@@ -123,10 +124,21 @@ function createPageFunction(coreFn) {
123
124
  const result = await coreFn(options);
124
125
  // If result already has a data property, ensure it's an array
125
126
  if (result && typeof result === "object" && "data" in result) {
126
- const data = result.data;
127
+ const paginatedResult = result;
128
+ // Support both nextCursor and JSON:API links.next format
129
+ let nextCursor;
130
+ if (paginatedResult.nextCursor) {
131
+ nextCursor = paginatedResult.nextCursor;
132
+ }
133
+ else if (paginatedResult.links?.next) {
134
+ // Extract cursor from fully qualified URL (JSON:API spec format)
135
+ nextCursor = extractCursor({ next: paginatedResult.links.next });
136
+ }
127
137
  return {
128
- data: Array.isArray(data) ? data : [data],
129
- nextCursor: result.nextCursor,
138
+ data: Array.isArray(paginatedResult.data)
139
+ ? paginatedResult.data
140
+ : [paginatedResult.data],
141
+ nextCursor,
130
142
  };
131
143
  }
132
144
  // If result is an array, wrap in {data: result}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk",
3
- "version": "0.18.1",
3
+ "version": "0.18.3",
4
4
  "description": "Complete Zapier SDK - combines all Zapier SDK packages",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -36,6 +36,7 @@
36
36
  "access": "public"
37
37
  },
38
38
  "dependencies": {
39
+ "@zapier/zapier-sdk-core": "^0.5.1",
39
40
  "zod": "4.2.1"
40
41
  },
41
42
  "peerDependencies": {
@@ -1,94 +0,0 @@
1
- /**
2
- * Handler for getAuthentication operation
3
- *
4
- * This handler will become an SDK API endpoint handler.
5
- * It encapsulates the business logic for retrieving a single authentication, including:
6
- * - API call to internal authentication endpoint
7
- * - Custom error handling (401, 403, 404)
8
- * - Response transformation (field renaming, computed fields)
9
- *
10
- * The handler receives a validated authentication ID and returns normalized data.
11
- */
12
- import type { Handler, HandlerDeps } from "../types";
13
- import { type GetAuthenticationHandlerRequest, type GetAuthenticationResponse } from "../schemas/authentications";
14
- /**
15
- * Simple HTTP client interface for calling internal APIs
16
- *
17
- * Why pass this as a dependency instead of importing directly?
18
- *
19
- * 1. **Different implementations in different contexts:**
20
- * - In the SDK: Uses the ApiClient wrapper (adds auth, error handling, etc.)
21
- * - In the SDK API: Would use internal HTTP client or direct service calls
22
- *
23
- * 2. **Testability:**
24
- * - Can mock httpClient in tests without complex setup
25
- * - Can verify API calls and responses in isolation
26
- *
27
- * 3. **No hard coupling:**
28
- * - Handler doesn't know/care how HTTP calls are made
29
- * - Makes migration to SDK API easier (just swap implementation)
30
- */
31
- export interface HttpClient {
32
- get<T = unknown>(path: string, options?: {
33
- searchParams?: Record<string, string>;
34
- authRequired?: boolean;
35
- customErrorHandler?: (errorInfo: {
36
- status: number;
37
- statusText: string;
38
- data: unknown;
39
- }) => Error | undefined;
40
- }): Promise<T>;
41
- post<T = unknown>(path: string, data?: unknown, options?: {
42
- authRequired?: boolean;
43
- customErrorHandler?: (errorInfo: {
44
- status: number;
45
- statusText: string;
46
- data: unknown;
47
- }) => Error | undefined;
48
- }): Promise<T>;
49
- delete<T = unknown>(path: string, options?: {
50
- authRequired?: boolean;
51
- customErrorHandler?: (errorInfo: {
52
- status: number;
53
- statusText: string;
54
- data: unknown;
55
- }) => Error | undefined;
56
- }): Promise<T>;
57
- }
58
- /**
59
- * Dependencies required by the getAuthentication handler
60
- *
61
- * Passed as a parameter (dependency injection) rather than imported directly
62
- * to allow different implementations in different environments:
63
- * - SDK plugin injects: { httpClient: api } (SDK's ApiClient)
64
- * - SDK API would inject: { httpClient: internalHttpClient } (direct internal calls)
65
- * - Tests inject: { httpClient: mockHttpClient } (mocked responses)
66
- *
67
- * Extends HandlerDeps to ensure compatibility with the Handler interface.
68
- */
69
- export interface GetAuthenticationHandlerDeps extends HandlerDeps {
70
- httpClient: HttpClient;
71
- }
72
- /**
73
- * Handles getAuthentication operation
74
- *
75
- * Conforms to the Handler<TRequest, TResponse, TDeps> interface contract.
76
- *
77
- * Flow:
78
- * 1. Validates request (schema validation happens at plugin boundary)
79
- * 2. Makes API call to /authentications/{id}/ with custom error handler
80
- * 3. Transforms response to normalized AuthenticationItem
81
- * 4. Returns wrapped in { data } envelope
82
- *
83
- * Error handling:
84
- * - 401: Authentication error (invalid/expired token)
85
- * - 403: Forbidden (insufficient scopes)
86
- * - 404: Authentication not found
87
- * - Other: Propagates original error
88
- *
89
- * @param request - The authentication ID to retrieve
90
- * @param deps - Dependencies injected by the caller (httpClient)
91
- * @returns Single authentication item wrapped in data envelope
92
- */
93
- export declare const handleGetAuthentication: Handler<GetAuthenticationHandlerRequest, GetAuthenticationResponse, GetAuthenticationHandlerDeps>;
94
- //# sourceMappingURL=getAuthentication.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getAuthentication.d.ts","sourceRoot":"","sources":["../../../src/temporary-internal-core/handlers/getAuthentication.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAEL,KAAK,+BAA+B,EACpC,KAAK,yBAAyB,EAE/B,MAAM,4BAA4B,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,CAAC;CACxB;AAMD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,uBAAuB,EAAE,OAAO,CAC3C,+BAA+B,EAC/B,yBAAyB,EACzB,4BAA4B,CA8C7B,CAAC"}
@@ -1,68 +0,0 @@
1
- /**
2
- * Handler for getAuthentication operation
3
- *
4
- * This handler will become an SDK API endpoint handler.
5
- * It encapsulates the business logic for retrieving a single authentication, including:
6
- * - API call to internal authentication endpoint
7
- * - Custom error handling (401, 403, 404)
8
- * - Response transformation (field renaming, computed fields)
9
- *
10
- * The handler receives a validated authentication ID and returns normalized data.
11
- */
12
- import { GetAuthenticationHandlerRequestSchema, } from "../schemas/authentications";
13
- import { ZapierAuthenticationError, ZapierResourceNotFoundError, } from "../schemas/errors";
14
- import { normalizeAuthenticationItem } from "../utils/transformations";
15
- // ============================================================================
16
- // Handler Implementation
17
- // ============================================================================
18
- /**
19
- * Handles getAuthentication operation
20
- *
21
- * Conforms to the Handler<TRequest, TResponse, TDeps> interface contract.
22
- *
23
- * Flow:
24
- * 1. Validates request (schema validation happens at plugin boundary)
25
- * 2. Makes API call to /authentications/{id}/ with custom error handler
26
- * 3. Transforms response to normalized AuthenticationItem
27
- * 4. Returns wrapped in { data } envelope
28
- *
29
- * Error handling:
30
- * - 401: Authentication error (invalid/expired token)
31
- * - 403: Forbidden (insufficient scopes)
32
- * - 404: Authentication not found
33
- * - Other: Propagates original error
34
- *
35
- * @param request - The authentication ID to retrieve
36
- * @param deps - Dependencies injected by the caller (httpClient)
37
- * @returns Single authentication item wrapped in data envelope
38
- */
39
- export const handleGetAuthentication = async ({ request, deps }) => {
40
- // Validate and normalize request at handler boundary
41
- const validatedRequest = GetAuthenticationHandlerRequestSchema.parse(request);
42
- const { httpClient } = deps;
43
- const { authenticationId } = validatedRequest;
44
- // Make API call with custom error handling
45
- const authentication = await httpClient.get(`/zapier/api/v4/authentications/${authenticationId}/`, {
46
- authRequired: true,
47
- customErrorHandler: ({ status }) => {
48
- if (status === 401) {
49
- return new ZapierAuthenticationError(`Authentication failed. Your token may not have permission to access authentications or may be expired. (HTTP ${status})`, { statusCode: status });
50
- }
51
- if (status === 403) {
52
- return new ZapierAuthenticationError(`Access forbidden. Your token may not have the required scopes to get authentication ${authenticationId}. (HTTP ${status})`, { statusCode: status });
53
- }
54
- if (status === 404) {
55
- return new ZapierResourceNotFoundError(`Authentication ${authenticationId} not found. It may not exist or you may not have access to it. (HTTP ${status})`, {
56
- resourceType: "Authentication",
57
- resourceId: String(authenticationId),
58
- });
59
- }
60
- return undefined; // Let default error handling take over
61
- },
62
- });
63
- // Transform to normalized AuthenticationItem
64
- const normalizedAuthentication = normalizeAuthenticationItem(authentication);
65
- return {
66
- data: normalizedAuthentication,
67
- };
68
- };
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=getAuthentication.test.d.ts.map