@billfn/admin 0.1.0

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.
@@ -0,0 +1,897 @@
1
+ import { type AdminClient, type AdminClientRequestOptions, type AdminCapabilityAdapter, type AdminObjectSchema, type AdminOperationContext, type AdminOperationDefinition, type AdminOperationResult } from "@superfunctions/admin";
2
+ export interface BillFnAdminResourceDefinition {
3
+ id: string;
4
+ label: string;
5
+ description: string;
6
+ icon: string;
7
+ risk: "standard" | "sensitive";
8
+ idField: string;
9
+ displayFields: readonly string[];
10
+ searchableFields: readonly string[];
11
+ filterableFields: readonly string[];
12
+ sortableFields: readonly string[];
13
+ sensitiveFields: readonly string[];
14
+ }
15
+ export interface BillFnAdminActionDefinition {
16
+ id: string;
17
+ resource: string;
18
+ title: string;
19
+ description: string;
20
+ classification: "write" | "destructive";
21
+ requiresConfirmation: boolean;
22
+ idempotent: true;
23
+ target: "resource" | "collection";
24
+ }
25
+ export declare const billFnAdminResources: readonly [{
26
+ readonly id: "customers";
27
+ readonly label: "Customers";
28
+ readonly description: "Inspect and operate customers in BillFn.";
29
+ readonly icon: "billfn:customers";
30
+ readonly risk: "standard";
31
+ readonly idField: "id";
32
+ readonly displayFields: readonly ["id", "name", "status", "updatedAt"];
33
+ readonly searchableFields: readonly ["id", "name", "status"];
34
+ readonly filterableFields: readonly ["status", "createdAt", "updatedAt"];
35
+ readonly sortableFields: readonly ["createdAt", "updatedAt", "name"];
36
+ readonly sensitiveFields: readonly [];
37
+ }, {
38
+ readonly id: "products";
39
+ readonly label: "Products";
40
+ readonly description: "Inspect and operate products in BillFn.";
41
+ readonly icon: "billfn:products";
42
+ readonly risk: "standard";
43
+ readonly idField: "id";
44
+ readonly displayFields: readonly ["id", "productKey", "planCount"];
45
+ readonly searchableFields: readonly ["id", "productKey"];
46
+ readonly filterableFields: readonly ["productKey", "planCount"];
47
+ readonly sortableFields: readonly ["productKey", "planCount"];
48
+ readonly sensitiveFields: readonly [];
49
+ }, {
50
+ readonly id: "plans";
51
+ readonly label: "Plans";
52
+ readonly description: "Inspect and operate plans in BillFn.";
53
+ readonly icon: "billfn:plans";
54
+ readonly risk: "standard";
55
+ readonly idField: "id";
56
+ readonly displayFields: readonly ["id", "displayName", "productKey", "planKey"];
57
+ readonly searchableFields: readonly ["id", "displayName", "productKey", "planKey"];
58
+ readonly filterableFields: readonly ["productKey", "planKey"];
59
+ readonly sortableFields: readonly ["displayName", "productKey", "planKey"];
60
+ readonly sensitiveFields: readonly [];
61
+ }, {
62
+ readonly id: "prices";
63
+ readonly label: "Prices";
64
+ readonly description: "Inspect and operate prices in BillFn.";
65
+ readonly icon: "billfn:prices";
66
+ readonly risk: "standard";
67
+ readonly idField: "id";
68
+ readonly displayFields: readonly ["id", "displayName", "amount", "currency", "interval", "provider"];
69
+ readonly searchableFields: readonly ["id", "displayName", "priceId", "planKey", "productKey", "provider"];
70
+ readonly filterableFields: readonly ["provider", "currency", "kind", "interval", "planKey", "productKey"];
71
+ readonly sortableFields: readonly ["amount", "currency", "displayName", "interval", "provider"];
72
+ readonly sensitiveFields: readonly [];
73
+ }, {
74
+ readonly id: "subscriptions";
75
+ readonly label: "Subscriptions";
76
+ readonly description: "Inspect and operate subscriptions in BillFn.";
77
+ readonly icon: "billfn:subscriptions";
78
+ readonly risk: "standard";
79
+ readonly idField: "id";
80
+ readonly displayFields: readonly ["id", "planKey", "status", "provider", "currentPeriodEnd", "updatedAt"];
81
+ readonly searchableFields: readonly ["id", "planKey", "priceId", "provider", "status"];
82
+ readonly filterableFields: readonly ["planKey", "provider", "status"];
83
+ readonly sortableFields: readonly ["createdAt", "currentPeriodEnd", "status", "updatedAt"];
84
+ readonly sensitiveFields: readonly [];
85
+ }, {
86
+ readonly id: "entitlements";
87
+ readonly label: "Entitlements";
88
+ readonly description: "Inspect and operate entitlements in BillFn.";
89
+ readonly icon: "billfn:entitlements";
90
+ readonly risk: "standard";
91
+ readonly idField: "id";
92
+ readonly displayFields: readonly ["id", "planKey", "status", "effectiveAt", "expiresAt", "updatedAt"];
93
+ readonly searchableFields: readonly ["id", "planKey", "status"];
94
+ readonly filterableFields: readonly ["planKey", "status"];
95
+ readonly sortableFields: readonly ["createdAt", "effectiveAt", "expiresAt", "updatedAt"];
96
+ readonly sensitiveFields: readonly [];
97
+ }, {
98
+ readonly id: "quotas";
99
+ readonly label: "Quotas";
100
+ readonly description: "Inspect and operate quotas in BillFn.";
101
+ readonly icon: "billfn:quotas";
102
+ readonly risk: "standard";
103
+ readonly idField: "id";
104
+ readonly displayFields: readonly ["id", "name", "status", "updatedAt"];
105
+ readonly searchableFields: readonly ["id", "name", "status"];
106
+ readonly filterableFields: readonly ["status", "createdAt", "updatedAt"];
107
+ readonly sortableFields: readonly ["createdAt", "updatedAt", "name"];
108
+ readonly sensitiveFields: readonly [];
109
+ }, {
110
+ readonly id: "invoices";
111
+ readonly label: "Invoices";
112
+ readonly description: "Inspect and operate invoices in BillFn.";
113
+ readonly icon: "billfn:invoices";
114
+ readonly risk: "standard";
115
+ readonly idField: "id";
116
+ readonly displayFields: readonly ["id", "name", "status", "updatedAt"];
117
+ readonly searchableFields: readonly ["id", "name", "status"];
118
+ readonly filterableFields: readonly ["status", "createdAt", "updatedAt"];
119
+ readonly sortableFields: readonly ["createdAt", "updatedAt", "name"];
120
+ readonly sensitiveFields: readonly [];
121
+ }, {
122
+ readonly id: "payments";
123
+ readonly label: "Payments";
124
+ readonly description: "Inspect and operate payments in BillFn.";
125
+ readonly icon: "billfn:payments";
126
+ readonly risk: "sensitive";
127
+ readonly idField: "id";
128
+ readonly displayFields: readonly ["id", "name", "status", "updatedAt"];
129
+ readonly searchableFields: readonly ["id", "name", "status"];
130
+ readonly filterableFields: readonly ["status", "createdAt", "updatedAt"];
131
+ readonly sortableFields: readonly ["createdAt", "updatedAt", "name"];
132
+ readonly sensitiveFields: readonly ["secret", "token", "credential", "value", "password", "passwd", "apiKey", "privateKey", "authorization", "cookie", "otp", "otpCode", "recoveryCode", "recoveryCodes", "verificationCode", "sessionToken"];
133
+ }, {
134
+ readonly id: "usage";
135
+ readonly label: "Usage";
136
+ readonly description: "Inspect and operate usage in BillFn.";
137
+ readonly icon: "billfn:usage";
138
+ readonly risk: "standard";
139
+ readonly idField: "id";
140
+ readonly displayFields: readonly ["id", "resource", "current", "limit"];
141
+ readonly searchableFields: readonly ["id", "resource"];
142
+ readonly filterableFields: readonly ["resource"];
143
+ readonly sortableFields: readonly ["current", "limit", "resource"];
144
+ readonly sensitiveFields: readonly [];
145
+ }, {
146
+ readonly id: "reconciliation";
147
+ readonly label: "Reconciliation";
148
+ readonly description: "Inspect and operate reconciliation in BillFn.";
149
+ readonly icon: "billfn:reconciliation";
150
+ readonly risk: "standard";
151
+ readonly idField: "id";
152
+ readonly displayFields: readonly ["id", "name", "status", "updatedAt"];
153
+ readonly searchableFields: readonly ["id", "name", "status"];
154
+ readonly filterableFields: readonly ["status", "createdAt", "updatedAt"];
155
+ readonly sortableFields: readonly ["createdAt", "updatedAt", "name"];
156
+ readonly sensitiveFields: readonly [];
157
+ }, {
158
+ readonly id: "revenue";
159
+ readonly label: "Revenue";
160
+ readonly description: "Inspect and operate revenue in BillFn.";
161
+ readonly icon: "billfn:revenue";
162
+ readonly risk: "standard";
163
+ readonly idField: "id";
164
+ readonly displayFields: readonly ["id", "name", "status", "updatedAt"];
165
+ readonly searchableFields: readonly ["id", "name", "status"];
166
+ readonly filterableFields: readonly ["status", "createdAt", "updatedAt"];
167
+ readonly sortableFields: readonly ["createdAt", "updatedAt", "name"];
168
+ readonly sensitiveFields: readonly [];
169
+ }];
170
+ export declare const billFnAdminActions: readonly [{
171
+ readonly id: "create-catalog";
172
+ readonly resource: "products";
173
+ readonly title: "Create Catalog";
174
+ readonly description: "Create Catalog for products.";
175
+ readonly classification: "write";
176
+ readonly requiresConfirmation: false;
177
+ readonly idempotent: true;
178
+ readonly target: "collection";
179
+ }, {
180
+ readonly id: "update-catalog";
181
+ readonly resource: "products";
182
+ readonly title: "Update Catalog";
183
+ readonly description: "Update Catalog for products.";
184
+ readonly classification: "write";
185
+ readonly requiresConfirmation: false;
186
+ readonly idempotent: true;
187
+ readonly target: "resource";
188
+ }, {
189
+ readonly id: "grant-entitlement";
190
+ readonly resource: "entitlements";
191
+ readonly title: "Grant Entitlement";
192
+ readonly description: "Grant Entitlement for entitlements.";
193
+ readonly classification: "write";
194
+ readonly requiresConfirmation: false;
195
+ readonly idempotent: true;
196
+ readonly target: "resource";
197
+ }, {
198
+ readonly id: "change-subscription";
199
+ readonly resource: "subscriptions";
200
+ readonly title: "Change Subscription";
201
+ readonly description: "Change Subscription for subscriptions.";
202
+ readonly classification: "write";
203
+ readonly requiresConfirmation: true;
204
+ readonly idempotent: true;
205
+ readonly target: "resource";
206
+ }, {
207
+ readonly id: "cancel-subscription";
208
+ readonly resource: "subscriptions";
209
+ readonly title: "Cancel Subscription";
210
+ readonly description: "Cancel Subscription for subscriptions.";
211
+ readonly classification: "destructive";
212
+ readonly requiresConfirmation: true;
213
+ readonly idempotent: true;
214
+ readonly target: "resource";
215
+ }, {
216
+ readonly id: "issue-credit";
217
+ readonly resource: "invoices";
218
+ readonly title: "Issue Credit";
219
+ readonly description: "Issue Credit for invoices.";
220
+ readonly classification: "write";
221
+ readonly requiresConfirmation: false;
222
+ readonly idempotent: true;
223
+ readonly target: "resource";
224
+ }, {
225
+ readonly id: "refund-payment";
226
+ readonly resource: "payments";
227
+ readonly title: "Refund Payment";
228
+ readonly description: "Refund Payment for payments.";
229
+ readonly classification: "write";
230
+ readonly requiresConfirmation: true;
231
+ readonly idempotent: true;
232
+ readonly target: "resource";
233
+ }, {
234
+ readonly id: "reconcile-provider";
235
+ readonly resource: "reconciliation";
236
+ readonly title: "Reconcile Provider";
237
+ readonly description: "Reconcile Provider for reconciliation.";
238
+ readonly classification: "write";
239
+ readonly requiresConfirmation: true;
240
+ readonly idempotent: true;
241
+ readonly target: "collection";
242
+ }];
243
+ export interface BillFnAdminResourcePolicy {
244
+ defaultScope: "active";
245
+ permission: string;
246
+ redaction: "none" | "sensitive-fields";
247
+ }
248
+ export interface BillFnAdminOperationPolicy {
249
+ permission: string;
250
+ scope: {
251
+ levels: readonly ["organization", "workspace", "project", "environment"];
252
+ forwardsNamespace: true;
253
+ forwardsRegion: true;
254
+ };
255
+ safety: {
256
+ classification: "write" | "destructive";
257
+ requiresConfirmation: boolean;
258
+ };
259
+ idempotency: {
260
+ mode: "required";
261
+ keyStrategy: "context.idempotencyKey";
262
+ };
263
+ audit: {
264
+ mode: "required";
265
+ action: string;
266
+ targetResource: string;
267
+ targetIdPath?: "$.id";
268
+ collection?: true;
269
+ };
270
+ observation: {
271
+ domain: "billfn";
272
+ requestIdPath: "context.requestId";
273
+ correlationIdPath: "context.correlationId";
274
+ };
275
+ }
276
+ export declare const billFnAdminResourcePolicies: Readonly<Record<string, BillFnAdminResourcePolicy>>;
277
+ export declare const billFnAdminOperationPolicies: Readonly<Record<string, BillFnAdminOperationPolicy>>;
278
+ export declare const billFnAdminSchemas: {
279
+ readonly entity: AdminObjectSchema;
280
+ readonly listInput: AdminObjectSchema;
281
+ readonly listOutput: AdminObjectSchema;
282
+ readonly getInput: AdminObjectSchema;
283
+ readonly getOutput: AdminObjectSchema;
284
+ readonly actionInput: AdminObjectSchema;
285
+ readonly actionOutput: AdminObjectSchema;
286
+ };
287
+ type FunctionAdminActionOperationId<TModule extends string, TAction> = TAction extends {
288
+ resource: infer TResource extends string;
289
+ id: infer TActionId extends string;
290
+ } ? `${TModule}.${TResource}.${TActionId}` : never;
291
+ type BillFnDomainReadResourceId = "products" | "plans" | "prices" | "subscriptions" | "entitlements" | "usage";
292
+ type BillFnDomainAction = Extract<(typeof billFnAdminActions)[number], {
293
+ id: "change-subscription" | "cancel-subscription" | "refund-payment" | "reconcile-provider";
294
+ }>;
295
+ export type BillFnAdminOperationId = `billfn.${BillFnDomainReadResourceId}.list` | `billfn.${BillFnDomainReadResourceId}.get` | FunctionAdminActionOperationId<"billfn", BillFnDomainAction>;
296
+ export declare const billFnAdminCapability: {
297
+ readonly schemaVersion: "1.0";
298
+ readonly id: "billfn";
299
+ readonly displayName: "BillFn";
300
+ readonly version: "1.0.0";
301
+ readonly description: "Function-owned BillFn operator capabilities backed by the configured billing instance.";
302
+ readonly category: "commerce";
303
+ readonly availability: "required-product";
304
+ readonly scopeLevels: readonly ["organization", "workspace", "project", "environment"];
305
+ readonly dependencies: readonly [];
306
+ readonly resources: ({
307
+ readonly id: "customers";
308
+ readonly label: "Customers";
309
+ readonly description: "Inspect and operate customers in BillFn.";
310
+ readonly icon: "billfn:customers";
311
+ readonly risk: "standard";
312
+ readonly idField: "id";
313
+ readonly displayFields: readonly ["id", "name", "status", "updatedAt"];
314
+ readonly searchableFields: readonly ["id", "name", "status"];
315
+ readonly filterableFields: readonly ["status", "createdAt", "updatedAt"];
316
+ readonly sortableFields: readonly ["createdAt", "updatedAt", "name"];
317
+ readonly sensitiveFields: readonly [];
318
+ } | {
319
+ readonly id: "products";
320
+ readonly label: "Products";
321
+ readonly description: "Inspect and operate products in BillFn.";
322
+ readonly icon: "billfn:products";
323
+ readonly risk: "standard";
324
+ readonly idField: "id";
325
+ readonly displayFields: readonly ["id", "productKey", "planCount"];
326
+ readonly searchableFields: readonly ["id", "productKey"];
327
+ readonly filterableFields: readonly ["productKey", "planCount"];
328
+ readonly sortableFields: readonly ["productKey", "planCount"];
329
+ readonly sensitiveFields: readonly [];
330
+ } | {
331
+ readonly id: "plans";
332
+ readonly label: "Plans";
333
+ readonly description: "Inspect and operate plans in BillFn.";
334
+ readonly icon: "billfn:plans";
335
+ readonly risk: "standard";
336
+ readonly idField: "id";
337
+ readonly displayFields: readonly ["id", "displayName", "productKey", "planKey"];
338
+ readonly searchableFields: readonly ["id", "displayName", "productKey", "planKey"];
339
+ readonly filterableFields: readonly ["productKey", "planKey"];
340
+ readonly sortableFields: readonly ["displayName", "productKey", "planKey"];
341
+ readonly sensitiveFields: readonly [];
342
+ } | {
343
+ readonly id: "prices";
344
+ readonly label: "Prices";
345
+ readonly description: "Inspect and operate prices in BillFn.";
346
+ readonly icon: "billfn:prices";
347
+ readonly risk: "standard";
348
+ readonly idField: "id";
349
+ readonly displayFields: readonly ["id", "displayName", "amount", "currency", "interval", "provider"];
350
+ readonly searchableFields: readonly ["id", "displayName", "priceId", "planKey", "productKey", "provider"];
351
+ readonly filterableFields: readonly ["provider", "currency", "kind", "interval", "planKey", "productKey"];
352
+ readonly sortableFields: readonly ["amount", "currency", "displayName", "interval", "provider"];
353
+ readonly sensitiveFields: readonly [];
354
+ } | {
355
+ readonly id: "subscriptions";
356
+ readonly label: "Subscriptions";
357
+ readonly description: "Inspect and operate subscriptions in BillFn.";
358
+ readonly icon: "billfn:subscriptions";
359
+ readonly risk: "standard";
360
+ readonly idField: "id";
361
+ readonly displayFields: readonly ["id", "planKey", "status", "provider", "currentPeriodEnd", "updatedAt"];
362
+ readonly searchableFields: readonly ["id", "planKey", "priceId", "provider", "status"];
363
+ readonly filterableFields: readonly ["planKey", "provider", "status"];
364
+ readonly sortableFields: readonly ["createdAt", "currentPeriodEnd", "status", "updatedAt"];
365
+ readonly sensitiveFields: readonly [];
366
+ } | {
367
+ readonly id: "entitlements";
368
+ readonly label: "Entitlements";
369
+ readonly description: "Inspect and operate entitlements in BillFn.";
370
+ readonly icon: "billfn:entitlements";
371
+ readonly risk: "standard";
372
+ readonly idField: "id";
373
+ readonly displayFields: readonly ["id", "planKey", "status", "effectiveAt", "expiresAt", "updatedAt"];
374
+ readonly searchableFields: readonly ["id", "planKey", "status"];
375
+ readonly filterableFields: readonly ["planKey", "status"];
376
+ readonly sortableFields: readonly ["createdAt", "effectiveAt", "expiresAt", "updatedAt"];
377
+ readonly sensitiveFields: readonly [];
378
+ } | {
379
+ readonly id: "quotas";
380
+ readonly label: "Quotas";
381
+ readonly description: "Inspect and operate quotas in BillFn.";
382
+ readonly icon: "billfn:quotas";
383
+ readonly risk: "standard";
384
+ readonly idField: "id";
385
+ readonly displayFields: readonly ["id", "name", "status", "updatedAt"];
386
+ readonly searchableFields: readonly ["id", "name", "status"];
387
+ readonly filterableFields: readonly ["status", "createdAt", "updatedAt"];
388
+ readonly sortableFields: readonly ["createdAt", "updatedAt", "name"];
389
+ readonly sensitiveFields: readonly [];
390
+ } | {
391
+ readonly id: "invoices";
392
+ readonly label: "Invoices";
393
+ readonly description: "Inspect and operate invoices in BillFn.";
394
+ readonly icon: "billfn:invoices";
395
+ readonly risk: "standard";
396
+ readonly idField: "id";
397
+ readonly displayFields: readonly ["id", "name", "status", "updatedAt"];
398
+ readonly searchableFields: readonly ["id", "name", "status"];
399
+ readonly filterableFields: readonly ["status", "createdAt", "updatedAt"];
400
+ readonly sortableFields: readonly ["createdAt", "updatedAt", "name"];
401
+ readonly sensitiveFields: readonly [];
402
+ } | {
403
+ readonly id: "payments";
404
+ readonly label: "Payments";
405
+ readonly description: "Inspect and operate payments in BillFn.";
406
+ readonly icon: "billfn:payments";
407
+ readonly risk: "sensitive";
408
+ readonly idField: "id";
409
+ readonly displayFields: readonly ["id", "name", "status", "updatedAt"];
410
+ readonly searchableFields: readonly ["id", "name", "status"];
411
+ readonly filterableFields: readonly ["status", "createdAt", "updatedAt"];
412
+ readonly sortableFields: readonly ["createdAt", "updatedAt", "name"];
413
+ readonly sensitiveFields: readonly ["secret", "token", "credential", "value", "password", "passwd", "apiKey", "privateKey", "authorization", "cookie", "otp", "otpCode", "recoveryCode", "recoveryCodes", "verificationCode", "sessionToken"];
414
+ } | {
415
+ readonly id: "usage";
416
+ readonly label: "Usage";
417
+ readonly description: "Inspect and operate usage in BillFn.";
418
+ readonly icon: "billfn:usage";
419
+ readonly risk: "standard";
420
+ readonly idField: "id";
421
+ readonly displayFields: readonly ["id", "resource", "current", "limit"];
422
+ readonly searchableFields: readonly ["id", "resource"];
423
+ readonly filterableFields: readonly ["resource"];
424
+ readonly sortableFields: readonly ["current", "limit", "resource"];
425
+ readonly sensitiveFields: readonly [];
426
+ } | {
427
+ readonly id: "reconciliation";
428
+ readonly label: "Reconciliation";
429
+ readonly description: "Inspect and operate reconciliation in BillFn.";
430
+ readonly icon: "billfn:reconciliation";
431
+ readonly risk: "standard";
432
+ readonly idField: "id";
433
+ readonly displayFields: readonly ["id", "name", "status", "updatedAt"];
434
+ readonly searchableFields: readonly ["id", "name", "status"];
435
+ readonly filterableFields: readonly ["status", "createdAt", "updatedAt"];
436
+ readonly sortableFields: readonly ["createdAt", "updatedAt", "name"];
437
+ readonly sensitiveFields: readonly [];
438
+ } | {
439
+ readonly id: "revenue";
440
+ readonly label: "Revenue";
441
+ readonly description: "Inspect and operate revenue in BillFn.";
442
+ readonly icon: "billfn:revenue";
443
+ readonly risk: "standard";
444
+ readonly idField: "id";
445
+ readonly displayFields: readonly ["id", "name", "status", "updatedAt"];
446
+ readonly searchableFields: readonly ["id", "name", "status"];
447
+ readonly filterableFields: readonly ["status", "createdAt", "updatedAt"];
448
+ readonly sortableFields: readonly ["createdAt", "updatedAt", "name"];
449
+ readonly sensitiveFields: readonly [];
450
+ })[];
451
+ readonly navigation: readonly [{
452
+ readonly id: "billfn";
453
+ readonly label: "BillFn";
454
+ readonly path: "/modules/billfn";
455
+ readonly icon: "billfn";
456
+ readonly description: "Operate BillFn in the active scope.";
457
+ readonly order: 100;
458
+ }];
459
+ readonly operations: readonly (AdminOperationDefinition & {
460
+ readonly id: BillFnAdminOperationId;
461
+ })[];
462
+ };
463
+ export interface BillFnAdminListInput {
464
+ filter?: Record<string, unknown>;
465
+ limit?: number;
466
+ cursor?: string;
467
+ search?: string;
468
+ sort?: readonly {
469
+ field?: string;
470
+ direction?: "asc" | "desc";
471
+ }[];
472
+ }
473
+ export interface BillFnAdminGetInput {
474
+ id: string;
475
+ }
476
+ export interface BillFnChangeSubscriptionInput {
477
+ id: string;
478
+ payload: {
479
+ targetPriceId: string;
480
+ effectiveAt?: "immediate" | "next_renewal";
481
+ prorationBehavior?: "provider_default" | "prorate" | "none";
482
+ };
483
+ reason?: string;
484
+ }
485
+ export interface BillFnCancelSubscriptionInput {
486
+ id: string;
487
+ reason?: string;
488
+ }
489
+ export interface BillFnRefundPaymentInput {
490
+ id: string;
491
+ payload: {
492
+ subscriptionId?: string;
493
+ mode?: "full" | "prorated_remaining_period" | "custom";
494
+ amount?: number;
495
+ };
496
+ reason?: string;
497
+ }
498
+ export interface BillFnReconcileProviderInput {
499
+ payload: {
500
+ kind: "subscription-sync" | "account-scan";
501
+ provider?: "dodo" | "apple" | "stripe" | "polar" | "google-play" | "microsoft-store";
502
+ billingAccountId?: string;
503
+ subscriptionId?: string;
504
+ providerEventId?: string;
505
+ cursor?: string;
506
+ };
507
+ }
508
+ type BillFnAdminResult = AdminOperationResult<Record<string, unknown>>;
509
+ export declare function createBillFnAdminClient(adminClient: AdminClient): import("@superfunctions/admin").CapabilityAdminClient<{
510
+ readonly schemaVersion: "1.0";
511
+ readonly id: "billfn";
512
+ readonly displayName: "BillFn";
513
+ readonly version: "1.0.0";
514
+ readonly description: "Function-owned BillFn operator capabilities backed by the configured billing instance.";
515
+ readonly category: "commerce";
516
+ readonly availability: "required-product";
517
+ readonly scopeLevels: readonly ["organization", "workspace", "project", "environment"];
518
+ readonly dependencies: readonly [];
519
+ readonly resources: ({
520
+ readonly id: "customers";
521
+ readonly label: "Customers";
522
+ readonly description: "Inspect and operate customers in BillFn.";
523
+ readonly icon: "billfn:customers";
524
+ readonly risk: "standard";
525
+ readonly idField: "id";
526
+ readonly displayFields: readonly ["id", "name", "status", "updatedAt"];
527
+ readonly searchableFields: readonly ["id", "name", "status"];
528
+ readonly filterableFields: readonly ["status", "createdAt", "updatedAt"];
529
+ readonly sortableFields: readonly ["createdAt", "updatedAt", "name"];
530
+ readonly sensitiveFields: readonly [];
531
+ } | {
532
+ readonly id: "products";
533
+ readonly label: "Products";
534
+ readonly description: "Inspect and operate products in BillFn.";
535
+ readonly icon: "billfn:products";
536
+ readonly risk: "standard";
537
+ readonly idField: "id";
538
+ readonly displayFields: readonly ["id", "productKey", "planCount"];
539
+ readonly searchableFields: readonly ["id", "productKey"];
540
+ readonly filterableFields: readonly ["productKey", "planCount"];
541
+ readonly sortableFields: readonly ["productKey", "planCount"];
542
+ readonly sensitiveFields: readonly [];
543
+ } | {
544
+ readonly id: "plans";
545
+ readonly label: "Plans";
546
+ readonly description: "Inspect and operate plans in BillFn.";
547
+ readonly icon: "billfn:plans";
548
+ readonly risk: "standard";
549
+ readonly idField: "id";
550
+ readonly displayFields: readonly ["id", "displayName", "productKey", "planKey"];
551
+ readonly searchableFields: readonly ["id", "displayName", "productKey", "planKey"];
552
+ readonly filterableFields: readonly ["productKey", "planKey"];
553
+ readonly sortableFields: readonly ["displayName", "productKey", "planKey"];
554
+ readonly sensitiveFields: readonly [];
555
+ } | {
556
+ readonly id: "prices";
557
+ readonly label: "Prices";
558
+ readonly description: "Inspect and operate prices in BillFn.";
559
+ readonly icon: "billfn:prices";
560
+ readonly risk: "standard";
561
+ readonly idField: "id";
562
+ readonly displayFields: readonly ["id", "displayName", "amount", "currency", "interval", "provider"];
563
+ readonly searchableFields: readonly ["id", "displayName", "priceId", "planKey", "productKey", "provider"];
564
+ readonly filterableFields: readonly ["provider", "currency", "kind", "interval", "planKey", "productKey"];
565
+ readonly sortableFields: readonly ["amount", "currency", "displayName", "interval", "provider"];
566
+ readonly sensitiveFields: readonly [];
567
+ } | {
568
+ readonly id: "subscriptions";
569
+ readonly label: "Subscriptions";
570
+ readonly description: "Inspect and operate subscriptions in BillFn.";
571
+ readonly icon: "billfn:subscriptions";
572
+ readonly risk: "standard";
573
+ readonly idField: "id";
574
+ readonly displayFields: readonly ["id", "planKey", "status", "provider", "currentPeriodEnd", "updatedAt"];
575
+ readonly searchableFields: readonly ["id", "planKey", "priceId", "provider", "status"];
576
+ readonly filterableFields: readonly ["planKey", "provider", "status"];
577
+ readonly sortableFields: readonly ["createdAt", "currentPeriodEnd", "status", "updatedAt"];
578
+ readonly sensitiveFields: readonly [];
579
+ } | {
580
+ readonly id: "entitlements";
581
+ readonly label: "Entitlements";
582
+ readonly description: "Inspect and operate entitlements in BillFn.";
583
+ readonly icon: "billfn:entitlements";
584
+ readonly risk: "standard";
585
+ readonly idField: "id";
586
+ readonly displayFields: readonly ["id", "planKey", "status", "effectiveAt", "expiresAt", "updatedAt"];
587
+ readonly searchableFields: readonly ["id", "planKey", "status"];
588
+ readonly filterableFields: readonly ["planKey", "status"];
589
+ readonly sortableFields: readonly ["createdAt", "effectiveAt", "expiresAt", "updatedAt"];
590
+ readonly sensitiveFields: readonly [];
591
+ } | {
592
+ readonly id: "quotas";
593
+ readonly label: "Quotas";
594
+ readonly description: "Inspect and operate quotas in BillFn.";
595
+ readonly icon: "billfn:quotas";
596
+ readonly risk: "standard";
597
+ readonly idField: "id";
598
+ readonly displayFields: readonly ["id", "name", "status", "updatedAt"];
599
+ readonly searchableFields: readonly ["id", "name", "status"];
600
+ readonly filterableFields: readonly ["status", "createdAt", "updatedAt"];
601
+ readonly sortableFields: readonly ["createdAt", "updatedAt", "name"];
602
+ readonly sensitiveFields: readonly [];
603
+ } | {
604
+ readonly id: "invoices";
605
+ readonly label: "Invoices";
606
+ readonly description: "Inspect and operate invoices in BillFn.";
607
+ readonly icon: "billfn:invoices";
608
+ readonly risk: "standard";
609
+ readonly idField: "id";
610
+ readonly displayFields: readonly ["id", "name", "status", "updatedAt"];
611
+ readonly searchableFields: readonly ["id", "name", "status"];
612
+ readonly filterableFields: readonly ["status", "createdAt", "updatedAt"];
613
+ readonly sortableFields: readonly ["createdAt", "updatedAt", "name"];
614
+ readonly sensitiveFields: readonly [];
615
+ } | {
616
+ readonly id: "payments";
617
+ readonly label: "Payments";
618
+ readonly description: "Inspect and operate payments in BillFn.";
619
+ readonly icon: "billfn:payments";
620
+ readonly risk: "sensitive";
621
+ readonly idField: "id";
622
+ readonly displayFields: readonly ["id", "name", "status", "updatedAt"];
623
+ readonly searchableFields: readonly ["id", "name", "status"];
624
+ readonly filterableFields: readonly ["status", "createdAt", "updatedAt"];
625
+ readonly sortableFields: readonly ["createdAt", "updatedAt", "name"];
626
+ readonly sensitiveFields: readonly ["secret", "token", "credential", "value", "password", "passwd", "apiKey", "privateKey", "authorization", "cookie", "otp", "otpCode", "recoveryCode", "recoveryCodes", "verificationCode", "sessionToken"];
627
+ } | {
628
+ readonly id: "usage";
629
+ readonly label: "Usage";
630
+ readonly description: "Inspect and operate usage in BillFn.";
631
+ readonly icon: "billfn:usage";
632
+ readonly risk: "standard";
633
+ readonly idField: "id";
634
+ readonly displayFields: readonly ["id", "resource", "current", "limit"];
635
+ readonly searchableFields: readonly ["id", "resource"];
636
+ readonly filterableFields: readonly ["resource"];
637
+ readonly sortableFields: readonly ["current", "limit", "resource"];
638
+ readonly sensitiveFields: readonly [];
639
+ } | {
640
+ readonly id: "reconciliation";
641
+ readonly label: "Reconciliation";
642
+ readonly description: "Inspect and operate reconciliation in BillFn.";
643
+ readonly icon: "billfn:reconciliation";
644
+ readonly risk: "standard";
645
+ readonly idField: "id";
646
+ readonly displayFields: readonly ["id", "name", "status", "updatedAt"];
647
+ readonly searchableFields: readonly ["id", "name", "status"];
648
+ readonly filterableFields: readonly ["status", "createdAt", "updatedAt"];
649
+ readonly sortableFields: readonly ["createdAt", "updatedAt", "name"];
650
+ readonly sensitiveFields: readonly [];
651
+ } | {
652
+ readonly id: "revenue";
653
+ readonly label: "Revenue";
654
+ readonly description: "Inspect and operate revenue in BillFn.";
655
+ readonly icon: "billfn:revenue";
656
+ readonly risk: "standard";
657
+ readonly idField: "id";
658
+ readonly displayFields: readonly ["id", "name", "status", "updatedAt"];
659
+ readonly searchableFields: readonly ["id", "name", "status"];
660
+ readonly filterableFields: readonly ["status", "createdAt", "updatedAt"];
661
+ readonly sortableFields: readonly ["createdAt", "updatedAt", "name"];
662
+ readonly sensitiveFields: readonly [];
663
+ })[];
664
+ readonly navigation: readonly [{
665
+ readonly id: "billfn";
666
+ readonly label: "BillFn";
667
+ readonly path: "/modules/billfn";
668
+ readonly icon: "billfn";
669
+ readonly description: "Operate BillFn in the active scope.";
670
+ readonly order: 100;
671
+ }];
672
+ readonly operations: readonly (AdminOperationDefinition & {
673
+ readonly id: BillFnAdminOperationId;
674
+ })[];
675
+ }> & {
676
+ products: {
677
+ list: (input?: BillFnAdminListInput, options?: AdminClientRequestOptions) => Promise<AdminOperationResult<unknown>>;
678
+ get: (input: BillFnAdminGetInput, options?: AdminClientRequestOptions) => Promise<AdminOperationResult<unknown>>;
679
+ };
680
+ plans: {
681
+ list: (input?: BillFnAdminListInput, options?: AdminClientRequestOptions) => Promise<AdminOperationResult<unknown>>;
682
+ get: (input: BillFnAdminGetInput, options?: AdminClientRequestOptions) => Promise<AdminOperationResult<unknown>>;
683
+ };
684
+ prices: {
685
+ list: (input?: BillFnAdminListInput, options?: AdminClientRequestOptions) => Promise<AdminOperationResult<unknown>>;
686
+ get: (input: BillFnAdminGetInput, options?: AdminClientRequestOptions) => Promise<AdminOperationResult<unknown>>;
687
+ };
688
+ subscriptions: {
689
+ change: (input: BillFnChangeSubscriptionInput, options?: AdminClientRequestOptions) => Promise<AdminOperationResult<unknown>>;
690
+ cancel: (input: BillFnCancelSubscriptionInput, options?: AdminClientRequestOptions) => Promise<AdminOperationResult<unknown>>;
691
+ list: (input?: BillFnAdminListInput, options?: AdminClientRequestOptions) => Promise<AdminOperationResult<unknown>>;
692
+ get: (input: BillFnAdminGetInput, options?: AdminClientRequestOptions) => Promise<AdminOperationResult<unknown>>;
693
+ };
694
+ entitlements: {
695
+ list: (input?: BillFnAdminListInput, options?: AdminClientRequestOptions) => Promise<AdminOperationResult<unknown>>;
696
+ get: (input: BillFnAdminGetInput, options?: AdminClientRequestOptions) => Promise<AdminOperationResult<unknown>>;
697
+ };
698
+ usage: {
699
+ list: (input?: BillFnAdminListInput, options?: AdminClientRequestOptions) => Promise<AdminOperationResult<unknown>>;
700
+ get: (input: BillFnAdminGetInput, options?: AdminClientRequestOptions) => Promise<AdminOperationResult<unknown>>;
701
+ };
702
+ payments: {
703
+ refund: (input: BillFnRefundPaymentInput, options?: AdminClientRequestOptions) => Promise<AdminOperationResult<unknown>>;
704
+ };
705
+ reconciliation: {
706
+ run: (input: BillFnReconcileProviderInput, options?: AdminClientRequestOptions) => Promise<AdminOperationResult<unknown>>;
707
+ };
708
+ };
709
+ export interface BillFnAdminService {
710
+ listProducts(input: BillFnAdminListInput, context: AdminOperationContext): Promise<BillFnAdminResult>;
711
+ getProduct(input: BillFnAdminGetInput, context: AdminOperationContext): Promise<BillFnAdminResult>;
712
+ listPlans(input: BillFnAdminListInput, context: AdminOperationContext): Promise<BillFnAdminResult>;
713
+ getPlan(input: BillFnAdminGetInput, context: AdminOperationContext): Promise<BillFnAdminResult>;
714
+ listPrices(input: BillFnAdminListInput, context: AdminOperationContext): Promise<BillFnAdminResult>;
715
+ getPrice(input: BillFnAdminGetInput, context: AdminOperationContext): Promise<BillFnAdminResult>;
716
+ listSubscriptions(input: BillFnAdminListInput, context: AdminOperationContext): Promise<BillFnAdminResult>;
717
+ getSubscription(input: BillFnAdminGetInput, context: AdminOperationContext): Promise<BillFnAdminResult>;
718
+ listEntitlements(input: BillFnAdminListInput, context: AdminOperationContext): Promise<BillFnAdminResult>;
719
+ getEntitlement(input: BillFnAdminGetInput, context: AdminOperationContext): Promise<BillFnAdminResult>;
720
+ listUsage(input: BillFnAdminListInput, context: AdminOperationContext): Promise<BillFnAdminResult>;
721
+ getUsage(input: BillFnAdminGetInput, context: AdminOperationContext): Promise<BillFnAdminResult>;
722
+ changeSubscription(input: BillFnChangeSubscriptionInput, context: AdminOperationContext): Promise<BillFnAdminResult>;
723
+ cancelSubscription(input: BillFnCancelSubscriptionInput, context: AdminOperationContext): Promise<BillFnAdminResult>;
724
+ refundPayment(input: BillFnRefundPaymentInput, context: AdminOperationContext): Promise<BillFnAdminResult>;
725
+ reconcileProvider(input: BillFnReconcileProviderInput, context: AdminOperationContext): Promise<BillFnAdminResult>;
726
+ }
727
+ export declare function createBillFnAdminAdapter(service: BillFnAdminService): AdminCapabilityAdapter;
728
+ export declare const adminCapability: {
729
+ readonly schemaVersion: "1.0";
730
+ readonly id: "billfn";
731
+ readonly displayName: "BillFn";
732
+ readonly version: "1.0.0";
733
+ readonly description: "Function-owned BillFn operator capabilities backed by the configured billing instance.";
734
+ readonly category: "commerce";
735
+ readonly availability: "required-product";
736
+ readonly scopeLevels: readonly ["organization", "workspace", "project", "environment"];
737
+ readonly dependencies: readonly [];
738
+ readonly resources: ({
739
+ readonly id: "customers";
740
+ readonly label: "Customers";
741
+ readonly description: "Inspect and operate customers in BillFn.";
742
+ readonly icon: "billfn:customers";
743
+ readonly risk: "standard";
744
+ readonly idField: "id";
745
+ readonly displayFields: readonly ["id", "name", "status", "updatedAt"];
746
+ readonly searchableFields: readonly ["id", "name", "status"];
747
+ readonly filterableFields: readonly ["status", "createdAt", "updatedAt"];
748
+ readonly sortableFields: readonly ["createdAt", "updatedAt", "name"];
749
+ readonly sensitiveFields: readonly [];
750
+ } | {
751
+ readonly id: "products";
752
+ readonly label: "Products";
753
+ readonly description: "Inspect and operate products in BillFn.";
754
+ readonly icon: "billfn:products";
755
+ readonly risk: "standard";
756
+ readonly idField: "id";
757
+ readonly displayFields: readonly ["id", "productKey", "planCount"];
758
+ readonly searchableFields: readonly ["id", "productKey"];
759
+ readonly filterableFields: readonly ["productKey", "planCount"];
760
+ readonly sortableFields: readonly ["productKey", "planCount"];
761
+ readonly sensitiveFields: readonly [];
762
+ } | {
763
+ readonly id: "plans";
764
+ readonly label: "Plans";
765
+ readonly description: "Inspect and operate plans in BillFn.";
766
+ readonly icon: "billfn:plans";
767
+ readonly risk: "standard";
768
+ readonly idField: "id";
769
+ readonly displayFields: readonly ["id", "displayName", "productKey", "planKey"];
770
+ readonly searchableFields: readonly ["id", "displayName", "productKey", "planKey"];
771
+ readonly filterableFields: readonly ["productKey", "planKey"];
772
+ readonly sortableFields: readonly ["displayName", "productKey", "planKey"];
773
+ readonly sensitiveFields: readonly [];
774
+ } | {
775
+ readonly id: "prices";
776
+ readonly label: "Prices";
777
+ readonly description: "Inspect and operate prices in BillFn.";
778
+ readonly icon: "billfn:prices";
779
+ readonly risk: "standard";
780
+ readonly idField: "id";
781
+ readonly displayFields: readonly ["id", "displayName", "amount", "currency", "interval", "provider"];
782
+ readonly searchableFields: readonly ["id", "displayName", "priceId", "planKey", "productKey", "provider"];
783
+ readonly filterableFields: readonly ["provider", "currency", "kind", "interval", "planKey", "productKey"];
784
+ readonly sortableFields: readonly ["amount", "currency", "displayName", "interval", "provider"];
785
+ readonly sensitiveFields: readonly [];
786
+ } | {
787
+ readonly id: "subscriptions";
788
+ readonly label: "Subscriptions";
789
+ readonly description: "Inspect and operate subscriptions in BillFn.";
790
+ readonly icon: "billfn:subscriptions";
791
+ readonly risk: "standard";
792
+ readonly idField: "id";
793
+ readonly displayFields: readonly ["id", "planKey", "status", "provider", "currentPeriodEnd", "updatedAt"];
794
+ readonly searchableFields: readonly ["id", "planKey", "priceId", "provider", "status"];
795
+ readonly filterableFields: readonly ["planKey", "provider", "status"];
796
+ readonly sortableFields: readonly ["createdAt", "currentPeriodEnd", "status", "updatedAt"];
797
+ readonly sensitiveFields: readonly [];
798
+ } | {
799
+ readonly id: "entitlements";
800
+ readonly label: "Entitlements";
801
+ readonly description: "Inspect and operate entitlements in BillFn.";
802
+ readonly icon: "billfn:entitlements";
803
+ readonly risk: "standard";
804
+ readonly idField: "id";
805
+ readonly displayFields: readonly ["id", "planKey", "status", "effectiveAt", "expiresAt", "updatedAt"];
806
+ readonly searchableFields: readonly ["id", "planKey", "status"];
807
+ readonly filterableFields: readonly ["planKey", "status"];
808
+ readonly sortableFields: readonly ["createdAt", "effectiveAt", "expiresAt", "updatedAt"];
809
+ readonly sensitiveFields: readonly [];
810
+ } | {
811
+ readonly id: "quotas";
812
+ readonly label: "Quotas";
813
+ readonly description: "Inspect and operate quotas in BillFn.";
814
+ readonly icon: "billfn:quotas";
815
+ readonly risk: "standard";
816
+ readonly idField: "id";
817
+ readonly displayFields: readonly ["id", "name", "status", "updatedAt"];
818
+ readonly searchableFields: readonly ["id", "name", "status"];
819
+ readonly filterableFields: readonly ["status", "createdAt", "updatedAt"];
820
+ readonly sortableFields: readonly ["createdAt", "updatedAt", "name"];
821
+ readonly sensitiveFields: readonly [];
822
+ } | {
823
+ readonly id: "invoices";
824
+ readonly label: "Invoices";
825
+ readonly description: "Inspect and operate invoices in BillFn.";
826
+ readonly icon: "billfn:invoices";
827
+ readonly risk: "standard";
828
+ readonly idField: "id";
829
+ readonly displayFields: readonly ["id", "name", "status", "updatedAt"];
830
+ readonly searchableFields: readonly ["id", "name", "status"];
831
+ readonly filterableFields: readonly ["status", "createdAt", "updatedAt"];
832
+ readonly sortableFields: readonly ["createdAt", "updatedAt", "name"];
833
+ readonly sensitiveFields: readonly [];
834
+ } | {
835
+ readonly id: "payments";
836
+ readonly label: "Payments";
837
+ readonly description: "Inspect and operate payments in BillFn.";
838
+ readonly icon: "billfn:payments";
839
+ readonly risk: "sensitive";
840
+ readonly idField: "id";
841
+ readonly displayFields: readonly ["id", "name", "status", "updatedAt"];
842
+ readonly searchableFields: readonly ["id", "name", "status"];
843
+ readonly filterableFields: readonly ["status", "createdAt", "updatedAt"];
844
+ readonly sortableFields: readonly ["createdAt", "updatedAt", "name"];
845
+ readonly sensitiveFields: readonly ["secret", "token", "credential", "value", "password", "passwd", "apiKey", "privateKey", "authorization", "cookie", "otp", "otpCode", "recoveryCode", "recoveryCodes", "verificationCode", "sessionToken"];
846
+ } | {
847
+ readonly id: "usage";
848
+ readonly label: "Usage";
849
+ readonly description: "Inspect and operate usage in BillFn.";
850
+ readonly icon: "billfn:usage";
851
+ readonly risk: "standard";
852
+ readonly idField: "id";
853
+ readonly displayFields: readonly ["id", "resource", "current", "limit"];
854
+ readonly searchableFields: readonly ["id", "resource"];
855
+ readonly filterableFields: readonly ["resource"];
856
+ readonly sortableFields: readonly ["current", "limit", "resource"];
857
+ readonly sensitiveFields: readonly [];
858
+ } | {
859
+ readonly id: "reconciliation";
860
+ readonly label: "Reconciliation";
861
+ readonly description: "Inspect and operate reconciliation in BillFn.";
862
+ readonly icon: "billfn:reconciliation";
863
+ readonly risk: "standard";
864
+ readonly idField: "id";
865
+ readonly displayFields: readonly ["id", "name", "status", "updatedAt"];
866
+ readonly searchableFields: readonly ["id", "name", "status"];
867
+ readonly filterableFields: readonly ["status", "createdAt", "updatedAt"];
868
+ readonly sortableFields: readonly ["createdAt", "updatedAt", "name"];
869
+ readonly sensitiveFields: readonly [];
870
+ } | {
871
+ readonly id: "revenue";
872
+ readonly label: "Revenue";
873
+ readonly description: "Inspect and operate revenue in BillFn.";
874
+ readonly icon: "billfn:revenue";
875
+ readonly risk: "standard";
876
+ readonly idField: "id";
877
+ readonly displayFields: readonly ["id", "name", "status", "updatedAt"];
878
+ readonly searchableFields: readonly ["id", "name", "status"];
879
+ readonly filterableFields: readonly ["status", "createdAt", "updatedAt"];
880
+ readonly sortableFields: readonly ["createdAt", "updatedAt", "name"];
881
+ readonly sensitiveFields: readonly [];
882
+ })[];
883
+ readonly navigation: readonly [{
884
+ readonly id: "billfn";
885
+ readonly label: "BillFn";
886
+ readonly path: "/modules/billfn";
887
+ readonly icon: "billfn";
888
+ readonly description: "Operate BillFn in the active scope.";
889
+ readonly order: 100;
890
+ }];
891
+ readonly operations: readonly (AdminOperationDefinition & {
892
+ readonly id: BillFnAdminOperationId;
893
+ })[];
894
+ };
895
+ export declare const createAdminAdapter: typeof createBillFnAdminAdapter;
896
+ export { createBillFnDomainAdminService, type BillFnDomainAdminServiceOptions, } from "./domain-service.js";
897
+ //# sourceMappingURL=index.d.ts.map