@bedrock-rbx/ocale 0.4.0 → 0.5.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 (90) hide show
  1. package/README.md +1 -0
  2. package/dist/assets.d.mts +64 -0
  3. package/dist/assets.d.mts.map +1 -0
  4. package/dist/assets.mjs +301 -0
  5. package/dist/assets.mjs.map +1 -0
  6. package/dist/badge-insufficient-funds-BLFvQZt1.mjs +91 -0
  7. package/dist/badge-insufficient-funds-BLFvQZt1.mjs.map +1 -0
  8. package/dist/badges.d.mts +136 -17
  9. package/dist/badges.d.mts.map +1 -1
  10. package/dist/badges.mjs +375 -99
  11. package/dist/badges.mjs.map +1 -1
  12. package/dist/{capacity-admission-hycCFkTo.d.mts → capacity-admission-Ce2V9QNb.d.mts} +2 -10
  13. package/dist/capacity-admission-Ce2V9QNb.d.mts.map +1 -0
  14. package/dist/{data.generated-D_vpa5-g.d.mts → data.generated-B4Fztv_7.d.mts} +1 -3
  15. package/dist/{data.generated-D_vpa5-g.d.mts.map → data.generated-B4Fztv_7.d.mts.map} +1 -1
  16. package/dist/developer-products.d.mts +29 -11
  17. package/dist/developer-products.d.mts.map +1 -1
  18. package/dist/developer-products.mjs +104 -18
  19. package/dist/developer-products.mjs.map +1 -1
  20. package/dist/game-passes.d.mts +2 -10
  21. package/dist/game-passes.d.mts.map +1 -1
  22. package/dist/game-passes.mjs +12 -18
  23. package/dist/game-passes.mjs.map +1 -1
  24. package/dist/index.d.mts +58 -39
  25. package/dist/index.d.mts.map +1 -1
  26. package/dist/index.mjs +9 -12
  27. package/dist/index.mjs.map +1 -1
  28. package/dist/is-date-time-string-C91G44SI.mjs +19 -0
  29. package/dist/is-date-time-string-C91G44SI.mjs.map +1 -0
  30. package/dist/locales.d.mts +1 -3
  31. package/dist/locales.d.mts.map +1 -1
  32. package/dist/locales.mjs +2 -4
  33. package/dist/locales.mjs.map +1 -1
  34. package/dist/luau-execution.d.mts +2 -8
  35. package/dist/luau-execution.d.mts.map +1 -1
  36. package/dist/luau-execution.mjs +7 -11
  37. package/dist/luau-execution.mjs.map +1 -1
  38. package/dist/{network-error-iVSng5MT.mjs → network-error-P4An7nUB.mjs} +5 -9
  39. package/dist/{network-error-iVSng5MT.mjs.map → network-error-P4An7nUB.mjs.map} +1 -1
  40. package/dist/places.d.mts +57 -9
  41. package/dist/places.d.mts.map +1 -1
  42. package/dist/places.mjs +127 -21
  43. package/dist/places.mjs.map +1 -1
  44. package/dist/{poll-timeout-DzztDymd.mjs → poll-timeout-BCxgN97O.mjs} +4 -6
  45. package/dist/{poll-timeout-DzztDymd.mjs.map → poll-timeout-BCxgN97O.mjs.map} +1 -1
  46. package/dist/{polling-helpers-DfF5dspc.mjs → polling-helpers-BtEYR5dN.mjs} +19 -30
  47. package/dist/polling-helpers-BtEYR5dN.mjs.map +1 -0
  48. package/dist/{price-information-DEkEQ8Pq.mjs → price-information--d6GZAcp.mjs} +3 -4
  49. package/dist/{price-information-DEkEQ8Pq.mjs.map → price-information--d6GZAcp.mjs.map} +1 -1
  50. package/dist/{resource-client-BCKukheG.d.mts → resource-client-CF8SPsV8.d.mts} +3 -9
  51. package/dist/resource-client-CF8SPsV8.d.mts.map +1 -0
  52. package/dist/{resource-client-CaIVr-go.mjs → resource-client-Cm_bPcCs.mjs} +23 -59
  53. package/dist/resource-client-Cm_bPcCs.mjs.map +1 -0
  54. package/dist/{retry-C2oHesDx.d.mts → retry-DYxm_eBU.d.mts} +2 -6
  55. package/dist/retry-DYxm_eBU.d.mts.map +1 -0
  56. package/dist/{retry-CMRDvAR4.mjs → retry-Dv5TsY9O.mjs} +50 -52
  57. package/dist/retry-Dv5TsY9O.mjs.map +1 -0
  58. package/dist/{signatures-JF-7Psce.mjs → signatures-CtJ7jfVN.mjs} +2 -3
  59. package/dist/{signatures-JF-7Psce.mjs.map → signatures-CtJ7jfVN.mjs.map} +1 -1
  60. package/dist/storage.d.mts +2 -12
  61. package/dist/storage.d.mts.map +1 -1
  62. package/dist/storage.mjs +12 -20
  63. package/dist/storage.mjs.map +1 -1
  64. package/dist/testing.d.mts +2 -54
  65. package/dist/testing.d.mts.map +1 -1
  66. package/dist/testing.mjs +16 -30
  67. package/dist/testing.mjs.map +1 -1
  68. package/dist/{to-blob-RPqMBuft.mjs → to-blob-Bqu7bmlE.mjs} +2 -3
  69. package/dist/{to-blob-RPqMBuft.mjs.map → to-blob-Bqu7bmlE.mjs.map} +1 -1
  70. package/dist/{types-CdMr_J1M.d.mts → types-Z4abDJfK.d.mts} +1 -9
  71. package/dist/types-Z4abDJfK.d.mts.map +1 -0
  72. package/dist/universes.d.mts +4 -18
  73. package/dist/universes.d.mts.map +1 -1
  74. package/dist/universes.mjs +27 -47
  75. package/dist/universes.mjs.map +1 -1
  76. package/dist/{validation-964VNlbp.mjs → validation-kaTLLAD1.mjs} +3 -4
  77. package/dist/{validation-964VNlbp.mjs.map → validation-kaTLLAD1.mjs.map} +1 -1
  78. package/dist/{wire-DJqupefn.d.mts → wire-DDG87I-d.d.mts} +1 -3
  79. package/dist/wire-DDG87I-d.d.mts.map +1 -0
  80. package/package.json +8 -7
  81. package/dist/badge-cost-mismatch-DrlvhlQc.mjs +0 -47
  82. package/dist/badge-cost-mismatch-DrlvhlQc.mjs.map +0 -1
  83. package/dist/capacity-admission-hycCFkTo.d.mts.map +0 -1
  84. package/dist/polling-helpers-DfF5dspc.mjs.map +0 -1
  85. package/dist/resource-client-BCKukheG.d.mts.map +0 -1
  86. package/dist/resource-client-CaIVr-go.mjs.map +0 -1
  87. package/dist/retry-C2oHesDx.d.mts.map +0 -1
  88. package/dist/retry-CMRDvAR4.mjs.map +0 -1
  89. package/dist/types-CdMr_J1M.d.mts.map +0 -1
  90. package/dist/wire-DJqupefn.d.mts.map +0 -1
@@ -1,7 +1,7 @@
1
- import { j as isRecord, m as UnexpectedResponseError, t as CREATE_METHOD_DEFAULTS } from "./retry-CMRDvAR4.mjs";
2
- import { n as okRequest, s as toJsonDetails, t as ResourceClient } from "./resource-client-CaIVr-go.mjs";
3
- import { a as pollUntilDoneCoreAsync, c as LIST_LOGS_SPEC, i as defaultPollDelay, l as LuauExecutionCapacityError, n as submitAndPollAsync, o as withBudgetRequestTimeout, r as submitWithCapacityAsync, s as GET_SPEC, t as buildPollDependencies } from "./polling-helpers-DfF5dspc.mjs";
4
- //#region src/domains/cloud-v2/luau-execution-task-binary-inputs/builders.ts
1
+ import { a as pollUntilDoneCoreAsync, c as LIST_LOGS_SPEC, i as defaultPollDelay, l as LuauExecutionCapacityError, n as submitAndPollAsync, o as withBudgetRequestTimeout, r as submitWithCapacityAsync, s as GET_SPEC, t as buildPollDependencies } from "./polling-helpers-BtEYR5dN.mjs";
2
+ import { N as isRecord, m as UnexpectedResponseError, t as CREATE_METHOD_DEFAULTS } from "./retry-Dv5TsY9O.mjs";
3
+ import { n as okRequest, s as toJsonDetails, t as ResourceClient } from "./resource-client-Cm_bPcCs.mjs";
4
+ // src/domains/cloud-v2/luau-execution-task-binary-inputs/builders.ts
5
5
  /**
6
6
  * Builds a `POST` request for the Open Cloud
7
7
  * `Cloud_CreateLuauExecutionSessionTaskBinaryInput` endpoint. The
@@ -19,8 +19,7 @@ function buildCreateBinaryInputRequest({ size, universeId }) {
19
19
  url: `/cloud/v2/universes/${universeId}/luau-execution-session-task-binary-inputs`
20
20
  };
21
21
  }
22
- //#endregion
23
- //#region src/domains/cloud-v2/luau-execution-task-binary-inputs/operations.ts
22
+ // src/domains/cloud-v2/luau-execution-task-binary-inputs/operations.ts
24
23
  const CREATE_PER_MINUTE = 5;
25
24
  /**
26
25
  * Per-second request ceiling for creating a Luau execution task binary
@@ -41,8 +40,7 @@ const CREATE_OPERATION_LIMIT = Object.freeze({
41
40
  * schema.
42
41
  */
43
42
  const CREATE_REQUIRED_SCOPES = Object.freeze(["universe.place.luau-execution-session:write"]);
44
- //#endregion
45
- //#region src/domains/cloud-v2/luau-execution-task-binary-inputs/parsers.ts
43
+ // src/domains/cloud-v2/luau-execution-task-binary-inputs/parsers.ts
46
44
  const PATH_PATTERN = /^universes\/(\d+)\/luau-execution-session-task-binary-inputs\/([^/]+)$/;
47
45
  const MALFORMED_MESSAGE = "Malformed luau-execution-session-task-binary-input response";
