@kaitencloud/graphql-schema 1.0.3 → 2.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/schema.graphqls +381 -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.1.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
  """
@@ -413,6 +652,11 @@ extend type Query {
413
652
  """
414
653
  organizationAuditTrails(
415
654
  eventName: String
655
+ """
656
+ Leave out the reads, evaluations and reports that make up the bulk of a busy
657
+ trail, for a page that wants the changes behind them. False when absent.
658
+ """
659
+ changesOnly: Boolean
416
660
  after: Time
417
661
  before: Time
418
662
  """Maximum number of entries to return (default 200, max 1000)"""
@@ -422,6 +666,16 @@ extend type Query {
422
666
  ): OrganizationAuditTrailPage!
423
667
  }
424
668
 
669
+ """Where an entitlement of an instance comes from."""
670
+ enum EntitlementUsageSource {
671
+ """The licence grants it; add-ons, boosts and an exception may change it."""
672
+ license
673
+ """An add-on attached grants it."""
674
+ addon
675
+ """Only the instance's exception grants it."""
676
+ exception
677
+ }
678
+
425
679
  """
426
680
  Current usage of an entitlement on an instance. One row per license grant:
427
681
  NUMBER entitlements carry the accumulated usage (zeroed when nothing has been
@@ -456,6 +710,20 @@ type EntitlementUsage {
456
710
  entitlement (no configured reset period).
457
711
  """
458
712
  currentPeriodEnd: Time
713
+
714
+ source: EntitlementUsageSource!
715
+
716
+ """
717
+ How far above limit usage is still accepted, in percent: -1 unlimited, 0 a
718
+ hard limit. Null for BOOLEAN and CONFIG.
719
+ """
720
+ limitCapExceededOveragePercent: Int
721
+
722
+ """
723
+ What the licence, the add-ons, the boosts and the exception each
724
+ contribute, as the REST gauge read returns it.
725
+ """
726
+ provenance: Map
459
727
  }
460
728
 
461
729
  extend type Instance {
@@ -547,10 +815,19 @@ enum LicenseType {
547
815
  COMMUNITY
548
816
  }
549
817
 
818
+ """
819
+ What a trial without an ACTIVE payment method becomes at its end: CANCEL it,
820
+ or CONVERT it to ACTIVE.
821
+ """
822
+ enum TrialEndWithoutPaymentMethod {
823
+ CANCEL
824
+ CONVERT
825
+ }
826
+
550
827
  """
551
828
  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
829
+ the family's own settings, no display name: the display name is the current
830
+ version's own name. Renaming a version or publishing a new one never changes it, which is
554
831
  what makes its slug safe to put in a public pricing URL -- for as long as the
555
832
  family has a version: deleting its last version deletes the family and frees the
556
833
  slug.
@@ -558,6 +835,27 @@ slug.
558
835
  type LicenseFamily {
559
836
  id: UUID!
560
837
  slug: String!
838
+ """Whether the family's default PUBLISHED version is in the public catalogue."""
839
+ isPublic: Boolean!
840
+ """
841
+ The FREE family an instance of this family moves to when its subscription
842
+ ends; null without one.
843
+ """
844
+ fallbackLicenseFamilySlug: String
845
+ """
846
+ What a trial charged automatically with a total above 0 becomes at its end
847
+ when the customer has no ACTIVE payment method.
848
+ """
849
+ trialEndWithoutPaymentMethod: TrialEndWithoutPaymentMethod!
850
+ """How many days before a trial's end trial_will_end fires (1 to 30)."""
851
+ trialReminderDays: Int!
852
+ }
853
+
854
+ """How a licence or add-on version is sold."""
855
+ enum PricingType {
856
+ FREE
857
+ PAID
858
+ CUSTOM
561
859
  }
562
860
 
