@onflay/node 0.3.0 → 1.0.0-staging-20261206080029
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/CHANGELOG.md +74 -0
- package/README.md +211 -48
- package/dist/chunk-4RUPPDC2.mjs +121 -0
- package/dist/chunk-4RUPPDC2.mjs.map +1 -0
- package/dist/chunk-63KSRMJG.mjs +47 -0
- package/dist/chunk-63KSRMJG.mjs.map +1 -0
- package/dist/chunk-7LYAEZCT.mjs +197 -0
- package/dist/chunk-7LYAEZCT.mjs.map +1 -0
- package/dist/chunk-A3TRCKHK.mjs +60 -0
- package/dist/chunk-A3TRCKHK.mjs.map +1 -0
- package/dist/chunk-AFAU2FH2.js +47 -0
- package/dist/chunk-AFAU2FH2.js.map +1 -0
- package/dist/chunk-DBE2YZWE.mjs +38 -0
- package/dist/chunk-DBE2YZWE.mjs.map +1 -0
- package/dist/chunk-EOHFYWFQ.mjs +154 -0
- package/dist/chunk-EOHFYWFQ.mjs.map +1 -0
- package/dist/chunk-I2IVHBFA.js +197 -0
- package/dist/chunk-I2IVHBFA.js.map +1 -0
- package/dist/chunk-J4MYKTPN.mjs +37 -0
- package/dist/chunk-J4MYKTPN.mjs.map +1 -0
- package/dist/chunk-JQPANXLV.mjs +37 -0
- package/dist/chunk-JQPANXLV.mjs.map +1 -0
- package/dist/chunk-JXP6V2P2.mjs +1057 -0
- package/dist/chunk-JXP6V2P2.mjs.map +1 -0
- package/dist/chunk-M52GW7GQ.js +1057 -0
- package/dist/chunk-M52GW7GQ.js.map +1 -0
- package/dist/chunk-MMMUKAI6.js +37 -0
- package/dist/chunk-MMMUKAI6.js.map +1 -0
- package/dist/chunk-NSR4UQLV.js +87 -0
- package/dist/chunk-NSR4UQLV.js.map +1 -0
- package/dist/chunk-SUONZUVK.js +154 -0
- package/dist/chunk-SUONZUVK.js.map +1 -0
- package/dist/chunk-T26CPULH.js +121 -0
- package/dist/chunk-T26CPULH.js.map +1 -0
- package/dist/chunk-V2XJ4GZU.js +38 -0
- package/dist/chunk-V2XJ4GZU.js.map +1 -0
- package/dist/chunk-W6AEPYUG.js +37 -0
- package/dist/chunk-W6AEPYUG.js.map +1 -0
- package/dist/chunk-YHQ7XIC6.js +60 -0
- package/dist/chunk-YHQ7XIC6.js.map +1 -0
- package/dist/chunk-YSXUZYUY.mjs +87 -0
- package/dist/chunk-YSXUZYUY.mjs.map +1 -0
- package/dist/index-C1KFW_9r.d.mts +3989 -0
- package/dist/index-C1KFW_9r.d.ts +3989 -0
- package/dist/index.d.mts +918 -0
- package/dist/index.d.ts +918 -29
- package/dist/index.js +2990 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2991 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/config.d.mts +59 -0
- package/dist/lib/config.d.ts +59 -0
- package/dist/lib/config.js +15 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/config.mjs +15 -0
- package/dist/lib/config.mjs.map +1 -0
- package/dist/lib/http.d.mts +51 -0
- package/dist/lib/http.d.ts +51 -0
- package/dist/lib/http.js +13 -0
- package/dist/lib/http.js.map +1 -0
- package/dist/lib/http.mjs +13 -0
- package/dist/lib/http.mjs.map +1 -0
- package/dist/lib/retries.d.mts +41 -0
- package/dist/lib/retries.d.ts +41 -0
- package/dist/lib/retries.js +16 -0
- package/dist/lib/retries.js.map +1 -0
- package/dist/lib/retries.mjs +16 -0
- package/dist/lib/retries.mjs.map +1 -0
- package/dist/lib/sdks.d.mts +61 -0
- package/dist/lib/sdks.d.ts +61 -0
- package/dist/lib/sdks.js +12 -0
- package/dist/lib/sdks.js.map +1 -0
- package/dist/lib/sdks.mjs +12 -0
- package/dist/lib/sdks.mjs.map +1 -0
- package/dist/models/components/index.d.mts +1 -0
- package/dist/models/components/index.d.ts +1 -0
- package/dist/models/components/index.js +1 -0
- package/dist/models/components/index.js.map +1 -0
- package/dist/models/components/index.mjs +1 -0
- package/dist/models/components/index.mjs.map +1 -0
- package/dist/models/errors/index.d.mts +161 -0
- package/dist/models/errors/index.d.ts +161 -0
- package/dist/models/errors/index.js +29 -0
- package/dist/models/errors/index.js.map +1 -0
- package/dist/models/errors/index.mjs +29 -0
- package/dist/models/errors/index.mjs.map +1 -0
- package/dist/models/operations/index.d.mts +769 -0
- package/dist/models/operations/index.d.ts +769 -0
- package/dist/models/operations/index.js +1 -0
- package/dist/models/operations/index.js.map +1 -0
- package/dist/models/operations/index.mjs +1 -0
- package/dist/models/operations/index.mjs.map +1 -0
- package/dist/types/index.d.mts +26 -0
- package/dist/types/index.d.ts +26 -0
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/verify-tF2BsJK6.d.mts +325 -0
- package/dist/verify-tF2BsJK6.d.ts +325 -0
- package/dist/webhooks/express.d.mts +39 -0
- package/dist/webhooks/express.d.ts +39 -0
- package/dist/webhooks/express.js +10 -0
- package/dist/webhooks/express.js.map +1 -0
- package/dist/webhooks/express.mjs +10 -0
- package/dist/webhooks/express.mjs.map +1 -0
- package/dist/webhooks/hono.d.mts +33 -0
- package/dist/webhooks/hono.d.ts +33 -0
- package/dist/webhooks/hono.js +10 -0
- package/dist/webhooks/hono.js.map +1 -0
- package/dist/webhooks/hono.mjs +10 -0
- package/dist/webhooks/hono.mjs.map +1 -0
- package/dist/webhooks/index.d.mts +34 -0
- package/dist/webhooks/index.d.ts +34 -0
- package/dist/webhooks/index.js +75 -0
- package/dist/webhooks/index.js.map +1 -0
- package/dist/webhooks/index.mjs +75 -0
- package/dist/webhooks/index.mjs.map +1 -0
- package/dist/webhooks/next.d.mts +38 -0
- package/dist/webhooks/next.d.ts +38 -0
- package/dist/webhooks/next.js +10 -0
- package/dist/webhooks/next.js.map +1 -0
- package/dist/webhooks/next.mjs +10 -0
- package/dist/webhooks/next.mjs.map +1 -0
- package/package.json +273 -14
- package/dist/client.d.ts +0 -65
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -216
- package/dist/client.js.map +0 -1
- package/dist/errors.d.ts +0 -61
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -134
- package/dist/errors.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/onflay.d.ts +0 -44
- package/dist/onflay.d.ts.map +0 -1
- package/dist/onflay.js +0 -63
- package/dist/onflay.js.map +0 -1
- package/dist/pagination.d.ts +0 -19
- package/dist/pagination.d.ts.map +0 -1
- package/dist/pagination.js +0 -61
- package/dist/pagination.js.map +0 -1
- package/dist/resources/checkout-sessions.d.ts +0 -11
- package/dist/resources/checkout-sessions.d.ts.map +0 -1
- package/dist/resources/checkout-sessions.js +0 -20
- package/dist/resources/checkout-sessions.js.map +0 -1
- package/dist/resources/customers.d.ts +0 -17
- package/dist/resources/customers.d.ts.map +0 -1
- package/dist/resources/customers.js +0 -39
- package/dist/resources/customers.js.map +0 -1
- package/dist/resources/invoices.d.ts +0 -60
- package/dist/resources/invoices.d.ts.map +0 -1
- package/dist/resources/invoices.js +0 -69
- package/dist/resources/invoices.js.map +0 -1
- package/dist/resources/payments.d.ts +0 -11
- package/dist/resources/payments.d.ts.map +0 -1
- package/dist/resources/payments.js +0 -27
- package/dist/resources/payments.js.map +0 -1
- package/dist/resources/prices.d.ts +0 -24
- package/dist/resources/prices.d.ts.map +0 -1
- package/dist/resources/prices.js +0 -46
- package/dist/resources/prices.js.map +0 -1
- package/dist/resources/products.d.ts +0 -18
- package/dist/resources/products.d.ts.map +0 -1
- package/dist/resources/products.js +0 -40
- package/dist/resources/products.js.map +0 -1
- package/dist/resources/subscriptions.d.ts +0 -39
- package/dist/resources/subscriptions.d.ts.map +0 -1
- package/dist/resources/subscriptions.js +0 -62
- package/dist/resources/subscriptions.js.map +0 -1
- package/dist/resources/usage.d.ts +0 -26
- package/dist/resources/usage.d.ts.map +0 -1
- package/dist/resources/usage.js +0 -43
- package/dist/resources/usage.js.map +0 -1
- package/dist/resources/webhook-endpoints.d.ts +0 -20
- package/dist/resources/webhook-endpoints.d.ts.map +0 -1
- package/dist/resources/webhook-endpoints.js +0 -47
- package/dist/resources/webhook-endpoints.js.map +0 -1
- package/dist/types/checkout-sessions.d.ts +0 -67
- package/dist/types/checkout-sessions.d.ts.map +0 -1
- package/dist/types/checkout-sessions.js +0 -3
- package/dist/types/checkout-sessions.js.map +0 -1
- package/dist/types/customers.d.ts +0 -28
- package/dist/types/customers.d.ts.map +0 -1
- package/dist/types/customers.js +0 -3
- package/dist/types/customers.js.map +0 -1
- package/dist/types/events.d.ts +0 -118
- package/dist/types/events.d.ts.map +0 -1
- package/dist/types/events.js +0 -28
- package/dist/types/events.js.map +0 -1
- package/dist/types/invoices.d.ts +0 -65
- package/dist/types/invoices.d.ts.map +0 -1
- package/dist/types/invoices.js +0 -3
- package/dist/types/invoices.js.map +0 -1
- package/dist/types/payments.d.ts +0 -25
- package/dist/types/payments.d.ts.map +0 -1
- package/dist/types/payments.js +0 -3
- package/dist/types/payments.js.map +0 -1
- package/dist/types/prices.d.ts +0 -57
- package/dist/types/prices.d.ts.map +0 -1
- package/dist/types/prices.js +0 -3
- package/dist/types/prices.js.map +0 -1
- package/dist/types/products.d.ts +0 -29
- package/dist/types/products.d.ts.map +0 -1
- package/dist/types/products.js +0 -3
- package/dist/types/products.js.map +0 -1
- package/dist/types/shared.d.ts +0 -34
- package/dist/types/shared.d.ts.map +0 -1
- package/dist/types/shared.js +0 -4
- package/dist/types/shared.js.map +0 -1
- package/dist/types/subscriptions.d.ts +0 -85
- package/dist/types/subscriptions.d.ts.map +0 -1
- package/dist/types/subscriptions.js +0 -3
- package/dist/types/subscriptions.js.map +0 -1
- package/dist/types/usage.d.ts +0 -35
- package/dist/types/usage.d.ts.map +0 -1
- package/dist/types/usage.js +0 -3
- package/dist/types/usage.js.map +0 -1
- package/dist/types/webhook-endpoints.d.ts +0 -48
- package/dist/types/webhook-endpoints.d.ts.map +0 -1
- package/dist/types/webhook-endpoints.js +0 -3
- package/dist/types/webhook-endpoints.js.map +0 -1
- package/dist/version.d.ts +0 -4
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js +0 -7
- package/dist/version.js.map +0 -1
package/dist/pagination.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
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
|
package/dist/pagination.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,11 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,39 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type { OnflayClient } from '../client';
|
|
2
|
-
import type { CreateBillingInvoiceParams, ListBillingInvoicesParams, OnflayBillingInvoice, OnflayPaymentMethod, SetupIntentSession } from '../types/invoices';
|
|
3
|
-
interface ListInvoicesResponse {
|
|
4
|
-
data: OnflayBillingInvoice[];
|
|
5
|
-
total: number;
|
|
6
|
-
}
|
|
7
|
-
interface ListPaymentMethodsResponse {
|
|
8
|
-
data: OnflayPaymentMethod[];
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Usage-based billing invoices.
|
|
12
|
-
*
|
|
13
|
-
* For developer-pushed billing (your platform computes the amount):
|
|
14
|
-
* ```ts
|
|
15
|
-
* const invoice = await onflay.invoices.create({
|
|
16
|
-
* customerId: 'cust_...',
|
|
17
|
-
* currency: 'usd',
|
|
18
|
-
* lineItems: [{ description: 'API calls — June 2026', amountInCents: 4900 }],
|
|
19
|
-
* });
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* For collecting a card (required before the first automatic charge):
|
|
23
|
-
* ```ts
|
|
24
|
-
* const session = await onflay.invoices.createSetupIntent('cust_...', {
|
|
25
|
-
* returnUrl: 'https://your-app.com/billing/success',
|
|
26
|
-
* });
|
|
27
|
-
* // Redirect or embed: session.hostedUrl
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export declare class InvoicesResource {
|
|
31
|
-
private readonly client;
|
|
32
|
-
constructor(client: OnflayClient);
|
|
33
|
-
/**
|
|
34
|
-
* Create and immediately charge a billing invoice.
|
|
35
|
-
* The customer must have a saved payment method set as default (see
|
|
36
|
-
* `createSetupIntent`). Onflay creates the Stripe invoice, finalizes it,
|
|
37
|
-
* and returns the persisted record.
|
|
38
|
-
*/
|
|
39
|
-
create(params: CreateBillingInvoiceParams, options?: {
|
|
40
|
-
idempotencyKey?: string;
|
|
41
|
-
}): Promise<OnflayBillingInvoice>;
|
|
42
|
-
retrieve(invoiceId: string): Promise<OnflayBillingInvoice>;
|
|
43
|
-
list(params?: ListBillingInvoicesParams): Promise<ListInvoicesResponse>;
|
|
44
|
-
/**
|
|
45
|
-
* Create a SetupIntent to collect a payment method for a customer.
|
|
46
|
-
*
|
|
47
|
-
* Returns a `hostedUrl` (redirect the customer there to enter their card)
|
|
48
|
-
* and a `clientSecret` (use this if you want to embed Stripe Elements yourself).
|
|
49
|
-
*
|
|
50
|
-
* The card is automatically set as the default payment method after the customer
|
|
51
|
-
* completes the form, enabling automatic charging on future invoices.
|
|
52
|
-
*/
|
|
53
|
-
createSetupIntent(customerId: string, params?: {
|
|
54
|
-
returnUrl?: string;
|
|
55
|
-
idempotencyKey?: string;
|
|
56
|
-
}): Promise<SetupIntentSession>;
|
|
57
|
-
listPaymentMethods(customerId: string): Promise<ListPaymentMethodsResponse>;
|
|
58
|
-
}
|
|
59
|
-
export {};
|
|
60
|
-
//# sourceMappingURL=invoices.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"invoices.d.ts","sourceRoot":"","sources":["../../src/resources/invoices.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EACV,0BAA0B,EAC1B,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAE3B,UAAU,oBAAoB;IAC5B,IAAI,EAAE,oBAAoB,EAAE,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,0BAA0B;IAClC,IAAI,EAAE,mBAAmB,EAAE,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,YAAY;IAEjD;;;;;OAKG;IACG,MAAM,CACV,MAAM,EAAE,0BAA0B,EAClC,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,GACpC,OAAO,CAAC,oBAAoB,CAAC;IAO1B,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAO1D,IAAI,CAAC,MAAM,GAAE,yBAA8B,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAMjF;;;;;;;;OAQG;IACG,iBAAiB,CACrB,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,GACvD,OAAO,CAAC,kBAAkB,CAAC;IAWxB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC;CAMlF"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InvoicesResource = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Usage-based billing invoices.
|
|
6
|
-
*
|
|
7
|
-
* For developer-pushed billing (your platform computes the amount):
|
|
8
|
-
* ```ts
|
|
9
|
-
* const invoice = await onflay.invoices.create({
|
|
10
|
-
* customerId: 'cust_...',
|
|
11
|
-
* currency: 'usd',
|
|
12
|
-
* lineItems: [{ description: 'API calls — June 2026', amountInCents: 4900 }],
|
|
13
|
-
* });
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* For collecting a card (required before the first automatic charge):
|
|
17
|
-
* ```ts
|
|
18
|
-
* const session = await onflay.invoices.createSetupIntent('cust_...', {
|
|
19
|
-
* returnUrl: 'https://your-app.com/billing/success',
|
|
20
|
-
* });
|
|
21
|
-
* // Redirect or embed: session.hostedUrl
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
class InvoicesResource {
|
|
25
|
-
client;
|
|
26
|
-
constructor(client) {
|
|
27
|
-
this.client = client;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Create and immediately charge a billing invoice.
|
|
31
|
-
* The customer must have a saved payment method set as default (see
|
|
32
|
-
* `createSetupIntent`). Onflay creates the Stripe invoice, finalizes it,
|
|
33
|
-
* and returns the persisted record.
|
|
34
|
-
*/
|
|
35
|
-
async create(params, options) {
|
|
36
|
-
return this.client.request('POST', '/v1/invoices', {
|
|
37
|
-
body: params,
|
|
38
|
-
...(options?.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {}),
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
async retrieve(invoiceId) {
|
|
42
|
-
return this.client.request('GET', `/v1/invoices/${encodeURIComponent(invoiceId)}`);
|
|
43
|
-
}
|
|
44
|
-
async list(params = {}) {
|
|
45
|
-
return this.client.request('GET', '/v1/invoices', {
|
|
46
|
-
query: params,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Create a SetupIntent to collect a payment method for a customer.
|
|
51
|
-
*
|
|
52
|
-
* Returns a `hostedUrl` (redirect the customer there to enter their card)
|
|
53
|
-
* and a `clientSecret` (use this if you want to embed Stripe Elements yourself).
|
|
54
|
-
*
|
|
55
|
-
* The card is automatically set as the default payment method after the customer
|
|
56
|
-
* completes the form, enabling automatic charging on future invoices.
|
|
57
|
-
*/
|
|
58
|
-
async createSetupIntent(customerId, params) {
|
|
59
|
-
return this.client.request('POST', `/v1/customers/${encodeURIComponent(customerId)}/setup-intent`, {
|
|
60
|
-
body: params?.returnUrl ? { returnUrl: params.returnUrl } : {},
|
|
61
|
-
...(params?.idempotencyKey ? { idempotencyKey: params.idempotencyKey } : {}),
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
async listPaymentMethods(customerId) {
|
|
65
|
-
return this.client.request('GET', `/v1/customers/${encodeURIComponent(customerId)}/payment-methods`);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.InvoicesResource = InvoicesResource;
|
|
69
|
-
//# sourceMappingURL=invoices.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"invoices.js","sourceRoot":"","sources":["../../src/resources/invoices.ts"],"names":[],"mappings":";;;AAkBA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAa,gBAAgB;IACE;IAA7B,YAA6B,MAAoB;QAApB,WAAM,GAAN,MAAM,CAAc;IAAG,CAAC;IAErD;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CACV,MAAkC,EAClC,OAAqC;QAErC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAuB,MAAM,EAAE,cAAc,EAAE;YACvE,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,gBAAgB,kBAAkB,CAAC,SAAS,CAAC,EAAE,CAChD,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,SAAoC,EAAE;QAC/C,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAuB,KAAK,EAAE,cAAc,EAAE;YACtE,KAAK,EAAE,MAAqD;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,iBAAiB,CACrB,UAAkB,EAClB,MAAwD;QAExD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,MAAM,EACN,iBAAiB,kBAAkB,CAAC,UAAU,CAAC,eAAe,EAC9D;YACE,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE;YAC9D,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC7E,CACF,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,UAAkB;QACzC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,KAAK,EACL,iBAAiB,kBAAkB,CAAC,UAAU,CAAC,kBAAkB,CAClE,CAAC;IACJ,CAAC;CACF;AA7DD,4CA6DC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/resources/prices.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,18 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,40 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,39 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SubscriptionsResource = void 0;
|
|
4
|
-
const pagination_1 = require("../pagination");
|
|
5
|
-
class SubscriptionsResource {
|
|
6
|
-
client;
|
|
7
|
-
constructor(client) {
|
|
8
|
-
this.client = client;
|
|
9
|
-
}
|
|
10
|
-
async create(params, options) {
|
|
11
|
-
return this.client.request('POST', '/v1/subscriptions', {
|
|
12
|
-
body: params,
|
|
13
|
-
...(options?.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {}),
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
async retrieve(subscriptionId) {
|
|
17
|
-
return this.client.request('GET', `/v1/subscriptions/${encodeURIComponent(subscriptionId)}`);
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Update a subscription's items, cancellation policy, or metadata.
|
|
21
|
-
*
|
|
22
|
-
* Proration semantics (see `prorationBehavior` on the params type):
|
|
23
|
-
* - `create_prorations` (default) — issue a prorated charge or
|
|
24
|
-
* credit immediately when items change. Best for upgrades.
|
|
25
|
-
* - `none` — switch to the new items at the next renewal with
|
|
26
|
-
* no immediate billing impact. Best for downgrades scheduled
|
|
27
|
-
* for end-of-period.
|
|
28
|
-
* - `always_invoice` — prorate AND invoice now (no preview step).
|
|
29
|
-
*
|
|
30
|
-
* The recommended upgrade flow when paired with the CLI catalog:
|
|
31
|
-
* 1. `prices.create({...new amount})` → fresh `priceId`
|
|
32
|
-
* 2. `prices.update(oldPriceId, { active: false })`
|
|
33
|
-
* 3. `subscriptions.update(subId, { items: [{ priceId: NEW }],
|
|
34
|
-
* prorationBehavior: 'create_prorations' })`
|
|
35
|
-
* which keeps existing subscribers grandfathered until they
|
|
36
|
-
* explicitly upgrade.
|
|
37
|
-
*/
|
|
38
|
-
async update(subscriptionId, params, options) {
|
|
39
|
-
return this.client.request('PATCH', `/v1/subscriptions/${encodeURIComponent(subscriptionId)}`, {
|
|
40
|
-
body: params,
|
|
41
|
-
...(options?.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {}),
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
async cancel(subscriptionId, params = {}, options) {
|
|
45
|
-
return this.client.request('POST', `/v1/subscriptions/${encodeURIComponent(subscriptionId)}/cancel`, {
|
|
46
|
-
body: params,
|
|
47
|
-
...(options?.idempotencyKey ? { idempotencyKey: options.idempotencyKey } : {}),
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
async list(params = {}) {
|
|
51
|
-
return this.client.request('GET', '/v1/subscriptions', { query: params });
|
|
52
|
-
}
|
|
53
|
-
listAll(params = {}) {
|
|
54
|
-
return (0, pagination_1.autoPaginate)({
|
|
55
|
-
client: this.client,
|
|
56
|
-
path: '/v1/subscriptions',
|
|
57
|
-
initialParams: params,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
exports.SubscriptionsResource = SubscriptionsResource;
|
|
62
|
-
//# sourceMappingURL=subscriptions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../src/resources/subscriptions.ts"],"names":[],"mappings":";;;AACA,8CAA6C;AAU7C,MAAa,qBAAqB;IACH;IAA7B,YAA6B,MAAoB;QAApB,WAAM,GAAN,MAAM,CAAc;IAAG,CAAC;IAErD,KAAK,CAAC,MAAM,CACV,MAAgC,EAChC,OAAqC;QAErC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAqB,MAAM,EAAE,mBAAmB,EAAE;YAC1E,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,cAAsB;QACnC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,KAAK,EACL,qBAAqB,kBAAkB,CAAC,cAAc,CAAC,EAAE,CAC1D,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,MAAM,CACV,cAAsB,EACtB,MAAgC,EAChC,OAAqC;QAErC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,OAAO,EACP,qBAAqB,kBAAkB,CAAC,cAAc,CAAC,EAAE,EACzD;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,MAAM,CACV,cAAsB,EACtB,SAAmC,EAAE,EACrC,OAAqC;QAErC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,MAAM,EACN,qBAAqB,kBAAkB,CAAC,cAAc,CAAC,SAAS,EAChE;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,SAAkC,EAAE;QAC7C,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,KAAK,EACL,mBAAmB,EACnB,EAAE,KAAK,EAAE,MAA+D,EAAE,CAC3E,CAAC;IACJ,CAAC;IAED,OAAO,CACL,SAAkD,EAAE;QAEpD,OAAO,IAAA,yBAAY,EAA8C;YAC/D,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,IAAI,EAAE,mBAAmB;YACzB,aAAa,EAAE,MAAM;SACtB,CAAC,CAAC;IACL,CAAC;CACF;AAtFD,sDAsFC"}
|