48
46
  /**
@@ -76,8 +74,7 @@ function malformed(statusCode, body) {
76
74
  success: false
77
75
  };
78
76
  }
79
- //#endregion
80
- //#region src/resources/luau-execution/client.ts
77
+ // src/resources/luau-execution/client.ts
81
78
  function makeSpec(spec) {
82
79
  return Object.freeze({
83
80
  ...spec,
@@ -176,7 +173,6 @@ function createTasksHandle(inner) {
176
173
  }
177
174
  };
178
175
  }
179
- //#endregion
180
176
  export { LuauExecutionCapacityError, LuauExecutionClient, defaultPollDelay };
181
177
 
182
178
  //# sourceMappingURL=luau-execution.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"luau-execution.mjs","names":[],"sources":["../src/domains/cloud-v2/luau-execution-task-binary-inputs/builders.ts","../src/domains/cloud-v2/luau-execution-task-binary-inputs/operations.ts","../src/domains/cloud-v2/luau-execution-task-binary-inputs/parsers.ts","../src/resources/luau-execution/client.ts"],"sourcesContent":["import type { HttpRequest } from \"../../../client/types.ts\";\nimport type { CreateBinaryInputParameters } from \"./types.ts\";\n\n/**\n * Builds a `POST` request for the Open Cloud\n * `Cloud_CreateLuauExecutionSessionTaskBinaryInput` endpoint. The\n * server responds with a presigned `uploadUri` and the resource `path`.\n *\n * @param parameters - Universe identifier and the byte size of the\n * binary to be uploaded.\n * @returns A pure {@link HttpRequest} describing the create call.\n */\nexport function buildCreateBinaryInputRequest({\n\tsize,\n\tuniverseId,\n}: CreateBinaryInputParameters): HttpRequest {\n\treturn {\n\t\tbody: { size },\n\t\theaders: { \"content-type\": \"application/json\" },\n\t\tmethod: \"POST\",\n\t\turl: `/cloud/v2/universes/${universeId}/luau-execution-session-task-binary-inputs`,\n\t};\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\nconst CREATE_PER_MINUTE = 5;\nconst SECONDS_PER_MINUTE = 60;\n\n/**\n * Per-second request ceiling for creating a Luau execution task binary\n * input, sourced from `x-roblox-rate-limits.perApiKeyOwner` on the\n * `Cloud_CreateLuauExecutionSessionTaskBinaryInput` operation (5 requests\n * per minute per API key owner). The whole per-minute allowance is also\n * the burst, matching the server: a probe found the sixth create within\n * one minute is the first to draw a 429.\n */\nexport const CREATE_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tburstCapacity: CREATE_PER_MINUTE,\n\tmaxPerSecond: CREATE_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"luau-execution-task-binary-inputs.create\",\n});\n\n/**\n * Scopes required to create a Luau execution task binary input, sourced\n * from `x-roblox-scopes` on the create operation in the vendored OpenAPI\n * schema.\n */\nexport const CREATE_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"universe.place.luau-execution-session:write\",\n]);\n","import type { HttpResponse } from \"../../../client/types.ts\";\nimport { UnexpectedResponseError } from \"../../../errors/unexpected-response.ts\";\nimport { isRecord } from \"../../../internal/utils/is-record.ts\";\nimport { toJsonDetails } from \"../../../internal/utils/to-json-details.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { LuauExecutionTaskBinaryInput } from \"./types.ts\";\n\nconst PATH_PATTERN = /^universes\\/(\\d+)\\/luau-execution-session-task-binary-inputs\\/([^/]+)$/;\n\nconst MALFORMED_MESSAGE = \"Malformed luau-execution-session-task-binary-input response\";\n\n/**\n * Parses a successful Open Cloud\n * `Cloud_CreateLuauExecutionSessionTaskBinaryInput` response body into\n * the public {@link LuauExecutionTaskBinaryInput}.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * @returns A success result wrapping the parsed binary input, or an\n * {@link UnexpectedResponseError} when the body does not match the expected\n * shape.\n */\nexport function parseBinaryInputResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<LuauExecutionTaskBinaryInput, UnexpectedResponseError> {\n\tif (!isRecord(body)) {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\tif (typeof body[\"path\"] !== \"string\" || !PATH_PATTERN.test(body[\"path\"])) {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\tif (typeof body[\"uploadUri\"] !== \"string\") {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\treturn {\n\t\tdata: { path: body[\"path\"], uploadUri: body[\"uploadUri\"] },\n\t\tsuccess: true,\n\t};\n}\n\nfunction malformed(\n\tstatusCode: number,\n\tbody: unknown,\n): Result<LuauExecutionTaskBinaryInput, UnexpectedResponseError> {\n\treturn {\n\t\terr: new UnexpectedResponseError(MALFORMED_MESSAGE, {\n\t\t\tdetails: toJsonDetails(body),\n\t\t\tstatusCode,\n\t\t}),\n\t\tsuccess: false,\n\t};\n}\n","import type { OpenCloudClientOptions, RequestOptions } from \"../../client/types.ts\";\nimport { buildCreateBinaryInputRequest } from \"../../domains/cloud-v2/luau-execution-task-binary-inputs/builders.ts\";\nimport {\n\tCREATE_OPERATION_LIMIT,\n\tCREATE_REQUIRED_SCOPES,\n} from \"../../domains/cloud-v2/luau-execution-task-binary-inputs/operations.ts\";\nimport { parseBinaryInputResponse } from \"../../domains/cloud-v2/luau-execution-task-binary-inputs/parsers.ts\";\nimport type {\n\tCreateBinaryInputParameters,\n\tLuauExecutionTaskBinaryInput,\n} from \"../../domains/cloud-v2/luau-execution-task-binary-inputs/types.ts\";\nimport { LIST_LOGS_SPEC } from \"../../domains/cloud-v2/luau-execution-task-logs/specs.ts\";\nimport type {\n\tListLogsParameters,\n\tLogPage,\n} from \"../../domains/cloud-v2/luau-execution-task-logs/types.ts\";\nimport { GET_SPEC } from \"../../domains/cloud-v2/luau-execution-tasks/specs.ts\";\nimport type {\n\tGetParameters,\n\tLuauExecutionTask,\n\tLuauExecutionTaskRef,\n\tSubmitAtHeadParameters,\n\tSubmitAtVersionParameters,\n} from \"../../domains/cloud-v2/luau-execution-tasks/types.ts\";\nimport type { OpenCloudError } from \"../../errors/base.ts\";\nimport { CREATE_METHOD_DEFAULTS } from \"../../internal/http/retry.ts\";\nimport {\n\tokRequest,\n\tResourceClient,\n\ttype ResourceMethodSpec,\n} from \"../../internal/resource-client.ts\";\nimport type { Result } from \"../../types.ts\";\nimport {\n\ttype LuauExecutionRunOptions,\n\ttype LuauExecutionSubmitOptions,\n\tsubmitWithCapacityAsync,\n} from \"./capacity-admission.ts\";\nimport { buildPollDependencies, submitAndPollAsync } from \"./polling-helpers.ts\";\nimport {\n\tpollUntilDoneCoreAsync,\n\ttype PollUntilDoneOptions,\n\twithBudgetRequestTimeout,\n} from \"./polling.ts\";\n\nfunction makeSpec<P, R>(spec: ResourceMethodSpec<P, R>): ResourceMethodSpec<P, R> {\n\treturn Object.freeze({ ...spec, apiKeyOnly: true });\n}\n\nconst CREATE_BINARY_INPUT_SPEC = makeSpec<\n\tCreateBinaryInputParameters,\n\tLuauExecutionTaskBinaryInput\n>({\n\tbuildRequest: (parameters) => okRequest(buildCreateBinaryInputRequest(parameters)),\n\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\tmethodKind: \"create\",\n\toperationLimit: CREATE_OPERATION_LIMIT,\n\tparse: parseBinaryInputResponse,\n\trequiredScopes: CREATE_REQUIRED_SCOPES,\n});\n\n/**\n * Operation handle for the `binaryInputs` namespace on\n * {@link LuauExecutionClient}. Provides `create` to allocate a presigned\n * upload slot for binary script inputs.\n *\n * @since 0.1.0\n */\nexport interface BinaryInputsHandle {\n\t/**\n\t * Allocates a presigned binary input upload slot. The returned\n\t * `uploadUri` is a presigned `PUT` target; the caller uploads the\n\t * binary data directly and passes `path` to `tasks.submit` as\n\t * `binaryInput`.\n\t *\n\t * @param parameters - Universe identifier and the byte size of the\n\t * binary to upload.\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping the parsed\n\t * {@link LuauExecutionTaskBinaryInput} or the {@link OpenCloudError}\n\t * that caused the request to fail.\n\t */\n\tcreate(\n\t\tparameters: CreateBinaryInputParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<LuauExecutionTaskBinaryInput, OpenCloudError>>;\n}\n\n/**\n * Operation handle exposed by {@link LuauExecutionClient} as the\n * `tasks` namespace. Provides `submit` to queue a Luau script, `get`\n * to fetch a task's current state, and `listLogs` to retrieve\n * structured log messages produced by a task.\n *\n * @since 0.1.0\n */\nexport interface TasksHandle {\n\t/**\n\t * Fetches the current state of a previously-submitted Luau\n\t * execution task. Uses idempotent retry semantics for both 429 and\n\t * 5xx.\n\t *\n\t * @param parameters - The task ref plus an optional `view` selector.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.credential} for this call only).\n\t * @returns A {@link Result} wrapping the parsed\n\t * {@link LuauExecutionTask} or the {@link OpenCloudError} that\n\t * caused the request to fail.\n\t */\n\tget(\n\t\tparameters: GetParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<LuauExecutionTask, OpenCloudError>>;\n\t/**\n\t * Lists one page of structured log messages produced by a\n\t * previously-submitted Luau execution task. Messages from multiple\n\t * server-side chunks are flattened into a single ordered array.\n\t * Uses idempotent retry semantics for both 429 and 5xx.\n\t *\n\t * @param parameters - The task ref and optional pagination controls\n\t * (`pageSize`, `pageToken`).\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.credential} for this call only).\n\t * @returns A {@link Result} wrapping the parsed {@link LogPage} or\n\t * the {@link OpenCloudError} that caused the request to fail.\n\t */\n\tlistLogs(\n\t\tparameters: ListLogsParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<LogPage, OpenCloudError>>;\n\t/**\n\t * Polls `tasks.get` with `view=BASIC` on a configurable backoff schedule\n\t * until the task reaches a terminal state, the wall-clock budget is\n\t * exhausted, or the supplied `AbortSignal` fires. Returns the terminal\n\t * task on success. The budget also bounds an in-flight\n\t * request through its request deadline, so a hanging request ends with\n\t * `PollTimeoutError` at the budget.\n\t *\n\t * @param ref - Reference to the task to poll, typically returned by `submit`.\n\t * @param options - Polling and per-request overrides.\n\t * @returns A {@link Result} wrapping the terminal {@link LuauExecutionTask},\n\t * or an error if aborted, timed out, or the transport fails.\n\t */\n\tpollUntilDone(\n\t\tref: LuauExecutionTaskRef,\n\t\toptions?: PollUntilDoneOptions,\n\t): Promise<Result<LuauExecutionTask, OpenCloudError>>;\n\t/**\n\t * Submits a Luau script and polls `tasks.get` with `view=BASIC` until\n\t * the task reaches a terminal state, the wall-clock budget is\n\t * exhausted, or the supplied `AbortSignal` fires. Combines `submit`\n\t * and `pollUntilDone` in one call. The budget opens before the submit\n\t * and covers it, and bounds each in-flight request through its request\n\t * deadline.\n\t *\n\t * @param parameters - The same input accepted by `submit`.\n\t * @param options - Polling and per-request overrides.\n\t * @returns A {@link Result} wrapping the terminal\n\t * {@link LuauExecutionTask}, or an error if submit fails, the task\n\t * is aborted, timed out, or the transport fails.\n\t */\n\trunUntilDone(\n\t\tparameters: SubmitAtHeadParameters | SubmitAtVersionParameters,\n\t\toptions?: LuauExecutionRunOptions,\n\t): Promise<Result<LuauExecutionTask, OpenCloudError>>;\n\t/**\n\t * Submits a Luau script for execution against a place. Dispatches\n\t * to the head-version URL when `versionId` is omitted, or to the\n\t * specific-version URL when one is supplied. Both URL shapes share\n\t * one rate-limit queue and one required-scope set.\n\t *\n\t * @param parameters - The universe and place identifiers, the\n\t * script to run, an optional `versionId`, and any other writable\n\t * submit fields.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.credential} for this call only).\n\t * @returns A {@link Result} wrapping the parsed\n\t * {@link LuauExecutionTask} or the {@link OpenCloudError} that\n\t * caused the request to fail.\n\t */\n\tsubmit(\n\t\tparameters: SubmitAtHeadParameters | SubmitAtVersionParameters,\n\t\toptions?: LuauExecutionSubmitOptions,\n\t): Promise<Result<LuauExecutionTask, OpenCloudError>>;\n}\n\n/**\n * Public client for the Roblox Open Cloud `LuauExecutionSessionTask`\n * resource. Tasks run a Luau script against a place and surface state,\n * output, or error through the `LuauExecutionTask` discriminated\n * union. Exposes `tasks.submit` for both the head version and a\n * specific place version, `tasks.get` for fetching task state,\n * `tasks.listLogs` for fetching structured log messages, and\n * `binaryInputs.create` for allocating presigned upload slots.\n *\n * @since 0.1.0\n *\n * @example\n *\n * ```ts\n * import { LuauExecutionClient } from \"@bedrock-rbx/ocale/luau-execution\";\n *\n * const client = new LuauExecutionClient({ credential: { apiKey: \"your-key\", kind: \"apiKey\" } });\n * expect(client).toBeInstanceOf(LuauExecutionClient);\n * ```\n */\nexport class LuauExecutionClient {\n\treadonly #inner: ResourceClient;\n\n\tpublic readonly binaryInputs: BinaryInputsHandle;\n\tpublic readonly tasks: TasksHandle;\n\n\t/**\n\t * Creates a new {@link LuauExecutionClient}. Configuration is frozen\n\t * on construction; per-request overrides are accepted on each\n\t * method.\n\t *\n\t * @param options - Client-level configuration including the API key.\n\t */\n\tconstructor(options: OpenCloudClientOptions) {\n\t\tthis.#inner = new ResourceClient(options);\n\t\tthis.binaryInputs = createBinaryInputsHandle(this.#inner);\n\t\tthis.tasks = createTasksHandle(this.#inner);\n\t}\n}\n\nfunction createBinaryInputsHandle(inner: ResourceClient): BinaryInputsHandle {\n\treturn {\n\t\tasync create(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: CREATE_BINARY_INPUT_SPEC });\n\t\t},\n\t};\n}\n\nfunction createTasksHandle(inner: ResourceClient): TasksHandle {\n\treturn {\n\t\tasync get(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: GET_SPEC });\n\t\t},\n\t\tasync listLogs(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: LIST_LOGS_SPEC });\n\t\t},\n\t\tasync pollUntilDone(ref, options = {}) {\n\t\t\tconst resolved = withBudgetRequestTimeout(options);\n\t\t\treturn pollUntilDoneCoreAsync(\n\t\t\t\tbuildPollDependencies(inner, { options: resolved, ref }),\n\t\t\t\tresolved,\n\t\t\t);\n\t\t},\n\t\tasync runUntilDone(parameters, options = {}) {\n\t\t\treturn submitAndPollAsync(inner, {\n\t\t\t\toptions: withBudgetRequestTimeout(options),\n\t\t\t\tparameters,\n\t\t\t});\n\t\t},\n\t\tasync submit(parameters, options) {\n\t\t\treturn submitWithCapacityAsync({ inner, options, parameters });\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;AAYA,SAAgB,8BAA8B,EAC7C,MACA,cAC4C;CAC5C,OAAO;EACN,MAAM,EAAE,KAAK;EACb,SAAS,EAAE,gBAAgB,mBAAmB;EAC9C,QAAQ;EACR,KAAK,uBAAuB,WAAW;CACxC;AACD;;;ACpBA,MAAM,oBAAoB;;;;;;;;;AAW1B,MAAa,yBAAyC,OAAO,OAAO;CACnE,eAAe;CACf,cAAc,oBAAoB;CAClC,cAAc;AACf,CAAC;;;;;;AAOD,MAAa,yBAAgD,OAAO,OAAO,CAC1E,6CACD,CAAC;;;ACnBD,MAAM,eAAe;AAErB,MAAM,oBAAoB;;;;;;;;;;;AAY1B,SAAgB,yBAAyB,EACxC,MACA,QAAQ,cACuE;CAC/E,IAAI,CAAC,SAAS,IAAI,GACjB,OAAO,UAAU,YAAY,IAAI;CAGlC,IAAI,OAAO,KAAK,YAAY,YAAY,CAAC,aAAa,KAAK,KAAK,OAAO,GACtE,OAAO,UAAU,YAAY,IAAI;CAGlC,IAAI,OAAO,KAAK,iBAAiB,UAChC,OAAO,UAAU,YAAY,IAAI;CAGlC,OAAO;EACN,MAAM;GAAE,MAAM,KAAK;GAAS,WAAW,KAAK;EAAa;EACzD,SAAS;CACV;AACD;AAEA,SAAS,UACR,YACA,MACgE;CAChE,OAAO;EACN,KAAK,IAAI,wBAAwB,mBAAmB;GACnD,SAAS,cAAc,IAAI;GAC3B;EACD,CAAC;EACD,SAAS;CACV;AACD;;;ACVA,SAAS,SAAe,MAA0D;CACjF,OAAO,OAAO,OAAO;EAAE,GAAG;EAAM,YAAY;CAAK,CAAC;AACnD;AAEA,MAAM,2BAA2B,SAG/B;CACD,eAAe,eAAe,UAAU,8BAA8B,UAAU,CAAC;CACjF,gBAAgB;CAChB,YAAY;CACZ,gBAAgB;CAChB,OAAO;CACP,gBAAgB;AACjB,CAAC;;;;;;;;;;;;;;;;;;;;;AAmJD,IAAa,sBAAb,MAAiC;CAChC;CAEA;CACA;;;;;;;;CASA,YAAY,SAAiC;EAC5C,KAAK,SAAS,IAAI,eAAe,OAAO;EACxC,KAAK,eAAe,yBAAyB,KAAK,MAAM;EACxD,KAAK,QAAQ,kBAAkB,KAAK,MAAM;CAC3C;AACD;AAEA,SAAS,yBAAyB,OAA2C;CAC5E,OAAO,EACN,MAAM,OAAO,YAAY,SAAS;EACjC,OAAO,MAAM,aAAa;GAAE;GAAS;GAAY,MAAM;EAAyB,CAAC;CAClF,EACD;AACD;AAEA,SAAS,kBAAkB,OAAoC;CAC9D,OAAO;EACN,MAAM,IAAI,YAAY,SAAS;GAC9B,OAAO,MAAM,aAAa;IAAE;IAAS;IAAY,MAAM;GAAS,CAAC;EAClE;EACA,MAAM,SAAS,YAAY,SAAS;GACnC,OAAO,MAAM,aAAa;IAAE;IAAS;IAAY,MAAM;GAAe,CAAC;EACxE;EACA,MAAM,cAAc,KAAK,UAAU,CAAC,GAAG;GACtC,MAAM,WAAW,yBAAyB,OAAO;GACjD,OAAO,uBACN,sBAAsB,OAAO;IAAE,SAAS;IAAU;GAAI,CAAC,GACvD,QACD;EACD;EACA,MAAM,aAAa,YAAY,UAAU,CAAC,GAAG;GAC5C,OAAO,mBAAmB,OAAO;IAChC,SAAS,yBAAyB,OAAO;IACzC;GACD,CAAC;EACF;EACA,MAAM,OAAO,YAAY,SAAS;GACjC,OAAO,wBAAwB;IAAE;IAAO;IAAS;GAAW,CAAC;EAC9D;CACD;AACD"}
1
+ {"version":3,"file":"luau-execution.mjs","names":[],"sources":["../src/domains/cloud-v2/luau-execution-task-binary-inputs/builders.ts","../src/domains/cloud-v2/luau-execution-task-binary-inputs/operations.ts","../src/domains/cloud-v2/luau-execution-task-binary-inputs/parsers.ts","../src/resources/luau-execution/client.ts"],"sourcesContent":["import type { HttpRequest } from \"../../../client/types.ts\";\nimport type { CreateBinaryInputParameters } from \"./types.ts\";\n\n/**\n * Builds a `POST` request for the Open Cloud\n * `Cloud_CreateLuauExecutionSessionTaskBinaryInput` endpoint. The\n * server responds with a presigned `uploadUri` and the resource `path`.\n *\n * @param parameters - Universe identifier and the byte size of the\n * binary to be uploaded.\n * @returns A pure {@link HttpRequest} describing the create call.\n */\nexport function buildCreateBinaryInputRequest({\n\tsize,\n\tuniverseId,\n}: CreateBinaryInputParameters): HttpRequest {\n\treturn {\n\t\tbody: { size },\n\t\theaders: { \"content-type\": \"application/json\" },\n\t\tmethod: \"POST\",\n\t\turl: `/cloud/v2/universes/${universeId}/luau-execution-session-task-binary-inputs`,\n\t};\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\nconst CREATE_PER_MINUTE = 5;\nconst SECONDS_PER_MINUTE = 60;\n\n/**\n * Per-second request ceiling for creating a Luau execution task binary\n * input, sourced from `x-roblox-rate-limits.perApiKeyOwner` on the\n * `Cloud_CreateLuauExecutionSessionTaskBinaryInput` operation (5 requests\n * per minute per API key owner). The whole per-minute allowance is also\n * the burst, matching the server: a probe found the sixth create within\n * one minute is the first to draw a 429.\n */\nexport const CREATE_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tburstCapacity: CREATE_PER_MINUTE,\n\tmaxPerSecond: CREATE_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"luau-execution-task-binary-inputs.create\",\n});\n\n/**\n * Scopes required to create a Luau execution task binary input, sourced\n * from `x-roblox-scopes` on the create operation in the vendored OpenAPI\n * schema.\n */\nexport const CREATE_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"universe.place.luau-execution-session:write\",\n]);\n","import type { HttpResponse } from \"../../../client/types.ts\";\nimport { UnexpectedResponseError } from \"../../../errors/unexpected-response.ts\";\nimport { isRecord } from \"../../../internal/utils/is-record.ts\";\nimport { toJsonDetails } from \"../../../internal/utils/to-json-details.ts\";\nimport type { Result } from \"../../../types.ts\";\nimport type { LuauExecutionTaskBinaryInput } from \"./types.ts\";\n\nconst PATH_PATTERN = /^universes\\/(\\d+)\\/luau-execution-session-task-binary-inputs\\/([^/]+)$/;\n\nconst MALFORMED_MESSAGE = \"Malformed luau-execution-session-task-binary-input response\";\n\n/**\n * Parses a successful Open Cloud\n * `Cloud_CreateLuauExecutionSessionTaskBinaryInput` response body into\n * the public {@link LuauExecutionTaskBinaryInput}.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * @returns A success result wrapping the parsed binary input, or an\n * {@link UnexpectedResponseError} when the body does not match the expected\n * shape.\n */\nexport function parseBinaryInputResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<LuauExecutionTaskBinaryInput, UnexpectedResponseError> {\n\tif (!isRecord(body)) {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\tif (typeof body[\"path\"] !== \"string\" || !PATH_PATTERN.test(body[\"path\"])) {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\tif (typeof body[\"uploadUri\"] !== \"string\") {\n\t\treturn malformed(statusCode, body);\n\t}\n\n\treturn {\n\t\tdata: { path: body[\"path\"], uploadUri: body[\"uploadUri\"] },\n\t\tsuccess: true,\n\t};\n}\n\nfunction malformed(\n\tstatusCode: number,\n\tbody: unknown,\n): Result<LuauExecutionTaskBinaryInput, UnexpectedResponseError> {\n\treturn {\n\t\terr: new UnexpectedResponseError(MALFORMED_MESSAGE, {\n\t\t\tdetails: toJsonDetails(body),\n\t\t\tstatusCode,\n\t\t}),\n\t\tsuccess: false,\n\t};\n}\n","import type { OpenCloudClientOptions, RequestOptions } from \"../../client/types.ts\";\nimport { buildCreateBinaryInputRequest } from \"../../domains/cloud-v2/luau-execution-task-binary-inputs/builders.ts\";\nimport {\n\tCREATE_OPERATION_LIMIT,\n\tCREATE_REQUIRED_SCOPES,\n} from \"../../domains/cloud-v2/luau-execution-task-binary-inputs/operations.ts\";\nimport { parseBinaryInputResponse } from \"../../domains/cloud-v2/luau-execution-task-binary-inputs/parsers.ts\";\nimport type {\n\tCreateBinaryInputParameters,\n\tLuauExecutionTaskBinaryInput,\n} from \"../../domains/cloud-v2/luau-execution-task-binary-inputs/types.ts\";\nimport { LIST_LOGS_SPEC } from \"../../domains/cloud-v2/luau-execution-task-logs/specs.ts\";\nimport type {\n\tListLogsParameters,\n\tLogPage,\n} from \"../../domains/cloud-v2/luau-execution-task-logs/types.ts\";\nimport { GET_SPEC } from \"../../domains/cloud-v2/luau-execution-tasks/specs.ts\";\nimport type {\n\tGetParameters,\n\tLuauExecutionTask,\n\tLuauExecutionTaskRef,\n\tSubmitAtHeadParameters,\n\tSubmitAtVersionParameters,\n} from \"../../domains/cloud-v2/luau-execution-tasks/types.ts\";\nimport type { OpenCloudError } from \"../../errors/base.ts\";\nimport { CREATE_METHOD_DEFAULTS } from \"../../internal/http/retry.ts\";\nimport {\n\tokRequest,\n\tResourceClient,\n\ttype ResourceMethodSpec,\n} from \"../../internal/resource-client.ts\";\nimport type { Result } from \"../../types.ts\";\nimport {\n\ttype LuauExecutionRunOptions,\n\ttype LuauExecutionSubmitOptions,\n\tsubmitWithCapacityAsync,\n} from \"./capacity-admission.ts\";\nimport { buildPollDependencies, submitAndPollAsync } from \"./polling-helpers.ts\";\nimport {\n\tpollUntilDoneCoreAsync,\n\ttype PollUntilDoneOptions,\n\twithBudgetRequestTimeout,\n} from \"./polling.ts\";\n\nfunction makeSpec<P, R>(spec: ResourceMethodSpec<P, R>): ResourceMethodSpec<P, R> {\n\treturn Object.freeze({ ...spec, apiKeyOnly: true });\n}\n\nconst CREATE_BINARY_INPUT_SPEC = makeSpec<\n\tCreateBinaryInputParameters,\n\tLuauExecutionTaskBinaryInput\n>({\n\tbuildRequest: (parameters) => okRequest(buildCreateBinaryInputRequest(parameters)),\n\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\tmethodKind: \"create\",\n\toperationLimit: CREATE_OPERATION_LIMIT,\n\tparse: parseBinaryInputResponse,\n\trequiredScopes: CREATE_REQUIRED_SCOPES,\n});\n\n/**\n * Operation handle for the `binaryInputs` namespace on\n * {@link LuauExecutionClient}. Provides `create` to allocate a presigned\n * upload slot for binary script inputs.\n *\n * @since 0.1.0\n */\nexport interface BinaryInputsHandle {\n\t/**\n\t * Allocates a presigned binary input upload slot. The returned\n\t * `uploadUri` is a presigned `PUT` target; the caller uploads the\n\t * binary data directly and passes `path` to `tasks.submit` as\n\t * `binaryInput`.\n\t *\n\t * @param parameters - Universe identifier and the byte size of the\n\t * binary to upload.\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping the parsed\n\t * {@link LuauExecutionTaskBinaryInput} or the {@link OpenCloudError}\n\t * that caused the request to fail.\n\t */\n\tcreate(\n\t\tparameters: CreateBinaryInputParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<LuauExecutionTaskBinaryInput, OpenCloudError>>;\n}\n\n/**\n * Operation handle exposed by {@link LuauExecutionClient} as the\n * `tasks` namespace. Provides `submit` to queue a Luau script, `get`\n * to fetch a task's current state, and `listLogs` to retrieve\n * structured log messages produced by a task.\n *\n * @since 0.1.0\n */\nexport interface TasksHandle {\n\t/**\n\t * Fetches the current state of a previously-submitted Luau\n\t * execution task. Uses idempotent retry semantics for both 429 and\n\t * 5xx.\n\t *\n\t * @param parameters - The task ref plus an optional `view` selector.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.credential} for this call only).\n\t * @returns A {@link Result} wrapping the parsed\n\t * {@link LuauExecutionTask} or the {@link OpenCloudError} that\n\t * caused the request to fail.\n\t */\n\tget(\n\t\tparameters: GetParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<LuauExecutionTask, OpenCloudError>>;\n\t/**\n\t * Lists one page of structured log messages produced by a\n\t * previously-submitted Luau execution task. Messages from multiple\n\t * server-side chunks are flattened into a single ordered array.\n\t * Uses idempotent retry semantics for both 429 and 5xx.\n\t *\n\t * @param parameters - The task ref and optional pagination controls\n\t * (`pageSize`, `pageToken`).\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.credential} for this call only).\n\t * @returns A {@link Result} wrapping the parsed {@link LogPage} or\n\t * the {@link OpenCloudError} that caused the request to fail.\n\t */\n\tlistLogs(\n\t\tparameters: ListLogsParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<LogPage, OpenCloudError>>;\n\t/**\n\t * Polls `tasks.get` with `view=BASIC` on a configurable backoff schedule\n\t * until the task reaches a terminal state, the wall-clock budget is\n\t * exhausted, or the supplied `AbortSignal` fires. Returns the terminal\n\t * task on success. The budget also bounds an in-flight\n\t * request through its request deadline, so a hanging request ends with\n\t * `PollTimeoutError` at the budget.\n\t *\n\t * @param ref - Reference to the task to poll, typically returned by `submit`.\n\t * @param options - Polling and per-request overrides.\n\t * @returns A {@link Result} wrapping the terminal {@link LuauExecutionTask},\n\t * or an error if aborted, timed out, or the transport fails.\n\t */\n\tpollUntilDone(\n\t\tref: LuauExecutionTaskRef,\n\t\toptions?: PollUntilDoneOptions,\n\t): Promise<Result<LuauExecutionTask, OpenCloudError>>;\n\t/**\n\t * Submits a Luau script and polls `tasks.get` with `view=BASIC` until\n\t * the task reaches a terminal state, the wall-clock budget is\n\t * exhausted, or the supplied `AbortSignal` fires. Combines `submit`\n\t * and `pollUntilDone` in one call. The budget opens before the submit\n\t * and covers it, and bounds each in-flight request through its request\n\t * deadline.\n\t *\n\t * @param parameters - The same input accepted by `submit`.\n\t * @param options - Polling and per-request overrides.\n\t * @returns A {@link Result} wrapping the terminal\n\t * {@link LuauExecutionTask}, or an error if submit fails, the task\n\t * is aborted, timed out, or the transport fails.\n\t */\n\trunUntilDone(\n\t\tparameters: SubmitAtHeadParameters | SubmitAtVersionParameters,\n\t\toptions?: LuauExecutionRunOptions,\n\t): Promise<Result<LuauExecutionTask, OpenCloudError>>;\n\t/**\n\t * Submits a Luau script for execution against a place. Dispatches\n\t * to the head-version URL when `versionId` is omitted, or to the\n\t * specific-version URL when one is supplied. Both URL shapes share\n\t * one rate-limit queue and one required-scope set.\n\t *\n\t * @param parameters - The universe and place identifiers, the\n\t * script to run, an optional `versionId`, and any other writable\n\t * submit fields.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.credential} for this call only).\n\t * @returns A {@link Result} wrapping the parsed\n\t * {@link LuauExecutionTask} or the {@link OpenCloudError} that\n\t * caused the request to fail.\n\t */\n\tsubmit(\n\t\tparameters: SubmitAtHeadParameters | SubmitAtVersionParameters,\n\t\toptions?: LuauExecutionSubmitOptions,\n\t): Promise<Result<LuauExecutionTask, OpenCloudError>>;\n}\n\n/**\n * Public client for the Roblox Open Cloud `LuauExecutionSessionTask`\n * resource. Tasks run a Luau script against a place and surface state,\n * output, or error through the `LuauExecutionTask` discriminated\n * union. Exposes `tasks.submit` for both the head version and a\n * specific place version, `tasks.get` for fetching task state,\n * `tasks.listLogs` for fetching structured log messages, and\n * `binaryInputs.create` for allocating presigned upload slots.\n *\n * @since 0.1.0\n *\n * @example\n *\n * ```ts\n * import { LuauExecutionClient } from \"@bedrock-rbx/ocale/luau-execution\";\n *\n * const client = new LuauExecutionClient({ credential: { apiKey: \"your-key\", kind: \"apiKey\" } });\n * expect(client).toBeInstanceOf(LuauExecutionClient);\n * ```\n */\nexport class LuauExecutionClient {\n\treadonly #inner: ResourceClient;\n\n\tpublic readonly binaryInputs: BinaryInputsHandle;\n\tpublic readonly tasks: TasksHandle;\n\n\t/**\n\t * Creates a new {@link LuauExecutionClient}. Configuration is frozen\n\t * on construction; per-request overrides are accepted on each\n\t * method.\n\t *\n\t * @param options - Client-level configuration including the API key.\n\t */\n\tconstructor(options: OpenCloudClientOptions) {\n\t\tthis.#inner = new ResourceClient(options);\n\t\tthis.binaryInputs = createBinaryInputsHandle(this.#inner);\n\t\tthis.tasks = createTasksHandle(this.#inner);\n\t}\n}\n\nfunction createBinaryInputsHandle(inner: ResourceClient): BinaryInputsHandle {\n\treturn {\n\t\tasync create(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: CREATE_BINARY_INPUT_SPEC });\n\t\t},\n\t};\n}\n\nfunction createTasksHandle(inner: ResourceClient): TasksHandle {\n\treturn {\n\t\tasync get(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: GET_SPEC });\n\t\t},\n\t\tasync listLogs(parameters, options) {\n\t\t\treturn inner.executeAsync({ options, parameters, spec: LIST_LOGS_SPEC });\n\t\t},\n\t\tasync pollUntilDone(ref, options = {}) {\n\t\t\tconst resolved = withBudgetRequestTimeout(options);\n\t\t\treturn pollUntilDoneCoreAsync(\n\t\t\t\tbuildPollDependencies(inner, { options: resolved, ref }),\n\t\t\t\tresolved,\n\t\t\t);\n\t\t},\n\t\tasync runUntilDone(parameters, options = {}) {\n\t\t\treturn submitAndPollAsync(inner, {\n\t\t\t\toptions: withBudgetRequestTimeout(options),\n\t\t\t\tparameters,\n\t\t\t});\n\t\t},\n\t\tasync submit(parameters, options) {\n\t\t\treturn submitWithCapacityAsync({ inner, options, parameters });\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;AAYA,SAAgB,8BAA8B,EAC7C,MACA,cAC4C;CAC5C,OAAO;EACN,MAAM,EAAE,KAAK;EACb,SAAS,EAAE,gBAAgB,mBAAmB;EAC9C,QAAQ;EACR,KAAK,uBAAuB,WAAW;CACxC;AACD;;ACpBA,MAAM,oBAAoB;;;;;;;;;AAW1B,MAAa,yBAAyC,OAAO,OAAO;CACnE,eAAe;CACf,cAAc,oBAAoB;CAClC,cAAc;AACf,CAAC;;;;;;AAOD,MAAa,yBAAgD,OAAO,OAAO,CAC1E,6CACD,CAAC;;ACnBD,MAAM,eAAe;AAErB,MAAM,oBAAoB;;;;;;;;;;;AAY1B,SAAgB,yBAAyB,EACxC,MACA,QAAQ,cACuE;CAC/E,IAAI,CAAC,SAAS,IAAI,GACjB,OAAO,UAAU,YAAY,IAAI;CAGlC,IAAI,OAAO,KAAK,YAAY,YAAY,CAAC,aAAa,KAAK,KAAK,OAAO,GACtE,OAAO,UAAU,YAAY,IAAI;CAGlC,IAAI,OAAO,KAAK,iBAAiB,UAChC,OAAO,UAAU,YAAY,IAAI;CAGlC,OAAO;EACN,MAAM;GAAE,MAAM,KAAK;GAAS,WAAW,KAAK;EAAa;EACzD,SAAS;CACV;AACD;AAEA,SAAS,UACR,YACA,MACgE;CAChE,OAAO;EACN,KAAK,IAAI,wBAAwB,mBAAmB;GACnD,SAAS,cAAc,IAAI;GAC3B;EACD,CAAC;EACD,SAAS;CACV;AACD;;ACVA,SAAS,SAAe,MAA0D;CACjF,OAAO,OAAO,OAAO;EAAE,GAAG;EAAM,YAAY;CAAK,CAAC;AACnD;AAEA,MAAM,2BAA2B,SAG/B;CACD,eAAe,eAAe,UAAU,8BAA8B,UAAU,CAAC;CACjF,gBAAgB;CAChB,YAAY;CACZ,gBAAgB;CAChB,OAAO;CACP,gBAAgB;AACjB,CAAC;;;;;;;;;;;;;;;;;;;;;AAmJD,IAAa,sBAAb,MAAiC;CAChC;CAEA;CACA;;;;;;;;CASA,YAAY,SAAiC;EAC5C,KAAK,SAAS,IAAI,eAAe,OAAO;EACxC,KAAK,eAAe,yBAAyB,KAAK,MAAM;EACxD,KAAK,QAAQ,kBAAkB,KAAK,MAAM;CAC3C;AACD;AAEA,SAAS,yBAAyB,OAA2C;CAC5E,OAAO,EACN,MAAM,OAAO,YAAY,SAAS;EACjC,OAAO,MAAM,aAAa;GAAE;GAAS;GAAY,MAAM;EAAyB,CAAC;CAClF,EACD;AACD;AAEA,SAAS,kBAAkB,OAAoC;CAC9D,OAAO;EACN,MAAM,IAAI,YAAY,SAAS;GAC9B,OAAO,MAAM,aAAa;IAAE;IAAS;IAAY,MAAM;GAAS,CAAC;EAClE;EACA,MAAM,SAAS,YAAY,SAAS;GACnC,OAAO,MAAM,aAAa;IAAE;IAAS;IAAY,MAAM;GAAe,CAAC;EACxE;EACA,MAAM,cAAc,KAAK,UAAU,CAAC,GAAG;GACtC,MAAM,WAAW,yBAAyB,OAAO;GACjD,OAAO,uBACN,sBAAsB,OAAO;IAAE,SAAS;IAAU;GAAI,CAAC,GACvD,QACD;EACD;EACA,MAAM,aAAa,YAAY,UAAU,CAAC,GAAG;GAC5C,OAAO,mBAAmB,OAAO;IAChC,SAAS,yBAAyB,OAAO;IACzC;GACD,CAAC;EACF;EACA,MAAM,OAAO,YAAY,SAAS;GACjC,OAAO,wBAAwB;IAAE;IAAO;IAAS;GAAW,CAAC;EAC9D;CACD;AACD"}
@@ -1,4 +1,4 @@
1
- //#region src/errors/base.ts
1
+ // src/errors/base.ts
2
2
  const NO_PREVIOUS_ATTEMPTS = Object.freeze([]);
3
3
  const PREVIOUS_ATTEMPTS = /* @__PURE__ */ new WeakMap();
4
4
  /**
@@ -69,8 +69,7 @@ function recordPreviousAttempts(error, attempts) {
69
69
  PREVIOUS_ATTEMPTS.set(error, Object.freeze([...attempts]));
70
70
  return error;
71
71
  }
72
- //#endregion
73
- //#region src/errors/api-error.ts
72
+ // src/errors/api-error.ts
74
73
  /**
75
74
  * Thrown when the Roblox Open Cloud API returns a non-2xx response
76
75
  * that is not a rate limit (429).
@@ -171,8 +170,7 @@ function requestContextOf(err) {
171
170
  url: err.url
172
171
  };
173
172
  }
174
- //#endregion
175
- //#region src/errors/rate-limit.ts
173
+ // src/errors/rate-limit.ts
176
174
  /**
177
175
  * Thrown when the Roblox Open Cloud API returns a 429 Too Many Requests
178
176
  * response. Contains the server-suggested retry delay and safe,
@@ -274,8 +272,7 @@ function markServerRetryGuidance(error) {
274
272
  function hasServerRetryGuidance(error) {
275
273
  return error.retryAfterSeconds > 0 || GUIDED_ERRORS.has(error);
276
274
  }
277
- //#endregion
278
- //#region src/errors/network-error.ts
275
+ // src/errors/network-error.ts
279
276
  /**
280
277
  * Thrown when a network-level failure prevents the request from reaching
281
278
  * the Roblox Open Cloud API (e.g., DNS resolution failure, connection reset).
@@ -302,7 +299,6 @@ var NetworkError = class extends OpenCloudError {
302
299
  this.url = options?.url;
303
300
  }
304
301
  };
305
- //#endregion
306
302
  export { ApiError as a, recordPreviousAttempts as c, markServerRetryGuidance as i, RateLimitError as n, requestContextOf as o, hasServerRetryGuidance as r, OpenCloudError as s, NetworkError as t };
307
303
 
308
- //# sourceMappingURL=network-error-iVSng5MT.mjs.map
304
+ //# sourceMappingURL=network-error-P4An7nUB.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"network-error-iVSng5MT.mjs","names":[],"sources":["../src/errors/base.ts","../src/errors/api-error.ts","../src/errors/rate-limit.ts","../src/errors/network-error.ts"],"sourcesContent":["/**\n * Options for constructing an {@link OpenCloudError}.\n *\n * @since 0.3.0\n */\nexport interface OpenCloudErrorOptions extends ErrorOptions {\n\t/**\n\t * Machine-readable classifier for the failure, when the error has one. An\n\t * `ApiError` and `RateLimitError` fill it from the response body; a\n\t * `ValidationError` narrows it to its own closed union. Errors with nothing\n\t * to classify (transport failures and poll timeouts) leave it `undefined`.\n\t */\n\treadonly code?: string | undefined;\n}\n\nconst NO_PREVIOUS_ATTEMPTS: ReadonlyArray<OpenCloudError> = Object.freeze([]);\n\nconst PREVIOUS_ATTEMPTS = new WeakMap<OpenCloudError, ReadonlyArray<OpenCloudError>>();\n\n/**\n * Base error class for all Open Cloud SDK errors.\n *\n * All specific error types (RateLimitError, ApiError, NetworkError)\n * extend this class, enabling `instanceof OpenCloudError` checks.\n *\n * `code` is declared here rather than on the subclasses that populate it, so a\n * caller holding the `OpenCloudError` that `Result.err` is typed as can branch\n * on it without first narrowing to a subclass.\n *\n * @since 0.1.0\n *\n * @example\n *\n * ```ts\n * import { ApiError, OpenCloudError } from \"@bedrock-rbx/ocale\";\n *\n * // `Result.err` is typed as OpenCloudError, so a caller draining a queue\n * // branches on the canonical status without narrowing to a subclass first.\n * const err: OpenCloudError = new ApiError(\"HTTP 404: Queue items not found.\", {\n * code: \"NOT_FOUND\",\n * statusCode: 404,\n * });\n *\n * expect(err.code).toBe(\"NOT_FOUND\");\n * expect(new OpenCloudError(\"no classifier\").code).toBeUndefined();\n * ```\n */\nexport class OpenCloudError extends Error {\n\t/** Machine-readable classifier, or `undefined` when the error has none. */\n\tpublic readonly code: string | undefined;\n\tpublic override readonly name: string = \"OpenCloudError\";\n\n\t/**\n\t * Creates a new OpenCloudError.\n\t *\n\t * @param message - Human-readable error description.\n\t * @param options - Error options including the optional `cause` and the\n\t * machine-readable `code`.\n\t */\n\tconstructor(message?: string, options?: OpenCloudErrorOptions) {\n\t\tsuper(message, options);\n\t\tthis.code = options?.code;\n\t}\n\n\t/**\n\t * Failures of the earlier attempts of the same logical request, oldest\n\t * first. A failure that is this error's own `cause` is not repeated here.\n\t * Empty when the request was not retried.\n\t *\n\t * @since 0.4.0\n\t * @returns The earlier attempts' failures.\n\t */\n\tpublic get previousAttempts(): ReadonlyArray<OpenCloudError> {\n\t\treturn PREVIOUS_ATTEMPTS.get(this) ?? NO_PREVIOUS_ATTEMPTS;\n\t}\n}\n\n/**\n * Records the failures of the earlier attempts of the logical request that\n * produced `error`, so they read back through\n * {@link OpenCloudError.previousAttempts}.\n *\n * @param error - The failure the retry loop returns.\n * @param attempts - Earlier attempt failures, oldest first.\n * @returns The same error.\n */\nexport function recordPreviousAttempts(\n\terror: OpenCloudError,\n\tattempts: ReadonlyArray<OpenCloudError>,\n): OpenCloudError {\n\tPREVIOUS_ATTEMPTS.set(error, Object.freeze([...attempts]));\n\treturn error;\n}\n","import { OpenCloudError, type OpenCloudErrorOptions } from \"./base.ts\";\n\n/**\n * Options for constructing an {@link ApiError}.\n *\n * @since 0.1.0\n */\nexport interface ApiErrorOptions extends OpenCloudErrorOptions {\n\t/** Parsed response body, when present. */\n\tdetails?: JSONValue | undefined;\n\t/**\n\t * Wall-clock time the request was in flight before this error, in\n\t * milliseconds. Present for errors built by the transport; a long elapsed\n\t * time on an intermittent failure points at a load or timeout correlation.\n\t */\n\telapsedMs?: number | undefined;\n\t/**\n\t * Human-readable summary extracted from an HTML gateway error page, set\n\t * when the error body was such a page (an HAProxy-style load-balancer\n\t * rejection) rather than an Open Cloud response. When present, the raw HTML\n\t * is not retained on {@link ApiError.details}.\n\t */\n\tgatewaySummary?: string | undefined;\n\t/** HTTP method of the request that produced this error. */\n\tmethod?: string | undefined;\n\t/**\n\t * Allowlisted response headers useful for diagnosis and escalation (request\n\t * ids, edge/server identifiers). The full header set is never retained, to\n\t * avoid surfacing anything sensitive and to keep errors light.\n\t */\n\tresponseHeaders?: Readonly<Record<string, string>> | undefined;\n\t/** HTTP status code from the API response. */\n\tstatusCode: number;\n\t/**\n\t * Length, in decoded characters, of a 2xx body that could not be parsed as\n\t * JSON. Set only by the transport, and only for that failure — nothing else\n\t * builds an {@link ApiError} over a successful status — so its presence is\n\t * also how a body-parse failure is told apart from an API rejection. The\n\t * number is the diagnostic one: a body that stops mid-token at exactly the\n\t * length the edge delivered is a truncated read, not malformed JSON.\n\t */\n\tunparsedBodyLength?: number | undefined;\n\t/** Fully-qualified URL of the request that produced this error. */\n\turl?: string | undefined;\n}\n\n/**\n * Everything in {@link ApiErrorOptions} except what the API answered ({@link\n * ApiErrorOptions.code}, {@link ApiErrorOptions.details}, and {@link\n * ApiErrorOptions.statusCode}): the request the transport made, how long it was\n * in flight, and what the response carried alongside its body. Every field is\n * required, and every one accepts `undefined` for a field the transport did not\n * capture.\n *\n * @since 0.2.0\n */\nexport type ApiRequestContext = {\n\t[K in Exclude<keyof ApiErrorOptions, \"cause\" | \"code\" | \"details\" | \"statusCode\">]-?:\n\t\t| ApiErrorOptions[K]\n\t\t| undefined;\n};\n\n/**\n * Thrown when the Roblox Open Cloud API returns a non-2xx response\n * that is not a rate limit (429).\n *\n * @since 0.1.0\n *\n * @example\n *\n * ```ts\n * import { ApiError } from \"@bedrock-rbx/ocale\";\n *\n * const error = new ApiError(\"HTTP 404: Pass not found (code NotFound)\", {\n * code: \"NotFound\",\n * details: { errorCode: \"NotFound\", message: \"Pass not found\" },\n * statusCode: 404,\n * });\n *\n * expect(error).toBeInstanceOf(ApiError);\n * expect(error.statusCode).toBe(404);\n * expect(error.code).toBe(\"NotFound\");\n * expect(error.details).toEqual({\n * errorCode: \"NotFound\",\n * message: \"Pass not found\",\n * });\n * ```\n */\nexport class ApiError extends OpenCloudError {\n\tpublic readonly details: JSONValue | undefined;\n\tpublic readonly elapsedMs: number | undefined;\n\tpublic readonly gatewaySummary: string | undefined;\n\tpublic readonly method: string | undefined;\n\tpublic override readonly name: string = \"ApiError\";\n\tpublic readonly responseHeaders: Readonly<Record<string, string>> | undefined;\n\tpublic readonly statusCode: number;\n\tpublic readonly unparsedBodyLength: number | undefined;\n\tpublic readonly url: string | undefined;\n\n\t/**\n\t * Creates a new ApiError.\n\t *\n\t * @param message - Human-readable error description.\n\t * @param options - Error options including status code, optional error\n\t * code, the parsed response body when present, and the request context\n\t * (method, url, elapsed time, allowlisted response headers) when built by\n\t * the transport.\n\t */\n\tconstructor(message: string, options: ApiErrorOptions) {\n\t\tsuper(message, options);\n\t\tthis.statusCode = options.statusCode;\n\t\tthis.details = options.details;\n\t\tthis.method = options.method;\n\t\tthis.url = options.url;\n\t\tthis.elapsedMs = options.elapsedMs;\n\t\tthis.responseHeaders = options.responseHeaders;\n\t\tthis.gatewaySummary = options.gatewaySummary;\n\t\tthis.unparsedBodyLength = options.unparsedBodyLength;\n\t}\n}\n\n/**\n * Reads the request context off an {@link ApiError} so a replacement error can\n * carry it. Spread the result into the options of the new error. {@link\n * OpenCloudError.code}, {@link ApiError.details}, and {@link\n * ApiError.statusCode} describe the API's answer and are left to the caller.\n *\n * @since 0.2.0\n *\n * @param err - The error to read the request context from.\n * @returns The transport-captured fields, each undefined when unset.\n *\n * @example\n *\n * ```ts\n * import { ApiError, requestContextOf } from \"@bedrock-rbx/ocale\";\n *\n * const original = new ApiError(\"HTTP 404\", {\n * elapsedMs: 512,\n * method: \"GET\",\n * statusCode: 404,\n * url: \"https://apis.roblox.com/cloud/v2/universes/1\",\n * });\n *\n * const rewrapped = new ApiError(\"Universe 1 was not found; adoption failed\", {\n * ...requestContextOf(original),\n * statusCode: 404,\n * });\n *\n * expect(rewrapped.method).toBe(\"GET\");\n * expect(rewrapped.url).toBe(\"https://apis.roblox.com/cloud/v2/universes/1\");\n * expect(rewrapped.elapsedMs).toBe(512);\n * ```\n */\nexport function requestContextOf(err: ApiError): ApiRequestContext {\n\treturn {\n\t\telapsedMs: err.elapsedMs,\n\t\tgatewaySummary: err.gatewaySummary,\n\t\tmethod: err.method,\n\t\tresponseHeaders: err.responseHeaders,\n\t\tunparsedBodyLength: err.unparsedBodyLength,\n\t\turl: err.url,\n\t};\n}\n","import { OpenCloudError, type OpenCloudErrorOptions } from \"./base.ts\";\n\n/**\n * Which layer refused a 429, as best the SDK can tell from one response.\n * It names the refusing layer only, not the cause of the refusal.\n *\n * - `\"edge\"`: the gateway refused before the request reached the service.\n * - `\"service\"`: the service behind the gateway refused (the response names it\n * in `x-roblox-system-reason`).\n * - `\"unknown\"`: the response has no positive evidence for either layer.\n *\n * @since 0.4.0\n */\nexport type RateLimitSource = \"edge\" | \"service\" | \"unknown\";\n\n/**\n * Options for constructing a {@link RateLimitError}.\n *\n * @since 0.1.0\n */\nexport interface RateLimitErrorOptions extends OpenCloudErrorOptions {\n\t/**\n\t * Parsed 429 response body, when present. Holds the server's 429\n\t * explanation (JSON when the body parses, otherwise the truncated raw\n\t * text) so a rate limit stays diagnosable from the error alone. A literal\n\t * JSON `null` remains `null`; an absent body is `undefined`.\n\t */\n\tdetails?: JSONValue | undefined;\n\t/**\n\t * Requests left in the reported rate-limit window. Read from\n\t * `x-ratelimit-remaining` using the smallest valid token.\n\t *\n\t * `undefined` when the header has no valid non-negative integer token.\n\t *\n\t * Parsed separately from `x-ratelimit-reset`; a valid value survives an\n\t * invalid reset.\n\t *\n\t * This is one budget reading, not a classifier for the cause of the 429.\n\t */\n\tremaining?: number | undefined;\n\t/**\n\t * Allowlisted response headers useful for diagnosing the 429. Values are\n\t * preserved exactly as the Fetch API presents them, including comma-joined\n\t * multi-window values. The full header set is never retained.\n\t */\n\tresponseHeaders?: Readonly<Record<string, string>> | undefined;\n\t/** Seconds to wait before retrying the request. */\n\tretryAfterSeconds: number;\n\t/**\n\t * Which layer refused the request. Defaults to `\"unknown\"`.\n\t *\n\t * @since 0.4.0\n\t */\n\tsource?: RateLimitSource | undefined;\n\t/**\n\t * HTTP status code that produced the error. Always `429` when minted by the\n\t * SDK transport; `undefined` when constructed without one.\n\t */\n\tstatusCode?: number | undefined;\n}\n\n/**\n * Thrown when the Roblox Open Cloud API returns a 429 Too Many Requests\n * response. Contains the server-suggested retry delay and safe,\n * machine-readable response evidence. The body code, remaining budget, and\n * headers do not identify the upstream cause (for example quota vs place\n * capacity). `source` names only the layer that refused the request;\n * `\"unknown\"` means the response carried no positive evidence for either\n * layer.\n *\n * @since 0.1.0\n *\n * @example\n *\n * ```ts\n * import { RateLimitError } from \"@bedrock-rbx/ocale\";\n *\n * const error = new RateLimitError(\"Too many requests\", {\n * code: \"RESOURCE_EXHAUSTED\",\n * remaining: 3,\n * responseHeaders: {\n * \"retry-after\": \"1856\",\n * \"x-ratelimit-limit\": \"5, 5;w=60, 5;w=60\",\n * },\n * retryAfterSeconds: 1856,\n * source: \"service\",\n * });\n *\n * // `source` is a classification; the raw evidence stays available.\n * const evidence = {\n * code: error.code,\n * limit: error.responseHeaders?.[\"x-ratelimit-limit\"],\n * retryAfter: error.responseHeaders?.[\"retry-after\"],\n * source: error.source,\n * };\n *\n * expect(evidence).toEqual({\n * code: \"RESOURCE_EXHAUSTED\",\n * limit: \"5, 5;w=60, 5;w=60\",\n * retryAfter: \"1856\",\n * source: \"service\",\n * });\n * ```\n */\nexport class RateLimitError extends OpenCloudError {\n\t/**\n\t * Parsed 429 response body. A literal JSON `null` remains `null`; an absent\n\t * body is `undefined`.\n\t */\n\tpublic readonly details: JSONValue | undefined;\n\tpublic override readonly name = \"RateLimitError\";\n\t/**\n\t * Requests left in the reported window, or `undefined` if not reported.\n\t */\n\tpublic readonly remaining: number | undefined;\n\t/** Allowlisted raw response headers, or `undefined` if not set. */\n\tpublic readonly responseHeaders: Readonly<Record<string, string>> | undefined;\n\tpublic readonly retryAfterSeconds: number;\n\t/**\n\t * Which layer refused the request, or `\"unknown\"` without evidence.\n\t *\n\t * @since 0.4.0\n\t */\n\tpublic readonly source: RateLimitSource;\n\t/** HTTP status code that produced the error, or `undefined` if not set. */\n\tpublic readonly statusCode: number | undefined;\n\n\t/**\n\t * Creates a new RateLimitError.\n\t *\n\t * @param message - Human-readable error description.\n\t * @param options - Error options including the retry delay.\n\t */\n\tconstructor(message: string, options: RateLimitErrorOptions) {\n\t\tsuper(message, options);\n\t\tthis.retryAfterSeconds = options.retryAfterSeconds;\n\t\tthis.remaining = options.remaining;\n\t\tthis.responseHeaders = options.responseHeaders;\n\t\tthis.details = options.details;\n\t\tthis.statusCode = options.statusCode;\n\t\tthis.source = options.source ?? \"unknown\";\n\t}\n}\n\nconst GUIDED_ERRORS = new WeakSet<RateLimitError>();\n\n/**\n * Marks a transport-minted error whose zero-second delay is explicit guidance.\n *\n * @param error - The classified rate-limit failure.\n * @returns The same error, marked for retry orchestration.\n */\nexport function markServerRetryGuidance(error: RateLimitError): RateLimitError {\n\tGUIDED_ERRORS.add(error);\n\treturn error;\n}\n\n/**\n * Checks whether an error carries applicable server retry guidance.\n *\n * @param error - The rate-limit failure to inspect.\n * @returns Whether its delay should override caller backoff.\n */\nexport function hasServerRetryGuidance(error: RateLimitError): boolean {\n\treturn error.retryAfterSeconds > 0 || GUIDED_ERRORS.has(error);\n}\n","import { OpenCloudError } from \"./base.ts\";\n\n/**\n * Options for constructing a {@link NetworkError}.\n *\n * @since 0.1.0\n */\nexport interface NetworkErrorOptions extends ErrorOptions {\n\t/** HTTP method of the request that failed. */\n\tmethod?: string | undefined;\n\t/** Fully-qualified URL of the request that failed. */\n\turl?: string | undefined;\n}\n\n/**\n * Thrown when a network-level failure prevents the request from reaching\n * the Roblox Open Cloud API (e.g., DNS resolution failure, connection reset).\n * The `method` and `url` name the failing call so a transport failure that\n * survives every retry can be diagnosed; the underlying transport error is\n * carried on `cause`.\n *\n * @since 0.1.0\n */\nexport class NetworkError extends OpenCloudError {\n\tpublic readonly method: string | undefined;\n\tpublic override readonly name: string = \"NetworkError\";\n\tpublic readonly url: string | undefined;\n\n\t/**\n\t * Creates a new NetworkError.\n\t *\n\t * @param message - Human-readable error description.\n\t * @param options - Error options including the optional `cause` and the\n\t * `method` / `url` of the request that failed.\n\t */\n\tconstructor(message: string, options?: NetworkErrorOptions) {\n\t\tsuper(message, options);\n\t\tthis.method = options?.method;\n\t\tthis.url = options?.url;\n\t}\n}\n"],"mappings":";AAeA,MAAM,uBAAsD,OAAO,OAAO,CAAC,CAAC;AAE5E,MAAM,oCAAoB,IAAI,QAAuD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BrF,IAAa,iBAAb,cAAoC,MAAM;;CAEzC;CACA,OAAwC;;;;;;;;CASxC,YAAY,SAAkB,SAAiC;EAC9D,MAAM,SAAS,OAAO;EACtB,KAAK,OAAO,SAAS;CACtB;;;;;;;;;CAUA,IAAW,mBAAkD;EAC5D,OAAO,kBAAkB,IAAI,IAAI,KAAK;CACvC;AACD;;;;;;;;;;AAWA,SAAgB,uBACf,OACA,UACiB;CACjB,kBAAkB,IAAI,OAAO,OAAO,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC;CACzD,OAAO;AACR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACJA,IAAa,WAAb,cAA8B,eAAe;CAC5C;CACA;CACA;CACA;CACA,OAAwC;CACxC;CACA;CACA;CACA;;;;;;;;;;CAWA,YAAY,SAAiB,SAA0B;EACtD,MAAM,SAAS,OAAO;EACtB,KAAK,aAAa,QAAQ;EAC1B,KAAK,UAAU,QAAQ;EACvB,KAAK,SAAS,QAAQ;EACtB,KAAK,MAAM,QAAQ;EACnB,KAAK,YAAY,QAAQ;EACzB,KAAK,kBAAkB,QAAQ;EAC/B,KAAK,iBAAiB,QAAQ;EAC9B,KAAK,qBAAqB,QAAQ;CACnC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,SAAgB,iBAAiB,KAAkC;CAClE,OAAO;EACN,WAAW,IAAI;EACf,gBAAgB,IAAI;EACpB,QAAQ,IAAI;EACZ,iBAAiB,IAAI;EACrB,oBAAoB,IAAI;EACxB,KAAK,IAAI;CACV;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC3DA,IAAa,iBAAb,cAAoC,eAAe;;;;;CAKlD;CACA,OAAgC;;;;CAIhC;;CAEA;CACA;;;;;;CAMA;;CAEA;;;;;;;CAQA,YAAY,SAAiB,SAAgC;EAC5D,MAAM,SAAS,OAAO;EACtB,KAAK,oBAAoB,QAAQ;EACjC,KAAK,YAAY,QAAQ;EACzB,KAAK,kBAAkB,QAAQ;EAC/B,KAAK,UAAU,QAAQ;EACvB,KAAK,aAAa,QAAQ;EAC1B,KAAK,SAAS,QAAQ,UAAU;CACjC;AACD;AAEA,MAAM,gCAAgB,IAAI,QAAwB;;;;;;;AAQlD,SAAgB,wBAAwB,OAAuC;CAC9E,cAAc,IAAI,KAAK;CACvB,OAAO;AACR;;;;;;;AAQA,SAAgB,uBAAuB,OAAgC;CACtE,OAAO,MAAM,oBAAoB,KAAK,cAAc,IAAI,KAAK;AAC9D;;;;;;;;;;;;AC9IA,IAAa,eAAb,cAAkC,eAAe;CAChD;CACA,OAAwC;CACxC;;;;;;;;CASA,YAAY,SAAiB,SAA+B;EAC3D,MAAM,SAAS,OAAO;EACtB,KAAK,SAAS,SAAS;EACvB,KAAK,MAAM,SAAS;CACrB;AACD"}
1
+ {"version":3,"file":"network-error-P4An7nUB.mjs","names":[],"sources":["../src/errors/base.ts","../src/errors/api-error.ts","../src/errors/rate-limit.ts","../src/errors/network-error.ts"],"sourcesContent":["/**\n * Options for constructing an {@link OpenCloudError}.\n *\n * @since 0.3.0\n */\nexport interface OpenCloudErrorOptions extends ErrorOptions {\n\t/**\n\t * Machine-readable classifier for the failure, when the error has one. An\n\t * `ApiError` and `RateLimitError` fill it from the response body; a\n\t * `ValidationError` narrows it to its own closed union. Errors with nothing\n\t * to classify (transport failures and poll timeouts) leave it `undefined`.\n\t */\n\treadonly code?: string | undefined;\n}\n\nconst NO_PREVIOUS_ATTEMPTS: ReadonlyArray<OpenCloudError> = Object.freeze([]);\n\nconst PREVIOUS_ATTEMPTS = new WeakMap<OpenCloudError, ReadonlyArray<OpenCloudError>>();\n\n/**\n * Base error class for all Open Cloud SDK errors.\n *\n * All specific error types (RateLimitError, ApiError, NetworkError)\n * extend this class, enabling `instanceof OpenCloudError` checks.\n *\n * `code` is declared here rather than on the subclasses that populate it, so a\n * caller holding the `OpenCloudError` that `Result.err` is typed as can branch\n * on it without first narrowing to a subclass.\n *\n * @since 0.1.0\n *\n * @example\n *\n * ```ts\n * import { ApiError, OpenCloudError } from \"@bedrock-rbx/ocale\";\n *\n * // `Result.err` is typed as OpenCloudError, so a caller draining a queue\n * // branches on the canonical status without narrowing to a subclass first.\n * const err: OpenCloudError = new ApiError(\"HTTP 404: Queue items not found.\", {\n * code: \"NOT_FOUND\",\n * statusCode: 404,\n * });\n *\n * expect(err.code).toBe(\"NOT_FOUND\");\n * expect(new OpenCloudError(\"no classifier\").code).toBeUndefined();\n * ```\n */\nexport class OpenCloudError extends Error {\n\t/** Machine-readable classifier, or `undefined` when the error has none. */\n\tpublic readonly code: string | undefined;\n\tpublic override readonly name: string = \"OpenCloudError\";\n\n\t/**\n\t * Creates a new OpenCloudError.\n\t *\n\t * @param message - Human-readable error description.\n\t * @param options - Error options including the optional `cause` and the\n\t * machine-readable `code`.\n\t */\n\tconstructor(message?: string, options?: OpenCloudErrorOptions) {\n\t\tsuper(message, options);\n\t\tthis.code = options?.code;\n\t}\n\n\t/**\n\t * Failures of the earlier attempts of the same logical request, oldest\n\t * first. A failure that is this error's own `cause` is not repeated here.\n\t * Empty when the request was not retried.\n\t *\n\t * @since 0.4.0\n\t * @returns The earlier attempts' failures.\n\t */\n\tpublic get previousAttempts(): ReadonlyArray<OpenCloudError> {\n\t\treturn PREVIOUS_ATTEMPTS.get(this) ?? NO_PREVIOUS_ATTEMPTS;\n\t}\n}\n\n/**\n * Records the failures of the earlier attempts of the logical request that\n * produced `error`, so they read back through\n * {@link OpenCloudError.previousAttempts}.\n *\n * @param error - The failure the retry loop returns.\n * @param attempts - Earlier attempt failures, oldest first.\n * @returns The same error.\n */\nexport function recordPreviousAttempts(\n\terror: OpenCloudError,\n\tattempts: ReadonlyArray<OpenCloudError>,\n): OpenCloudError {\n\tPREVIOUS_ATTEMPTS.set(error, Object.freeze([...attempts]));\n\treturn error;\n}\n","import { OpenCloudError, type OpenCloudErrorOptions } from \"./base.ts\";\n\n/**\n * Options for constructing an {@link ApiError}.\n *\n * @since 0.1.0\n */\nexport interface ApiErrorOptions extends OpenCloudErrorOptions {\n\t/** Parsed response body, when present. */\n\tdetails?: JSONValue | undefined;\n\t/**\n\t * Wall-clock time the request was in flight before this error, in\n\t * milliseconds. Present for errors built by the transport; a long elapsed\n\t * time on an intermittent failure points at a load or timeout correlation.\n\t */\n\telapsedMs?: number | undefined;\n\t/**\n\t * Human-readable summary extracted from an HTML gateway error page, set\n\t * when the error body was such a page (an HAProxy-style load-balancer\n\t * rejection) rather than an Open Cloud response. When present, the raw HTML\n\t * is not retained on {@link ApiError.details}.\n\t */\n\tgatewaySummary?: string | undefined;\n\t/** HTTP method of the request that produced this error. */\n\tmethod?: string | undefined;\n\t/**\n\t * Allowlisted response headers useful for diagnosis and escalation (request\n\t * ids, edge/server identifiers). The full header set is never retained, to\n\t * avoid surfacing anything sensitive and to keep errors light.\n\t */\n\tresponseHeaders?: Readonly<Record<string, string>> | undefined;\n\t/** HTTP status code from the API response. */\n\tstatusCode: number;\n\t/**\n\t * Length, in decoded characters, of a 2xx body that could not be parsed as\n\t * JSON. Set only by the transport, and only for that failure — nothing else\n\t * builds an {@link ApiError} over a successful status — so its presence is\n\t * also how a body-parse failure is told apart from an API rejection. The\n\t * number is the diagnostic one: a body that stops mid-token at exactly the\n\t * length the edge delivered is a truncated read, not malformed JSON.\n\t */\n\tunparsedBodyLength?: number | undefined;\n\t/** Fully-qualified URL of the request that produced this error. */\n\turl?: string | undefined;\n}\n\n/**\n * Everything in {@link ApiErrorOptions} except what the API answered ({@link\n * ApiErrorOptions.code}, {@link ApiErrorOptions.details}, and {@link\n * ApiErrorOptions.statusCode}): the request the transport made, how long it was\n * in flight, and what the response carried alongside its body. Every field is\n * required, and every one accepts `undefined` for a field the transport did not\n * capture.\n *\n * @since 0.2.0\n */\nexport type ApiRequestContext = {\n\t[K in Exclude<keyof ApiErrorOptions, \"cause\" | \"code\" | \"details\" | \"statusCode\">]-?:\n\t\t| ApiErrorOptions[K]\n\t\t| undefined;\n};\n\n/**\n * Thrown when the Roblox Open Cloud API returns a non-2xx response\n * that is not a rate limit (429).\n *\n * @since 0.1.0\n *\n * @example\n *\n * ```ts\n * import { ApiError } from \"@bedrock-rbx/ocale\";\n *\n * const error = new ApiError(\"HTTP 404: Pass not found (code NotFound)\", {\n * code: \"NotFound\",\n * details: { errorCode: \"NotFound\", message: \"Pass not found\" },\n * statusCode: 404,\n * });\n *\n * expect(error).toBeInstanceOf(ApiError);\n * expect(error.statusCode).toBe(404);\n * expect(error.code).toBe(\"NotFound\");\n * expect(error.details).toEqual({\n * errorCode: \"NotFound\",\n * message: \"Pass not found\",\n * });\n * ```\n */\nexport class ApiError extends OpenCloudError {\n\tpublic readonly details: JSONValue | undefined;\n\tpublic readonly elapsedMs: number | undefined;\n\tpublic readonly gatewaySummary: string | undefined;\n\tpublic readonly method: string | undefined;\n\tpublic override readonly name: string = \"ApiError\";\n\tpublic readonly responseHeaders: Readonly<Record<string, string>> | undefined;\n\tpublic readonly statusCode: number;\n\tpublic readonly unparsedBodyLength: number | undefined;\n\tpublic readonly url: string | undefined;\n\n\t/**\n\t * Creates a new ApiError.\n\t *\n\t * @param message - Human-readable error description.\n\t * @param options - Error options including status code, optional error\n\t * code, the parsed response body when present, and the request context\n\t * (method, url, elapsed time, allowlisted response headers) when built by\n\t * the transport.\n\t */\n\tconstructor(message: string, options: ApiErrorOptions) {\n\t\tsuper(message, options);\n\t\tthis.statusCode = options.statusCode;\n\t\tthis.details = options.details;\n\t\tthis.method = options.method;\n\t\tthis.url = options.url;\n\t\tthis.elapsedMs = options.elapsedMs;\n\t\tthis.responseHeaders = options.responseHeaders;\n\t\tthis.gatewaySummary = options.gatewaySummary;\n\t\tthis.unparsedBodyLength = options.unparsedBodyLength;\n\t}\n}\n\n/**\n * Reads the request context off an {@link ApiError} so a replacement error can\n * carry it. Spread the result into the options of the new error. {@link\n * OpenCloudError.code}, {@link ApiError.details}, and {@link\n * ApiError.statusCode} describe the API's answer and are left to the caller.\n *\n * @since 0.2.0\n *\n * @param err - The error to read the request context from.\n * @returns The transport-captured fields, each undefined when unset.\n *\n * @example\n *\n * ```ts\n * import { ApiError, requestContextOf } from \"@bedrock-rbx/ocale\";\n *\n * const original = new ApiError(\"HTTP 404\", {\n * elapsedMs: 512,\n * method: \"GET\",\n * statusCode: 404,\n * url: \"https://apis.roblox.com/cloud/v2/universes/1\",\n * });\n *\n * const rewrapped = new ApiError(\"Universe 1 was not found; adoption failed\", {\n * ...requestContextOf(original),\n * statusCode: 404,\n * });\n *\n * expect(rewrapped.method).toBe(\"GET\");\n * expect(rewrapped.url).toBe(\"https://apis.roblox.com/cloud/v2/universes/1\");\n * expect(rewrapped.elapsedMs).toBe(512);\n * ```\n */\nexport function requestContextOf(err: ApiError): ApiRequestContext {\n\treturn {\n\t\telapsedMs: err.elapsedMs,\n\t\tgatewaySummary: err.gatewaySummary,\n\t\tmethod: err.method,\n\t\tresponseHeaders: err.responseHeaders,\n\t\tunparsedBodyLength: err.unparsedBodyLength,\n\t\turl: err.url,\n\t};\n}\n","import { OpenCloudError, type OpenCloudErrorOptions } from \"./base.ts\";\n\n/**\n * Which layer refused a 429, as best the SDK can tell from one response.\n * It names the refusing layer only, not the cause of the refusal.\n *\n * - `\"edge\"`: the gateway refused before the request reached the service.\n * - `\"service\"`: the service behind the gateway refused (the response names it\n * in `x-roblox-system-reason`).\n * - `\"unknown\"`: the response has no positive evidence for either layer.\n *\n * @since 0.4.0\n */\nexport type RateLimitSource = \"edge\" | \"service\" | \"unknown\";\n\n/**\n * Options for constructing a {@link RateLimitError}.\n *\n * @since 0.1.0\n */\nexport interface RateLimitErrorOptions extends OpenCloudErrorOptions {\n\t/**\n\t * Parsed 429 response body, when present. Holds the server's 429\n\t * explanation (JSON when the body parses, otherwise the truncated raw\n\t * text) so a rate limit stays diagnosable from the error alone. A literal\n\t * JSON `null` remains `null`; an absent body is `undefined`.\n\t */\n\tdetails?: JSONValue | undefined;\n\t/**\n\t * Requests left in the reported rate-limit window. Read from\n\t * `x-ratelimit-remaining` using the smallest valid token.\n\t *\n\t * `undefined` when the header has no valid non-negative integer token.\n\t *\n\t * Parsed separately from `x-ratelimit-reset`; a valid value survives an\n\t * invalid reset.\n\t *\n\t * This is one budget reading, not a classifier for the cause of the 429.\n\t */\n\tremaining?: number | undefined;\n\t/**\n\t * Allowlisted response headers useful for diagnosing the 429. Values are\n\t * preserved exactly as the Fetch API presents them, including comma-joined\n\t * multi-window values. The full header set is never retained.\n\t */\n\tresponseHeaders?: Readonly<Record<string, string>> | undefined;\n\t/** Seconds to wait before retrying the request. */\n\tretryAfterSeconds: number;\n\t/**\n\t * Which layer refused the request. Defaults to `\"unknown\"`.\n\t *\n\t * @since 0.4.0\n\t */\n\tsource?: RateLimitSource | undefined;\n\t/**\n\t * HTTP status code that produced the error. Always `429` when minted by the\n\t * SDK transport; `undefined` when constructed without one.\n\t */\n\tstatusCode?: number | undefined;\n}\n\n/**\n * Thrown when the Roblox Open Cloud API returns a 429 Too Many Requests\n * response. Contains the server-suggested retry delay and safe,\n * machine-readable response evidence. The body code, remaining budget, and\n * headers do not identify the upstream cause (for example quota vs place\n * capacity). `source` names only the layer that refused the request;\n * `\"unknown\"` means the response carried no positive evidence for either\n * layer.\n *\n * @since 0.1.0\n *\n * @example\n *\n * ```ts\n * import { RateLimitError } from \"@bedrock-rbx/ocale\";\n *\n * const error = new RateLimitError(\"Too many requests\", {\n * code: \"RESOURCE_EXHAUSTED\",\n * remaining: 3,\n * responseHeaders: {\n * \"retry-after\": \"1856\",\n * \"x-ratelimit-limit\": \"5, 5;w=60, 5;w=60\",\n * },\n * retryAfterSeconds: 1856,\n * source: \"service\",\n * });\n *\n * // `source` is a classification; the raw evidence stays available.\n * const evidence = {\n * code: error.code,\n * limit: error.responseHeaders?.[\"x-ratelimit-limit\"],\n * retryAfter: error.responseHeaders?.[\"retry-after\"],\n * source: error.source,\n * };\n *\n * expect(evidence).toEqual({\n * code: \"RESOURCE_EXHAUSTED\",\n * limit: \"5, 5;w=60, 5;w=60\",\n * retryAfter: \"1856\",\n * source: \"service\",\n * });\n * ```\n */\nexport class RateLimitError extends OpenCloudError {\n\t/**\n\t * Parsed 429 response body. A literal JSON `null` remains `null`; an absent\n\t * body is `undefined`.\n\t */\n\tpublic readonly details: JSONValue | undefined;\n\tpublic override readonly name = \"RateLimitError\";\n\t/**\n\t * Requests left in the reported window, or `undefined` if not reported.\n\t */\n\tpublic readonly remaining: number | undefined;\n\t/** Allowlisted raw response headers, or `undefined` if not set. */\n\tpublic readonly responseHeaders: Readonly<Record<string, string>> | undefined;\n\tpublic readonly retryAfterSeconds: number;\n\t/**\n\t * Which layer refused the request, or `\"unknown\"` without evidence.\n\t *\n\t * @since 0.4.0\n\t */\n\tpublic readonly source: RateLimitSource;\n\t/** HTTP status code that produced the error, or `undefined` if not set. */\n\tpublic readonly statusCode: number | undefined;\n\n\t/**\n\t * Creates a new RateLimitError.\n\t *\n\t * @param message - Human-readable error description.\n\t * @param options - Error options including the retry delay.\n\t */\n\tconstructor(message: string, options: RateLimitErrorOptions) {\n\t\tsuper(message, options);\n\t\tthis.retryAfterSeconds = options.retryAfterSeconds;\n\t\tthis.remaining = options.remaining;\n\t\tthis.responseHeaders = options.responseHeaders;\n\t\tthis.details = options.details;\n\t\tthis.statusCode = options.statusCode;\n\t\tthis.source = options.source ?? \"unknown\";\n\t}\n}\n\nconst GUIDED_ERRORS = new WeakSet<RateLimitError>();\n\n/**\n * Marks a transport-minted error whose zero-second delay is explicit guidance.\n *\n * @param error - The classified rate-limit failure.\n * @returns The same error, marked for retry orchestration.\n */\nexport function markServerRetryGuidance(error: RateLimitError): RateLimitError {\n\tGUIDED_ERRORS.add(error);\n\treturn error;\n}\n\n/**\n * Checks whether an error carries applicable server retry guidance.\n *\n * @param error - The rate-limit failure to inspect.\n * @returns Whether its delay should override caller backoff.\n */\nexport function hasServerRetryGuidance(error: RateLimitError): boolean {\n\treturn error.retryAfterSeconds > 0 || GUIDED_ERRORS.has(error);\n}\n","import { OpenCloudError } from \"./base.ts\";\n\n/**\n * Options for constructing a {@link NetworkError}.\n *\n * @since 0.1.0\n */\nexport interface NetworkErrorOptions extends ErrorOptions {\n\t/** HTTP method of the request that failed. */\n\tmethod?: string | undefined;\n\t/** Fully-qualified URL of the request that failed. */\n\turl?: string | undefined;\n}\n\n/**\n * Thrown when a network-level failure prevents the request from reaching\n * the Roblox Open Cloud API (e.g., DNS resolution failure, connection reset).\n * The `method` and `url` name the failing call so a transport failure that\n * survives every retry can be diagnosed; the underlying transport error is\n * carried on `cause`.\n *\n * @since 0.1.0\n */\nexport class NetworkError extends OpenCloudError {\n\tpublic readonly method: string | undefined;\n\tpublic override readonly name: string = \"NetworkError\";\n\tpublic readonly url: string | undefined;\n\n\t/**\n\t * Creates a new NetworkError.\n\t *\n\t * @param message - Human-readable error description.\n\t * @param options - Error options including the optional `cause` and the\n\t * `method` / `url` of the request that failed.\n\t */\n\tconstructor(message: string, options?: NetworkErrorOptions) {\n\t\tsuper(message, options);\n\t\tthis.method = options?.method;\n\t\tthis.url = options?.url;\n\t}\n}\n"],"mappings":";AAeA,MAAM,uBAAsD,OAAO,OAAO,CAAC,CAAC;AAE5E,MAAM,oCAAoB,IAAI,QAAuD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BrF,IAAa,iBAAb,cAAoC,MAAM;;CAEzC;CACA,OAAwC;;;;;;;;CASxC,YAAY,SAAkB,SAAiC;EAC9D,MAAM,SAAS,OAAO;EACtB,KAAK,OAAO,SAAS;CACtB;;;;;;;;;CAUA,IAAW,mBAAkD;EAC5D,OAAO,kBAAkB,IAAI,IAAI,KAAK;CACvC;AACD;;;;;;;;;;AAWA,SAAgB,uBACf,OACA,UACiB;CACjB,kBAAkB,IAAI,OAAO,OAAO,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC;CACzD,OAAO;AACR;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACJA,IAAa,WAAb,cAA8B,eAAe;CAC5C;CACA;CACA;CACA;CACA,OAAwC;CACxC;CACA;CACA;CACA;;;;;;;;;;CAWA,YAAY,SAAiB,SAA0B;EACtD,MAAM,SAAS,OAAO;EACtB,KAAK,aAAa,QAAQ;EAC1B,KAAK,UAAU,QAAQ;EACvB,KAAK,SAAS,QAAQ;EACtB,KAAK,MAAM,QAAQ;EACnB,KAAK,YAAY,QAAQ;EACzB,KAAK,kBAAkB,QAAQ;EAC/B,KAAK,iBAAiB,QAAQ;EAC9B,KAAK,qBAAqB,QAAQ;CACnC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,SAAgB,iBAAiB,KAAkC;CAClE,OAAO;EACN,WAAW,IAAI;EACf,gBAAgB,IAAI;EACpB,QAAQ,IAAI;EACZ,iBAAiB,IAAI;EACrB,oBAAoB,IAAI;EACxB,KAAK,IAAI;CACV;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC3DA,IAAa,iBAAb,cAAoC,eAAe;;;;;CAKlD;CACA,OAAgC;;;;CAIhC;;CAEA;CACA;;;;;;CAMA;;CAEA;;;;;;;CAQA,YAAY,SAAiB,SAAgC;EAC5D,MAAM,SAAS,OAAO;EACtB,KAAK,oBAAoB,QAAQ;EACjC,KAAK,YAAY,QAAQ;EACzB,KAAK,kBAAkB,QAAQ;EAC/B,KAAK,UAAU,QAAQ;EACvB,KAAK,aAAa,QAAQ;EAC1B,KAAK,SAAS,QAAQ,UAAU;CACjC;AACD;AAEA,MAAM,gCAAgB,IAAI,QAAwB;;;;;;;AAQlD,SAAgB,wBAAwB,OAAuC;CAC9E,cAAc,IAAI,KAAK;CACvB,OAAO;AACR;;;;;;;AAQA,SAAgB,uBAAuB,OAAgC;CACtE,OAAO,MAAM,oBAAoB,KAAK,cAAc,IAAI,KAAK;AAC9D;;;;;;;;;;;AC9IA,IAAa,eAAb,cAAkC,eAAe;CAChD;CACA,OAAwC;CACxC;;;;;;;;CASA,YAAY,SAAiB,SAA+B;EAC3D,MAAM,SAAS,OAAO;EACtB,KAAK,SAAS,SAAS;EACvB,KAAK,MAAM,SAAS;CACrB;AACD"}
package/dist/places.d.mts CHANGED
@@ -1,6 +1,5 @@
1
- import { c as OpenCloudClientOptions, d as RequestOptions, g as OpenCloudError, m as Result } from "./types-CdMr_J1M.mjs";
2
- import { a as ListLogsParameters, f as LuauExecutionTask, h as SubmitAtVersionParameters, m as SubmitAtHeadParameters, n as LuauExecutionSubmitOptions, o as LogMessage, p as LuauExecutionTaskRef, r as PollUntilDoneOptions, s as LogPage, t as LuauExecutionRunOptions, u as GetParameters } from "./capacity-admission-hycCFkTo.mjs";
3
- //#region src/domains/cloud-v2/places/types.d.ts
1
+ import { a as ListLogsParameters, f as LuauExecutionTask, h as SubmitAtVersionParameters, m as SubmitAtHeadParameters, n as LuauExecutionSubmitOptions, o as LogMessage, p as LuauExecutionTaskRef, r as PollUntilDoneOptions, s as LogPage, t as LuauExecutionRunOptions, u as GetParameters } from "./capacity-admission-Ce2V9QNb.mjs";
2
+ import { c as OpenCloudClientOptions, d as RequestOptions, g as OpenCloudError, m as Result, p as Page } from "./types-Z4abDJfK.mjs";
4
3
  /**
5
4
  * Identifies a place to read through `PlacesClient.get`.
6
5
  *
@@ -58,8 +57,42 @@ interface Place {
58
57
  /** Timestamp of the most recent update. */
59
58
  readonly updatedAt: Date;
60
59
  }
61
- //#endregion
62
- //#region src/domains/universes/places/types.d.ts
60
+ /**
61
+ * Page sizes the develop places endpoint accepts. Any other value is
62
+ * rejected with HTTP 400.
63
+ *
64
+ * @since 0.5.0
65
+ */
66
+ type ListPlacesPageSize = 10 | 25 | 50 | 100;
67
+ /**
68
+ * Parameters for listing the places of a universe. Pass the returned
69
+ * `nextPageToken` as `pageToken` until it is undefined.
70
+ *
71
+ * @since 0.5.0
72
+ */
73
+ interface ListPlacesParameters {
74
+ /** Optional page size; the server defaults to 10. */
75
+ readonly pageSize?: ListPlacesPageSize;
76
+ /** Cursor returned by the previous page. */
77
+ readonly pageToken?: string;
78
+ /** Stringified universe ID. */
79
+ readonly universeId: string;
80
+ }
81
+ /**
82
+ * One place in a universe, as listed by `PlacesClient.list`.
83
+ *
84
+ * @since 0.5.0
85
+ */
86
+ interface PlaceSummary {
87
+ /** Stringified place ID. */
88
+ readonly id: string;
89
+ /** Place name. */
90
+ readonly name: string;
91
+ /** Place description; empty when unset. */
92
+ readonly description: string;
93
+ /** Stringified ID of the universe that owns the place. */
94
+ readonly universeId: string;
95
+ }
63
96
  /**
64
97
  * Caller-supplied input for the `publish` and `save` methods on
65
98
  * `PlacesClient`. Both methods take the same parameter shape; which
@@ -96,8 +129,6 @@ interface PlaceVersion {
96
129
  */
97
130
  readonly versionNumber: number;
98
131
  }
