cliodot 1.2.3 → 1.2.4
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/LICENSE +201 -0
- package/README.md +2 -0
- package/dist/AuthAppClient.d.ts +1 -0
- package/dist/AuthAppClient.d.ts.map +1 -1
- package/dist/AuthAppClient.js +199 -1
- package/dist/CommercialAppClient.d.ts +50 -9
- package/dist/CommercialAppClient.d.ts.map +1 -1
- package/dist/CommercialAppClient.js +576 -1
- package/dist/ConnectorBuilder.js +104 -1
- package/dist/Events.d.ts +2 -0
- package/dist/Events.d.ts.map +1 -1
- package/dist/Events.js +325 -1
- package/dist/Flosync.js +296 -1
- package/dist/FlosyncClient.js +429 -1
- package/dist/FunctionBuilder.js +65 -1
- package/dist/IdentityAppClient.d.ts +1 -0
- package/dist/IdentityAppClient.d.ts.map +1 -1
- package/dist/IdentityAppClient.js +197 -1
- package/dist/MemoryAppClient.d.ts +1 -0
- package/dist/MemoryAppClient.d.ts.map +1 -1
- package/dist/MemoryAppClient.js +149 -1
- package/dist/MemoryClient.js +20 -1
- package/dist/OAuthAppClient.d.ts +1 -0
- package/dist/OAuthAppClient.d.ts.map +1 -1
- package/dist/OAuthAppClient.js +269 -1
- package/dist/ProviderServicesClient.d.ts +24 -0
- package/dist/ProviderServicesClient.d.ts.map +1 -0
- package/dist/ProviderServicesClient.js +158 -0
- package/dist/Surface.d.ts +2 -0
- package/dist/Surface.d.ts.map +1 -1
- package/dist/Surface.js +255 -1
- package/dist/ValidatorBuilder.js +24 -1
- package/dist/Webhooks.js +61 -1
- package/dist/WorkflowBuilder.js +279 -1
- package/dist/__tests__/CommercialAppClient.test.d.ts +2 -0
- package/dist/__tests__/CommercialAppClient.test.d.ts.map +1 -0
- package/dist/__tests__/CommercialAppClient.test.js +217 -0
- package/dist/__tests__/Events.test.js +191 -1
- package/dist/__tests__/IdentityAppClient.test.js +232 -1
- package/dist/__tests__/OAuthAppClient.test.js +300 -1
- package/dist/__tests__/ProviderServicesClient.test.d.ts +2 -0
- package/dist/__tests__/ProviderServicesClient.test.d.ts.map +1 -0
- package/dist/__tests__/ProviderServicesClient.test.js +131 -0
- package/dist/__tests__/Surface.test.js +150 -1
- package/dist/__tests__/errors.test.js +54 -1
- package/dist/__tests__/function.test.js +58 -1
- package/dist/__tests__/helpers.d.ts +5 -0
- package/dist/__tests__/helpers.d.ts.map +1 -0
- package/dist/__tests__/helpers.js +10 -0
- package/dist/__tests__/localhost-lookup.test.d.ts +2 -0
- package/dist/__tests__/localhost-lookup.test.d.ts.map +1 -0
- package/dist/__tests__/localhost-lookup.test.js +26 -0
- package/dist/__tests__/parse-api-error.test.js +26 -1
- package/dist/__tests__/runner.test.js +156 -1
- package/dist/connectors/builtin.js +354 -1
- package/dist/connectors/registry.js +300 -1
- package/dist/decorators/build.js +105 -1
- package/dist/decorators/connector.js +56 -1
- package/dist/decorators/index.js +34 -1
- package/dist/decorators/metadata.js +338 -1
- package/dist/decorators/steps.js +220 -1
- package/dist/decorators/workflow.js +52 -1
- package/dist/errors.js +76 -1
- package/dist/http/__tests__/cliodot-request.environment.test.d.ts +2 -0
- package/dist/http/__tests__/cliodot-request.environment.test.d.ts.map +1 -0
- package/dist/http/__tests__/cliodot-request.environment.test.js +37 -0
- package/dist/http/__tests__/cliodot-result.test.d.ts +2 -0
- package/dist/http/__tests__/cliodot-result.test.d.ts.map +1 -0
- package/dist/http/__tests__/cliodot-result.test.js +57 -0
- package/dist/http/__tests__/events-instance-id.test.d.ts +2 -0
- package/dist/http/__tests__/events-instance-id.test.d.ts.map +1 -0
- package/dist/http/__tests__/events-instance-id.test.js +45 -0
- package/dist/http/cliodot-request.d.ts +35 -0
- package/dist/http/cliodot-request.d.ts.map +1 -0
- package/dist/http/cliodot-request.js +105 -0
- package/dist/http/cliodot-result.d.ts +40 -0
- package/dist/http/cliodot-result.d.ts.map +1 -0
- package/dist/http/cliodot-result.js +139 -0
- package/dist/http/create-client.d.ts +3 -0
- package/dist/http/create-client.d.ts.map +1 -0
- package/dist/http/create-client.js +14 -0
- package/dist/http/events-instance-id.d.ts +11 -0
- package/dist/http/events-instance-id.d.ts.map +1 -0
- package/dist/http/events-instance-id.js +86 -0
- package/dist/http/localhost-lookup.d.ts +12 -0
- package/dist/http/localhost-lookup.d.ts.map +1 -0
- package/dist/http/localhost-lookup.js +67 -0
- package/dist/http/parse-api-error.js +56 -1
- package/dist/http/sanitize-execution-headers.js +79 -1
- package/dist/identity-offline-verify.js +174 -1
- package/dist/identity-token-cache.js +51 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +108 -1
- package/dist/runner/ProcessorEngine.js +1311 -1
- package/dist/runner/connector.executor.js +1786 -1
- package/dist/runner/utilities/math.executor.js +153 -1
- package/dist/runner/utilities/random.executor.js +151 -1
- package/dist/runner/utilities/string.executor.js +825 -1
- package/dist/template.js +127 -1
- package/dist/transformers/StepsToNodesTransformer.js +214 -1
- package/dist/transformers/WorkflowTransformer.js +189 -1
- package/dist/types/auth-app.api.d.ts +2 -0
- package/dist/types/auth-app.api.d.ts.map +1 -1
- package/dist/types/auth-app.api.js +2 -1
- package/dist/types/builtin.js +2 -1
- package/dist/types/client.api.js +2 -1
- package/dist/types/commercial-app.api.d.ts +407 -11
- package/dist/types/commercial-app.api.d.ts.map +1 -1
- package/dist/types/commercial-app.api.js +2 -1
- package/dist/types/connector.js +2 -1
- package/dist/types/context.js +2 -1
- package/dist/types/event-app.api.d.ts +8 -0
- package/dist/types/event-app.api.d.ts.map +1 -1
- package/dist/types/event-app.api.js +2 -1
- package/dist/types/function.js +2 -1
- package/dist/types/identity-app.api.d.ts +2 -0
- package/dist/types/identity-app.api.d.ts.map +1 -1
- package/dist/types/identity-app.api.js +2 -1
- package/dist/types/index.js +23 -1
- package/dist/types/memory-app.api.d.ts +2 -0
- package/dist/types/memory-app.api.d.ts.map +1 -1
- package/dist/types/memory-app.api.js +2 -1
- package/dist/types/oauth-app.api.d.ts +2 -0
- package/dist/types/oauth-app.api.d.ts.map +1 -1
- package/dist/types/oauth-app.api.js +105 -1
- package/dist/types/provider-services.api.d.ts +98 -0
- package/dist/types/provider-services.api.d.ts.map +1 -0
- package/dist/types/provider-services.api.js +2 -0
- package/dist/types/validator.js +2 -1
- package/dist/types/webhook-app.api.js +2 -1
- package/dist/types/workflow.js +33 -1
- package/dist/validators/validators.js +478 -1
- package/dist/variable.js +37 -1
- package/package.json +3 -2
package/dist/types/builtin.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/types/client.api.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -5,6 +5,8 @@ export type CommercialAppClientConfig = {
|
|
|
5
5
|
appApiKey?: string;
|
|
6
6
|
appSecret?: string;
|
|
7
7
|
debug?: boolean;
|
|
8
|
+
/** Pin project env bag for connector auth templates. Omit to follow the project switch. */
|
|
9
|
+
environment?: "dev" | "prod" | "development" | "production";
|
|
8
10
|
};
|
|
9
11
|
export type CommercialPaginationMeta = {
|
|
10
12
|
totalDocs: number;
|
|
@@ -39,6 +41,10 @@ export type CommercialCustomer = {
|
|
|
39
41
|
line1?: string;
|
|
40
42
|
postal_code?: string;
|
|
41
43
|
};
|
|
44
|
+
credit_balances?: Array<{
|
|
45
|
+
currency: string;
|
|
46
|
+
amount: number;
|
|
47
|
+
}>;
|
|
42
48
|
metadata?: Record<string, unknown>;
|
|
43
49
|
createdAt?: string | Date;
|
|
44
50
|
updatedAt?: string | Date;
|
|
@@ -76,6 +82,11 @@ export type CommercialPlanEntitlement = {
|
|
|
76
82
|
feature_key: string;
|
|
77
83
|
enabled: boolean;
|
|
78
84
|
limit: number | null;
|
|
85
|
+
unit_prices?: CommercialPrice[];
|
|
86
|
+
topup_packs?: Array<{
|
|
87
|
+
units: number;
|
|
88
|
+
prices: CommercialPrice[];
|
|
89
|
+
}>;
|
|
79
90
|
};
|
|
80
91
|
export type CommercialPrice = {
|
|
81
92
|
currency: string;
|
|
@@ -100,6 +111,10 @@ export type CommercialPlan = {
|
|
|
100
111
|
entitlements: CommercialPlanEntitlement[];
|
|
101
112
|
trial_days?: number;
|
|
102
113
|
allowed_addon_keys?: string[];
|
|
114
|
+
billing_mode?: "recurring" | "payg" | "hybrid" | string;
|
|
115
|
+
payg_overage_policy?: "deny" | "accrue" | "immediate_topup" | "accrue_and_topup" | string;
|
|
116
|
+
payg_charge_threshold_amount?: number;
|
|
117
|
+
payg_hard_cap_amount?: number;
|
|
103
118
|
metadata?: Record<string, unknown>;
|
|
104
119
|
};
|
|
105
120
|
export type CommercialSubscription = {
|
|
@@ -130,6 +145,47 @@ export type CommercialSubscription = {
|
|
|
130
145
|
}>;
|
|
131
146
|
seats_purchased?: number;
|
|
132
147
|
price_metadata?: Record<string, unknown>;
|
|
148
|
+
pricing?: {
|
|
149
|
+
currency: string;
|
|
150
|
+
plan_amount: number;
|
|
151
|
+
addon_total: number;
|
|
152
|
+
seat_total: number;
|
|
153
|
+
subtotal: number;
|
|
154
|
+
discount_total: number;
|
|
155
|
+
tax_total: number;
|
|
156
|
+
total: number;
|
|
157
|
+
line_items: Array<{
|
|
158
|
+
kind: string;
|
|
159
|
+
description: string;
|
|
160
|
+
quantity: number;
|
|
161
|
+
unit_amount: number;
|
|
162
|
+
amount: number;
|
|
163
|
+
currency: string;
|
|
164
|
+
metadata?: Record<string, unknown>;
|
|
165
|
+
}>;
|
|
166
|
+
};
|
|
167
|
+
auto_renew?: boolean;
|
|
168
|
+
renewal_mode?: "platform" | "provider";
|
|
169
|
+
skip_trial?: boolean;
|
|
170
|
+
usage_rollover?: "none" | "carry_unused";
|
|
171
|
+
pending_plan_change?: Record<string, unknown> | null;
|
|
172
|
+
usage_rollover_credits?: Record<string, number>;
|
|
173
|
+
billing_mode?: "recurring" | "payg" | "hybrid" | string;
|
|
174
|
+
payg_overage_policy?: "deny" | "accrue" | "immediate_topup" | "accrue_and_topup" | string;
|
|
175
|
+
payg_charge_threshold_amount?: number;
|
|
176
|
+
payg_hard_cap_amount?: number;
|
|
177
|
+
unbilled_usage?: {
|
|
178
|
+
currency: string;
|
|
179
|
+
amount: number;
|
|
180
|
+
units_by_feature?: Record<string, number>;
|
|
181
|
+
amounts_by_feature?: Record<string, number>;
|
|
182
|
+
since?: string | Date;
|
|
183
|
+
};
|
|
184
|
+
payg_charge_status?: "idle" | "processing" | "failed" | string;
|
|
185
|
+
payg_pack_credits?: Record<string, number>;
|
|
186
|
+
pending_topup_invoice_id?: string;
|
|
187
|
+
payment_method_key?: string;
|
|
188
|
+
payment_card_id?: string;
|
|
133
189
|
trial_starts_at?: string | Date | null;
|
|
134
190
|
trial_ends_at?: string | Date | null;
|
|
135
191
|
starts_at?: string | Date | null;
|
|
@@ -176,6 +232,40 @@ export type CommercialCheckResult = {
|
|
|
176
232
|
assigned: number;
|
|
177
233
|
available: number;
|
|
178
234
|
};
|
|
235
|
+
topup_packs?: Array<{
|
|
236
|
+
units: number;
|
|
237
|
+
prices: CommercialPrice[];
|
|
238
|
+
}>;
|
|
239
|
+
pending_topup_invoice_id?: string;
|
|
240
|
+
unbilled?: {
|
|
241
|
+
currency: string;
|
|
242
|
+
amount: number;
|
|
243
|
+
units_by_feature?: Record<string, number>;
|
|
244
|
+
amounts_by_feature?: Record<string, number>;
|
|
245
|
+
};
|
|
246
|
+
payg?: {
|
|
247
|
+
billing_mode: string;
|
|
248
|
+
overage_policy: string;
|
|
249
|
+
charge_status: string;
|
|
250
|
+
};
|
|
251
|
+
breakdown?: CommercialConsumeBreakdown;
|
|
252
|
+
};
|
|
253
|
+
export type CommercialConsumeBreakdown = {
|
|
254
|
+
feature_key: string;
|
|
255
|
+
quantity: number;
|
|
256
|
+
currency?: string;
|
|
257
|
+
unit_amount?: number | null;
|
|
258
|
+
cost: number;
|
|
259
|
+
plan_quantity: number;
|
|
260
|
+
pack_quantity: number;
|
|
261
|
+
overage_quantity: number;
|
|
262
|
+
credited_amount: number;
|
|
263
|
+
accrued_amount: number;
|
|
264
|
+
credited_quantity?: number;
|
|
265
|
+
accrued_quantity?: number;
|
|
266
|
+
unbilled_after?: number;
|
|
267
|
+
credit_balance_after?: number;
|
|
268
|
+
summary: string;
|
|
179
269
|
};
|
|
180
270
|
export type CommercialConsumeInput = CommercialCheckInput;
|
|
181
271
|
export type CommercialConsumeResult = CommercialCheckResult & {
|
|
@@ -212,8 +302,8 @@ export type CommercialStateResult = {
|
|
|
212
302
|
assigned: number;
|
|
213
303
|
available: number;
|
|
214
304
|
};
|
|
215
|
-
invoices?:
|
|
216
|
-
payments?: unknown
|
|
305
|
+
invoices?: CommercialInvoice[];
|
|
306
|
+
payments?: Array<Record<string, unknown>>;
|
|
217
307
|
};
|
|
218
308
|
export type CommercialListCustomersResponse = {
|
|
219
309
|
ok: true;
|
|
@@ -242,6 +332,15 @@ export type CommercialListSubscriptionsResponse = {
|
|
|
242
332
|
subscriptions: CommercialSubscription[];
|
|
243
333
|
pagination: CommercialPaginationMeta;
|
|
244
334
|
};
|
|
335
|
+
export type CommercialInvoiceLineItem = {
|
|
336
|
+
kind: string;
|
|
337
|
+
description: string;
|
|
338
|
+
quantity: number;
|
|
339
|
+
unit_amount: number;
|
|
340
|
+
amount: number;
|
|
341
|
+
currency: string;
|
|
342
|
+
metadata?: Record<string, unknown>;
|
|
343
|
+
};
|
|
245
344
|
export type CommercialInvoice = {
|
|
246
345
|
_id: string;
|
|
247
346
|
tenant_id: string;
|
|
@@ -259,7 +358,7 @@ export type CommercialInvoice = {
|
|
|
259
358
|
status: string;
|
|
260
359
|
currency: string;
|
|
261
360
|
amount: number;
|
|
262
|
-
line_items?:
|
|
361
|
+
line_items?: CommercialInvoiceLineItem[];
|
|
263
362
|
subtotal?: number;
|
|
264
363
|
discount_total?: number;
|
|
265
364
|
tax_total?: number;
|
|
@@ -334,7 +433,13 @@ export type CommercialCreateSubscriptionInput = {
|
|
|
334
433
|
seats_purchased?: number;
|
|
335
434
|
metadata?: Record<string, unknown>;
|
|
336
435
|
payment_method?: string;
|
|
436
|
+
card?: string;
|
|
437
|
+
card_id?: string;
|
|
337
438
|
payment_input?: Record<string, unknown>;
|
|
439
|
+
auto_renew?: boolean;
|
|
440
|
+
renewal_mode?: "platform" | "provider";
|
|
441
|
+
skip_trial?: boolean;
|
|
442
|
+
usage_rollover?: "none" | "carry_unused";
|
|
338
443
|
};
|
|
339
444
|
export type CommercialChangePlanInput = {
|
|
340
445
|
subscriptionId: string;
|
|
@@ -348,7 +453,33 @@ export type CommercialChangePlanInput = {
|
|
|
348
453
|
}>;
|
|
349
454
|
seats_purchased?: number;
|
|
350
455
|
payment_method?: string;
|
|
456
|
+
card?: string;
|
|
457
|
+
card_id?: string;
|
|
351
458
|
payment_input?: Record<string, unknown>;
|
|
459
|
+
auto_renew?: boolean;
|
|
460
|
+
renewal_mode?: "platform" | "provider";
|
|
461
|
+
apply_at?: "immediate" | "next_renewal";
|
|
462
|
+
usage_rollover?: "none" | "carry_unused";
|
|
463
|
+
};
|
|
464
|
+
export type CommercialUpdatePendingSubscriptionInput = {
|
|
465
|
+
subscriptionId: string;
|
|
466
|
+
plan?: string;
|
|
467
|
+
currency?: string;
|
|
468
|
+
discount_code?: string;
|
|
469
|
+
tax_rate?: string;
|
|
470
|
+
addons?: Array<{
|
|
471
|
+
key: string;
|
|
472
|
+
quantity: number;
|
|
473
|
+
}>;
|
|
474
|
+
seats_purchased?: number;
|
|
475
|
+
payment_method?: string;
|
|
476
|
+
card?: string;
|
|
477
|
+
card_id?: string;
|
|
478
|
+
payment_input?: Record<string, unknown>;
|
|
479
|
+
auto_renew?: boolean;
|
|
480
|
+
renewal_mode?: "platform" | "provider";
|
|
481
|
+
skip_trial?: boolean;
|
|
482
|
+
metadata?: Record<string, unknown>;
|
|
352
483
|
};
|
|
353
484
|
export type CommercialPaymentMethodSummary = {
|
|
354
485
|
key: string;
|
|
@@ -363,6 +494,8 @@ export type CommercialInitiatePaymentInput = {
|
|
|
363
494
|
subscription?: string;
|
|
364
495
|
invoice?: string;
|
|
365
496
|
payment_method?: string;
|
|
497
|
+
card?: string;
|
|
498
|
+
card_id?: string;
|
|
366
499
|
input?: Record<string, unknown>;
|
|
367
500
|
currency?: string;
|
|
368
501
|
discount_code?: string;
|
|
@@ -376,8 +509,211 @@ export type CommercialInitiatePaymentResult = {
|
|
|
376
509
|
currency: string;
|
|
377
510
|
amount: number;
|
|
378
511
|
total?: number;
|
|
512
|
+
metadata?: Record<string, unknown>;
|
|
379
513
|
};
|
|
380
514
|
charge: unknown;
|
|
515
|
+
error?: string;
|
|
516
|
+
failure_reason?: string;
|
|
517
|
+
};
|
|
518
|
+
export type CommercialChargeUsageInput = {
|
|
519
|
+
subscriptionId: string;
|
|
520
|
+
amount?: number;
|
|
521
|
+
payment_method?: string;
|
|
522
|
+
card?: string;
|
|
523
|
+
card_id?: string;
|
|
524
|
+
payment_input?: Record<string, unknown>;
|
|
525
|
+
};
|
|
526
|
+
export type CommercialChargeUsageResult = CommercialInitiatePaymentResult & {
|
|
527
|
+
billed_amount: number;
|
|
528
|
+
unbilled_remaining: number;
|
|
529
|
+
};
|
|
530
|
+
export type CommercialRenewSubscriptionInput = {
|
|
531
|
+
subscriptionId: string;
|
|
532
|
+
payment_method?: string;
|
|
533
|
+
};
|
|
534
|
+
export type CommercialRenewSubscriptionResult = {
|
|
535
|
+
ok: true;
|
|
536
|
+
invoice: CommercialInvoice;
|
|
537
|
+
subscription: CommercialSubscription;
|
|
538
|
+
created: boolean;
|
|
539
|
+
};
|
|
540
|
+
export type CommercialCreditBalance = {
|
|
541
|
+
currency: string;
|
|
542
|
+
amount: number;
|
|
543
|
+
};
|
|
544
|
+
export type CommercialCreditLedgerEvent = {
|
|
545
|
+
_id: string;
|
|
546
|
+
tenant_id: string;
|
|
547
|
+
app_id: string;
|
|
548
|
+
customer_id: string;
|
|
549
|
+
currency: string;
|
|
550
|
+
delta: number;
|
|
551
|
+
balance_after: number;
|
|
552
|
+
reason: string;
|
|
553
|
+
invoice_id?: string;
|
|
554
|
+
subscription_id?: string;
|
|
555
|
+
feature_key?: string;
|
|
556
|
+
quantity?: number;
|
|
557
|
+
unit_amount?: number;
|
|
558
|
+
cost?: number;
|
|
559
|
+
plan_quantity?: number;
|
|
560
|
+
pack_quantity?: number;
|
|
561
|
+
overage_quantity?: number;
|
|
562
|
+
credited_amount?: number;
|
|
563
|
+
accrued_amount?: number;
|
|
564
|
+
summary?: string;
|
|
565
|
+
at: string | Date;
|
|
566
|
+
createdAt?: string | Date;
|
|
567
|
+
};
|
|
568
|
+
export type CommercialListCreditsParams = CommercialListParams;
|
|
569
|
+
export type CommercialListCreditsResponse = {
|
|
570
|
+
ok: true;
|
|
571
|
+
credit_balances: CommercialCreditBalance[];
|
|
572
|
+
events: CommercialCreditLedgerEvent[];
|
|
573
|
+
pagination: Pick<CommercialPaginationMeta, "totalDocs" | "page" | "limit"> & Partial<CommercialPaginationMeta>;
|
|
574
|
+
};
|
|
575
|
+
export type CommercialCustomerCard = {
|
|
576
|
+
_id: string;
|
|
577
|
+
tenant_id: string;
|
|
578
|
+
app_id: string;
|
|
579
|
+
customer_id: string;
|
|
580
|
+
token?: string;
|
|
581
|
+
fingerprint?: string;
|
|
582
|
+
last4?: string;
|
|
583
|
+
brand?: string;
|
|
584
|
+
exp_month?: number;
|
|
585
|
+
exp_year?: number;
|
|
586
|
+
payment_method_key?: string;
|
|
587
|
+
provider_customer_id?: string;
|
|
588
|
+
is_default: boolean;
|
|
589
|
+
status: "active" | "expired" | "revoked" | string;
|
|
590
|
+
metadata?: Record<string, unknown>;
|
|
591
|
+
createdAt?: string | Date;
|
|
592
|
+
updatedAt?: string | Date;
|
|
593
|
+
};
|
|
594
|
+
export type CommercialAddCardInput = {
|
|
595
|
+
token?: string;
|
|
596
|
+
authorization_code?: string;
|
|
597
|
+
fingerprint?: string;
|
|
598
|
+
hash?: string;
|
|
599
|
+
last4?: string;
|
|
600
|
+
brand?: string;
|
|
601
|
+
exp_month?: number;
|
|
602
|
+
exp_year?: number;
|
|
603
|
+
payment_method_key?: string;
|
|
604
|
+
provider_customer_id?: string;
|
|
605
|
+
is_default?: boolean;
|
|
606
|
+
metadata?: Record<string, unknown>;
|
|
607
|
+
};
|
|
608
|
+
export type CommercialListCardsParams = CommercialListParams & {
|
|
609
|
+
include_revoked?: boolean;
|
|
610
|
+
};
|
|
611
|
+
export type CommercialListCardsResponse = {
|
|
612
|
+
ok: true;
|
|
613
|
+
cards: CommercialCustomerCard[];
|
|
614
|
+
pagination: CommercialPaginationMeta;
|
|
615
|
+
};
|
|
616
|
+
export type CommercialLifecycleEvent = {
|
|
617
|
+
_id: string;
|
|
618
|
+
tenant_id: string;
|
|
619
|
+
app_id: string;
|
|
620
|
+
customer_id?: string;
|
|
621
|
+
subscription_id?: string;
|
|
622
|
+
type: string;
|
|
623
|
+
at: string | Date;
|
|
624
|
+
actor?: string;
|
|
625
|
+
actor_id?: string;
|
|
626
|
+
payload?: Record<string, unknown>;
|
|
627
|
+
createdAt?: string | Date;
|
|
628
|
+
};
|
|
629
|
+
export type CommercialUsageEvent = {
|
|
630
|
+
_id: string;
|
|
631
|
+
tenant_id: string;
|
|
632
|
+
app_id: string;
|
|
633
|
+
customer_id: string;
|
|
634
|
+
subscription_id?: string;
|
|
635
|
+
feature_key: string;
|
|
636
|
+
quantity: number;
|
|
637
|
+
period_key: string;
|
|
638
|
+
at: string | Date;
|
|
639
|
+
allowed: boolean;
|
|
640
|
+
remaining?: number | null;
|
|
641
|
+
reason?: string;
|
|
642
|
+
currency?: string;
|
|
643
|
+
unit_amount?: number | null;
|
|
644
|
+
cost?: number;
|
|
645
|
+
plan_quantity?: number;
|
|
646
|
+
pack_quantity?: number;
|
|
647
|
+
overage_quantity?: number;
|
|
648
|
+
credited_amount?: number;
|
|
649
|
+
accrued_amount?: number;
|
|
650
|
+
credited_quantity?: number;
|
|
651
|
+
accrued_quantity?: number;
|
|
652
|
+
unbilled_after?: number;
|
|
653
|
+
credit_balance_after?: number;
|
|
654
|
+
summary?: string;
|
|
655
|
+
createdAt?: string | Date;
|
|
656
|
+
};
|
|
657
|
+
export type CommercialListEventsParams = CommercialListParams & {
|
|
658
|
+
type?: string;
|
|
659
|
+
feature?: string;
|
|
660
|
+
};
|
|
661
|
+
export type CommercialListEventsResponse = {
|
|
662
|
+
ok: true;
|
|
663
|
+
events: CommercialLifecycleEvent[];
|
|
664
|
+
pagination: CommercialPaginationMeta;
|
|
665
|
+
};
|
|
666
|
+
export type CommercialListUsageEventsResponse = {
|
|
667
|
+
ok: true;
|
|
668
|
+
events: CommercialUsageEvent[];
|
|
669
|
+
pagination: CommercialPaginationMeta;
|
|
670
|
+
};
|
|
671
|
+
export type CommercialDiscount = {
|
|
672
|
+
_id: string;
|
|
673
|
+
key?: string;
|
|
674
|
+
code?: string;
|
|
675
|
+
name?: string;
|
|
676
|
+
type?: string;
|
|
677
|
+
percent?: number;
|
|
678
|
+
amount?: number;
|
|
679
|
+
currency?: string;
|
|
680
|
+
duration?: string;
|
|
681
|
+
metadata?: Record<string, unknown>;
|
|
682
|
+
};
|
|
683
|
+
export type CommercialTaxRate = {
|
|
684
|
+
_id: string;
|
|
685
|
+
key?: string;
|
|
686
|
+
name?: string;
|
|
687
|
+
percent?: number;
|
|
688
|
+
inclusive?: boolean;
|
|
689
|
+
country?: string;
|
|
690
|
+
metadata?: Record<string, unknown>;
|
|
691
|
+
};
|
|
692
|
+
export type CommercialAddon = {
|
|
693
|
+
_id: string;
|
|
694
|
+
key: string;
|
|
695
|
+
name: string;
|
|
696
|
+
kind?: string;
|
|
697
|
+
prices?: CommercialPrice[];
|
|
698
|
+
metadata?: Record<string, unknown>;
|
|
699
|
+
};
|
|
700
|
+
export type CommercialSeatAssignment = {
|
|
701
|
+
_id: string;
|
|
702
|
+
customer_id: string;
|
|
703
|
+
subscription_id?: string;
|
|
704
|
+
subject_key: string;
|
|
705
|
+
email?: string;
|
|
706
|
+
metadata?: Record<string, unknown>;
|
|
707
|
+
assigned_at?: string | Date;
|
|
708
|
+
};
|
|
709
|
+
export type CommercialLicense = {
|
|
710
|
+
_id: string;
|
|
711
|
+
customer_id: string;
|
|
712
|
+
license_key_prefix?: string;
|
|
713
|
+
status: string;
|
|
714
|
+
plan_key?: string;
|
|
715
|
+
expires_at?: string | Date | null;
|
|
716
|
+
metadata?: Record<string, unknown>;
|
|
381
717
|
};
|
|
382
718
|
export type CommercialConfirmPaymentInput = {
|
|
383
719
|
reference: string;
|
|
@@ -412,6 +748,25 @@ export type CommercialSeatAssignInput = {
|
|
|
412
748
|
email?: string;
|
|
413
749
|
metadata?: Record<string, unknown>;
|
|
414
750
|
};
|
|
751
|
+
export type CommercialEntitlementTopupInput = {
|
|
752
|
+
subscriptionId: string;
|
|
753
|
+
feature: string;
|
|
754
|
+
pack_units?: number;
|
|
755
|
+
pack_index?: number;
|
|
756
|
+
payment_method?: string;
|
|
757
|
+
card?: string;
|
|
758
|
+
card_id?: string;
|
|
759
|
+
payment_input?: Record<string, unknown>;
|
|
760
|
+
};
|
|
761
|
+
export type CommercialCreditsTopupInput = {
|
|
762
|
+
customerId: string;
|
|
763
|
+
currency: string;
|
|
764
|
+
amount: number;
|
|
765
|
+
payment_method?: string;
|
|
766
|
+
card?: string;
|
|
767
|
+
card_id?: string;
|
|
768
|
+
payment_input?: Record<string, unknown>;
|
|
769
|
+
};
|
|
415
770
|
export type CommercialLicenseIssueInput = {
|
|
416
771
|
customer: string;
|
|
417
772
|
expires_at?: string;
|
|
@@ -454,6 +809,34 @@ export type CommercialAppClientApi = {
|
|
|
454
809
|
ok: true;
|
|
455
810
|
customer: CommercialCustomer;
|
|
456
811
|
}>;
|
|
812
|
+
listCredits(customerId: string, params?: CommercialListCreditsParams): Promise<CommercialListCreditsResponse>;
|
|
813
|
+
topupCredits(input: CommercialCreditsTopupInput): Promise<{
|
|
814
|
+
ok: true;
|
|
815
|
+
invoice: CommercialInvoice;
|
|
816
|
+
}>;
|
|
817
|
+
listCards(customerId: string, params?: CommercialListCardsParams): Promise<CommercialListCardsResponse>;
|
|
818
|
+
addCard(customerId: string, input: CommercialAddCardInput): Promise<{
|
|
819
|
+
ok: true;
|
|
820
|
+
card: CommercialCustomerCard;
|
|
821
|
+
}>;
|
|
822
|
+
updateCard(customerId: string, cardId: string, input: CommercialAddCardInput): Promise<{
|
|
823
|
+
ok: true;
|
|
824
|
+
card: CommercialCustomerCard;
|
|
825
|
+
}>;
|
|
826
|
+
removeCard(customerId: string, cardId: string): Promise<{
|
|
827
|
+
ok: true;
|
|
828
|
+
card: CommercialCustomerCard;
|
|
829
|
+
}>;
|
|
830
|
+
setDefaultCard(customerId: string, cardId: string): Promise<{
|
|
831
|
+
ok: true;
|
|
832
|
+
card: CommercialCustomerCard;
|
|
833
|
+
}>;
|
|
834
|
+
listEvents(customerId: string, params?: CommercialListEventsParams): Promise<CommercialListEventsResponse>;
|
|
835
|
+
listUsageEvents(customerId: string, params?: CommercialListEventsParams): Promise<CommercialListUsageEventsResponse>;
|
|
836
|
+
listEventTypes(): Promise<{
|
|
837
|
+
ok: true;
|
|
838
|
+
event_types: string[];
|
|
839
|
+
}>;
|
|
457
840
|
listFeatures(params?: CommercialListParams): Promise<CommercialListFeaturesResponse>;
|
|
458
841
|
getFeature(featureId: string): Promise<{
|
|
459
842
|
ok: true;
|
|
@@ -487,10 +870,22 @@ export type CommercialAppClientApi = {
|
|
|
487
870
|
ok: true;
|
|
488
871
|
subscription: CommercialSubscription;
|
|
489
872
|
}>;
|
|
873
|
+
updatePendingSubscription(input: CommercialUpdatePendingSubscriptionInput): Promise<{
|
|
874
|
+
ok: true;
|
|
875
|
+
subscription: CommercialSubscription;
|
|
876
|
+
}>;
|
|
490
877
|
changePlan(input: CommercialChangePlanInput): Promise<{
|
|
491
878
|
ok: true;
|
|
492
879
|
subscription: CommercialSubscription;
|
|
493
880
|
}>;
|
|
881
|
+
entitlementTopup(input: CommercialEntitlementTopupInput): Promise<{
|
|
882
|
+
ok: true;
|
|
883
|
+
invoice: CommercialInvoice;
|
|
884
|
+
subscription: CommercialSubscription;
|
|
885
|
+
}>;
|
|
886
|
+
chargeUsage(input: CommercialChargeUsageInput): Promise<CommercialChargeUsageResult>;
|
|
887
|
+
renewSubscription(input: CommercialRenewSubscriptionInput): Promise<CommercialRenewSubscriptionResult>;
|
|
888
|
+
renew(input: CommercialRenewSubscriptionInput): Promise<CommercialRenewSubscriptionResult>;
|
|
494
889
|
updateSubscriptionStatus(input: CommercialUpdateSubscriptionStatusInput): Promise<{
|
|
495
890
|
ok: true;
|
|
496
891
|
subscription: CommercialSubscription;
|
|
@@ -516,44 +911,45 @@ export type CommercialAppClientApi = {
|
|
|
516
911
|
customer?: string;
|
|
517
912
|
}): Promise<{
|
|
518
913
|
ok: true;
|
|
519
|
-
discount:
|
|
520
|
-
quote:
|
|
914
|
+
discount: CommercialDiscount;
|
|
915
|
+
quote: CommercialPricingQuote;
|
|
521
916
|
}>;
|
|
522
917
|
listDiscounts(params?: CommercialListParams): Promise<{
|
|
523
918
|
ok: true;
|
|
524
|
-
discounts:
|
|
919
|
+
discounts: CommercialDiscount[];
|
|
525
920
|
pagination: CommercialPaginationMeta;
|
|
526
921
|
}>;
|
|
527
922
|
listTaxRates(params?: CommercialListParams): Promise<{
|
|
528
923
|
ok: true;
|
|
529
|
-
tax_rates:
|
|
924
|
+
tax_rates: CommercialTaxRate[];
|
|
530
925
|
pagination: CommercialPaginationMeta;
|
|
531
926
|
}>;
|
|
532
927
|
listAddons(params?: CommercialListParams): Promise<{
|
|
533
928
|
ok: true;
|
|
534
|
-
addons:
|
|
929
|
+
addons: CommercialAddon[];
|
|
535
930
|
pagination: CommercialPaginationMeta;
|
|
536
931
|
}>;
|
|
537
932
|
assignSeat(input: CommercialSeatAssignInput): Promise<{
|
|
538
933
|
ok: true;
|
|
539
|
-
assignment:
|
|
934
|
+
assignment: CommercialSeatAssignment;
|
|
540
935
|
}>;
|
|
541
936
|
unassignSeat(input: CommercialSeatAssignInput): Promise<{
|
|
542
937
|
ok: boolean;
|
|
543
938
|
}>;
|
|
544
939
|
issueLicense(input: CommercialLicenseIssueInput): Promise<{
|
|
545
940
|
ok: true;
|
|
546
|
-
license:
|
|
941
|
+
license: CommercialLicense;
|
|
547
942
|
license_key: string;
|
|
548
943
|
}>;
|
|
549
944
|
validateLicense(input: CommercialLicenseValidateInput): Promise<{
|
|
550
945
|
ok: true;
|
|
551
946
|
valid: boolean;
|
|
947
|
+
license?: CommercialLicense;
|
|
552
948
|
[key: string]: unknown;
|
|
553
949
|
}>;
|
|
554
950
|
revokeLicense(licenseId: string): Promise<{
|
|
555
951
|
ok: true;
|
|
556
|
-
license:
|
|
952
|
+
license: CommercialLicense;
|
|
557
953
|
}>;
|
|
558
954
|
analytics(params?: CommercialAnalyticsParams): Promise<{
|
|
559
955
|
ok: true;
|