@kaitencloud/graphql-schema 2.2.0 → 2.4.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 +165 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaitencloud/graphql-schema",
3
- "version": "2.2.0",
3
+ "version": "2.4.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
@@ -122,6 +122,74 @@ type AddonPrice {
122
122
  deprecatedAt: Time
123
123
  }
124
124
 
125
+ """How a NUMBER grant of an add-on combines with the licence's own."""
126
+ enum AddonOverrideBehavior {
127
+ ADD
128
+ OVERRIDE
129
+ MAX
130
+ }
131
+
132
+ """
133
+ An entitlement an add-on version grants, on a licence it fits: one way an
134
+ instance of that licence can come to hold the entitlement without the licence
135
+ granting it.
136
+
137
+ An add-on attaches to an instance, never to a licence. What ties it to a
138
+ licence is compatibility, declared per add-on version against a licence
139
+ FAMILY: the grants are therefore the same for every version of a family.
140
+ Nothing here says an instance holds the add-on; Instance.addons does.
141
+ """
142
+ type LicenseAddonGrant {
143
+ entitlementSlug: String!
144
+ entitlementType: String!
145
+ addonId: UUID!
146
+ """The add-on version: what an attachment names."""
147
+ addonSlug: String!
148
+ addonFamilySlug: String!
149
+ addonName: String!
150
+ """The version number in its add-on family."""
151
+ addonVersion: Int!
152
+ """
153
+ DRAFT: attachable to an instance with no live subscription only. PUBLISHED:
154
+ attachable. ARCHIVED: no new attachment, the instances that hold it keep it
155
+ and its grant.
156
+ """
157
+ lifecycleState: AddonLifecycleState!
158
+ """The version its add-on family resolves to. Only a PUBLISHED version."""
159
+ isDefault: Boolean!
160
+ """The most one instance may hold; null when unbounded."""
161
+ maxQuantity: Int
162
+ """
163
+ The grant per unit of quantity, shaped like a licence grant:
164
+ {type:"number",value:N}, {type:"boolean",value:B}, {type:"object",value:{...}}.
165
+ """
166
+ value: Map!
167
+ """True when the value is the unlimited sentinel."""
168
+ unlimited: Boolean!
169
+ """
170
+ The overage the add-on allows; null inherits the licence grant's (0 for an
171
+ entitlement only add-ons grant).
172
+ """
173
+ limitCapExceededOveragePercent: Int
174
+ """
175
+ How a number grant combines with the licence's: ADD sums value x quantity,
176
+ OVERRIDE replaces it with the latest attached add-on's, MAX keeps the larger.
177
+ A boolean always ORs, a config always overrides.
178
+ """
179
+ overrideBehavior: AddonOverrideBehavior!
180
+ }
181
+
182
+ extend type License {
183
+ """
184
+ What add-ons can grant on this licence: every entitlement of every add-on
185
+ version compatible with the licence's family, optionally one entitlement.
186
+ The licence's own grants are License.entitlements. Like the REST add-on
187
+ catalogue, it needs billing to be enabled for the organization, and
188
+ read:addons.
189
+ """
190
+ addonGrants(entitlementSlug: String): [LicenseAddonGrant!]!
191
+ }
192
+
125
193
  """
126
194
  A cursor-paginated page of add-on versions.
127
195
  """
@@ -339,6 +407,36 @@ enum EntitlementType {
339
407
  NUMBER_AI_CREDIT
340
408
  }
341
409
 
410
+ """
411
+ Where the usage of a NUMBER or NUMBER_AI_CREDIT entitlement comes from.
412
+ """
413
+ enum UsageSource {
414
+ """
415
+ The vendor's code reports it, and Kaiten folds each report with the
416
+ aggregation method. The default.
417
+ """
418
+ CALCULATED_USAGE
419
+ """
420
+ The weighted sum of the usage of other entitlements, its sources, computed
421
+ when it is read, for display only: nothing is stored for it and nothing is
422
+ enforced on it.
423
+ """
424
+ COMBINED_USAGE
425
+ }
426
+
427
+ """
428
+ One source of a combined entitlement: the entitlement whose usage it sums, and
429
+ the rate one unit of that usage is worth.
430
+ """
431
+ type EntitlementSource {
432
+ entitlementSlug: String!
433
+ """
434
+ Conversion rate, an exact decimal string: one unit of the source is worth this
435
+ many units of the combined entitlement.
436
+ """
437
+ weight: String!
438
+ }
439
+
342
440
  """
343
441
  Cadence at which usage automatically resets for a NUMBER entitlement.
344
442
  """
