@kaitencloud/graphql-schema 2.3.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 +72 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaitencloud/graphql-schema",
3
- "version": "2.3.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
@@ -407,6 +407,36 @@ enum EntitlementType {
407
407
  NUMBER_AI_CREDIT
408
408
  }
409
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
+
410
440
  """
411
441
  Cadence at which usage automatically resets for a NUMBER entitlement.
412
442
  """
@@ -450,6 +480,18 @@ type Entitlement {
450
480
  description: String
451
481
  type: EntitlementType
452
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
+
453
495
  """
454
496
  Optional icon, stored as a provider-namespaced token (provider:name).
455
497
  Decoupled from any specific icon library.
@@ -744,10 +786,33 @@ enum EntitlementUsageSource {
744
786
  exception
745
787
  }
746
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
+
747
810
  """
748
811
  Current usage of an entitlement on an instance. One row per license grant:
749
812
  NUMBER entitlements carry the accumulated usage (zeroed when nothing has been
750
- 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.
751
816
  """
752
817
  type EntitlementUsage {
753
818
  entitlementId: UUID!
@@ -792,6 +857,12 @@ type EntitlementUsage {
792
857
  contribute, as the REST gauge read returns it.
793
858
  """
794
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!]
795
866
  }
796
867
 
797
868
  extend type Instance {