@zapier/zapier-sdk 0.26.0 → 0.27.0

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 (157) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/CLAUDE.md +6 -6
  3. package/README.md +217 -222
  4. package/dist/api/index.d.ts +1 -1
  5. package/dist/api/index.d.ts.map +1 -1
  6. package/dist/api/types.d.ts +3 -3
  7. package/dist/api/types.d.ts.map +1 -1
  8. package/dist/index.cjs +367 -216
  9. package/dist/index.d.mts +171 -91
  10. package/dist/index.d.ts +6 -5
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +4 -4
  13. package/dist/index.mjs +359 -211
  14. package/dist/plugins/apps/index.d.ts.map +1 -1
  15. package/dist/plugins/apps/index.js +20 -13
  16. package/dist/plugins/apps/schemas.d.ts +6 -2
  17. package/dist/plugins/apps/schemas.d.ts.map +1 -1
  18. package/dist/plugins/apps/schemas.js +7 -3
  19. package/dist/plugins/deprecated/authentications.d.ts +79 -0
  20. package/dist/plugins/deprecated/authentications.d.ts.map +1 -0
  21. package/dist/plugins/deprecated/authentications.js +90 -0
  22. package/dist/plugins/fetch/index.d.ts +4 -0
  23. package/dist/plugins/fetch/index.d.ts.map +1 -1
  24. package/dist/plugins/fetch/index.js +7 -4
  25. package/dist/plugins/fetch/schemas.d.ts +1 -0
  26. package/dist/plugins/fetch/schemas.d.ts.map +1 -1
  27. package/dist/plugins/fetch/schemas.js +3 -1
  28. package/dist/plugins/findFirstConnection/index.d.ts +21 -0
  29. package/dist/plugins/findFirstConnection/index.d.ts.map +1 -0
  30. package/dist/plugins/findFirstConnection/index.js +37 -0
  31. package/dist/plugins/findFirstConnection/index.test.d.ts.map +1 -0
  32. package/dist/plugins/{findFirstAuthentication → findFirstConnection}/index.test.js +43 -43
  33. package/dist/plugins/findFirstConnection/schemas.d.ts +22 -0
  34. package/dist/plugins/findFirstConnection/schemas.d.ts.map +1 -0
  35. package/dist/plugins/findFirstConnection/schemas.js +8 -0
  36. package/dist/plugins/findUniqueConnection/index.d.ts +21 -0
  37. package/dist/plugins/findUniqueConnection/index.d.ts.map +1 -0
  38. package/dist/plugins/findUniqueConnection/index.js +40 -0
  39. package/dist/plugins/findUniqueConnection/index.test.d.ts.map +1 -0
  40. package/dist/plugins/{findUniqueAuthentication → findUniqueConnection}/index.test.js +41 -41
  41. package/dist/plugins/findUniqueConnection/schemas.d.ts +22 -0
  42. package/dist/plugins/findUniqueConnection/schemas.d.ts.map +1 -0
  43. package/dist/plugins/findUniqueConnection/schemas.js +8 -0
  44. package/dist/plugins/getApp/index.js +2 -2
  45. package/dist/plugins/getConnection/index.d.ts +22 -0
  46. package/dist/plugins/getConnection/index.d.ts.map +1 -0
  47. package/dist/plugins/getConnection/index.js +35 -0
  48. package/dist/plugins/getConnection/index.test.d.ts.map +1 -0
  49. package/dist/plugins/{getAuthentication → getConnection}/index.test.js +46 -28
  50. package/dist/plugins/getConnection/schemas.d.ts +13 -0
  51. package/dist/plugins/getConnection/schemas.d.ts.map +1 -0
  52. package/dist/plugins/getConnection/schemas.js +8 -0
  53. package/dist/plugins/getInputFieldsSchema/index.d.ts.map +1 -1
  54. package/dist/plugins/getInputFieldsSchema/index.js +7 -4
  55. package/dist/plugins/getInputFieldsSchema/schemas.d.ts +1 -0
  56. package/dist/plugins/getInputFieldsSchema/schemas.d.ts.map +1 -1
  57. package/dist/plugins/getInputFieldsSchema/schemas.js +6 -2
  58. package/dist/plugins/listApps/schemas.js +2 -2
  59. package/dist/plugins/listClientCredentials/schemas.js +2 -2
  60. package/dist/plugins/listConnections/index.d.ts +24 -0
  61. package/dist/plugins/listConnections/index.d.ts.map +1 -0
  62. package/dist/plugins/{listAuthentications → listConnections}/index.js +28 -21
  63. package/dist/plugins/listConnections/index.test.d.ts.map +1 -0
  64. package/dist/plugins/{listAuthentications → listConnections}/index.test.js +219 -198
  65. package/dist/plugins/{listAuthentications → listConnections}/schemas.d.ts +11 -10
  66. package/dist/plugins/listConnections/schemas.d.ts.map +1 -0
  67. package/dist/plugins/listConnections/schemas.js +47 -0
  68. package/dist/plugins/listInputFieldChoices/index.d.ts.map +1 -1
  69. package/dist/plugins/listInputFieldChoices/index.js +8 -5
  70. package/dist/plugins/listInputFieldChoices/schemas.d.ts +1 -0
  71. package/dist/plugins/listInputFieldChoices/schemas.d.ts.map +1 -1
  72. package/dist/plugins/listInputFieldChoices/schemas.js +3 -1
  73. package/dist/plugins/listInputFields/index.d.ts.map +1 -1
  74. package/dist/plugins/listInputFields/index.js +7 -4
  75. package/dist/plugins/listInputFields/schemas.d.ts +1 -0
  76. package/dist/plugins/listInputFields/schemas.d.ts.map +1 -1
  77. package/dist/plugins/listInputFields/schemas.js +3 -1
  78. package/dist/plugins/manifest/schemas.d.ts +2 -0
  79. package/dist/plugins/manifest/schemas.d.ts.map +1 -1
  80. package/dist/plugins/manifest/schemas.js +3 -1
  81. package/dist/plugins/registry/index.d.ts.map +1 -1
  82. package/dist/plugins/registry/index.js +3 -2
  83. package/dist/plugins/request/index.d.ts.map +1 -1
  84. package/dist/plugins/request/index.js +5 -2
  85. package/dist/plugins/request/schemas.d.ts +2 -0
  86. package/dist/plugins/request/schemas.d.ts.map +1 -1
  87. package/dist/plugins/request/schemas.js +3 -1
  88. package/dist/plugins/runAction/index.d.ts.map +1 -1
  89. package/dist/plugins/runAction/index.js +12 -8
  90. package/dist/plugins/runAction/schemas.d.ts +1 -0
  91. package/dist/plugins/runAction/schemas.d.ts.map +1 -1
  92. package/dist/plugins/runAction/schemas.js +4 -2
  93. package/dist/resolvers/connectionId.d.ts +9 -0
  94. package/dist/resolvers/connectionId.d.ts.map +1 -0
  95. package/dist/resolvers/connectionId.js +42 -0
  96. package/dist/resolvers/index.d.ts +5 -1
  97. package/dist/resolvers/index.d.ts.map +1 -1
  98. package/dist/resolvers/index.js +6 -1
  99. package/dist/resolvers/inputFieldKey.d.ts +1 -1
  100. package/dist/resolvers/inputFieldKey.d.ts.map +1 -1
  101. package/dist/resolvers/inputFieldKey.js +2 -2
  102. package/dist/resolvers/inputs.d.ts +1 -1
  103. package/dist/resolvers/inputs.d.ts.map +1 -1
  104. package/dist/resolvers/inputs.js +4 -4
  105. package/dist/schemas/Connection.d.ts +29 -0
  106. package/dist/schemas/Connection.d.ts.map +1 -0
  107. package/dist/schemas/{Auth.js → Connection.js} +5 -7
  108. package/dist/sdk.d.ts +29 -7
  109. package/dist/sdk.d.ts.map +1 -1
  110. package/dist/sdk.js +12 -5
  111. package/dist/sdk.test.js +9 -8
  112. package/dist/services/implementations.d.ts +6 -6
  113. package/dist/services/implementations.d.ts.map +1 -1
  114. package/dist/services/implementations.js +10 -10
  115. package/dist/types/domain.d.ts +4 -4
  116. package/dist/types/domain.d.ts.map +1 -1
  117. package/dist/types/properties.d.ts +5 -1
  118. package/dist/types/properties.d.ts.map +1 -1
  119. package/dist/types/properties.js +4 -2
  120. package/dist/types/sdk.d.ts +12 -9
  121. package/dist/types/sdk.d.ts.map +1 -1
  122. package/package.json +2 -2
  123. package/dist/plugins/findFirstAuthentication/index.d.ts +0 -21
  124. package/dist/plugins/findFirstAuthentication/index.d.ts.map +0 -1
  125. package/dist/plugins/findFirstAuthentication/index.js +0 -36
  126. package/dist/plugins/findFirstAuthentication/index.test.d.ts.map +0 -1
  127. package/dist/plugins/findFirstAuthentication/schemas.d.ts +0 -21
  128. package/dist/plugins/findFirstAuthentication/schemas.d.ts.map +0 -1
  129. package/dist/plugins/findFirstAuthentication/schemas.js +0 -8
  130. package/dist/plugins/findUniqueAuthentication/index.d.ts +0 -21
  131. package/dist/plugins/findUniqueAuthentication/index.d.ts.map +0 -1
  132. package/dist/plugins/findUniqueAuthentication/index.js +0 -39
  133. package/dist/plugins/findUniqueAuthentication/index.test.d.ts.map +0 -1
  134. package/dist/plugins/findUniqueAuthentication/schemas.d.ts +0 -21
  135. package/dist/plugins/findUniqueAuthentication/schemas.d.ts.map +0 -1
  136. package/dist/plugins/findUniqueAuthentication/schemas.js +0 -8
  137. package/dist/plugins/getAuthentication/index.d.ts +0 -21
  138. package/dist/plugins/getAuthentication/index.d.ts.map +0 -1
  139. package/dist/plugins/getAuthentication/index.js +0 -29
  140. package/dist/plugins/getAuthentication/index.test.d.ts.map +0 -1
  141. package/dist/plugins/getAuthentication/schemas.d.ts +0 -7
  142. package/dist/plugins/getAuthentication/schemas.d.ts.map +0 -1
  143. package/dist/plugins/getAuthentication/schemas.js +0 -1
  144. package/dist/plugins/listAuthentications/index.d.ts +0 -24
  145. package/dist/plugins/listAuthentications/index.d.ts.map +0 -1
  146. package/dist/plugins/listAuthentications/index.test.d.ts.map +0 -1
  147. package/dist/plugins/listAuthentications/schemas.d.ts.map +0 -1
  148. package/dist/plugins/listAuthentications/schemas.js +0 -32
  149. package/dist/resolvers/authenticationId.d.ts +0 -9
  150. package/dist/resolvers/authenticationId.d.ts.map +0 -1
  151. package/dist/resolvers/authenticationId.js +0 -42
  152. package/dist/schemas/Auth.d.ts +0 -55
  153. package/dist/schemas/Auth.d.ts.map +0 -1
  154. /package/dist/plugins/{findFirstAuthentication → findFirstConnection}/index.test.d.ts +0 -0
  155. /package/dist/plugins/{findUniqueAuthentication → findUniqueConnection}/index.test.d.ts +0 -0
  156. /package/dist/plugins/{getAuthentication → getConnection}/index.test.d.ts +0 -0
  157. /package/dist/plugins/{listAuthentications → listConnections}/index.test.d.ts +0 -0
