@crowdedkingdoms/crowdyjs 12.2.0 → 13.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.
@@ -1,12 +1,13 @@
1
- import { CpEnvironmentsDocument, CpEnvironmentDocument, CpChangeOrdersDocument, CpChangeOrderDocument, CpAuditDocument, CpSecretsDocument, CpEnvSecretsDocument, CpOvhCatalogSummaryDocument, CpComputePlatformCeilingsDocument, CpSetComputePlatformCeilingsDocument, CpUsageSummaryDocument, CpUnreleasedGameApiTagsDocument, CpEnvironmentVersionsDocument, OperatorUsersDocument, SetEnvironmentDeletionProtectionDocument, PutCpSecretDocument, DeleteCpSecretDocument, PutCpEnvSecretDocument, IngestEnvironmentVersionDocument, PublishEnvironmentReleaseFromGameApiTagDocument, YankEnvironmentVersionDocument, } from '../generated/graphql.js';
1
+ import { CpComputePlatformCeilingsDocument, CpSetComputePlatformCeilingsDocument, } from '../generated/graphql.js';
2
2
  /**
3
- * Operator (control-plane) surface — exposed as `client.operator`.
3
+ * Operator (platform-policy) surface — exposed as `client.operator`.
4
4
  *
5
- * Targets the **management-api**. EVERY operation here requires
6
- * `users.is_operator` (super-admins implicitly have it). This is the privileged
7
- * platform-operations surface (cross-org environment administration, secrets,
8
- * release management) and is NOT for end users. Mutations write audit entries
9
- * and several have real side effects (GitHub commits, deploy retargeting).
5
+ * As of the unified galaxy API this surface is reduced to the platform-wide
6
+ * compute ceilings: dedicated customer environments were retired, and the
7
+ * infrastructure control plane (environments, change orders, secrets, release
8
+ * management, audit) moved to the separate infra-control-plane service with
9
+ * its own auth and operator console. EVERY operation here still requires
10
+ * `users.is_operator` (super-admins implicitly have it).
10
11
  *
11
12
  * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` without a session, `FORBIDDEN`
12
13
  * when the caller is not an operator.
@@ -16,107 +17,10 @@ export class ControlPlaneAPI {
16
17
  this.management = management;
17
18
  }
18
19
  /**
19
- * Paginated list of every environment across all orgs (1-based paging).
20
+ * The platform-wide compute ceilings (max modules, tick rates, fuel,
21
+ * memory, run time, db-op and egress budgets).
20
22
  *
21
- * @param opts - Optional `page` (default 1) and `pageSize` (default 50).
22
- * @returns A page of operator environment rows.
23
- */
24
- async environments(opts = {}) {
25
- const data = await this.management.request(CpEnvironmentsDocument, {
26
- page: opts.page,
27
- pageSize: opts.pageSize,
28
- });
29
- return data.cpEnvironments;
30
- }
31
- /**
32
- * Operator view of one environment by slug (across any org).
33
- *
34
- * @param slug - Environment slug.
35
- * @returns The environment row, or `null` if not found.
36
- */
37
- async environment(slug) {
38
- const data = await this.management.request(CpEnvironmentDocument, { slug });
39
- return data.cpEnvironment;
40
- }
41
- /**
42
- * Paginated change orders, optionally filtered by environment.
43
- *
44
- * @param opts - Optional `environmentId` filter, `page`, `pageSize`.
45
- * @returns A page of change-order rows.
46
- */
47
- async changeOrders(opts = {}) {
48
- const data = await this.management.request(CpChangeOrdersDocument, {
49
- environmentId: opts.environmentId,
50
- page: opts.page,
51
- pageSize: opts.pageSize,
52
- });
53
- return data.cpChangeOrders;
54
- }
55
- /**
56
- * One change order with its tasks and steps.
57
- *
58
- * @param id - Change order UUID.
59
- * @returns The change-order detail, or `null` if not found.
60
- */
61
- async changeOrder(id) {
62
- const data = await this.management.request(CpChangeOrderDocument, { id });
63
- return data.cpChangeOrder;
64
- }
65
- /**
66
- * Most recent operator audit entries (newest first), optionally filtered.
67
- *
68
- * @param opts - Optional `environmentId` filter and `limit` (default 200).
69
- * @returns The audit entries.
70
- */
71
- async audit(opts = {}) {
72
- const data = await this.management.request(CpAuditDocument, {
73
- environmentId: opts.environmentId,
74
- limit: opts.limit,
75
- });
76
- return data.cpAudit;
77
- }
78
- /**
79
- * Control-plane secret metadata (names/kinds only, never plaintext).
80
- *
81
- * @param environmentId - Optional environment UUID filter.
82
- * @returns The secret metadata rows.
83
- */
84
- async secrets(environmentId) {
85
- const data = await this.management.request(CpSecretsDocument, {
86
- environmentId,
87
- });
88
- return data.cpSecrets;
89
- }
90
- /**
91
- * Environment-delivered secret metadata (names/kinds only, never plaintext).
92
- *
93
- * @param environmentId - Optional environment UUID filter.
94
- * @returns The env-secret metadata rows.
95
- */
96
- async envSecrets(environmentId) {
97
- const data = await this.management.request(CpEnvSecretsDocument, {
98
- environmentId,
99
- });
100
- return data.cpEnvSecrets;
101
- }
102
- /**
103
- * OVH flavor catalog with provider vs. customer pricing.
104
- *
105
- * @param region - Optional region code filter (e.g. `'GRA11'`).
106
- * @returns The catalog rows.
107
- */
108
- async ovhCatalogSummary(region) {
109
- const data = await this.management.request(CpOvhCatalogSummaryDocument, {
110
- region,
111
- });
112
- return data.cpOvhCatalogSummary;
113
- }
114
- /**
115
- * Platform-wide compute ceilings (the maxima `computeSetPolicy` clamps to).
116
- * Every knob is nullable: `null` means no operator override, so the
117
- * env-var/bootstrap default applies on the game-api side.
118
- *
119
- * @returns The stored ceiling overrides plus updatedAt/updatedByUserId.
23
+ * @returns The stored ceilings row.
120
24
  */
