@kaitencloud/graphql-schema 1.0.3 → 2.0.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/schema.graphqls +376 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaitencloud/graphql-schema",
3
- "version": "1.0.3",
3
+ "version": "2.0.0",
4
4
  "description": "Kaiten API GraphQL schema: the gqlgen fragments, concatenated, published for downstream SDKs.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
package/schema.graphqls CHANGED
@@ -29,6 +29,154 @@ type Query {
29
29
  _health: String!
30
30
  }
31
31
 
32
+ """
33
+ An add-on version an instance holds, and how many units.
34
+ """
35
+ type InstanceAddon {
36
+ id: UUID!
37
+ addonId: UUID!
38
+ addonSlug: String!
39
+ familySlug: String!
40
+ name: String!
41
+ quantity: Int!
42
+ """The most one instance may hold; null when unbounded."""
43
+ maxQuantity: Int
44
+ """
45
+ A decrease scheduled for the next boundary, 0 for a removal; null when
46
+ nothing is scheduled.
47
+ """
48
+ pendingQuantity: Int
49
+ attachedAt: Time!
50
+ }
51
+
52
+ extend type Instance {
53
+ """
54
+ The add-ons the instance holds now, oldest attachment first. Like the REST
55
+ list, it needs billing to be enabled for the organization.
56
+ """
57
+ addons: [InstanceAddon!]!
58
+ }
59
+
60
+ """The lifecycle of an add-on version."""
61
+ enum AddonLifecycleState {
62
+ DRAFT
63
+ PUBLISHED
64
+ ARCHIVED
65
+ }
66
+
67
+ """How a mid-period increase of an add-on family's ADVANCE add-ons is billed."""
68
+ enum IncreaseBilling {
69
+ TRUE_UP
70
+ NEXT_BOUNDARY
71
+ }
72
+
73
+ """
74
+ An add-on version: what a voucher names an add-on by, and the prices it
75
+ is sold at. The versions of one product share a name, so the version tells them
76
+ apart.
77
+ """
78
+ type Addon {
79
+ id: UUID!
80
+ slug: String!
81
+ """The family the version belongs to."""
82
+ familySlug: String!
83
+ name: String!
84
+ description: String!
85
+ """The version number in its family."""
86
+ version: Int!
87
+ versionName: String!
88
+ """The version the family resolves to. Only a PUBLISHED version."""
89
+ isDefault: Boolean!
90
+ lifecycleState: AddonLifecycleState!
91
+ """How this version is sold."""
92
+ pricingType: PricingType!
93
+ """The most one instance may hold; null when unbounded."""
94
+ maxQuantity: Int
95
+ """The family's: how a mid-period increase of its ADVANCE add-ons is billed."""
96
+ increaseBilling: IncreaseBilling!
97
+ """The version's prices in display order; status narrows them."""
98
+ prices(status: PriceStatus): [AddonPrice!]!
99
+ }
100
+
101
+ """
102
+ A price of an add-on version. It has the shape of a licence price.
103
+ Amounts are in minor units of currency; unitAmountDecimal is the amount.
104
+ """
105
+ type AddonPrice {
106
+ id: UUID!
107
+ billingModel: PriceBillingModel!
108
+ billingTiming: PriceBillingTiming!
109
+ """Null on a metered price."""
110
+ billingPeriod: PriceBillingPeriod
111
+ currency: String!
112
+ """The amount in minor units, up to 12 decimal places."""
113
+ unitAmountDecimal: String!
114
+ """The slug of the entitlement a metered price measures; null on a flat fee."""
115
+ meteredEntitlement: String
116
+ """Measured units in one sale unit of a metered price; null on a flat fee."""
117
+ saleUnitFactor: String
118
+ displayLabel: String
119
+ displayOrder: Int!
120
+ isDefault: Boolean!
121
+ status: PriceStatus!
122
+ deprecatedAt: Time
123
+ }
124
+
125
+ """
126
+ A cursor-paginated page of add-on versions.
127
+ """
128
+ type AddonPage {
129
+ items: [Addon!]!
130
+ """Opaque cursor for the next page. Null when hasMore is false."""
131
+ nextCursor: String
132
+ hasMore: Boolean!
133
+ }
134
+
135
+ extend type Query {
136
+ """
137
+ The organization's add-on versions, newest first, cursor-paginated. Like the
138
+ REST list, it needs billing to be enabled for the organization.
139
+ """
140
+ addons(limit: Int, cursor: String): AddonPage!
141
+ }
142
+
143
+ """The status of a subscription. INCOMPLETE: a public checkout waiting for its first payment."""
144
+ enum SubscriptionStatus {
145
+ INCOMPLETE
146
+ TRIAL
147
+ ACTIVE
148
+ PAST_DUE
149
+ CANCELED
150
+ }
151
+
152
+ """The payment provider a subscription's invoices go to."""
153
+ enum ProviderKind {
154
+ NOOP
155
+ STRIPE
156
+ }
157
+
158
+ """
159
+ What the console's instance lists show of an instance's subscription. The
160
+ whole subscription is GET /instances/{instanceSlug}/billing.
161
+ """
162
+ type InstanceBillingSummary {
163
+ status: SubscriptionStatus!
164
+ providerKind: ProviderKind!
165
+ currentPeriodEnd: Time!
166
+ cancelAtPeriodEnd: Boolean!
167
+ pastDueSince: Time
168
+ trialEndsAt: Time
169
+ }
170
+
171
+ extend type Instance {
172
+ """
173
+ The instance's subscription; null when it was never subscribed. Requires
174
+ read:billing and billing enabled for the organization: fetch it in a
175
+ document of its own, once billing is enabled.
176
+ """
177
+ billing: InstanceBillingSummary
178
+ }
179
+
32
180
  """
33
181
  Component represents a software component, optionally included in releases.
34
182
  """
