@bedrock-rbx/ocale 0.3.2 → 0.3.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.
@@ -1,8 +1,36 @@
1
1
  import { a as ApiError } from "./network-error-DR9FX5hb.mjs";
2
- import { r as IDEMPOTENT_METHOD_DEFAULTS, t as CREATE_METHOD_DEFAULTS } from "./retry-Cc4LcXYZ.mjs";
2
+ import { r as IDEMPOTENT_METHOD_DEFAULTS, t as CREATE_METHOD_DEFAULTS } from "./retry-vpHMIwaU.mjs";
3
3
  import { t as ValidationError } from "./validation-B_Zs1So2.mjs";
4
4
  import { t as toBlob } from "./to-blob-RPqMBuft.mjs";
5
- import { c as isDateTimeString, n as okRequest, o as toJsonDetails, r as parseEmptyResponse, s as isRecord, t as ResourceClient } from "./resource-client--yYybltk.mjs";
5
+ import { c as isDateTimeString, n as okRequest, o as toJsonDetails, r as parseEmptyResponse, s as isRecord, t as ResourceClient } from "./resource-client-3cOhqZpX.mjs";
6
+ //#region src/internal/utils/positive-integer-id.ts
7
+ const POSITIVE_INTEGER_PATTERN = /^[1-9]\d*$/;
8
+ /**
9
+ * Parses stringified Roblox IDs for a wire field typed as an integer array.
10
+ *
11
+ * @param ids - The stringified IDs.
12
+ * @param field - The parameter the IDs came from.
13
+ * @returns The IDs as numbers, or a {@link ValidationError} naming the
14
+ * first entry that is not a positive integer within the safe-integer
15
+ * range.
16
+ */
17
+ function parsePositiveIntegerIds(ids, { code, field }) {
18
+ const invalid = ids.find((id) => parsePositiveIntegerId(id) === void 0);
19
+ if (invalid !== void 0) return {
20
+ err: new ValidationError(`${field} entry ${JSON.stringify(invalid)} is not a positive integer ID`, { code }),
21
+ success: false
22
+ };
23
+ return {
24
+ data: ids.map(Number),
25
+ success: true
26
+ };
27
+ }
28
+ function parsePositiveIntegerId(value) {
29
+ if (!POSITIVE_INTEGER_PATTERN.test(value)) return;
30
+ const parsed = Number(value);
31
+ return Number.isSafeInteger(parsed) ? parsed : void 0;
32
+ }
33
+ //#endregion
6
34
  //#region src/domains/cloud-v2/universes/builders.ts