99
- //#endregion
100
- //#region src/resources/places/client.d.ts
101
132
  /**
102
133
  * Operation Group exposed by {@link PlacesClient} as the
103
134
  * `luauExecution` namespace. Provides `submit` to queue a Luau script,
@@ -232,6 +263,24 @@ export declare class PlacesClient {
232
263
  * @returns The parsed place or the Open Cloud failure.
233
264
  */
234
265
  get(parameters: GetPlaceParameters, options?: RequestOptions): Promise<Result<Place, OpenCloudError>>;
266
+ /**
267
+ * Lists one page of the places of a universe. Omit `pageToken` for the
268
+ * first page, then pass the returned `nextPageToken` until it is
269
+ * undefined. An unknown universe yields an empty page.
270
+ *
271
+ * The read is unauthenticated: it sends no credential and is served from
272
+ * `https://develop.roblox.com`, so the client `baseUrl` does not apply.
273
+ * `pageSize` accepts only 10, 25, 50 or 100 and defaults to 10.
274
+ * Roblox allows 10000 reads per caller in a fixed 60-second window. A 429
275
+ * waits until the reported `x-ratelimit-reset` before it retries.
276
+ *
277
+ * @since 0.5.0
278
+ * @param parameters - Universe ID and optional pagination fields.
279
+ * @param options - Optional per-request overrides.
280
+ * @returns A {@link Result} wrapping the page of {@link PlaceSummary}
281
+ * items, or the {@link OpenCloudError} that caused the request to fail.
282
+ */
283
+ list(parameters: ListPlacesParameters, options?: RequestOptions): Promise<Result<Page<PlaceSummary>, OpenCloudError>>;
235
284
  /**
236
285
  * Publishes a new live version of a place.
237
286
  *
@@ -281,6 +330,5 @@ export declare class PlacesClient {
281
330
  */
