-
Notifications
You must be signed in to change notification settings - Fork 190
Expand file tree
/
Copy pathschemas.ts
More file actions
5455 lines (4670 loc) · 154 KB
/
Copy pathschemas.ts
File metadata and controls
5455 lines (4670 loc) · 154 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import { z } from 'zod'
export const labels = z
.record(z.string(), z.string())
.describe(
'Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "\\_".',
)
export const currencyCode = z
.string()
.min(3)
.max(3)
.regex(new RegExp('^[A-Z]{3}$'))
.describe(
'Three-letter [ISO4217](https://www.iso.org/iso-4217-currency-codes.html) currency code. Custom three-letter currency codes are also supported for convenience.',
)
export const numeric = z
.string()
.regex(new RegExp('^\\-?[0-9]+(\\.[0-9]+)?$'))
.describe('Numeric represents an arbitrary precision number.')
export const cursorPaginationQueryPage = z
.object({
size: z
.number()
.int()
.optional()
.describe('The number of items to include per page.'),
after: z
.string()
.optional()
.describe(
'Request the next page of data, starting with the item after this parameter.',
),
before: z
.string()
.optional()
.describe(
'Request the previous page of data, starting with the item before this parameter.',
),
})
.describe('Determines which page of the collection to retrieve.')
export const stringFieldFilter = z
.union([
z.string(),
z.object({
eq: z
.string()
.optional()
.describe('Value strictly equals the given string value.'),
neq: z
.string()
.optional()
.describe('Value does not equal the given string value.'),
contains: z
.string()
.optional()
.describe('Value contains the given string value (fuzzy match).'),
ocontains: z
.array(z.string())
.optional()
.describe(
'Returns entities that fuzzy-match any of the comma-delimited phrases in the filter string.',
),
oeq: z
.array(z.string())
.optional()
.describe(
'Returns entities that exact match any of the comma-delimited phrases in the filter string.',
),
gt: z
.string()
.optional()
.describe(
'Value is greater than the given string value (lexicographic compare).',
),
gte: z
.string()
.optional()
.describe(
'Value is greater than or equal to the given string value (lexicographic compare).',
),
lt: z
.string()
.optional()
.describe(
'Value is less than the given string value (lexicographic compare).',
),
lte: z
.string()
.optional()
.describe(
'Value is less than or equal to the given string value (lexicographic compare).',
),
exists: z
.boolean()
.optional()
.describe(
'When true, the field must be present (non-null); when false, the field must be absent (null).',
),
}),
])
.describe(
'Filters on the given string field value by either exact or fuzzy match. All properties are optional; provide exactly one to specify the comparison.',
)
export const ulid = z
.string()
.regex(new RegExp('^[0-7][0-9A-HJKMNP-TV-Z]{25}$'))
.describe('ULID (Universally Unique Lexicographically Sortable Identifier).')
export const dateTime = z
.string()
.datetime()
.describe(
'[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.',
)
export const sortQuery = z
.object({
by: z.string().describe('The attribute to sort by.'),
order: z
.union([z.literal('asc'), z.literal('desc')])
.optional()
.default('asc')
.describe('The sort order. `asc` for ascending, `desc` for descending.'),
})
.describe(
'Sort query. The `asc` suffix is optional as the default sort order is ascending. The `desc` suffix is used to specify a descending order.',
)
export const ingestedEventValidationError = z
.object({
code: z.string().describe('The machine readable code of the error.'),
message: z
.string()
.describe('The human readable description of the error.'),
attributes: z
.record(z.string(), z.unknown())
.optional()
.describe('Additional attributes.'),
})
.describe('Event validation errors.')
export const cursorMetaPage = z
.object({
first: z.string().optional().describe('URI to the first page.'),
last: z.string().optional().describe('URI to the last page.'),
next: z.string().optional().describe('URI to the next page.'),
previous: z.string().optional().describe('URI to the previous page.'),
size: z.number().int().optional().describe('Requested page size.'),
})
.describe('Cursor pagination metadata.')
export const invalidRules = z
.enum([
'required',
'is_array',
'is_base64',
'is_boolean',
'is_date_time',
'is_integer',
'is_null',
'is_number',
'is_object',
'is_string',
'is_uuid',
'is_fqdn',
'is_arn',
'unknown_property',
'missing_reference',
'is_label',
'matches_regex',
'invalid',
'is_supported_network_availability_zone_list',
'is_supported_network_cidr_block',
'is_supported_provider_region',
'type',
])
.describe('The validation rule that a parameter failed.')
export const invalidParameterMinimumRule = z
.enum([
'min_length',
'min_digits',
'min_lowercase',
'min_uppercase',
'min_symbols',
'min_items',
'min',
])
.describe('Minimum-length (or minimum-value) validation rules.')
export const invalidParameterMaximumRule = z
.enum(['max_length', 'max_items', 'max'])
.describe('Maximum-length (or maximum-value) validation rules.')
export const invalidParameterChoiceRule = z
.enum(['enum'])
.describe('The enum validation rule.')
export const invalidParameterDependentRule = z
.enum(['dependent_fields'])
.describe('The dependent-fields validation rule.')
export const baseError = z
.intersection(
z.object({
type: z
.string()
.default('about:blank')
.describe('Type contains a URI that identifies the problem type.'),
status: z
.number()
.int()
.describe(
'The HTTP status code generated by the origin server for this occurrence of the problem.',
),
title: z
.string()
.describe('A a short, human-readable summary of the problem type.'),
detail: z
.string()
.describe(
'A human-readable explanation specific to this occurrence of the problem.',
),
instance: z
.string()
.describe(
'A URI reference that identifies the specific occurrence of the problem.',
),
}),
z.record(z.string(), z.unknown()),
)
.describe('Standard error response.')
export const booleanFieldFilter = z
.union([
z.boolean(),
z.object({
eq: z
.boolean()
.describe('Value strictly equals the given boolean value.'),
}),
])
.describe('Filter by a boolean value (true/false).')
export const eventSubject = z
.object({
key: z.string().min(1).describe('The key of the subject.'),
})
.describe('Subject of an event.')
export const resourceKey = z
.string()
.min(1)
.max(64)
.regex(new RegExp('^[a-z0-9]+(?:_[a-z0-9]+)*$'))
.describe('A key is a unique string that is used to identify a resource.')
export const meterAggregation = z
.union([
z.literal('sum'),
z.literal('count'),
z.literal('unique_count'),
z.literal('avg'),
z.literal('min'),
z.literal('max'),
z.literal('latest'),
])
.describe('The aggregation type to use for the meter.')
export const pageMeta = z
.object({
number: z.number().int().describe('Page number.'),
size: z.number().int().describe('Page size.'),
total: z
.number()
.int()
.describe('Total number of items in the collection.'),
})
.describe('Pagination information.')
export const meterQueryGranularity = z
.union([
z.literal('PT1M'),
z.literal('PT1H'),
z.literal('P1D'),
z.literal('P1M'),
])
.describe(
'The granularity of the time grouping. Time durations are specified in ISO 8601 format.',
)
export const queryFilterString = z
.object({
eq: z
.string()
.optional()
.describe('The attribute equals the provided value.'),
neq: z
.string()
.optional()
.describe('The attribute does not equal the provided value.'),
in: z
.array(z.string())
.min(1)
.max(100)
.optional()
.describe('The attribute is one of the provided values.'),
nin: z
.array(z.string())
.min(1)
.max(100)
.optional()
.describe('The attribute is not one of the provided values.'),
contains: z
.string()
.optional()
.describe('The attribute contains the provided value.'),
ncontains: z
.string()
.optional()
.describe('The attribute does not contain the provided value.'),
get and() {
return z
.array(queryFilterString)
.min(1)
.max(10)
.optional()
.describe('Combines the provided filters with a logical AND.')
},
get or() {
return z
.array(queryFilterString)
.min(1)
.max(10)
.optional()
.describe('Combines the provided filters with a logical OR.')
},
})
.describe(
'A query filter for a string attribute. Operators are mutually exclusive, only one operator is allowed at a time.',
)
export const externalResourceKey = z
.string()
.min(1)
.max(256)
.describe(
'ExternalResourceKey is a unique string that is used to identify a resource in an external system.',
)
export const usageAttributionSubjectKey = z
.string()
.min(1)
.describe('Subject key.')
export const countryCode = z
.string()
.min(2)
.max(2)
.regex(new RegExp('^[A-Z]{2}$'))
.describe(
'[ISO 3166-1](https://www.iso.org/iso-3166-country-codes.html) alpha-2 country code. Custom two-letter country codes are also supported for convenience.',
)
export const appStripeCreateCheckoutSessionBillingAddressCollection = z
.enum(['auto', 'required'])
.describe(
"Controls whether Checkout collects the customer's billing address.",
)
export const appStripeCreateCheckoutSessionCustomerUpdateBehavior = z
.enum(['auto', 'never'])
.describe('Behavior for updating customer fields from checkout session.')
export const appStripeCreateCheckoutSessionConsentCollectionPaymentMethodReuseAgreementPosition =
z
.enum(['auto', 'hidden'])
.describe('Position of payment method reuse agreement in the UI.')
export const appStripeCreateCheckoutSessionConsentCollectionPromotions = z
.enum(['auto', 'none'])
.describe('Promotional communication consent collection setting.')
export const appStripeCreateCheckoutSessionConsentCollectionTermsOfService = z
.enum(['none', 'required'])
.describe('Terms of service acceptance requirement.')
export const appStripeCheckoutSessionCustomTextParams = z
.object({
after_submit: z
.object({
message: z
.string()
.max(1200)
.optional()
.describe('The custom message text (max 1200 characters).'),
})
.optional()
.describe('Text displayed after the payment confirmation button.'),
shipping_address: z
.object({
message: z
.string()
.max(1200)
.optional()
.describe('The custom message text (max 1200 characters).'),
})
.optional()
.describe('Text displayed alongside shipping address collection.'),
submit: z
.object({
message: z
.string()
.max(1200)
.optional()
.describe('The custom message text (max 1200 characters).'),
})
.optional()
.describe('Text displayed alongside the payment confirmation button.'),
terms_of_service_acceptance: z
.object({
message: z
.string()
.max(1200)
.optional()
.describe('The custom message text (max 1200 characters).'),
})
.optional()
.describe('Text replacing the default terms of service agreement text.'),
})
.describe('Custom text displayed at various stages of the checkout flow.')
export const appStripeCheckoutSessionUiMode = z
.enum(['embedded', 'hosted'])
.describe('Checkout Session UI mode.')
export const appStripeCreateCheckoutSessionRedirectOnCompletion = z
.enum(['always', 'if_required', 'never'])
.describe('Redirect behavior for embedded checkout sessions.')
export const appStripeCreateCheckoutSessionTaxIdCollectionRequired = z
.enum(['if_supported', 'never'])
.describe('Tax ID collection requirement level.')
export const appStripeCheckoutSessionMode = z
.enum(['setup'])
.describe(
'Stripe Checkout Session mode. Determines the primary purpose of the checkout session.',
)
export const appStripeCreateCustomerPortalSessionOptions = z
.object({
configuration_id: z
.string()
.optional()
.describe(
'The ID of an existing [Stripe configuration](https://docs.stripe.com/api/customer_portal/configurations) to use for this session, describing its functionality and features. If not specified, the session uses the default configuration.',
),
locale: z
.string()
.optional()
.describe(
"The IETF [language tag](https://docs.stripe.com/api/customer_portal/sessions/create#create_portal_session-locale) of the locale customer portal is displayed in. If blank or `auto`, the customer's preferred_locales or browser's locale is used.",
),
return_url: z
.string()
.optional()
.describe(
'The [URL to redirect](https://docs.stripe.com/api/customer_portal/sessions/create#create_portal_session-return_url) the customer to after they have completed their requested actions.',
),
})
.describe('Request to create a Stripe Customer Portal Session.')
export const entitlementType = z
.enum(['metered', 'static', 'boolean'])
.describe('The type of the entitlement.')
export const createLabels = z
.record(z.string(), z.string())
.describe(
'Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "\\_".',
)
export const creditFundingMethod = z
.enum(['none', 'invoice', 'external'])
.describe(
'The funding method describes how the grant is funded. - `none`: No funding workflow applies, for example promotional grants - `invoice`: The grant is funded by an in-system invoice flow - `external`: The grant is funded outside the system (e.g., wire transfer, external invoice, or manual reconciliation)',
)
export const creditAvailabilityPolicy = z
.enum(['on_creation'])
.describe(
'When credits become available for consumption. - `on_creation`: Credits are available as soon as the grant is created. - `on_authorization`: Credits are available once the payment is authorized. - `on_settlement`: Credits are available once the payment is settled.',
)
export const taxBehavior = z
.enum(['inclusive', 'exclusive'])
.describe(
'Tax behavior. This enum is used to specify whether tax is included in the price or excluded from the price.',
)
export const iso8601Duration = z
.string()
.regex(
new RegExp(
'^P(?:\\d+(?:\\.\\d+)?Y)?(?:\\d+(?:\\.\\d+)?M)?(?:\\d+(?:\\.\\d+)?W)?(?:\\d+(?:\\.\\d+)?D)?(?:T(?:\\d+(?:\\.\\d+)?H)?(?:\\d+(?:\\.\\d+)?M)?(?:\\d+(?:\\.\\d+)?S)?)?$',
),
)
.describe(
'[ISO 8601 Duration](https://docs.digi.com/resources/documentation/digidocs/90001488-13/reference/r_iso_8601_duration_format.htm) string.',
)
export const creditPurchasePaymentSettlementStatus = z
.enum(['pending', 'authorized', 'settled'])
.describe(
'Credit purchase payment settlement status. - `pending`: Payment has been initiated and is not yet authorized. - `authorized`: Payment has been authorized. - `settled`: Payment has been settled.',
)
export const creditGrantStatus = z
.enum(['pending', 'active', 'expired', 'voided'])
.describe(
'Credit grant lifecycle status. - `pending`: The credit block has been created but is not yet valid. (`effective_at` is in the future or availability_policy is not met) - `active`: The credit block is currently valid and eligible for consumption. (`effective_at` is in the past, `expires_at` is in the future and availability_policy is met) - `expired`: The credit block expired with remaining unused balance, `expires_at` time has passed. - `voided`: The credit block was voided. Remaining balance is forfeited.',
)
export const stringFieldFilterExact = z
.union([
z.string(),
z.object({
eq: z
.string()
.optional()
.describe('Value strictly equals the given string value.'),
oeq: z
.array(z.string())
.optional()
.describe(
'Returns entities that exact match any of the comma-delimited phrases in the filter string.',
),
neq: z
.string()
.optional()
.describe('Value does not equal the given string value.'),
}),
])
.describe(
'Filters on the given string field value by exact match. All properties are optional; provide exactly one to specify the comparison.',
)
export const creditTransactionType = z
.enum(['funded', 'consumed', 'expired'])
.describe(
'The type of the credit transaction. - `funded`: Credit granted and available for consumption. - `consumed`: Credit consumed by usage or fees. - `expired`: Credit removed because it expired before being used.',
)
export const chargesExpand = z
.enum(['real_time_usage'])
.describe(
"Expands for customer charges. Values: - `real_time_usage`: The charge's real-time usage.",
)
export const resourceManagedBy = z
.enum(['manual', 'system', 'subscription'])
.describe(
'Identifies which system manages a resource. Values: - `manual`: The resource is managed manually (overridden by our API users). - `system`: The resource is managed by the system. - `subscription`: The resource is managed by the subscription.',
)
export const chargeStatus = z
.enum(['created', 'active', 'final', 'deleted'])
.describe(
'Lifecycle status of a charge. Values: - `created`: The charge has been created but is not active yet. - `active`: The charge is active. - `final`: The charge is fully finalized and no further changes are expected. - `deleted`: The charge has been deleted.',
)
export const priceFree = z
.object({
type: z.literal('free').describe('The type of the price.'),
})
.describe('Free price.')
export const settlementMode = z
.enum(['credit_then_invoice', 'credit_only'])
.describe(
'Settlement mode for billing. Values: - `credit_then_invoice`: Credits are applied first, then any remainder is invoiced. - `credit_only`: Usage is settled exclusively against credits.',
)
export const taxConfigStripe = z
.object({
code: z
.string()
.regex(new RegExp('^txcd_\\d{8}$'))
.describe('Product [tax code](https://docs.stripe.com/tax/tax-codes).'),
})
.describe('The tax config for Stripe.')
export const taxConfigExternalInvoicing = z
.object({
code: z
.string()
.max(64)
.describe(
'The tax code should be interpreted by the external invoicing provider.',
),
})
.describe('External invoicing tax config.')
export const pricePaymentTerm = z
.union([z.literal('in_advance'), z.literal('in_arrears')])
.describe('The payment term of a flat price.')
export const flatFeeDiscounts = z
.object({
percentage: z
.number()
.nonnegative()
.lte(100)
.optional()
.describe('Percentage discount applied to the price (0–100).'),
})
.describe(
'Discounts applicable to flat fee charges. This is the same as `ProductCatalog.Discounts` but without the `usage` field, which is not applicable to flat fee charges.',
)
export const rateCardProrationMode = z
.enum(['no_proration', 'prorate_prices'])
.describe(
'The proration mode of the rate card. Values: - `no_proration`: No proration. - `prorate_prices`: Prorate the price based on the time remaining in the billing period.',
)
export const subscriptionStatus = z
.enum(['active', 'inactive', 'canceled', 'scheduled'])
.describe('Subscription status.')
export const subscriptionEditTimingEnum = z
.enum(['immediate', 'next_billing_cycle'])
.describe(
'Subscription edit timing. When immediate, the requested changes take effect immediately. When next_billing_cycle, the requested changes take effect at the next billing cycle.',
)
export const appType = z
.enum(['sandbox', 'stripe', 'external_invoicing'])
.describe('The type of the app.')
export const appStatus = z
.enum(['ready', 'unauthorized'])
.describe('Connection status of an installed app.')
export const taxIdentificationCode = z
.string()
.min(1)
.max(32)
.describe(
'Tax identifier code is a normalized tax code shown on the original identity document.',
)
export const workflowCollectionAlignmentSubscription = z
.object({
type: z.literal('subscription').describe('The type of alignment.'),
})
.describe(
'BillingWorkflowCollectionAlignmentSubscription specifies the alignment for collecting the pending line items into an invoice.',
)
export const workflowInvoicingSettings = z
.object({
auto_advance: z
.boolean()
.optional()
.default(true)
.describe(
'Whether to automatically issue the invoice after the draftPeriod has passed.',
),
draft_period: z
.string()
.optional()
.default('P0D')
.describe(
'The period for the invoice to be kept in draft status for manual reviews.',
),
progressive_billing: z
.boolean()
.optional()
.default(true)
.describe('Should progressive billing be allowed for this workflow?'),
})
.describe('Invoice settings for a billing workflow.')
export const workflowPaymentChargeAutomaticallySettings = z
.object({
collection_method: z
.literal('charge_automatically')
.describe('The collection method for the invoice.'),
})
.describe(
'Payment settings for a billing workflow when the collection method is charge automatically.',
)
export const workflowPaymentSendInvoiceSettings = z
.object({
collection_method: z
.literal('send_invoice')
.describe('The collection method for the invoice.'),
due_after: z
.string()
.optional()
.default('P30D')
.describe(
"The period after which the invoice is due. With some payment solutions it's only applicable for manual collection method.",
),
})
.describe(
'Payment settings for a billing workflow when the collection method is send invoice.',
)
export const currencyType = z
.enum(['fiat', 'custom'])
.describe(
'Currency type for custom currencies. It should be a unique code but not conflicting with any existing standard currency codes.',
)
export const currencyCodeCustom = z
.string()
.min(3)
.max(24)
.describe(
'Custom currency code. It should be a unique code but not conflicting with any existing fiat currency codes.',
)
export const featureLlmTokenType = z
.enum([
'input',
'output',
'cache_read',
'cache_write',
'reasoning',
'request',
'response',
])
.describe('Token type for LLM cost lookup.')
export const llmCostProvider = z
.object({
id: z
.string()
.describe('Identifier of the provider, e.g., "openai", "anthropic".'),
name: z
.string()
.describe('Name of the provider, e.g., "OpenAI", "Anthropic".'),
})
.describe('LLM Provider')
export const llmCostModel = z
.object({
id: z
.string()
.describe('Identifier of the model, e.g., "gpt-4", "claude-3-5-sonnet".'),
name: z
.string()
.describe('Name of the model, e.g., "GPT-4", "Claude 3.5 Sonnet".'),
})
.describe('LLM Model')
export const llmCostPriceSource = z
.enum(['manual', 'system'])
.describe('Identifies where an LLM cost price came from.')
export const planStatus = z
.enum(['draft', 'active', 'archived', 'scheduled'])
.describe(
'The status of a plan. - `draft`: The plan has not yet been published and can be edited. - `active`: The plan is published and can be used in subscriptions. - `archived`: The plan is no longer available for use. - `scheduled`: The plan is scheduled to be published at a future date.',
)
export const rateCardStaticEntitlement = z
.object({
type: z.literal('static').describe('The type of the entitlement template.'),
config: z
.unknown()
.describe(
'The entitlement config as a JSON object. Returned when checking entitlement access; useful for configuring fine-grained access settings implemented in your own system.',
),
})
.describe('The entitlement template of a static entitlement.')
export const rateCardBooleanEntitlement = z
.object({
type: z
.literal('boolean')
.describe('The type of the entitlement template.'),
})
.describe('The entitlement template of a boolean entitlement.')
export const productCatalogValidationError = z
.object({
code: z.string().describe('Machine-readable error code.'),
message: z.string().describe('Human-readable description of the error.'),
attributes: z
.record(z.string(), z.unknown())
.optional()
.describe('Additional structured context.'),
field: z.string().describe('The path to the field.'),
})
.describe('Validation errors providing detailed description of the issue.')
export const addonInstanceType = z
.enum(['single', 'multiple'])
.describe(
'The instanceType of the add-on. - `single`: Can be added to a subscription only once. - `multiple`: Can be added to a subscription more than once.',
)
export const addonStatus = z
.enum(['draft', 'active', 'archived'])
.describe(
'The status of the add-on defined by the `effective_from` and `effective_to` properties. - `draft`: The add-on has not yet been published and can be edited. - `active`: The add-on is published and available for use. - `archived`: The add-on is no longer available for use.',
)
export const governanceQueryRequestCustomers = z
.object({
keys: z
.array(z.string())
.min(1)
.max(100)
.describe(
'Each entry can be a customer `key` or a usage-attribution subject `key`. Identifiers that cannot be resolved to a customer are reported in the response `errors` array.',
),
})
.describe('List of customer identifiers to evaluate access for.')
export const governanceQueryRequestFeatures = z
.object({
keys: z
.array(z.string())
.min(1)
.max(100)
.describe('List of feature keys to evaluate access for.'),
})
.describe(
'Optional list of feature keys to evaluate access for. If omitted, all features available in the organization are returned. Providing this list is recommended to reduce the response size and the load on the backend services.',
)
export const governanceFeatureAccessReasonCode = z
.enum([
'unknown',
'usage_limit_reached',
'feature_unavailable',
'feature_not_found',
'no_credit_available',
])
.describe('Machine-readable reason code for denied feature access.')
export const governanceQueryErrorCode = z
.enum(['unknown', 'customer_not_found'])
.describe('Error code for a governance query failure.')
export const queryFilterInteger = z
.object({
eq: z
.number()
.int()
.optional()
.describe('The attribute equals the provided value.'),
neq: z
.number()
.int()
.optional()
.describe('The attribute does not equal the provided value.'),
in: z
.array(z.number().int())
.min(1)
.max(100)
.optional()
.describe('The attribute is one of the provided values.'),
nin: z
.array(z.number().int())
.min(1)
.max(100)
.optional()
.describe('The attribute is not one of the provided values.'),
gt: z
.number()
.int()
.optional()
.describe('The attribute is greater than the provided value.'),
gte: z
.number()
.int()
.optional()
.describe(
'The attribute is greater than or equal to the provided value.',
),
lt: z
.number()
.int()
.optional()
.describe('The attribute is less than the provided value.'),
lte: z
.number()
.int()
.optional()
.describe('The attribute is less than or equal to the provided value.'),
get and() {
return z
.array(queryFilterInteger)
.min(1)
.max(10)
.optional()
.describe('Combines the provided filters with a logical AND.')
},
get or() {
return z
.array(queryFilterInteger)
.min(1)
.max(10)
.optional()
.describe('Combines the provided filters with a logical OR.')
},
})
.describe(
'A query filter for an integer attribute. Operators are mutually exclusive, only one operator is allowed at a time.',
)
export const queryFilterFloat = z
.object({
gt: z
.number()
.optional()
.describe('The attribute is greater than the provided value.'),
gte: z
.number()
.optional()
.describe(
'The attribute is greater than or equal to the provided value.',
),
lt: z