563
861
  """
@@ -586,6 +884,20 @@ alone, this one is a resolved view of the product.
586
884
  type LicenseFamilyView {
587
885
  id: UUID!
588
886
  slug: String!
887
+ """Whether the family's default PUBLISHED version is in the public catalogue."""
888
+ isPublic: Boolean!
889
+ """
890
+ The FREE family an instance of this family moves to when its subscription
891
+ ends; null without one.
892
+ """
893
+ fallbackLicenseFamilySlug: String
894
+ """
895
+ What a trial charged automatically with a total above 0 becomes at its end
896
+ when the customer has no ACTIVE payment method.
897
+ """
898
+ trialEndWithoutPaymentMethod: TrialEndWithoutPaymentMethod!
899
+ """How many days before a trial's end trial_will_end fires (1 to 30)."""
900
+ trialReminderDays: Int!
589
901
 
590
902
  """
591
903
  The version this family currently serves: its default version, or its
@@ -633,6 +945,20 @@ type License {
633
945
  Instances using this license
634
946
  """
635
947
  instances: [Instance!]!
948
+
949
+ """How this version is sold."""
950
+ pricingType: PricingType!
951
+ """The trial a subscription starts with by default, in days; null when none."""
952
+ trialPeriodDays: Int
953
+ """Whether self-serve signup captures a payment method before activation."""
954
+ requiresPaymentMethod: Boolean
955
+ """Where a buyer is sent when this version cannot be bought self-serve."""
956
+ selfServeCtaUrl: String
957
+ """
958
+ The version's prices in display order; status narrows them. Like the REST
959
+ list, it needs billing to be enabled for the organization.
960
+ """
961
+ prices(status: PriceStatus): [LicensePrice!]!
636
962
  }
637
963
 
638
964
  """
@@ -710,6 +1036,57 @@ extend type License {
710
1036
  entitlements: [LicenseEntitlement!]!
711
1037
  }
712
1038
 
1039
+ """How a price bills: a flat fee per period, or the usage of an entitlement."""
1040
+ enum PriceBillingModel {
1041
+ FLAT_FEE
1042
+ USAGE_BASED
1043
+ OVERAGE
1044
+ }
1045
+
1046
+ """When a price bills: at the start of the period it covers, or at its end."""
1047
+ enum PriceBillingTiming {
1048
+ ADVANCE
1049
+ ARREARS
1050
+ }
1051
+
1052
+ """The length of a flat fee's period."""
1053
+ enum PriceBillingPeriod {
1054
+ MONTHLY
1055
+ QUARTERLY
1056
+ SEMI_ANNUAL
1057
+ ANNUAL
1058
+ }
1059
+
1060
+ """Whether a price is still offered."""
1061
+ enum PriceStatus {
1062
+ ACTIVE
1063
+ DEPRECATED
1064
+ }
1065
+
1066
+ """
1067
+ A price of a licence version. Amounts are in minor units of currency.
1068
+ unitAmountDecimal is the amount: GraphQL has no Int wide enough for every one.
1069
+ """
1070
+ type LicensePrice {
1071
+ id: UUID!
1072
+ billingModel: PriceBillingModel!
1073
+ billingTiming: PriceBillingTiming!
1074
+ """Null on a metered price."""
1075
+ billingPeriod: PriceBillingPeriod
1076
+ currency: String!
1077
+ """The amount in minor units, up to 12 decimal places."""
1078
+ unitAmountDecimal: String!
1079
+ """The slug of the entitlement a metered price measures; null on a flat fee."""
1080
+ meteredEntitlement: String
1081
+ """Measured units in one sale unit of a metered price; null on a flat fee."""
1082
+ saleUnitFactor: String
1083
+ displayLabel: String
1084
+ displayOrder: Int!
1085
+ isDefault: Boolean!
1086
+ status: PriceStatus!
1087
+ deprecatedAt: Time
1088
+ }
1089
+
713
1090
  """
714
1091
  Resource types that can carry typed metadata managed by a MetadataField.
715
1092
  Mirrors the sqlc enum `metadata_field_resource_type`.