282
331
  update(parameters: UpdatePlaceParameters, options?: RequestOptions): Promise<Result<Place, OpenCloudError>>;
283
332
  }
284
- //#endregion
285
- export type { GetPlaceParameters, ListLogsParameters, LogMessage, LogPage, LuauExecutionHandle, Place, PlaceVersion, PublishParameters, UpdatePlaceParameters };
333
+ export type { GetPlaceParameters, ListLogsParameters, ListPlacesPageSize, ListPlacesParameters, LogMessage, LogPage, LuauExecutionHandle, Place, PlaceSummary, PlaceVersion, PublishParameters, UpdatePlaceParameters };
286
334
  //# sourceMappingURL=places.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"places.d.mts","names":[],"sources":["../src/domains/cloud-v2/places/types.ts","../src/domains/universes/places/types.ts","../src/resources/places/client.ts"],"mappings":";;;;;;;;UAKiB;;WAEP;;WAEA;;;;;;;;;;UAWO;;WAEP;;WAEA;;WAEA;;WAEA;;WAEA;;;;;;;;UASO;;WAEP;;WAEA,WAAW;;WAEX;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA,WAAW;;;;;;;;;;;;UCjDJ;;WAEP,MAAM,WAAW;;;;;;;WAOjB;;WAEA;;WAEA;;;;;;;UAQO;;;;;;WAMP;;;;;;;;;;;;;;UCwBO;;;;;;;;;;;;;EAahB,IACC,YAAY,eACZ,UAAU,iBACR,QAAQ,OAAO,mBAAmB;;;;;;;;;;;;;;EAcrC,SACC,YAAY,oBACZ,UAAU,iBACR,QAAQ,OAAO,SAAS;;;;;;;;;;;;;;EAc3B,cACC,KAAK,sBACL,UAAU,uBACR,QAAQ,OAAO,mBAAmB;;;;;;;;;;;;;;;EAerC,aACC,YAAY,yBAAyB,2BACrC,UAAU,0BACR,QAAQ,OAAO,mBAAmB;;;;;;;;;;;;;;;;EAgBrC,OACC,YAAY,yBAAyB,2BACrC,UAAU,6BACR,QAAQ,OAAO,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAqEzB;;WAGI,eAAe;;;;;;;EAQ/B,YAAY,SAAS;;;;;;;;;;EAcrB,IACC,YAAY,oBACZ,UAAU,iBACR,QAAQ,OAAO,OAAO;;;;;;;;;;;;;;EAiBzB,QACC,YAAY,mBACZ,UAAU,iBACR,QAAQ,OAAO,cAAc;;;;;;;;;;;;;;;;;;EAqBhC,KACC,YAAY,mBACZ,UAAU,iBACR,QAAQ,OAAO,cAAc;;;;;;;;;;;;;;;;EAmBhC,OACC,YAAY,uBACZ,UAAU,iBACR,QAAQ,OAAO,OAAO"}
