@zapier/zapier-sdk 0.8.2 → 0.9.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 (104) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +10 -33
  3. package/dist/api/client.d.ts.map +1 -1
  4. package/dist/api/client.js +1 -2
  5. package/dist/api/polling.d.ts +36 -6
  6. package/dist/api/polling.d.ts.map +1 -1
  7. package/dist/api/polling.js +132 -28
  8. package/dist/api/polling.test.d.ts +2 -0
  9. package/dist/api/polling.test.d.ts.map +1 -0
  10. package/dist/api/polling.test.js +318 -0
  11. package/dist/api/types.d.ts +1 -2
  12. package/dist/api/types.d.ts.map +1 -1
  13. package/dist/index.cjs +489 -252
  14. package/dist/index.d.mts +182 -187
  15. package/dist/index.d.ts +1 -2
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +0 -1
  18. package/dist/index.mjs +486 -251
  19. package/dist/plugins/apps/index.d.ts +4 -0
  20. package/dist/plugins/apps/index.d.ts.map +1 -1
  21. package/dist/plugins/getApp/index.d.ts +2 -7
  22. package/dist/plugins/getApp/index.d.ts.map +1 -1
  23. package/dist/plugins/getApp/index.js +9 -9
  24. package/dist/plugins/getApp/index.test.js +1 -1
  25. package/dist/plugins/getAuthentication/index.test.js +1 -1
  26. package/dist/plugins/listActions/index.d.ts +2 -4
  27. package/dist/plugins/listActions/index.d.ts.map +1 -1
  28. package/dist/plugins/listActions/index.js +1 -1
  29. package/dist/plugins/listActions/index.test.js +4 -4
  30. package/dist/plugins/listApps/index.d.ts +4 -7
  31. package/dist/plugins/listApps/index.d.ts.map +1 -1
  32. package/dist/plugins/listApps/index.js +33 -17
  33. package/dist/plugins/listApps/index.test.js +22 -2
  34. package/dist/plugins/listAuthentications/index.d.ts +2 -4
  35. package/dist/plugins/listAuthentications/index.d.ts.map +1 -1
  36. package/dist/plugins/listAuthentications/index.js +4 -0
  37. package/dist/plugins/listAuthentications/index.test.js +39 -13
  38. package/dist/plugins/listAuthentications/schemas.d.ts +3 -0
  39. package/dist/plugins/listAuthentications/schemas.d.ts.map +1 -1
  40. package/dist/plugins/listAuthentications/schemas.js +4 -0
  41. package/dist/plugins/manifest/index.d.ts +25 -9
  42. package/dist/plugins/manifest/index.d.ts.map +1 -1
  43. package/dist/plugins/manifest/index.js +239 -67
  44. package/dist/plugins/manifest/index.test.js +426 -171
  45. package/dist/plugins/manifest/schemas.d.ts +5 -1
  46. package/dist/plugins/manifest/schemas.d.ts.map +1 -1
  47. package/dist/plugins/manifest/schemas.js +1 -0
  48. package/dist/sdk.d.ts +5 -11
  49. package/dist/sdk.d.ts.map +1 -1
  50. package/dist/sdk.js +1 -4
  51. package/dist/types/plugin.d.ts +1 -0
  52. package/dist/types/plugin.d.ts.map +1 -1
  53. package/dist/types/sdk.d.ts +6 -3
  54. package/dist/types/sdk.d.ts.map +1 -1
  55. package/dist/utils/domain-utils.d.ts +16 -0
  56. package/dist/utils/domain-utils.d.ts.map +1 -1
  57. package/dist/utils/domain-utils.js +46 -27
  58. package/dist/utils/domain-utils.test.js +157 -3
  59. package/dist/utils/file-utils.d.ts +4 -0
  60. package/dist/utils/file-utils.d.ts.map +1 -0
  61. package/dist/utils/file-utils.js +74 -0
  62. package/dist/utils/file-utils.test.d.ts +2 -0
  63. package/dist/utils/file-utils.test.d.ts.map +1 -0
  64. package/dist/utils/file-utils.test.js +51 -0
  65. package/package.json +1 -1
  66. package/src/api/client.ts +5 -4
  67. package/src/api/polling.test.ts +405 -0
  68. package/src/api/polling.ts +224 -44
  69. package/src/api/types.ts +1 -2
  70. package/src/index.ts +1 -1
  71. package/src/plugins/apps/index.ts +9 -2
  72. package/src/plugins/getApp/index.test.ts +1 -1
  73. package/src/plugins/getApp/index.ts +12 -14
  74. package/src/plugins/getAuthentication/index.test.ts +1 -1
  75. package/src/plugins/listActions/index.test.ts +8 -7
  76. package/src/plugins/listActions/index.ts +3 -3
  77. package/src/plugins/listApps/index.test.ts +23 -2
  78. package/src/plugins/listApps/index.ts +46 -25
  79. package/src/plugins/listAuthentications/index.test.ts +52 -15
  80. package/src/plugins/listAuthentications/index.ts +7 -2
  81. package/src/plugins/listAuthentications/schemas.ts +4 -0
  82. package/src/plugins/manifest/index.test.ts +503 -197
  83. package/src/plugins/manifest/index.ts +338 -82
  84. package/src/plugins/manifest/schemas.ts +9 -2
  85. package/src/sdk.ts +1 -5
  86. package/src/types/plugin.ts +3 -0
  87. package/src/types/sdk.ts +26 -21
  88. package/src/utils/domain-utils.test.ts +196 -2
  89. package/src/utils/domain-utils.ts +68 -35
  90. package/src/utils/file-utils.test.ts +73 -0
  91. package/src/utils/file-utils.ts +94 -0
  92. package/tsconfig.tsbuildinfo +1 -1
  93. package/dist/plugins/lockVersion/index.d.ts +0 -24
  94. package/dist/plugins/lockVersion/index.d.ts.map +0 -1
  95. package/dist/plugins/lockVersion/index.js +0 -72
  96. package/dist/plugins/lockVersion/index.test.d.ts +0 -2
  97. package/dist/plugins/lockVersion/index.test.d.ts.map +0 -1
  98. package/dist/plugins/lockVersion/index.test.js +0 -129
  99. package/dist/plugins/lockVersion/schemas.d.ts +0 -10
  100. package/dist/plugins/lockVersion/schemas.d.ts.map +0 -1
  101. package/dist/plugins/lockVersion/schemas.js +0 -6
  102. package/src/plugins/lockVersion/index.test.ts +0 -176
  103. package/src/plugins/lockVersion/index.ts +0 -112
  104. package/src/plugins/lockVersion/schemas.ts +0 -9
