@onflay/node 0.1.1

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 (98) hide show
  1. package/README.md +87 -0
  2. package/dist/client.d.ts +65 -0
  3. package/dist/client.d.ts.map +1 -0
  4. package/dist/client.js +215 -0
  5. package/dist/client.js.map +1 -0
  6. package/dist/errors.d.ts +61 -0
  7. package/dist/errors.d.ts.map +1 -0
  8. package/dist/errors.js +132 -0
  9. package/dist/errors.js.map +1 -0
  10. package/dist/index.d.ts +26 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +41 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/onflay.d.ts +42 -0
  15. package/dist/onflay.d.ts.map +1 -0
  16. package/dist/onflay.js +60 -0
  17. package/dist/onflay.js.map +1 -0
  18. package/dist/pagination.d.ts +19 -0
  19. package/dist/pagination.d.ts.map +1 -0
  20. package/dist/pagination.js +61 -0
  21. package/dist/pagination.js.map +1 -0
  22. package/dist/resources/checkout-sessions.d.ts +11 -0
  23. package/dist/resources/checkout-sessions.d.ts.map +1 -0
  24. package/dist/resources/checkout-sessions.js +20 -0
  25. package/dist/resources/checkout-sessions.js.map +1 -0
  26. package/dist/resources/customers.d.ts +17 -0
  27. package/dist/resources/customers.d.ts.map +1 -0
  28. package/dist/resources/customers.js +39 -0
  29. package/dist/resources/customers.js.map +1 -0
  30. package/dist/resources/payments.d.ts +11 -0
  31. package/dist/resources/payments.d.ts.map +1 -0
  32. package/dist/resources/payments.js +27 -0
  33. package/dist/resources/payments.js.map +1 -0
  34. package/dist/resources/prices.d.ts +24 -0
  35. package/dist/resources/prices.d.ts.map +1 -0
  36. package/dist/resources/prices.js +46 -0
  37. package/dist/resources/prices.js.map +1 -0
  38. package/dist/resources/products.d.ts +18 -0
  39. package/dist/resources/products.d.ts.map +1 -0
  40. package/dist/resources/products.js +40 -0
  41. package/dist/resources/products.js.map +1 -0
  42. package/dist/resources/subscriptions.d.ts +39 -0
  43. package/dist/resources/subscriptions.d.ts.map +1 -0
  44. package/dist/resources/subscriptions.js +62 -0
  45. package/dist/resources/subscriptions.js.map +1 -0
  46. package/dist/resources/usage.d.ts +26 -0
  47. package/dist/resources/usage.d.ts.map +1 -0
  48. package/dist/resources/usage.js +43 -0
  49. package/dist/resources/usage.js.map +1 -0
  50. package/dist/resources/webhook-endpoints.d.ts +20 -0
  51. package/dist/resources/webhook-endpoints.d.ts.map +1 -0
  52. package/dist/resources/webhook-endpoints.js +47 -0
  53. package/dist/resources/webhook-endpoints.js.map +1 -0
  54. package/dist/types/checkout-sessions.d.ts +39 -0
  55. package/dist/types/checkout-sessions.d.ts.map +1 -0
  56. package/dist/types/checkout-sessions.js +3 -0
  57. package/dist/types/checkout-sessions.js.map +1 -0
  58. package/dist/types/customers.d.ts +28 -0
  59. package/dist/types/customers.d.ts.map +1 -0
  60. package/dist/types/customers.js +3 -0
  61. package/dist/types/customers.js.map +1 -0
  62. package/dist/types/events.d.ts +55 -0
  63. package/dist/types/events.d.ts.map +1 -0
  64. package/dist/types/events.js +23 -0
  65. package/dist/types/events.js.map +1 -0
  66. package/dist/types/payments.d.ts +25 -0
  67. package/dist/types/payments.d.ts.map +1 -0
  68. package/dist/types/payments.js +3 -0
  69. package/dist/types/payments.js.map +1 -0
  70. package/dist/types/prices.d.ts +57 -0
  71. package/dist/types/prices.d.ts.map +1 -0
  72. package/dist/types/prices.js +3 -0
  73. package/dist/types/prices.js.map +1 -0
  74. package/dist/types/products.d.ts +29 -0
  75. package/dist/types/products.d.ts.map +1 -0
  76. package/dist/types/products.js +3 -0
  77. package/dist/types/products.js.map +1 -0
  78. package/dist/types/shared.d.ts +34 -0
  79. package/dist/types/shared.d.ts.map +1 -0
  80. package/dist/types/shared.js +4 -0
  81. package/dist/types/shared.js.map +1 -0
  82. package/dist/types/subscriptions.d.ts +85 -0
  83. package/dist/types/subscriptions.d.ts.map +1 -0
  84. package/dist/types/subscriptions.js +3 -0
  85. package/dist/types/subscriptions.js.map +1 -0
  86. package/dist/types/usage.d.ts +35 -0
  87. package/dist/types/usage.d.ts.map +1 -0
  88. package/dist/types/usage.js +3 -0
  89. package/dist/types/usage.js.map +1 -0
  90. package/dist/types/webhook-endpoints.d.ts +48 -0
  91. package/dist/types/webhook-endpoints.d.ts.map +1 -0
  92. package/dist/types/webhook-endpoints.js +3 -0
  93. package/dist/types/webhook-endpoints.js.map +1 -0
  94. package/dist/version.d.ts +4 -0
  95. package/dist/version.d.ts.map +1 -0
  96. package/dist/version.js +7 -0
  97. package/dist/version.js.map +1 -0
  98. package/package.json +43 -0