1
+ {"version":3,"file":"places.d.mts","names":[],"sources":["../src/domains/cloud-v2/places/types.ts","../src/domains/develop/places/types.ts","../src/domains/universes/places/types.ts","../src/resources/places/client.ts"],"mappings":";;;;;;;UAKiB;;WAEP;;WAEA;;;;;;;;;;UAWO;;WAEP;;WAEA;;WAEA;;WAEA;;WAEA;;;;;;;;UASO;;WAEP;;WAEA,WAAW;;WAEX;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA,WAAW;;;;;;;;KCnDT;;;;;;;UAQK;;WAEP,WAAW;;WAEX;;WAEA;;;;;;;UAQO;;WAEP;;WAEA;;WAEA;;WAEA;;;;;;;;;;UC5BO;;WAEP,MAAM,WAAW;;;;;;;WAOjB;;WAEA;;WAEA;;;;;;;UAQO;;;;;;WAMP;;;;;;;;;;;;UCoCO;;;;;;;;;;;;;EAahB,IACC,YAAY,eACZ,UAAU,iBACR,QAAQ,OAAO,mBAAmB;;;;;;;;;;;;;;EAcrC,SACC,YAAY,oBACZ,UAAU,iBACR,QAAQ,OAAO,SAAS;;;;;;;;;;;;;;EAc3B,cACC,KAAK,sBACL,UAAU,uBACR,QAAQ,OAAO,mBAAmB;;;;;;;;;;;;;;;EAerC,aACC,YAAY,yBAAyB,2BACrC,UAAU,0BACR,QAAQ,OAAO,mBAAmB;;;;;;;;;;;;;;;;EAgBrC,OACC,YAAY,yBAAyB,2BACrC,UAAU,6BACR,QAAQ,OAAO,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAmFzB;;WAGI,eAAe;;;;;;;EAQ/B,YAAY,SAAS;;;;;;;;;;EAcrB,IACC,YAAY,oBACZ,UAAU,iBACR,QAAQ,OAAO,OAAO;;;;;;;;;;;;;;;;;;EAqBzB,KACC,YAAY,sBACZ,UAAU,iBACR,QAAQ,OAAO,KAAK,eAAe;;;;;;;;;;;;;;EAsBtC,QACC,YAAY,mBACZ,UAAU,iBACR,QAAQ,OAAO,cAAc;;;;;;;;;;;;;;;;;;EAqBhC,KACC,YAAY,mBACZ,UAAU,iBACR,QAAQ,OAAO,cAAc;;;;;;;;;;;;;;;;EAmBhC,OACC,YAAY,uBACZ,UAAU,iBACR,QAAQ,OAAO,OAAO"}
package/dist/places.mjs CHANGED
@@ -1,9 +1,10 @@
1
- import { j as isRecord, m as UnexpectedResponseError, o as UPLOAD_METHOD_DEFAULTS } from "./retry-CMRDvAR4.mjs";
2
- import { t as ValidationError } from "./validation-964VNlbp.mjs";
3
- import { c as isDateTimeString, n as okRequest, s as toJsonDetails, t as ResourceClient } from "./resource-client-CaIVr-go.mjs";
4
- import { a as pollUntilDoneCoreAsync, c as LIST_LOGS_SPEC, n as submitAndPollAsync, o as withBudgetRequestTimeout, r as submitWithCapacityAsync, s as GET_SPEC, t as buildPollDependencies } from "./polling-helpers-DfF5dspc.mjs";
5
- import { n as RBXL_SIGNATURE, r as matchesSignature, t as RBXLX_SIGNATURE } from "./signatures-JF-7Psce.mjs";
6
- //#region src/domains/cloud-v2/places/builders.ts
1
+ import { a as pollUntilDoneCoreAsync, c as LIST_LOGS_SPEC, n as submitAndPollAsync, o as withBudgetRequestTimeout, r as submitWithCapacityAsync, s as GET_SPEC, t as buildPollDependencies } from "./polling-helpers-BtEYR5dN.mjs";
2
+ import { t as ValidationError } from "./validation-kaTLLAD1.mjs";
3
+ import { n as okRequest, s as toJsonDetails, t as ResourceClient } from "./resource-client-Cm_bPcCs.mjs";
4
+ import { A as waitForQuotaReset, N as isRecord, m as UnexpectedResponseError, o as UPLOAD_METHOD_DEFAULTS, r as IDEMPOTENT_METHOD_DEFAULTS } from "./retry-Dv5TsY9O.mjs";
5
+ import { t as isDateTimeString } from "./is-date-time-string-C91G44SI.mjs";
6
+ import { n as RBXL_SIGNATURE, r as matchesSignature, t as RBXLX_SIGNATURE } from "./signatures-CtJ7jfVN.mjs";
7
+ // src/domains/cloud-v2/places/builders.ts
7
8
  const NON_UPDATABLE_KEYS = /* @__PURE__ */ new Set(["placeId", "universeId"]);