7
35
  /**
8
36
  * Dodges `unicorn/no-null` while still emitting a literal `null` onto
@@ -24,6 +52,43 @@ function buildGetRequest(parameters) {
24
52
  });
25
53
  }
26
54
  /**
55
+ * Builds a `POST` request for the Open Cloud `:restartServers` custom
56
+ * method on a universe. A bleed-off duration also sets the wire's
57
+ * `bleedOffServers` flag, which the server needs before it reads the
58
+ * duration.
59
+ *
60
+ * @param parameters - The universe identifier and restart selection.
61
+ * @returns A success result wrapping the request, or a
62
+ * {@link ValidationError} when `placeIds` is empty (Roblox would read it
63
+ * as every place) or holds an ID that is not a positive integer.
64
+ */
65
+ function buildRestartServersRequest({ bleedOffDurationMinutes, placeIds, universeId, ...selection }) {
66
+ if (placeIds?.length === 0) return {
67
+ err: new ValidationError("placeIds must contain at least one place ID", { code: "empty_place_ids" }),
68
+ success: false
69
+ };
70
+ const wirePlaceIds = placeIds === void 0 ? void 0 : parsePositiveIntegerIds(placeIds, {
71
+ code: "invalid_place_id",
72
+ field: "placeIds"
73
+ });
74
+ if (wirePlaceIds?.success === false) return wirePlaceIds;
75
+ const bleedOff = bleedOffDurationMinutes === void 0 ? {} : {
76
+ bleedOffDurationMinutes,
77
+ bleedOffServers: true
78
+ };
79
+ const places = wirePlaceIds === void 0 ? {} : { placeIds: wirePlaceIds.data };
80
+ return okRequest({
81
+ body: {
82
+ ...selection,
83
+ ...bleedOff,
84
+ ...places
85
+ },
86
+ headers: { "content-type": "application/json" },
87
+ method: "POST",
88
+ url: `/cloud/v2/universes/${universeId}:restartServers`
89
+ });
90
+ }
91
+ /**
27
92
  * Builds a `PATCH` request for the Open Cloud "update universe"
28
93
  * endpoint. Derives the `updateMask` query string from the keys
29
94
  * present on `parameters` and emits a JSON body containing those same
@@ -62,14 +127,15 @@ function bodyValueFor(parameters, key) {
62
127
  }
63
128
  //#endregion
64
129
  //#region src/domains/cloud-v2/universes/operations.ts
65
- const PER_MINUTE = 100;
66
- const SECONDS_PER_MINUTE = 60;
130
+ const PER_MINUTE$1 = 100;
131
+ const RESTART_SERVERS_PER_MINUTE = 30;
132
+ const SECONDS_PER_MINUTE$1 = 60;
67
133
  /**
68
134
  * Per-second request ceiling for reading a universe, from the Open
69
135
  * Cloud OpenAPI schema (100 requests per minute per API key owner).
70
136
  */
71
137
  const GET_OPERATION_LIMIT = Object.freeze({
72
- maxPerSecond: PER_MINUTE / SECONDS_PER_MINUTE,
138
+ maxPerSecond: PER_MINUTE$1 / SECONDS_PER_MINUTE$1,
73
139
  operationKey: "universes.get"
74
140
  });
75
141
  /**
@@ -81,7 +147,7 @@ const GET_OPERATION_LIMIT = Object.freeze({
81
147
  * cross-method contention surprises.
82
148
  */
83
149
  const UPDATE_OPERATION_LIMIT = Object.freeze({
84
- maxPerSecond: PER_MINUTE / SECONDS_PER_MINUTE,
150
+ maxPerSecond: PER_MINUTE$1 / SECONDS_PER_MINUTE$1,
85
151
  operationKey: "universes.update"
86
152
  });
87
153
  /**
@@ -92,6 +158,24 @@ const UPDATE_OPERATION_LIMIT = Object.freeze({
92
158
  * generic ApiError.
93
159
  */
94
160
  const UPDATE_REQUIRED_SCOPES = Object.freeze(["universe:write"]);
161
+ /**
162
+ * Per-second request ceiling for restarting a universe's servers, from
163
+ * `Cloud_RestartUniverseServers` in the Open Cloud OpenAPI schema (30
164
+ * requests per minute per API key owner). The burst grants the whole
165
+ * minute's quota up front, since the default of one token would pace a
166
+ * sub-second limit at one call every two seconds.
167
+ */
168
+ const RESTART_OPERATION_LIMIT = Object.freeze({
169
+ burstCapacity: RESTART_SERVERS_PER_MINUTE,
170
+ maxPerSecond: RESTART_SERVERS_PER_MINUTE / SECONDS_PER_MINUTE$1,
171
+ operationKey: "universes.restartServers"
172
+ });
173
+ /**
174
+ * Scopes required to restart a universe's servers, sourced from
175
+ * `x-roblox-scopes` on the `Cloud_RestartUniverseServers` operation in the
176
+ * vendored OpenAPI schema.
177
+ */
178
+ const RESTART_REQUIRED_SCOPES = Object.freeze(["universe:write"]);
95
179
  //#endregion
96
180
  //#region src/domains/cloud-v2/universes/parsers.ts
