{"version":3,"file":"storage.mjs","names":["SECONDS_PER_MINUTE","PATH_PATTERN","makeSpec","#inner","#inner"],"sources":["../src/domains/cloud-v2/memory-store-queues/builders.ts","../src/domains/cloud-v2/memory-store-queues/operations.ts","../src/domains/cloud-v2/memory-store-queues/parsers.ts","../src/resources/storage/queues-group.ts","../src/domains/cloud-v2/memory-store-sorted-maps/builders.ts","../src/domains/cloud-v2/memory-store-sorted-maps/operations.ts","../src/domains/cloud-v2/memory-store-sorted-maps/parsers.ts","../src/resources/storage/sorted-maps-group.ts","../src/resources/storage/client.ts"],"sourcesContent":["import type { HttpRequest } from \"../../../client/types.ts\";\nimport type {\n\tDequeueQueueItemsParameters,\n\tDiscardQueueItemsParameters,\n\tEnqueueQueueItemParameters,\n} from \"./types.ts\";\n\n/**\n * Builds a `POST` request for the Open Cloud\n * `Cloud_CreateMemoryStoreQueueItem` endpoint. Serializes the optional\n * `ttl` field as a Google protobuf `Duration` string in seconds (`\"30s\"`)\n * to match the wire contract.\n *\n * @param parameters - Universe and queue identifiers, the opaque payload,\n *   and optional priority and TTL.\n * @returns A pure {@link HttpRequest} describing the enqueue call.\n */\nexport function buildEnqueueRequest({\n\tdata,\n\tpriority,\n\tqueueId,\n\tttl,\n\tuniverseId,\n}: EnqueueQueueItemParameters): HttpRequest {\n\tconst body: Record<string, unknown> = { data };\n\tif (priority !== undefined) {\n\t\tbody[\"priority\"] = priority;\n\t}\n\n\tif (ttl !== undefined) {\n\t\tbody[\"ttl\"] = `${ttl}s`;\n\t}\n\n\treturn {\n\t\tbody,\n\t\theaders: { \"content-type\": \"application/json\" },\n\t\tmethod: \"POST\",\n\t\turl: `/cloud/v2/universes/${universeId}/memory-store/queues/${queueId}/items`,\n\t};\n}\n\n/**\n * Builds a `GET` request for the Open Cloud\n * `Cloud_ReadMemoryStoreQueueItems` endpoint. The `:read` suffix is a\n * custom-method marker; the call is HTTP `GET` despite the AIP-136\n * convention that custom methods use `POST`. Parameters travel as query\n * string only; there is no request body.\n *\n * `invisibilityWindow` is serialized as a Google protobuf `Duration`\n * string in seconds (`\"30s\"`), matching the wire contract.\n *\n * @param parameters - Universe and queue identifiers, plus optional\n *   `count`, `allOrNothing`, and `invisibilityWindow`.\n * @returns A pure {@link HttpRequest} describing the dequeue call.\n */\nexport function buildDequeueRequest(parameters: DequeueQueueItemsParameters): HttpRequest {\n\tconst query = new URLSearchParams();\n\tif (parameters.count !== undefined) {\n\t\tquery.append(\"count\", String(parameters.count));\n\t}\n\n\tif (parameters.allOrNothing !== undefined) {\n\t\tquery.append(\"allOrNothing\", String(parameters.allOrNothing));\n\t}\n\n\tif (parameters.invisibilityWindow !== undefined) {\n\t\tquery.append(\"invisibilityWindow\", `${parameters.invisibilityWindow}s`);\n\t}\n\n\tconst queryString = query.toString();\n\tconst { queueId, universeId } = parameters;\n\tconst base = `/cloud/v2/universes/${universeId}/memory-store/queues/${queueId}/items:read`;\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\n * `Cloud_DiscardMemoryStoreQueueItems` endpoint. The request body uses\n * `{ readId }`, matching the schema (the dequeue *response* uses `id`,\n * but the discard *request* matches the schema and is not patched).\n *\n * @param parameters - Universe and queue identifiers, plus the\n *   `readId` returned from a prior dequeue.\n * @returns A pure {@link HttpRequest} describing the discard call.\n */\nexport function buildDiscardRequest({\n\tqueueId,\n\treadId,\n\tuniverseId,\n}: DiscardQueueItemsParameters): HttpRequest {\n\treturn {\n\t\tbody: { readId },\n\t\theaders: { \"content-type\": \"application/json\" },\n\t\tmethod: \"POST\",\n\t\turl: `/cloud/v2/universes/${universeId}/memory-store/queues/${queueId}/items:discard`,\n\t};\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\nconst ENQUEUE_PER_MINUTE = 1_000_000;\nconst SECONDS_PER_MINUTE = 60;\n\n/**\n * Per-second request ceiling for enqueueing a memory-store queue item,\n * from the Open Cloud OpenAPI schema (1,000,000 requests per minute per\n * API key owner). Keyed independently from the dequeue and discard\n * operations so the three do not share a queue; upstream quota\n * accounting is documented per-operation, and the conservative default\n * is fewer cross-method contention surprises.\n */\nexport const ENQUEUE_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: ENQUEUE_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"memory-store-queues.enqueue\",\n});\n\n/**\n * Scopes required to enqueue a memory-store queue item, sourced from\n * `x-roblox-scopes` on the `Cloud_CreateMemoryStoreQueueItem` operation\n * in the vendored OpenAPI schema.\n */\nexport const ENQUEUE_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"memory-store.queue:add\",\n]);\n\nconst DEQUEUE_PER_MINUTE = 1_000_000;\n\n/**\n * Per-second request ceiling for dequeueing memory-store queue items,\n * from the Open Cloud OpenAPI schema (1,000,000 requests per minute\n * per API key owner). Keyed independently from enqueue and discard.\n */\nexport const DEQUEUE_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: DEQUEUE_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"memory-store-queues.dequeue\",\n});\n\n/**\n * Scopes required to dequeue memory-store queue items, sourced from\n * `x-roblox-scopes` on the `Cloud_ReadMemoryStoreQueueItems` operation\n * in the vendored OpenAPI schema.\n */\nexport const DEQUEUE_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"memory-store.queue:dequeue\",\n]);\n\nconst DISCARD_PER_MINUTE = 1_000_000;\n\n/**\n * Per-second request ceiling for discarding (acknowledging) memory-store\n * queue items, from the Open Cloud OpenAPI schema (1,000,000 requests\n * per minute per API key owner). Keyed independently from enqueue and\n * dequeue.\n */\nexport const DISCARD_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: DISCARD_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"memory-store-queues.discard\",\n});\n\n/**\n * Scopes required to discard memory-store queue items, sourced from\n * `x-roblox-scopes` on the `Cloud_DiscardMemoryStoreQueueItems`\n * operation in the vendored OpenAPI schema.\n */\nexport const DISCARD_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"memory-store.queue:discard\",\n]);\n","import type { HttpResponse } from \"../../../client/types.ts\";\nimport { ApiError } from \"../../../errors/api-error.ts\";\nimport { isDateTimeString } from \"../../../internal/utils/is-date-time-string.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 { DequeueResult, QueueItem } from \"./types.ts\";\nimport type { MemoryStoreQueueItemWire } from \"./wire.ts\";\n\nconst PATH_PATTERN = /^cloud\\/v2\\/universes\\/(\\d+)\\/memory-store\\/queues\\/([^/]+)\\/items\\/([^/]+)$/;\nconst MALFORMED_QUEUE_ITEM_MESSAGE = \"Malformed memory-store queue item response\";\nconst MALFORMED_DEQUEUE_MESSAGE = \"Malformed memory-store dequeue response\";\n\n/**\n * Parses a successful memory-store queue-item response body (the\n * `Cloud_CreateMemoryStoreQueueItem` happy path) into the public\n * {@link QueueItem} shape.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * @returns A success result wrapping the parsed {@link QueueItem}, or an\n *   {@link ApiError} when the body does not match the wire schema.\n */\nexport function parseQueueItemResponse(response: HttpResponse): Result<QueueItem, ApiError> {\n\tconst item = wireBodyToQueueItem(response.body);\n\tif (item === undefined) {\n\t\treturn malformedQueueItem(response.status, response.body);\n\t}\n\n\treturn { data: item, success: true };\n}\n\n/**\n * Parses a successful `Cloud_ReadMemoryStoreQueueItems` response body\n * into the public {@link DequeueResult} shape. Each item in the\n * `queueItems` array is validated through the same path-and-shape\n * checks as {@link parseQueueItemResponse}; a malformed entry rejects\n * the whole response.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * @returns A success result wrapping the parsed {@link DequeueResult},\n *   or an {@link ApiError} when the response shape is wrong.\n */\nexport function parseDequeueResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<DequeueResult, ApiError> {\n\tif (!isRecord(body)) {\n\t\treturn malformedDequeue(statusCode, body);\n\t}\n\n\tconst { id, queueItems } = body;\n\tif (typeof id !== \"string\") {\n\t\treturn malformedDequeue(statusCode, body);\n\t}\n\n\tif (queueItems !== undefined && queueItems !== null && !Array.isArray(queueItems)) {\n\t\treturn malformedDequeue(statusCode, body);\n\t}\n\n\tconst rawItems = queueItems ?? [];\n\tconst items = rawItems.map(wireBodyToQueueItem);\n\tif (!items.every(isQueueItem)) {\n\t\treturn malformedDequeue(statusCode, body);\n\t}\n\n\treturn { data: { items, readId: id }, success: true };\n}\n\nfunction isQueueItemWire(body: unknown): body is MemoryStoreQueueItemWire {\n\tif (!isRecord(body)) {\n\t\treturn false;\n\t}\n\n\tconst { data, expireTime, path, priority } = body;\n\treturn (\n\t\ttypeof path === \"string\" &&\n\t\tisDateTimeString(expireTime) &&\n\t\tdata !== undefined &&\n\t\tdata !== null &&\n\t\t(priority === undefined || priority === null || typeof priority === \"number\")\n\t);\n}\n\nfunction wireBodyToQueueItem(body: unknown): QueueItem | undefined {\n\tif (!isQueueItemWire(body)) {\n\t\treturn undefined;\n\t}\n\n\tconst match = PATH_PATTERN.exec(body.path);\n\tconst universeId = match?.[1];\n\tconst queueId = match?.[2];\n\tconst id = match?.[3];\n\tif (universeId === undefined || queueId === undefined || id === undefined) {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\tid,\n\t\tdata: body.data,\n\t\texpiresAt: new Date(body.expireTime),\n\t\tpriority: body.priority ?? undefined,\n\t\tqueueId,\n\t\tuniverseId,\n\t};\n}\n\nfunction malformedQueueItem(statusCode: number, body: unknown): Result<QueueItem, ApiError> {\n\treturn {\n\t\terr: new ApiError(MALFORMED_QUEUE_ITEM_MESSAGE, {\n\t\t\tdetails: toJsonDetails(body),\n\t\t\tstatusCode,\n\t\t}),\n\t\tsuccess: false,\n\t};\n}\n\nfunction isQueueItem(item: QueueItem | undefined): item is QueueItem {\n\treturn item !== undefined;\n}\n\nfunction malformedDequeue(statusCode: number, body: unknown): Result<DequeueResult, ApiError> {\n\treturn {\n\t\terr: new ApiError(MALFORMED_DEQUEUE_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 {\n\tbuildDequeueRequest,\n\tbuildDiscardRequest,\n\tbuildEnqueueRequest,\n} from \"../../domains/cloud-v2/memory-store-queues/builders.ts\";\nimport {\n\tDEQUEUE_OPERATION_LIMIT,\n\tDEQUEUE_REQUIRED_SCOPES,\n\tDISCARD_OPERATION_LIMIT,\n\tDISCARD_REQUIRED_SCOPES,\n\tENQUEUE_OPERATION_LIMIT,\n\tENQUEUE_REQUIRED_SCOPES,\n} from \"../../domains/cloud-v2/memory-store-queues/operations.ts\";\nimport {\n\tparseDequeueResponse,\n\tparseQueueItemResponse,\n} from \"../../domains/cloud-v2/memory-store-queues/parsers.ts\";\nimport type {\n\tDequeueQueueItemsParameters,\n\tDequeueResult,\n\tDiscardQueueItemsParameters,\n\tEnqueueQueueItemParameters,\n\tQueueItem,\n} from \"../../domains/cloud-v2/memory-store-queues/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\ttype ResourceClient,\n\ttype ResourceMethodSpec,\n} from \"../../internal/resource-client.ts\";\nimport type { Result } from \"../../types.ts\";\n\nfunction makeSpec<P, R>(spec: ResourceMethodSpec<P, R>): ResourceMethodSpec<P, R> {\n\treturn Object.freeze(spec);\n}\n\nconst ENQUEUE_SPEC = makeSpec<EnqueueQueueItemParameters, QueueItem>({\n\tbuildRequest: (parameters) => okRequest(buildEnqueueRequest(parameters)),\n\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\tmethodKind: \"create\",\n\toperationLimit: ENQUEUE_OPERATION_LIMIT,\n\tparse: parseQueueItemResponse,\n\trequiredScopes: ENQUEUE_REQUIRED_SCOPES,\n});\n\n// Dequeue uses HTTP GET but mutates server state via the invisibility\n// window. Retrying a 5xx where the server set invisibility before\n// failing the response would lose the original batch (it stays\n// invisible until the window elapses) and return a different one. So\n// the retry policy mirrors `create`: only 429, never 5xx.\nconst DEQUEUE_SPEC = makeSpec<DequeueQueueItemsParameters, DequeueResult>({\n\tbuildRequest: (parameters) => okRequest(buildDequeueRequest(parameters)),\n\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\tmethodKind: \"create\",\n\toperationLimit: DEQUEUE_OPERATION_LIMIT,\n\tparse: parseDequeueResponse,\n\trequiredScopes: DEQUEUE_REQUIRED_SCOPES,\n});\n\nconst DISCARD_SPEC = makeSpec<DiscardQueueItemsParameters, undefined>({\n\tbuildRequest: (parameters) => okRequest(buildDiscardRequest(parameters)),\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: DISCARD_OPERATION_LIMIT,\n\tparse: parseEmptyResponse,\n\trequiredScopes: DISCARD_REQUIRED_SCOPES,\n});\n\n/**\n * Operation Group on `StorageClient` that exposes the memory-store\n * queue endpoints. Queues are FIFO collections of opaque JSON values\n * with optional priority and TTL; consumers enqueue items, dequeue\n * them in batches, and acknowledge processed batches with a read\n * identifier.\n */\nexport class MemoryStoreQueuesGroup {\n\treadonly #inner: ResourceClient;\n\n\t/**\n\t * Wraps the shared {@link ResourceClient} so the Operation Group\n\t * routes calls through the same retry, hooks, and rate-limit queues\n\t * as the rest of the parent client.\n\t *\n\t * @param inner - The shared {@link ResourceClient} owned by the\n\t *   parent client.\n\t */\n\tconstructor(inner: ResourceClient) {\n\t\tthis.#inner = inner;\n\t}\n\n\t/**\n\t * Dequeues up to `count` items from the front of the queue. Items\n\t * returned become invisible to subsequent reads for\n\t * `invisibilityWindow` seconds (default 30 server-side); they\n\t * reappear once the window elapses unless acknowledged via\n\t * `discard` with the returned `readId`.\n\t *\n\t * On 5xx, dequeue does not retry: the server may have set\n\t * invisibility on a batch before the response failed, so a retry\n\t * would return a *different* batch and the first one is lost until\n\t * the window expires. Callers that can detect duplicates externally\n\t * may opt back into 5xx retry per call by passing `retryableStatuses`\n\t * on `options`.\n\t *\n\t * @param parameters - Universe and queue identifiers, plus optional\n\t *   `count`, `allOrNothing`, and `invisibilityWindow`.\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping the parsed {@link DequeueResult}\n\t *   or the {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async dequeue(\n\t\tparameters: DequeueQueueItemsParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<DequeueResult, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: DEQUEUE_SPEC });\n\t}\n\n\t/**\n\t * Acknowledges a dequeued batch of items, removing them from the\n\t * queue permanently. Pass the `readId` returned from the prior\n\t * `dequeue` call. Without `discard`, the items reappear once the\n\t * invisibility window elapses.\n\t *\n\t * The call is idempotent: a second `discard` with the same `readId`\n\t * is a no-op once the batch has been acknowledged. The retry policy\n\t * therefore retries both 429 and 5xx.\n\t *\n\t * @param parameters - Universe and queue identifiers, plus the\n\t *   `readId` returned from a prior dequeue.\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping `undefined` on success (the\n\t *   server returns an empty body) or the {@link OpenCloudError}\n\t *   that caused the request to fail.\n\t */\n\tpublic async discard(\n\t\tparameters: DiscardQueueItemsParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<undefined, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: DISCARD_SPEC });\n\t}\n\n\t/**\n\t * Enqueues a single item onto a memory-store queue. The queue is\n\t * auto-created on first use; the queue identifier is any string the\n\t * caller picks. Items with higher `priority` values are dequeued\n\t * first; equal priorities preserve insertion order. Items expire\n\t * and are removed automatically after `ttl` seconds, or after a\n\t * server-default lifetime when omitted.\n\t *\n\t * @param parameters - Universe and queue identifiers, the opaque\n\t *   payload, and optional `priority` and `ttl`.\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 QueueItem} or\n\t *   the {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async enqueue(\n\t\tparameters: EnqueueQueueItemParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<QueueItem, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: ENQUEUE_SPEC });\n\t}\n}\n","import type { HttpRequest } from \"../../../client/types.ts\";\nimport type {\n\tCreateSortedMapItemParameters,\n\tDeleteSortedMapItemParameters,\n\tGetSortedMapItemParameters,\n\tListSortedMapItemsParameters,\n\tSortKey,\n\tUpdateSortedMapItemParameters,\n} from \"./types.ts\";\n\n/**\n * Builds a `POST` request for the Open Cloud\n * `Cloud_CreateMemoryStoreSortedMapItem` endpoint. The caller-supplied\n * `itemId` travels as the `id` query parameter (URL-encoded by\n * `URLSearchParams`); the body carries `value`, the optional `ttl`\n * (serialized as a Google protobuf `Duration` string in seconds), and\n * one of `stringSortKey`/`numericSortKey` projected from the\n * {@link SortKey} discriminated union.\n *\n * @param parameters - Universe, sorted-map, item identifiers, the\n *   value to store, and optional `sortKey` and `ttl`.\n * @returns A pure {@link HttpRequest} describing the create call.\n */\nexport function buildCreateRequest({\n\titemId,\n\tmapId,\n\tsortKey,\n\tttl,\n\tuniverseId,\n\tvalue,\n}: CreateSortedMapItemParameters): HttpRequest {\n\tconst body: Record<string, unknown> = { value };\n\tif (ttl !== undefined) {\n\t\tbody[\"ttl\"] = `${ttl}s`;\n\t}\n\n\tapplySortKeyToBody(body, sortKey);\n\n\tconst query = new URLSearchParams({ id: itemId });\n\treturn {\n\t\tbody,\n\t\theaders: { \"content-type\": \"application/json\" },\n\t\tmethod: \"POST\",\n\t\turl: `/cloud/v2/universes/${encodeURIComponent(universeId)}/memory-store/sorted-maps/${encodeURIComponent(mapId)}/items?${query.toString()}`,\n\t};\n}\n\n/**\n * Builds a `DELETE` request for the Open Cloud\n * `Cloud_DeleteMemoryStoreSortedMapItem` endpoint. Every path segment\n * (universe, sorted-map, item identifiers) is URL-encoded so callers\n * can pass values containing reserved characters without manual\n * escaping.\n *\n * @param parameters - Universe, sorted-map, and item identifiers.\n * @returns A pure {@link HttpRequest} describing the delete call.\n */\nexport function buildDeleteRequest({\n\titemId,\n\tmapId,\n\tuniverseId,\n}: DeleteSortedMapItemParameters): HttpRequest {\n\treturn {\n\t\tmethod: \"DELETE\",\n\t\turl: `/cloud/v2/universes/${encodeURIComponent(universeId)}/memory-store/sorted-maps/${encodeURIComponent(mapId)}/items/${encodeURIComponent(itemId)}`,\n\t};\n}\n\n/**\n * Builds a `GET` request for the Open Cloud\n * `Cloud_GetMemoryStoreSortedMapItem` endpoint. Every path segment\n * (universe, sorted-map, item identifiers) is URL-encoded so callers\n * can pass values containing reserved characters without manual\n * escaping.\n *\n * @param parameters - Universe, sorted-map, and item identifiers.\n * @returns A pure {@link HttpRequest} describing the get call.\n */\nexport function buildGetRequest({\n\titemId,\n\tmapId,\n\tuniverseId,\n}: GetSortedMapItemParameters): HttpRequest {\n\treturn {\n\t\tmethod: \"GET\",\n\t\turl: `/cloud/v2/universes/${encodeURIComponent(universeId)}/memory-store/sorted-maps/${encodeURIComponent(mapId)}/items/${encodeURIComponent(itemId)}`,\n\t};\n}\n\n/**\n * Builds a `GET` request for the Open Cloud\n * `Cloud_ListMemoryStoreSortedMapItems` endpoint. Optional `filter`,\n * `maxPageSize`, `orderBy`, and `pageToken` parameters travel as query\n * string parameters and are omitted when unset.\n *\n * @param parameters - Universe and sorted-map identifiers, plus\n *   optional pagination and filter parameters.\n * @returns A pure {@link HttpRequest} describing the list call.\n */\nexport function buildListRequest({\n\tfilter,\n\tmapId,\n\tmaxPageSize,\n\torderBy,\n\tpageToken,\n\tuniverseId,\n}: ListSortedMapItemsParameters): HttpRequest {\n\tconst query = new URLSearchParams();\n\tif (maxPageSize !== undefined) {\n\t\tquery.append(\"maxPageSize\", String(maxPageSize));\n\t}\n\n\tif (pageToken !== undefined) {\n\t\tquery.append(\"pageToken\", pageToken);\n\t}\n\n\tif (orderBy !== undefined) {\n\t\tquery.append(\"orderBy\", orderBy);\n\t}\n\n\tif (filter !== undefined) {\n\t\tquery.append(\"filter\", filter);\n\t}\n\n\tconst base = `/cloud/v2/universes/${encodeURIComponent(universeId)}/memory-store/sorted-maps/${encodeURIComponent(mapId)}/items`;\n\tconst queryString = query.toString();\n\treturn { method: \"GET\", url: queryString === \"\" ? base : `${base}?${queryString}` };\n}\n\n/**\n * Builds a `PATCH` request for the Open Cloud\n * `Cloud_UpdateMemoryStoreSortedMapItem` endpoint. Body fields are\n * conditionally included so a partial update sends only the changed\n * fields; the optional `allowMissing` query string drives\n * upsert-on-missing behaviour server-side.\n *\n * @param parameters - Universe, sorted-map, and item identifiers,\n *   plus any subset of `value`, `ttl`, `sortKey`, and `allowMissing`.\n * @returns A pure {@link HttpRequest} describing the update call.\n */\nexport function buildUpdateRequest(parameters: UpdateSortedMapItemParameters): HttpRequest {\n\tconst { allowMissing: shouldAllowMissing, itemId, mapId, universeId } = parameters;\n\tconst base = `/cloud/v2/universes/${encodeURIComponent(universeId)}/memory-store/sorted-maps/${encodeURIComponent(mapId)}/items/${encodeURIComponent(itemId)}`;\n\tconst query = new URLSearchParams();\n\tif (shouldAllowMissing !== undefined) {\n\t\tquery.append(\"allowMissing\", String(shouldAllowMissing));\n\t}\n\n\tconst queryString = query.toString();\n\treturn {\n\t\tbody: buildUpdateBody(parameters),\n\t\theaders: { \"content-type\": \"application/json\" },\n\t\tmethod: \"PATCH\",\n\t\turl: queryString === \"\" ? base : `${base}?${queryString}`,\n\t};\n}\n\nfunction applySortKeyToBody(body: Record<string, unknown>, sortKey: SortKey | undefined): void {\n\tif (sortKey === undefined) {\n\t\treturn;\n\t}\n\n\tif (sortKey.kind === \"string\") {\n\t\tbody[\"stringSortKey\"] = sortKey.value;\n\t\treturn;\n\t}\n\n\tbody[\"numericSortKey\"] = sortKey.value;\n}\n\nfunction buildUpdateBody({\n\tsortKey,\n\tttl,\n\tvalue,\n}: UpdateSortedMapItemParameters): Record<string, unknown> {\n\tconst body: Record<string, unknown> = {};\n\tif (value !== undefined) {\n\t\tbody[\"value\"] = value;\n\t}\n\n\tif (ttl !== undefined) {\n\t\tbody[\"ttl\"] = `${ttl}s`;\n\t}\n\n\tapplySortKeyToBody(body, sortKey);\n\treturn body;\n}\n","import type { OperationLimit } from \"../../../internal/http/rate-limit-queue.ts\";\n\nconst CREATE_PER_MINUTE = 1_000_000;\nconst SECONDS_PER_MINUTE = 60;\n\nconst WRITE_SCOPE = \"memory-store.sorted-map:write\";\n\n/**\n * Per-second request ceiling for creating a memory-store sorted-map\n * item, from the Open Cloud OpenAPI schema (1,000,000 requests per\n * minute per API key owner). Keyed independently from the get, update,\n * delete, and list operations so the five do not share a queue.\n */\nexport const CREATE_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: CREATE_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"memory-store-sorted-maps.create\",\n});\n\n/**\n * Scopes required to create a memory-store sorted-map item, sourced\n * from `x-roblox-scopes` on the `Cloud_CreateMemoryStoreSortedMapItem`\n * operation in the vendored OpenAPI schema.\n */\nexport const CREATE_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([WRITE_SCOPE]);\n\nconst DELETE_PER_MINUTE = 1_000_000;\n\n/**\n * Per-second request ceiling for deleting a memory-store sorted-map\n * item, from the Open Cloud OpenAPI schema (1,000,000 requests per\n * minute per API key owner).\n */\nexport const DELETE_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: DELETE_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"memory-store-sorted-maps.delete\",\n});\n\n/**\n * Scopes required to delete a memory-store sorted-map item, sourced\n * from `x-roblox-scopes` on the `Cloud_DeleteMemoryStoreSortedMapItem`\n * operation in the vendored OpenAPI schema.\n */\nexport const DELETE_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([WRITE_SCOPE]);\n\nconst GET_PER_MINUTE = 1_000_000;\n\n/**\n * Per-second request ceiling for reading a memory-store sorted-map\n * item, from the Open Cloud OpenAPI schema (1,000,000 requests per\n * minute per API key owner).\n */\nexport const GET_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: GET_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"memory-store-sorted-maps.get\",\n});\n\n/**\n * Scopes required to read a memory-store sorted-map item, sourced from\n * `x-roblox-scopes` on the `Cloud_GetMemoryStoreSortedMapItem`\n * operation in the vendored OpenAPI schema.\n */\nexport const GET_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"memory-store.sorted-map:read\",\n]);\n\nconst LIST_PER_MINUTE = 1_000_000;\n\n/**\n * Per-second request ceiling for listing memory-store sorted-map\n * items, from the Open Cloud OpenAPI schema (1,000,000 requests per\n * minute per API key owner).\n */\nexport const LIST_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: LIST_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"memory-store-sorted-maps.list\",\n});\n\n/**\n * Scopes required to list memory-store sorted-map items, sourced from\n * `x-roblox-scopes` on the `Cloud_ListMemoryStoreSortedMapItems`\n * operation in the vendored OpenAPI schema.\n */\nexport const LIST_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([\n\t\"memory-store.sorted-map:read\",\n]);\n\nconst UPDATE_PER_MINUTE = 1_000_000;\n\n/**\n * Per-second request ceiling for updating a memory-store sorted-map\n * item, from the Open Cloud OpenAPI schema (1,000,000 requests per\n * minute per API key owner).\n */\nexport const UPDATE_OPERATION_LIMIT: OperationLimit = Object.freeze({\n\tmaxPerSecond: UPDATE_PER_MINUTE / SECONDS_PER_MINUTE,\n\toperationKey: \"memory-store-sorted-maps.update\",\n});\n\n/**\n * Scopes required to update a memory-store sorted-map item, sourced\n * from `x-roblox-scopes` on the `Cloud_UpdateMemoryStoreSortedMapItem`\n * operation in the vendored OpenAPI schema.\n */\nexport const UPDATE_REQUIRED_SCOPES: ReadonlyArray<string> = Object.freeze([WRITE_SCOPE]);\n","import type { HttpResponse } from \"../../../client/types.ts\";\nimport { ApiError } from \"../../../errors/api-error.ts\";\nimport { isDateTimeString } from \"../../../internal/utils/is-date-time-string.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 { ListSortedMapItemsResult, SortedMapItem, SortKey } from \"./types.ts\";\nimport type { MemoryStoreSortedMapItemWire } from \"./wire.ts\";\n\nconst PATH_PATTERN =\n\t/^cloud\\/v2\\/universes\\/(\\d+)\\/memory-stores?\\/sorted-maps\\/([^/]+)\\/items\\/([^/]+)$/;\nconst MALFORMED_MESSAGE = \"Malformed memory-store sorted-map item response\";\nconst MALFORMED_LIST_MESSAGE = \"Malformed memory-store sorted-map list response\";\n\n/**\n * Parses a successful memory-store sorted-map item response body (the\n * happy path for create, get, and update) into the public\n * {@link SortedMapItem} shape.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * @returns A success result wrapping the parsed {@link SortedMapItem},\n *   or an {@link ApiError} when the body does not match the wire schema.\n */\nexport function parseSortedMapItemResponse(\n\tresponse: HttpResponse,\n): Result<SortedMapItem, ApiError> {\n\tconst item = wireBodyToSortedMapItem(response.body);\n\tif (item === undefined) {\n\t\treturn malformedSortedMapItem(response.status, response.body);\n\t}\n\n\treturn { data: item, success: true };\n}\n\n/**\n * Parses a successful `Cloud_ListMemoryStoreSortedMapItems` response\n * body into the public {@link ListSortedMapItemsResult} shape. Each\n * item in the `items` array is validated through the same\n * path-and-shape checks as {@link parseSortedMapItemResponse}; a\n * malformed entry rejects the whole response.\n *\n * @param response - The full {@link HttpResponse} from the Open Cloud API.\n * @returns A success result wrapping the parsed\n *   {@link ListSortedMapItemsResult}, or an {@link ApiError} when the\n *   response shape is wrong.\n */\nexport function parseListResponse({\n\tbody,\n\tstatus: statusCode,\n}: HttpResponse): Result<ListSortedMapItemsResult, ApiError> {\n\tif (!isRecord(body)) {\n\t\treturn malformedList(statusCode, body);\n\t}\n\n\tconst { items: rawItemsField, nextPageToken } = body;\n\tif (rawItemsField !== undefined && rawItemsField !== null && !Array.isArray(rawItemsField)) {\n\t\treturn malformedList(statusCode, body);\n\t}\n\n\tconst normalizedToken = nextPageToken ?? undefined;\n\tif (normalizedToken !== undefined && typeof normalizedToken !== \"string\") {\n\t\treturn malformedList(statusCode, body);\n\t}\n\n\tconst rawItems = rawItemsField ?? [];\n\tconst items = rawItems.map(wireBodyToSortedMapItem);\n\tif (!items.every(isSortedMapItem)) {\n\t\treturn malformedList(statusCode, body);\n\t}\n\n\treturn { data: { items, nextPageToken: normalizedToken }, success: true };\n}\n\nfunction isSortedMapItemWire(body: unknown): body is MemoryStoreSortedMapItemWire {\n\tif (!isRecord(body)) {\n\t\treturn false;\n\t}\n\n\tconst { id, etag, expireTime, numericSortKey, path, stringSortKey, value } = body;\n\treturn (\n\t\ttypeof path === \"string\" &&\n\t\ttypeof etag === \"string\" &&\n\t\ttypeof id === \"string\" &&\n\t\tisDateTimeString(expireTime) &&\n\t\tvalue !== undefined &&\n\t\t(stringSortKey === undefined ||\n\t\t\tstringSortKey === null ||\n\t\t\ttypeof stringSortKey === \"string\") &&\n\t\t(numericSortKey === undefined ||\n\t\t\tnumericSortKey === null ||\n\t\t\ttypeof numericSortKey === \"number\")\n\t);\n}\n\nfunction extractSortKey(body: MemoryStoreSortedMapItemWire): \"conflict\" | SortKey | undefined {\n\tconst hasStringKey = typeof body.stringSortKey === \"string\";\n\tconst hasNumericKey = typeof body.numericSortKey === \"number\";\n\tif (hasStringKey && hasNumericKey) {\n\t\treturn \"conflict\";\n\t}\n\n\tif (hasStringKey) {\n\t\treturn { kind: \"string\", value: body.stringSortKey };\n\t}\n\n\tif (hasNumericKey) {\n\t\treturn { kind: \"numeric\", value: body.numericSortKey };\n\t}\n\n\treturn undefined;\n}\n\nfunction wireBodyToSortedMapItem(body: unknown): SortedMapItem | undefined {\n\tif (!isSortedMapItemWire(body)) {\n\t\treturn undefined;\n\t}\n\n\t// Item ids round-trip URL-encoded in `path` (e.g. `name::id` arrives\n\t// as `name%3A%3Aid`), so the decoded id is read from `body.id` rather\n\t// than the regex group.\n\tconst match = PATH_PATTERN.exec(body.path);\n\tconst universeId = match?.[1];\n\tconst mapId = match?.[2];\n\tif (universeId === undefined || mapId === undefined) {\n\t\treturn undefined;\n\t}\n\n\tconst sortKey = extractSortKey(body);\n\tif (sortKey === \"conflict\") {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\tid: body.id,\n\t\tetag: body.etag,\n\t\texpiresAt: new Date(body.expireTime),\n\t\tmapId,\n\t\tsortKey,\n\t\tuniverseId,\n\t\tvalue: body.value,\n\t};\n}\n\nfunction malformedSortedMapItem(\n\tstatusCode: number,\n\tbody: unknown,\n): Result<SortedMapItem, ApiError> {\n\treturn {\n\t\terr: new ApiError(MALFORMED_MESSAGE, {\n\t\t\tdetails: toJsonDetails(body),\n\t\t\tstatusCode,\n\t\t}),\n\t\tsuccess: false,\n\t};\n}\n\nfunction isSortedMapItem(item: SortedMapItem | undefined): item is SortedMapItem {\n\treturn item !== undefined;\n}\n\nfunction malformedList(\n\tstatusCode: number,\n\tbody: unknown,\n): Result<ListSortedMapItemsResult, ApiError> {\n\treturn {\n\t\terr: new ApiError(MALFORMED_LIST_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 {\n\tbuildCreateRequest,\n\tbuildDeleteRequest,\n\tbuildGetRequest,\n\tbuildListRequest,\n\tbuildUpdateRequest,\n} from \"../../domains/cloud-v2/memory-store-sorted-maps/builders.ts\";\nimport {\n\tCREATE_OPERATION_LIMIT,\n\tCREATE_REQUIRED_SCOPES,\n\tDELETE_OPERATION_LIMIT,\n\tDELETE_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/cloud-v2/memory-store-sorted-maps/operations.ts\";\nimport {\n\tparseListResponse,\n\tparseSortedMapItemResponse,\n} from \"../../domains/cloud-v2/memory-store-sorted-maps/parsers.ts\";\nimport type {\n\tCreateSortedMapItemParameters,\n\tDeleteSortedMapItemParameters,\n\tGetSortedMapItemParameters,\n\tListSortedMapItemsParameters,\n\tListSortedMapItemsResult,\n\tSortedMapItem,\n\tUpdateSortedMapItemParameters,\n} from \"../../domains/cloud-v2/memory-store-sorted-maps/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\ttype ResourceClient,\n\ttype ResourceMethodSpec,\n} from \"../../internal/resource-client.ts\";\nimport type { 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<CreateSortedMapItemParameters, SortedMapItem>({\n\tbuildRequest: (parameters) => okRequest(buildCreateRequest(parameters)),\n\tmethodDefaults: CREATE_METHOD_DEFAULTS,\n\tmethodKind: \"create\",\n\toperationLimit: CREATE_OPERATION_LIMIT,\n\tparse: parseSortedMapItemResponse,\n\trequiredScopes: CREATE_REQUIRED_SCOPES,\n});\n\nconst DELETE_SPEC = makeSpec<DeleteSortedMapItemParameters, undefined>({\n\tbuildRequest: (parameters) => okRequest(buildDeleteRequest(parameters)),\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: DELETE_OPERATION_LIMIT,\n\tparse: parseEmptyResponse,\n\trequiredScopes: DELETE_REQUIRED_SCOPES,\n});\n\nconst GET_SPEC = makeSpec<GetSortedMapItemParameters, SortedMapItem>({\n\tbuildRequest: (parameters) => okRequest(buildGetRequest(parameters)),\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: GET_OPERATION_LIMIT,\n\tparse: parseSortedMapItemResponse,\n\trequiredScopes: GET_REQUIRED_SCOPES,\n});\n\nconst LIST_SPEC = makeSpec<ListSortedMapItemsParameters, ListSortedMapItemsResult>({\n\tbuildRequest: (parameters) => okRequest(buildListRequest(parameters)),\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: LIST_OPERATION_LIMIT,\n\tparse: parseListResponse,\n\trequiredScopes: LIST_REQUIRED_SCOPES,\n});\n\nconst UPDATE_SPEC = makeSpec<UpdateSortedMapItemParameters, SortedMapItem>({\n\tbuildRequest: (parameters) => okRequest(buildUpdateRequest(parameters)),\n\tmethodDefaults: IDEMPOTENT_METHOD_DEFAULTS,\n\tmethodKind: \"idempotent\",\n\toperationLimit: UPDATE_OPERATION_LIMIT,\n\tparse: parseSortedMapItemResponse,\n\trequiredScopes: UPDATE_REQUIRED_SCOPES,\n});\n\n/**\n * Operation Group on `StorageClient` that exposes the memory-store\n * sorted-map endpoints. Sorted maps are ordered collections of\n * (id, value, sortKey) triples; consumers create, read, update, list,\n * and delete items keyed by a caller-supplied identifier and ordered\n * by an optional string or numeric sort key.\n */\nexport class MemoryStoreSortedMapsGroup {\n\treadonly #inner: ResourceClient;\n\n\t/**\n\t * Wraps the shared {@link ResourceClient} so the Operation Group\n\t * routes calls through the same retry, hooks, and rate-limit queues\n\t * as the rest of the parent client.\n\t *\n\t * @param inner - The shared {@link ResourceClient} owned by the\n\t *   parent client.\n\t */\n\tconstructor(inner: ResourceClient) {\n\t\tthis.#inner = inner;\n\t}\n\n\t/**\n\t * Creates a single item in a sorted map. The sorted map is\n\t * auto-created on first use; the map identifier is any string the\n\t * caller picks. Items are keyed by `itemId` (case-sensitive) and\n\t * ordered by an optional `sortKey`. Items expire and are removed\n\t * automatically after `ttl` seconds, or after a server-default\n\t * lifetime when omitted.\n\t *\n\t * On 5xx, create does not retry: Roblox Open Cloud has no\n\t * idempotency-key support, so a retry of a transient failure risks\n\t * producing a duplicate item.\n\t *\n\t * @param parameters - Universe, sorted-map, item identifiers, the\n\t *   value to store, and optional `sortKey` and `ttl`.\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 SortedMapItem}\n\t *   or the {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async create(\n\t\tparameters: CreateSortedMapItemParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<SortedMapItem, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: CREATE_SPEC });\n\t}\n\n\t/**\n\t * Removes a single item from a sorted map. The call is idempotent:\n\t * a second `delete` against the same item is a no-op once the\n\t * server has dropped the row. The retry policy retries both 429\n\t * and 5xx.\n\t *\n\t * @param parameters - Universe, sorted-map, and item identifiers.\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping `undefined` on success or the\n\t *   {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async delete(\n\t\tparameters: DeleteSortedMapItemParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<undefined, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: DELETE_SPEC });\n\t}\n\n\t/**\n\t * Reads a single item from a sorted map. Returns the parsed\n\t * {@link SortedMapItem} with the server-recorded `etag` for use in\n\t * subsequent conditional updates (once the SDK begins emitting\n\t * `If-Match`; see the package README).\n\t *\n\t * @param parameters - Universe, sorted-map, and item identifiers.\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping the parsed {@link SortedMapItem}\n\t *   or the {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async get(\n\t\tparameters: GetSortedMapItemParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<SortedMapItem, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: GET_SPEC });\n\t}\n\n\t/**\n\t * Lists items in a sorted map. The server caps `maxPageSize` at\n\t * `100` and defaults it to `1` when omitted, so callers explicitly\n\t * pass `maxPageSize` to retrieve more than a single item per page.\n\t * The `filter` parameter accepts a CEL expression on `id` and\n\t * `sortKey` (operators `<`, `>`, `&&` only).\n\t *\n\t * @param parameters - Universe and sorted-map identifiers, plus\n\t *   optional pagination and filter parameters.\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping the parsed\n\t *   {@link ListSortedMapItemsResult} or the {@link OpenCloudError}\n\t *   that caused the request to fail.\n\t */\n\tpublic async list(\n\t\tparameters: ListSortedMapItemsParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<ListSortedMapItemsResult, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: LIST_SPEC });\n\t}\n\n\t/**\n\t * Updates a sorted-map item under PATCH semantics: omitted body\n\t * fields are left unchanged on the server, supplied fields replace\n\t * their existing values. Passing `allowMissing: true` creates the\n\t * item when no row exists instead of returning 404.\n\t *\n\t * Retries 5xx because PATCH with the same body produces the same\n\t * server state.\n\t *\n\t * @param parameters - Universe, sorted-map, and item identifiers,\n\t *   plus any subset of `value`, `ttl`, `sortKey`, and\n\t *   `allowMissing`.\n\t * @param options - Optional per-request overrides.\n\t * @returns A {@link Result} wrapping the parsed {@link SortedMapItem}\n\t *   or the {@link OpenCloudError} that caused the request to fail.\n\t */\n\tpublic async update(\n\t\tparameters: UpdateSortedMapItemParameters,\n\t\toptions?: RequestOptions,\n\t): Promise<Result<SortedMapItem, OpenCloudError>> {\n\t\treturn this.#inner.executeAsync({ options, parameters, spec: UPDATE_SPEC });\n\t}\n}\n","import type { OpenCloudClientOptions } from \"../../client/types.ts\";\nimport { ResourceClient } from \"../../internal/resource-client.ts\";\nimport { MemoryStoreQueuesGroup } from \"./queues-group.ts\";\nimport { MemoryStoreSortedMapsGroup } from \"./sorted-maps-group.ts\";\n\n/**\n * Public client for the Roblox Open Cloud `Data and memory stores`\n * Feature. Today it covers memory-store queues via the\n * {@link StorageClient.queues} Operation Group and memory-store sorted\n * maps via the {@link StorageClient.sortedMaps} Operation Group; a\n * future data-stores Operation Group slots in as a sibling on the same\n * client.\n *\n * Every method returns a `Result` so callers handle failure\n * explicitly; no thrown error ever escapes the client.\n *\n * @since 0.1.0\n *\n * @example\n *\n * ```ts\n * import { StorageClient } from \"@bedrock-rbx/ocale/storage\";\n *\n * const client = new StorageClient({ apiKey: \"your-key\" });\n * expect(client).toBeInstanceOf(StorageClient);\n * ```\n */\nexport class StorageClient {\n\t/** Memory-store queue Operation Group. */\n\tpublic readonly queues: MemoryStoreQueuesGroup;\n\t/** Memory-store sorted-map Operation Group. */\n\tpublic readonly sortedMaps: MemoryStoreSortedMapsGroup;\n\n\t/**\n\t * Creates a new {@link StorageClient}. 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\tconst inner = new ResourceClient(options);\n\t\tthis.queues = new MemoryStoreQueuesGroup(inner);\n\t\tthis.sortedMaps = new MemoryStoreSortedMapsGroup(inner);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;AAiBA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