8
9
  /**
9
10
  * Build a read-only lookup of a place's configuration, including its root flag.
@@ -50,8 +51,7 @@ function buildUpdateRequest(parameters) {
50
51
  function extractUpdateFieldKeys(parameters) {
51
52
  return Object.keys(parameters).filter((key) => !NON_UPDATABLE_KEYS.has(key));
52
53
  }
53
- //#endregion
54
- //#region src/domains/cloud-v2/places/operations.ts
54
+ // src/domains/cloud-v2/places/operations.ts
55
55
  const UPDATE_PER_MINUTE = 100;
56
56
  const SECONDS_PER_MINUTE$1 = 60;
57
57
  /** Read quota from the Cloud_GetPlace operation: 100 requests per minute. */
@@ -77,8 +77,7 @@ const UPDATE_OPERATION_LIMIT = Object.freeze({
77
77
  * OpenAPI schema.
78
78
  */
79
79
  const UPDATE_REQUIRED_SCOPES = Object.freeze(["universe.place:write"]);
80
- //#endregion
81
- //#region src/domains/cloud-v2/places/parsers.ts
80
+ // src/domains/cloud-v2/places/parsers.ts
82
81
  const MALFORMED_PLACE_MESSAGE = "Malformed place response";
83
82
  const PLACE_PATH_PATTERN = /^universes\/(\d+)\/places\/(\d+)$/;
84
83
  /**
@@ -91,7 +90,7 @@ const PLACE_PATH_PATTERN = /^universes\/(\d+)\/places\/(\d+)$/;
91
90
  * schema.
92
91
  */
93
92
  function parsePlaceResponse({ body, status: statusCode }) {
94
- if (!isPlaceWire(body)) return malformedPlace(statusCode, body);
93
+ if (!isPlaceWire$1(body)) return malformedPlace(statusCode, body);
95
94
  const match = PLACE_PATH_PATTERN.exec(body.path);
96
95
  const universeId = match?.[1];
97
96
  const id = match?.[2];
@@ -137,11 +136,87 @@ function hasValidPlaceOptional(body) {
137
136
  const serverSize = body["serverSize"] ?? void 0;
138
137
  return (serverSize === void 0 || typeof serverSize === "number") && isOptionalBoolean(body["root"]) && isOptionalBoolean(body["universeRuntimeCreation"]);
139
138
  }
140
- function isPlaceWire(body) {
139
+ function isPlaceWire$1(body) {
141
140
  return isRecord(body) && hasValidPlaceRequired(body) && hasValidPlaceOptional(body);
142
141
  }
143
- //#endregion
144
- //#region src/domains/universes/places/builders.ts
142
+ // src/domains/develop/places/builders.ts
143
+ /**
144
+ * Builds the `GET` request listing one page of a universe's places. Maps
145
+ * `pageSize` to `limit` and `pageToken` to `cursor`, each only when defined.
146
+ *
147
+ * @param parameters - Universe ID plus optional pagination fields.
148
+ * @returns A pure {@link HttpRequest} describing the list call.
149
+ */
150
+ function buildListPlacesRequest(parameters) {
151
+ const query = new URLSearchParams();
152
+ if (parameters.pageSize !== void 0) query.append("limit", String(parameters.pageSize));
153
+ if (parameters.pageToken !== void 0) query.append("cursor", parameters.pageToken);
154
+ const queryString = query.toString();
155
+ const base = `/v1/universes/${parameters.universeId}/places`;
156
+ return {
157
+ method: "GET",
158
+ url: queryString === "" ? base : `${base}?${queryString}`
159
+ };
160
+ }
161
+ // src/domains/develop/places/operations.ts
162
+ /** Origin of the unauthenticated develop places endpoint. */
163
+ const LIST_PLACES_BASE_URL = "https://develop.roblox.com";
164
+ /**
165
+ * Per-second ceiling for listing places. Not published in the OpenAPI spec;
166
+ * observed 2026-11-09 on 200 and 400 responses as
167
+ * `x-ratelimit-limit: 10000, 10000;w=60` (10000 requests per 60 seconds).
168
+ * The window is fixed: a 429's `retry-after` is shorter than the window,
169
+ * which reopens only at `x-ratelimit-reset`.
170
+ */
171
+ const LIST_PLACES_OPERATION_LIMIT = Object.freeze({
172
+ maxPerSecond: 1e4 / 60,
173
+ operationKey: "places.list"
174
+ });
175
+ // src/domains/develop/places/parsers.ts
176
+ /**
177
+ * Parses one page of a universe's places. Numeric IDs become strings and a
178
+ * `null` next cursor becomes `undefined`.
179
+ *
180
+ * @param response - The HTTP response to parse.
181
+ * @returns The parsed page or an `UnexpectedResponseError` when the body is
182
+ * malformed.
183
+ */
184
+ function parsePlacesListResponse({ body, status: statusCode }) {
185
+ if (!isRecord(body) || !Array.isArray(body["data"])) return malformed(statusCode, body);
186
+ const nextPageToken = body["nextPageCursor"] ?? void 0;
187
+ if (nextPageToken !== void 0 && typeof nextPageToken !== "string") return malformed(statusCode, body);
188
+ const items = [];
189
+ const places = body["data"];
190
+ for (const item of places) {
191
+ if (!isPlaceWire(item)) return malformed(statusCode, body);
192
+ items.push({
193
+ id: String(item.id),
194
+ name: item.name,
195
+ description: item.description,
196
+ universeId: String(item.universeId)
197
+ });
198
+ }
199
+ return {
200
+ data: {
201
+ items,
202
+ nextPageToken
203
+ },
204
+ success: true
205
+ };
206
+ }
207
+ function isPlaceWire(value) {
208
+ return isRecord(value) && Number.isSafeInteger(value["id"]) && Number.isSafeInteger(value["universeId"]) && typeof value["name"] === "string" && typeof value["description"] === "string";
209
+ }
210
+ function malformed(statusCode, body) {
211
+ return {
212
+ err: new UnexpectedResponseError("Malformed places list response", {
213
+ details: toJsonDetails(body),
214
+ statusCode
215
+ }),
216
+ success: false
217
+ };
218
+ }
219
+ // src/domains/universes/places/builders.ts
145
220
  const CONTENT_TYPE_BY_FORMAT = {
146
221
  rbxl: "application/octet-stream",
147
222
  rbxlx: "application/xml"
@@ -190,8 +265,7 @@ function validateBody(body, format) {
190
265
  if (body.length === 0) return new ValidationError("Place body is empty", { code: "empty_body" });
191
266
  if (!matchesSignature(body, format === "rbxl" ? RBXL_SIGNATURE : RBXLX_SIGNATURE)) return new ValidationError(`Place body does not match the declared "${format}" format`, { code: "format_mismatch" });
192
267
  }
193
- //#endregion
194
- //#region src/domains/universes/places/operations.ts
268
+ // src/domains/universes/places/operations.ts
195
269
  const PUBLISH_PER_MINUTE = 30;
196
270
  /**
197
271
  * Per-second request ceiling for publishing or saving a place version,
@@ -212,8 +286,7 @@ const PUBLISH_OPERATION_LIMIT = Object.freeze({
212
286
  * in the vendored OpenAPI schema.
213
287
  */
214
288
  const PUBLISH_REQUIRED_SCOPES = Object.freeze(["universe-places:write"]);
215
- //#endregion
216
- //#region src/domains/universes/places/parsers.ts
289
+ // src/domains/universes/places/parsers.ts
217
290
  /**
218
291
  * Parses a successful publish-version response into the public
219
292
  * {@link PlaceVersion} shape. The Roblox endpoint sometimes returns the
@@ -266,8 +339,7 @@ function isPlaceVersionWire(value) {
266
339
  if (!isRecord(value)) return false;
267
340
  return typeof value["versionNumber"] === "number";
268
341
  }
269
- //#endregion
270
- //#region src/resources/places/client.ts
342
+ // src/resources/places/client.ts
271
343
  function makePublishSpec(versionType) {
272
344
  return Object.freeze({
273
345
  apiKeyOnly: true,
@@ -290,6 +362,16 @@ const GET_PLACE_SPEC = Object.freeze({
290
362
  operationLimit: GET_OPERATION_LIMIT,
291
363
  parse: parsePlaceResponse
292
364
  });
365
+ const LIST_PLACES_SPEC = Object.freeze({
366
+ buildRequest: (parameters) => {
367
+ return okRequest(buildListPlacesRequest(parameters));
368
+ },
369
+ methodDefaults: IDEMPOTENT_METHOD_DEFAULTS,
370
+ methodKind: "idempotent",
371
+ operationLimit: LIST_PLACES_OPERATION_LIMIT,
372
+ parse: parsePlacesListResponse,
373
+ unauthenticatedBaseUrl: LIST_PLACES_BASE_URL
374
+ });
293
375
  const UPDATE_SPEC = Object.freeze({
294
376
  buildRequest: buildUpdateRequest,
295
377
  methodDefaults: {},
@@ -358,6 +440,31 @@ var PlacesClient = class {
358
440
  });
359
441
  }
360
442
  /**
443
+ * Lists one page of the places of a universe. Omit `pageToken` for the
444
+ * first page, then pass the returned `nextPageToken` until it is
445
+ * undefined. An unknown universe yields an empty page.
446
+ *
447
+ * The read is unauthenticated: it sends no credential and is served from
448
+ * `https://develop.roblox.com`, so the client `baseUrl` does not apply.
449
+ * `pageSize` accepts only 10, 25, 50 or 100 and defaults to 10.
450
+ * Roblox allows 10000 reads per caller in a fixed 60-second window. A 429
451
+ * waits until the reported `x-ratelimit-reset` before it retries.
452
+ *
453
+ * @since 0.5.0
454
+ * @param parameters - Universe ID and optional pagination fields.
455
+ * @param options - Optional per-request overrides.
456
+ * @returns A {@link Result} wrapping the page of {@link PlaceSummary}
457
+ * items, or the {@link OpenCloudError} that caused the request to fail.
458
+ */
459
+ async list(parameters, options) {
460
+ return this.#inner.executeAsync({
461
+ options,
462
+ parameters,
463
+ refineError: waitForQuotaReset,
464
+ spec: LIST_PLACES_SPEC
465
+ });
466
+ }
467
+ /**
361
468
  * Publishes a new live version of a place.
362
469
  *
363
470
  * No default request timeout applies to this upload; pass `options.timeout`
@@ -462,7 +569,6 @@ function createLuauExecutionHandle(inner) {
462
569
  }
463
570
  };
464
571
  }
465
- //#endregion
466
572
  export { PlacesClient };
467
573
 
468
574
  //# sourceMappingURL=places.mjs.map