@@ -8,4 +8,8 @@ export interface AppsPluginProvides {
8
8
  export declare const appsPlugin: Plugin<GetSdkType<FetchPluginProvides & RunActionPluginProvides>, // requires fetch + runAction in SDK
9
9
  {}, // no context requirements
10
10
  AppsPluginProvides>;
11
+ export type { ActionExecutionOptions } from "./types";
12
+ export type { ActionExecutionResult } from "../../api/types";
13
+ export interface ZapierSdkApps {
14
+ }
11
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/apps/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAElE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,WAAW,CAAC;CACnB;AA4JD,eAAO,MAAM,UAAU,EAAE,MAAM,CAC7B,UAAU,CAAC,mBAAmB,GAAG,uBAAuB,CAAC,EAAE,oCAAoC;AAC/F,EAAE,EAAE,0BAA0B;AAC9B,kBAAkB,CAMnB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/apps/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA0B,WAAW,EAAE,MAAM,SAAS,CAAC;AAEnE,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAElE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,WAAW,CAAC;CACnB;AA4JD,eAAO,MAAM,UAAU,EAAE,MAAM,CAC7B,UAAU,CAAC,mBAAmB,GAAG,uBAAuB,CAAC,EAAE,oCAAoC;AAC/F,EAAE,EAAE,0BAA0B;AAC9B,kBAAkB,CAMnB,CAAC;AAGF,YAAY,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAI7D,MAAM,WAAW,aAAa;CAAG"}
@@ -3,8 +3,7 @@ import { GetAppSchema } from "./schemas";
3
3
  import type { GetAppOptions } from "./schemas";
4
4
  import type { AppItem } from "../../types/domain";
5
5
  import type { GetSdkType } from "../../types/plugin";
6
- import type { GetImplementation } from "../manifest/schemas";
7
- import type { ManifestPluginProvides } from "../manifest";
6
+ import type { ListAppsPluginProvides } from "../listApps";
8
7
  export interface GetAppPluginProvides {
9
8
  getApp: (options: GetAppOptions) => Promise<{
10
9
  data: AppItem;
@@ -17,9 +16,5 @@ export interface GetAppPluginProvides {
17
16
  };
18
17
  };
19
18
  }
20
- export declare const getAppPlugin: Plugin<GetSdkType<ManifestPluginProvides>, // depends on manifest plugin with getImplementation in context
21
- {
22
- getImplementation: GetImplementation;
23
- }, //
24
- GetAppPluginProvides>;
19
+ export declare const getAppPlugin: Plugin<GetSdkType<ListAppsPluginProvides>, {}, GetAppPluginProvides>;
25
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getApp/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAG1D,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAC/D,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,WAAW,EAAE,OAAO,YAAY,CAAC;aAClC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAGD,eAAO,MAAM,YAAY,EAAE,MAAM,CAC/B,UAAU,CAAC,sBAAsB,CAAC,EAAE,+DAA+D;AACnG;IAAE,iBAAiB,EAAE,iBAAiB,CAAA;CAAE,EAAE,EAAE;AAC5C,oBAAoB,CA2BrB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/getApp/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAG1D,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAC/D,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,WAAW,EAAE,OAAO,YAAY,CAAC;aAClC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAGD,eAAO,MAAM,YAAY,EAAE,MAAM,CAC/B,UAAU,CAAC,sBAAsB,CAAC,EAClC,EAAE,EACF,oBAAoB,CA0BrB,CAAC"}
@@ -2,17 +2,17 @@ import { createFunction } from "../../utils/function-utils";
2
2
  import { GetAppSchema } from "./schemas";
3
3
  import { ZapierAppNotFoundError } from "../../types/errors";
4
4
  // GetApp plugin depends on listApps SDK function
5
- export const getAppPlugin = ({ context }) => {
5
+ export const getAppPlugin = ({ sdk }) => {
6
6
  const getApp = createFunction(async function getApp(options) {
7
- const app = await context.getImplementation(options.appKey);
8
- if (!app) {
9
- throw new ZapierAppNotFoundError("App not found", {
10
- appKey: options.appKey,
11
- });
7
+ const appsIterator = sdk.listApps({ appKeys: [options.appKey] }).items();
8
+ for await (const app of appsIterator) {
9
+ return {
10
+ data: app,
11
+ };
12
12
  }
13
- return {
14
- data: app,
15
- };
13
+ throw new ZapierAppNotFoundError("App not found", {
14
+ appKey: options.appKey,
15
+ });
16
16
  }, GetAppSchema);
17
17
  // Return flat structure - getApp goes directly to SDK
18
18
  return {
@@ -8,8 +8,8 @@ import { manifestPlugin } from "../manifest";
8
8
  function createTestSdk() {
9
9
  return createSdk()
10
10
  .addPlugin(apiPlugin, { fetch: global.fetch })
11
- .addPlugin(listAppsPlugin)
12
11
  .addPlugin(manifestPlugin)
12
+ .addPlugin(listAppsPlugin)
13
13
  .addPlugin(getAppPlugin);
14
14
  }
15
15
  describe("getApp plugin", () => {
@@ -33,8 +33,8 @@ describe("getAuthentication plugin", () => {
33
33
  function createTestSdk() {
34
34
  return createSdk()
35
35
  .addPlugin(apiPlugin)
36
- .addPlugin(listAppsPlugin)
37
36
  .addPlugin(manifestPlugin)
37
+ .addPlugin(listAppsPlugin)
38
38
  .addPlugin(getAuthenticationPlugin);
39
39
  }
40
40
  describe("schema validation", () => {
@@ -21,10 +21,8 @@ export interface ListActionsPluginProvides {
21
21
  };
22
22
  };
23
23
  }
24
- export declare const listActionsPlugin: Plugin<GetSdkType<ManifestPluginProvides>, // requires getApp in SDK
25
- {
24
+ export declare const listActionsPlugin: Plugin<GetSdkType<ManifestPluginProvides>, {
26
25
  api: ApiClient;
27
26
  getVersionedImplementationId: GetVersionedImplementationId;
28
- }, // requires api and getVersionedImplementationId in context
29
- ListActionsPluginProvides>;
27
+ }, ListActionsPluginProvides>;
30
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listActions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MA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,MAAM,oBAAoB,CAAC;AAErD,OAAO,EACL,iBAAiB,EACjB,KAAK,kBAAkB,EAExB,MAAM,WAAW,CAAC;AAMnB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAExE,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,CAAC,OAAO,CAAC,EAAE,kBAAkB,KAAK,OAAO,CAAC;QACrD,IAAI,EAAE,UAAU,EAAE,CAAC;KACpB,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,EACD,yBAAyB,CAkF1B,CAAC"}
@@ -5,7 +5,7 @@ import { createPaginatedFunction } from "../../utils/function-utils";
5
5
  export const listActionsPlugin = ({ context }) => {
6
6
  const listActions = createPaginatedFunction(async function listActionsPage(options) {
7
7
  const { api, getVersionedImplementationId } = context;
8
- // Use the getApp function from the SDK (dependency injection)
8
+ // Use getVersionedImplementationId (optimized to check manifest first)
9
9
  const selectedApi = await getVersionedImplementationId(options.appKey);
10
10
  if (!selectedApi) {
11
11
  throw new ZapierConfigurationError("No current_implementation_id found for app", { configType: "current_implementation_id" });
@@ -55,6 +55,7 @@ describe("listActions plugin", () => {
55
55
  .fn()
56
56
  .mockResolvedValue("SlackCLIAPI@1.21.1");
57
57
  });
58
+ const mockResolveAppKeys = vi.fn().mockResolvedValue([]);
58
59
  function createTestSdk() {
59
60
  // Create a proper plugin chain with context dependencies
60
61
  // Build SDK with proper plugin composition, providing API in initial context
@@ -62,18 +63,17 @@ describe("listActions plugin", () => {
62
63
  .addPlugin(() => ({
63
64
  context: {
64
65
  api: mockApiClient,
65
- getVersionedImplementationId: mockGetVersionedImplementationId,
66
66
  },
67
67
  }))
68
- .addPlugin(listAppsPlugin)
69
68
  .addPlugin(() => ({
70
69
  context: {
71
70
  manifest: null,
72
- getManifestEntry: () => null,
73
71
  getVersionedImplementationId: mockGetVersionedImplementationId,
74
- getImplementation: () => Promise.resolve(null),
72
+ resolveAppKeys: mockResolveAppKeys,
73
+ updateManifestEntry: vi.fn().mockResolvedValue(["test-key", {}]),
75
74
  },
76
75
  }))
76
+ .addPlugin(listAppsPlugin)
77
77
  .addPlugin(listActionsPlugin);
78
78
  }
79
79
  describe("schema validation", () => {
@@ -1,8 +1,9 @@
1
- import type { Plugin } from "../../types/plugin";
2
- import type { ApiClient } from "../../api/types";
1
+ import type { GetContextType, Plugin } from "../../types/plugin";
3
2
  import { ListAppsSchema } from "./schemas";
4
3
  import type { ListAppsOptions } from "./schemas";
5
4
  import type { AppItem } from "../../types/domain";
5
+ import type { ManifestPluginProvides } from "../manifest";
6
+ import type { ApiPluginProvides } from "../api";
6
7
  export interface ListAppsPluginProvides {
7
8
  listApps: (options?: ListAppsOptions) => Promise<{
8
9
  data: AppItem[];
@@ -20,9 +21,5 @@ export interface ListAppsPluginProvides {
20
21
  };
21
22
  };
22
23
  }
23
- export declare const listAppsPlugin: Plugin<{}, // no SDK dependencies
24
- {
25
- api: ApiClient;
26
- }, // requires api in context
27
- ListAppsPluginProvides>;
24
+ export declare const listAppsPlugin: Plugin<{}, GetContextType<ApiPluginProvides & ManifestPluginProvides>, ListAppsPluginProvides>;
28
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listApps/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,WAAW,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AASlD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,eAAe,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,OAAO,EAAE,CAAA;KAAE,CAAC,GACnE,aAAa,CAAC;QAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QACxD,KAAK,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC;KACjC,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,QAAQ,EAAE;gBACR,WAAW,EAAE,OAAO,cAAc,CAAC;aACpC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAGD,eAAO,MAAM,cAAc,EAAE,MAAM,CACjC,EAAE,EAAE,sBAAsB;AAC1B;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,EAAE,0BAA0B;AAC9C,sBAAsB,CAyFvB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/listApps/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,WAAW,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAUlD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAEhD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,eAAe,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,OAAO,EAAE,CAAA;KAAE,CAAC,GACnE,aAAa,CAAC;QAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QACxD,KAAK,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC;KACjC,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,QAAQ,EAAE;gBACR,WAAW,EAAE,OAAO,cAAc,CAAC;aACpC,CAAC;SACH,CAAC;KACH,CAAC;CACH;AAED,eAAO,MAAM,cAAc,EAAE,MAAM,CACjC,EAAE,EACF,cAAc,CAAC,iBAAiB,GAAG,sBAAsB,CAAC,EAC1D,sBAAsB,CA4GvB,CAAC"}
@@ -1,13 +1,29 @@
1
1
  import { createPaginatedFunction } from "../../utils/function-utils";
2
2
  import { ListAppsSchema } from "./schemas";
3
- import { groupAppKeysByType, normalizeImplementationMetaToAppItem, splitVersionedKey, } from "../../utils/domain-utils";
3
+ import { normalizeImplementationMetaToAppItem, splitVersionedKey, toAppLocator, toImplementationId, } from "../../utils/domain-utils";
4
4
  import { extractCursor } from "../../utils/function-utils";
5
- // Direct plugin function - takes options + sdk + context in one object
6
5
  export const listAppsPlugin = ({ context }) => {
7
6
  const listApps = createPaginatedFunction(async function listAppsPage(options) {
8
7
  const api = context.api;
9
8
  const opts = options;
10
- const appKeys = [...(opts.appKeys ?? [])].map((key) => splitVersionedKey(key)[0]);
9
+ const appLocators = await context.resolveAppKeys({
10
+ appKeys: [...(opts.appKeys ?? [])],
11
+ });
12
+ const implementationNameToLocator = {};
13
+ for (const locator of appLocators) {
14
+ implementationNameToLocator[locator.implementationName] = [
15
+ ...(implementationNameToLocator[locator.implementationName] ?? []),
16
+ locator,
17
+ ];
18
+ }
19
+ const duplicatedLookupAppKeys = Object.keys(implementationNameToLocator)
20
+ .filter((key) => implementationNameToLocator[key].length > 1)
21
+ .map((key) => implementationNameToLocator[key])
22
+ .flat()
23
+ .map((locator) => locator.lookupAppKey);
24
+ if (duplicatedLookupAppKeys.length > 0) {
25
+ throw new Error(`Duplicate lookup app keys found: ${duplicatedLookupAppKeys.join(", ")}`);
26
+ }
11
27
  if (opts.search) {
12
28
  const searchParams = {};
13
29
  searchParams.term = opts.search;
@@ -15,11 +31,15 @@ export const listAppsPlugin = ({ context }) => {
15
31
  searchParams,
16
32
  });
17
33
  const implementations = searchEnvelope.results.map(normalizeImplementationMetaToAppItem);
18
- const appKeysSet = new Set(appKeys);
34
+ const implementationNameSet = new Set(appLocators.map((locator) => locator.implementationName));
19
35
  for (const implementation of implementations) {
20
- if (!appKeysSet.has(implementation.key)) {
21
- appKeysSet.add(implementation.key);
22
- appKeys.push(implementation.key);
36
+ const [implementationName] = splitVersionedKey(implementation.key);
37
+ if (!implementationNameSet.has(implementationName)) {
38
+ implementationNameSet.add(implementationName);
39
+ appLocators.push({
40
+ ...toAppLocator(implementation.key),
41
+ implementationName,
42
+ });
23
43
  }
24
44
  }
25
45
  }
@@ -27,19 +47,15 @@ export const listAppsPlugin = ({ context }) => {
27
47
  if (opts.pageSize) {
28
48
  searchParams.limit = opts.pageSize.toString();
29
49
  }
30
- searchParams.latest_only = "true";
50
+ if (appLocators.length === 0) {
51
+ searchParams.latest_only = "true";
52
+ }
31
53
  if (opts.cursor) {
32
54
  searchParams.offset = opts.cursor;
33
55
  }
34
- if (appKeys.length > 0) {
35
- const groupedAppKeys = groupAppKeysByType(appKeys);
36
- if (groupedAppKeys.selectedApi.length > 0) {
37
- searchParams.selected_apis = groupedAppKeys.selectedApi.join(",");
38
- }
39
- if (groupedAppKeys.slug.length > 0) {
40
- searchParams.slugs = groupedAppKeys.slug.join(",");
41
- }
42
- }
56
+ searchParams.selected_apis = appLocators
57
+ .map((locator) => toImplementationId(locator))
58
+ .join(",");
43
59
  const implementationsEnvelope = await api.get("/api/v4/implementations-meta/lookup/", {
44
60
  searchParams,
45
61
  });
@@ -26,9 +26,25 @@ const mockAppsResponse = {
26
26
  next_cursor: null,
27
27
  },
28
28
  };
29
+ const mockResolveAppKeys = vi
30
+ .fn()
31
+ .mockImplementation(async ({ appKeys }) => {
32
+ // Mock implementation that returns resolved locators for the app keys
33
+ return appKeys.map((appKey) => ({
34
+ lookupAppKey: appKey,
35
+ implementationName: appKey, // For testing, use appKey as implementationName
36
+ slug: appKey.toLowerCase(),
37
+ version: undefined,
38
+ }));
39
+ });
29
40
  function createTestSdk() {
30
41
  return createSdk()
31
42
  .addPlugin(apiPlugin, { fetch: global.fetch })
43
+ .addPlugin(() => ({
44
+ context: {
45
+ resolveAppKeys: mockResolveAppKeys,
46
+ },
47
+ }))
32
48
  .addPlugin(listAppsPlugin);
33
49
  }
34
50
  describe("listApps plugin", () => {
@@ -88,7 +104,11 @@ describe("listApps plugin", () => {
88
104
  title: "Slack",
89
105
  });
90
106
  expect(context.api.get).toHaveBeenCalledWith("/api/v4/implementations-meta/lookup/", {
91
- searchParams: { latest_only: "true", limit: "100" },
107
+ searchParams: {
108
+ latest_only: "true",
109
+ limit: "100",
110
+ selected_apis: "",
111
+ },
92
112
  });
93
113
  });
94
114
  it("should throw validation error for invalid pageSize", () => {
@@ -297,7 +317,7 @@ describe("listApps plugin", () => {
297
317
  await sdk.listApps({ appKeys: ["SlackCLIAPI", "GitHubCLIAPI"] });
298
318
  expect(mockGet).toHaveBeenCalledWith(expect.stringContaining("implementations-meta"), expect.objectContaining({
299
319
  searchParams: expect.objectContaining({
300
- selected_apis: "SlackCLIAPI,GitHubCLIAPI",
320
+ selected_apis: "SlackCLIAPI@latest,GitHubCLIAPI@latest",
301
321
  }),
302
322
  }));
303
323
  });
@@ -21,10 +21,8 @@ export interface ListAuthenticationsPluginProvides {
21
21
  };
22
22
  };
23
23
  }
24
- export declare const listAuthenticationsPlugin: Plugin<GetSdkType<ManifestPluginProvides>, // requires getApp in SDK
25
- {
24
+ export declare const listAuthenticationsPlugin: Plugin<GetSdkType<ManifestPluginProvides>, {
26
25
  api: ApiClient;
27
26
  getVersionedImplementationId: GetVersionedImplementationId;
28
- }, // requires api in context
29
- ListAuthenticationsPluginProvides>;
27
+ }, ListAuthenticationsPluginProvides>;
30
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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;AAE3C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EACL,yBAAyB,EACzB,KAAK,0BAA0B,EAEhC,MAAM,WAAW,CAAC;AAUnB,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE1D,MAAM,WAAW,iCAAiC;IAChD,mBAAmB,EAAE,CAAC,OAAO,CAAC,EAAE,0BAA0B,KAAK,OAAO,CAAC;QACrE,IAAI,EAAE,kBAAkB,EAAE,CAAC;KAC5B,CAAC,GACA,aAAa,CAAC;QAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG;QACnE,KAAK,IAAI,aAAa,CAAC,kBAAkB,CAAC,CAAC;KAC5C,CAAC;IACJ,OAAO,EAAE;QACP,IAAI,EAAE;YACJ,mBAAmB,EAAE;gBACnB,WAAW,EAAE,OAAO,yBAAyB,CAAC;aAC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C;IACE,GAAG,EAAE,SAAS,CAAC;IACf,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,EACD,iCAAiC,CAmGlC,CAAC"}
@@ -15,6 +15,10 @@ export const listAuthenticationsPlugin = ({ context }) => {
15
15
  searchParams.versionless_selected_api = versionlessSelectedApi;
16
16
  }
17
17
  }
18
+ // Add authenticationIds as ids parameter if provided
19
+ if (options.authenticationIds && options.authenticationIds.length > 0) {
20
+ searchParams.ids = options.authenticationIds.join(",");
21
+ }
18
22
  // Add other query parameters if provided
19
23
  // Use title as search if no explicit search provided
20
24
  if (options.search) {
@@ -35,14 +35,6 @@ const mockAuthenticationsResponse = {
35
35
  next: null,
36
36
  previous: null,
37
37
  };
38
- const mockSlackApp = {
39
- title: "Slack",
40
- key: "SlackCLIAPI",
41
- current_implementation_id: "SlackCLIAPI@1.21.1",
42
- version: "1.21.1",
43
- description: "Team communication platform",
44
- slug: "slack",
45
- };
46
38
  describe("listAuthentications plugin", () => {
47
39
  let mockApiClient;
48
40
  let mockGetVersionedImplementationId;
@@ -60,15 +52,13 @@ describe("listAuthentications plugin", () => {
60
52
  api: mockApiClient,
61
53
  },
62
54
  });
55
+ const mockResolveAppKeys = vi.fn().mockResolvedValue([]);
63
56
  const manifestPlugin = () => ({
64
57
  context: {
65
58
  manifest: null,
66
59
  getVersionedImplementationId: mockGetVersionedImplementationId,
67
- getManifestEntry: () => ({
68
- implementationName: "SlackCLIAPI",
69
- version: "1.21.1",
70
- }),
71
- getImplementation: vi.fn().mockResolvedValue(mockSlackApp),
60
+ resolveAppKeys: mockResolveAppKeys,
61
+ updateManifestEntry: vi.fn().mockResolvedValue(["test-key", {}]),
72
62
  },
73
63
  });
74
64
  function createTestSdk() {
@@ -131,6 +121,19 @@ describe("listAuthentications plugin", () => {
131
121
  });
132
122
  }).toThrow(ZapierValidationError);
133
123
  });
124
+ it("should throw validation error for invalid authenticationIds type", () => {
125
+ const sdk = createTestSdk();
126
+ expect(() => {
127
+ sdk.listAuthentications({
128
+ authenticationIds: "123", // Should be array of strings
129
+ });
130
+ }).toThrow(ZapierValidationError);
131
+ expect(() => {
132
+ sdk.listAuthentications({
133
+ authenticationIds: [123], // Should be array of strings, not numbers
134
+ });
135
+ }).toThrow(ZapierValidationError);
136
+ });
134
137
  it("should throw validation error for invalid pageSize", () => {
135
138
  const sdk = createTestSdk();
136
139
  expect(() => {
@@ -161,6 +164,7 @@ describe("listAuthentications plugin", () => {
161
164
  const sdk = createTestSdk();
162
165
  const result = await sdk.listAuthentications({
163
166
  appKey: "slack",
167
+ authenticationIds: ["123", "456"],
164
168
  search: "workspace",
165
169
  title: "My Slack Workspace",
166
170
  accountId: "acc_123",
@@ -273,6 +277,28 @@ describe("listAuthentications plugin", () => {
273
277
  }),
274
278
  }));
275
279
  });
280
+ it("should pass authenticationIds as ids parameter to API", async () => {
281
+ const sdk = createTestSdk();
282
+ await sdk.listAuthentications({
283
+ authenticationIds: ["123", "456", "789"],
284
+ });
285
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v4/authentications/", expect.objectContaining({
286
+ searchParams: expect.objectContaining({
287
+ ids: "123,456,789",
288
+ }),
289
+ }));
290
+ });
291
+ it("should not include ids parameter when authenticationIds is empty", async () => {
292
+ const sdk = createTestSdk();
293
+ await sdk.listAuthentications({
294
+ authenticationIds: [],
295
+ });
296
+ expect(mockApiClient.get).toHaveBeenCalledWith("/api/v4/authentications/", expect.objectContaining({
297
+ searchParams: expect.not.objectContaining({
298
+ ids: expect.anything(),
299
+ }),
300
+ }));
301
+ });
276
302
  });
277
303
  describe("pagination", () => {
278
304
  it("should handle pagination with maxItems by collecting all items", async () => {
@@ -4,6 +4,7 @@ import type { AuthenticationItem } from "../../types/domain";
4
4
  import type { ZapierAuthenticationError, ZapierApiError, ZapierAppNotFoundError, ZapierValidationError, ZapierUnknownError } from "../../types/errors";
5
5
  export declare const ListAuthenticationsSchema: z.ZodObject<{
6
6
  appKey: z.ZodOptional<z.ZodString>;
7
+ authenticationIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
7
8
  search: z.ZodOptional<z.ZodString>;
8
9
  title: z.ZodOptional<z.ZodString>;
9
10
  accountId: z.ZodOptional<z.ZodString>;
@@ -18,6 +19,7 @@ export declare const ListAuthenticationsSchema: z.ZodObject<{
18
19
  maxItems?: number | undefined;
19
20
  accountId?: string | undefined;
20
21
  owner?: string | undefined;
22
+ authenticationIds?: string[] | undefined;
21
23
  }, {
22
24
  title?: string | undefined;
23
25
  search?: string | undefined;
@@ -26,6 +28,7 @@ export declare const ListAuthenticationsSchema: z.ZodObject<{
26
28
  maxItems?: number | undefined;
27
29
  accountId?: string | undefined;
28
30
  owner?: string | undefined;
31
+ authenticationIds?: string[] | undefined;
29
32
  }>;
30
33
  export type ListAuthenticationsOptions = z.infer<typeof ListAuthenticationsSchema>;
31
34
  export interface ListAuthenticationsPage {
@@ -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;AAG5B,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;EA0B+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,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8B+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"}
@@ -4,6 +4,10 @@ import { AppKeyPropertySchema } from "../../types/properties";
4
4
  export const ListAuthenticationsSchema = z
5
5
  .object({
6
6
  appKey: AppKeyPropertySchema.optional().describe("App key of authentications to list (e.g., 'SlackCLIAPI')"),
7
+ authenticationIds: z
8
+ .array(z.string())
9
+ .optional()
10
+ .describe("List of authentication IDs to filter by"),
7
11
  search: z
8
12
  .string()
9
13
  .optional()
@@ -1,22 +1,38 @@
1
- import type { GetImplementation, GetManifestEntry, GetVersionedImplementationId, Manifest, ManifestPluginOptionsSchema } from "./schemas";
2
- import type { GetSdkType, Plugin } from "../../types/plugin";
1
+ import type { GetVersionedImplementationId, Manifest, ManifestEntry, ManifestPluginOptionsSchema, ResolveAppKeys } from "./schemas";
2
+ import type { Plugin } from "../../types/plugin";
3
3
  import type { z } from "zod";
4
4
  import type { ApiClient } from "../../api";
5
- import type { ListAppsPluginProvides } from "../listApps";
6
5
  export type ManifestPluginOptions = z.infer<typeof ManifestPluginOptionsSchema>;
7
6
  export interface ManifestPluginProvides {
8
7
  context: {
9
8
  getVersionedImplementationId: GetVersionedImplementationId;
10
- getManifestEntry: GetManifestEntry;
11
- getImplementation: GetImplementation;
9
+ resolveAppKeys: ResolveAppKeys;
10
+ updateManifestEntry: (appKey: string, entry: ManifestEntry, configPath?: string) => Promise<[string, ManifestEntry]>;
12
11
  };
13
12
  }
14
13
  /**
15
- * Load manifest from a file path synchronously
16
- * Supports local files (Node.js only)
14
+ * Read manifest from a file path asynchronously
15
+ * Supports local files (Node.js) and browser environments (fallback to global filesystem)
17
16
  */
18
- export declare function loadManifestFromFile(filePath: string): Manifest | null;
19
- export declare const manifestPlugin: Plugin<GetSdkType<ListAppsPluginProvides>, {
17
+ export declare function readManifestFromFile(filePath: string): Promise<Manifest | null>;
18
+ /**
19
+ * Get the preferred key for storing an app in the manifest
20
+ * Extracted from plugin to make it easier to test
21
+ */
22
+ export declare function getPreferredManifestEntryKey({ appKey, api, }: {
23
+ appKey: string;
24
+ api: ApiClient;
25
+ }): Promise<string>;
26
+ /**
27
+ * Find a manifest entry by any app key (implementation name, slug, etc.).
28
+ */
29
+ export declare function findManifestEntry({ appKey, manifest, }: {
30
+ appKey: string;
31
+ manifest: Manifest;
32
+ }): [string, ManifestEntry] | null;
33
+ export { DEFAULT_CONFIG_PATH } from "./schemas";
34
+ export declare const manifestPlugin: Plugin<{}, // no SDK dependencies
35
+ {
20
36
  api: ApiClient;
21
37
  }, ManifestPluginProvides>;
22
38
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/manifest/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,4BAA4B,EAC5B,QAAQ,EACR,2BAA2B,EAC5B,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAO1D,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE;QACP,4BAA4B,EAAE,4BAA4B,CAAC;QAC3D,gBAAgB,EAAE,gBAAgB,CAAC;QACnC,iBAAiB,EAAE,iBAAiB,CAAC;KACtC,CAAC;CACH;AA2BD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAUtE;AAcD,eAAO,MAAM,cAAc,EAAE,MAAM,CACjC,UAAU,CAAC,sBAAsB,CAAC,EAClC;IAAE,GAAG,EAAE,SAAS,CAAA;CAAE,EAClB,sBAAsB,CA6FvB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/manifest/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,4BAA4B,EAC5B,QAAQ,EACR,aAAa,EACb,2BAA2B,EAC3B,cAAc,EACf,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,MAAM,EAAE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