@@ -382,6 +480,18 @@ type Entitlement {
382
480
  description: String
383
481
  type: EntitlementType
384
482
 
483
+ """
484
+ Where the usage comes from (NUMBER and NUMBER_AI_CREDIT only; null for
485
+ BOOLEAN and CONFIG). Immutable.
486
+ """
487
+ usageSource: UsageSource
488
+
489
+ """
490
+ What a COMBINED_USAGE entitlement sums, each source with its weight. Null for
491
+ any other entitlement.
492
+ """
493
+ sources: [EntitlementSource!]
494
+
385
495
  """
386
496
  Optional icon, stored as a provider-namespaced token (provider:name).
387
497
  Decoupled from any specific icon library.
@@ -676,10 +786,33 @@ enum EntitlementUsageSource {
676
786
  exception
677
787
  }
678
788
 
789
+ """
790
+ What one source of a combined entitlement reads on its own, before its weight:
791
+ the detail of the sum.
792
+ """
793
+ type CombinedSourceUsage {
794
+ entitlementSlug: String!
795
+ """
796
+ The rate one unit of the source is worth in the combined entitlement, an exact
797
+ decimal string.
798
+ """
799
+ weight: String!
800
+ """
801
+ The source's own usage in its current window.
802
+ """
803
+ usage: Float!
804
+ """
805
+ The source's own effective limit; -1 means unlimited.
806
+ """
807
+ limit: Float!
808
+ }
809
+
679
810
  """
680
811
  Current usage of an entitlement on an instance. One row per license grant:
681
812
  NUMBER entitlements carry the accumulated usage (zeroed when nothing has been
682
- reported yet); other types carry the license value.
813
+ reported yet); other types carry the license value. A combined entitlement
814
+ (COMBINED_USAGE) has one too, as soon as one of its sources is granted: the
815
+ weighted sum of its sources', computed when read.
683
816
  """
684
817
  type EntitlementUsage {
685
818
  entitlementId: UUID!
@@ -724,6 +857,12 @@ type EntitlementUsage {
724
857
  contribute, as the REST gauge read returns it.
725
858
  """
726
859
  provenance: Map
860
+
861
+ """
862
+ A combined entitlement's sources the instance is granted, each with its own
863
+ usage and limit before its weight. Null for any other entitlement.
864
+ """
865
+ sources: [CombinedSourceUsage!]
727
866
  }
728
867
 
729
868
  extend type Instance {
@@ -842,9 +981,20 @@ type ConversionRule {
842
981
  maximumCreditsPerRequest: String
843
982
  chargeOnError: ChargeOnErrorPolicy!
844
983
  status: ConversionRuleStatus!
984
+ """Whether the licence itself grants the pool."""
845
985
  grantedByLicense: Boolean!
986
+ """
987
+ Whether an add-on version compatible with the licence's family grants the
988
+ pool, whatever its lifecycle state: instances of the licence can then hold
989
+ the pool without the licence granting it. License.addonGrants lists them.
990
+ """
991
+ grantedByAddons: Boolean!
846
992
  createdAt: Time!
993
+ """Who created the rule. A service account is a user."""
994
+ createdBy: User!
847
995
  updatedAt: Time!
996
+ """Who last changed the rule: its pricing, or its archival."""
997
+ updatedBy: User!
848
998
  }
849
999
  extend type License {
850
1000
  """All rules when status is omitted; an explicit status filters that relation."""
@@ -895,6 +1045,15 @@ type LicenseFamily {
895
1045
  trialEndWithoutPaymentMethod: TrialEndWithoutPaymentMethod!
896
1046
  """How many days before a trial's end trial_will_end fires (1 to 30)."""
897
1047
  trialReminderDays: Int!
1048
+ """
1049
+ The version this family currently serves: its default version, or its
1050
+ highest-numbered PUBLISHED version. Null when every version is a draft or has
1051
+ been archived. The same resolution as LicenseFamilyView.currentVersion, read
1052
+ here so that a list of licenses can label each family (a family has no name
1053
+ of its own: it is shown under its current version's) without one
1054
+ licenseFamily query per family.
1055
+ """
1056
+ currentVersion: License
898
1057
  }
899
1058
 
900
1059
  """How a licence or add-on version is sold."""
@@ -973,6 +1132,11 @@ type License {
973
1132
  description: String!
974
1133
  type: LicenseType!
975
1134
  version: String!
1135
+ """
1136
+ version as a number: the order of the versions in their family, 1 being the
1137
+ first. Assigned by the server and never reused within a family.
1138
+ """
1139
+ versionNumber: Int!
976
1140
  versionName: String
977
1141
  isDefault: Boolean!
978
1142