@@ -73,6 +221,8 @@ type Customer {
73
221
  name: String!
74
222
  slug: String!
75
223
  externalCustomerId: String
224
+ """Where the customer's invoices are sent. Personal data."""
225
+ billingEmail: String
76
226
  domain: String
77
227
  integrations: Map!
78
228
  createdBy: User!
@@ -201,12 +351,15 @@ enum EntitlementResetPeriod {
201
351
  }
202
352
 
203
353
  """
204
- Phase of a periodic usage window: CALENDAR (UTC calendar-aligned) or
205
- LICENSE_START (phased off the instance's license start date).
354
+ Phase of a periodic usage window: CALENDAR (UTC calendar-aligned),
355
+ LICENSE_START (phased off the instance's license start date) or
356
+ BILLING_PERIOD (phased off the instance's live subscription's billing anchor,
357
+ LICENSE_START without one; with resetPeriod MONTH or YEAR only).
206
358
  """
207
359
  enum EntitlementResetAnchor {
208
360
  CALENDAR
209
361
  LICENSE_START
362
+ BILLING_PERIOD
210
363
  }
211
364
 
212
365
  """
@@ -319,6 +472,67 @@ extend type Query {
319
472
  entitlements(limit: Int, cursor: String): EntitlementPage!
320
473
  }
321
474
 
475
+ """
476
+ How an exception sets its entitlement: SET works on every type, ADD and
477
+ UNLIMITED on NUMBER and NUMBER_AI_CREDIT only.
478
+ """
479
+ enum EntitlementExceptionKind {
480
+ SET
481
+ ADD
482
+ UNLIMITED
483
+ }
484
+
485
+ """
486
+ An exception's status at the read.
487
+ """
488
+ enum EntitlementExceptionStatus {
489
+ SCHEDULED
490
+ ACTIVE
491
+ EXPIRED
492
+ REVOKED
493
+ }
494
+
495
+ """
496
+ Which exceptions of an instance to list.
497
+ """
498
+ enum EntitlementExceptionFilter {
499
+ """Neither revoked nor ended, scheduled ones included."""
500
+ ACTIVE
501
+ """Every exception of the instance, revoked and ended ones included."""
502
+ ALL
503
+ }
504
+
505
+ """
506
+ The vendor's dated decision on one entitlement of one instance, without a
507
+ code: the last layer of its effective entitlements. Never gated by billing.
508
+ """
509
+ type EntitlementException {
510
+ id: UUID!
511
+ entitlementSlug: String!
512
+ entitlementType: EntitlementType!
513
+ kind: EntitlementExceptionKind!
514
+ """
515
+ The value in the {type, value} shape of a licence grant; null for UNLIMITED.
516
+ """
517
+ value: Map
518
+ startsAt: Time!
519
+ """Null: no end."""
520
+ endsAt: Time
521
+ """Why the vendor decided it."""
522
+ reason: String!
523
+ status: EntitlementExceptionStatus!
524
+ createdAt: Time!
525
+ revokedAt: Time
526
+ }
527
+
528
+ extend type Instance {
529
+ """
530
+ The instance's entitlement exceptions, latest start first, as
531
+ GET /instances/{instanceSlug}/entitlement-exceptions lists them.
532
+ """
533
+ entitlementExceptions(filter: EntitlementExceptionFilter = ACTIVE): [EntitlementException!]!
534
+ }
535
+
322
536
  """
323
537
  AuditTrail records a single domain event captured from the outbox CDC pipeline.
324
538
  """
@@ -332,6 +546,19 @@ type AuditTrail {
332
546
  timestamp: Time!
333
547
  """Event payload as a JSON object. Event-specific data such as status lives here."""
334
548
  payload: Map
549
+ """Who the event is recorded under; null for an entry recorded before actors were."""
550
+ actor: AuditActor
551
+ }
552
+
553
+ """
554
+ The user an audit entry is recorded under: a person, a service account, or
555
+ Kaiten itself ("Kaiten (system)"), which records jobs and anonymous checkouts.
556
+ """
557
+ type AuditActor {
558
+ id: UUID!
559
+ name: String!
560
+ """USER, SERVICE or SYSTEM."""
561
+ kind: String!
335
562
  }
336
563
 
337
564
  """
@@ -394,6 +621,18 @@ type OrganizationAuditTrail {
394
621
  timestamp: Time!
395
622
  """Event payload as a JSON object. Event-specific data such as status lives here."""
396
623
  payload: Map
624
+ """Who the event is recorded under; null for an entry recorded before actors were."""
625
+ actor: OrganizationAuditActor
626
+ }
627
+
628
+ """
629
+ The user an organization-wide audit entry is recorded under, as AuditActor.
630
+ """
631
+ type OrganizationAuditActor {
632
+ id: UUID!
633
+ name: String!
634
+ """USER, SERVICE or SYSTEM."""
635
+ kind: String!
397
636
  }
398
637
 
399
638
  """
@@ -422,6 +661,16 @@ extend type Query {
422
661
  ): OrganizationAuditTrailPage!
423
662
  }
424
663
 
664
+ """Where an entitlement of an instance comes from."""
665
+ enum EntitlementUsageSource {
666
+ """The licence grants it; add-ons, boosts and an exception may change it."""
667
+ license
668
+ """An add-on attached grants it."""
669
+ addon
670
+ """Only the instance's exception grants it."""
671
+ exception
672
+ }
673
+
425
674
  """
426
675
  Current usage of an entitlement on an instance. One row per license grant:
427
676
  NUMBER entitlements carry the accumulated usage (zeroed when nothing has been
@@ -456,6 +705,20 @@ type EntitlementUsage {
456
705
  entitlement (no configured reset period).
457
706
  """
