@zapier/zapier-sdk 0.18.0 → 0.18.2

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 (43) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +5 -5
  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/types.d.ts +2 -1
  7. package/dist/api/types.d.ts.map +1 -1
  8. package/dist/api/types.js +0 -10
  9. package/dist/index.cjs +59 -247
  10. package/dist/index.d.mts +100 -191
  11. package/dist/index.mjs +59 -247
  12. package/dist/plugins/eventEmission/transport.d.ts +8 -18
  13. package/dist/plugins/eventEmission/transport.d.ts.map +1 -1
  14. package/dist/plugins/eventEmission/transport.js +47 -44
  15. package/dist/plugins/eventEmission/transport.test.js +36 -25
  16. package/dist/plugins/getAuthentication/index.d.ts +3 -3
  17. package/dist/plugins/getAuthentication/index.d.ts.map +1 -1
  18. package/dist/plugins/getAuthentication/index.js +3 -5
  19. package/dist/plugins/getAuthentication/index.test.js +4 -16
  20. package/dist/plugins/getAuthentication/schemas.d.ts +2 -4
  21. package/dist/plugins/getAuthentication/schemas.d.ts.map +1 -1
  22. package/dist/plugins/getAuthentication/schemas.js +1 -1
  23. package/dist/plugins/listAuthentications/index.d.ts.map +1 -1
  24. package/dist/schemas/Auth.d.ts +11 -11
  25. package/dist/schemas/Auth.d.ts.map +1 -1
  26. package/dist/schemas/Auth.js +2 -12
  27. package/dist/sdk.d.ts +3 -1
  28. package/dist/sdk.d.ts.map +1 -1
  29. package/dist/temporary-internal-core/index.d.ts +0 -2
  30. package/dist/temporary-internal-core/index.d.ts.map +1 -1
  31. package/dist/temporary-internal-core/index.js +0 -2
  32. package/dist/temporary-internal-core/utils/transformations.d.ts +1 -1
  33. package/dist/temporary-internal-core/utils/transformations.d.ts.map +1 -1
  34. package/package.json +2 -1
  35. package/dist/temporary-internal-core/handlers/getAuthentication.d.ts +0 -94
  36. package/dist/temporary-internal-core/handlers/getAuthentication.d.ts.map +0 -1
  37. package/dist/temporary-internal-core/handlers/getAuthentication.js +0 -68
  38. package/dist/temporary-internal-core/handlers/getAuthentication.test.d.ts +0 -2
  39. package/dist/temporary-internal-core/handlers/getAuthentication.test.d.ts.map +0 -1
  40. package/dist/temporary-internal-core/handlers/getAuthentication.test.js +0 -248
  41. package/dist/temporary-internal-core/schemas/authentications/index.d.ts +0 -150
  42. package/dist/temporary-internal-core/schemas/authentications/index.d.ts.map +0 -1
  43. package/dist/temporary-internal-core/schemas/authentications/index.js +0 -97
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @zapier/zapier-sdk
2
2
 
3
+ ## 0.18.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 76fb606: - `getAuthentication` plugin now routes through proxy instead of direct Zapier API's
8
+
9
+ ## 0.18.1
10
+
11
+ ### Patch Changes
12
+
13
+ - ee5beb6: Refactor transport classes to factory functions
14
+
3
15
  ## 0.18.0
4
16
 
5
17
  ### Minor Changes
package/README.md CHANGED
@@ -652,10 +652,10 @@ Get a specific authentication by ID
652
652
 
653
653
  **Parameters:**
654
654
 
655
- | Name | Type | Required | Default | Possible Values | Description |
656
- | -------------------- | ---------------- | -------- | ------- | --------------- | ----------------------------- |
657
- | `options` | `object` | ✅ | — | — | |
658
- | ↳ `authenticationId` | `string, number` | ✅ | — | — | Authentication ID to retrieve |
655
+ | Name | Type | Required | Default | Possible Values | Description |
656
+ | -------------------- | -------- | -------- | ------- | --------------- | ----------------------------- |
657
+ | `options` | `object` | ✅ | — | — | |
658
+ | ↳ `authenticationId` | `string` | ✅ | — | — | Authentication ID to retrieve |
659
659
 