@@ -1,36 +0,0 @@
1
- import { FindFirstAuthenticationSchema, } from "./schemas";
2
- import { createFunction } from "../../utils/function-utils";
3
- import { AuthenticationItemSchema } from "../../schemas/Auth";
4
- import { ZapierResourceNotFoundError } from "../../types/errors";
5
- import { createTelemetryCallback } from "../../utils/telemetry-utils";
6
- export const findFirstAuthenticationPlugin = ({ sdk, context }) => {
7
- async function findFirstAuthentication(options = {}) {
8
- // Use listAuthentications with maxItems 1 to get the first result
9
- const authsResponse = await sdk.listAuthentications({
10
- ...options,
11
- maxItems: 1,
12
- _telemetry: { isNested: true },
13
- });
14
- if (authsResponse.data.length === 0) {
15
- throw new ZapierResourceNotFoundError("No authentication found matching the specified criteria", { resourceType: "Authentication" });
16
- }
17
- return {
18
- data: authsResponse.data[0],
19
- };
20
- }
21
- const findFirstAuthenticationDefinition = createFunction(findFirstAuthentication, FindFirstAuthenticationSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, findFirstAuthentication.name));
22
- return {
23
- findFirstAuthentication: findFirstAuthenticationDefinition,
24
- context: {
25
- meta: {
26
- findFirstAuthentication: {
27
- categories: ["authentication"],
28
- type: "item",
29
- itemType: "Authentication",
30
- inputSchema: FindFirstAuthenticationSchema,
31
- outputSchema: AuthenticationItemSchema,
32
- },
33
- },
34
- },
35
- };
36
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/plugins/findFirstAuthentication/index.test.ts"],"names":[],"mappings":""}
@@ -1,21 +0,0 @@
1
- import type { z } from "zod";
2
- import type { AuthenticationItem } from "../../types/domain";
3
- import type { ZapierAuthenticationError, ZapierApiError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
4
- export declare const FindFirstAuthenticationSchema: z.ZodObject<{
5
- search: z.ZodOptional<z.ZodString>;
6
- title: z.ZodOptional<z.ZodString>;
7
- appKey: z.ZodOptional<z.ZodString & {
8
- _def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
9
- }>;
10
- accountId: z.ZodOptional<z.ZodString>;
11
- owner: z.ZodOptional<z.ZodString>;
12
- isExpired: z.ZodOptional<z.ZodBoolean>;
13
- }, z.core.$strip>;
14
- export type FindFirstAuthenticationOptions = z.infer<typeof FindFirstAuthenticationSchema>;
15
- export type FindFirstAuthenticationError = ZapierAuthenticationError | ZapierApiError | ZapierValidationError | ZapierUnknownError;
16
- export interface FindFirstAuthenticationSdkFunction {
17
- findFirstAuthentication: (options?: FindFirstAuthenticationOptions) => Promise<{
18
- data: AuthenticationItem | null;
19
- }>;
20
- }
21
- //# sourceMappingURL=schemas.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/findFirstAuthentication/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,6BAA6B;;;;;;;;;iBAO0B,CAAC;AAGrE,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,6BAA6B,CACrC,CAAC;AAGF,MAAM,MAAM,4BAA4B,GACpC,yBAAyB,GACzB,cAAc,GACd,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,kCAAkC;IACjD,uBAAuB,EAAE,CACvB,OAAO,CAAC,EAAE,8BAA8B,KACrC,OAAO,CAAC;QAAE,IAAI,EAAE,kBAAkB,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;CACnD"}
@@ -1,8 +0,0 @@
1
- import { ListAuthenticationsQuerySchema } from "../listAuthentications/schemas";
2
- export const FindFirstAuthenticationSchema = ListAuthenticationsQuerySchema.omit({
3
- authenticationIds: true,
4
- pageSize: true,
5
- maxItems: true,
6
- cursor: true,
7
- _telemetry: true,
8
- }).describe("Find the first authentication matching the criteria");
@@ -1,21 +0,0 @@
1
- import type { Plugin, GetSdkType } from "../../types/plugin";
2
- import type { AuthenticationItem } from "../../types/domain";
3
- import { FindUniqueAuthenticationSchema, type FindUniqueAuthenticationOptions } from "./schemas";
4
- import type { ListAuthenticationsPluginProvides } from "../listAuthentications";
5
- import type { EventEmissionContext } from "../eventEmission";
6
- export interface FindUniqueAuthenticationPluginProvides {
7
- findUniqueAuthentication: (options?: FindUniqueAuthenticationOptions) => Promise<{
8
- data: AuthenticationItem;
9
- }>;
10
- context: {
11
- meta: {
12
- findUniqueAuthentication: {
13
- inputSchema: typeof FindUniqueAuthenticationSchema;
14
- };
15
- };
16
- };
17
- }
18
- export declare const findUniqueAuthenticationPlugin: Plugin<GetSdkType<ListAuthenticationsPluginProvides>, // requires listAuthentications in SDK
19
- EventEmissionContext, // requires eventEmission in context
20
- FindUniqueAuthenticationPluginProvides>;
21
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/findUniqueAuthentication/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EACL,8BAA8B,EAC9B,KAAK,+BAA+B,EACrC,MAAM,WAAW,CAAC;AAMnB,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AAEhF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG7D,MAAM,WAAW,sCAAsC;IACrD,wBAAwB,EAAE,CACxB,OAAO,CAAC,EAAE,+BAA+B,KACtC,OAAO,CAAC;QAAE,IAAI,EAAE,kBAAkB,CAAA;KAAE,CAAC,CAAC;IAC3C,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,wBAAwB,EAAE;gBACxB,WAAW,EAAE,OAAO,8BAA8B,CAAC;aACpD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,8BAA8B,EAAE,MAAM,CACjD,UAAU,CAAC,iCAAiC,CAAC,EAAE,sCAAsC;AACrF,oBAAoB,EAAE,oCAAoC;AAC1D,sCAAsC,CAqDvC,CAAC"}
@@ -1,39 +0,0 @@
1
- import { FindUniqueAuthenticationSchema, } from "./schemas";
2
- import { ZapierResourceNotFoundError, ZapierValidationError, } from "../../types/errors";
3
- import { createFunction } from "../../utils/function-utils";
4
- import { AuthenticationItemSchema } from "../../schemas/Auth";
5
- import { createTelemetryCallback } from "../../utils/telemetry-utils";
6
- export const findUniqueAuthenticationPlugin = ({ sdk, context }) => {
7
- async function findUniqueAuthentication(options = {}) {
8
- // Use listAuthentications with maxItems 2 to check for uniqueness
9
- const authsResponse = await sdk.listAuthentications({
10
- ...options,
11
- maxItems: 2, // Get up to 2 to check for uniqueness
12
- _telemetry: { isNested: true },
13
- });
14
- if (authsResponse.data.length === 0) {
15
- throw new ZapierResourceNotFoundError("No authentication found matching the specified criteria", { resourceType: "Authentication" });
16
- }
17
- if (authsResponse.data.length > 1) {
18
- throw new ZapierValidationError("Multiple authentications found matching the specified criteria. Expected exactly one.");
19
- }
20
- return {
21
- data: authsResponse.data[0],
22
- };
23
- }
24
- const findUniqueAuthenticationDefinition = createFunction(findUniqueAuthentication, FindUniqueAuthenticationSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, findUniqueAuthentication.name));
25
- return {
26
- findUniqueAuthentication: findUniqueAuthenticationDefinition,
27
- context: {
28
- meta: {
29
- findUniqueAuthentication: {
30
- categories: ["authentication"],
31
- type: "item",
32
- itemType: "Authentication",
33
- inputSchema: FindUniqueAuthenticationSchema,
34
- outputSchema: AuthenticationItemSchema,
35
- },
36
- },
37
- },
38
- };
39
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/plugins/findUniqueAuthentication/index.test.ts"],"names":[],"mappings":""}
@@ -1,21 +0,0 @@
1
- import type { z } from "zod";
2
- import type { AuthenticationItem } from "../../types/domain";
3
- import type { ZapierAuthenticationError, ZapierApiError, ZapierResourceNotFoundError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
4
- export declare const FindUniqueAuthenticationSchema: z.ZodObject<{
5
- search: z.ZodOptional<z.ZodString>;
6
- title: z.ZodOptional<z.ZodString>;
7
- appKey: z.ZodOptional<z.ZodString & {
8
- _def: z.core.$ZodStringDef & import("../..").PositionalMetadata;
9
- }>;
10
- accountId: z.ZodOptional<z.ZodString>;
11
- owner: z.ZodOptional<z.ZodString>;
12
- isExpired: z.ZodOptional<z.ZodBoolean>;
13
- }, z.core.$strip>;
14
- export type FindUniqueAuthenticationOptions = z.infer<typeof FindUniqueAuthenticationSchema>;
15
- export type FindUniqueAuthenticationError = ZapierAuthenticationError | ZapierApiError | ZapierResourceNotFoundError | ZapierValidationError | ZapierUnknownError;
16
- export interface FindUniqueAuthenticationSdkFunction {
17
- findUniqueAuthentication: (options?: FindUniqueAuthenticationOptions) => Promise<{
18
- data: AuthenticationItem;
19
- }>;
20
- }
21
- //# sourceMappingURL=schemas.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/findUniqueAuthentication/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,2BAA2B,EAC3B,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,8BAA8B;;;;;;;;;iBAOwB,CAAC;AAGpE,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CACnD,OAAO,8BAA8B,CACtC,CAAC;AAGF,MAAM,MAAM,6BAA6B,GACrC,yBAAyB,GACzB,cAAc,GACd,2BAA2B,GAC3B,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,mCAAmC;IAClD,wBAAwB,EAAE,CACxB,OAAO,CAAC,EAAE,+BAA+B,KACtC,OAAO,CAAC;QAAE,IAAI,EAAE,kBAAkB,CAAA;KAAE,CAAC,CAAC;CAC5C"}
@@ -1,8 +0,0 @@
1
- import { ListAuthenticationsQuerySchema } from "../listAuthentications/schemas";
2
- export const FindUniqueAuthenticationSchema = ListAuthenticationsQuerySchema.omit({
3
- authenticationIds: true,
4
- pageSize: true,
5
- maxItems: true,
6
- cursor: true,
7
- _telemetry: true,
8
- }).describe("Find a unique authentication matching the criteria");
@@ -1,21 +0,0 @@
1
- import type { Plugin } from "../../types/plugin";
2
- import type { ApiClient } from "../../api";
3
- import type { EventEmissionContext } from "../eventEmission";
4
- import { GetAuthenticationParamSchema, type GetAuthenticationParam, type GetAuthenticationResponse } from "@zapier/zapier-sdk-core/v0/schemas/authentications";
5
- export interface GetAuthenticationPluginProvides {
6
- getAuthentication: (options: GetAuthenticationParam) => Promise<GetAuthenticationResponse>;
7
- context: {
8
- meta: {
9
- getAuthentication: {
10
- inputSchema: typeof GetAuthenticationParamSchema;
11
- };
12
- };
13
- };
14
- }
15
- export declare const getAuthenticationPlugin: Plugin<{}, // no SDK dependencies
16
- // no SDK dependencies
17
- {
18
- api: ApiClient;
19
- } & EventEmissionContext, // requires api in context
20
- GetAuthenticationPluginProvides>;
21
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getAuthentication/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAI3C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EACL,4BAA4B,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC/B,MAAM,oDAAoD,CAAC;AAE5D,MAAM,WAAW,+BAA+B;IAC9C,iBAAiB,EAAE,CACjB,OAAO,EAAE,sBAAsB,KAC5B,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACxC,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,iBAAiB,EAAE;gBACjB,WAAW,EAAE,OAAO,4BAA4B,CAAC;aAClD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAC1C,EAAE,EAAE,sBAAsB;AAC1B,AADI,sBAAsB;AAC1B;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,GAAG,oBAAoB,EAAE,0BAA0B;AACrE,+BAA+B,CAoChC,CAAC"}
@@ -1,29 +0,0 @@
1
- import { createFunction } from "../../utils/function-utils";
2
- import { authenticationIdGenericResolver } from "../../resolvers";
3
- import { AuthenticationItemSchema } from "../../schemas/Auth";
4
- import { createTelemetryCallback } from "../../utils/telemetry-utils";
5
- import { GetAuthenticationParamSchema, } from "@zapier/zapier-sdk-core/v0/schemas/authentications";
6
- export const getAuthenticationPlugin = ({ context }) => {
7
- async function getAuthentication(options) {
8
- const { api } = context;
9
- return await api.get(`/api/v0/authentications/${encodeURIComponent(options.authenticationId)}`);
10
- }
11
- const getAuthenticationDefinition = createFunction(getAuthentication, GetAuthenticationParamSchema, createTelemetryCallback(context.eventEmission.emitMethodCalled, getAuthentication.name));
12
- return {
13
- getAuthentication: getAuthenticationDefinition,
14
- context: {
15
- meta: {
16
- getAuthentication: {
17
- categories: ["authentication"],
18
- type: "item",
19
- itemType: "Authentication",
20
- inputSchema: GetAuthenticationParamSchema,
21
- outputSchema: AuthenticationItemSchema,
22
- resolvers: {
23
- authenticationId: authenticationIdGenericResolver,
24
- },
25
- },
26
- },
27
- },
28
- };
29
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/plugins/getAuthentication/index.test.ts"],"names":[],"mappings":""}
@@ -1,7 +0,0 @@
1
- import type { GetAuthenticationResponse, GetAuthenticationParam } from "@zapier/zapier-sdk-core/v0/schemas/authentications";
2
- import type { ZapierAuthenticationError, ZapierResourceNotFoundError, ZapierApiError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
3
- export type GetAuthenticationError = ZapierAuthenticationError | ZapierResourceNotFoundError | ZapierApiError | ZapierValidationError | ZapierUnknownError;
4
- export interface GetAuthenticationSdkFunction {
5
- getAuthentication: (options: GetAuthenticationParam) => Promise<GetAuthenticationResponse>;
6
- }
7
- //# sourceMappingURL=schemas.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/plugins/getAuthentication/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,oDAAoD,CAAC;AAE5D,OAAO,KAAK,EACV,yBAAyB,EACzB,2BAA2B,EAC3B,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,MAAM,MAAM,sBAAsB,GAC9B,yBAAyB,GACzB,2BAA2B,GAC3B,cAAc,GACd,qBAAqB,GACrB,kBAAkB,CAAC;AAGvB,MAAM,WAAW,4BAA4B;IAC3C,iBAAiB,EAAE,CACjB,OAAO,EAAE,sBAAsB,KAC5B,OAAO,CAAC,yBAAyB,CAAC,CAAC;CACzC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,24 +0,0 @@
1
- import type { Plugin, GetSdkType } from "../../types/plugin";
2
- import type { ApiClient } from "../../api";
3
- import type { AuthenticationItem } from "@zapier/zapier-sdk-core/v0/schemas/authentications";
4
- import { ListAuthenticationsQuerySchema, type ListAuthenticationsOptions, type ListAuthenticationsPage } from "./schemas";
5
- import type { GetVersionedImplementationId } from "../manifest/schemas";
6
- import type { ManifestPluginProvides } from "../manifest";
7
- import type { EventEmissionContext } from "../eventEmission";
8
- export interface ListAuthenticationsPluginProvides {
9
- listAuthentications: (options?: ListAuthenticationsOptions) => Promise<ListAuthenticationsPage> & AsyncIterable<ListAuthenticationsPage> & {
10
- items(): AsyncIterable<AuthenticationItem>;
11
- };
12
- context: {
13
- meta: {
14
- listAuthentications: {
15
- inputSchema: typeof ListAuthenticationsQuerySchema;
16
- };
17
- };
18
- };
19
- }
20
- export declare const listAuthenticationsPlugin: Plugin<GetSdkType<ManifestPluginProvides>, {
21
- api: ApiClient;
22
- getVersionedImplementationId: GetVersionedImplementationId;
23
- } & EventEmissionContext, ListAuthenticationsPluginProvides>;
24
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listAuthentications/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,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AAC7F,OAAO,EACL,8BAA8B,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC7B,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;AAK7D,MAAM,WAAW,iCAAiC;IAChD,mBAAmB,EAAE,CACnB,OAAO,CAAC,EAAE,0BAA0B,KACjC,OAAO,CAAC,uBAAuB,CAAC,GACnC,aAAa,CAAC,uBAAuB,CAAC,GAAG;QACvC,KAAK,IAAI,aAAa,CAAC,kBAAkB,CAAC,CAAC;KAC5C,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,mBAAmB,EAAE;gBACnB,WAAW,EAAE,OAAO,8BAA8B,CAAC;aACpD,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAC5C,UAAU,CAAC,sBAAsB,CAAC,EAClC;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,GAAG,oBAAoB,EACxB,iCAAiC,CAoGlC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../src/plugins/listAuthentications/index.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
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,32 +0,0 @@
1
- import { z } from "zod";
2
- import { AppKeyPropertySchema } from "../../types/properties";
3
- import { ListAuthenticationsQuerySchema as ListAuthenticationsQueryBase } from "@zapier/zapier-sdk-core/v0/schemas/authentications";
4
- import { TelemetryMarkerSchema } from "../../utils/function-utils";
5
- export const ListAuthenticationsQuerySchema = ListAuthenticationsQueryBase.omit({
6
- offset: true,
7
- })
8
- .extend({
9
- // Override appKey with our custom schema (array type, different description)
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
12
- authenticationIds: z
13
- .array(z.string())
14
- .optional()
15
- .describe("List of authentication IDs to filter by"),
16
- // Override pageSize to make optional (needs to be fixed in `zapier-sdk-core`)
17
- pageSize: z
18
- .number()
19
- .min(1)
20
- .optional()
21
- .describe("Number of authentications per page"),
22
- // SDK specific property for pagination/iterator helpers
23
- maxItems: z
24
- .number()
25
- .min(1)
26
- .optional()
27
- .describe("Maximum total items to return across all pages"),
28
- // SDK specific property for pagination/iterator helpers
29
- cursor: z.string().optional().describe("Cursor to start from"),
30
- })
31
- .merge(TelemetryMarkerSchema)
32
- .describe("List available authentications with optional filtering");
@@ -1,9 +0,0 @@
1
- import type { DynamicResolver } from "../utils/schema-utils";
2
- import type { AuthItem } from "../schemas/Auth";
3
- type AuthenticationIdResolver = DynamicResolver<AuthItem, {
4
- appKey?: string;
5
- }>;
6
- export declare const authenticationIdResolver: AuthenticationIdResolver;
7
- export declare const authenticationIdGenericResolver: AuthenticationIdResolver;
8
- export {};
9
- //# sourceMappingURL=authenticationId.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authenticationId.d.ts","sourceRoot":"","sources":["../../src/resolvers/authenticationId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,KAAK,wBAAwB,GAAG,eAAe,CAAC,QAAQ,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE/E,eAAO,MAAM,wBAAwB,EAAE,wBA0CtC,CAAC;AAGF,eAAO,MAAM,+BAA+B,EAAE,wBAG7C,CAAC"}
@@ -1,42 +0,0 @@
1
- export const authenticationIdResolver = {
2
- type: "dynamic",
3
- depends: ["appKey"],
4
- fetch: async (sdk, resolvedParams) => {
5
- const listOptions = {
6
- maxItems: 1000,
7
- };
8
- if (resolvedParams.appKey) {
9
- listOptions.appKey = resolvedParams.appKey;
10
- }
11
- const myAuths = await sdk.listAuthentications({
12
- ...listOptions,
13
- owner: "me",
14
- });
15
- const allAuths = await sdk.listAuthentications(listOptions);
16
- // Filter out myAuths from allAuths
17
- const otherAuths = allAuths.data.filter((auth) => !myAuths.data.some((myAuth) => myAuth.id === auth.id));
18
- return [...myAuths.data, ...otherAuths];
19
- },
20
- prompt: (auths, params) => ({
21
- type: "list",
22
- name: "authenticationId",
23
- message: params.appKey
24
- ? `Select authentication for ${params.appKey}:`
25
- : "Select authentication:",
26
- choices: [
27
- ...auths.map((auth) => ({
28
- name: `${auth.title || auth.label || "Authentication"} (ID: ${auth.id})`,
29
- value: auth.id,
30
- })),
31
- {
32
- name: "↗ Skip authentication (may fail)",
33
- value: null,
34
- },
35
- ],
36
- }),
37
- };
38
- // Generic version without appKey dependency
39
- export const authenticationIdGenericResolver = {
40
- ...authenticationIdResolver,
41
- depends: [],
42
- };
@@ -1,55 +0,0 @@
1
- import type { z } from "zod";
2
- export declare const AuthenticationItemSchema: z.ZodObject<{
3
- date: z.ZodString;
4
- lastchanged: z.ZodOptional<z.ZodString>;
5
- destination_selected_api: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6
- is_invite_only: z.ZodBoolean;
7
- is_private: z.ZodBoolean;
8
- shared_with_all: z.ZodBoolean;
9
- is_stale: z.ZodOptional<z.ZodString>;
10
- is_shared: z.ZodOptional<z.ZodString>;
11
- marked_stale_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12
- label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
13
- identifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
14
- title: z.ZodOptional<z.ZodNullable<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
- permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
19
- id: z.ZodString;
20
- account_id: z.ZodString;
21
- implementation_id: z.ZodOptional<z.ZodString>;
22
- profile_id: z.ZodOptional<z.ZodString>;
23
- is_expired: z.ZodOptional<z.ZodString>;
24
- expired_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
25
- app_key: z.ZodOptional<z.ZodString>;
26
- app_version: z.ZodOptional<z.ZodString>;
27
- }, z.core.$strip>;
28
- export declare const AuthItemSchema: z.ZodObject<{
29
- date: z.ZodString;
30
- lastchanged: z.ZodOptional<z.ZodString>;
31
- destination_selected_api: z.ZodOptional<z.ZodNullable<z.ZodString>>;
32
- is_invite_only: z.ZodBoolean;
33
- is_private: z.ZodBoolean;
34
- shared_with_all: z.ZodBoolean;
35
- is_stale: z.ZodOptional<z.ZodString>;
36
- is_shared: z.ZodOptional<z.ZodString>;
37
- marked_stale_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
38
- label: z.ZodOptional<z.ZodNullable<z.ZodString>>;
39
- identifier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
40
- title: z.ZodOptional<z.ZodNullable<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
- permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
45
- id: z.ZodString;
46
- account_id: z.ZodString;
47
- implementation_id: z.ZodOptional<z.ZodString>;
48
- profile_id: z.ZodOptional<z.ZodString>;
49
- is_expired: z.ZodOptional<z.ZodString>;
50
- expired_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
51
- app_key: z.ZodOptional<z.ZodString>;
52
- app_version: z.ZodOptional<z.ZodString>;
53
- }, z.core.$strip>;
54
- export type AuthItem = z.infer<typeof AuthItemSchema>;
55
- //# sourceMappingURL=Auth.d.ts.map
@@ -1 +0,0 @@
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"}