@bedrock-rbx/ocale 0.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/badges.d.mts +186 -0
- package/dist/badges.d.mts.map +1 -0
- package/dist/badges.mjs +309 -0
- package/dist/badges.mjs.map +1 -0
- package/dist/developer-products.d.mts +245 -0
- package/dist/developer-products.d.mts.map +1 -0
- package/dist/developer-products.mjs +388 -0
- package/dist/developer-products.mjs.map +1 -0
- package/dist/game-passes.d.mts +210 -0
- package/dist/game-passes.d.mts.map +1 -0
- package/dist/game-passes.mjs +397 -0
- package/dist/game-passes.mjs.map +1 -0
- package/dist/index.d.mts +191 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/places.d.mts +161 -0
- package/dist/places.d.mts.map +1 -0
- package/dist/places.mjs +403 -0
- package/dist/places.mjs.map +1 -0
- package/dist/price-information-CmpscMc4.mjs +42 -0
- package/dist/price-information-CmpscMc4.mjs.map +1 -0
- package/dist/rate-limit-BBU_4xnZ.mjs +135 -0
- package/dist/rate-limit-BBU_4xnZ.mjs.map +1 -0
- package/dist/resource-client-CaS_j3yg.mjs +652 -0
- package/dist/resource-client-CaS_j3yg.mjs.map +1 -0
- package/dist/to-blob-1BtHsDGK.mjs +18 -0
- package/dist/to-blob-1BtHsDGK.mjs.map +1 -0
- package/dist/types-YCTsM8Qd.d.mts +214 -0
- package/dist/types-YCTsM8Qd.d.mts.map +1 -0
- package/dist/universes.d.mts +387 -0
- package/dist/universes.d.mts.map +1 -0
- package/dist/universes.mjs +705 -0
- package/dist/universes.mjs.map +1 -0
- package/dist/validation-CTZzJhmd.mjs +38 -0
- package/dist/validation-CTZzJhmd.mjs.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"game-passes.mjs","names":["#inner"],"sources":["../src/domains/game-passes/game-passes/builders.ts","../src/domains/game-passes/game-passes/operations.ts","../src/domains/game-passes/game-passes/parsers.ts","../src/resources/game-passes/client.ts"],"sourcesContent":["import type { HttpRequest } from \"../../../internal/http/types.ts\";\nimport { toBlob } from \"../../../internal/utils/to-blob.ts\";\nimport type {\n\tCreateGamePassParameters,\n\tGetGamePassParameters,\n\tListGamePassesParameters,\n\tUpdateGamePassParameters,\n} from \"./types.ts\";\n\n/**\n * Builds a `GET` request for the Open Cloud \"read game pass\" endpoint.\n *\n * @param parameters - Universe and game pass identifiers to interpolate into\n * the URL.\n * @returns A pure {@link HttpRequest} describing the read call.\n */\nexport function buildGetRequest(parameters: GetGamePassParameters): HttpRequest {\n\treturn {\n\t\tmethod: \"GET\",\n\t\turl: `/game-passes/v1/universes/${parameters.universeId}/game-passes/${parameters.gamePassId}/creator`,\n\t};\n}\n\n/**\n * Builds a `GET` request for the Open Cloud \"list game passes\" endpoint.\n * Optional `pageSize` and `pageToken` are appended to the query string only\n * when defined so the server applies its own defaults for omitted fields.\n *\n * @param parameters - Universe identifier plus optional pagination cursors.\n * @returns A pure {@link HttpRequest} describing the list call.\n */\nexport function buildListRequest(parameters: ListGamePassesParameters): HttpRequest {\n\tconst query = new URLSearchParams();\n\tif (parameters.pageSize !== undefined) {\n\t\tquery.append(\"pageSize\", String(parameters.pageSize));\n\t}\n\n\tif (parameters.pageToken !== undefined) {\n\t\tquery.append(\"pageToken\", parameters.pageToken);\n\t}\n\n\tconst queryString = query.toString();\n\tconst base = `/game-passes/v1/universes/${parameters.universeId}/game-passes/creator`;\n\treturn {\n\t\tmethod: \"GET\",\n\t\turl: queryString === \"\" ? base : `${base}?${queryString}`,\n\t};\n}\n\n/**\n * Builds a `POST` request for the Open Cloud \"create game pass\" endpoint.\n *\n * @param parameters - Fields describing the new game pass; optional values\n * omitted here are left off the multipart payload entirely.\n * @returns A pure {@link HttpRequest} describing the create call.\n */\nexport function buildCreateRequest(parameters: CreateGamePassParameters): HttpRequest {\n\tconst body = new FormData();\n\tbody.append(\"name\", parameters.name);\n\tif (parameters.description !== undefined) {\n\t\tbody.append(\"description\", parameters.description);\n\t}\n\n\tif (parameters.isForSale !== undefined) {\n\t\tbody.append(\"isForSale\", String(parameters.isForSale));\n\t}\n\n\tif (parameters.price !== undefined) {\n\t\tbody.append(\"price\", String(parameters.price));\n\t}\n\n\tif (parameters.isRegionalPricingEnabled !== undefined) {\n\t\tbody.append(\"isRegionalPricingEnabled\", String(parameters.isRegionalPricingEnabled));\n\t}\n\n\tif (parameters.imageFile !== undefined) {\n\t\tbody.append(\"imageFile\", toBlob(parameters.imageFile));\n\t}\n\n\treturn {\n\t\tbody,\n\t\tmethod: \"POST\",\n\t\turl: `/game-passes/v1/universes/${parameters.universeId}/game-passes`,\n\t};\n}\n\n/**\n * Builds a `PATCH` request for the Open Cloud \"update game pass\" endpoint.\n * Every field on `parameters` except the identifiers is optional;\n * omitted fields are not appended to the multipart body so the server\n * leaves their current values unchanged.\n *\n * The public parameter `imageFile` is mapped to the wire's `file`\n * multipart field name, matching the OpenAPI schema for this endpoint\n * (the create endpoint uses `imageFile`, but the update endpoint uses\n * `file`). Public consumers stay with one ergonomic name across both\n * methods.\n *\n * @param parameters - Identifiers plus fields to update.\n * @returns A pure {@link HttpRequest} describing the update call.\n */\nexport function buildUpdateRequest(parameters: UpdateGamePassParameters): HttpRequest {\n\tconst body = new FormData();\n\tif (parameters.name !== undefined) {\n\t\tbody.append(\"name\", parameters.name);\n\t}\n\n\tif (parameters.description !== undefined) {\n\t\tbody.append(\"description\", parameters.description);\n\t}\n\n\tif (parameters.isForSale !== undefined) {\n\t\tbody.append(\"isForSale\", String(parameters.isForSale));\n\t}\n\n\tif (parameters.price !== undefined) {\n\t\tbody.append(\"price\", String(parameters.price));\n\t}\n\n\tif (parameters.isRegionalPricingEnabled !== undefined) {\n\t\tbody.append(\"isRegionalPricingEnabled\", String(parameters.isRegionalPricingEnabled));\n\t}\n\n\tif (parameters.imageFile !== undefined) {\n\t\tbody.append(\"file\", toBlob(parameters.imageFile));\n\t}\n\n\treturn {\n\t\tbody,\n\t\tmethod: \"PATCH\",\n\t\turl: `/game-passes/v1/universes/${parameters.universeId}/game-passes/${parameters.gamePassId}`,\n\t};\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\n/**\n * Per-second request ceiling for reading a single game pass, from the\n * Open Cloud OpenAPI schema.\n */\nexport const GET_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: 10,\n\toperationKey: \"game-passes.get\",\n});\n\n/**\n * Per-second request ceiling for creating a game pass, from the Open\n * Cloud OpenAPI schema.\n */\nexport const CREATE_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: 5,\n\toperationKey: \"game-passes.create\",\n});\n\n/**\n * Per-second request ceiling for updating a game pass, from the Open\n * Cloud OpenAPI schema. Keyed independently from\n * {@link CREATE_OPERATION_LIMIT} so create and update do not share a\n * queue, since the schema does not document the per-second quota as\n * shared between the POST and PATCH endpoints.\n */\nexport const UPDATE_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: 5,\n\toperationKey: \"game-passes.update\",\n});\n\n/**\n * Per-second request ceiling for listing game passes for a universe,\n * from the Open Cloud OpenAPI schema.\n */\nexport const LIST_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: 10,\n\toperationKey: \"game-passes.list\",\n});\n\n/**\n * Scopes required to read a game pass, sourced from `x-roblox-scopes`\n * on the `GamePasses_GetGamePassConfig` operation in the vendored\n * OpenAPI schema.\n */\nexport const GET_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\"game-pass:read\"]);\n\n/**\n * Scopes required to create a game pass, sourced from `x-roblox-scopes`\n * on the `GamePasses_CreateGamePass` operation in the vendored OpenAPI\n * schema.\n */\nexport const CREATE_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\"game-pass:write\"]);\n\n/**\n * Scopes required to update a game pass, sourced from `x-roblox-scopes`\n * on the `GamePasses_UpdateGamePass` operation in the vendored OpenAPI\n * schema.\n */\nexport const UPDATE_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\"game-pass:write\"]);\n\n/**\n * Scopes required to list game passes for a universe, sourced from\n * `x-roblox-scopes` on the `GamePasses_ListGamePassConfigsByUniverse`\n * operation in the vendored OpenAPI schema.\n */\nexport const LIST_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\"game-pass:read\"]);\n","import type { HttpResponse } from \"../../../client/types.ts\";\nimport { ApiError } from \"../../../errors/api-error.ts\";\nimport {\n\tcopyPriceInformation,\n\tisPriceInformationLike,\n} from \"../../../internal/price-information.ts\";\nimport { isRecord } from \"../../../internal/utils/is-record.ts\";\nimport type { Page, Result } from \"../../../types.ts\";\nimport type { GamePass } from \"./types.ts\";\nimport type {\n\tGamePassConfigV2,\n\tListGamePassConfigsByUniverseResponseWire,\n\tPricingFeatureWire,\n} from \"./wire.ts\";\n\n/**\n * Parses a successful Game Pass API response into the public `GamePass`\n * shape, returning a `Result` so callers can handle malformed payloads\n * without exceptions.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * The status code is included on the returned `ApiError` when validation\n * fails; the headers are available for future parsers that need them.\n * @returns A success result wrapping the converted `GamePass`, or an\n * `ApiError` when the body does not match the wire schema.\n */\nexport function parseGamePassResponse(response: HttpResponse): Result<GamePass, ApiError> {\n\tconst { body, status: statusCode } = response;\n\n\tif (!isGamePassConfigV2(body)) {\n\t\treturn {\n\t\t\terr: new ApiError(\"Malformed game pass response\", { statusCode }),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\treturn { data: toGamePass(body), success: true };\n}\n\n/**\n * Parses a successful \"list game passes\" response into a public\n * {@link Page} of {@link GamePass}, returning a `Result` so callers can\n * handle malformed payloads without exceptions. JSON `null` or a missing\n * `nextPageToken` is normalized to `undefined`.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * @returns A success result wrapping the converted page, or an\n * `ApiError` when the body does not match the wire schema.\n */\nexport function parseGamePassesListResponse(\n\tresponse: HttpResponse,\n): Result<Page<GamePass>, ApiError> {\n\tconst { body, status: statusCode } = response;\n\n\tif (!isListResponseWire(body)) {\n\t\treturn {\n\t\t\terr: new ApiError(\"Malformed game passes list response\", { statusCode }),\n\t\t\tsuccess: false,\n\t\t};\n\t}\n\n\treturn {\n\t\tdata: {\n\t\t\titems: body.gamePasses.map(toGamePass),\n\t\t\tnextPageToken: body.nextPageToken ?? undefined,\n\t\t},\n\t\tsuccess: true,\n\t};\n}\n\nfunction toGamePass(wire: GamePassConfigV2): GamePass {\n\tconst priceWire = wire.priceInformation ?? undefined;\n\treturn {\n\t\tid: String(wire.gamePassId),\n\t\tname: wire.name,\n\t\tcreatedAt: new Date(wire.createdTimestamp),\n\t\tdescription: wire.description,\n\t\ticonAssetId: wire.iconAssetId === 0 ? undefined : String(wire.iconAssetId),\n\t\tisForSale: wire.isForSale,\n\t\tprice: priceWire === undefined ? undefined : copyPriceInformation(priceWire),\n\t\tupdatedAt: new Date(wire.updatedTimestamp),\n\t};\n}\n\nfunction hasRequiredPrimitiveFields(body: Record<string, unknown>): boolean {\n\treturn (\n\t\ttypeof body[\"gamePassId\"] === \"number\" &&\n\t\ttypeof body[\"name\"] === \"string\" &&\n\t\ttypeof body[\"description\"] === \"string\" &&\n\t\ttypeof body[\"isForSale\"] === \"boolean\" &&\n\t\ttypeof body[\"iconAssetId\"] === \"number\" &&\n\t\ttypeof body[\"createdTimestamp\"] === \"string\" &&\n\t\ttypeof body[\"updatedTimestamp\"] === \"string\"\n\t);\n}\n\nfunction isPricingFeatureWire(value: unknown): value is PricingFeatureWire {\n\treturn (\n\t\tvalue === \"Invalid\" ||\n\t\tvalue === \"PriceOptimization\" ||\n\t\tvalue === \"RegionalPricing\" ||\n\t\tvalue === \"UserFixedPrice\"\n\t);\n}\n\nfunction isGamePassConfigV2(body: unknown): body is GamePassConfigV2 {\n\tif (!isRecord(body)) {\n\t\treturn false;\n\t}\n\n\tif (!hasRequiredPrimitiveFields(body)) {\n\t\treturn false;\n\t}\n\n\tconst price = body[\"priceInformation\"] ?? undefined;\n\tif (price !== undefined && !isPriceInformationLike(price, isPricingFeatureWire)) {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\nfunction isListResponseWire(body: unknown): body is ListGamePassConfigsByUniverseResponseWire {\n\tif (!isRecord(body)) {\n\t\treturn false;\n\t}\n\n\tconst { gamePasses } = body;\n\tif (!Array.isArray(gamePasses)) {\n\t\treturn false;\n\t}\n\n\tfor (const item of gamePasses) {\n\t\tif (!isGamePassConfigV2(item)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tconst nextPageToken = body[\"nextPageToken\"] ?? undefined;\n\tif (nextPageToken !== undefined && typeof nextPageToken !== \"string\") {\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n","import type { OpenCloudClientOptions, RequestOptions } from \"../../client/types.ts\";\nimport {\n\tbuildCreateRequest,\n\tbuildGetRequest,\n\tbuildListRequest,\n\tbuildUpdateRequest,\n} from \"../../domains/game-passes/game-passes/builders.ts\";\nimport {\n\tCREATE_OPERATION_LIMIT,\n\tCREATE_REQUIRED_SCOPES,\n\tGET_OPERATION_LIMIT,\n\tGET_REQUIRED_SCOPES,\n\tLIST_OPERATION_LIMIT,\n\tLIST_REQUIRED_SCOPES,\n\tUPDATE_OPERATION_LIMIT,\n\tUPDATE_REQUIRED_SCOPES,\n} from \"../../domains/game-passes/game-passes/operations.ts\";\nimport {\n\tparseGamePassesListResponse,\n\tparseGamePassResponse,\n} from \"../../domains/game-passes/game-passes/parsers.ts\";\nimport type {\n\tCreateGamePassParameters,\n\tGamePass,\n\tGetGamePassParameters,\n\tListGamePassesParameters,\n\tUpdateGamePassParameters,\n} from \"../../domains/game-passes/game-passes/types.ts\";\nimport type { OpenCloudError } from \"../../errors/base.ts\";\nimport { CREATE_METHOD_DEFAULTS, IDEMPOTENT_METHOD_DEFAULTS } from \"../../internal/http/retry.ts\";\nimport {\n\tokRequest,\n\tparseEmptyResponse,\n\tResourceClient,\n\ttype ResourceMethodSpec,\n} from \"../../internal/resource-client.ts\";\nimport type { Page, Result } from \"../../types.ts\";\n\nfunction makeSpec<P, R>(spec: ResourceMethodSpec<P, R>): ResourceMethodSpec<P, R> {\n\treturn Object.freeze(spec);\n}\n\nconst CREATE_SPEC = makeSpec<CreateGamePassParameters, GamePass>({\n\tbuildRequest: (parameters) => okRequest(buildCreateRequest(parameters)),\n\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\tmethodKind: \"create\",\n\toperationLimit: CREATE_OPERATION_LIMIT,\n\tparse: parseGamePassResponse,\n\trequiredScopes: CREATE_REQUIRED_SCOPES,\n});\n\nconst GET_SPEC = makeSpec<GetGamePassParameters, GamePass>({\n\tbuildRequest: (parameters) => okRequest(buildGetRequest(parameters)),\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: GET_OPERATION_LIMIT,\n\tparse: parseGamePassResponse,\n\trequiredScopes: GET_REQUIRED_SCOPES,\n});\n\nconst UPDATE_SPEC = makeSpec<UpdateGamePassParameters, undefined>({\n\tbuildRequest: (parameters) => okRequest(buildUpdateRequest(parameters)),\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: UPDATE_OPERATION_LIMIT,\n\tparse: parseEmptyResponse,\n\trequiredScopes: UPDATE_REQUIRED_SCOPES,\n});\n\nconst LIST_SPEC = makeSpec<ListGamePassesParameters, Page<GamePass>>({\n\tbuildRequest: (parameters) => okRequest(buildListRequest(parameters)),\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: LIST_OPERATION_LIMIT,\n\tparse: parseGamePassesListResponse,\n\trequiredScopes: LIST_REQUIRED_SCOPES,\n});\n\n/**\n * Public client for the Roblox Open Cloud Game Passes API.\n *\n * Wires request builders, the injected {@link OpenCloudClientOptions.httpClient}, and response\n * parsers into a single ergonomic surface. Every method returns a\n * {@link Result} so callers handle failure explicitly; no thrown\n * `OpenCloudError` ever escapes the client.\n *\n * ```ts\n * import { GamePassesClient } from \"@bedrock-rbx/ocale/game-passes\";\n *\n * const client = new GamePassesClient({ apiKey: process.env.ROBLOX_API_KEY! });\n *\n * const result = await client.get({\n * universeId: \"1234567890\",\n * gamePassId: \"9876543210\",\n * });\n *\n * if (result.success) {\n * console.log(`${result.data.name} (${result.data.id})`);\n * } else {\n * console.error(result.err.message);\n * }\n * ```\n *\n * Listing is cursor-paginated; drive the loop on `nextPageToken`:\n *\n * ```ts\n * let pageToken: string | undefined;\n * do {\n * const page = await client.list({ universeId: \"1234567890\", pageToken });\n * if (!page.success) {\n * console.error(page.err.message);\n * break;\n * }\n *\n * for (const pass of page.data.items) {\n * console.log(`${pass.name} (${pass.id})`);\n * }\n *\n * pageToken = page.data.nextPageToken;\n * } while (pageToken !== undefined);\n * ```\n */\nexport class GamePassesClient {\n\treadonly #inner: ResourceClient;\n\n\t/**\n\t * Creates a new {@link GamePassesClient}. Configuration is frozen on\n\t * construction; per-request overrides are accepted on each 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}\n\n\t/**\n\t * Creates a new game pass under the supplied universe.\n\t *\n\t * @param parameters - Creation fields including the universe and pass name.\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping the parsed {@link GamePass} or the\n\t * {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async create(\n\t\tparameters: CreateGamePassParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<GamePass, OpenCloudError>> {\n\t\treturn this.#inner.execute({ options, parameters, spec: CREATE_SPEC });\n\t}\n\n\t/**\n\t * Reads a single game pass by ID.\n\t *\n\t * @param parameters - Universe and game pass identifiers.\n\t * @param options - Optional per-request overrides (e.g. A different\n\t * {@link OpenCloudClientOptions.apiKey} for this call only).\n\t * @returns A {@link Result} wrapping the parsed {@link GamePass} or the\n\t * {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async get(\n\t\tparameters: GetGamePassParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<GamePass, OpenCloudError>> {\n\t\treturn this.#inner.execute({ options, parameters, spec: GET_SPEC });\n\t}\n\n\t/**\n\t * Lists one page of game passes for the supplied universe. Pagination is\n\t * cursor-based: omit `pageToken` for the first page, then thread the\n\t * previous response's `nextPageToken` back in until it is `undefined`.\n\t *\n\t * @param parameters - Universe identifier and optional page cursors.\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping a {@link Page} of {@link GamePass},\n\t * or the {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async list(\n\t\tparameters: ListGamePassesParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<Page<GamePass>, OpenCloudError>> {\n\t\treturn this.#inner.execute({ options, parameters, spec: LIST_SPEC });\n\t}\n\n\t/**\n\t * Partially updates an existing game pass. Mirrors the upstream\n\t * `204 No Content` response: a successful update yields `undefined`\n\t * data. Callers that need the post-update state (for example to\n\t * observe a server-derived `updatedAt`) chain\n\t * {@link GamePassesClient.get} themselves so the GET only fires when\n\t * actually needed.\n\t *\n\t * @param parameters - The universe and game pass identifiers and the\n\t * fields to update. Only fields explicitly provided are forwarded.\n\t * @param options - Optional per-request overrides.\n\t * @returns A success {@link Result} with no payload, or the\n\t * {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async update(\n\t\tparameters: UpdateGamePassParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<undefined, OpenCloudError>> {\n\t\treturn this.#inner.execute({ options, parameters, spec: UPDATE_SPEC });\n\t}\n}\n"],"mappings":";;;;;;;;;;;;AAgBA,SAAgB,gBAAgB,YAAgD;AAC/E,QAAO;EACN,QAAQ;EACR,KAAK,6BAA6B,WAAW,WAAW,eAAe,WAAW,WAAW;EAC7F;;;;;;;;;;AA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;;CAapE,MAAa,KACZ,YACA,SACkD;AAClD,SAAO,MAAA,MAAY,QAAQ;GAAE;GAAS;GAAY,MAAM;GAAW,CAAC;;;;;;;;;;;;;;;;CAiBrE,MAAa,OACZ,YACA,SAC6C;AAC7C,SAAO,MAAA,MAAY,QAAQ;GAAE;GAAS;GAAY,MAAM;GAAa,CAAC"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { a as OpenCloudHooks, c as Page, d as OpenCloudError, i as OpenCloudClientOptions, l as Result, n as HttpRequest, o as RequestConfig, r as HttpResponse, s as RequestOptions, t as HttpClient, u as SleepFunc } from "./types-YCTsM8Qd.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/errors/api-error.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Options for constructing an {@link ApiError}.
|
|
6
|
+
*/
|
|
7
|
+
interface ApiErrorOptions extends ErrorOptions {
|
|
8
|
+
/** Optional machine-readable error code from the API. */
|
|
9
|
+
code?: string | undefined;
|
|
10
|
+
/** HTTP status code from the API response. */
|
|
11
|
+
statusCode: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Thrown when the Roblox Open Cloud API returns a non-2xx response
|
|
15
|
+
* that is not a rate limit (429).
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { ApiError } from "@bedrock-rbx/ocale";
|
|
21
|
+
*
|
|
22
|
+
* const error = new ApiError("Game pass not found", {
|
|
23
|
+
* code: "NotFound",
|
|
24
|
+
* statusCode: 404,
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* expect(error).toBeInstanceOf(ApiError);
|
|
28
|
+
* expect(error.statusCode).toBe(404);
|
|
29
|
+
* expect(error.code).toBe("NotFound");
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
declare class ApiError extends OpenCloudError {
|
|
33
|
+
readonly code: string | undefined;
|
|
34
|
+
override readonly name: string;
|
|
35
|
+
readonly statusCode: number;
|
|
36
|
+
/**
|
|
37
|
+
* Creates a new ApiError.
|
|
38
|
+
*
|
|
39
|
+
* @param message - Human-readable error description.
|
|
40
|
+
* @param options - Error options including status code and optional error code.
|
|
41
|
+
*/
|
|
42
|
+
constructor(message: string, options: ApiErrorOptions);
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/errors/network-error.d.ts
|
|
46
|
+
/**
|
|
47
|
+
* Thrown when a network-level failure prevents the request from reaching
|
|
48
|
+
* the Roblox Open Cloud API (e.g., DNS resolution failure, connection timeout).
|
|
49
|
+
*/
|
|
50
|
+
declare class NetworkError extends OpenCloudError {
|
|
51
|
+
override readonly name: string;
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/errors/permission-error.d.ts
|
|
55
|
+
/**
|
|
56
|
+
* Options for constructing a {@link PermissionError}.
|
|
57
|
+
*/
|
|
58
|
+
interface PermissionErrorOptions extends ApiErrorOptions {
|
|
59
|
+
/**
|
|
60
|
+
* Stable identifier of the Open Cloud operation that returned the
|
|
61
|
+
* permission failure (matches `OperationLimit.operationKey`, e.g.
|
|
62
|
+
* `"developer-products.create"`).
|
|
63
|
+
*/
|
|
64
|
+
operationKey: string;
|
|
65
|
+
/**
|
|
66
|
+
* Scope strings the API key or OAuth token must carry for the failing
|
|
67
|
+
* operation, sourced from the vendored OpenAPI schema's `x-roblox-scopes`
|
|
68
|
+
* for that operationId.
|
|
69
|
+
*/
|
|
70
|
+
requiredScopes: ReadonlyArray<string>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Thrown when the Roblox Open Cloud API returns a 401 or 403 for an operation
|
|
74
|
+
* whose required scopes are known. Subclass of {@link ApiError} carrying the
|
|
75
|
+
* scope strings the caller's credential is missing plus the operation key, so
|
|
76
|
+
* a CLI consumer can tell the user exactly which scope to grant on their API
|
|
77
|
+
* key.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
*
|
|
81
|
+
* ```ts
|
|
82
|
+
* import { PermissionError } from "@bedrock-rbx/ocale";
|
|
83
|
+
*
|
|
84
|
+
* const error = new PermissionError("HTTP 403", {
|
|
85
|
+
* operationKey: "developer-products.create",
|
|
86
|
+
* requiredScopes: ["creator-store-product:write"],
|
|
87
|
+
* statusCode: 403,
|
|
88
|
+
* });
|
|
89
|
+
*
|
|
90
|
+
* expect(error).toBeInstanceOf(PermissionError);
|
|
91
|
+
* expect(error.requiredScopes).toStrictEqual(["creator-store-product:write"]);
|
|
92
|
+
* expect(error.operationKey).toBe("developer-products.create");
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
declare class PermissionError extends ApiError {
|
|
96
|
+
override readonly name: string;
|
|
97
|
+
readonly operationKey: string;
|
|
98
|
+
readonly requiredScopes: ReadonlyArray<string>;
|
|
99
|
+
/**
|
|
100
|
+
* Creates a new PermissionError.
|
|
101
|
+
*
|
|
102
|
+
* @param message - Human-readable error description.
|
|
103
|
+
* @param options - Error options including status code, the operation key,
|
|
104
|
+
* and the scopes the caller's credential must carry.
|
|
105
|
+
*/
|
|
106
|
+
constructor(message: string, options: PermissionErrorOptions);
|
|
107
|
+
}
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region src/errors/rate-limit.d.ts
|
|
110
|
+
/**
|
|
111
|
+
* Options for constructing a {@link RateLimitError}.
|
|
112
|
+
*/
|
|
113
|
+
interface RateLimitErrorOptions extends ErrorOptions {
|
|
114
|
+
/** Seconds to wait before retrying the request. */
|
|
115
|
+
retryAfterSeconds: number;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Thrown when the Roblox Open Cloud API returns a 429 Too Many Requests response.
|
|
119
|
+
* Contains the server-suggested retry delay.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
*
|
|
123
|
+
* ```ts
|
|
124
|
+
* import { RateLimitError } from "@bedrock-rbx/ocale";
|
|
125
|
+
*
|
|
126
|
+
* const error = new RateLimitError("Too many requests", {
|
|
127
|
+
* retryAfterSeconds: 30,
|
|
128
|
+
* });
|
|
129
|
+
*
|
|
130
|
+
* expect(error).toBeInstanceOf(RateLimitError);
|
|
131
|
+
* expect(error.retryAfterSeconds).toBe(30);
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
declare class RateLimitError extends OpenCloudError {
|
|
135
|
+
override readonly name = "RateLimitError";
|
|
136
|
+
readonly retryAfterSeconds: number;
|
|
137
|
+
/**
|
|
138
|
+
* Creates a new RateLimitError.
|
|
139
|
+
*
|
|
140
|
+
* @param message - Human-readable error description.
|
|
141
|
+
* @param options - Error options including the retry delay.
|
|
142
|
+
*/
|
|
143
|
+
constructor(message: string, options: RateLimitErrorOptions);
|
|
144
|
+
}
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region src/errors/validation.d.ts
|
|
147
|
+
/**
|
|
148
|
+
* Closed discriminator for a {@link ValidationError}. Consumers can
|
|
149
|
+
* exhaustively `switch` over this union so TypeScript will refuse to compile
|
|
150
|
+
* if a new variant is added without a handler.
|
|
151
|
+
*/
|
|
152
|
+
type ValidationErrorCode = "empty_body" | "empty_image_ids" | "empty_update" | "format_mismatch" | "invalid_image_id";
|
|
153
|
+
/**
|
|
154
|
+
* Options for constructing a {@link ValidationError}.
|
|
155
|
+
*/
|
|
156
|
+
interface ValidationErrorOptions extends ErrorOptions {
|
|
157
|
+
/** Machine-readable discriminator identifying the validation failure. */
|
|
158
|
+
code: ValidationErrorCode;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Thrown locally when caller-supplied input is rejected before any HTTP
|
|
162
|
+
* round-trip. The `code` discriminator lets consumers branch on local-input
|
|
163
|
+
* errors separately from server-side errors.
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
*
|
|
167
|
+
* ```ts
|
|
168
|
+
* import { ValidationError } from "@bedrock-rbx/ocale";
|
|
169
|
+
*
|
|
170
|
+
* const error = new ValidationError("Place body is empty", {
|
|
171
|
+
* code: "empty_body",
|
|
172
|
+
* });
|
|
173
|
+
*
|
|
174
|
+
* expect(error).toBeInstanceOf(ValidationError);
|
|
175
|
+
* expect(error.code).toBe("empty_body");
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
declare class ValidationError extends OpenCloudError {
|
|
179
|
+
readonly code: ValidationErrorCode;
|
|
180
|
+
override readonly name: string;
|
|
181
|
+
/**
|
|
182
|
+
* Creates a new ValidationError.
|
|
183
|
+
*
|
|
184
|
+
* @param message - Human-readable error description.
|
|
185
|
+
* @param options - Error options including the validation failure code.
|
|
186
|
+
*/
|
|
187
|
+
constructor(message: string, options: ValidationErrorOptions);
|
|
188
|
+
}
|
|
189
|
+
//#endregion
|
|
190
|
+
export { ApiError, type ApiErrorOptions, type HttpClient, type HttpRequest, type HttpResponse, NetworkError, type OpenCloudClientOptions, OpenCloudError, type OpenCloudHooks, type Page, PermissionError, type PermissionErrorOptions, RateLimitError, type RateLimitErrorOptions, type RequestConfig, type RequestOptions, type Result, type SleepFunc, ValidationError, type ValidationErrorCode, type ValidationErrorOptions };
|
|
191
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/errors/api-error.ts","../src/errors/network-error.ts","../src/errors/permission-error.ts","../src/errors/rate-limit.ts","../src/errors/validation.ts"],"mappings":";;;;;AAKA;UAAiB,eAAA,SAAwB,YAAA;;EAExC,IAAA;;EAEA,UAAA;AAAA;;;AAsBD;;;;;;;;;;;;;;;;;cAAa,QAAA,SAAiB,cAAA;EAAA,SACb,IAAA;EAAA,kBACS,IAAA;EAAA,SACT,UAAA;EC3BS;;;;ACF1B;;EFqCC,WAAA,CAAY,OAAA,UAAiB,OAAA,EAAS,eAAA;AAAA;;;;;AArCvC;;cCCa,YAAA,SAAqB,cAAA;EAAA,kBACR,IAAA;AAAA;;;;;ADF1B;UEAiB,sBAAA,SAA+B,eAAA;;;;;;EAM/C,YAAA;EFFA;AAsBD;;;;EEdC,cAAA,EAAgB,aAAA;AAAA;;;;;;;;;;;;ADXjB;;;;;;;;ACDA;;;;cAsCa,eAAA,SAAwB,QAAA;EAAA,kBACX,IAAA;EAAA,SACT,YAAA;EAAA,SACA,cAAA,EAAgB,aAAA;;;AAHjC;;;;;EAYC,WAAA,CAAY,OAAA,UAAiB,OAAA,EAAS,sBAAA;AAAA;;;;;AFlDvC;UGAiB,qBAAA,SAA8B,YAAA;;EAE9C,iBAAA;AAAA;;;;;AHwBD;;;;;;;;;;;;;cGJa,cAAA,SAAuB,cAAA;EAAA,kBACV,IAAA;EAAA,SACT,iBAAA;;AFvBjB;;;;;EE+BC,WAAA,CAAY,OAAA,UAAiB,OAAA,EAAS,qBAAA;AAAA;;;;;AHhCvC;;;KIEY,mBAAA;;;;UAUK,sBAAA,SAA+B,YAAA;EJR/C;EIUA,IAAA,EAAM,mBAAA;AAAA;;;;;;;;;;;;;;;;AHbP;;;cGkCa,eAAA,SAAwB,cAAA;EAAA,SACpB,IAAA,EAAM,mBAAA;EAAA,kBACG,IAAA;;;AFrC1B;;;;EE6CC,WAAA,CAAY,OAAA,UAAiB,OAAA,EAAS,sBAAA;AAAA"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as OpenCloudError, i as ApiError, n as PermissionError, r as NetworkError, t as RateLimitError } from "./rate-limit-BBU_4xnZ.mjs";
|
|
2
|
+
import { t as ValidationError } from "./validation-CTZzJhmd.mjs";
|
|
3
|
+
export { ApiError, NetworkError, OpenCloudError, PermissionError, RateLimitError, ValidationError };
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { d as OpenCloudError, i as OpenCloudClientOptions, l as Result, s as RequestOptions } from "./types-YCTsM8Qd.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/domains/cloud-v2/places/types.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Caller-supplied input for the `update` method on `PlacesClient`.
|
|
6
|
+
* Every writable field is optional; presence of a key drives the
|
|
7
|
+
* `updateMask` query string that the server uses as the field-mask
|
|
8
|
+
* for the partial update. Absent keys are left untouched server-side.
|
|
9
|
+
*/
|
|
10
|
+
interface UpdatePlaceParameters {
|
|
11
|
+
/** New description for the place. */
|
|
12
|
+
readonly description?: string;
|
|
13
|
+
/** New display name for the place. */
|
|
14
|
+
readonly displayName?: string;
|
|
15
|
+
/** Stringified ID of the place to update. */
|
|
16
|
+
readonly placeId: string;
|
|
17
|
+
/** New maximum number of allowed users in a single server. */
|
|
18
|
+
readonly serverSize?: number;
|
|
19
|
+
/** Stringified ID of the universe that owns the place. */
|
|
20
|
+
readonly universeId: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Parsed representation of a Roblox place's configuration, as returned
|
|
24
|
+
* by the Open Cloud `Cloud_GetPlace` and `Cloud_UpdatePlace` endpoints.
|
|
25
|
+
*/
|
|
26
|
+
interface Place {
|
|
27
|
+
/** Stringified place ID, extracted from the wire `path`. */
|
|
28
|
+
readonly id: string;
|
|
29
|
+
/** Timestamp when the place was created. */
|
|
30
|
+
readonly createdAt: Date;
|
|
31
|
+
/** Long-form description of the place. */
|
|
32
|
+
readonly description: string;
|
|
33
|
+
/** Human-facing name of the place. */
|
|
34
|
+
readonly displayName: string;
|
|
35
|
+
/** Whether this place is the universe's root place. */
|
|
36
|
+
readonly root: boolean;
|
|
37
|
+
/** Maximum allowed users in a single server; `undefined` when unset. */
|
|
38
|
+
readonly serverSize: number | undefined;
|
|
39
|
+
/** Stringified universe ID, extracted from the wire `path`. */
|
|
40
|
+
readonly universeId: string;
|
|
41
|
+
/** Whether the place was created in-experience. */
|
|
42
|
+
readonly universeRuntimeCreation: boolean;
|
|
43
|
+
/** Timestamp of the most recent update. */
|
|
44
|
+
readonly updatedAt: Date;
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/domains/universes/places/types.d.ts
|
|
48
|
+
/**
|
|
49
|
+
* Caller-supplied input for the `publish` and `save` methods on
|
|
50
|
+
* `PlacesClient`. Both methods take the same parameter shape; which
|
|
51
|
+
* version-type query string is used is decided by the method, not the
|
|
52
|
+
* caller.
|
|
53
|
+
*/
|
|
54
|
+
interface PublishParameters {
|
|
55
|
+
/** Raw `.rbxl` or `.rbxlx` file bytes. Must be non-empty. */
|
|
56
|
+
readonly body: Uint8Array<ArrayBuffer>;
|
|
57
|
+
/**
|
|
58
|
+
* Whether `body` is the binary or XML place format. The transport
|
|
59
|
+
* sends `application/octet-stream` for `"rbxl"` and `application/xml`
|
|
60
|
+
* for `"rbxlx"`, and the builder rejects payloads whose magic bytes
|
|
61
|
+
* disagree with the declared format before any HTTP call.
|
|
62
|
+
*/
|
|
63
|
+
readonly format: "rbxl" | "rbxlx";
|
|
64
|
+
/** Stringified ID of the place inside the universe. */
|
|
65
|
+
readonly placeId: string;
|
|
66
|
+
/** Stringified ID of the universe that owns the place. */
|
|
67
|
+
readonly universeId: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Successful response from publishing or saving a new place version.
|
|
71
|
+
*/
|
|
72
|
+
interface PlaceVersion {
|
|
73
|
+
/**
|
|
74
|
+
* Auto-incrementing version number assigned by Roblox. Always at least
|
|
75
|
+
* `1` for the first publish; increases by one for every subsequent
|
|
76
|
+
* publish or save against the same place.
|
|
77
|
+
*/
|
|
78
|
+
readonly versionNumber: number;
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/resources/places/client.d.ts
|
|
82
|
+
/**
|
|
83
|
+
* Public client for the Roblox Open Cloud `Place` resource. Covers
|
|
84
|
+
* place-version publishing (`publish`, `save`) and place-configuration
|
|
85
|
+
* updates (`update`). Wires the request builders, the injected
|
|
86
|
+
* {@link OpenCloudClientOptions.httpClient}, and the response parsers
|
|
87
|
+
* into a single ergonomic surface. Every method returns a {@link Result}
|
|
88
|
+
* so callers handle failure explicitly; no thrown {@link OpenCloudError}
|
|
89
|
+
* ever escapes the client.
|
|
90
|
+
*
|
|
91
|
+
* Publishing or saving a 5xx-failed place version is not retried
|
|
92
|
+
* automatically: Roblox does not support idempotency keys, so a retry
|
|
93
|
+
* could publish a duplicate version unnoticed. Callers that *can* detect
|
|
94
|
+
* duplicates externally may opt back into 5xx retry per-call by passing
|
|
95
|
+
* `retryableStatuses` on the second argument. The `update` method, by
|
|
96
|
+
* contrast, is idempotent and retries both 429 and 5xx automatically.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
*
|
|
100
|
+
* ```ts
|
|
101
|
+
* import { PlacesClient } from "@bedrock-rbx/ocale/places";
|
|
102
|
+
*
|
|
103
|
+
* const client = new PlacesClient({ apiKey: "your-key" });
|
|
104
|
+
* expect(client).toBeInstanceOf(PlacesClient);
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
declare class PlacesClient {
|
|
108
|
+
#private;
|
|
109
|
+
/**
|
|
110
|
+
* Creates a new {@link PlacesClient}. Configuration is frozen on
|
|
111
|
+
* construction; per-request overrides are accepted on each method.
|
|
112
|
+
*
|
|
113
|
+
* @param options - Client-level configuration including the API key.
|
|
114
|
+
*/
|
|
115
|
+
constructor(options: OpenCloudClientOptions);
|
|
116
|
+
/**
|
|
117
|
+
* Publishes a new live version of a place.
|
|
118
|
+
*
|
|
119
|
+
* @param parameters - Universe and place identifiers, the place file
|
|
120
|
+
* bytes, and their declared `format`.
|
|
121
|
+
* @param options - Optional per-request overrides (e.g. A different
|
|
122
|
+
* {@link OpenCloudClientOptions.apiKey} for this call only).
|
|
123
|
+
* @returns A {@link Result} wrapping the parsed {@link PlaceVersion}
|
|
124
|
+
* or the {@link OpenCloudError} that caused the request to fail.
|
|
125
|
+
*/
|
|
126
|
+
publish(parameters: PublishParameters, options?: RequestOptions): Promise<Result<PlaceVersion, OpenCloudError>>;
|
|
127
|
+
/**
|
|
128
|
+
* Saves a new draft version of a place. Identical to {@link publish}
|
|
129
|
+
* except the resulting version is not made live; consumers can list or
|
|
130
|
+
* promote it later. Shares a single per-API-key rate-limit queue with
|
|
131
|
+
* `publish` because Roblox attributes both calls to the same per-minute
|
|
132
|
+
* quota.
|
|
133
|
+
*
|
|
134
|
+
* @param parameters - Universe and place identifiers, the place file
|
|
135
|
+
* bytes, and their declared `format`.
|
|
136
|
+
* @param options - Optional per-request overrides (e.g. A different
|
|
137
|
+
* {@link OpenCloudClientOptions.apiKey} for this call only).
|
|
138
|
+
* @returns A {@link Result} wrapping the parsed {@link PlaceVersion}
|
|
139
|
+
* or the {@link OpenCloudError} that caused the request to fail.
|
|
140
|
+
*/
|
|
141
|
+
save(parameters: PublishParameters, options?: RequestOptions): Promise<Result<PlaceVersion, OpenCloudError>>;
|
|
142
|
+
/**
|
|
143
|
+
* Partially updates a place's configuration. The fields supplied on
|
|
144
|
+
* `parameters` (excluding the identifiers) are forwarded to the
|
|
145
|
+
* server via a Google-style `updateMask`; unmentioned fields are
|
|
146
|
+
* left untouched. The universe's root place is the canonical place
|
|
147
|
+
* to update when changing a universe's description or display name:
|
|
148
|
+
* both are derived server-side from the root place.
|
|
149
|
+
*
|
|
150
|
+
* @param parameters - The universe and place identifiers and the
|
|
151
|
+
* fields to update. At least one writable field must be supplied.
|
|
152
|
+
* @param options - Optional per-request overrides (e.g. A different
|
|
153
|
+
* {@link OpenCloudClientOptions.apiKey} for this call only).
|
|
154
|
+
* @returns A {@link Result} wrapping the parsed {@link Place} or
|
|
155
|
+
* the {@link OpenCloudError} that caused the request to fail.
|
|
156
|
+
*/
|
|
157
|
+
update(parameters: UpdatePlaceParameters, options?: RequestOptions): Promise<Result<Place, OpenCloudError>>;
|
|
158
|
+
}
|
|
159
|
+
//#endregion
|
|
160
|
+
export { type Place, type PlaceVersion, PlacesClient, type PublishParameters, type UpdatePlaceParameters };
|
|
161
|
+
//# sourceMappingURL=places.d.mts.map
|
|
@@ -0,0 +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":";;;;;;AAMA;;;UAAiB,qBAAA;;WAEP,WAAA;;WAEA,WAAA;;WAEA,OAAA;EAIA;EAAA,SAFA,UAAA;EASO;EAAA,SAPP,UAAA;AAAA;;;;;UAOO,KAAA;;WAEP,EAAA;;WAEA,SAAA,EAAW,IAAA;;WAEX,WAAA;;WAEA,WAAA;;WAEA,IAAA;;WAEA,UAAA;EC7BO;EAAA,SD+BP,UAAA;EC7BM;EAAA,SD+BN,uBAAA;;WAEA,SAAA,EAAW,IAAA;AAAA;;;;;;AAnCrB;;;UCAiB,iBAAA;;WAEP,IAAA,EAAM,UAAA,CAAW,WAAA;;;;;;ADe3B;WCRU,MAAA;;WAEA,OAAA;;WAEA,UAAA;AAAA;;;;UAMO,YAAA;;;;;;WAMP,aAAA;AAAA;;;;;;;;;;;;ADRV;;;;;;;;;;;;;;;;cEgDa,YAAA;EAAA;;;ADjEb;;;;EC0EC,WAAA,CAAY,OAAA,EAAS,sBAAA;;;;;;;;ADvDtB;;;ECqEC,OAAA,CACC,UAAA,EAAY,iBAAA,EACZ,OAAA,GAAU,cAAA,GACR,OAAA,CAAQ,MAAA,CAAO,YAAA,EAAc,cAAA;EDlEvB;;;;ACwCV;;;;;;;;;;EA4CC,IAAA,CACC,UAAA,EAAY,iBAAA,EACZ,OAAA,GAAU,cAAA,GACR,OAAA,CAAQ,MAAA,CAAO,YAAA,EAAc,cAAA;;;;;;;;;;;;;;;;EAmBhC,MAAA,CACC,UAAA,EAAY,qBAAA,EACZ,OAAA,GAAU,cAAA,GACR,OAAA,CAAQ,MAAA,CAAO,KAAA,EAAO,cAAA;AAAA"}
|