660
660
  **Returns:** `Promise<AuthenticationItem>`
661
661
 
@@ -663,7 +663,7 @@ Get a specific authentication by ID
663
663
 
664
664
  ```typescript
665
665
  const { data: authentication } = await sdk.getAuthentication({
666
- authenticationId: "example-value",
666
+ authenticationId: "example-id",
667
667
  });
668
668
  ```
669
669
 
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/api/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,OAAO,EACb,MAAM,4BAA4B,CAAC;AAEpC,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAChC,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAiBD,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,KAAK,EAAE,EAClB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM;;;SAsBb;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;;;SAEtD"}
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/api/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAE1E,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAChC,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAWD,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,KAAK,EAAE,EAClB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM;;;SAsBb;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;;;SAEtD"}
@@ -1,4 +1,4 @@
1
- import { handleListApps, handleGetAuthentication, } from "../temporary-internal-core";
1
+ import { handleListApps } from "../temporary-internal-core";
2
2
  const routes = [
3
3
  {
4
4
  method: "GET",
@@ -6,12 +6,6 @@ const routes = [
6
6
  handler: handleListApps,
7
7
  paramMap: [],
8
8
  },
9
- {
10
- method: "GET",
11
- pattern: /^\/api\/v0\/authentications\/([^\/]+)$/,
12
- handler: handleGetAuthentication,
13
- paramMap: ["authenticationId"],
14
- },
15
9
  ];
16
10
  export function findMatchingRoute(routeList, method, path) {
17
11
  for (const route of routeList) {
@@ -1,6 +1,6 @@
1
1
  import { describe, it, expect, vi } from "vitest";
2
2
  import { matchRoute, findMatchingRoute } from "./router";
3
- import { handleListApps, handleGetAuthentication, } from "../temporary-internal-core";
3
+ import { handleListApps } from "../temporary-internal-core";
4
4
  describe("Router", () => {
5
5
  describe("matchRoute (Integration)", () => {
6
6
  it("should match GET /api/v0/apps", () => {
@@ -9,12 +9,6 @@ describe("Router", () => {
9
9
  expect(match?.handler).toBe(handleListApps);
10
10
  expect(match?.params).toEqual({});
11
11
  });
12
- it("should match GET /api/v0/authentications/:authenticationId", () => {
13
- const match = matchRoute("GET", "/api/v0/authentications/12345");
14
- expect(match).not.toBeNull();
15
- expect(match?.handler).toBe(handleGetAuthentication);
16
- expect(match?.params).toEqual({ authenticationId: "12345" });
17
- });
18
12
  it("should not match POST /api/v0/apps", () => {
19
13
  const match = matchRoute("POST", "/api/v0/apps");
20
14
  expect(match).toBeNull();
@@ -8,9 +8,10 @@
8
8
  * API response model types are inferred from Zod schemas defined in api/schemas.ts
9
9
  * to ensure a single source of truth and eliminate duplication.
10
10
  */
11
+ import type { AuthenticationSchema, AuthenticationsResponseSchema } from "@zapier/zapier-sdk-core/v0/schemas/authentications";
11
12
  import type { SdkEvent } from "../types/events";
12
13
  import type { z } from "zod";
13
- import type { NeedChoicesSchema, NeedSchema, ActionLinksSchema, ActionPermissionsSchema, ActionSchema, ChoiceSchema, FieldSchema, ActionExecutionResultSchema, ActionFieldChoiceSchema, ActionFieldSchema, AuthenticationSchema, AuthenticationsResponseSchema, UserProfileSchema, AppSchema, NeedsRequestSchema, NeedsResponseSchema, ImplementationSchema, ImplementationsResponseSchema, ImplementationMetaSchema, ImplementationsMetaResponseSchema, ServiceSchema, ServicesResponseSchema, NeedChoicesRequestSchema, NeedChoicesResponseSchema, NeedChoicesResponseMetaSchema, NeedChoicesResponseLinksSchema } from "./schemas";
14
+ import type { NeedChoicesSchema, NeedSchema, ActionLinksSchema, ActionPermissionsSchema, ActionSchema, ChoiceSchema, FieldSchema, ActionExecutionResultSchema, ActionFieldChoiceSchema, ActionFieldSchema, UserProfileSchema, AppSchema, NeedsRequestSchema, NeedsResponseSchema, ImplementationSchema, ImplementationsResponseSchema, ImplementationMetaSchema, ImplementationsMetaResponseSchema, ServiceSchema, ServicesResponseSchema, NeedChoicesRequestSchema, NeedChoicesResponseSchema, NeedChoicesResponseMetaSchema, NeedChoicesResponseLinksSchema } from "./schemas";
14
15
  export interface ApiClientOptions {
15
16
  baseUrl: string;
16
17
  authBaseUrl?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,uBAAuB,EACvB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,2BAA2B,EAC3B,uBAAuB,EACvB,iBAAiB,EACjB,oBAAoB,EACpB,6BAA6B,EAC7B,iBAAiB,EACjB,SAAS,EACT,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,6BAA6B,EAC7B,wBAAwB,EACxB,iCAAiC,EACjC,aAAa,EACb,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,6BAA6B,EAC7B,8BAA8B,EAC/B,MAAM,WAAW,CAAC;AAMnB,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAA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AA2B,GAAG,CAAC,CAAC,KAAK,CAC/C,OAAO,iCAAiC,CACzC,CAAC;AAGF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC5E,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC;AACF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAC5C,OAAO,8BAA8B,CACtC,CAAC"}
package/dist/api/types.js CHANGED
@@ -1,11 +1 @@
1
- /**
2
- * API Client Type Definitions
3
- *
4
- * This module contains all type definitions related to the Zapier API client,
5
- * including configuration options, client interfaces, request/response types,
6
- * and API response models.
7
- *
8
- * API response model types are inferred from Zod schemas defined in api/schemas.ts
9
- * to ensure a single source of truth and eliminate duplication.
10
- */
11
1
  export {};
package/dist/index.cjs CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var zod = require('zod');
4
+ var authentications = require('@zapier/zapier-sdk-core/v0/schemas/authentications');
4
5
  var promises = require('timers/promises');
5
6
  var os = require('os');
6
7
 
@@ -2263,26 +2264,7 @@ var ListAuthenticationsSchema = zod.z.object({
2263
2264
  cursor: zod.z.string().optional().describe("Cursor to start from")
2264
2265
  }).merge(TelemetryMarkerSchema).describe("List available authentications with optional filtering");
2265
2266
  var AuthenticationItemSchema = withFormatter(
2266
- AuthenticationSchema.omit({ selected_api: true, customuser_id: true }).extend(
2267
- {
2268
- id: zod.z.string(),
2269
- // Converted from number
2270
- account_id: zod.z.string(),
2271
- // Converted from number
2272
- implementation_id: zod.z.string().optional(),
2273
- // Renamed from selected_api
2274
- is_expired: zod.z.string().optional(),
2275
- // Mapped from is_stale
2276
- expired_at: zod.z.string().nullable().optional(),
2277
- // Mapped from marked_stale_at
2278
- app_key: zod.z.string().optional(),
2279
- // App key from implementations endpoint
2280
- app_version: zod.z.string().optional(),
2281
- // Version extracted from implementation_id
2282
- profile_id: zod.z.string().optional()
2283
- // Mapped from customuser_id, converted from number
2284
- }
2285
- ),
2267
+ authentications.AuthenticationItemSchema,
2286
2268
  {
2287
2269
  format: (item) => {
2288
2270
  const details = [];
@@ -2369,7 +2351,9 @@ var listAuthenticationsPlugin = ({ context }) => {
2369
2351
  (auth) => normalizeAuthenticationItem(auth)
2370
2352
  );
2371
2353
  if (options.title) {
2372
- auths = auths.filter((auth) => auth.title === options.title);
2354
+ auths = auths.filter(
2355
+ (auth) => auth.title === options.title
2356
+ );
2373
2357
  }
2374
2358
  return {
2375
2359
  data: auths,
@@ -2497,64 +2481,6 @@ var getActionPlugin = ({ sdk, context }) => {
2497
2481
  }
2498
2482
  };
2499
2483
  };
2500
- var AuthenticationSchema2 = zod.z.object({
2501
- id: zod.z.number(),
2502
- date: zod.z.string(),
2503
- lastchanged: zod.z.string().optional(),
2504
- account_id: zod.z.number(),
2505
- customuser_id: zod.z.number().optional(),
2506
- selected_api: zod.z.string(),
2507
- destination_selected_api: zod.z.string().nullable().optional(),
2508
- is_invite_only: zod.z.boolean(),
2509
- is_private: zod.z.boolean(),
2510
- shared_with_all: zod.z.boolean(),
2511
- is_stale: zod.z.string().optional(),
2512
- is_shared: zod.z.string().optional(),
2513
- marked_stale_at: zod.z.string().nullable().optional(),
2514
- label: zod.z.string().nullable().optional(),
2515
- identifier: zod.z.string().nullable().optional(),
2516
- title: zod.z.string().nullable().optional(),
2517
- url: zod.z.string().optional(),
2518
- groups: zod.z.string().optional(),
2519
- members: zod.z.string().optional(),
2520
- permissions: zod.z.record(zod.z.string(), zod.z.boolean()).optional()
2521
- });
2522
- zod.z.object({
2523
- count: zod.z.number(),
2524
- next: zod.z.string().nullable().optional(),
2525
- previous: zod.z.string().nullable().optional(),
2526
- results: zod.z.array(AuthenticationSchema2)
2527
- });
2528
- var AuthenticationItemSchema2 = AuthenticationSchema2.omit({
2529
- selected_api: true,
2530
- customuser_id: true
2531
- }).extend({
2532
- // Override numeric IDs with string versions (converted by normalizeAuthenticationItem)
2533
- id: zod.z.string(),
2534
- account_id: zod.z.string(),
2535
- // Renamed fields
2536
- implementation_id: zod.z.string().optional(),
2537
- profile_id: zod.z.string().optional(),
2538
- // Mapped fields (originals preserved in ...restOfAuth)
2539
- is_expired: zod.z.string().optional(),
2540
- expired_at: zod.z.string().nullable().optional(),
2541
- // Computed fields
2542
- app_key: zod.z.string().optional(),
2543
- app_version: zod.z.string().optional()
2544
- });
2545
- var GetAuthenticationOptionsSchema = zod.z.object({
2546
- authenticationId: zod.z.union([zod.z.string(), zod.z.number().int().positive()]).describe("Authentication ID to retrieve")
2547
- }).describe("Get a specific authentication by ID");
2548
- var GetAuthenticationHandlerRequestSchema = zod.z.object({
2549
- authenticationId: zod.z.union([zod.z.string(), zod.z.number()]).describe("Authentication ID - string from searchParams or number")
2550
- }).transform((data) => ({
2551
- authenticationId: typeof data.authenticationId === "string" ? parseInt(data.authenticationId, 10) : data.authenticationId
2552
- }));
2553
- zod.z.object({
2554
- data: zod.z.lazy(() => AuthenticationItemSchema2)
2555
- });
2556
-
2557
- // src/plugins/getAuthentication/index.ts
2558
2484
  var getAuthenticationPlugin = ({ context }) => {
2559
2485
  async function getAuthentication(options) {
2560
2486
  const { api } = context;
@@ -2564,7 +2490,7 @@ var getAuthenticationPlugin = ({ context }) => {
2564
2490
  }
2565
2491
  const getAuthenticationDefinition = createFunction(
2566
2492
  getAuthentication,
2567
- GetAuthenticationOptionsSchema,
2493
+ authentications.GetAuthenticationParamSchema,
2568
2494
  createTelemetryCallback(
2569
2495
  context.eventEmission.emitMethodCalled,
2570
2496
  getAuthentication.name
@@ -2578,7 +2504,7 @@ var getAuthenticationPlugin = ({ context }) => {
2578
2504
  categories: ["authentication"],
2579
2505
  type: "item",
2580
2506
  itemType: "Authentication",
2581
- inputSchema: GetAuthenticationOptionsSchema,
2507
+ inputSchema: authentications.GetAuthenticationParamSchema,
2582
2508
  outputSchema: AuthenticationItemSchema,
2583
2509
  resolvers: {
2584
2510
  authenticationId: authenticationIdGenericResolver
@@ -3876,50 +3802,6 @@ function extractPaginationCursor(response) {
3876
3802
  return void 0;
3877
3803
  }
3878
3804
  }
3879
- function normalizeAuthenticationItem2(auth, options = {}) {
3880
- let appKey = options.app_key;
3881
- let appVersion = options.app_version;
3882
- if (auth.selected_api) {
3883
- const [extractedAppKey, extractedVersion] = splitVersionedKey2(
3884
- auth.selected_api
3885
- );
3886
- if (!appKey) {
3887
- appKey = extractedAppKey;
3888
- }
3889
- if (!appVersion) {
3890
- appVersion = extractedVersion;
3891
- }
3892
- }
3893
- const {
3894
- selected_api: selectedApi,
3895
- customuser_id: profileId,
3896
- id,
3897
- account_id: accountId,
3898
- ...restOfAuth
3899
- } = auth;
3900
- return {
3901
- ...restOfAuth,
3902
- // Pass through all other API response fields except selected_api
3903
- id: String(id),
3904
- // Convert to string
3905
- account_id: String(accountId),
3906
- // Convert to string
3907
- implementation_id: selectedApi,
3908
- // Rename selected_api to implementation_id
3909
- title: auth.title || auth.label || void 0,
3910
- // Coerce title from label if missing
3911
- is_expired: auth.is_stale,
3912
- // Map is_stale to is_expired
3913
- expired_at: auth.marked_stale_at,
3914
- // Map marked_stale_at to expired_at
3915
- app_key: appKey,
3916
- // App key from implementations endpoint or parsed from selected_api
3917
- app_version: appVersion,
3918
- // Version from selected_api or provided
3919
- profile_id: profileId != null ? String(profileId) : void 0
3920
- // Map customuser_id to profile_id, convert to string
3921
- };
3922
- }
3923
3805
 
3924
3806
  // src/temporary-internal-core/handlers/listApps.ts
3925
3807
  var DEFAULT_PAGE_SIZE = 20;
@@ -4023,73 +3905,6 @@ var handleListApps = async ({ request, deps }) => {
4023
3905
  };
4024
3906
  };
4025
3907
 
4026
- // src/temporary-internal-core/schemas/errors/index.ts
4027
- var ZapierError2 = class extends Error {
4028
- constructor(message, options = {}) {
4029
- super(message);
4030
- this.statusCode = options.statusCode;
4031
- this.errors = options.errors;
4032
- this.cause = options.cause;
4033
- this.response = options.response;
4034
- Object.setPrototypeOf(this, new.target.prototype);
4035
- }
4036
- };
4037
- var ZapierAuthenticationError2 = class extends ZapierError2 {
4038
- constructor(message, options = {}) {
4039
- super(message, options);
4040
- this.name = "ZapierAuthenticationError";
4041
- }
4042
- };
4043
- var ZapierResourceNotFoundError2 = class extends ZapierError2 {
4044
- constructor(message, options = {}) {
4045
- super(message, options);
4046
- this.name = "ZapierResourceNotFoundError";
4047
- this.resourceType = options.resourceType;
4048
- this.resourceId = options.resourceId;
4049
- }
4050
- };
4051
-
4052
- // src/temporary-internal-core/handlers/getAuthentication.ts
4053
- var handleGetAuthentication = async ({ request, deps }) => {
4054
- const validatedRequest = GetAuthenticationHandlerRequestSchema.parse(request);
4055
- const { httpClient } = deps;
4056
- const { authenticationId } = validatedRequest;
4057
- const authentication = await httpClient.get(
4058
- `/zapier/api/v4/authentications/${authenticationId}/`,
4059
- {
4060
- authRequired: true,
4061
- customErrorHandler: ({ status }) => {
4062
- if (status === 401) {
4063
- return new ZapierAuthenticationError2(
4064
- `Authentication failed. Your token may not have permission to access authentications or may be expired. (HTTP ${status})`,
4065
- { statusCode: status }
4066
- );
4067
- }
4068
- if (status === 403) {
4069
- return new ZapierAuthenticationError2(
4070
- `Access forbidden. Your token may not have the required scopes to get authentication ${authenticationId}. (HTTP ${status})`,
4071
- { statusCode: status }
4072
- );
4073
- }
4074
- if (status === 404) {
4075
- return new ZapierResourceNotFoundError2(
4076
- `Authentication ${authenticationId} not found. It may not exist or you may not have access to it. (HTTP ${status})`,
4077
- {
4078
- resourceType: "Authentication",
4079
- resourceId: String(authenticationId)
4080
- }
4081
- );
4082
- }
4083
- return void 0;
4084
- }
4085
- }
4086
- );
4087
- const normalizedAuthentication = normalizeAuthenticationItem2(authentication);
4088
- return {
4089
- data: normalizedAuthentication
4090
- };
4091
- };
4092
-
4093
3908
  // src/api/router.ts
4094
3909
  var routes = [
4095
3910
  {
@@ -4097,12 +3912,6 @@ var routes = [
4097
3912
  pattern: /^\/api\/v0\/apps$/,
4098
3913
  handler: handleListApps,
4099
3914
  paramMap: []
4100
- },
4101
- {
4102
- method: "GET",
4103
- pattern: /^\/api\/v0\/authentications\/([^\/]+)$/,
4104
- handler: handleGetAuthentication,
4105
- paramMap: ["authenticationId"]
4106
3915
  }
4107
3916
  ];
4108
3917
  function findMatchingRoute(routeList, method, path) {
@@ -4916,70 +4725,73 @@ var listInputFieldChoicesPlugin = ({ context, sdk }) => {
4916
4725
  // src/plugins/eventEmission/transport.ts
4917
4726
  var DEFAULT_RETRY_ATTEMPTS = 2;
4918
4727
  var DEFAULT_RETRY_DELAY_MS = 300;
4919
- var HttpTransport = class {
4920
- constructor(config) {
4921
- this.config = config;
4922
- }
4923
- async emit(subject, event) {
4924
- try {
4925
- await this.emitWithRetry(
4926
- subject,
4927
- event,
4928
- this.config.retryAttempts || DEFAULT_RETRY_ATTEMPTS
4929
- );
4930
- } catch {
4931
- }
4932
- }
4933
- async emitWithRetry(subject, event, attemptsLeft) {
4728
+ function createHttpTransport(config) {
4729
+ const delay = async (ms) => {
4730
+ return new Promise((resolve2) => {
4731
+ const timer = setTimeout(resolve2, ms);
4732
+ if (typeof timer.unref === "function") {
4733
+ timer.unref();
4734
+ }
4735
+ });
4736
+ };
4737
+ const emitWithRetry = async (subject, event, attemptsLeft) => {
4934
4738
  try {
4935
4739
  const payload = {
4936
4740
  subject,
4937
4741
  properties: event
4938
4742
  };
4939
- const response = await fetch(this.config.endpoint, {
4743
+ const response = await fetch(config.endpoint, {
4940
4744
  method: "POST",
4941
4745
  headers: {
4942
4746
  "Content-Type": "application/json",
4943
- ...this.config.headers
4747
+ ...config.headers
4944
4748
  },
4945
4749
  body: JSON.stringify(payload)
4946
4750
  });
4947
4751
  if (!response.ok && attemptsLeft > 1) {
4948
- await this.delay(this.config.retryDelayMs || DEFAULT_RETRY_DELAY_MS);
4949
- return this.emitWithRetry(subject, event, attemptsLeft - 1);
4752
+ await delay(config.retryDelayMs || DEFAULT_RETRY_DELAY_MS);
4753
+ return emitWithRetry(subject, event, attemptsLeft - 1);
4950
4754
  }
4951
4755
  } catch (error) {
4952
4756
  if (attemptsLeft > 1) {
4953
- await this.delay(this.config.retryDelayMs || DEFAULT_RETRY_DELAY_MS);
4954
- return this.emitWithRetry(subject, event, attemptsLeft - 1);
4757
+ await delay(config.retryDelayMs || DEFAULT_RETRY_DELAY_MS);
4758
+ return emitWithRetry(subject, event, attemptsLeft - 1);
4955
4759
  }
4956
4760
  throw error;
4957
4761
  }
4958
- }
4959
- async delay(ms) {
4960
- return new Promise((resolve2) => {
4961
- const timer = setTimeout(resolve2, ms);
4962
- if (typeof timer.unref === "function") {
4963
- timer.unref();
4762
+ };
4763
+ return {
4764
+ async emit(subject, event) {
4765
+ try {
4766
+ await emitWithRetry(
4767
+ subject,
4768
+ event,
4769
+ config.retryAttempts || DEFAULT_RETRY_ATTEMPTS
4770
+ );
4771
+ } catch {
4964
4772
  }
4965
- });
4966
- }
4967
- };
4968
- var ConsoleTransport = class {
4969
- async emit(subject, event) {
4970
- try {
4971
- console.log(
4972
- "[SDK Telemetry]",
4973
- JSON.stringify({ subject, properties: event }, null, 2)
4974
- );
4975
- } catch {
4976
4773
  }
4977
- }
4978
- };
4979
- var NoopTransport = class {
4980
- async emit(_subject, _event) {
4981
- }
4982
- };
4774
+ };
4775
+ }
4776
+ function createConsoleTransport() {
4777
+ return {
4778
+ async emit(subject, event) {
4779
+ try {
4780
+ console.log(
4781
+ "[SDK Telemetry]",
4782
+ JSON.stringify({ subject, properties: event }, null, 2)
4783
+ );
4784
+ } catch {
4785
+ }
4786
+ }
4787
+ };
4788
+ }
4789
+ function createNoopTransport() {
4790
+ return {
4791
+ async emit(_subject, _event) {
4792
+ }
4793
+ };
4794
+ }
4983
4795
  function createTransport(config) {
4984
4796
  try {
4985
4797
  switch (config.type) {
@@ -4987,20 +4799,20 @@ function createTransport(config) {
4987
4799
  if (!config.endpoint) {
4988
4800
  throw new Error("HTTP transport requires endpoint");
4989
4801
  }
4990
- return new HttpTransport({
4802
+ return createHttpTransport({
4991
4803
  endpoint: config.endpoint,
4992
4804
  headers: config.headers,
4993
4805
  retryAttempts: config.retryAttempts,
4994
4806
  retryDelayMs: config.retryDelayMs
4995
4807
  });
4996
4808
  case "console":
4997
- return new ConsoleTransport();
4809
+ return createConsoleTransport();
4998
4810
  case "noop":
4999
4811
  default:
5000
- return new NoopTransport();
4812
+ return createNoopTransport();
5001
4813
  }
5002
4814
  } catch {
5003
- return new NoopTransport();
4815
+ return createNoopTransport();
5004
4816
  }
5005
4817
  }
5006
4818
  function generateEventId() {
@@ -5069,7 +4881,7 @@ function getCpuTime() {
5069
4881
 
5070
4882
  // package.json
5071
4883
  var package_default = {
5072
- version: "0.18.0"};
4884
+ version: "0.18.2"};
5073
4885
 
5074
4886
  // src/plugins/eventEmission/builders.ts
5075
4887
  function createBaseEvent(context = {}) {