458
707
  currentPeriodEnd: Time
708
+
709
+ source: EntitlementUsageSource!
710
+
711
+ """
712
+ How far above limit usage is still accepted, in percent: -1 unlimited, 0 a
713
+ hard limit. Null for BOOLEAN and CONFIG.
714
+ """
715
+ limitCapExceededOveragePercent: Int
716
+
717
+ """
718
+ What the licence, the add-ons, the boosts and the exception each
719
+ contribute, as the REST gauge read returns it.
720
+ """
721
+ provenance: Map
459
722
  }
460
723
 
461
724
  extend type Instance {
@@ -547,10 +810,19 @@ enum LicenseType {
547
810
  COMMUNITY
548
811
  }
549
812
 
813
+ """
814
+ What a trial without an ACTIVE payment method becomes at its end: CANCEL it,
815
+ or CONVERT it to ACTIVE.
816
+ """
817
+ enum TrialEndWithoutPaymentMethod {
818
+ CANCEL
819
+ CONVERT
820
+ }
821
+
550
822
  """
551
823
  LicenseFamily is the product a license is a version of. It carries identity and
552
- nothing else: no display name, because the display name is the current version's
553
- own name. Renaming a version or publishing a new one never changes it, which is
824
+ the family's own settings, no display name: the display name is the current
825
+ version's own name. Renaming a version or publishing a new one never changes it, which is
554
826
  what makes its slug safe to put in a public pricing URL -- for as long as the
555
827
  family has a version: deleting its last version deletes the family and frees the
556
828
  slug.
@@ -558,6 +830,27 @@ slug.
558
830
  type LicenseFamily {
559
831
  id: UUID!
560
832
  slug: String!
833
+ """Whether the family's default PUBLISHED version is in the public catalogue."""
834
+ isPublic: Boolean!
835
+ """
836
+ The FREE family an instance of this family moves to when its subscription
837
+ ends; null without one.
838
+ """
839
+ fallbackLicenseFamilySlug: String
840
+ """
841
+ What a trial charged automatically with a total above 0 becomes at its end
842
+ when the customer has no ACTIVE payment method.
843
+ """
844
+ trialEndWithoutPaymentMethod: TrialEndWithoutPaymentMethod!
845
+ """How many days before a trial's end trial_will_end fires (1 to 30)."""
846
+ trialReminderDays: Int!
847
+ }
848
+
849
+ """How a licence or add-on version is sold."""
850
+ enum PricingType {
851
+ FREE
852
+ PAID
853
+ CUSTOM
561
854
  }
