priceos 1.0.21 → 1.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -58,19 +58,16 @@ var getRetryDelayMs = (retryCount) => {
58
58
  return Math.min(RETRY_DELAY_CAP_MS, backoff + jitter);
59
59
  };
60
60
  var resolveIdempotencyKey = (input) => {
61
- const providedEventKey = typeof input.eventKey === "string" ? input.eventKey.trim() : "";
62
61
  const providedIdempotencyKey = typeof input.idempotencyKey === "string" ? String(input.idempotencyKey).trim() : "";
63
- return providedIdempotencyKey || providedEventKey;
62
+ return providedIdempotencyKey;
64
63
  };
65
64
  var withIdempotencyKey = (input) => {
66
65
  const idempotencyKey = resolveIdempotencyKey(input);
67
66
  if (!idempotencyKey) return input;
68
- const next = {
67
+ return {
69
68
  ...input,
70
69
  idempotencyKey
71
70
  };
72
- delete next.eventKey;
73
- return next;
74
71
  };
75
72
  var createLogger = (logLevel) => {
76
73
  const shouldLog = (level) => logLevel !== "none" && LOG_LEVELS[level] <= LOG_LEVELS[logLevel];
@@ -145,6 +142,22 @@ var throwRequestError = (log, error, response, context) => {
145
142
  log.error("Request failed", { context, status: response?.status, error });
146
143
  throw new PriceOSError(getErrorMessage(error), { status: response?.status, details: error });
147
144
  };
145
+ var resolveUrlResponse = (data, response) => {
146
+ if (data && typeof data === "object" && !Array.isArray(data)) {
147
+ const value = data.url;
148
+ if (typeof value === "string" && value.trim().length > 0) {
149
+ return { url: value };
150
+ }
151
+ }
152
+ const location = response?.headers.get("location");
153
+ if (location && location.trim().length > 0) {
154
+ return { url: location };
155
+ }
156
+ if (response?.redirected && typeof response.url === "string" && response.url.trim().length > 0) {
157
+ return { url: response.url };
158
+ }
159
+ return null;
160
+ };
148
161
  var createRetryingFetch = (baseFetch, log) => {
149
162
  return async (input, init) => {
150
163
  const { method, url } = getRequestDetails(input, init);
@@ -259,9 +272,14 @@ var PriceOS = class {
259
272
  }
260
273
  });
261
274
  this.customers = {
262
- get: async (customerId) => {
275
+ get: async (customerId, options) => {
276
+ const query = options?.expand?.length ? { expand: options.expand } : void 0;
263
277
  const { data, error, response } = await this.client.GET("/v1/customers/{customerId}", {
264
- params: { path: { customerId }, header: this.header }
278
+ params: {
279
+ path: { customerId },
280
+ ...query ? { query } : {},
281
+ header: this.header
282
+ }
265
283
  });
266
284
  if (error) throwRequestError(this.log, error, response, "GET /v1/customers/{customerId}");
267
285
  return data ?? null;
@@ -291,6 +309,34 @@ var PriceOS = class {
291
309
  if (error) throwRequestError(this.log, error, response, "PUT /v1/customers/{customerId}");
292
310
  return data;
293
311
  },
312
+ addCustomProduct: async (input) => {
313
+ const { customerId, ...body } = input;
314
+ const { data, error, response } = await this.client.POST(
315
+ "/v1/customers/{customerId}/custom-product/add",
316
+ {
317
+ params: { path: { customerId }, header: this.header },
318
+ body
319
+ }
320
+ );
321
+ if (error) {
322
+ throwRequestError(this.log, error, response, "POST /v1/customers/{customerId}/custom-product/add");
323
+ }
324
+ return data;
325
+ },
326
+ removeCustomProduct: async (input) => {
327
+ const { customerId, ...body } = input;
328
+ const { data, error, response } = await this.client.POST(
329
+ "/v1/customers/{customerId}/custom-product/remove",
330
+ {
331
+ params: { path: { customerId }, header: this.header },
332
+ body
333
+ }
334
+ );
335
+ if (error) {
336
+ throwRequestError(this.log, error, response, "POST /v1/customers/{customerId}/custom-product/remove");
337
+ }
338
+ return data;
339
+ },
294
340
  delete: async (customerId) => {
295
341
  const { data, error, response } = await this.client.DELETE("/v1/customers/{customerId}", {
296
342
  params: { path: { customerId }, header: this.header }
@@ -308,7 +354,43 @@ var PriceOS = class {
308
354
  if (error) {
309
355
  throwRequestError(this.log, error, response, "POST /v1/customers/{customerId}/customer_portal");
310
356
  }
311
- return data;
357
+ if (response && !response.ok) {
358
+ throw new PriceOSError(response.statusText || "Request failed", { status: response.status });
359
+ }
360
+ const result = resolveUrlResponse(data, response);
361
+ if (result) {
362
+ return result;
363
+ }
364
+ throw new PriceOSError("Invalid customer portal response", {
365
+ status: response?.status,
366
+ details: {
367
+ redirected: response?.redirected ?? false,
368
+ responseUrl: response?.url ?? null
369
+ }
370
+ });
371
+ },
372
+ createCheckout: async (customerId, input) => {
373
+ const { data, error, response } = await this.client.POST("/v1/customers/{customerId}/checkout", {
374
+ params: { path: { customerId }, header: this.header },
375
+ body: input
376
+ });
377
+ if (error) {
378
+ throwRequestError(this.log, error, response, "POST /v1/customers/{customerId}/checkout");
379
+ }
380
+ if (response && !response.ok) {
381
+ throw new PriceOSError(response.statusText || "Request failed", { status: response.status });
382
+ }
383
+ const result = resolveUrlResponse(data, response);
384
+ if (result) {
385
+ return result;
386
+ }
387
+ throw new PriceOSError("Invalid checkout response", {
388
+ status: response?.status,
389
+ details: {
390
+ redirected: response?.redirected ?? false,
391
+ responseUrl: response?.url ?? null
392
+ }
393
+ });
312
394
  }
313
395
  };
314
396
  const getFeatureAccessForCustomer = async (customerId) => {
@@ -346,7 +428,20 @@ var PriceOS = class {
346
428
  body: input
347
429
  });
348
430
  if (error) throwRequestError(this.log, error, response, "POST /v1/checkout");
349
- return data;
431
+ if (response && !response.ok) {
432
+ throw new PriceOSError(response.statusText || "Request failed", { status: response.status });
433
+ }
434
+ const result = resolveUrlResponse(data, response);
435
+ if (result) {
436
+ return result;
437
+ }
438
+ throw new PriceOSError("Invalid checkout response", {
439
+ status: response?.status,
440
+ details: {
441
+ redirected: response?.redirected ?? false,
442
+ responseUrl: response?.url ?? null
443
+ }
444
+ });
350
445
  }
351
446
  };
352
447
  this.bonuses = {
@@ -408,24 +503,6 @@ var PriceOS = class {
408
503
  if (error) throwRequestError(this.log, error, response, "GET /v1/usage/{id}");
409
504
  return data;
410
505
  },
411
- getEventByIdempotencyKey: async (idempotencyKey) => {
412
- const { data, error, response } = await this.client.GET("/v1/usage/idempotency-key/{idempotencyKey}", {
413
- params: { header: this.header, path: { idempotencyKey } }
414
- });
415
- if (error) {
416
- throwRequestError(this.log, error, response, "GET /v1/usage/idempotency-key/{idempotencyKey}");
417
- }
418
- return data;
419
- },
420
- getEventByKey: async (eventKey) => {
421
- const { data, error, response } = await this.client.GET("/v1/usage/idempotency-key/{idempotencyKey}", {
422
- params: { header: this.header, path: { idempotencyKey: eventKey } }
423
- });
424
- if (error) {
425
- throwRequestError(this.log, error, response, "GET /v1/usage/idempotency-key/{idempotencyKey}");
426
- }
427
- return data;
428
- },
429
506
  updateEvent: async (input) => {
430
507
  const { id, ...body } = input;
431
508
  const { data, error, response } = await this.client.PUT("/v1/usage/{id}", {
@@ -435,15 +512,6 @@ var PriceOS = class {
435
512
  if (error) throwRequestError(this.log, error, response, "PUT /v1/usage/{id}");
436
513
  return data;
437
514
  },
438
- voidEvent: async (input) => {
439
- const { id, ...body } = input;
440
- const { data, error, response } = await this.client.POST("/v1/usage/{id}/void", {
441
- params: { header: this.header, path: { id } },
442
- body
443
- });
444
- if (error) throwRequestError(this.log, error, response, "POST /v1/usage/{id}/void");
445
- return data;
446
- },
447
515
  deleteEvent: async (eventId) => {
448
516
  const { data, error, response } = await this.client.DELETE("/v1/usage/{id}", {
449
517
  params: { header: this.header, path: { id: eventId } }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/client.ts"],"sourcesContent":["export { PriceOS, PriceOSError } from \"./client\";\nexport type {\n PriceOSClientOptions,\n PriceOSLogLevel,\n PriceOSBonusesClient,\n PriceOSCustomersClient,\n PriceOSFeaturesClient,\n PriceOSPricingClient,\n PriceOSCheckoutClient,\n PriceOSHttpClient,\n PriceOSUsageClient,\n} from \"./client\";\nexport type {\n CreateBonusBody,\n CreateBonusResponse,\n ListBonusesRequest,\n ListBonusesResponse,\n UpdateBonusBody,\n UpdateBonusRequest,\n UpdateBonusResponse,\n DeleteBonusRequest,\n DeleteBonusResponse,\n CreateCustomerRequest,\n CreateCustomerResponse,\n CreateCustomerPortalRequest,\n CreateCustomerPortalResponse,\n DeleteUsageEventsBody,\n DeleteUsageEventsResponse,\n DeleteUsageEventRequest,\n DeleteUsageEventResponse,\n DeleteCustomerRequest,\n DeleteCustomerResponse,\n GetUsageEventRequest,\n GetUsageEventResponse,\n GetUsageEventByKeyRequest,\n GetUsageEventByKeyResponse,\n GetCustomerResponse,\n PriceOSCustomer,\n GetFeatureAccessResponse,\n GetPricingTableRequest,\n GetPricingTableResponse,\n PricingTablePlan,\n PricingTablePrice,\n PricingTableFeature,\n PricingTableCustomerState,\n CreateCheckoutRequest,\n CreateCheckoutResponse,\n LinkCustomerBody,\n LinkCustomerResponse,\n LimitFeatureKeyFromAccessMap,\n TrackedLimitFeatureKeyFromAccessMap,\n ListUsageEventsBody,\n ListUsageEventsResponse,\n SetUsageBody,\n SetUsageResponse,\n UpdateUsageEventBody,\n UpdateUsageEventRequest,\n UpdateUsageEventResponse,\n VoidUsageEventBody,\n VoidUsageEventRequest,\n VoidUsageEventResponse,\n UsageEventDetail,\n UsageEvent,\n TrackUsageBody,\n TrackUsageBatchBody,\n TrackUsageBatchEvent,\n TrackUsageBatchResponse,\n TrackUsageResponse,\n UpdateCustomerBody,\n UpdateCustomerResponse,\n} from \"./types\";\n","import createClient from \"openapi-fetch\";\nimport type { Client } from \"openapi-fetch\";\nimport type { paths } from \"./gen/openapi\";\nimport {\n CreateBonusBody,\n CreateBonusResponse,\n CreateCustomerRequest,\n CreateCustomerResponse,\n CreateCustomerPortalResponse,\n DeleteBonusResponse,\n ListBonusesRequest,\n ListBonusesResponse,\n DeleteUsageEventsBody,\n DeleteUsageEventsResponse,\n DeleteUsageEventResponse,\n DeleteCustomerResponse,\n GetUsageEventResponse,\n GetUsageEventByIdempotencyKeyResponse,\n GetUsageEventByKeyResponse,\n GetCustomerResponse,\n GetFeatureAccessResponse,\n LinkCustomerBody,\n LinkCustomerResponse,\n LimitFeatureKeyFromAccessMap,\n TrackedLimitFeatureKeyFromAccessMap,\n ListUsageEventsBody,\n ListUsageEventsResponse,\n SetUsageBody,\n SetUsageResponse,\n UpdateUsageEventRequest,\n UpdateUsageEventResponse,\n VoidUsageEventRequest,\n VoidUsageEventResponse,\n UpdateBonusRequest,\n UpdateBonusResponse,\n TrackUsageBody,\n TrackUsageBatchBody,\n TrackUsageBatchResponse,\n TrackUsageResponse,\n UpdateCustomerBody,\n UpdateCustomerResponse,\n GetPricingTableRequest,\n GetPricingTableResponse,\n CreateCheckoutRequest,\n CreateCheckoutResponse,\n} from \"./types\";\n\nexport type PriceOSLogLevel = \"none\" | \"error\" | \"warning\" | \"info\" | \"debug\";\n\n// --- Public options ---\nexport type PriceOSClientOptions = {\n logLevel?: PriceOSLogLevel;\n};\n\nconst RATE_LIMIT_STATUS = 429;\nconst MAX_RETRIES = 4;\nconst BASE_DELAY_MS = 250;\nconst BACKOFF_MULTIPLIER = 2;\nconst JITTER_MS = 250;\nconst RETRY_DELAY_CAP_MS = 5_000;\nconst REQUEST_TIMEOUT_MS = 20_000;\n\nconst LOG_LEVELS: Record<PriceOSLogLevel, number> = {\n none: 0,\n error: 1,\n warning: 2,\n info: 3,\n debug: 4,\n};\n\ntype Logger = {\n error: (message: string, details?: Record<string, unknown>) => void;\n warning: (message: string, details?: Record<string, unknown>) => void;\n info: (message: string, details?: Record<string, unknown>) => void;\n debug: (message: string, details?: Record<string, unknown>) => void;\n};\n\nconst sleep = (ms: number): Promise<void> => new Promise((resolve) => setTimeout(resolve, ms));\n\nconst getRetryDelayMs = (retryCount: number): number => {\n const backoff = BASE_DELAY_MS * Math.pow(BACKOFF_MULTIPLIER, retryCount - 1);\n const jitter = Math.random() * JITTER_MS;\n return Math.min(RETRY_DELAY_CAP_MS, backoff + jitter);\n};\n\nconst resolveIdempotencyKey = (input: { idempotencyKey?: string; eventKey?: string }) => {\n const providedEventKey = typeof input.eventKey === \"string\" ? input.eventKey.trim() : \"\";\n const providedIdempotencyKey =\n typeof input.idempotencyKey === \"string\"\n ? String(input.idempotencyKey).trim()\n : \"\";\n return providedIdempotencyKey || providedEventKey;\n};\n\nconst withIdempotencyKey = <T extends { idempotencyKey?: string; eventKey?: string }>(input: T): T => {\n const idempotencyKey = resolveIdempotencyKey(input);\n if (!idempotencyKey) return input;\n const next = {\n ...input,\n idempotencyKey,\n };\n delete (next as { eventKey?: string }).eventKey;\n return next;\n};\n\nconst createLogger = (logLevel: PriceOSLogLevel): Logger => {\n const shouldLog = (level: PriceOSLogLevel): boolean =>\n logLevel !== \"none\" && LOG_LEVELS[level] <= LOG_LEVELS[logLevel];\n\n const write = (\n level: PriceOSLogLevel,\n message: string,\n details?: Record<string, unknown>\n ): void => {\n if (!shouldLog(level)) return;\n const prefix = `[PriceOS] ${level.toUpperCase()}: ${message}`;\n const payload = details && Object.keys(details).length > 0 ? details : undefined;\n\n switch (level) {\n case \"error\":\n payload ? console.error(prefix, payload) : console.error(prefix);\n return;\n case \"warning\":\n payload ? console.warn(prefix, payload) : console.warn(prefix);\n return;\n case \"info\":\n payload ? console.info(prefix, payload) : console.info(prefix);\n return;\n case \"debug\":\n payload ? console.debug(prefix, payload) : console.debug(prefix);\n return;\n }\n };\n\n return {\n error: (message, details) => write(\"error\", message, details),\n warning: (message, details) => write(\"warning\", message, details),\n info: (message, details) => write(\"info\", message, details),\n debug: (message, details) => write(\"debug\", message, details),\n };\n};\n\nconst getUpstreamSignal = (input: RequestInfo | URL, init?: RequestInit): AbortSignal | undefined => {\n if (init?.signal) return init.signal;\n if (typeof Request !== \"undefined\" && input instanceof Request) return input.signal;\n return undefined;\n};\n\nconst stripSignal = (init?: RequestInit): RequestInit | undefined => {\n if (!init) return undefined;\n const { signal: _signal, ...rest } = init;\n return rest;\n};\n\nconst getRequestDetails = (\n input: RequestInfo | URL,\n init?: RequestInit\n): { method: string; url: string } => {\n const method =\n init?.method ??\n (typeof Request !== \"undefined\" && input instanceof Request ? input.method : \"GET\");\n const url =\n typeof input === \"string\"\n ? input\n : input instanceof URL\n ? input.toString()\n : input.url;\n return { method, url };\n};\n\nconst prepareRetryRequest = async (\n input: RequestInfo | URL,\n init: RequestInit | undefined,\n log: Logger,\n method: string,\n url: string\n): Promise<{ requestInput: RequestInfo | URL; baseInit?: RequestInit; canRetry: boolean }> => {\n if (!(typeof Request !== \"undefined\" && input instanceof Request)) {\n return { requestInput: input, baseInit: stripSignal(init), canRetry: true };\n }\n\n if (input.bodyUsed) {\n log.warning(\"Request body already used; retries disabled\", { method, url });\n return { requestInput: input, baseInit: stripSignal(init), canRetry: false };\n }\n\n let body: BodyInit | undefined = undefined;\n if (method !== \"GET\" && method !== \"HEAD\") {\n try {\n body = await input.clone().arrayBuffer();\n } catch (error) {\n log.warning(\"Unable to clone request body; retries disabled\", { method, url, error });\n return { requestInput: input, baseInit: stripSignal(init), canRetry: false };\n }\n }\n\n const headers = new Headers(input.headers);\n const baseInit = { ...stripSignal(init), method, headers, body };\n return { requestInput: input.url, baseInit, canRetry: true };\n};\n\nconst getErrorMessage = (error: unknown): string => {\n const maybeError = error as { error?: unknown } | null;\n if (maybeError && typeof maybeError.error === \"string\") return maybeError.error;\n return \"Request failed\";\n};\n\nconst throwRequestError = (\n log: Logger,\n error: unknown,\n response: Response | undefined,\n context: string\n): never => {\n log.error(\"Request failed\", { context, status: response?.status, error });\n throw new PriceOSError(getErrorMessage(error), { status: response?.status, details: error });\n};\n\nconst createRetryingFetch = (baseFetch: typeof fetch, log: Logger): typeof fetch => {\n return async (input: RequestInfo | URL, init?: RequestInit): Promise<Response> => {\n const { method, url } = getRequestDetails(input, init);\n const upstreamSignal = getUpstreamSignal(input, init);\n const { requestInput, baseInit, canRetry } = await prepareRetryRequest(\n input,\n init,\n log,\n method,\n url\n );\n let attempt = 0;\n while (true) {\n log.debug(\"Request attempt\", { method, url, attempt: attempt + 1, maxRetries: MAX_RETRIES });\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);\n let removeAbortListener: (() => void) | null = null;\n\n if (upstreamSignal) {\n if (upstreamSignal.aborted) {\n controller.abort();\n } else {\n const onAbort = () => controller.abort();\n upstreamSignal.addEventListener(\"abort\", onAbort);\n removeAbortListener = () => upstreamSignal.removeEventListener(\"abort\", onAbort);\n }\n }\n\n try {\n const requestInit = { ...(baseInit ?? {}), signal: controller.signal };\n const response = await baseFetch(requestInput, requestInit);\n if (response.status !== RATE_LIMIT_STATUS) return response;\n\n const retryAfter = response.headers.get(\"retry-after\") ?? undefined;\n log.warning(\"Rate limit hit (429)\", {\n method,\n url,\n attempt: attempt + 1,\n maxRetries: MAX_RETRIES,\n retryAfter,\n });\n\n if (!canRetry) {\n log.warning(\"Skipping retry because request body is not replayable\", { method, url });\n return response;\n }\n\n if (attempt >= MAX_RETRIES) {\n log.error(\"Rate limit retries exhausted\", { method, url, attempts: attempt + 1 });\n return response;\n }\n\n const delayMs = getRetryDelayMs(attempt + 1);\n log.info(\"Waiting to retry after rate limit\", {\n method,\n url,\n delayMs,\n nextAttempt: attempt + 2,\n maxRetries: MAX_RETRIES,\n });\n await sleep(delayMs);\n attempt += 1;\n } catch (error) {\n if (controller.signal.aborted) {\n const abortedByCaller = upstreamSignal?.aborted ?? false;\n if (abortedByCaller) {\n log.warning(\"Request aborted by caller\", { method, url, attempt: attempt + 1 });\n } else {\n log.error(\"Request timed out\", {\n method,\n url,\n attempt: attempt + 1,\n timeoutMs: REQUEST_TIMEOUT_MS,\n });\n }\n } else {\n log.error(\"Request failed\", { method, url, attempt: attempt + 1, error });\n }\n throw error;\n } finally {\n clearTimeout(timeoutId);\n removeAbortListener?.();\n }\n }\n };\n};\n\nexport type PriceOSCustomersClient<TFeatureAccessMap = GetFeatureAccessResponse> = {\n get(customerId: string): Promise<GetCustomerResponse<TFeatureAccessMap> | null>;\n link(input: LinkCustomerBody): Promise<LinkCustomerResponse<TFeatureAccessMap> | null>;\n create(input: CreateCustomerRequest): Promise<CreateCustomerResponse<TFeatureAccessMap>>;\n update(input: UpdateCustomerBody): Promise<UpdateCustomerResponse<TFeatureAccessMap>>;\n delete(customerId: string): Promise<DeleteCustomerResponse>;\n createPortal(customerId: string): Promise<CreateCustomerPortalResponse>;\n};\n\ntype FeatureAccessRecord<TFeatureAccessMap> =\n TFeatureAccessMap extends Record<string, unknown> ? TFeatureAccessMap : Record<string, never>;\n\ntype FeatureAccessKey<TFeatureAccessMap> = keyof FeatureAccessRecord<TFeatureAccessMap> & string;\n\nexport type PriceOSFeaturesClient<TFeatureAccessMap = GetFeatureAccessResponse> = {\n getAccess(customerId: string): Promise<TFeatureAccessMap>;\n getAccess<TFeatureKey extends FeatureAccessKey<TFeatureAccessMap>>(\n customerId: string,\n featureKey: TFeatureKey\n ): Promise<FeatureAccessRecord<TFeatureAccessMap>[TFeatureKey]>;\n};\n\nexport type PriceOSPricingClient = {\n getTable(input?: GetPricingTableRequest): Promise<GetPricingTableResponse>;\n};\n\nexport type PriceOSCheckoutClient = {\n create(input: CreateCheckoutRequest): Promise<CreateCheckoutResponse>;\n};\n\nexport type PriceOSBonusesClient<TFeatureAccessMap = GetFeatureAccessResponse> = {\n create(\n input: CreateBonusBody<TrackedLimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<CreateBonusResponse>;\n list(\n input: ListBonusesRequest<LimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<ListBonusesResponse>;\n update(input: UpdateBonusRequest): Promise<UpdateBonusResponse>;\n delete(bonusId: string): Promise<DeleteBonusResponse>;\n};\n\nexport type PriceOSUsageClient<TFeatureAccessMap = GetFeatureAccessResponse> = {\n track(\n input: TrackUsageBody<LimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<TrackUsageResponse>;\n set(\n input: SetUsageBody<LimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<SetUsageResponse>;\n getEvent(eventId: string): Promise<GetUsageEventResponse>;\n getEventByIdempotencyKey(idempotencyKey: string): Promise<GetUsageEventByIdempotencyKeyResponse>;\n getEventByKey(eventKey: string): Promise<GetUsageEventByKeyResponse>;\n updateEvent(input: UpdateUsageEventRequest): Promise<UpdateUsageEventResponse>;\n voidEvent(input: VoidUsageEventRequest): Promise<VoidUsageEventResponse>;\n deleteEvent(eventId: string): Promise<DeleteUsageEventResponse>;\n deleteEvents(\n input: DeleteUsageEventsBody<LimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<DeleteUsageEventsResponse>;\n trackBatch(\n input: TrackUsageBatchBody<LimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<TrackUsageBatchResponse>;\n listEvents(\n input: ListUsageEventsBody<LimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<ListUsageEventsResponse>;\n};\n\n// --- Public SDK surface type ---\nexport type PriceOSHttpClient<TFeatureAccessMap = GetFeatureAccessResponse> = {\n customers: PriceOSCustomersClient<TFeatureAccessMap>;\n features: PriceOSFeaturesClient<TFeatureAccessMap>;\n pricing: PriceOSPricingClient;\n checkout: PriceOSCheckoutClient;\n bonuses: PriceOSBonusesClient<TFeatureAccessMap>;\n usage: PriceOSUsageClient<TFeatureAccessMap>;\n};\n\nexport class PriceOSError extends Error {\n status?: number;\n details?: unknown;\n\n constructor(message: string, opts?: { status?: number; details?: unknown }) {\n super(message);\n this.name = \"PriceOSError\";\n this.status = opts?.status;\n this.details = opts?.details;\n }\n}\n\nexport class PriceOS<TFeatureAccessMap = GetFeatureAccessResponse>\n implements PriceOSHttpClient<TFeatureAccessMap>\n{\n private client: Client<paths>;\n private header: { \"x-api-key\": string };\n private log: Logger;\n customers: PriceOSCustomersClient<TFeatureAccessMap>;\n features: PriceOSFeaturesClient<TFeatureAccessMap>;\n pricing: PriceOSPricingClient;\n checkout: PriceOSCheckoutClient;\n bonuses: PriceOSBonusesClient<TFeatureAccessMap>;\n usage: PriceOSUsageClient<TFeatureAccessMap>;\n\n constructor(apiKey: string, opts: PriceOSClientOptions = {}) {\n const logLevel = opts.logLevel ?? \"none\";\n this.log = createLogger(logLevel);\n const baseUrl = \"https://api.priceos.com\";\n this.header = { \"x-api-key\": apiKey };\n const fetchWithRetry = createRetryingFetch(fetch, this.log);\n this.client = createClient<paths>({\n baseUrl,\n fetch: fetchWithRetry,\n headers: {\n \"x-api-key\": apiKey,\n },\n });\n\n this.customers = {\n get: async (customerId: string): Promise<GetCustomerResponse<TFeatureAccessMap> | null> => {\n const { data, error, response } = await this.client.GET(\"/v1/customers/{customerId}\", {\n params: { path: { customerId }, header: this.header },\n });\n if (error) throwRequestError(this.log, error, response, \"GET /v1/customers/{customerId}\");\n return (data ?? null) as GetCustomerResponse<TFeatureAccessMap> | null;\n },\n link: async (\n input: LinkCustomerBody\n ): Promise<LinkCustomerResponse<TFeatureAccessMap> | null> => {\n const { data, error, response } = await this.client.POST(\"/v1/customers/link\", {\n params: { header: this.header },\n body: input,\n });\n if (error) throwRequestError(this.log, error, response, \"POST /v1/customers/link\");\n return (data ?? null) as LinkCustomerResponse<TFeatureAccessMap> | null;\n },\n create: async (input: CreateCustomerRequest): Promise<CreateCustomerResponse<TFeatureAccessMap>> => {\n const { data, error, response } = await this.client.POST(\"/v1/customers\", {\n params: { header: this.header },\n body: input,\n });\n if (error) throwRequestError(this.log, error, response, \"POST /v1/customers\");\n return data! as CreateCustomerResponse<TFeatureAccessMap>;\n },\n update: async (input: UpdateCustomerBody): Promise<UpdateCustomerResponse<TFeatureAccessMap>> => {\n const { customerId, ...body } = input;\n const { data, error, response } = await this.client.PUT(\"/v1/customers/{customerId}\", {\n params: { path: { customerId }, header: this.header },\n body,\n });\n if (error) throwRequestError(this.log, error, response, \"PUT /v1/customers/{customerId}\");\n return data! as UpdateCustomerResponse<TFeatureAccessMap>;\n },\n delete: async (customerId: string): Promise<DeleteCustomerResponse> => {\n const { data, error, response } = await this.client.DELETE(\"/v1/customers/{customerId}\", {\n params: { path: { customerId }, header: this.header },\n });\n if (error) throwRequestError(this.log, error, response, \"DELETE /v1/customers/{customerId}\");\n return data! as DeleteCustomerResponse;\n },\n createPortal: async (customerId: string): Promise<CreateCustomerPortalResponse> => {\n const { data, error, response } = await this.client.POST(\n \"/v1/customers/{customerId}/customer_portal\",\n {\n params: { path: { customerId }, header: this.header },\n }\n );\n if (error) {\n throwRequestError(this.log, error, response, \"POST /v1/customers/{customerId}/customer_portal\");\n }\n return data! as CreateCustomerPortalResponse;\n },\n };\n\n const getFeatureAccessForCustomer = async (customerId: string): Promise<TFeatureAccessMap> => {\n const { data, error, response } = await this.client.GET(\"/v1/feature-access\", {\n params: { query: { customerId }, header: this.header },\n });\n if (error) throwRequestError(this.log, error, response, \"GET /v1/feature-access\");\n return data! as TFeatureAccessMap;\n };\n\n function getFeatureAccess(customerId: string): Promise<TFeatureAccessMap>;\n function getFeatureAccess<TFeatureKey extends FeatureAccessKey<TFeatureAccessMap>>(\n customerId: string,\n featureKey: TFeatureKey\n ): Promise<FeatureAccessRecord<TFeatureAccessMap>[TFeatureKey]>;\n async function getFeatureAccess<TFeatureKey extends FeatureAccessKey<TFeatureAccessMap>>(\n customerId: string,\n featureKey?: TFeatureKey\n ): Promise<TFeatureAccessMap | FeatureAccessRecord<TFeatureAccessMap>[TFeatureKey]> {\n const featureAccess = await getFeatureAccessForCustomer(customerId);\n if (featureKey === undefined) return featureAccess;\n return (featureAccess as FeatureAccessRecord<TFeatureAccessMap>)[featureKey];\n }\n\n this.features = {\n getAccess: getFeatureAccess,\n };\n\n this.pricing = {\n getTable: async (input: GetPricingTableRequest = {}): Promise<GetPricingTableResponse> => {\n const query = {\n ...(typeof input.customerId === \"string\" ? { customerId: input.customerId } : {}),\n ...(typeof input.pricingTableKey === \"string\" ? { pricingTableKey: input.pricingTableKey } : {}),\n };\n const { data, error, response } = await this.client.GET(\"/v1/pricing-table\", {\n params: { query, header: this.header },\n });\n if (error) throwRequestError(this.log, error, response, \"GET /v1/pricing-table\");\n return data! as GetPricingTableResponse;\n },\n };\n\n this.checkout = {\n create: async (input: CreateCheckoutRequest): Promise<CreateCheckoutResponse> => {\n const { data, error, response } = await this.client.POST(\"/v1/checkout\", {\n params: { header: this.header },\n body: input,\n });\n if (error) throwRequestError(this.log, error, response, \"POST /v1/checkout\");\n return data! as CreateCheckoutResponse;\n },\n };\n\n this.bonuses = {\n create: async (\n input: CreateBonusBody<TrackedLimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<CreateBonusResponse> => {\n const { data, error, response } = await this.client.POST(\"/v1/bonuses\", {\n params: { header: this.header },\n body: input,\n });\n if (error) throwRequestError(this.log, error, response, \"POST /v1/bonuses\");\n return data!;\n },\n list: async (\n input: ListBonusesRequest<LimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<ListBonusesResponse> => {\n const { data, error, response } = await this.client.GET(\"/v1/bonuses\", {\n params: { header: this.header, query: input },\n });\n if (error) throwRequestError(this.log, error, response, \"GET /v1/bonuses\");\n return data!;\n },\n update: async (input: UpdateBonusRequest): Promise<UpdateBonusResponse> => {\n const { bonusId, ...body } = input;\n const { data, error, response } = await this.client.PUT(\"/v1/bonuses/{bonusId}\", {\n params: { header: this.header, path: { bonusId } },\n body,\n });\n if (error) throwRequestError(this.log, error, response, \"PUT /v1/bonuses/{bonusId}\");\n return data!;\n },\n delete: async (bonusId: string): Promise<DeleteBonusResponse> => {\n const { data, error, response } = await this.client.DELETE(\"/v1/bonuses/{bonusId}\", {\n params: { header: this.header, path: { bonusId } },\n });\n if (error) throwRequestError(this.log, error, response, \"DELETE /v1/bonuses/{bonusId}\");\n return data!;\n },\n };\n\n this.usage = {\n track: async (\n input: TrackUsageBody<LimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<TrackUsageResponse> => {\n const body = withIdempotencyKey(input);\n const { data, error, response } = await this.client.POST(\"/v1/usage\", {\n params: { header: this.header },\n body,\n });\n if (error) throwRequestError(this.log, error, response, \"POST /v1/usage\");\n return data!;\n },\n set: async (\n input: SetUsageBody<LimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<SetUsageResponse> => {\n const body = withIdempotencyKey(input);\n const { data, error, response } = await this.client.POST(\"/v1/usage/set\", {\n params: { header: this.header },\n body,\n });\n if (error) throwRequestError(this.log, error, response, \"POST /v1/usage/set\");\n return data!;\n },\n getEvent: async (eventId: string): Promise<GetUsageEventResponse> => {\n const { data, error, response } = await this.client.GET(\"/v1/usage/{id}\", {\n params: { header: this.header, path: { id: eventId } },\n });\n if (error) throwRequestError(this.log, error, response, \"GET /v1/usage/{id}\");\n return data!;\n },\n getEventByIdempotencyKey: async (\n idempotencyKey: string\n ): Promise<GetUsageEventByIdempotencyKeyResponse> => {\n const { data, error, response } = await this.client.GET(\"/v1/usage/idempotency-key/{idempotencyKey}\", {\n params: { header: this.header, path: { idempotencyKey } },\n });\n if (error) {\n throwRequestError(this.log, error, response, \"GET /v1/usage/idempotency-key/{idempotencyKey}\");\n }\n return data!;\n },\n getEventByKey: async (eventKey: string): Promise<GetUsageEventByKeyResponse> => {\n const { data, error, response } = await this.client.GET(\"/v1/usage/idempotency-key/{idempotencyKey}\", {\n params: { header: this.header, path: { idempotencyKey: eventKey } },\n });\n if (error) {\n throwRequestError(this.log, error, response, \"GET /v1/usage/idempotency-key/{idempotencyKey}\");\n }\n return data!;\n },\n updateEvent: async (input: UpdateUsageEventRequest): Promise<UpdateUsageEventResponse> => {\n const { id, ...body } = input;\n const { data, error, response } = await this.client.PUT(\"/v1/usage/{id}\", {\n params: { header: this.header, path: { id } },\n body,\n });\n if (error) throwRequestError(this.log, error, response, \"PUT /v1/usage/{id}\");\n return data!;\n },\n voidEvent: async (input: VoidUsageEventRequest): Promise<VoidUsageEventResponse> => {\n const { id, ...body } = input;\n const { data, error, response } = await this.client.POST(\"/v1/usage/{id}/void\", {\n params: { header: this.header, path: { id } },\n body,\n });\n if (error) throwRequestError(this.log, error, response, \"POST /v1/usage/{id}/void\");\n return data!;\n },\n deleteEvent: async (eventId: string): Promise<DeleteUsageEventResponse> => {\n const { data, error, response } = await this.client.DELETE(\"/v1/usage/{id}\", {\n params: { header: this.header, path: { id: eventId } },\n });\n if (error) throwRequestError(this.log, error, response, \"DELETE /v1/usage/{id}\");\n return data!;\n },\n deleteEvents: async (\n input: DeleteUsageEventsBody<LimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<DeleteUsageEventsResponse> => {\n const { data, error, response } = await this.client.POST(\"/v1/usage/delete\", {\n params: { header: this.header },\n body: input,\n });\n if (error) throwRequestError(this.log, error, response, \"POST /v1/usage/delete\");\n return data!;\n },\n trackBatch: async (\n input: TrackUsageBatchBody<LimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<TrackUsageBatchResponse> => {\n const body = {\n ...input,\n events: input.events.map((event) => withIdempotencyKey(event)),\n };\n const { data, error, response } = await this.client.POST(\"/v1/usage/batch\", {\n params: { header: this.header },\n body,\n });\n if (error) throwRequestError(this.log, error, response, \"POST /v1/usage/batch\");\n return data!;\n },\n listEvents: async (\n input: ListUsageEventsBody<LimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<ListUsageEventsResponse> => {\n const { data, error, response } = await this.client.POST(\"/v1/usage/events\", {\n params: { header: this.header },\n body: input,\n });\n if (error) throwRequestError(this.log, error, response, \"POST /v1/usage/events\");\n return data!;\n },\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,2BAAyB;AAsDzB,IAAM,oBAAoB;AAC1B,IAAM,cAAc;AACpB,IAAM,gBAAgB;AACtB,IAAM,qBAAqB;AAC3B,IAAM,YAAY;AAClB,IAAM,qBAAqB;AAC3B,IAAM,qBAAqB;AAE3B,IAAM,aAA8C;AAAA,EAClD,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AAAA,EACN,OAAO;AACT;AASA,IAAM,QAAQ,CAAC,OAA8B,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,EAAE,CAAC;AAE7F,IAAM,kBAAkB,CAAC,eAA+B;AACtD,QAAM,UAAU,gBAAgB,KAAK,IAAI,oBAAoB,aAAa,CAAC;AAC3E,QAAM,SAAS,KAAK,OAAO,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c,OACZ,UACuC;AACvC,cAAM,EAAE,MAAM,OAAO,SAAS,IAAI,MAAM,KAAK,OAAO,KAAK,oBAAoB;AAAA,UAC3E,QAAQ,EAAE,QAAQ,KAAK,OAAO;AAAA,UAC9B,MAAM;AAAA,QACR,CAAC;AACD,YAAI,MAAO,mBAAkB,KAAK,KAAK,OAAO,UAAU,uBAAuB;AAC/E,eAAO;AAAA,MACT;AAAA,MACA,YAAY,OACV,UACqC;AACrC,cAAM,OAAO;AAAA,UACX,GAAG;AAAA,UACH,QAAQ,MAAM,OAAO,IAAI,CAAC,UAAU,mBAAmB,KAAK,CAAC;AAAA,QAC/D;AACA,cAAM,EAAE,MAAM,OAAO,SAAS,IAAI,MAAM,KAAK,OAAO,KAAK,mBAAmB;AAAA,UAC1E,QAAQ,EAAE,QAAQ,KAAK,OAAO;AAAA,UAC9B;AAAA,QACF,CAAC;AACD,YAAI,MAAO,mBAAkB,KAAK,KAAK,OAAO,UAAU,sBAAsB;AAC9E,eAAO;AAAA,MACT;AAAA,MACA,YAAY,OACV,UACqC;AACrC,cAAM,EAAE,MAAM,OAAO,SAAS,IAAI,MAAM,KAAK,OAAO,KAAK,oBAAoB;AAAA,UAC3E,QAAQ,EAAE,QAAQ,KAAK,OAAO;AAAA,UAC9B,MAAM;AAAA,QACR,CAAC;AACD,YAAI,MAAO,mBAAkB,KAAK,KAAK,OAAO,UAAU,uBAAuB;AAC/E,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACF;","names":["createClient"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/client.ts"],"sourcesContent":["export { PriceOS, PriceOSError } from \"./client\";\nexport type {\n PriceOSClientOptions,\n PriceOSLogLevel,\n PriceOSBonusesClient,\n PriceOSCustomersClient,\n PriceOSFeaturesClient,\n PriceOSPricingClient,\n PriceOSCheckoutClient,\n PriceOSHttpClient,\n PriceOSUsageClient,\n} from \"./client\";\nexport type {\n CreateBonusBody,\n CreateBonusResponse,\n ListBonusesRequest,\n ListBonusesResponse,\n UpdateBonusBody,\n UpdateBonusRequest,\n UpdateBonusResponse,\n DeleteBonusRequest,\n DeleteBonusResponse,\n CreateCustomerRequest,\n CreateCustomerResponse,\n CreateCustomerCheckoutRequest,\n CreateCustomerCheckoutResponse,\n CreateCustomerPortalRequest,\n CreateCustomerPortalResponse,\n DeleteUsageEventsBody,\n DeleteUsageEventsResponse,\n DeleteUsageEventRequest,\n DeleteUsageEventResponse,\n DeleteCustomerRequest,\n DeleteCustomerResponse,\n GetUsageEventRequest,\n GetUsageEventResponse,\n GetCustomerResponse,\n GetCustomerQuery,\n GetCustomerExpand,\n PriceOSCustomer,\n GetFeatureAccessResponse,\n GetPricingTableRequest,\n GetPricingTableResponse,\n PricingTablePlan,\n PricingTablePrice,\n PricingTableFeature,\n PricingTableCustomerState,\n CreateCheckoutRequest,\n CreateCheckoutResponse,\n LinkCustomerBody,\n LinkCustomerResponse,\n LimitFeatureKeyFromAccessMap,\n TrackedLimitFeatureKeyFromAccessMap,\n ListUsageEventsBody,\n ListUsageEventsResponse,\n SetUsageBody,\n SetUsageResponse,\n UpdateUsageEventBody,\n UpdateUsageEventRequest,\n UpdateUsageEventResponse,\n UsageEventDetail,\n UsageEvent,\n TrackUsageBody,\n TrackUsageBatchBody,\n TrackUsageBatchEvent,\n TrackUsageBatchResponse,\n TrackUsageResponse,\n UpdateCustomerBody,\n UpdateCustomerResponse,\n} from \"./types\";\n","import createClient from \"openapi-fetch\";\nimport type { Client } from \"openapi-fetch\";\nimport type { paths } from \"./gen/openapi\";\nimport {\n AddCustomProductRequest,\n AddCustomProductResponse,\n CreateBonusBody,\n CreateBonusResponse,\n CreateCustomerCheckoutRequest,\n CreateCustomerCheckoutResponse,\n CreateCustomerRequest,\n CreateCustomerResponse,\n CreateCustomerPortalResponse,\n DeleteBonusResponse,\n ListBonusesRequest,\n ListBonusesResponse,\n DeleteUsageEventsBody,\n DeleteUsageEventsResponse,\n DeleteUsageEventResponse,\n DeleteCustomerResponse,\n GetUsageEventResponse,\n GetCustomerResponse,\n GetCustomerQuery,\n GetFeatureAccessResponse,\n LinkCustomerBody,\n LinkCustomerResponse,\n LimitFeatureKeyFromAccessMap,\n TrackedLimitFeatureKeyFromAccessMap,\n ListUsageEventsBody,\n ListUsageEventsResponse,\n SetUsageBody,\n SetUsageResponse,\n RemoveCustomProductRequest,\n RemoveCustomProductResponse,\n UpdateUsageEventRequest,\n UpdateUsageEventResponse,\n UpdateBonusRequest,\n UpdateBonusResponse,\n TrackUsageBody,\n TrackUsageBatchBody,\n TrackUsageBatchResponse,\n TrackUsageResponse,\n UpdateCustomerBody,\n UpdateCustomerResponse,\n GetPricingTableRequest,\n GetPricingTableResponse,\n CreateCheckoutRequest,\n CreateCheckoutResponse,\n} from \"./types\";\n\nexport type PriceOSLogLevel = \"none\" | \"error\" | \"warning\" | \"info\" | \"debug\";\n\n// --- Public options ---\nexport type PriceOSClientOptions = {\n logLevel?: PriceOSLogLevel;\n};\n\nconst RATE_LIMIT_STATUS = 429;\nconst MAX_RETRIES = 4;\nconst BASE_DELAY_MS = 250;\nconst BACKOFF_MULTIPLIER = 2;\nconst JITTER_MS = 250;\nconst RETRY_DELAY_CAP_MS = 5_000;\nconst REQUEST_TIMEOUT_MS = 20_000;\n\nconst LOG_LEVELS: Record<PriceOSLogLevel, number> = {\n none: 0,\n error: 1,\n warning: 2,\n info: 3,\n debug: 4,\n};\n\ntype Logger = {\n error: (message: string, details?: Record<string, unknown>) => void;\n warning: (message: string, details?: Record<string, unknown>) => void;\n info: (message: string, details?: Record<string, unknown>) => void;\n debug: (message: string, details?: Record<string, unknown>) => void;\n};\n\nconst sleep = (ms: number): Promise<void> => new Promise((resolve) => setTimeout(resolve, ms));\n\nconst getRetryDelayMs = (retryCount: number): number => {\n const backoff = BASE_DELAY_MS * Math.pow(BACKOFF_MULTIPLIER, retryCount - 1);\n const jitter = Math.random() * JITTER_MS;\n return Math.min(RETRY_DELAY_CAP_MS, backoff + jitter);\n};\n\nconst resolveIdempotencyKey = (input: { idempotencyKey?: string }) => {\n const providedIdempotencyKey =\n typeof input.idempotencyKey === \"string\"\n ? String(input.idempotencyKey).trim()\n : \"\";\n return providedIdempotencyKey;\n};\n\nconst withIdempotencyKey = <T extends { idempotencyKey?: string }>(input: T): T => {\n const idempotencyKey = resolveIdempotencyKey(input);\n if (!idempotencyKey) return input;\n return {\n ...input,\n idempotencyKey,\n };\n};\n\nconst createLogger = (logLevel: PriceOSLogLevel): Logger => {\n const shouldLog = (level: PriceOSLogLevel): boolean =>\n logLevel !== \"none\" && LOG_LEVELS[level] <= LOG_LEVELS[logLevel];\n\n const write = (\n level: PriceOSLogLevel,\n message: string,\n details?: Record<string, unknown>\n ): void => {\n if (!shouldLog(level)) return;\n const prefix = `[PriceOS] ${level.toUpperCase()}: ${message}`;\n const payload = details && Object.keys(details).length > 0 ? details : undefined;\n\n switch (level) {\n case \"error\":\n payload ? console.error(prefix, payload) : console.error(prefix);\n return;\n case \"warning\":\n payload ? console.warn(prefix, payload) : console.warn(prefix);\n return;\n case \"info\":\n payload ? console.info(prefix, payload) : console.info(prefix);\n return;\n case \"debug\":\n payload ? console.debug(prefix, payload) : console.debug(prefix);\n return;\n }\n };\n\n return {\n error: (message, details) => write(\"error\", message, details),\n warning: (message, details) => write(\"warning\", message, details),\n info: (message, details) => write(\"info\", message, details),\n debug: (message, details) => write(\"debug\", message, details),\n };\n};\n\nconst getUpstreamSignal = (input: RequestInfo | URL, init?: RequestInit): AbortSignal | undefined => {\n if (init?.signal) return init.signal;\n if (typeof Request !== \"undefined\" && input instanceof Request) return input.signal;\n return undefined;\n};\n\nconst stripSignal = (init?: RequestInit): RequestInit | undefined => {\n if (!init) return undefined;\n const { signal: _signal, ...rest } = init;\n return rest;\n};\n\nconst getRequestDetails = (\n input: RequestInfo | URL,\n init?: RequestInit\n): { method: string; url: string } => {\n const method =\n init?.method ??\n (typeof Request !== \"undefined\" && input instanceof Request ? input.method : \"GET\");\n const url =\n typeof input === \"string\"\n ? input\n : input instanceof URL\n ? input.toString()\n : input.url;\n return { method, url };\n};\n\nconst prepareRetryRequest = async (\n input: RequestInfo | URL,\n init: RequestInit | undefined,\n log: Logger,\n method: string,\n url: string\n): Promise<{ requestInput: RequestInfo | URL; baseInit?: RequestInit; canRetry: boolean }> => {\n if (!(typeof Request !== \"undefined\" && input instanceof Request)) {\n return { requestInput: input, baseInit: stripSignal(init), canRetry: true };\n }\n\n if (input.bodyUsed) {\n log.warning(\"Request body already used; retries disabled\", { method, url });\n return { requestInput: input, baseInit: stripSignal(init), canRetry: false };\n }\n\n let body: BodyInit | undefined = undefined;\n if (method !== \"GET\" && method !== \"HEAD\") {\n try {\n body = await input.clone().arrayBuffer();\n } catch (error) {\n log.warning(\"Unable to clone request body; retries disabled\", { method, url, error });\n return { requestInput: input, baseInit: stripSignal(init), canRetry: false };\n }\n }\n\n const headers = new Headers(input.headers);\n const baseInit = { ...stripSignal(init), method, headers, body };\n return { requestInput: input.url, baseInit, canRetry: true };\n};\n\nconst getErrorMessage = (error: unknown): string => {\n const maybeError = error as { error?: unknown } | null;\n if (maybeError && typeof maybeError.error === \"string\") return maybeError.error;\n return \"Request failed\";\n};\n\nconst throwRequestError = (\n log: Logger,\n error: unknown,\n response: Response | undefined,\n context: string\n): never => {\n log.error(\"Request failed\", { context, status: response?.status, error });\n throw new PriceOSError(getErrorMessage(error), { status: response?.status, details: error });\n};\n\nconst resolveUrlResponse = (\n data: unknown,\n response: Response | undefined\n): { url: string } | null => {\n if (data && typeof data === \"object\" && !Array.isArray(data)) {\n const value = (data as { url?: unknown }).url;\n if (typeof value === \"string\" && value.trim().length > 0) {\n return { url: value };\n }\n }\n\n const location = response?.headers.get(\"location\");\n if (location && location.trim().length > 0) {\n return { url: location };\n }\n\n if (response?.redirected && typeof response.url === \"string\" && response.url.trim().length > 0) {\n return { url: response.url };\n }\n\n return null;\n};\n\nconst createRetryingFetch = (baseFetch: typeof fetch, log: Logger): typeof fetch => {\n return async (input: RequestInfo | URL, init?: RequestInit): Promise<Response> => {\n const { method, url } = getRequestDetails(input, init);\n const upstreamSignal = getUpstreamSignal(input, init);\n const { requestInput, baseInit, canRetry } = await prepareRetryRequest(\n input,\n init,\n log,\n method,\n url\n );\n let attempt = 0;\n while (true) {\n log.debug(\"Request attempt\", { method, url, attempt: attempt + 1, maxRetries: MAX_RETRIES });\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);\n let removeAbortListener: (() => void) | null = null;\n\n if (upstreamSignal) {\n if (upstreamSignal.aborted) {\n controller.abort();\n } else {\n const onAbort = () => controller.abort();\n upstreamSignal.addEventListener(\"abort\", onAbort);\n removeAbortListener = () => upstreamSignal.removeEventListener(\"abort\", onAbort);\n }\n }\n\n try {\n const requestInit = { ...(baseInit ?? {}), signal: controller.signal };\n const response = await baseFetch(requestInput, requestInit);\n if (response.status !== RATE_LIMIT_STATUS) return response;\n\n const retryAfter = response.headers.get(\"retry-after\") ?? undefined;\n log.warning(\"Rate limit hit (429)\", {\n method,\n url,\n attempt: attempt + 1,\n maxRetries: MAX_RETRIES,\n retryAfter,\n });\n\n if (!canRetry) {\n log.warning(\"Skipping retry because request body is not replayable\", { method, url });\n return response;\n }\n\n if (attempt >= MAX_RETRIES) {\n log.error(\"Rate limit retries exhausted\", { method, url, attempts: attempt + 1 });\n return response;\n }\n\n const delayMs = getRetryDelayMs(attempt + 1);\n log.info(\"Waiting to retry after rate limit\", {\n method,\n url,\n delayMs,\n nextAttempt: attempt + 2,\n maxRetries: MAX_RETRIES,\n });\n await sleep(delayMs);\n attempt += 1;\n } catch (error) {\n if (controller.signal.aborted) {\n const abortedByCaller = upstreamSignal?.aborted ?? false;\n if (abortedByCaller) {\n log.warning(\"Request aborted by caller\", { method, url, attempt: attempt + 1 });\n } else {\n log.error(\"Request timed out\", {\n method,\n url,\n attempt: attempt + 1,\n timeoutMs: REQUEST_TIMEOUT_MS,\n });\n }\n } else {\n log.error(\"Request failed\", { method, url, attempt: attempt + 1, error });\n }\n throw error;\n } finally {\n clearTimeout(timeoutId);\n removeAbortListener?.();\n }\n }\n };\n};\n\nexport type PriceOSCustomersClient<TFeatureAccessMap = GetFeatureAccessResponse> = {\n get(\n customerId: string,\n options?: { expand?: GetCustomerQuery[\"expand\"] }\n ): Promise<GetCustomerResponse<TFeatureAccessMap> | null>;\n link(input: LinkCustomerBody): Promise<LinkCustomerResponse<TFeatureAccessMap> | null>;\n create(input: CreateCustomerRequest): Promise<CreateCustomerResponse<TFeatureAccessMap>>;\n update(input: UpdateCustomerBody): Promise<UpdateCustomerResponse<TFeatureAccessMap>>;\n addCustomProduct(input: AddCustomProductRequest): Promise<AddCustomProductResponse<TFeatureAccessMap>>;\n removeCustomProduct(\n input: RemoveCustomProductRequest\n ): Promise<RemoveCustomProductResponse<TFeatureAccessMap>>;\n delete(customerId: string): Promise<DeleteCustomerResponse>;\n createPortal(customerId: string): Promise<CreateCustomerPortalResponse>;\n createCheckout(\n customerId: string,\n input: CreateCustomerCheckoutRequest\n ): Promise<CreateCustomerCheckoutResponse>;\n};\n\ntype FeatureAccessRecord<TFeatureAccessMap> =\n TFeatureAccessMap extends Record<string, unknown> ? TFeatureAccessMap : Record<string, never>;\n\ntype FeatureAccessKey<TFeatureAccessMap> = keyof FeatureAccessRecord<TFeatureAccessMap> & string;\n\nexport type PriceOSFeaturesClient<TFeatureAccessMap = GetFeatureAccessResponse> = {\n getAccess(customerId: string): Promise<TFeatureAccessMap>;\n getAccess<TFeatureKey extends FeatureAccessKey<TFeatureAccessMap>>(\n customerId: string,\n featureKey: TFeatureKey\n ): Promise<FeatureAccessRecord<TFeatureAccessMap>[TFeatureKey]>;\n};\n\nexport type PriceOSPricingClient = {\n getTable(input?: GetPricingTableRequest): Promise<GetPricingTableResponse>;\n};\n\nexport type PriceOSCheckoutClient = {\n create(input: CreateCheckoutRequest): Promise<CreateCheckoutResponse>;\n};\n\nexport type PriceOSBonusesClient<TFeatureAccessMap = GetFeatureAccessResponse> = {\n create(\n input: CreateBonusBody<TrackedLimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<CreateBonusResponse>;\n list(\n input: ListBonusesRequest<LimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<ListBonusesResponse>;\n update(input: UpdateBonusRequest): Promise<UpdateBonusResponse>;\n delete(bonusId: string): Promise<DeleteBonusResponse>;\n};\n\nexport type PriceOSUsageClient<TFeatureAccessMap = GetFeatureAccessResponse> = {\n track(\n input: TrackUsageBody<LimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<TrackUsageResponse>;\n set(\n input: SetUsageBody<LimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<SetUsageResponse>;\n getEvent(eventId: string): Promise<GetUsageEventResponse>;\n updateEvent(input: UpdateUsageEventRequest): Promise<UpdateUsageEventResponse>;\n deleteEvent(eventId: string): Promise<DeleteUsageEventResponse>;\n deleteEvents(\n input: DeleteUsageEventsBody<LimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<DeleteUsageEventsResponse>;\n trackBatch(\n input: TrackUsageBatchBody<LimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<TrackUsageBatchResponse>;\n listEvents(\n input: ListUsageEventsBody<LimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<ListUsageEventsResponse>;\n};\n\n// --- Public SDK surface type ---\nexport type PriceOSHttpClient<TFeatureAccessMap = GetFeatureAccessResponse> = {\n customers: PriceOSCustomersClient<TFeatureAccessMap>;\n features: PriceOSFeaturesClient<TFeatureAccessMap>;\n pricing: PriceOSPricingClient;\n checkout: PriceOSCheckoutClient;\n bonuses: PriceOSBonusesClient<TFeatureAccessMap>;\n usage: PriceOSUsageClient<TFeatureAccessMap>;\n};\n\nexport class PriceOSError extends Error {\n status?: number;\n details?: unknown;\n\n constructor(message: string, opts?: { status?: number; details?: unknown }) {\n super(message);\n this.name = \"PriceOSError\";\n this.status = opts?.status;\n this.details = opts?.details;\n }\n}\n\nexport class PriceOS<TFeatureAccessMap = GetFeatureAccessResponse>\n implements PriceOSHttpClient<TFeatureAccessMap>\n{\n private client: Client<paths>;\n private header: { \"x-api-key\": string };\n private log: Logger;\n customers: PriceOSCustomersClient<TFeatureAccessMap>;\n features: PriceOSFeaturesClient<TFeatureAccessMap>;\n pricing: PriceOSPricingClient;\n checkout: PriceOSCheckoutClient;\n bonuses: PriceOSBonusesClient<TFeatureAccessMap>;\n usage: PriceOSUsageClient<TFeatureAccessMap>;\n\n constructor(apiKey: string, opts: PriceOSClientOptions = {}) {\n const logLevel = opts.logLevel ?? \"none\";\n this.log = createLogger(logLevel);\n const baseUrl = \"https://api.priceos.com\";\n this.header = { \"x-api-key\": apiKey };\n const fetchWithRetry = createRetryingFetch(fetch, this.log);\n this.client = createClient<paths>({\n baseUrl,\n fetch: fetchWithRetry,\n headers: {\n \"x-api-key\": apiKey,\n },\n });\n\n this.customers = {\n get: async (\n customerId: string,\n options?: { expand?: GetCustomerQuery[\"expand\"] }\n ): Promise<GetCustomerResponse<TFeatureAccessMap> | null> => {\n const query = options?.expand?.length ? { expand: options.expand } : undefined;\n const { data, error, response } = await this.client.GET(\"/v1/customers/{customerId}\", {\n params: {\n path: { customerId },\n ...(query ? { query } : {}),\n header: this.header,\n },\n });\n if (error) throwRequestError(this.log, error, response, \"GET /v1/customers/{customerId}\");\n return (data ?? null) as GetCustomerResponse<TFeatureAccessMap> | null;\n },\n link: async (\n input: LinkCustomerBody\n ): Promise<LinkCustomerResponse<TFeatureAccessMap> | null> => {\n const { data, error, response } = await this.client.POST(\"/v1/customers/link\", {\n params: { header: this.header },\n body: input,\n });\n if (error) throwRequestError(this.log, error, response, \"POST /v1/customers/link\");\n return (data ?? null) as LinkCustomerResponse<TFeatureAccessMap> | null;\n },\n create: async (input: CreateCustomerRequest): Promise<CreateCustomerResponse<TFeatureAccessMap>> => {\n const { data, error, response } = await this.client.POST(\"/v1/customers\", {\n params: { header: this.header },\n body: input,\n });\n if (error) throwRequestError(this.log, error, response, \"POST /v1/customers\");\n return data! as CreateCustomerResponse<TFeatureAccessMap>;\n },\n update: async (input: UpdateCustomerBody): Promise<UpdateCustomerResponse<TFeatureAccessMap>> => {\n const { customerId, ...body } = input;\n const { data, error, response } = await this.client.PUT(\"/v1/customers/{customerId}\", {\n params: { path: { customerId }, header: this.header },\n body,\n });\n if (error) throwRequestError(this.log, error, response, \"PUT /v1/customers/{customerId}\");\n return data! as UpdateCustomerResponse<TFeatureAccessMap>;\n },\n addCustomProduct: async (\n input: AddCustomProductRequest\n ): Promise<AddCustomProductResponse<TFeatureAccessMap>> => {\n const { customerId, ...body } = input;\n const { data, error, response } = await this.client.POST(\n \"/v1/customers/{customerId}/custom-product/add\",\n {\n params: { path: { customerId }, header: this.header },\n body,\n }\n );\n if (error) {\n throwRequestError(this.log, error, response, \"POST /v1/customers/{customerId}/custom-product/add\");\n }\n return data! as AddCustomProductResponse<TFeatureAccessMap>;\n },\n removeCustomProduct: async (\n input: RemoveCustomProductRequest\n ): Promise<RemoveCustomProductResponse<TFeatureAccessMap>> => {\n const { customerId, ...body } = input;\n const { data, error, response } = await this.client.POST(\n \"/v1/customers/{customerId}/custom-product/remove\",\n {\n params: { path: { customerId }, header: this.header },\n body,\n }\n );\n if (error) {\n throwRequestError(this.log, error, response, \"POST /v1/customers/{customerId}/custom-product/remove\");\n }\n return data! as RemoveCustomProductResponse<TFeatureAccessMap>;\n },\n delete: async (customerId: string): Promise<DeleteCustomerResponse> => {\n const { data, error, response } = await this.client.DELETE(\"/v1/customers/{customerId}\", {\n params: { path: { customerId }, header: this.header },\n });\n if (error) throwRequestError(this.log, error, response, \"DELETE /v1/customers/{customerId}\");\n return data! as DeleteCustomerResponse;\n },\n createPortal: async (customerId: string): Promise<CreateCustomerPortalResponse> => {\n const { data, error, response } = await this.client.POST(\n \"/v1/customers/{customerId}/customer_portal\",\n {\n params: { path: { customerId }, header: this.header },\n }\n );\n if (error) {\n throwRequestError(this.log, error, response, \"POST /v1/customers/{customerId}/customer_portal\");\n }\n if (response && !response.ok) {\n throw new PriceOSError(response.statusText || \"Request failed\", { status: response.status });\n }\n const result = resolveUrlResponse(data, response);\n if (result) {\n return result as CreateCustomerPortalResponse;\n }\n throw new PriceOSError(\"Invalid customer portal response\", {\n status: response?.status,\n details: {\n redirected: response?.redirected ?? false,\n responseUrl: response?.url ?? null,\n },\n });\n },\n createCheckout: async (\n customerId: string,\n input: CreateCustomerCheckoutRequest\n ): Promise<CreateCustomerCheckoutResponse> => {\n const { data, error, response } = await this.client.POST(\"/v1/customers/{customerId}/checkout\", {\n params: { path: { customerId }, header: this.header },\n body: input,\n });\n if (error) {\n throwRequestError(this.log, error, response, \"POST /v1/customers/{customerId}/checkout\");\n }\n if (response && !response.ok) {\n throw new PriceOSError(response.statusText || \"Request failed\", { status: response.status });\n }\n const result = resolveUrlResponse(data, response);\n if (result) {\n return result as CreateCustomerCheckoutResponse;\n }\n throw new PriceOSError(\"Invalid checkout response\", {\n status: response?.status,\n details: {\n redirected: response?.redirected ?? false,\n responseUrl: response?.url ?? null,\n },\n });\n },\n };\n\n const getFeatureAccessForCustomer = async (customerId: string): Promise<TFeatureAccessMap> => {\n const { data, error, response } = await this.client.GET(\"/v1/feature-access\", {\n params: { query: { customerId }, header: this.header },\n });\n if (error) throwRequestError(this.log, error, response, \"GET /v1/feature-access\");\n return data! as TFeatureAccessMap;\n };\n\n function getFeatureAccess(customerId: string): Promise<TFeatureAccessMap>;\n function getFeatureAccess<TFeatureKey extends FeatureAccessKey<TFeatureAccessMap>>(\n customerId: string,\n featureKey: TFeatureKey\n ): Promise<FeatureAccessRecord<TFeatureAccessMap>[TFeatureKey]>;\n async function getFeatureAccess<TFeatureKey extends FeatureAccessKey<TFeatureAccessMap>>(\n customerId: string,\n featureKey?: TFeatureKey\n ): Promise<TFeatureAccessMap | FeatureAccessRecord<TFeatureAccessMap>[TFeatureKey]> {\n const featureAccess = await getFeatureAccessForCustomer(customerId);\n if (featureKey === undefined) return featureAccess;\n return (featureAccess as FeatureAccessRecord<TFeatureAccessMap>)[featureKey];\n }\n\n this.features = {\n getAccess: getFeatureAccess,\n };\n\n this.pricing = {\n getTable: async (input: GetPricingTableRequest = {}): Promise<GetPricingTableResponse> => {\n const query = {\n ...(typeof input.customerId === \"string\" ? { customerId: input.customerId } : {}),\n ...(typeof input.pricingTableKey === \"string\" ? { pricingTableKey: input.pricingTableKey } : {}),\n };\n const { data, error, response } = await this.client.GET(\"/v1/pricing-table\", {\n params: { query, header: this.header },\n });\n if (error) throwRequestError(this.log, error, response, \"GET /v1/pricing-table\");\n return data! as GetPricingTableResponse;\n },\n };\n\n this.checkout = {\n create: async (input: CreateCheckoutRequest): Promise<CreateCheckoutResponse> => {\n const { data, error, response } = await this.client.POST(\"/v1/checkout\", {\n params: { header: this.header },\n body: input,\n });\n if (error) throwRequestError(this.log, error, response, \"POST /v1/checkout\");\n if (response && !response.ok) {\n throw new PriceOSError(response.statusText || \"Request failed\", { status: response.status });\n }\n const result = resolveUrlResponse(data, response);\n if (result) {\n return result as CreateCheckoutResponse;\n }\n throw new PriceOSError(\"Invalid checkout response\", {\n status: response?.status,\n details: {\n redirected: response?.redirected ?? false,\n responseUrl: response?.url ?? null,\n },\n });\n },\n };\n\n this.bonuses = {\n create: async (\n input: CreateBonusBody<TrackedLimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<CreateBonusResponse> => {\n const { data, error, response } = await this.client.POST(\"/v1/bonuses\", {\n params: { header: this.header },\n body: input,\n });\n if (error) throwRequestError(this.log, error, response, \"POST /v1/bonuses\");\n return data!;\n },\n list: async (\n input: ListBonusesRequest<LimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<ListBonusesResponse> => {\n const { data, error, response } = await this.client.GET(\"/v1/bonuses\", {\n params: { header: this.header, query: input },\n });\n if (error) throwRequestError(this.log, error, response, \"GET /v1/bonuses\");\n return data!;\n },\n update: async (input: UpdateBonusRequest): Promise<UpdateBonusResponse> => {\n const { bonusId, ...body } = input;\n const { data, error, response } = await this.client.PUT(\"/v1/bonuses/{bonusId}\", {\n params: { header: this.header, path: { bonusId } },\n body,\n });\n if (error) throwRequestError(this.log, error, response, \"PUT /v1/bonuses/{bonusId}\");\n return data!;\n },\n delete: async (bonusId: string): Promise<DeleteBonusResponse> => {\n const { data, error, response } = await this.client.DELETE(\"/v1/bonuses/{bonusId}\", {\n params: { header: this.header, path: { bonusId } },\n });\n if (error) throwRequestError(this.log, error, response, \"DELETE /v1/bonuses/{bonusId}\");\n return data!;\n },\n };\n\n this.usage = {\n track: async (\n input: TrackUsageBody<LimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<TrackUsageResponse> => {\n const body = withIdempotencyKey(input);\n const { data, error, response } = await this.client.POST(\"/v1/usage\", {\n params: { header: this.header },\n body,\n });\n if (error) throwRequestError(this.log, error, response, \"POST /v1/usage\");\n return data!;\n },\n set: async (\n input: SetUsageBody<LimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<SetUsageResponse> => {\n const body = withIdempotencyKey(input);\n const { data, error, response } = await this.client.POST(\"/v1/usage/set\", {\n params: { header: this.header },\n body,\n });\n if (error) throwRequestError(this.log, error, response, \"POST /v1/usage/set\");\n return data!;\n },\n getEvent: async (eventId: string): Promise<GetUsageEventResponse> => {\n const { data, error, response } = await this.client.GET(\"/v1/usage/{id}\", {\n params: { header: this.header, path: { id: eventId } },\n });\n if (error) throwRequestError(this.log, error, response, \"GET /v1/usage/{id}\");\n return data!;\n },\n updateEvent: async (input: UpdateUsageEventRequest): Promise<UpdateUsageEventResponse> => {\n const { id, ...body } = input;\n const { data, error, response } = await this.client.PUT(\"/v1/usage/{id}\", {\n params: { header: this.header, path: { id } },\n body,\n });\n if (error) throwRequestError(this.log, error, response, \"PUT /v1/usage/{id}\");\n return data!;\n },\n deleteEvent: async (eventId: string): Promise<DeleteUsageEventResponse> => {\n const { data, error, response } = await this.client.DELETE(\"/v1/usage/{id}\", {\n params: { header: this.header, path: { id: eventId } },\n });\n if (error) throwRequestError(this.log, error, response, \"DELETE /v1/usage/{id}\");\n return data!;\n },\n deleteEvents: async (\n input: DeleteUsageEventsBody<LimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<DeleteUsageEventsResponse> => {\n const { data, error, response } = await this.client.POST(\"/v1/usage/delete\", {\n params: { header: this.header },\n body: input,\n });\n if (error) throwRequestError(this.log, error, response, \"POST /v1/usage/delete\");\n return data!;\n },\n trackBatch: async (\n input: TrackUsageBatchBody<LimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<TrackUsageBatchResponse> => {\n const body = {\n ...input,\n events: input.events.map((event) => withIdempotencyKey(event)),\n };\n const { data, error, response } = await this.client.POST(\"/v1/usage/batch\", {\n params: { header: this.header },\n body,\n });\n if (error) throwRequestError(this.log, error, response, \"POST /v1/usage/batch\");\n return data!;\n },\n listEvents: async (\n input: ListUsageEventsBody<LimitFeatureKeyFromAccessMap<TFeatureAccessMap>>\n ): Promise<ListUsageEventsResponse> => {\n const { data, error, response } = await this.client.POST(\"/v1/usage/events\", {\n params: { header: this.header },\n body: input,\n });\n if (error) throwRequestError(this.log, error, response, \"POST /v1/usage/events\");\n return data!;\n },\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,2BAAyB;AAyDzB,IAAM,oBAAoB;AAC1B,IAAM,cAAc;AACpB,IAAM,gBAAgB;AACtB,IAAM,qBAAqB;AAC3B,IAAM,YAAY;AAClB,IAAM,qBAAqB;AAC3B,IAAM,qBAAqB;AAE3B,IAAM,aAA8C;AAAA,EAClD,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AAAA,EACN,OAAO;AACT;AASA,IAAM,QAAQ,CAAC,OAA8B,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,EAAE,CAAC;AAE7F,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E,eAAO;AAAA,MACT;AAAA,MACA,YAAY,OACV,UACqC;AACrC,cAAM,EAAE,MAAM,OAAO,SAAS,IAAI,MAAM,KAAK,OAAO,KAAK,oBAAoB;AAAA,UAC3E,QAAQ,EAAE,QAAQ,KAAK,OAAO;AAAA,UAC9B,MAAM;AAAA,QACR,CAAC;AACD,YAAI,MAAO,mBAAkB,KAAK,KAAK,OAAO,UAAU,uBAAuB;AAC/E,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACF;","names":["createClient"]}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export { PriceOS, PriceOSError } from "./client";
2
2
  export type { PriceOSClientOptions, PriceOSLogLevel, PriceOSBonusesClient, PriceOSCustomersClient, PriceOSFeaturesClient, PriceOSPricingClient, PriceOSCheckoutClient, PriceOSHttpClient, PriceOSUsageClient, } from "./client";
3
- export type { CreateBonusBody, CreateBonusResponse, ListBonusesRequest, ListBonusesResponse, UpdateBonusBody, UpdateBonusRequest, UpdateBonusResponse, DeleteBonusRequest, DeleteBonusResponse, CreateCustomerRequest, CreateCustomerResponse, CreateCustomerPortalRequest, CreateCustomerPortalResponse, DeleteUsageEventsBody, DeleteUsageEventsResponse, DeleteUsageEventRequest, DeleteUsageEventResponse, DeleteCustomerRequest, DeleteCustomerResponse, GetUsageEventRequest, GetUsageEventResponse, GetUsageEventByKeyRequest, GetUsageEventByKeyResponse, GetCustomerResponse, PriceOSCustomer, GetFeatureAccessResponse, GetPricingTableRequest, GetPricingTableResponse, PricingTablePlan, PricingTablePrice, PricingTableFeature, PricingTableCustomerState, CreateCheckoutRequest, CreateCheckoutResponse, LinkCustomerBody, LinkCustomerResponse, LimitFeatureKeyFromAccessMap, TrackedLimitFeatureKeyFromAccessMap, ListUsageEventsBody, ListUsageEventsResponse, SetUsageBody, SetUsageResponse, UpdateUsageEventBody, UpdateUsageEventRequest, UpdateUsageEventResponse, VoidUsageEventBody, VoidUsageEventRequest, VoidUsageEventResponse, UsageEventDetail, UsageEvent, TrackUsageBody, TrackUsageBatchBody, TrackUsageBatchEvent, TrackUsageBatchResponse, TrackUsageResponse, UpdateCustomerBody, UpdateCustomerResponse, } from "./types";
3
+ export type { CreateBonusBody, CreateBonusResponse, ListBonusesRequest, ListBonusesResponse, UpdateBonusBody, UpdateBonusRequest, UpdateBonusResponse, DeleteBonusRequest, DeleteBonusResponse, CreateCustomerRequest, CreateCustomerResponse, CreateCustomerCheckoutRequest, CreateCustomerCheckoutResponse, CreateCustomerPortalRequest, CreateCustomerPortalResponse, DeleteUsageEventsBody, DeleteUsageEventsResponse, DeleteUsageEventRequest, DeleteUsageEventResponse, DeleteCustomerRequest, DeleteCustomerResponse, GetUsageEventRequest, GetUsageEventResponse, GetCustomerResponse, GetCustomerQuery, GetCustomerExpand, PriceOSCustomer, GetFeatureAccessResponse, GetPricingTableRequest, GetPricingTableResponse, PricingTablePlan, PricingTablePrice, PricingTableFeature, PricingTableCustomerState, CreateCheckoutRequest, CreateCheckoutResponse, LinkCustomerBody, LinkCustomerResponse, LimitFeatureKeyFromAccessMap, TrackedLimitFeatureKeyFromAccessMap, ListUsageEventsBody, ListUsageEventsResponse, SetUsageBody, SetUsageResponse, UpdateUsageEventBody, UpdateUsageEventRequest, UpdateUsageEventResponse, UsageEventDetail, UsageEvent, TrackUsageBody, TrackUsageBatchBody, TrackUsageBatchEvent, TrackUsageBatchResponse, TrackUsageResponse, UpdateCustomerBody, UpdateCustomerResponse, } from "./types";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  PriceOS,
3
3
  PriceOSError
4
- } from "./chunk-SMK7KTGQ.js";
4
+ } from "./chunk-L253ULJU.js";
5
5
  export {
6
6
  PriceOS,
7
7
  PriceOSError