@kaitencloud/graphql-schema 1.0.3

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.
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,2 @@
1
+ Kaiten
2
+ Copyright 2026 KAITEN INC
package/README.md ADDED
@@ -0,0 +1,57 @@
1
+ # @kaitencloud/graphql-schema
2
+
3
+ The GraphQL schema of the [Kaiten](https://kaiten.sh) API, in one `schema.graphqls`. The
4
+ GraphQL endpoint is read-only: it serves queries over the same model as the REST API,
5
+ whose contract is [`@kaitencloud/openapi`](https://www.npmjs.com/package/@kaitencloud/openapi).
6
+ The schema lives in the [kaiten repository](https://github.com/kaitencloud/kaiten) and is
7
+ published each time it changes.
8
+
9
+ ## Get the file
10
+
11
+ ```sh
12
+ npm install @kaitencloud/graphql-schema
13
+ ```
14
+
15
+ The schema is then `node_modules/@kaitencloud/graphql-schema/schema.graphqls`. Without a
16
+ project, extract it from the package:
17
+
18
+ ```sh
19
+ npm pack @kaitencloud/graphql-schema@latest
20
+ tar -xzOf kaitencloud-graphql-schema-*.tgz package/schema.graphqls > schema.graphqls
21
+ ```
22
+
23
+ ## Reading it
24
+
25
+ The file holds the schema as the server loads it: a base schema, then one
26
+ `extend type Query` block per module. Tools that read SDL take it as it is, such as
27
+ graphql-js's `buildSchema` or GraphQL Code Generator. To print it as one sorted SDL:
28
+
29
+ ```js
30
+ import { readFileSync } from "node:fs";
31
+ import { buildSchema, lexicographicSortSchema, printSchema } from "graphql";
32
+
33
+ const sdl = readFileSync("node_modules/@kaitencloud/graphql-schema/schema.graphqls", "utf8");
34
+ console.log(printSchema(lexicographicSortSchema(buildSchema(sdl))));
35
+ ```
36
+
37
+ ## Versions
38
+
39
+ Each version is decided by comparing the schema with the one published before it, with
40
+ graphql-js's `findSchemaChanges`:
41
+
42
+ - **major**: a breaking or dangerous change, such as a removed type, field or argument, a
43
+ new required argument, a value added to an enum, a type added to a union or a changed
44
+ default value;
45
+ - **minor**: any other change to the schema, such as a new type or field, or a new
46
+ optional argument or input field;
47
+ - **patch**: the same schema in a different file, such as a description, a comment, the
48
+ order of the fragments or this README.
49
+
50
+ To hear about a breaking change before it reaches you, pin a major:
51
+ `"@kaitencloud/graphql-schema": "^1"`.
52
+
53
+ ## License
54
+
55
+ Apache-2.0. See `LICENSE` and `NOTICE`. The license does not grant permission to use
56
+ the Kaiten name or logos: see the
57
+ [trademark policy](https://github.com/kaitencloud/kaiten/blob/main/TRADEMARKS.md).
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@kaitencloud/graphql-schema",
3
+ "version": "1.0.3",
4
+ "description": "Kaiten API GraphQL schema: the gqlgen fragments, concatenated, published for downstream SDKs.",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/kaitencloud/kaiten.git",
9
+ "directory": "api/internal/infrastructure/http/graphql"
10
+ },
11
+ "files": [
12
+ "schema.graphqls",
13
+ "NOTICE"
14
+ ],
15
+ "publishConfig": {
16
+ "registry": "https://registry.npmjs.org/",
17
+ "access": "public"
18
+ }
19
+ }
@@ -0,0 +1,838 @@
1
+ """
2
+ Custom scalar for UUIDs
3
+ """
4
+ scalar UUID
5
+
6
+ """
7
+ Custom scalar for timestamps
8
+ """
9
+ scalar Time
10
+
11
+ """
12
+ Custom scalar for JSON maps
13
+ """
14
+ scalar Map
15
+
16
+ """
17
+ A user reference (id + name)
18
+ """
19
+ type User {
20
+ id: UUID!
21
+ name: String!
22
+ }
23
+
24
+ """
25
+ Health check endpoint
26
+ """
27
+
28
+ type Query {
29
+ _health: String!
30
+ }
31
+
32
+ """
33
+ Component represents a software component, optionally included in releases.
34
+ """
35
+ type Component {
36
+ id: UUID!
37
+ previousComponentId: UUID
38
+ name: String!
39
+ version: String!
40
+ slug: String!
41
+ description: String
42
+ createdBy: User!
43
+ createdAt: Time!
44
+ }
45
+
46
+ """
47
+ A cursor-paginated page of components.
48
+ """
49
+ type ComponentPage {
50
+ items: [Component!]!
51
+ """Opaque cursor for the next page. Null when hasMore is false."""
52
+ nextCursor: String
53
+ hasMore: Boolean!
54
+ }
55
+
56
+ extend type Query {
57
+ """
58
+ Get components for the current organization, cursor-paginated.
59
+ """
60
+ components(limit: Int, cursor: String): ComponentPage!
61
+
62
+ """
63
+ Get a specific component by ID or slug (at least one required)
64
+ """
65
+ component(id: UUID, slug: String): Component
66
+ }
67
+
68
+ """
69
+ Customer represents a client organization of a organization.
70
+ """
71
+ type Customer {
72
+ id: UUID!
73
+ name: String!
74
+ slug: String!
75
+ externalCustomerId: String
76
+ domain: String
77
+ integrations: Map!
78
+ createdBy: User!
79
+ createdAt: Time!
80
+ updatedBy: User!
81
+ updatedAt: Time!
82
+
83
+ """
84
+ Instances associated with this customer
85
+ """
86
+ instances: [Instance!]!
87
+ }
88
+
89
+ """
90
+ A cursor-paginated page of customers.
91
+ """
92
+ type CustomerPage {
93
+ items: [Customer!]!
94
+ """Opaque cursor for the next page. Null when hasMore is false."""
95
+ nextCursor: String
96
+ hasMore: Boolean!
97
+ }
98
+
99
+ extend type Query {
100
+ """
101
+ Get customers for the current organization, cursor-paginated. When
102
+ hasIntegration is set, only customers synced with that integration
103
+ adapter are returned; the page is cursor-paginated either way.
104
+ """
105
+ customers(hasIntegration: String, limit: Int, cursor: String): CustomerPage!
106
+
107
+ """
108
+ Get a specific customer by ID, slug, or the external ID you assigned it
109
+ (at least one required; they are tried in that order).
110
+
111
+ `externalCustomerId` is the id your own system uses for the tenant, so an
112
+ embedded client can ask for "my" customer without first learning Kaiten's
113
+ slug. It carries no uniqueness constraint, so a value matching more than one
114
+ customer is an error rather than an arbitrary pick.
115
+ """
116
+ customer(id: UUID, slug: String, externalCustomerId: String): Customer
117
+ }
118
+
119
+ """
120
+ One place a customer of this Kaiten runs a release: a target they name and
121
+ classify themselves ("AWS us-west-2", "on-prem staging"), carrying typed
122
+ metadata, the instances in it and the release currently on it.
123
+
124
+ Not an installation of Kaiten. Kaiten's own operations vocabulary uses the same
125
+ two words for one -- a Kubernetes namespace plus a Clerk application plus a DNS
126
+ name plus a reporting credential plus the organizations inside it -- and that
127
+ kind of zone is not reachable through this API at all.
128
+ """
129
+ type DeploymentZone {
130
+ id: UUID!
131
+ name: String!
132
+ slug: String!
133
+ description: String!
134
+ """
135
+ Environment class of the zone -- production, staging or development are the
136
+ values the console labels, but the field is free-form.
137
+ """
138
+ type: String!
139
+ metadata: Map
140
+ releaseId: UUID
141
+ createdBy: User!
142
+ createdAt: Time!
143
+ updatedBy: User!
144
+ updatedAt: Time!
145
+ }
146
+
147
+ """
148
+ A cursor-paginated page of deployment zones.
149
+ """
150
+ type DeploymentZonePage {
151
+ items: [DeploymentZone!]!
152
+ """Opaque cursor for the next page. Null when hasMore is false."""
153
+ nextCursor: String
154
+ hasMore: Boolean!
155
+ }
156
+
157
+ extend type Query {
158
+ """
159
+ Get deployment zones for the current organization, cursor-paginated.
160
+ """
161
+ deploymentZones(limit: Int, cursor: String): DeploymentZonePage!
162
+
163
+ """
164
+ Get a specific deployment zone by ID or slug (at least one required)
165
+ """
166
+ deploymentZone(id: UUID, slug: String): DeploymentZone
167
+ }
168
+
169
+ """
170
+ Deployment is one entry in a zone's deployment log: a release was put on a zone
171
+ at a moment in time. The same release can appear against the same zone more
172
+ than once -- that is a rollback.
173
+ """
174
+ type Deployment {
175
+ id: UUID!
176
+ deploymentZoneId: UUID!
177
+ releaseId: UUID!
178
+ createdBy: User!
179
+ createdAt: Time!
180
+ }
181
+
182
+ """
183
+ Entitlement type enumeration
184
+ """
185
+ enum EntitlementType {
186
+ BOOLEAN
187
+ NUMBER
188
+ CONFIG
189
+ NUMBER_AI_CREDIT
190
+ }
191
+
192
+ """
193
+ Cadence at which usage automatically resets for a NUMBER entitlement.
194
+ """
195
+ enum EntitlementResetPeriod {
196
+ HOUR
197
+ DAY
198
+ WEEK
199
+ MONTH
200
+ YEAR
201
+ }
202
+
203
+ """
204
+ Phase of a periodic usage window: CALENDAR (UTC calendar-aligned) or
205
+ LICENSE_START (phased off the instance's license start date).
206
+ """
207
+ enum EntitlementResetAnchor {
208
+ CALENDAR
209
+ LICENSE_START
210
+ }
211
+
212
+ """
213
+ Lightweight reference to an entitlement group (category axis for presentation).
214
+ """
215
+ type EntitlementGroupSummary {
216
+ id: UUID!
217
+ name: String!
218
+ slug: String!
219
+ }
220
+
221
+ """
222
+ An entitlement definition: a usage right or quota, with its customer-facing
223
+ presentation metadata (icon, units, visibility, display order).
224
+ """
225
+ type Entitlement {
226
+ id: UUID!
227
+ name: String!
228
+ slug: String!
229
+ description: String
230
+ type: EntitlementType
231
+
232
+ """
233
+ Optional icon, stored as a provider-namespaced token (provider:name).
234
+ Decoupled from any specific icon library.
235
+ """
236
+ icon: String
237
+
238
+ """
239
+ Singular label of the base unit this entitlement is measured in (NUMBER only).
240
+ """
241
+ unitSingular: String
242
+
243
+ """
244
+ Plural label of the base unit this entitlement is measured in (NUMBER only).
245
+ """
246
+ unitPlural: String
247
+
248
+ """
249
+ Singular label of the unit this entitlement is sold in, when it differs from
250
+ the base unit.
251
+ """
252
+ saleUnitSingular: String
253
+
254
+ """
255
+ Plural label of the unit this entitlement is sold in.
256
+ """
257
+ saleUnitPlural: String
258
+
259
+ """
260
+ Number of base units one sale unit represents (1 sale unit = N base units).
261
+ """
262
+ saleUnitFactor: Float
263
+
264
+ """
265
+ Whether this entitlement is displayed in customer-facing components
266
+ (e.g. plan and pricing pages). Defaults to false.
267
+ """
268
+ userFacing: Boolean
269
+
270
+ """
271
+ Sort order of this entitlement in customer-facing components (ascending).
272
+ """
273
+ displayOrder: Int
274
+
275
+ """
276
+ Percentage of the cap at which an early-warning event fires before the cap
277
+ is reached. 0 disables the warning (default).
278
+ """
279
+ warningThresholdPercent: Int
280
+
281
+ """
282
+ Cadence at which usage automatically resets (NUMBER only). Null means a
283
+ lifetime counter. Immutable once set.
284
+ """
285
+ resetPeriod: EntitlementResetPeriod
286
+
287
+ """
288
+ Phase of the periodic usage window. Required exactly when resetPeriod is
289
+ set; defaults to CALENDAR when omitted. Immutable once set.
290
+ """
291
+ resetAnchor: EntitlementResetAnchor
292
+
293
+ """
294
+ Groups associated with this entitlement
295
+ """
296
+ entitlementGroups: [EntitlementGroupSummary!]
297
+ }
298
+
299
+ """
300
+ A cursor-paginated page of entitlements.
301
+ """
302
+ type EntitlementPage {
303
+ items: [Entitlement!]!
304
+ """
305
+ Opaque cursor for the next page. Absent when hasMore is false.
306
+ """
307
+ nextCursor: String
308
+ """
309
+ Whether more rows exist beyond this page.
310
+ """
311
+ hasMore: Boolean!
312
+ }
313
+
314
+ extend type Query {
315
+ """
316
+ Get a cursor-paginated page of entitlement definitions for the current
317
+ organization
318
+ """
319
+ entitlements(limit: Int, cursor: String): EntitlementPage!
320
+ }
321
+
322
+ """
323
+ AuditTrail records a single domain event captured from the outbox CDC pipeline.
324
+ """
325
+ type AuditTrail {
326
+ id: UUID!
327
+ instanceId: UUID
328
+ instanceSlug: String!
329
+ eventName: String!
330
+ """Versioned event type identifier (e.g. com.kaiten.instance.entitlement.v1.value_get)"""
331
+ eventType: String!
332
+ timestamp: Time!
333
+ """Event payload as a JSON object. Event-specific data such as status lives here."""
334
+ payload: Map
335
+ }
336
+
337
+ """
338
+ A cursor-paginated page of instance-scoped audit trail entries.
339
+ """
340
+ type AuditTrailPage {
341
+ items: [AuditTrail!]!
342
+ """Opaque cursor for the next page. Null when hasMore is false."""
343
+ nextCursor: String
344
+ hasMore: Boolean!
345
+ }
346
+
347
+ extend type Instance {
348
+ """
349
+ Cursor-paginated audit trail entries for this instance.
350
+ """
351
+ auditTrails(
352
+ eventName: String
353
+ after: Time
354
+ before: Time
355
+ """Maximum number of entries to return (default 50, max 200)"""
356
+ limit: Int
357
+ """Opaque cursor from a previous response's nextCursor"""
358
+ cursor: String
359
+ ): AuditTrailPage!
360
+ }
361
+
362
+ extend type Query {
363
+ """
364
+ List audit trail entries for a given instance slug.
365
+ """
366
+ auditTrails(
367
+ instanceSlug: String!
368
+ eventName: String
369
+ after: Time
370
+ before: Time
371
+ """Maximum number of entries to return (default 50, max 200)"""
372
+ limit: Int
373
+ """Opaque cursor from a previous response's nextCursor"""
374
+ cursor: String
375
+ ): AuditTrailPage!
376
+ }
377
+
378
+ """
379
+ OrganizationAuditTrail is an organization-wide audit trail entry. Instance and
380
+ customer context is only present for instance-scoped events; organization-level
381
+ events (e.g. customer or entitlement lifecycle) carry null instance fields.
382
+ """
383
+ type OrganizationAuditTrail {
384
+ id: UUID!
385
+ instanceId: UUID
386
+ instanceSlug: String
387
+ instanceName: String
388
+ customerId: UUID
389
+ customerSlug: String
390
+ customerName: String
391
+ eventName: String!
392
+ """Versioned event type identifier (e.g. com.kaiten.instance.entitlement.v1.value_get)"""
393
+ eventType: String!
394
+ timestamp: Time!
395
+ """Event payload as a JSON object. Event-specific data such as status lives here."""
396
+ payload: Map
397
+ }
398
+
399
+ """
400
+ A cursor-paginated page of organization-wide audit trail entries.
401
+ """
402
+ type OrganizationAuditTrailPage {
403
+ items: [OrganizationAuditTrail!]!
404
+ """Opaque cursor for the next page. Null when hasMore is false."""
405
+ nextCursor: String
406
+ hasMore: Boolean!
407
+ }
408
+
409
+ extend type Query {
410
+ """
411
+ List every audit trail entry of the current organization, newest first,
412
+ including events not attached to an instance (e.g. CUSTOMER_CREATED).
413
+ """
414
+ organizationAuditTrails(
415
+ eventName: String
416
+ after: Time
417
+ before: Time
418
+ """Maximum number of entries to return (default 200, max 1000)"""
419
+ limit: Int
420
+ """Opaque cursor from a previous response's nextCursor"""
421
+ cursor: String
422
+ ): OrganizationAuditTrailPage!
423
+ }
424
+
425
+ """
426
+ Current usage of an entitlement on an instance. One row per license grant:
427
+ NUMBER entitlements carry the accumulated usage (zeroed when nothing has been
428
+ reported yet); other types carry the license value.
429
+ """
430
+ type EntitlementUsage {
431
+ entitlementId: UUID!
432
+ entitlementSlug: String!
433
+ licenseId: UUID!
434
+ licenseSlug: String!
435
+
436
+ """
437
+ Typed usage value. Shapes: {type:"number",value:N,event_count:C},
438
+ {type:"boolean",value:B}, {type:"object",value:{...}}
439
+ """
440
+ value: Map!
441
+
442
+ """
443
+ License grant this usage is measured against, same shape as value. Null when
444
+ the license grants no value; -1 means unlimited for a NUMBER entitlement.
445
+ """
446
+ limit: Map
447
+
448
+ """
449
+ Start of the current usage window (inclusive). Null for a lifetime
450
+ entitlement (no configured reset period).
451
+ """
452
+ currentPeriodStart: Time
453
+
454
+ """
455
+ End of the current usage window (exclusive). Null for a lifetime
456
+ entitlement (no configured reset period).
457
+ """
458
+ currentPeriodEnd: Time
459
+ }
460
+
461
+ extend type Instance {
462
+ """
463
+ Current entitlement usage for this instance (one row per license grant)
464
+ """
465
+ entitlementUsage: [EntitlementUsage!]!
466
+ }
467
+
468
+ """
469
+ Instance represents a deployed environment of the SaaS product for a customer.
470
+ """
471
+ enum InstanceStatus {
472
+ HEALTHY
473
+ DEGRADED
474
+ INCIDENT
475
+ MAINTENANCE
476
+ }
477
+
478
+ type Instance {
479
+ id: UUID!
480
+ name: String!
481
+ slug: String!
482
+ description: String!
483
+ status: InstanceStatus!
484
+ lifecycleStage: String
485
+ createdBy: User!
486
+ createdAt: Time!
487
+ updatedBy: User!
488
+ updatedAt: Time!
489
+ customerId: UUID!
490
+ customerSlug: String!
491
+ licenseId: UUID!
492
+ licenseSlug: String!
493
+ startLicenseDate: Time!
494
+ endLicenseDate: Time!
495
+ metadata: Map
496
+ integrations: Map!
497
+ deploymentZoneId: UUID
498
+ deploymentZoneSlug: String
499
+
500
+ """
501
+ The customer that owns this instance
502
+ """
503
+ customer: Customer!
504
+
505
+ """
506
+ The license associated with this instance
507
+ """
508
+ license: License!
509
+
510
+ """
511
+ The deployment zone associated with this instance
512
+ """
513
+ deploymentZone: DeploymentZone
514
+ }
515
+
516
+ """
517
+ A cursor-paginated page of instances.
518
+ """
519
+ type InstancePage {
520
+ items: [Instance!]!
521
+ """Opaque cursor for the next page. Null when hasMore is false."""
522
+ nextCursor: String
523
+ hasMore: Boolean!
524
+ }
525
+
526
+ extend type Query {
527
+ """
528
+ Get instances for the current organization, cursor-paginated. When
529
+ hasIntegration is set, only instances synced with that integration
530
+ adapter are returned; the page is cursor-paginated either way.
531
+ """
532
+ instances(hasIntegration: String, limit: Int, cursor: String): InstancePage!
533
+
534
+ """
535
+ Get a specific instance by ID or slug (at least one required)
536
+ """
537
+ instance(id: UUID, slug: String): Instance
538
+ }
539
+
540
+ """
541
+ License type enumeration
542
+ """
543
+ enum LicenseType {
544
+ DEVELOPMENT
545
+ TRIAL
546
+ PAID
547
+ COMMUNITY
548
+ }
549
+
550
+ """
551
+ 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
554
+ what makes its slug safe to put in a public pricing URL -- for as long as the
555
+ family has a version: deleting its last version deletes the family and frees the
556
+ slug.
557
+ """
558
+ type LicenseFamily {
559
+ id: UUID!
560
+ slug: String!
561
+ }
562
+
563
+ """
564
+ Whether a version of a license may be served.
565
+
566
+ Several versions of one family can be PUBLISHED at once, so this is not a
567
+ "current version" marker: which version a family resolves to is decided on top
568
+ of it, by taking the family's default version, or its highest-numbered published
569
+ one. DRAFT and ARCHIVED are both unservable and resolution treats them alike,
570
+ but one has never been offered and the other has been withdrawn.
571
+ """
572
+ enum LicenseLifecycleState {
573
+ DRAFT
574
+ PUBLISHED
575
+ ARCHIVED
576
+ }
577
+
578
+ """
579
+ LicenseFamilyView is a family together with the version it currently resolves
580
+ to -- the answer to "the current version of this product", which addressing a
581
+ version slug cannot give.
582
+
583
+ Distinct from LicenseFamily, which License.family returns: that one is identity
584
+ alone, this one is a resolved view of the product.
585
+ """
586
+ type LicenseFamilyView {
587
+ id: UUID!
588
+ slug: String!
589
+
590
+ """
591
+ The version this family currently serves: its default version, or its
592
+ highest-numbered PUBLISHED version. Null when every version is a draft or has
593
+ been archived.
594
+ """
595
+ currentVersion: License
596
+
597
+ """
598
+ Number of versions in this family, whatever their lifecycle state.
599
+ """
600
+ versionCount: Int!
601
+
602
+ """
603
+ Every version of the family, oldest first.
604
+ """
605
+ versions: [License!]!
606
+ }
607
+
608
+ """
609
+ License defines the commercial and functional rules for one or more instances.
610
+ """
611
+ type License {
612
+ id: UUID!
613
+ name: String!
614
+ slug: String!
615
+ description: String!
616
+ type: LicenseType!
617
+ version: String!
618
+ versionName: String
619
+ isDefault: Boolean!
620
+
621
+ """
622
+ Whether this version may be served.
623
+ """
624
+ lifecycleState: LicenseLifecycleState!
625
+
626
+ """
627
+ The family this license is a version of. Two licenses sharing it are the same
628
+ product, whatever their names say.
629
+ """
630
+ family: LicenseFamily!
631
+
632
+ """
633
+ Instances using this license
634
+ """
635
+ instances: [Instance!]!
636
+ }
637
+
638
+ """
639
+ A cursor-paginated page of licenses.
640
+ """
641
+ type LicensePage {
642
+ items: [License!]!
643
+ """Opaque cursor for the next page. Null when hasMore is false."""
644
+ nextCursor: String
645
+ hasMore: Boolean!
646
+ }
647
+
648
+ extend type Query {
649
+ """
650
+ Get licenses for the current organization, cursor-paginated.
651
+ """
652
+ licenses(limit: Int, cursor: String): LicensePage!
653
+
654
+ """
655
+ Get a specific license by ID or slug (at least one required)
656
+ """
657
+ license(id: UUID, slug: String): License
658
+
659
+ """
660
+ Resolve a license family to the version it currently serves. Null when no
661
+ family carries this slug; a family with nothing published resolves with a null
662
+ currentVersion rather than being reported as missing.
663
+ """
664
+ licenseFamily(slug: String!): LicenseFamilyView
665
+ }
666
+
667
+ """
668
+ An entitlement granted by a license, with its contractual value and the full
669
+ entitlement definition (presentation metadata included).
670
+ """
671
+ type LicenseEntitlement {
672
+ entitlementSlug: String!
673
+ entitlementName: String!
674
+ entitlementType: String!
675
+ licenseId: UUID!
676
+ licenseSlug: String!
677
+
678
+ """
679
+ Typed entitlement value. Shapes: {type:"number",value:N},
680
+ {type:"boolean",value:B}, {type:"object",value:{...}}
681
+ """
682
+ value: Map!
683
+
684
+ """
685
+ True when this grant carries the unlimited sentinel (no cap enforced), with
686
+ the exact semantics of the usage reporter. Clients must use this flag instead
687
+ of interpreting raw numeric values.
688
+ """
689
+ unlimited: Boolean!
690
+
691
+ """
692
+ Derives this grant's enforcement from its own numeric value, with no
693
+ separate hard/soft/unlimited flag: -1 when the value is unlimited (no cap,
694
+ no overage); otherwise 0 rejects usage above the value (hard limit) and a
695
+ positive percentage allows usage to exceed it by that much before being
696
+ rejected (soft limit). Null for non-numeric (BOOLEAN/CONFIG) grants.
697
+ """
698
+ limitCapExceededOveragePercent: Int
699
+
700
+ """
701
+ Full entitlement definition (icon, units, userFacing, displayOrder, groups).
702
+ """
703
+ entitlement: Entitlement!
704
+ }
705
+
706
+ extend type License {
707
+ """
708
+ Entitlements granted by this license
709
+ """
710
+ entitlements: [LicenseEntitlement!]!
711
+ }
712
+
713
+ """
714
+ Resource types that can carry typed metadata managed by a MetadataField.
715
+ Mirrors the sqlc enum `metadata_field_resource_type`.
716
+ """
717
+ enum MetadataFieldResourceType {
718
+ DEPLOYMENT_ZONE
719
+ INSTANCE
720
+ }
721
+
722
+ """
723
+ MetadataField defines the typed schema for one key of a resource's `metadata`
724
+ jsonb column. Org-scoped, soft-deletable via `archivedAt`.
725
+
726
+ Mutations (create / update / archive / reorder) are exposed via the REST API,
727
+ under `/api/metadata-fields`. The GraphQL surface is intentionally
728
+ read-only, consistent with the rest of the Kaiten GraphQL aggregator.
729
+ """
730
+ type MetadataField {
731
+ id: UUID!
732
+ resourceType: MetadataFieldResourceType!
733
+ key: String!
734
+ label: String!
735
+ """
736
+ JSON Schema 2020-12 document describing the value space (e.g. {"type":"string","enum":["a","b"]}).
737
+ """
738
+ jsonSchema: Map!
739
+ displayOrder: Int!
740
+ """
741
+ Soft-delete marker. Absent if the field is active.
742
+ Archived fields stay readable so the admin UI can surface legacy values.
743
+ """
744
+ archivedAt: Time
745
+ createdBy: User!
746
+ createdAt: Time!
747
+ updatedBy: User!
748
+ updatedAt: Time!
749
+ }
750
+
751
+ """
752
+ A cursor-paginated page of metadata fields.
753
+ """
754
+ type MetadataFieldPage {
755
+ items: [MetadataField!]!
756
+ """Opaque cursor for the next page. Null when hasMore is false."""
757
+ nextCursor: String
758
+ hasMore: Boolean!
759
+ }
760
+
761
+ extend type Query {
762
+ """
763
+ List MetadataField rows for the current organization and the given resource
764
+ type, cursor-paginated. By default only active fields are returned; pass
765
+ `includeArchived: true` to also return soft-deleted ones (useful for the
766
+ admin UI surfacing legacy values stored on resources).
767
+
768
+ Fields come back in the admin-controlled display order, so paging through
769
+ them yields the same sequence as `GET /metadata-fields`; the two surfaces
770
+ share a cursor format, and a token from either resumes on the other.
771
+ """
772
+ metadataFields(
773
+ resourceType: MetadataFieldResourceType!
774
+ includeArchived: Boolean = false
775
+ """Maximum number of entries to return (default 50, max 200)"""
776
+ limit: Int
777
+ """Opaque cursor from a previous response's nextCursor"""
778
+ cursor: String
779
+ ): MetadataFieldPage!
780
+ }
781
+
782
+ """
783
+ Release represents a software release with its components. A release is
784
+ immutable: it is created with its component list and can only be deleted
785
+ afterwards -- there is no update, so it carries no updated_* fields.
786
+ """
787
+ type Release {
788
+ id: UUID!
789
+ version: String!
790
+ slug: String!
791
+ description: String
792
+ createdBy: User!
793
+ createdAt: Time!
794
+
795
+ """
796
+ Components included in this release, fixed at creation
797
+ """
798
+ components: [Component!]!
799
+
800
+ """
801
+ Deployment zones this release has been deployed to at least once, each listed once
802
+ """
803
+ deploymentZones: [DeploymentZone!]!
804
+
805
+ """
806
+ Instances linked to deployment zones where this release has been deployed historically
807
+ """
808
+ instances: [Instance!]!
809
+
810
+ """
811
+ Every deployment of this release, newest first -- one entry per deployment,
812
+ so a zone it was rolled back to appears more than once
813
+ """
814
+ deployments: [Deployment!]!
815
+ }
816
+
817
+ """
818
+ A cursor-paginated page of releases.
819
+ """
820
+ type ReleasePage {
821
+ items: [Release!]!
822
+ """Opaque cursor for the next page. Null when hasMore is false."""
823
+ nextCursor: String
824
+ hasMore: Boolean!
825
+ }
826
+
827
+ extend type Query {
828
+ """
829
+ Get releases for the current organization, cursor-paginated.
830
+ """
831
+ releases(limit: Int, cursor: String): ReleasePage!
832
+
833
+ """
834
+ Get a specific release by ID or slug (at least one required)
835
+ """
836
+ release(id: UUID, slug: String): Release
837
+ }
838
+