562
855
 
563
856
  """
@@ -586,6 +879,20 @@ alone, this one is a resolved view of the product.
586
879
  type LicenseFamilyView {
587
880
  id: UUID!
588
881
  slug: String!
882
+ """Whether the family's default PUBLISHED version is in the public catalogue."""
883
+ isPublic: Boolean!
884
+ """
885
+ The FREE family an instance of this family moves to when its subscription
886
+ ends; null without one.
887
+ """
888
+ fallbackLicenseFamilySlug: String
889
+ """
890
+ What a trial charged automatically with a total above 0 becomes at its end
891
+ when the customer has no ACTIVE payment method.
892
+ """
893
+ trialEndWithoutPaymentMethod: TrialEndWithoutPaymentMethod!
894
+ """How many days before a trial's end trial_will_end fires (1 to 30)."""
895
+ trialReminderDays: Int!
589
896
 
590
897
  """
591
898
  The version this family currently serves: its default version, or its
@@ -633,6 +940,20 @@ type License {
633
940
  Instances using this license
634
941
  """
635
942
  instances: [Instance!]!
943
+
944
+ """How this version is sold."""
945
+ pricingType: PricingType!
946
+ """The trial a subscription starts with by default, in days; null when none."""
947
+ trialPeriodDays: Int
948
+ """Whether self-serve signup captures a payment method before activation."""
949
+ requiresPaymentMethod: Boolean
950
+ """Where a buyer is sent when this version cannot be bought self-serve."""
951
+ selfServeCtaUrl: String
952
+ """
953
+ The version's prices in display order; status narrows them. Like the REST
954
+ list, it needs billing to be enabled for the organization.
955
+ """
956
+ prices(status: PriceStatus): [LicensePrice!]!
636
957
  }
637
958
 
638
959
  """
@@ -710,6 +1031,57 @@ extend type License {
710
1031
  entitlements: [LicenseEntitlement!]!
711
1032
  }
712
1033
 
1034
+ """How a price bills: a flat fee per period, or the usage of an entitlement."""
1035
+ enum PriceBillingModel {
1036
+ FLAT_FEE
1037
+ USAGE_BASED
1038
+ OVERAGE
1039
+ }
1040
+
1041
+ """When a price bills: at the start of the period it covers, or at its end."""
1042
+ enum PriceBillingTiming {
1043
+ ADVANCE
1044
+ ARREARS
1045
+ }
1046
+
1047
+ """The length of a flat fee's period."""
1048
+ enum PriceBillingPeriod {
1049
+ MONTHLY
1050
+ QUARTERLY
1051
+ SEMI_ANNUAL
1052
+ ANNUAL
1053
+ }
1054
+
1055
+ """Whether a price is still offered."""
1056
+ enum PriceStatus {
1057
+ ACTIVE
1058
+ DEPRECATED
1059
+ }
1060
+
1061
+ """
1062
+ A price of a licence version. Amounts are in minor units of currency.
1063
+ unitAmountDecimal is the amount: GraphQL has no Int wide enough for every one.
1064
+ """
1065
+ type LicensePrice {
1066
+ id: UUID!
1067
+ billingModel: PriceBillingModel!
1068
+ billingTiming: PriceBillingTiming!
1069
+ """Null on a metered price."""
1070
+ billingPeriod: PriceBillingPeriod
1071
+ currency: String!
1072
+ """The amount in minor units, up to 12 decimal places."""
1073
+ unitAmountDecimal: String!
1074
+ """The slug of the entitlement a metered price measures; null on a flat fee."""
1075
+ meteredEntitlement: String
1076
+ """Measured units in one sale unit of a metered price; null on a flat fee."""
1077
+ saleUnitFactor: String
1078
+ displayLabel: String
1079
+ displayOrder: Int!
1080
+ isDefault: Boolean!
1081
+ status: PriceStatus!
1082
+ deprecatedAt: Time
1083
+ }
1084
+
713
1085
  """
714
1086
  Resource types that can carry typed metadata managed by a MetadataField.
715
1087
  Mirrors the sqlc enum `metadata_field_resource_type`.