package/dist/index.js ADDED
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ONFLAY_EVENT_TYPES = exports.WebhookEndpointsResource = exports.UsageResource = exports.CustomersResource = exports.SubscriptionsResource = exports.PaymentsResource = exports.CheckoutSessionsResource = exports.PricesResource = exports.ProductsResource = exports.ONFLAY_API_VERSION = exports.SDK_USER_AGENT = exports.SDK_VERSION = exports.OnflayRateLimitError = exports.OnflayInvalidRequestError = exports.OnflayIdempotencyError = exports.OnflayConnectionError = exports.OnflayAuthenticationError = exports.OnflayApiError = exports.OnflayError = exports.resolveBaseUrlFromKey = exports.ONFLAY_SANDBOX_BASE_URL = exports.ONFLAY_PROD_BASE_URL = exports.OnflayClient = exports.Onflay = void 0;
4
+ var onflay_1 = require("./onflay");
5
+ Object.defineProperty(exports, "Onflay", { enumerable: true, get: function () { return onflay_1.Onflay; } });
6
+ var client_1 = require("./client");
7
+ Object.defineProperty(exports, "OnflayClient", { enumerable: true, get: function () { return client_1.OnflayClient; } });
8
+ Object.defineProperty(exports, "ONFLAY_PROD_BASE_URL", { enumerable: true, get: function () { return client_1.ONFLAY_PROD_BASE_URL; } });
9
+ Object.defineProperty(exports, "ONFLAY_SANDBOX_BASE_URL", { enumerable: true, get: function () { return client_1.ONFLAY_SANDBOX_BASE_URL; } });
10
+ Object.defineProperty(exports, "resolveBaseUrlFromKey", { enumerable: true, get: function () { return client_1.resolveBaseUrlFromKey; } });
11
+ var errors_1 = require("./errors");
12
+ Object.defineProperty(exports, "OnflayError", { enumerable: true, get: function () { return errors_1.OnflayError; } });
13
+ Object.defineProperty(exports, "OnflayApiError", { enumerable: true, get: function () { return errors_1.OnflayApiError; } });
14
+ Object.defineProperty(exports, "OnflayAuthenticationError", { enumerable: true, get: function () { return errors_1.OnflayAuthenticationError; } });
15
+ Object.defineProperty(exports, "OnflayConnectionError", { enumerable: true, get: function () { return errors_1.OnflayConnectionError; } });
16
+ Object.defineProperty(exports, "OnflayIdempotencyError", { enumerable: true, get: function () { return errors_1.OnflayIdempotencyError; } });
17
+ Object.defineProperty(exports, "OnflayInvalidRequestError", { enumerable: true, get: function () { return errors_1.OnflayInvalidRequestError; } });
18
+ Object.defineProperty(exports, "OnflayRateLimitError", { enumerable: true, get: function () { return errors_1.OnflayRateLimitError; } });
19
+ var version_1 = require("./version");
20
+ Object.defineProperty(exports, "SDK_VERSION", { enumerable: true, get: function () { return version_1.SDK_VERSION; } });
21
+ Object.defineProperty(exports, "SDK_USER_AGENT", { enumerable: true, get: function () { return version_1.SDK_USER_AGENT; } });
22
+ Object.defineProperty(exports, "ONFLAY_API_VERSION", { enumerable: true, get: function () { return version_1.ONFLAY_API_VERSION; } });
23
+ var products_1 = require("./resources/products");
24
+ Object.defineProperty(exports, "ProductsResource", { enumerable: true, get: function () { return products_1.ProductsResource; } });
25
+ var prices_1 = require("./resources/prices");
26
+ Object.defineProperty(exports, "PricesResource", { enumerable: true, get: function () { return prices_1.PricesResource; } });
27
+ var checkout_sessions_1 = require("./resources/checkout-sessions");
28
+ Object.defineProperty(exports, "CheckoutSessionsResource", { enumerable: true, get: function () { return checkout_sessions_1.CheckoutSessionsResource; } });
29
+ var payments_1 = require("./resources/payments");
30
+ Object.defineProperty(exports, "PaymentsResource", { enumerable: true, get: function () { return payments_1.PaymentsResource; } });
31
+ var subscriptions_1 = require("./resources/subscriptions");
32
+ Object.defineProperty(exports, "SubscriptionsResource", { enumerable: true, get: function () { return subscriptions_1.SubscriptionsResource; } });
33
+ var customers_1 = require("./resources/customers");
34
+ Object.defineProperty(exports, "CustomersResource", { enumerable: true, get: function () { return customers_1.CustomersResource; } });
35
+ var usage_1 = require("./resources/usage");
36
+ Object.defineProperty(exports, "UsageResource", { enumerable: true, get: function () { return usage_1.UsageResource; } });
37
+ var webhook_endpoints_1 = require("./resources/webhook-endpoints");
38
+ Object.defineProperty(exports, "WebhookEndpointsResource", { enumerable: true, get: function () { return webhook_endpoints_1.WebhookEndpointsResource; } });
39
+ var events_1 = require("./types/events");
40
+ Object.defineProperty(exports, "ONFLAY_EVENT_TYPES", { enumerable: true, get: function () { return events_1.ONFLAY_EVENT_TYPES; } });
41
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,mCAKkB;AAJhB,sGAAA,YAAY,OAAA;AACZ,8GAAA,oBAAoB,OAAA;AACpB,iHAAA,uBAAuB,OAAA;AACvB,+GAAA,qBAAqB,OAAA;AAGvB,mCAQkB;AAPhB,qGAAA,WAAW,OAAA;AACX,wGAAA,cAAc,OAAA;AACd,mHAAA,yBAAyB,OAAA;AACzB,+GAAA,qBAAqB,OAAA;AACrB,gHAAA,sBAAsB,OAAA;AACtB,mHAAA,yBAAyB,OAAA;AACzB,8GAAA,oBAAoB,OAAA;AAGtB,qCAA4E;AAAnE,sGAAA,WAAW,OAAA;AAAE,yGAAA,cAAc,OAAA;AAAE,6GAAA,kBAAkB,OAAA;AAExD,iDAAwD;AAA/C,4GAAA,gBAAgB,OAAA;AACzB,6CAAoD;AAA3C,wGAAA,cAAc,OAAA;AACvB,mEAAyE;AAAhE,6HAAA,wBAAwB,OAAA;AACjC,iDAAwD;AAA/C,4GAAA,gBAAgB,OAAA;AACzB,2DAAkE;AAAzD,sHAAA,qBAAqB,OAAA;AAC9B,mDAA0D;AAAjD,8GAAA,iBAAiB,OAAA;AAC1B,2CAAkD;AAAzC,sGAAA,aAAa,OAAA;AACtB,mEAAyE;AAAhE,6HAAA,wBAAwB,OAAA;AA4EjC,yCAAoD;AAA3C,4GAAA,kBAAkB,OAAA"}
@@ -0,0 +1,42 @@
1
+ import { OnflayClient, type OnflayClientOptions } from './client';
2
+ import { CheckoutSessionsResource } from './resources/checkout-sessions';
3
+ import { CustomersResource } from './resources/customers';
4
+ import { PaymentsResource } from './resources/payments';
5
+ import { PricesResource } from './resources/prices';
6
+ import { ProductsResource } from './resources/products';
7
+ import { SubscriptionsResource } from './resources/subscriptions';
8
+ import { UsageResource } from './resources/usage';
9
+ import { WebhookEndpointsResource } from './resources/webhook-endpoints';
10
+ /**
11
+ * Top-level entry point of the Onflay Node SDK.
12
+ *
13
+ * ```ts
14
+ * import { Onflay } from '@onflay/node';
15
+ *
16
+ * const onflay = new Onflay(process.env.ONFLAY_API_KEY!);
17
+ * const session = await onflay.checkoutSessions.create({...});
18
+ * ```
19
+ *
20
+ * The base URL is auto-derived from the API key prefix:
21
+ * - `sk_live_*` / `pk_live_*` → `https://api.onflay.com`
22
+ * - `sk_test_*` / `pk_test_*` → `https://sandbox-api.onflay.com`
23
+ * Override with `new Onflay(key, { baseUrl: '...' })` for self-hosted
24
+ * or staging deployments.
25
+ */
26
+ export declare class Onflay {
27
+ readonly client: OnflayClient;
28
+ readonly products: ProductsResource;
29
+ readonly prices: PricesResource;
30
+ readonly checkoutSessions: CheckoutSessionsResource;
31
+ readonly payments: PaymentsResource;
32
+ readonly subscriptions: SubscriptionsResource;
33
+ readonly customers: CustomersResource;
34
+ readonly usage: UsageResource;
35
+ readonly webhookEndpoints: WebhookEndpointsResource;
36
+ constructor(apiKey: string, options?: OnflayClientOptions);
37
+ /** `'sandbox'` when the configured API key targets the test plane. */
38
+ get environment(): 'production' | 'sandbox';
39
+ /** Resolved base URL for the configured key (or override). */
40
+ get baseUrl(): string;
41
+ }
42
+ //# sourceMappingURL=onflay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onflay.d.ts","sourceRoot":"","sources":["../src/onflay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,MAAM;IACjB,SAAgB,MAAM,EAAE,YAAY,CAAC;IACrC,SAAgB,QAAQ,EAAE,gBAAgB,CAAC;IAC3C,SAAgB,MAAM,EAAE,cAAc,CAAC;IACvC,SAAgB,gBAAgB,EAAE,wBAAwB,CAAC;IAC3D,SAAgB,QAAQ,EAAE,gBAAgB,CAAC;IAC3C,SAAgB,aAAa,EAAE,qBAAqB,CAAC;IACrD,SAAgB,SAAS,EAAE,iBAAiB,CAAC;IAC7C,SAAgB,KAAK,EAAE,aAAa,CAAC;IACrC,SAAgB,gBAAgB,EAAE,wBAAwB,CAAC;gBAE/C,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB;IAY7D,sEAAsE;IACtE,IAAI,WAAW,IAAI,YAAY,GAAG,SAAS,CAE1C;IAED,8DAA8D;IAC9D,IAAI,OAAO,IAAI,MAAM,CAEpB;CACF"}
package/dist/onflay.js ADDED
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Onflay = void 0;
4
+ const client_1 = require("./client");
5
+ const checkout_sessions_1 = require("./resources/checkout-sessions");
6
+ const customers_1 = require("./resources/customers");
7
+ const payments_1 = require("./resources/payments");
8
+ const prices_1 = require("./resources/prices");
9
+ const products_1 = require("./resources/products");
10
+ const subscriptions_1 = require("./resources/subscriptions");
11
+ const usage_1 = require("./resources/usage");
12
+ const webhook_endpoints_1 = require("./resources/webhook-endpoints");
13
+ /**
14
+ * Top-level entry point of the Onflay Node SDK.
15
+ *
16
+ * ```ts
17
+ * import { Onflay } from '@onflay/node';
18
+ *
19
+ * const onflay = new Onflay(process.env.ONFLAY_API_KEY!);
20
+ * const session = await onflay.checkoutSessions.create({...});
21
+ * ```
22
+ *
23
+ * The base URL is auto-derived from the API key prefix:
24
+ * - `sk_live_*` / `pk_live_*` → `https://api.onflay.com`
25
+ * - `sk_test_*` / `pk_test_*` → `https://sandbox-api.onflay.com`
26
+ * Override with `new Onflay(key, { baseUrl: '...' })` for self-hosted
27
+ * or staging deployments.
28
+ */
29
+ class Onflay {
30
+ client;
31
+ products;
32
+ prices;
33
+ checkoutSessions;
34
+ payments;
35
+ subscriptions;
36
+ customers;
37
+ usage;
38
+ webhookEndpoints;
39
+ constructor(apiKey, options = {}) {
40
+ this.client = new client_1.OnflayClient(apiKey, options);
41
+ this.products = new products_1.ProductsResource(this.client);
42
+ this.prices = new prices_1.PricesResource(this.client);
43
+ this.checkoutSessions = new checkout_sessions_1.CheckoutSessionsResource(this.client);
44
+ this.payments = new payments_1.PaymentsResource(this.client);
45
+ this.subscriptions = new subscriptions_1.SubscriptionsResource(this.client);
46
+ this.customers = new customers_1.CustomersResource(this.client);
47
+ this.usage = new usage_1.UsageResource(this.client);
48
+ this.webhookEndpoints = new webhook_endpoints_1.WebhookEndpointsResource(this.client);
49
+ }
50
+ /** `'sandbox'` when the configured API key targets the test plane. */
51
+ get environment() {
52
+ return this.client.environment;
53
+ }
54
+ /** Resolved base URL for the configured key (or override). */
55
+ get baseUrl() {
56
+ return this.client.baseUrl;
57
+ }
58
+ }
59
+ exports.Onflay = Onflay;
60
+ //# sourceMappingURL=onflay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onflay.js","sourceRoot":"","sources":["../src/onflay.ts"],"names":[],"mappings":";;;AAAA,qCAAkE;AAClE,qEAAyE;AACzE,qDAA0D;AAC1D,mDAAwD;AACxD,+CAAoD;AACpD,mDAAwD;AACxD,6DAAkE;AAClE,6CAAkD;AAClD,qEAAyE;AAEzE;;;;;;;;;;;;;;;GAeG;AACH,MAAa,MAAM;IACD,MAAM,CAAe;IACrB,QAAQ,CAAmB;IAC3B,MAAM,CAAiB;IACvB,gBAAgB,CAA2B;IAC3C,QAAQ,CAAmB;IAC3B,aAAa,CAAwB;IACrC,SAAS,CAAoB;IAC7B,KAAK,CAAgB;IACrB,gBAAgB,CAA2B;IAE3D,YAAY,MAAc,EAAE,UAA+B,EAAE;QAC3D,IAAI,CAAC,MAAM,GAAG,IAAI,qBAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAChD,IAAI,CAAC,QAAQ,GAAG,IAAI,2BAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClD,IAAI,CAAC,MAAM,GAAG,IAAI,uBAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC9C,IAAI,CAAC,gBAAgB,GAAG,IAAI,4CAAwB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClE,IAAI,CAAC,QAAQ,GAAG,IAAI,2BAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClD,IAAI,CAAC,aAAa,GAAG,IAAI,qCAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5D,IAAI,CAAC,SAAS,GAAG,IAAI,6BAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACpD,IAAI,CAAC,KAAK,GAAG,IAAI,qBAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC5C,IAAI,CAAC,gBAAgB,GAAG,IAAI,4CAAwB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpE,CAAC;IAED,sEAAsE;IACtE,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;IACjC,CAAC;IAED,8DAA8D;IAC9D,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;IAC7B,CAAC;CACF;AAhCD,wBAgCC"}
@@ -0,0 +1,19 @@
1
+ import type { OnflayClient } from './client';
2
+ import type { ListIterator } from './types/shared';
3
+ interface AutoPagingArgs<TItem, TParams extends object> {
4
+ client: OnflayClient;
5
+ path: string;
6
+ initialParams?: TParams;
7
+ /**
8
+ * Optional shape adapter for endpoints whose payload differs from the
9
+ * canonical `{ data, meta }` shape. Returns the items + nextCursor.
10
+ */
11
+ adapter?: (raw: unknown) => {
12
+ data: TItem[];
13
+ nextCursor: string | null;
14
+ };
15
+ }
16
+ /** Walks every page of a list endpoint as an async iterable. */
17
+ export declare function autoPaginate<TItem, TParams extends object>(args: AutoPagingArgs<TItem, TParams>): ListIterator<TItem>;
18
+ export {};
19
+ //# sourceMappingURL=pagination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,UAAU,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAiB,MAAM,gBAAgB,CAAC;AAElE,UAAU,cAAc,CAAC,KAAK,EAAE,OAAO,SAAS,MAAM;IACpD,MAAM,EAAE,YAAY,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK;QAAE,IAAI,EAAE,KAAK,EAAE,CAAC;QAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;CAC1E;AAED,gEAAgE;AAChE,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,SAAS,MAAM,EACxD,IAAI,EAAE,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,GACnC,YAAY,CAAC,KAAK,CAAC,CAuBrB"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.autoPaginate = autoPaginate;
4
+ /** Walks every page of a list endpoint as an async iterable. */
5
+ function autoPaginate(args) {
6
+ const { client, path, initialParams, adapter } = args;
7
+ return {
8
+ async *[Symbol.asyncIterator]() {
9
+ const initial = initialParams;
10
+ let cursor = initial?.cursor ?? null;
11
+ while (true) {
12
+ const params = { ...(initialParams ?? {}) };
13
+ if (cursor)
14
+ params.cursor = cursor;
15
+ const opts = { query: toQuery(params) };
16
+ const raw = await client.request('GET', path, opts);
17
+ const page = adapter ? adapter(raw) : normalize(raw);
18
+ for (const item of page.data)
19
+ yield item;
20
+ if (!page.nextCursor)
21
+ return;
22
+ cursor = page.nextCursor;
23
+ }
24
+ },
25
+ async toArray() {
26
+ const out = [];
27
+ for await (const item of this)
28
+ out.push(item);
29
+ return out;
30
+ },
31
+ };
32
+ }
33
+ function normalize(raw) {
34
+ if (Array.isArray(raw))
35
+ return { data: raw, nextCursor: null };
36
+ if (raw && typeof raw === 'object') {
37
+ const obj = raw;
38
+ const data = Array.isArray(obj.data)
39
+ ? obj.data
40
+ : Array.isArray(obj.items)
41
+ ? obj.items
42
+ : [];
43
+ const nextCursor = (typeof obj.nextCursor === 'string' && obj.nextCursor) ||
44
+ obj.meta?.nextCursor ||
45
+ null;
46
+ return { data, nextCursor };
47
+ }
48
+ return { data: [], nextCursor: null };
49
+ }
50
+ function toQuery(params) {
51
+ const out = {};
52
+ for (const [key, value] of Object.entries(params)) {
53
+ if (value === undefined || value === null)
54
+ continue;
55
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
56
+ out[key] = value;
57
+ }
58
+ }
59
+ return out;
60
+ }
61
+ //# sourceMappingURL=pagination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.js","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":";;AAeA,oCAyBC;AA1BD,gEAAgE;AAChE,SAAgB,YAAY,CAC1B,IAAoC;IAEpC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACtD,OAAO;QACL,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC;YAC3B,MAAM,OAAO,GAAG,aAAoD,CAAC;YACrE,IAAI,MAAM,GAAmB,OAAO,EAAE,MAA6B,IAAI,IAAI,CAAC;YAC5E,OAAO,IAAI,EAAE,CAAC;gBACZ,MAAM,MAAM,GAAG,EAAE,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,EAA6B,CAAC;gBACvE,IAAI,MAAM;oBAAE,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;gBACnC,MAAM,IAAI,GAAmB,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;gBACxD,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,OAAO,CAAU,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC7D,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAQ,GAAG,CAAC,CAAC;gBAC5D,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,IAAI;oBAAE,MAAM,IAAI,CAAC;gBACzC,IAAI,CAAC,IAAI,CAAC,UAAU;oBAAE,OAAO;gBAC7B,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC;YAC3B,CAAC;QACH,CAAC;QACD,KAAK,CAAC,OAAO;YACX,MAAM,GAAG,GAAY,EAAE,CAAC;YACxB,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,IAAI;gBAAE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC9C,OAAO,GAAG,CAAC;QACb,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAI,GAAY;IAChC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,GAAU,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IACtE,IAAI,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QACnC,MAAM,GAAG,GAAG,GAAyC,CAAC;QACtD,MAAM,IAAI,GAAQ,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;YACvC,CAAC,CAAC,GAAG,CAAC,IAAI;YACV,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC;gBACxB,CAAC,CAAC,GAAG,CAAC,KAAK;gBACX,CAAC,CAAC,EAAE,CAAC;QACT,MAAM,UAAU,GACd,CAAC,OAAO,GAAG,CAAC,UAAU,KAAK,QAAQ,IAAI,GAAG,CAAC,UAAU,CAAC;YACtD,GAAG,CAAC,IAAI,EAAE,UAAU;YACpB,IAAI,CAAC;QACP,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IAC9B,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;AACxC,CAAC;AAED,SAAS,OAAO,CACd,MAA+B;IAE/B,MAAM,GAAG,GAAiE,EAAE,CAAC;IAC7E,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;YAAE,SAAS;QACpD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;YACzF,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACnB,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { OnflayClient } from '../client';
2
+ import type { CreateCheckoutSessionParams, OnflayCheckoutSession } from '../types/checkout-sessions';
3
+ export declare class CheckoutSessionsResource {
4
+ private readonly client;
5
+ constructor(client: OnflayClient);
6
+ create(params: CreateCheckoutSessionParams, options?: {
7
+ idempotencyKey?: string;
8
+ }): Promise<OnflayCheckoutSession>;
9
+ retrieve(sessionId: string): Promise<OnflayCheckoutSession>;
10
+ }
11
+ //# sourceMappingURL=checkout-sessions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkout-sessions.d.ts","sourceRoot":"","sources":["../../src/resources/checkout-sessions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EACV,2BAA2B,EAC3B,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AAEpC,qBAAa,wBAAwB;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,YAAY;IAE3C,MAAM,CACV,MAAM,EAAE,2BAA2B,EACnC,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,GACpC,OAAO,CAAC,qBAAqB,CAAC;IAO3B,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAMlE"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CheckoutSessionsResource = void 0;
4
+ class CheckoutSessionsResource {
5
+ client;
6
+ constructor(client) {
7
+ this.client = client;
8
+ }
9
+ async create(params, options) {
10
+ return this.client.request('POST', '/v1/checkout-sessions', {
11
+ body: params,
12
+ ...(options?.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {}),
13
+ });
14
+ }
15
+ async retrieve(sessionId) {
16
+ return this.client.request('GET', `/v1/checkout-sessions/${encodeURIComponent(sessionId)}`);
17
+ }
18
+ }
19
+ exports.CheckoutSessionsResource = CheckoutSessionsResource;
20
+ //# sourceMappingURL=checkout-sessions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkout-sessions.js","sourceRoot":"","sources":["../../src/resources/checkout-sessions.ts"],"names":[],"mappings":";;;AAMA,MAAa,wBAAwB;IACN;IAA7B,YAA6B,MAAoB;QAApB,WAAM,GAAN,MAAM,CAAc;IAAG,CAAC;IAErD,KAAK,CAAC,MAAM,CACV,MAAmC,EACnC,OAAqC;QAErC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAwB,MAAM,EAAE,uBAAuB,EAAE;YACjF,IAAI,EAAE,MAAM;YACZ,GAAG,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC/E,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,SAAiB;QAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,KAAK,EACL,yBAAyB,kBAAkB,CAAC,SAAS,CAAC,EAAE,CACzD,CAAC;IACJ,CAAC;CACF;AAnBD,4DAmBC"}
@@ -0,0 +1,17 @@
1
+ import type { OnflayClient } from '../client';
2
+ import type { ListIterator, PaginatedList } from '../types/shared';
3
+ import type { CreateCustomerParams, ListCustomersParams, OnflayCustomer, UpdateCustomerParams } from '../types/customers';
4
+ export declare class CustomersResource {
5
+ private readonly client;
6
+ constructor(client: OnflayClient);
7
+ create(params: CreateCustomerParams, options?: {
8
+ idempotencyKey?: string;
9
+ }): Promise<OnflayCustomer>;
10
+ retrieve(customerId: string): Promise<OnflayCustomer>;
11
+ update(customerId: string, params: UpdateCustomerParams, options?: {
12
+ idempotencyKey?: string;
13
+ }): Promise<OnflayCustomer>;
14
+ list(params?: ListCustomersParams): Promise<PaginatedList<OnflayCustomer>>;
15
+ listAll(params?: Omit<ListCustomersParams, 'cursor'>): ListIterator<OnflayCustomer>;
16
+ }
17
+ //# sourceMappingURL=customers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customers.d.ts","sourceRoot":"","sources":["../../src/resources/customers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,oBAAoB,EACrB,MAAM,oBAAoB,CAAC;AAE5B,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,YAAY;IAE3C,MAAM,CACV,MAAM,EAAE,oBAAoB,EAC5B,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,GACpC,OAAO,CAAC,cAAc,CAAC;IAOpB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAOrD,MAAM,CACV,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,oBAAoB,EAC5B,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,GACpC,OAAO,CAAC,cAAc,CAAC;IAWpB,IAAI,CAAC,MAAM,GAAE,mBAAwB,GAAG,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;IAMpF,OAAO,CAAC,MAAM,GAAE,IAAI,CAAC,mBAAmB,EAAE,QAAQ,CAAM,GAAG,YAAY,CAAC,cAAc,CAAC;CAOxF"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomersResource = void 0;
4
+ const pagination_1 = require("../pagination");
5
+ class CustomersResource {
6
+ client;
7
+ constructor(client) {
8
+ this.client = client;
9
+ }
10
+ async create(params, options) {
11
+ return this.client.request('POST', '/v1/customers', {
12
+ body: params,
13
+ ...(options?.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {}),
14
+ });
15
+ }
16
+ async retrieve(customerId) {
17
+ return this.client.request('GET', `/v1/customers/${encodeURIComponent(customerId)}`);
18
+ }
19
+ async update(customerId, params, options) {
20
+ return this.client.request('PATCH', `/v1/customers/${encodeURIComponent(customerId)}`, {
21
+ body: params,
22
+ ...(options?.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {}),
23
+ });
24
+ }
25
+ async list(params = {}) {
26
+ return this.client.request('GET', '/v1/customers', {
27
+ query: params,
28
+ });
29
+ }
30
+ listAll(params = {}) {
31
+ return (0, pagination_1.autoPaginate)({
32
+ client: this.client,
33
+ path: '/v1/customers',
34
+ initialParams: params,
35
+ });
36
+ }
37
+ }
38
+ exports.CustomersResource = CustomersResource;
39
+ //# sourceMappingURL=customers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customers.js","sourceRoot":"","sources":["../../src/resources/customers.ts"],"names":[],"mappings":";;;AACA,8CAA6C;AAS7C,MAAa,iBAAiB;IACC;IAA7B,YAA6B,MAAoB;QAApB,WAAM,GAAN,MAAM,CAAc;IAAG,CAAC;IAErD,KAAK,CAAC,MAAM,CACV,MAA4B,EAC5B,OAAqC;QAErC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAiB,MAAM,EAAE,eAAe,EAAE;YAClE,IAAI,EAAE,MAAM;YACZ,GAAG,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC/E,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,UAAkB;QAC/B,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,KAAK,EACL,iBAAiB,kBAAkB,CAAC,UAAU,CAAC,EAAE,CAClD,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,MAAM,CACV,UAAkB,EAClB,MAA4B,EAC5B,OAAqC;QAErC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,OAAO,EACP,iBAAiB,kBAAkB,CAAC,UAAU,CAAC,EAAE,EACjD;YACE,IAAI,EAAE,MAAM;YACZ,GAAG,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC/E,CACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,SAA8B,EAAE;QACzC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAgC,KAAK,EAAE,eAAe,EAAE;YAChF,KAAK,EAAE,MAA+D;SACvE,CAAC,CAAC;IACL,CAAC;IAED,OAAO,CAAC,SAA8C,EAAE;QACtD,OAAO,IAAA,yBAAY,EAAsC;YACvD,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,eAAe;YACrB,aAAa,EAAE,MAAM;SACtB,CAAC,CAAC;IACL,CAAC;CACF;AAhDD,8CAgDC"}
@@ -0,0 +1,11 @@
1
+ import type { OnflayClient } from '../client';
2
+ import type { ListIterator, PaginatedList } from '../types/shared';
3
+ import type { ListPaymentsParams, OnflayPayment } from '../types/payments';
4
+ export declare class PaymentsResource {
5
+ private readonly client;
6
+ constructor(client: OnflayClient);
7
+ retrieve(paymentId: string): Promise<OnflayPayment>;
8
+ list(params?: ListPaymentsParams): Promise<PaginatedList<OnflayPayment>>;
9
+ listAll(params?: Omit<ListPaymentsParams, 'cursor'>): ListIterator<OnflayPayment>;
10
+ }
11
+ //# sourceMappingURL=payments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payments.d.ts","sourceRoot":"","sources":["../../src/resources/payments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE3E,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,YAAY;IAE3C,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAOnD,IAAI,CAAC,MAAM,GAAE,kBAAuB,GAAG,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;IAMlF,OAAO,CAAC,MAAM,GAAE,IAAI,CAAC,kBAAkB,EAAE,QAAQ,CAAM,GAAG,YAAY,CAAC,aAAa,CAAC;CAOtF"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PaymentsResource = void 0;
4
+ const pagination_1 = require("../pagination");
5
+ class PaymentsResource {
6
+ client;
7
+ constructor(client) {
8
+ this.client = client;
9
+ }
10
+ async retrieve(paymentId) {
11
+ return this.client.request('GET', `/v1/payments/${encodeURIComponent(paymentId)}`);
12
+ }
13
+ async list(params = {}) {
14
+ return this.client.request('GET', '/v1/payments', {
15
+ query: params,
16
+ });
17
+ }
18
+ listAll(params = {}) {
19
+ return (0, pagination_1.autoPaginate)({
20
+ client: this.client,
21
+ path: '/v1/payments',
22
+ initialParams: params,
23
+ });
24
+ }
25
+ }
26
+ exports.PaymentsResource = PaymentsResource;
27
+ //# sourceMappingURL=payments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payments.js","sourceRoot":"","sources":["../../src/resources/payments.ts"],"names":[],"mappings":";;;AACA,8CAA6C;AAI7C,MAAa,gBAAgB;IACE;IAA7B,YAA6B,MAAoB;QAApB,WAAM,GAAN,MAAM,CAAc;IAAG,CAAC;IAErD,KAAK,CAAC,QAAQ,CAAC,SAAiB;QAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,KAAK,EACL,gBAAgB,kBAAkB,CAAC,SAAS,CAAC,EAAE,CAChD,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,SAA6B,EAAE;QACxC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAA+B,KAAK,EAAE,cAAc,EAAE;YAC9E,KAAK,EAAE,MAA+D;SACvE,CAAC,CAAC;IACL,CAAC;IAED,OAAO,CAAC,SAA6C,EAAE;QACrD,OAAO,IAAA,yBAAY,EAAoC;YACrD,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,cAAc;YACpB,aAAa,EAAE,MAAM;SACtB,CAAC,CAAC;IACL,CAAC;CACF;AAvBD,4CAuBC"}
@@ -0,0 +1,24 @@
1
+ import type { OnflayClient } from '../client';
2
+ import type { ListIterator, PaginatedList } from '../types/shared';
3
+ import type { CreatePriceParams, ListPricesParams, OnflayPrice, UpdatePriceParams } from '../types/prices';
4
+ export declare class PricesResource {
5
+ private readonly client;
6
+ constructor(client: OnflayClient);
7
+ create(params: CreatePriceParams, options?: {
8
+ idempotencyKey?: string;
9
+ }): Promise<OnflayPrice>;
10
+ retrieve(priceId: string): Promise<OnflayPrice>;
11
+ /**
12
+ * Update a price. Note: only `active` and `metadata` are mutable. To
13
+ * change `unitAmountInCents`, `currency`, `recurring`, or tier
14
+ * configuration, create a fresh price and deactivate the old one
15
+ * (the documented immutable-price upgrade pattern that keeps
16
+ * existing subscribers grandfathered into their original price).
17
+ */
18
+ update(priceId: string, params: UpdatePriceParams, options?: {
19
+ idempotencyKey?: string;
20
+ }): Promise<OnflayPrice>;
21
+ list(params?: ListPricesParams): Promise<PaginatedList<OnflayPrice>>;
22
+ listAll(params?: Omit<ListPricesParams, 'cursor'>): ListIterator<OnflayPrice>;
23
+ }
24
+ //# sourceMappingURL=prices.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prices.d.ts","sourceRoot":"","sources":["../../src/resources/prices.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AAEzB,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,YAAY;IAE3C,MAAM,CAAC,MAAM,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAO9F,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAIrD;;;;;;OAMG;IACG,MAAM,CACV,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,iBAAiB,EACzB,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,GACpC,OAAO,CAAC,WAAW,CAAC;IAWjB,IAAI,CAAC,MAAM,GAAE,gBAAqB,GAAG,OAAO,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;IAM9E,OAAO,CAAC,MAAM,GAAE,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAM,GAAG,YAAY,CAAC,WAAW,CAAC;CAOlF"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PricesResource = void 0;
4
+ const pagination_1 = require("../pagination");
5
+ class PricesResource {
6
+ client;
7
+ constructor(client) {
8
+ this.client = client;
9
+ }
10
+ async create(params, options) {
11
+ return this.client.request('POST', '/v1/prices', {
12
+ body: params,
13
+ ...(options?.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {}),
14
+ });
15
+ }
16
+ async retrieve(priceId) {
17
+ return this.client.request('GET', `/v1/prices/${encodeURIComponent(priceId)}`);
18
+ }
19
+ /**
20
+ * Update a price. Note: only `active` and `metadata` are mutable. To
21
+ * change `unitAmountInCents`, `currency`, `recurring`, or tier
22
+ * configuration, create a fresh price and deactivate the old one
23
+ * (the documented immutable-price upgrade pattern that keeps
24
+ * existing subscribers grandfathered into their original price).
25
+ */
26
+ async update(priceId, params, options) {
27
+ return this.client.request('PATCH', `/v1/prices/${encodeURIComponent(priceId)}`, {
28
+ body: params,
29
+ ...(options?.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {}),
30
+ });
31
+ }
32
+ async list(params = {}) {
33
+ return this.client.request('GET', '/v1/prices', {
34
+ query: params,
35
+ });
36
+ }
37
+ listAll(params = {}) {
38
+ return (0, pagination_1.autoPaginate)({
39
+ client: this.client,
40
+ path: '/v1/prices',
41
+ initialParams: params,
42
+ });
43
+ }
44
+ }
45
+ exports.PricesResource = PricesResource;
46
+ //# sourceMappingURL=prices.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prices.js","sourceRoot":"","sources":["../../src/resources/prices.ts"],"names":[],"mappings":";;;AACA,8CAA6C;AAS7C,MAAa,cAAc;IACI;IAA7B,YAA6B,MAAoB;QAApB,WAAM,GAAN,MAAM,CAAc;IAAG,CAAC;IAErD,KAAK,CAAC,MAAM,CAAC,MAAyB,EAAE,OAAqC;QAC3E,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAc,MAAM,EAAE,YAAY,EAAE;YAC5D,IAAI,EAAE,MAAM;YACZ,GAAG,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC/E,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,OAAe;QAC5B,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAc,KAAK,EAAE,cAAc,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC9F,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,CACV,OAAe,EACf,MAAyB,EACzB,OAAqC;QAErC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,OAAO,EACP,cAAc,kBAAkB,CAAC,OAAO,CAAC,EAAE,EAC3C;YACE,IAAI,EAAE,MAAM;YACZ,GAAG,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC/E,CACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,SAA2B,EAAE;QACtC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAA6B,KAAK,EAAE,YAAY,EAAE;YAC1E,KAAK,EAAE,MAA+D;SACvE,CAAC,CAAC;IACL,CAAC;IAED,OAAO,CAAC,SAA2C,EAAE;QACnD,OAAO,IAAA,yBAAY,EAAgC;YACjD,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,YAAY;YAClB,aAAa,EAAE,MAAM;SACtB,CAAC,CAAC;IACL,CAAC;CACF;AAjDD,wCAiDC"}
@@ -0,0 +1,18 @@
1
+ import type { OnflayClient } from '../client';
2
+ import type { ListIterator, PaginatedList } from '../types/shared';
3
+ import type { CreateProductParams, ListProductsParams, OnflayProduct, UpdateProductParams } from '../types/products';
4
+ export declare class ProductsResource {
5
+ private readonly client;
6
+ constructor(client: OnflayClient);
7
+ create(params: CreateProductParams, options?: {
8
+ idempotencyKey?: string;
9
+ }): Promise<OnflayProduct>;
10
+ retrieve(productId: string): Promise<OnflayProduct>;
11
+ update(productId: string, params: UpdateProductParams, options?: {
12
+ idempotencyKey?: string;
13
+ }): Promise<OnflayProduct>;
14
+ list(params?: ListProductsParams): Promise<PaginatedList<OnflayProduct>>;
15
+ /** Walks every page lazily until the API reports `nextCursor === null`. */
16
+ listAll(params?: Omit<ListProductsParams, 'cursor'>): ListIterator<OnflayProduct>;
17
+ }
18
+ //# sourceMappingURL=products.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../../src/resources/products.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAE3B,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,YAAY;IAE3C,MAAM,CAAC,MAAM,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,aAAa,CAAC;IAOlG,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAInD,MAAM,CACV,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,mBAAmB,EAC3B,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,GACpC,OAAO,CAAC,aAAa,CAAC;IAWnB,IAAI,CAAC,MAAM,GAAE,kBAAuB,GAAG,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;IAMlF,2EAA2E;IAC3E,OAAO,CAAC,MAAM,GAAE,IAAI,CAAC,kBAAkB,EAAE,QAAQ,CAAM,GAAG,YAAY,CAAC,aAAa,CAAC;CAOtF"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProductsResource = void 0;
4
+ const pagination_1 = require("../pagination");
5
+ class ProductsResource {
6
+ client;
7
+ constructor(client) {
8
+ this.client = client;
9
+ }
10
+ async create(params, options) {
11
+ return this.client.request('POST', '/v1/products', {
12
+ body: params,
13
+ ...(options?.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {}),
14
+ });
15
+ }
16
+ async retrieve(productId) {
17
+ return this.client.request('GET', `/v1/products/${encodeURIComponent(productId)}`);
18
+ }
19
+ async update(productId, params, options) {
20
+ return this.client.request('PATCH', `/v1/products/${encodeURIComponent(productId)}`, {
21
+ body: params,
22
+ ...(options?.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {}),
23
+ });
24
+ }
25
+ async list(params = {}) {
26
+ return this.client.request('GET', '/v1/products', {
27
+ query: params,
28
+ });
29
+ }
30
+ /** Walks every page lazily until the API reports `nextCursor === null`. */
31
+ listAll(params = {}) {
32
+ return (0, pagination_1.autoPaginate)({
33
+ client: this.client,
34
+ path: '/v1/products',
35
+ initialParams: params,
36
+ });
37
+ }
38
+ }
39
+ exports.ProductsResource = ProductsResource;
40
+ //# sourceMappingURL=products.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"products.js","sourceRoot":"","sources":["../../src/resources/products.ts"],"names":[],"mappings":";;;AACA,8CAA6C;AAS7C,MAAa,gBAAgB;IACE;IAA7B,YAA6B,MAAoB;QAApB,WAAM,GAAN,MAAM,CAAc;IAAG,CAAC;IAErD,KAAK,CAAC,MAAM,CAAC,MAA2B,EAAE,OAAqC;QAC7E,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAgB,MAAM,EAAE,cAAc,EAAE;YAChE,IAAI,EAAE,MAAM;YACZ,GAAG,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC/E,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,SAAiB;QAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAgB,KAAK,EAAE,gBAAgB,kBAAkB,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACpG,CAAC;IAED,KAAK,CAAC,MAAM,CACV,SAAiB,EACjB,MAA2B,EAC3B,OAAqC;QAErC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,OAAO,EACP,gBAAgB,kBAAkB,CAAC,SAAS,CAAC,EAAE,EAC/C;YACE,IAAI,EAAE,MAAM;YACZ,GAAG,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC/E,CACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,SAA6B,EAAE;QACxC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAA+B,KAAK,EAAE,cAAc,EAAE;YAC9E,KAAK,EAAE,MAA+D;SACvE,CAAC,CAAC;IACL,CAAC;IAED,2EAA2E;IAC3E,OAAO,CAAC,SAA6C,EAAE;QACrD,OAAO,IAAA,yBAAY,EAAoC;YACrD,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,cAAc;YACpB,aAAa,EAAE,MAAM;SACtB,CAAC,CAAC;IACL,CAAC;CACF;AA3CD,4CA2CC"}
@@ -0,0 +1,39 @@
1
+ import type { OnflayClient } from '../client';
2
+ import type { ListIterator, PaginatedList } from '../types/shared';
3
+ import type { CancelSubscriptionParams, CreateSubscriptionParams, ListSubscriptionsParams, OnflaySubscription, UpdateSubscriptionParams } from '../types/subscriptions';
4
+ export declare class SubscriptionsResource {
5
+ private readonly client;
6
+ constructor(client: OnflayClient);
7
+ create(params: CreateSubscriptionParams, options?: {
8
+ idempotencyKey?: string;
9
+ }): Promise<OnflaySubscription>;
10
+ retrieve(subscriptionId: string): Promise<OnflaySubscription>;
11
+ /**
12
+ * Update a subscription's items, cancellation policy, or metadata.
13
+ *
14
+ * Proration semantics (see `prorationBehavior` on the params type):
15
+ * - `create_prorations` (default) — issue a prorated charge or
16
+ * credit immediately when items change. Best for upgrades.
17
+ * - `none` — switch to the new items at the next renewal with
18
+ * no immediate billing impact. Best for downgrades scheduled
19
+ * for end-of-period.
20
+ * - `always_invoice` — prorate AND invoice now (no preview step).
21
+ *
22
+ * The recommended upgrade flow when paired with the CLI catalog:
23
+ * 1. `prices.create({...new amount})` → fresh `priceId`
24
+ * 2. `prices.update(oldPriceId, { active: false })`
25
+ * 3. `subscriptions.update(subId, { items: [{ priceId: NEW }],
26
+ * prorationBehavior: 'create_prorations' })`
27
+ * which keeps existing subscribers grandfathered until they
28
+ * explicitly upgrade.
29
+ */
30
+ update(subscriptionId: string, params: UpdateSubscriptionParams, options?: {
31
+ idempotencyKey?: string;
32
+ }): Promise<OnflaySubscription>;
33
+ cancel(subscriptionId: string, params?: CancelSubscriptionParams, options?: {
34
+ idempotencyKey?: string;
35
+ }): Promise<OnflaySubscription>;
36
+ list(params?: ListSubscriptionsParams): Promise<PaginatedList<OnflaySubscription>>;
37
+ listAll(params?: Omit<ListSubscriptionsParams, 'cursor'>): ListIterator<OnflaySubscription>;
38
+ }
39
+ //# sourceMappingURL=subscriptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../../src/resources/subscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EACV,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,EAClB,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAEhC,qBAAa,qBAAqB;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,YAAY;IAE3C,MAAM,CACV,MAAM,EAAE,wBAAwB,EAChC,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,GACpC,OAAO,CAAC,kBAAkB,CAAC;IAOxB,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAOnE;;;;;;;;;;;;;;;;;;OAkBG;IACG,MAAM,CACV,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,wBAAwB,EAChC,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,GACpC,OAAO,CAAC,kBAAkB,CAAC;IAWxB,MAAM,CACV,cAAc,EAAE,MAAM,EACtB,MAAM,GAAE,wBAA6B,EACrC,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,GACpC,OAAO,CAAC,kBAAkB,CAAC;IAWxB,IAAI,CAAC,MAAM,GAAE,uBAA4B,GAAG,OAAO,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;IAQ5F,OAAO,CACL,MAAM,GAAE,IAAI,CAAC,uBAAuB,EAAE,QAAQ,CAAM,GACnD,YAAY,CAAC,kBAAkB,CAAC;CAOpC"}