97
181
  const VISIBILITY_MAP = {
@@ -119,11 +203,11 @@ const OWNER_PATH_PATTERN = /^(?:users|groups)\/(\d+)$/;
119
203
  * an {@link ApiError} when the body does not match the wire schema.
120
204
  */
121
205
  function parseUniverseResponse({ body, status: statusCode }) {
122
- if (!isUniverseWire(body)) return malformed(statusCode, body);
206
+ if (!isUniverseWire(body)) return malformed$1(statusCode, body);
123
207
  const ownerResult = resolveOwner(body);
124
- if (!ownerResult.success) return malformed(statusCode, body);
208
+ if (!ownerResult.success) return malformed$1(statusCode, body);
125
209
  const id = UNIVERSE_PATH_PATTERN.exec(body.path)?.[1];
126
- if (id === void 0) return malformed(statusCode, body);
210
+ if (id === void 0) return malformed$1(statusCode, body);
127
211
  return {
128
212
  data: toUniverse({
129
213
  id,
@@ -133,7 +217,7 @@ function parseUniverseResponse({ body, status: statusCode }) {
133
217
  success: true
134
218
  };
135
219
  }
136
- function malformed(statusCode, body) {
220
+ function malformed$1(statusCode, body) {
137
221
  return {
138
222
  err: new ApiError(MALFORMED_MESSAGE, {
139
223
  details: toJsonDetails(body),
@@ -353,7 +437,6 @@ function toExperienceIcon(wire) {
353
437
  }
354
438
  //#endregion
355
439
  //#region src/domains/game-internationalization/game-thumbnails/builders.ts
356
- const POSITIVE_INTEGER_PATTERN = /^[1-9]\d*$/;
357
440
  /**
358
441
  * Builds a `POST` request for the localized "upload experience thumbnail"
359
442
  * endpoint. Each successful upload appends a new entry to the carousel.
@@ -406,32 +489,14 @@ function buildReorderThumbnailsRequest({ languageCode, orderedImageIds, universe
406
489
  success: true
407
490
  };
408
491
  }
409
- function parseImageId(value) {
410
- if (!POSITIVE_INTEGER_PATTERN.test(value)) return;
411
- const parsed = Number(value);
412
- if (!Number.isSafeInteger(parsed)) return;
413
- return parsed;
414
- }
415
- function appendParsedId(accumulator, id) {
416
- if (!accumulator.success) return accumulator;
417
- const parsed = parseImageId(id);
418
- if (parsed === void 0) return {
419
- err: new ValidationError(`orderedImageIds entry ${JSON.stringify(id)} is not a positive integer ID`, { code: "invalid_image_id" }),
420
- success: false
421
- };
422
- return {
423
- data: [...accumulator.data, parsed],
424
- success: true
425
- };
426
- }
427
492
  function parseOrderedImageIds(orderedImageIds) {
428
493
  if (orderedImageIds.length === 0) return {
429
494
  err: new ValidationError("orderedImageIds must contain at least one image ID", { code: "empty_image_ids" }),
430
495
  success: false
431
496
  };
432
- return orderedImageIds.reduce(appendParsedId, {
433
- data: [],
434
- success: true
497
+ return parsePositiveIntegerIds(orderedImageIds, {
498
+ code: "invalid_image_id",
499
+ field: "orderedImageIds"
435
500
  });
436
501
  }
437
502
  //#endregion
@@ -483,6 +548,384 @@ function isGameThumbnailUploadWire(body) {
483
548
  return typeof body["mediaAssetId"] === "string";
484
549
  }
485
550
  //#endregion
551
+ //#region src/domains/server-management/restarts/builders.ts
552
+ /**
553
+ * Builds a `GET` request for the server-management restart forecast.
554
+ *
555
+ * @param parameters - The universe identifier.
556
+ * @returns A success result wrapping the request; the builder cannot fail.
557
+ */
558
+ function buildForecastRequest(parameters) {
559
+ return okRequest({
560
+ method: "GET",
561
+ url: `/server-management/v1/universes/${parameters.universeId}/restarts:forecast`
562
+ });
563
+ }
564
+ /**
565
+ * Builds a `POST` request that launches a server-management restart. The
566
+ * body is never omitted: the endpoint answers 415 to a POST without one.
567
+ *
568
+ * @param parameters - The universe identifier and restart selection.
569
+ * @returns A success result wrapping the request; the builder cannot fail.
570
+ */
571
+ function buildLaunchRequest({ universeId, ...selection }) {
572
+ return okRequest({
573
+ body: selection,
574
+ headers: { "content-type": "application/json" },
575
+ method: "POST",
576
+ url: `/server-management/v1/universes/${universeId}/restarts`
577
+ });
578
+ }
579
+ /**
580
+ * Builds a `GET` request that lists a universe's server-management
581
+ * restarts.
582
+ *
583
+ * @param parameters - The universe identifier.
584
+ * @returns A success result wrapping the request; the builder cannot fail.
585
+ */
586
+ function buildListRequest(parameters) {
587
+ return okRequest({
588
+ method: "GET",
589
+ url: `/server-management/v1/universes/${parameters.universeId}/restarts`
590
+ });
591
+ }
592
+ //#endregion
593
+ //#region src/domains/server-management/restarts/operations.ts
594
+ const PER_MINUTE = 100;
595
+ const SECONDS_PER_MINUTE = 60;
596
+ /**
597
+ * Per-second request ceiling for `Restarts_ForecastRestart`, from the
598
+ * Open Cloud OpenAPI schema (100 requests per minute per API key owner).
599
+ * Live headers show it metered apart from launch and list.
600
+ */
601
+ const FORECAST_OPERATION_LIMIT = Object.freeze({
602
+ maxPerSecond: PER_MINUTE / SECONDS_PER_MINUTE,
603
+ operationKey: "restarts.forecast"
604
+ });
605
+ /**
606
+ * Scopes required to read restart forecasts and statuses, sourced from
607
+ * `x-roblox-scopes` on `Restarts_ForecastRestart` and
608
+ * `Restarts_ListRestartStatuses` in the vendored OpenAPI schema.
609
+ */
610
+ const READ_REQUIRED_SCOPES = Object.freeze(["universe:read"]);
611
+ /**
612
+ * Per-second request ceiling for `Restarts_LaunchRestart`, from the Open
613
+ * Cloud OpenAPI schema (100 requests per minute per API key owner).
614
+ */
615
+ const LAUNCH_OPERATION_LIMIT = Object.freeze({
616
+ maxPerSecond: PER_MINUTE / SECONDS_PER_MINUTE,
617
+ operationKey: "restarts.launch"
618
+ });
619
+ /**
620
+ * Scopes required to launch a restart, sourced from `x-roblox-scopes` on
621
+ * `Restarts_LaunchRestart` in the vendored OpenAPI schema.
622
+ */
623
+ const LAUNCH_REQUIRED_SCOPES = Object.freeze(["universe:write"]);
624
+ /**
625
+ * Per-second request ceiling for `Restarts_ListRestartStatuses`, from the
626
+ * Open Cloud OpenAPI schema (100 requests per minute per API key owner).
627
+ */
628
+ const LIST_OPERATION_LIMIT = Object.freeze({
629
+ maxPerSecond: PER_MINUTE / SECONDS_PER_MINUTE,
630
+ operationKey: "restarts.list"
631
+ });
632
+ //#endregion
633
+ //#region src/domains/server-management/restarts/parsers.ts
634
+ const RESTART_STATES = new Set([
635
+ "DELAYING",
636
+ "RESTARTING",
637
+ "SUCCEEDED"
638
+ ]);
639
+ /** The ID Roblox returns from a launch that matched no live server. */
640
+ const NIL_RESTART_ID = "00000000-0000-0000-0000-000000000000";
641
+ /**
642
+ * Parses a `ForecastRestartResponse` body into one
643
+ * {@link PlaceRestartForecast} per place.
644
+ *
645
+ * @param response - The full {@link HttpResponse} from the Open Cloud API.
646
+ * @returns A success result wrapping the forecasts, or an {@link ApiError}
647
+ * when the body does not match the wire schema.
648
+ */
649
+ function parseForecastResponse({ body, status: statusCode }) {
650
+ if (!isForecastWire(body)) return malformed("Malformed restart forecast response", {
651
+ body,
652
+ statusCode
653
+ });
654
+ return {
655
+ data: Object.entries(body.placeForecasts ?? {}).map(([placeId, summary]) => {
656
+ return toForecast(placeId, summary);
657
+ }),
658
+ success: true
659
+ };
660
+ }
661
+ /**
662
+ * Parses a `LaunchRestartResponse` body into a {@link LaunchedRestart}.
663
+ *
664
+ * @param response - The full {@link HttpResponse} from the Open Cloud API.
665
+ * @returns A success result wrapping the launched restart, or an
666
+ * {@link ApiError} when the body does not match the wire schema.
667
+ */
668
+ function parseLaunchResponse({ body, status: statusCode }) {
669
+ if (!isLaunchWire(body)) return malformed("Malformed restart launch response", {
670
+ body,
671
+ statusCode
672
+ });
673
+ return {
674
+ data: {
675
+ id: body.id === NIL_RESTART_ID ? void 0 : body.id ?? void 0,
676
+ instancesImpacted: body.instancesImpacted,
677
+ playersImpacted: body.playersImpacted
678
+ },
679
+ success: true
680
+ };
681
+ }
682
+ /**
683
+ * Parses a `ListRestartStatusesResponse` body into one
684
+ * {@link RestartStatus} per restart.
685
+ *
686
+ * @param response - The full {@link HttpResponse} from the Open Cloud API.
687
+ * @returns A success result wrapping the restarts, or an {@link ApiError}
688
+ * when the body does not match the wire schema.
689
+ */
690
+ function parseListResponse({ body, status: statusCode }) {
691
+ if (!isListWire(body)) return malformed("Malformed restart list response", {
692
+ body,
693
+ statusCode
694
+ });
695
+ return {
696
+ data: Object.entries(body.restartStatuses ?? {}).map(([id, status]) => {
697
+ return toRestartStatus(id, status);
698
+ }),
699
+ success: true
700
+ };
701
+ }
702
+ function malformed(message, { body, statusCode }) {
703
+ return {
704
+ err: new ApiError(message, {
705
+ details: toJsonDetails(body),
706
+ statusCode
707
+ }),
708
+ success: false
709
+ };
710
+ }
711
+ function toForecast(placeId, summary) {
712
+ return {
713
+ instancesImpacted: summary.instancesImpacted,
714
+ instancesPerVersion: summary.instancesPerVersion ?? {},
715
+ isNotInUniverse: summary.isNotInUniverse,
716
+ latestPlaceVersion: summary.latestPlaceVersion ?? void 0,
717
+ placeId,
718
+ playersImpacted: summary.playersImpacted,
719
+ playersPerVersion: summary.playersPerVersion ?? {},
720
+ publishedAt: new Date(summary.publishTime),
721
+ totalInstances: summary.totalInstances,
722
+ totalPlayers: summary.totalPlayers
723
+ };
724
+ }
725
+ /**
726
+ * Whether a nullable wire field carries no value: absent, `undefined`, or
727
+ * JSON `null`.
728
+ *
729
+ * @param value - The wire value.
730
+ * @returns `true` when the field carries no value.
731
+ */
732
+ function isAbsent(value) {
733
+ return (value ?? void 0) === void 0;
734
+ }
735
+ function isOptional(value, isPresent) {
736
+ return isAbsent(value) || isPresent(value);
737
+ }
738
+ function isOptionalRecordOf(value, isEntry) {
739
+ return isOptional(value, (record) => isRecord(record) && Object.values(record).every(isEntry));
740
+ }
741
+ function isNumber(value) {
742
+ return typeof value === "number";
743
+ }
744
+ function isString(value) {
745
+ return typeof value === "string";
746
+ }
747
+ function isPlaceSummaryWire(value) {
748
+ return isRecord(value) && typeof value["instancesImpacted"] === "number" && typeof value["isNotInUniverse"] === "boolean" && typeof value["playersImpacted"] === "number" && isDateTimeString(value["publishTime"]) && typeof value["totalInstances"] === "number" && typeof value["totalPlayers"] === "number" && isOptional(value["latestPlaceVersion"], isString) && isOptionalRecordOf(value["instancesPerVersion"], isNumber) && isOptionalRecordOf(value["playersPerVersion"], isNumber);
749
+ }
750
+ function isForecastWire(body) {
751
+ return isRecord(body) && isOptionalRecordOf(body["placeForecasts"], isPlaceSummaryWire);
752
+ }
753
+ function isLaunchWire(body) {
754
+ return isRecord(body) && isOptional(body["id"], isString) && typeof body["instancesImpacted"] === "number" && typeof body["playersImpacted"] === "number";
755
+ }
756
+ function toFilter(filter) {
757
+ const wire = filter ?? void 0;
758
+ if (wire === void 0) return;
759
+ const versions = wire.versions ?? void 0;
760
+ if (versions !== void 0) return { versions };
761
+ const excludeCurrentVersion = wire.excludeCurrentVersion ?? void 0;
762
+ return excludeCurrentVersion === void 0 ? {} : { excludeCurrentVersion };
763
+ }
764
+ function toPlaceStatus(placeId, wire) {
765
+ return {
766
+ endedAt: typeof wire.endTime === "string" ? new Date(wire.endTime) : void 0,
767
+ filter: toFilter(wire.filter),
768
+ latestVersion: wire.latestVersion ?? void 0,
769
+ placeId,
770
+ remainingInstances: wire.remainingInstances,
771
+ remainingPlayers: wire.remainingPlayers,
772
+ startedAt: new Date(wire.startTime),
773
+ state: wire.state,
774
+ totalInstances: wire.totalInstances,
775
+ totalPlayers: wire.totalPlayers
776
+ };
777
+ }
778
+ function toRestartStatus(id, wire) {
779
+ return {
780
+ id,
781
+ places: Object.entries(wire.placeRestartStatuses ?? {}).map(([placeId, status]) => {
782
+ return toPlaceStatus(placeId, status);
783
+ }),
784
+ scheduledAt: new Date(wire.scheduledTime),
785
+ startsAt: new Date(wire.startTime)
786
+ };
787
+ }
788
+ function isVersions(value) {
789
+ return Array.isArray(value) && value.every(isNumber);
790
+ }
791
+ function isFilterWire(value) {
792
+ return isRecord(value) && isOptional(value["excludeCurrentVersion"], (exclude) => typeof exclude === "boolean") && isOptional(value["versions"], isVersions);
793
+ }
794
+ function isPlaceStatusWire(value) {
795
+ return isRecord(value) && RESTART_STATES.has(value["state"]) && isDateTimeString(value["startTime"]) && isOptional(value["endTime"], isDateTimeString) && typeof value["totalPlayers"] === "number" && typeof value["totalInstances"] === "number" && typeof value["remainingPlayers"] === "number" && typeof value["remainingInstances"] === "number" && isOptional(value["filter"], isFilterWire) && isOptional(value["latestVersion"], isString);
796
+ }
797
+ function isRestartStatusWire(value) {
798
+ return isRecord(value) && isDateTimeString(value["scheduledTime"]) && isDateTimeString(value["startTime"]) && isOptionalRecordOf(value["placeRestartStatuses"], isPlaceStatusWire);
799
+ }
800
+ function isListWire(body) {
801
+ return isRecord(body) && isOptionalRecordOf(body["restartStatuses"], isRestartStatusWire);
802
+ }
803
+ //#endregion
804
+ //#region src/resources/universes/restarts-group.ts
805
+ function makeSpec(spec) {
806
+ return Object.freeze(spec);
807
+ }
808
+ const FORECAST_SPEC = makeSpec({
809
+ buildRequest: buildForecastRequest,
810
+ methodDefaults: IDEMPOTENT_METHOD_DEFAULTS,
811
+ methodKind: "idempotent",
812
+ operationLimit: FORECAST_OPERATION_LIMIT,
813
+ parse: parseForecastResponse,
814
+ requiredScopes: READ_REQUIRED_SCOPES
815
+ });
816
+ const LAUNCH_SPEC = makeSpec({
817
+ buildRequest: buildLaunchRequest,
818
+ methodDefaults: CREATE_METHOD_DEFAULTS,
819
+ methodKind: "create",
820
+ operationLimit: LAUNCH_OPERATION_LIMIT,
821
+ parse: parseLaunchResponse,
822
+ requiredScopes: LAUNCH_REQUIRED_SCOPES
823
+ });
824
+ const LIST_SPEC = makeSpec({
825
+ buildRequest: buildListRequest,
826
+ methodDefaults: IDEMPOTENT_METHOD_DEFAULTS,
827
+ methodKind: "idempotent",
828
+ operationLimit: LIST_OPERATION_LIMIT,
829
+ parse: parseListResponse,
830
+ requiredScopes: READ_REQUIRED_SCOPES
831
+ });
832
+ /**
833
+ * Operation Group on `UniversesClient` that exposes the server-management
834
+ * restart endpoints: preview a restart, launch one, and track it. The
835
+ * endpoints are BETA on the Roblox side.
836
+ */
837
+ var UniverseRestartsGroup = class {
838
+ #inner;
839
+ /**
840
+ * Wraps the shared {@link ResourceClient} so the Operation Group
841
+ * routes calls through the same retry, hooks, and rate-limit queues
842
+ * as the rest of the parent client.
843
+ *
844
+ * @param inner - The shared {@link ResourceClient} owned by the
845
+ * parent client.
846
+ */
847
+ constructor(inner) {
848
+ this.#inner = inner;
849
+ }
850
+ /**
851
+ * Reads the live servers of every active place in a universe, and how
852
+ * many of them a restart of old place versions would close.
853
+ *
854
+ * @param parameters - The universe identifier.
855
+ * @param options - Optional per-request overrides.
856
+ * @returns A {@link Result} wrapping one {@link PlaceRestartForecast}
857
+ * per active place (empty when no server runs), or the
858
+ * {@link OpenCloudError} that caused the request to fail.
859
+ */
860
+ async forecast(parameters, options) {
861
+ return this.#inner.executeAsync({
862
+ options,
863
+ parameters,
864
+ spec: FORECAST_SPEC
865
+ });
866
+ }
867
+ /**
868
+ * Launches a restart of a universe's live servers and returns its ID,
869
+ * which `list` reports while the restart runs. When no live server
870
+ * matches, Roblox records no restart and `id` is `undefined`.
871
+ *
872
+ * @example
873
+ * ```ts
874
+ * import { createFakeHttpClient } from "@bedrock-rbx/ocale/testing";
875
+ * import { UniversesClient } from "@bedrock-rbx/ocale/universes";
876
+ *
877
+ * const httpClient = createFakeHttpClient().mockResponse({
878
+ * body: {
879
+ * id: "00000000-0000-0000-0000-000000000000",
880
+ * instancesImpacted: 0,
881
+ * playersImpacted: 0,
882
+ * },
883
+ * status: 200,
884
+ * });
885
+ * const client = new UniversesClient({ apiKey: "your-key", httpClient });
886
+ *
887
+ * return client.restarts
888
+ * .launch({ bleedOffDurationMinutes: 5, universeId: "42" })
889
+ * .then((result) => {
890
+ * expect(result).toEqual({
891
+ * data: { id: undefined, instancesImpacted: 0, playersImpacted: 0 },
892
+ * success: true,
893
+ * });
894
+ * });
895
+ * ```
896
+ *
897
+ * @param parameters - The universe identifier.
898
+ * @param options - Optional per-request overrides.
899
+ * @returns A {@link Result} wrapping the {@link LaunchedRestart}, or
900
+ * the {@link OpenCloudError} that caused the request to fail.
901
+ */
902
+ async launch(parameters, options) {
903
+ return this.#inner.executeAsync({
904
+ options,
905
+ parameters,
906
+ spec: LAUNCH_SPEC
907
+ });
908
+ }
909
+ /**
910
+ * Lists a universe's restarts with their progress per place. A
911
+ * `:restartServers` call that selected a server appears here too, but
912
+ * only `launch` returns the ID to match it by.
913
+ *
914
+ * @param parameters - The universe identifier.
915
+ * @param options - Optional per-request overrides.
916
+ * @returns A {@link Result} wrapping one {@link RestartStatus} per
917
+ * restart, or the {@link OpenCloudError} that caused the request to
918
+ * fail.
919
+ */
920
+ async list(parameters, options) {
921
+ return this.#inner.executeAsync({
922
+ options,
923
+ parameters,
924
+ spec: LIST_SPEC
925
+ });
926
+ }
927
+ };
928
+ //#endregion
486
929
  //#region src/resources/universes/client.ts
487
930
  const GET_SPEC = Object.freeze({
488
931
  buildRequest: buildGetRequest,
@@ -499,6 +942,14 @@ const UPDATE_SPEC = Object.freeze({
499
942
  parse: parseUniverseResponse,
500
943
  requiredScopes: UPDATE_REQUIRED_SCOPES
501
944
  });
945
+ const RESTART_SERVERS_SPEC = Object.freeze({
946
+ buildRequest: buildRestartServersRequest,
947
+ methodDefaults: CREATE_METHOD_DEFAULTS,
948
+ methodKind: "create",
949
+ operationLimit: RESTART_OPERATION_LIMIT,
950
+ parse: parseEmptyResponse,
951
+ requiredScopes: RESTART_REQUIRED_SCOPES
952
+ });
502
953
  function buildIconUploadOkRequest(parameters) {
503
954
  return okRequest(buildUploadIconRequest(parameters));
504
955
  }
@@ -602,6 +1053,12 @@ var UniversesClient = class {
602
1053
  */
603
1054
  icon;
604
1055
  /**
1056
+ * Operation Group exposing the server-management restart Operations
1057
+ * (`forecast`, `launch`, `list`). Shares the parent client's HTTP,
1058
+ * rate-limit, and retry plumbing.
1059
+ */
1060
+ restarts;
1061
+ /**
605
1062
  * Operation Group exposing the localized experience-thumbnail
606
1063
  * Operations (`upload`, `delete`, `reorder`) backed by the
607
1064
  * `legacy-game-internationalization` domain. No list-thumbnails
@@ -621,6 +1078,7 @@ var UniversesClient = class {
621
1078
  constructor(options) {
622
1079
  this.#inner = new ResourceClient(options);
623
1080
  this.icon = createIconHandle(this.#inner);
1081
+ this.restarts = new UniverseRestartsGroup(this.#inner);
624
1082
  this.thumbnails = createThumbnailsHandle(this.#inner);
625
1083
  }
626
1084
  /**
@@ -640,6 +1098,23 @@ var UniversesClient = class {
640
1098
  });
641
1099
  }
642
1100
  /**
1101
+ * Restarts the live servers of a universe so players move onto the
1102
+ * latest published place versions.
1103
+ *
1104
+ * @param parameters - The universe identifier, plus optional place,
1105
+ * version, and bleed-off selection.
1106
+ * @param options - Optional per-request overrides.
1107
+ * @returns A success {@link Result} with no payload, or the
1108
+ * {@link OpenCloudError} that caused the request to fail.
1109
+ */
1110
+ async restartServers(parameters, options) {
1111
+ return this.#inner.executeAsync({
1112
+ options,
1113
+ parameters,
1114
+ spec: RESTART_SERVERS_SPEC
1115
+ });
1116
+ }
1117
+ /**
643
1118
  * Partially updates a universe's configuration. The fields
644
1119
  * supplied on `parameters` (excluding `universeId`) are forwarded
645
1120
  * to the server via a Google-style `updateMask`; unmentioned