121
25
  async computePlatformCeilings() {
122
26
  const data = await this.management.request(CpComputePlatformCeilingsDocument);
@@ -125,10 +29,9 @@ export class ControlPlaneAPI {
125
29
  /**
126
30
  * Patch the platform compute ceilings. Patch semantics per knob: omit =
127
31
  * unchanged, explicit `null` = clear the override (fall back to the
128
- * game-api bootstrap default), positive value = set. Changes replica-sync
129
- * to game-api and take effect on the next `computeSetPolicy` call (no
130
- * restart), within a 30s cache bound. Writes a
131
- * `compute.platform_ceilings_set` audit entry.
32
+ * game-api bootstrap default), positive value = set. Takes effect on the
33
+ * next `computeSetPolicy` call (no restart), within a 30s cache bound.
34
+ * Writes a `compute.platform_ceilings_set` audit entry.
132
35
  *
133
36
  * @param input - The per-knob patch.
134
37
  * @returns The stored ceilings after the patch.
@@ -137,142 +40,4 @@ export class ControlPlaneAPI {
137
40
  const data = await this.management.request(CpSetComputePlatformCeilingsDocument, { input });
138
41
  return data.cpSetComputePlatformCeilings;
139
42
  }
140
- /**
141
- * Operator per-minute usage summary for any environment (not org-scoped).
142
- *
143
- * @param environmentSlug - Environment slug.
144
- * @param since - Start of the window (ISO-8601 DateTime) up to now.
145
- * @returns The usage summary.
146
- */
147
- async usageSummary(environmentSlug, since) {
148
- const data = await this.management.request(CpUsageSummaryDocument, {
149
- environmentSlug,
150
- since,
151
- });
152
- return data.cpUsageSummary;
153
- }
154
- /**
155
- * cks-game-api git tags not yet pinned by any environment release.
156
- *
157
- * @returns The unreleased tags with proposed versions.
158
- */
159
- async unreleasedGameApiTags() {
160
- const data = await this.management.request(CpUnreleasedGameApiTagsDocument, {});
161
- return data.cpUnreleasedGameApiTags;
162
- }
163
- /**
164
- * Environment release manifests merged from git + DB.
165
- *
166
- * @returns The version rows with latest-available and git-source flags.
167
- */
168
- async environmentVersions() {
169
- const data = await this.management.request(CpEnvironmentVersionsDocument, {});
170
- return data.cpEnvironmentVersions;
171
- }
172
- /**
173
- * List users with operator and/or super-admin privileges.
174
- *
175
- * @returns The privileged users.
176
- */
177
- async operatorUsers() {
178
- const data = await this.management.request(OperatorUsersDocument, {});
179
- return data.operatorUsers;
180
- }
181
- /**
182
- * Toggle deletion protection on an environment (blocks purge when enabled).
183
- * Writes an audit entry.
184
- *
185
- * @param environmentId - Environment UUID.
186
- * @param enabled - `true` to protect, `false` to unprotect.
187
- * @returns `true` on success.
188
- */
189
- async setDeletionProtection(environmentId, enabled) {
190
- const data = await this.management.request(SetEnvironmentDeletionProtectionDocument, { environmentId, enabled });
191
- return data.setEnvironmentDeletionProtection;
192
- }
193
- /**
194
- * Create/overwrite a control-plane secret (plaintext is write-only). Writes an
195
- * audit entry.
196
- *
197
- * @param environmentId - Environment UUID.
198
- * @param name - Secret name/key.
199
- * @param plaintext - Secret value to encrypt and store.
200
- * @param kind - Optional classification tag.
201
- * @returns The secret metadata row.
202
- */
203
- async putSecret(environmentId, name, plaintext, kind) {
204
- const data = await this.management.request(PutCpSecretDocument, {
205
- environmentId,
206
- name,
207
- plaintext,
208
- kind,
209
- });
210
- return data.putCpSecret;
211
- }
212
- /**
213
- * Delete a control-plane secret by environment + name. Writes an audit entry.
214
- *
215
- * @param environmentId - Environment UUID.
216
- * @param name - Secret name/key to delete.
217
- * @returns `true` when a secret was removed.
218
- */
219
- async deleteSecret(environmentId, name) {
220
- const data = await this.management.request(DeleteCpSecretDocument, {
221
- environmentId,
222
- name,
223
- });
224
- return data.deleteCpSecret;
225
- }
226
- /**
227
- * Create/overwrite an environment-delivered secret (injected into the tenant
228
- * runtime; plaintext is write-only). Writes an audit entry.
229
- *
230
- * @param environmentId - Environment UUID.
231
- * @param name - Secret name/key.
232
- * @param plaintext - Secret value to encrypt and store.
233
- * @param kind - Optional classification tag.
234
- * @returns The env-secret metadata row.
235
- */
236
- async putEnvSecret(environmentId, name, plaintext, kind) {
237
- const data = await this.management.request(PutCpEnvSecretDocument, {
238
- environmentId,
239
- name,
240
- plaintext,
241
- kind,
242
- });
243
- return data.putCpEnvSecret;
244
- }
245
- /**
246
- * Ingest a release manifest into the deployable catalog. Writes an audit
247
- * entry.
248
- *
249
- * @param input - {@link IngestEnvironmentVersionInput} (version, force).
250
- * @returns The ingested version row.
251
- */
252
- async ingestEnvironmentVersion(input) {
253
- const data = await this.management.request(IngestEnvironmentVersionDocument, { input });
254
- return data.ingestEnvironmentVersion;
255
- }
256
- /**
257
- * Cut a new environment release from a cks-game-api git tag (ingests + commits
258
- * the manifest to git). SIDE EFFECT: retargets redeploy and writes to GitHub.
259
- *
260
- * @param input - {@link PublishEnvironmentReleaseFromGameApiTagInput}.
261
- * @returns The publish result.
262
- */
263
- async publishReleaseFromGameApiTag(input) {
264
- const data = await this.management.request(PublishEnvironmentReleaseFromGameApiTagDocument, { input });
265
- return data.publishEnvironmentReleaseFromGameApiTag;
266
- }
267
- /**
268
- * Yank (withdraw) an environment version so it can no longer be deployed.
269
- * Existing environments are unaffected. Writes an audit entry.
270
- *
271
- * @param version - Environment version to yank (e.g. `'v0.1.4'`).
272
- * @returns `true` on success.
273
- */
274
- async yankEnvironmentVersion(version) {
275
- const data = await this.management.request(YankEnvironmentVersionDocument, { version });
276
- return data.yankEnvironmentVersion;
277
- }
278
43
  }
@@ -1,13 +1,17 @@
1
1
  import type { GraphQLClient } from '../client.js';
2
- import { type EnvironmentUsageSummaryQuery, type OrgUsageByEnvironmentQuery, type EnvironmentUsageByAppQuery, type AppGraphqlOperationsQuery, type AppUsageSummaryQuery, type PlayerPulseQuery } from '../generated/graphql.js';
2
+ import { type AppGraphqlOperationsQuery, type AppUsageSummaryQuery, type PlayerPulseQuery } from '../generated/graphql.js';
3
3
  /**
4
4
  * Replication + GraphQL usage reporting — exposed as `client.usage` (and
5
5
  * grouped under `client.admin`).
6
6
  *
7
- * Targets the **management-api**. All operations are read-only observability and
8
- * require the `view_usage` org permission. `since` args are ISO-8601 `DateTime`
9
- * strings; byte/message counters are returned as string counters because they
10
- * can exceed the 32-bit Int range. `BigInt` ids are decimal strings.
7
+ * All operations are read-only observability and require the `view_usage` org
8
+ * permission. `since` args are ISO-8601 `DateTime` strings; byte/message
9
+ * counters are returned as string counters because they can exceed the 32-bit
10
+ * Int range. `BigInt` ids are decimal strings.
11
+ *
12
+ * As of the unified galaxy API the per-environment rollups
13
+ * (environmentSummary/orgByEnvironment/environmentByApp) were retired with
14
+ * dedicated customer environments — usage is org/app-scoped.
11
15
  *
12
16
  * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `FORBIDDEN` / `SCOPE_MISSING`
13
17
  * per the permission notes above.
@@ -15,33 +19,6 @@ import { type EnvironmentUsageSummaryQuery, type OrgUsageByEnvironmentQuery, typ
15
19
  export declare class UsageAPI {
16
20
  private readonly management;
17
21
  constructor(management: GraphQLClient);
18
- /**
19
- * Per-minute replication + GraphQL usage time series for one environment,
20
- * with rate peaks and live Buddy rates.
21
- *
22
- * @param orgId - Numeric org id.
23
- * @param environmentSlug - Environment slug to report on.
24
- * @param since - Start of the window (ISO-8601 DateTime) up to now.
25
- * @returns The {@link EnvironmentUsageSummary}.
26
- */
27
- environmentSummary(orgId: string, environmentSlug: string, since: string): Promise<EnvironmentUsageSummaryQuery['environmentUsageSummary']>;
28
- /**
29
- * Aggregate byte totals per environment across an org for a window.
30
- *
31
- * @param orgId - Numeric org id.
32
- * @param since - Start of the window (ISO-8601 DateTime) up to now.
33
- * @returns One rollup row per environment.
34
- */
35
- orgByEnvironment(orgId: string, since: string): Promise<OrgUsageByEnvironmentQuery['orgUsageByEnvironment']>;
36
- /**
37
- * Aggregate byte totals per app for the apps linked to an environment.
38
- *
39
- * @param orgId - Numeric org id.
40
- * @param environmentSlug - Environment slug whose apps to roll up.
41
- * @param since - Start of the window (ISO-8601 DateTime) up to now.
42
- * @returns One rollup row per app.
43
- */
44
- environmentByApp(orgId: string, environmentSlug: string, since: string): Promise<EnvironmentUsageByAppQuery['environmentUsageByApp']>;
45
22
  /**
46
23
  * Top GraphQL operations for an app ranked by bytes.
47
24
  *
@@ -1 +1 @@
1
- {"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../src/domains/usage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAOL,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;GAWG;AACH,qBAAa,QAAQ;IACP,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,aAAa;IAEtD;;;;;;;;OAQG;IACG,kBAAkB,CACtB,KAAK,EAAE,MAAM,EACb,eAAe,EAAE,MAAM,EACvB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,4BAA4B,CAAC,yBAAyB,CAAC,CAAC;IAQnE;;;;;;OAMG;IACG,gBAAgB,CACpB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,0BAA0B,C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K,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;IAUnD;;;;;;;;OAQG;IACG,WAAW,CACf,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;CAI5C"}
@@ -1,12 +1,16 @@
1
- import { EnvironmentUsageSummaryDocument, OrgUsageByEnvironmentDocument, EnvironmentUsageByAppDocument, AppGraphqlOperationsDocument, AppUsageSummaryDocument, PlayerPulseDocument, } from '../generated/graphql.js';
1
+ import { AppGraphqlOperationsDocument, AppUsageSummaryDocument, PlayerPulseDocument, } from '../generated/graphql.js';
2
2
  /**
3
3
  * Replication + GraphQL usage reporting — exposed as `client.usage` (and
4
4
  * grouped under `client.admin`).
5
5
  *
6
- * Targets the **management-api**. All operations are read-only observability and
7
- * require the `view_usage` org permission. `since` args are ISO-8601 `DateTime`
8
- * strings; byte/message counters are returned as string counters because they
9
- * can exceed the 32-bit Int range. `BigInt` ids are decimal strings.
6
+ * All operations are read-only observability and require the `view_usage` org
7
+ * permission. `since` args are ISO-8601 `DateTime` strings; byte/message
8
+ * counters are returned as string counters because they can exceed the 32-bit
9
+ * Int range. `BigInt` ids are decimal strings.
10
+ *
11
+ * As of the unified galaxy API the per-environment rollups
12
+ * (environmentSummary/orgByEnvironment/environmentByApp) were retired with
13
+ * dedicated customer environments — usage is org/app-scoped.
10
14
  *
11
15
  * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` / `FORBIDDEN` / `SCOPE_MISSING`
12
16
  * per the permission notes above.
@@ -15,49 +19,6 @@ export class UsageAPI {
15
19
  constructor(management) {
16
20
  this.management = management;
17
21
  }
18
- /**
19
- * Per-minute replication + GraphQL usage time series for one environment,
20
- * with rate peaks and live Buddy rates.
21
- *
22
- * @param orgId - Numeric org id.
23
- * @param environmentSlug - Environment slug to report on.
24
- * @param since - Start of the window (ISO-8601 DateTime) up to now.
25
- * @returns The {@link EnvironmentUsageSummary}.
26
- */
27
- async environmentSummary(orgId, environmentSlug, since) {
28
- const data = await this.management.request(EnvironmentUsageSummaryDocument, { orgId, environmentSlug, since });
29
- return data.environmentUsageSummary;
30
- }
31
- /**
32
- * Aggregate byte totals per environment across an org for a window.
33
- *
34
- * @param orgId - Numeric org id.
35
- * @param since - Start of the window (ISO-8601 DateTime) up to now.
36
- * @returns One rollup row per environment.
37
- */
38
- async orgByEnvironment(orgId, since) {
39
- const data = await this.management.request(OrgUsageByEnvironmentDocument, {
40
- orgId,
41
- since,
42
- });
43
- return data.orgUsageByEnvironment;
44
- }
45
- /**
46
- * Aggregate byte totals per app for the apps linked to an environment.
47
- *
48
- * @param orgId - Numeric org id.
49
- * @param environmentSlug - Environment slug whose apps to roll up.
50
- * @param since - Start of the window (ISO-8601 DateTime) up to now.
51
- * @returns One rollup row per app.
52
- */
53
- async environmentByApp(orgId, environmentSlug, since) {
54
- const data = await this.management.request(EnvironmentUsageByAppDocument, {
55
- orgId,
56
- environmentSlug,
57
- since,
58
- });
59
- return data.environmentUsageByApp;
60
- }
61
22
  /**
62
23
  * Top GraphQL operations for an app ranked by bytes.
63
24
  *