@panneau/protocol 5.0.0-alpha.3 → 5.0.0-alpha.32
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/dist/addresses.d.ts +23 -0
- package/dist/addresses.d.ts.map +1 -0
- package/dist/addresses.js +52 -0
- package/dist/addresses.js.map +1 -0
- package/dist/compound.d.ts +20 -0
- package/dist/compound.d.ts.map +1 -0
- package/dist/compound.js +27 -0
- package/dist/compound.js.map +1 -0
- package/dist/conditions.d.ts +1 -1
- package/dist/conformance/index.d.ts +6 -0
- package/dist/conformance/index.d.ts.map +1 -1
- package/dist/conformance/index.js +801 -11
- package/dist/conformance/index.js.map +1 -1
- package/dist/constants.d.ts +108 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +181 -3
- package/dist/constants.js.map +1 -1
- package/dist/context.d.ts +15 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +34 -0
- package/dist/context.js.map +1 -0
- package/dist/currencies.d.ts +22 -0
- package/dist/currencies.d.ts.map +1 -0
- package/dist/currencies.js +231 -0
- package/dist/currencies.js.map +1 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +19 -8
- package/dist/libraries.d.ts +33 -0
- package/dist/libraries.d.ts.map +1 -0
- package/dist/libraries.js +59 -0
- package/dist/libraries.js.map +1 -0
- package/dist/links.d.ts +38 -0
- package/dist/links.d.ts.map +1 -0
- package/dist/links.js +65 -0
- package/dist/links.js.map +1 -0
- package/dist/lint.d.ts +4 -3
- package/dist/lint.d.ts.map +1 -1
- package/dist/lint.js +168 -7
- package/dist/lint.js.map +1 -1
- package/dist/mock/auth.d.ts +71 -0
- package/dist/mock/auth.d.ts.map +1 -0
- package/dist/mock/auth.js +346 -0
- package/dist/mock/auth.js.map +1 -0
- package/dist/mock/example.d.ts +3 -2
- package/dist/mock/example.d.ts.map +1 -1
- package/dist/mock/example.js +241 -144
- package/dist/mock/example.js.map +1 -1
- package/dist/mock/index.d.ts +79 -7
- package/dist/mock/index.d.ts.map +1 -1
- package/dist/mock/index.js +603 -38
- package/dist/mock/index.js.map +1 -1
- package/dist/openapi.d.ts.map +1 -1
- package/dist/openapi.js +392 -144
- package/dist/openapi.js.map +1 -1
- package/dist/problem.d.ts +1 -1
- package/dist/query.d.ts +18 -0
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +34 -8
- package/dist/query.js.map +1 -1
- package/dist/resourceTypes.d.ts +39 -0
- package/dist/resourceTypes.d.ts.map +1 -0
- package/dist/resourceTypes.js +34 -0
- package/dist/resourceTypes.js.map +1 -0
- package/dist/rules.d.ts +18 -5
- package/dist/rules.d.ts.map +1 -1
- package/dist/rules.js +233 -15
- package/dist/rules.js.map +1 -1
- package/dist/runtime/index.d.ts +20 -10
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +13 -3
- package/dist/schemas/action.d.ts +118 -10
- package/dist/schemas/action.d.ts.map +1 -1
- package/dist/schemas/action.js +20 -3
- package/dist/schemas/action.js.map +1 -1
- package/dist/schemas/api.d.ts +334 -42
- package/dist/schemas/api.d.ts.map +1 -1
- package/dist/schemas/api.js +194 -34
- package/dist/schemas/api.js.map +1 -1
- package/dist/schemas/boot.d.ts +25 -1
- package/dist/schemas/boot.d.ts.map +1 -1
- package/dist/schemas/boot.js +2 -1
- package/dist/schemas/boot.js.map +1 -1
- package/dist/schemas/common.d.ts +1 -0
- package/dist/schemas/common.d.ts.map +1 -1
- package/dist/schemas/common.js +2 -1
- package/dist/schemas/common.js.map +1 -1
- package/dist/schemas/definition.d.ts +341 -28
- package/dist/schemas/definition.d.ts.map +1 -1
- package/dist/schemas/definition.js +65 -19
- package/dist/schemas/definition.js.map +1 -1
- package/dist/schemas/field.d.ts +357 -2
- package/dist/schemas/field.d.ts.map +1 -1
- package/dist/schemas/field.js +160 -20
- package/dist/schemas/field.js.map +1 -1
- package/dist/schemas/index.d.ts +1429 -80
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +60 -10
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/jsonRules.d.ts +83 -0
- package/dist/schemas/jsonRules.d.ts.map +1 -0
- package/dist/schemas/jsonRules.js +46 -0
- package/dist/schemas/jsonRules.js.map +1 -0
- package/dist/schemas/layout.d.ts +2 -1
- package/dist/schemas/layout.d.ts.map +1 -1
- package/dist/schemas/layout.js +2 -1
- package/dist/schemas/layout.js.map +1 -1
- package/dist/schemas/list.d.ts +23 -2
- package/dist/schemas/list.d.ts.map +1 -1
- package/dist/schemas/list.js +15 -6
- package/dist/schemas/list.js.map +1 -1
- package/dist/schemas/resource.d.ts +263 -17
- package/dist/schemas/resource.d.ts.map +1 -1
- package/dist/schemas/resource.js +19 -4
- package/dist/schemas/resource.js.map +1 -1
- package/dist/schemas/theme.d.ts +4 -0
- package/dist/schemas/theme.d.ts.map +1 -1
- package/dist/schemas/theme.js +1 -0
- package/dist/schemas/theme.js.map +1 -1
- package/dist/schemas/widget.d.ts +109 -0
- package/dist/schemas/widget.d.ts.map +1 -0
- package/dist/schemas/widget.js +74 -0
- package/dist/schemas/widget.js.map +1 -0
- package/dist/search.d.ts +51 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +53 -0
- package/dist/search.js.map +1 -0
- package/dist/themes.d.ts +1 -1
- package/dist/transforms.d.ts +17 -0
- package/dist/transforms.d.ts.map +1 -0
- package/dist/transforms.js +34 -0
- package/dist/transforms.js.map +1 -0
- package/dist/validate.d.ts +5 -3
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +36 -2
- package/dist/validate.js.map +1 -1
- package/dist/values.d.ts +5 -1
- package/dist/values.d.ts.map +1 -1
- package/dist/values.js +16 -2
- package/dist/values.js.map +1 -1
- package/dist/widgets.d.ts +42 -0
- package/dist/widgets.d.ts.map +1 -0
- package/dist/widgets.js +130 -0
- package/dist/widgets.js.map +1 -0
- package/package.json +6 -3
- package/schema/boot.schema.json +716 -20
- package/schema/definition.schema.json +713 -20
- package/schema/openapi.json +5659 -2229
package/dist/openapi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.js","names":[],"sources":["../src/openapi.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { createSchemaRegistry } from './schemas';\nimport { BootConfig } from './schemas/boot';\nimport { Definition } from './schemas/definition';\nimport { Theme } from './schemas/theme';\nimport { PROBLEM_CONTENT_TYPE, PROTOCOL_VERSION } from './version';\n\ntype JsonObject = Record<string, unknown>;\n\nconst ref = (id: string): JsonObject => ({ $ref: `#/components/schemas/${id}` });\n\nconst json = (schema: JsonObject): JsonObject => ({ 'application/json': { schema } });\n\nconst ok = (description: string, schema?: JsonObject, headers?: JsonObject): JsonObject => ({\n description,\n ...(schema !== undefined ? { content: json(schema) } : {}),\n ...(headers !== undefined ? { headers } : {}),\n});\n\nconst PROBLEMS: Record<number, string> = {\n 400: 'Bad request, such as a dry run of an action that does not declare `dryRun`.',\n 401: 'Not authenticated.',\n 403: 'Not allowed.',\n 404: 'Not found.',\n 409: 'Conflict with a business rule.',\n 412: 'Version conflict: `If-Match` does not match the current version, which is in `current`.',\n 422: 'Invalid values: messages are in `errors`, keyed by dot path.',\n};\n\nfunction problems(...statuses: number[]): JsonObject {\n return Object.fromEntries(\n statuses.map((status) => [\n String(status),\n {\n description: PROBLEMS[status],\n content: { [PROBLEM_CONTENT_TYPE]: { schema: ref('Problem') } },\n },\n ]),\n );\n}\n\nconst etag = { ETag: { description: 'The version of the item.', schema: { type: 'string' } } };\n\nconst pathParameter = (name: string, description: string): JsonObject => ({\n name,\n in: 'path',\n required: true,\n description,\n schema: { type: 'string' },\n});\n\nconst queryParameter = (name: string, description: string, schema: JsonObject): JsonObject => ({\n name,\n in: 'query',\n required: false,\n description,\n schema,\n});\n\nconst listParameters = [\n queryParameter('page', 'Page number, from 1.', { type: 'integer', minimum: 1 }),\n queryParameter('perPage', 'Items per page.', { type: 'integer', minimum: 1 }),\n queryParameter('sort', 'Comma-separated fields; a `-` prefix sorts descending.', {\n type: 'string',\n }),\n {\n name: 'filter',\n in: 'query',\n required: false,\n style: 'deepObject',\n explode: true,\n description:\n '`filter[status]=published`; `filter[tags][]=a&filter[tags][]=b` for any of several values; `filter[published_at][from]=2026-01-01&filter[published_at][to]=2026-01-31` for the inclusive bounds of a range filter (`date-range`), without the open end.',\n schema: { type: 'object', additionalProperties: true },\n },\n queryParameter('q', 'Search.', { type: 'string' }),\n queryParameter('fields', 'Comma-separated fields to include in each item.', { type: 'string' }),\n];\n\nconst resource = pathParameter('resource', 'Resource id.');\nconst id = pathParameter('id', 'Item id.');\nconst values = { type: 'object', additionalProperties: true };\n\n/** Component schemas, generated from the protocol's Zod schemas. */\nexport function createComponentSchemas(): Record<string, JsonObject> {\n const { schemas } = z.toJSONSchema(createSchemaRegistry(), {\n io: 'input',\n uri: (schemaId) => `#/components/schemas/${schemaId}`,\n });\n return Object.fromEntries(\n Object.entries(schemas).map(([schemaId, schema]) => {\n const { $schema: _schema, $id: _id, ...rest } = schema as JsonObject;\n return [schemaId, rest];\n }),\n );\n}\n\n/** The JSON Schema of the definition (`GET /definition`). */\nexport function createDefinitionJsonSchema(): JsonObject {\n return {\n $id: 'https://github.com/folkloreinc/panneau-js/blob/v5.x/packages/protocol/schema/definition.schema.json',\n ...(z.toJSONSchema(Definition, {\n io: 'input',\n metadata: createSchemaRegistry(),\n }) as JsonObject),\n };\n}\n\n/** The JSON Schema of a theme, for themes written as JSON files. */\nexport function createThemeJsonSchema(): JsonObject {\n return {\n $id: 'https://github.com/folkloreinc/panneau-js/blob/v5.x/packages/protocol/schema/theme.schema.json',\n ...(z.toJSONSchema(Theme, {\n io: 'input',\n metadata: createSchemaRegistry(),\n }) as JsonObject),\n };\n}\n\n/** The JSON Schema of the boot config, which a server writes in the page of the app. */\nexport function createBootConfigJsonSchema(): JsonObject {\n return {\n $id: 'https://github.com/folkloreinc/panneau-js/blob/v5.x/packages/protocol/schema/boot.schema.json',\n ...(z.toJSONSchema(BootConfig, {\n io: 'input',\n metadata: createSchemaRegistry(),\n }) as JsonObject),\n };\n}\n\n/** The OpenAPI 3.1 document of the Panneau HTTP API. */\nexport function createOpenApiDocument(): JsonObject {\n return {\n openapi: '3.1.0',\n info: {\n title: 'Panneau protocol',\n version: String(PROTOCOL_VERSION),\n description:\n 'The HTTP API between a Panneau frontend and its backend. Paths are relative to `api.baseUrl` of the definition. Authentication is up to the backend (session cookie or bearer token). Errors use `application/problem+json`.',\n },\n paths: {\n '/definition': {\n get: {\n operationId: 'getDefinition',\n summary: 'The definition for the current user, in the current locale.',\n responses: {\n 200: ok('The definition.', ref('Definition')),\n ...problems(401, 403),\n },\n },\n },\n '/resources/{resource}': {\n parameters: [resource],\n get: {\n operationId: 'listItems',\n parameters: listParameters,\n responses: {\n 200: ok('A page of items.', ref('ListResponse')),\n ...problems(401, 403, 404),\n },\n },\n post: {\n operationId: 'createItem',\n requestBody: { required: true, content: json(values) },\n responses: {\n 201: ok('The created item.', ref('ItemResponse'), etag),\n ...problems(401, 403, 404, 409, 422),\n },\n },\n },\n '/resources/{resource}/{id}': {\n parameters: [resource, id],\n get: {\n operationId: 'getItem',\n responses: {\n 200: ok('The item.', ref('ItemResponse'), etag),\n ...problems(401, 403, 404),\n },\n },\n patch: {\n operationId: 'updateItem',\n description: 'Partial update: only the values sent are changed.',\n parameters: [\n {\n name: 'If-Match',\n in: 'header',\n required: false,\n description: 'The version the client edited.',\n schema: { type: 'string' },\n },\n ],\n requestBody: { required: true, content: json(values) },\n responses: {\n 200: ok('The updated item.', ref('ItemResponse'), etag),\n ...problems(401, 403, 404, 409, 412, 422),\n },\n },\n delete: {\n operationId: 'deleteItem',\n responses: { 204: ok('Deleted.'), ...problems(401, 403, 404, 409) },\n },\n },\n '/resources/{resource}/{id}/preview': {\n parameters: [resource, id],\n post: {\n operationId: 'previewItem',\n requestBody: { required: true, content: json(values) },\n responses: {\n 200: ok('A short-lived preview URL.', ref('PreviewResponse')),\n ...problems(401, 403, 404, 422),\n },\n },\n },\n '/resources/{resource}/actions/{action}': {\n parameters: [resource, pathParameter('action', 'Action id.')],\n post: {\n operationId: 'runAction',\n requestBody: {\n required: true,\n content: {\n ...json(ref('ActionRequest')),\n 'multipart/form-data': { schema: ref('ActionRequest') },\n },\n },\n responses: {\n 200: ok('The result.', ref('ActionResult')),\n 202: ok('The action runs in the background.', ref('ActionRunResponse')),\n ...problems(400, 401, 403, 404, 409, 422),\n },\n },\n },\n '/actions/runs': {\n get: {\n operationId: 'listActionRuns',\n summary: \"The current user's recent runs.\",\n responses: {\n 200: ok('Runs, newest first.', {\n type: 'object',\n required: ['data'],\n properties: { data: { type: 'array', items: ref('ActionRun') } },\n }),\n ...problems(401),\n },\n },\n },\n '/actions/runs/{run}': {\n parameters: [pathParameter('run', 'Run id.')],\n get: {\n operationId: 'getActionRun',\n responses: {\n 200: ok('The run.', ref('ActionRunResponse')),\n ...problems(401, 403, 404),\n },\n },\n delete: {\n operationId: 'cancelActionRun',\n responses: { 204: ok('Cancelled.'), ...problems(401, 403, 404, 409) },\n },\n },\n '/media': {\n get: {\n operationId: 'listMedia',\n parameters: listParameters,\n responses: {\n 200: ok('A page of media.', ref('MediaListResponse')),\n ...problems(401, 403),\n },\n },\n post: {\n operationId: 'uploadMedia',\n requestBody: {\n required: true,\n content: {\n 'multipart/form-data': {\n schema: {\n type: 'object',\n required: ['file'],\n properties: {\n file: {\n type: 'string',\n contentMediaType: 'application/octet-stream',\n },\n name: { type: 'string' },\n tags: { type: 'array', items: { type: 'string' } },\n },\n },\n },\n },\n },\n responses: {\n 201: ok('The created media.', ref('MediaResponse')),\n ...problems(401, 403, 422),\n },\n },\n },\n '/media/tags': {\n get: {\n operationId: 'listMediaTags',\n responses: {\n 200: ok('Tags in use.', {\n type: 'object',\n required: ['data'],\n properties: { data: { type: 'array', items: { type: 'string' } } },\n }),\n ...problems(401, 403),\n },\n },\n },\n '/media/{id}': {\n parameters: [pathParameter('id', 'Media id.')],\n get: {\n operationId: 'getMedia',\n responses: {\n 200: ok('The media.', ref('MediaResponse')),\n ...problems(401, 403, 404),\n },\n },\n patch: {\n operationId: 'updateMedia',\n description: 'Updates metadata, tags or the image `transform`.',\n requestBody: { required: true, content: json(values) },\n responses: {\n 200: ok('The updated media.', ref('MediaResponse')),\n ...problems(401, 403, 404, 422),\n },\n },\n delete: {\n operationId: 'deleteMedia',\n responses: { 204: ok('Moved to the trash.'), ...problems(401, 403, 404, 409) },\n },\n },\n '/media/{id}/file': {\n parameters: [pathParameter('id', 'Media id.')],\n post: {\n operationId: 'replaceMediaFile',\n requestBody: {\n required: true,\n content: {\n 'multipart/form-data': {\n schema: {\n type: 'object',\n required: ['file'],\n properties: {\n file: {\n type: 'string',\n contentMediaType: 'application/octet-stream',\n },\n },\n },\n },\n },\n },\n responses: {\n 200: ok('The media.', ref('MediaResponse')),\n ...problems(401, 403, 404, 422),\n },\n },\n },\n '/media/{id}/restore': {\n parameters: [pathParameter('id', 'Media id.')],\n post: {\n operationId: 'restoreMedia',\n responses: {\n 200: ok('The restored media.', ref('MediaResponse')),\n ...problems(401, 403, 404),\n },\n },\n },\n '/auth/session': {\n get: {\n operationId: 'getSession',\n responses: { 200: ok('The current user.', ref('Session')), ...problems(401) },\n },\n },\n '/auth/login': {\n post: {\n operationId: 'login',\n requestBody: {\n required: true,\n content: json({\n type: 'object',\n required: ['email', 'password'],\n properties: {\n email: { type: 'string' },\n password: { type: 'string' },\n remember: { type: 'boolean' },\n },\n }),\n },\n responses: {\n 200: ok('Logged in.', ref('Session')),\n 202: ok(\n 'A second factor is required: answer `/auth/two-factor/challenge`.',\n {\n type: 'object',\n properties: { twoFactor: { type: 'boolean', const: true } },\n },\n ),\n ...problems(422),\n },\n },\n },\n '/auth/logout': {\n post: { operationId: 'logout', responses: { 204: ok('Logged out.') } },\n },\n '/auth/providers/{provider}/redirect': {\n parameters: [pathParameter('provider', 'Provider id.')],\n get: {\n operationId: 'redirectToProvider',\n parameters: [\n queryParameter('next', 'Local path to go to after login.', {\n type: 'string',\n }),\n ],\n responses: {\n 302: { description: 'Redirect to the provider.' },\n ...problems(404),\n },\n },\n },\n '/auth/password/forgot': {\n post: {\n operationId: 'forgotPassword',\n requestBody: {\n required: true,\n content: json({\n type: 'object',\n required: ['email'],\n properties: { email: { type: 'string' } },\n }),\n },\n responses: {\n 204: ok('A reset link was sent, if the account exists.'),\n ...problems(422),\n },\n },\n },\n '/auth/password/reset': {\n post: {\n operationId: 'resetPassword',\n requestBody: {\n required: true,\n content: json({\n type: 'object',\n required: ['token', 'email', 'password'],\n properties: {\n token: { type: 'string' },\n email: { type: 'string' },\n password: { type: 'string' },\n },\n }),\n },\n responses: { 204: ok('The password was reset.'), ...problems(422) },\n },\n },\n '/auth/two-factor/challenge': {\n post: {\n operationId: 'twoFactorChallenge',\n requestBody: {\n required: true,\n content: json({\n type: 'object',\n properties: {\n code: { type: 'string' },\n recoveryCode: { type: 'string' },\n },\n }),\n },\n responses: { 200: ok('Logged in.', ref('Session')), ...problems(422) },\n },\n },\n '/auth/passkeys/options': {\n post: {\n operationId: 'passkeyOptions',\n responses: {\n 200: ok('WebAuthn request options.', {\n type: 'object',\n additionalProperties: true,\n }),\n },\n },\n },\n '/auth/passkeys/login': {\n post: {\n operationId: 'passkeyLogin',\n requestBody: {\n required: true,\n content: json({ type: 'object', additionalProperties: true }),\n },\n responses: { 200: ok('Logged in.', ref('Session')), ...problems(422) },\n },\n },\n '/account': {\n get: {\n operationId: 'getAccount',\n responses: {\n 200: ok('The current user.', {\n type: 'object',\n required: ['data'],\n properties: { data: ref('User') },\n }),\n ...problems(401),\n },\n },\n patch: {\n operationId: 'updateAccount',\n requestBody: { required: true, content: json(values) },\n responses: {\n 200: ok('The updated user.', {\n type: 'object',\n required: ['data'],\n properties: { data: ref('User') },\n }),\n ...problems(401, 422),\n },\n },\n },\n '/search': {\n get: {\n operationId: 'search',\n parameters: [\n {\n ...queryParameter('q', 'Search terms.', { type: 'string' }),\n required: true,\n },\n ],\n responses: {\n 200: ok('Results grouped by resource.', ref('SearchResponse')),\n ...problems(401),\n },\n },\n },\n '/dashboard/widgets/{widget}': {\n parameters: [pathParameter('widget', 'Widget id.')],\n get: {\n operationId: 'getWidgetData',\n responses: {\n 200: ok(\"The widget's data. Its shape depends on the widget type.\", {\n type: 'object',\n additionalProperties: true,\n }),\n ...problems(401, 403, 404),\n },\n },\n },\n },\n components: { schemas: createComponentSchemas() },\n };\n}\n"],"mappings":";;;;;;;AAUA,IAAM,OAAO,QAA4B,EAAE,MAAM,wBAAwB,KAAK;AAE9E,IAAM,QAAQ,YAAoC,EAAE,oBAAoB,EAAE,OAAO,EAAE;AAEnF,IAAM,MAAM,aAAqB,QAAqB,aAAsC;CACxF;CACA,GAAI,WAAW,KAAA,IAAY,EAAE,SAAS,KAAK,MAAM,EAAE,IAAI,CAAC;CACxD,GAAI,YAAY,KAAA,IAAY,EAAE,QAAQ,IAAI,CAAC;AAC/C;AAEA,IAAM,WAAmC;CACrC,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;AACT;AAEA,SAAS,SAAS,GAAG,UAAgC;CACjD,OAAO,OAAO,YACV,SAAS,KAAK,WAAW,CACrB,OAAO,MAAM,GACb;EACI,aAAa,SAAS;EACtB,SAAS,GAAG,uBAAuB,EAAE,QAAQ,IAAI,SAAS,EAAE,EAAE;CAClE,CACJ,CAAC,CACL;AACJ;AAEA,IAAM,OAAO,EAAE,MAAM;CAAE,aAAa;CAA4B,QAAQ,EAAE,MAAM,SAAS;AAAE,EAAE;AAE7F,IAAM,iBAAiB,MAAc,iBAAqC;CACtE;CACA,IAAI;CACJ,UAAU;CACV;CACA,QAAQ,EAAE,MAAM,SAAS;AAC7B;AAEA,IAAM,kBAAkB,MAAc,aAAqB,YAAoC;CAC3F;CACA,IAAI;CACJ,UAAU;CACV;CACA;AACJ;AAEA,IAAM,iBAAiB;CACnB,eAAe,QAAQ,wBAAwB;EAAE,MAAM;EAAW,SAAS;CAAE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AU,sBAAsB;KAAK,CAAC;IAChE;IACA,WAAW;KAAE,KAAK,GAAG,cAAc,IAAI,SAAS,CAAC;KAAG,GAAG,SAAS,GAAG;IAAE;GACzE,EACJ;GACA,YAAY;IACR,KAAK;KACD,aAAa;KACb,WAAW;MACP,KAAK,GAAG,qBAAqB;OACzB,MAAM;OACN,UAAU,CAAC,MAAM;OACjB,YAAY,EAAE,MAAM,IAAI,MAAM,EAAE;MACpC,CAAC;MACD,GAAG,SAAS,GAAG;KACnB;IACJ;IACA,OAAO;KACH,aAAa;KACb,aAAa;MAAE,UAAU;MAAM,SAAS,KAAK,MAAM;KAAE;KACrD,WAAW;MACP,KAAK,GAAG,qBAAqB;OACzB,MAAM;OACN,UAAU,CAAC,MAAM;OACjB,YAAY,EAAE,MAAM,IAAI,MAAM,EAAE;MACpC,CAAC;MACD,GAAG,SAAS,KAAK,GAAG;KACxB;IACJ;GACJ;GACA,WAAW,EACP,KAAK;IACD,aAAa;IACb,YAAY,CACR;KACI,GAAG,eAAe,KAAK,iBAAiB,EAAE,MAAM,SAAS,CAAC;KAC1D,UAAU;IACd,CACJ;IACA,WAAW;KACP,KAAK,GAAG,gCAAgC,IAAI,gBAAgB,CAAC;KAC7D,GAAG,SAAS,GAAG;IACnB;GACJ,EACJ;GACA,+BAA+B;IAC3B,YAAY,CAAC,cAAc,UAAU,YAAY,CAAC;IAClD,KAAK;KACD,aAAa;KACb,WAAW;MACP,KAAK,GAAG,4DAA4D;OAChE,MAAM;OACN,sBAAsB;MAC1B,CAAC;MACD,GAAG,SAAS,KAAK,KAAK,GAAG;KAC7B;IACJ;GACJ;EACJ;EACA,YAAY,EAAE,SAAS,uBAAuB,EAAE;CACpD;AACJ"}
|
|
1
|
+
{"version":3,"file":"openapi.js","names":[],"sources":["../src/openapi.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport {\n AUTH_PAGE_PATHS,\n CONTEXT_HEADER,\n CONTEXT_PROBLEM_TYPE,\n EMAIL_UNVERIFIED_PROBLEM_TYPE,\n PASSWORD_CONFIRMATION_PROBLEM_TYPE,\n TWO_FACTOR_REQUIRED_PROBLEM_TYPE,\n} from './constants';\nimport { createSchemaRegistry } from './schemas';\nimport { BootConfig } from './schemas/boot';\nimport { Definition } from './schemas/definition';\nimport { Theme } from './schemas/theme';\nimport {\n SEARCH_DEFAULT_LIMIT,\n SEARCH_MAX_LENGTH,\n SEARCH_MAX_LIMIT,\n SEARCH_MIN_LENGTH,\n} from './search';\nimport { PROBLEM_CONTENT_TYPE, PROTOCOL_VERSION } from './version';\n\ntype JsonObject = Record<string, unknown>;\n\nconst ref = (id: string): JsonObject => ({ $ref: `#/components/schemas/${id}` });\n\nconst json = (schema: JsonObject): JsonObject => ({ 'application/json': { schema } });\n\nconst ok = (description: string, schema?: JsonObject, headers?: JsonObject): JsonObject => ({\n description,\n ...(schema !== undefined ? { content: json(schema) } : {}),\n ...(headers !== undefined ? { headers } : {}),\n});\n\nconst PROBLEMS: Record<number, string> = {\n 400: 'Bad request, such as a dry run of an action that does not declare `dryRun`.',\n 401: 'Not authenticated.',\n 403: `Not allowed. A value of \\`${CONTEXT_HEADER}\\` that the user can't use is a problem of type \\`${CONTEXT_PROBLEM_TYPE}\\`, with its \\`param\\`. With \\`auth.emailVerification\\`, a user whose email address isn't verified gets a problem of type \\`${EMAIL_UNVERIFIED_PROBLEM_TYPE}\\` on every operation but those of the auth. A user who must have two-factor authentication and hasn't set it up gets a problem of type \\`${TWO_FACTOR_REQUIRED_PROBLEM_TYPE}\\` on every operation but those of the auth and of \\`/account/two-factor\\`.`,\n 404: 'Not found.',\n 409: 'Conflict with a business rule.',\n 412: 'Version conflict: `If-Match` does not match the current version, which is in `current`.',\n 422: 'Invalid values: messages are in `errors`, keyed by dot path.',\n 423: `The password must be confirmed first (\\`POST /auth/password/confirm\\`): a problem of type \\`${PASSWORD_CONFIRMATION_PROBLEM_TYPE}\\`.`,\n 429: 'Too many requests: `Retry-After` gives the seconds to wait.',\n 500: 'Server error, such as a widget whose data does not have the shape of its type.',\n};\n\nfunction problems(...statuses: number[]): JsonObject {\n return Object.fromEntries(\n statuses.map((status) => [\n String(status),\n {\n description: PROBLEMS[status],\n content: { [PROBLEM_CONTENT_TYPE]: { schema: ref('Problem') } },\n },\n ]),\n );\n}\n\nconst etag = { ETag: { description: 'The version of the item.', schema: { type: 'string' } } };\n\nconst pathParameter = (name: string, description: string): JsonObject => ({\n name,\n in: 'path',\n required: true,\n description,\n schema: { type: 'string' },\n});\n\nconst queryParameter = (name: string, description: string, schema: JsonObject): JsonObject => ({\n name,\n in: 'query',\n required: false,\n description,\n schema,\n});\n\nconst listParameters = [\n queryParameter('page', 'Page number, from 1.', { type: 'integer', minimum: 1 }),\n queryParameter('perPage', 'Items per page.', { type: 'integer', minimum: 1 }),\n queryParameter(\n 'cursor',\n 'Lists whose `pagination` is `cursor`: the `nextCursor` (or `previousCursor`) of a page, instead of `page`.',\n { type: 'string' },\n ),\n queryParameter('sort', 'Comma-separated fields; a `-` prefix sorts descending.', {\n type: 'string',\n }),\n {\n name: 'filter',\n in: 'query',\n required: false,\n style: 'deepObject',\n explode: true,\n description:\n '`filter[status]=published`; `filter[tags][]=a&filter[tags][]=b` for any of several values; `filter[published_at][from]=2026-01-01&filter[published_at][to]=2026-01-31` for the inclusive bounds of a range filter (`date-range`), without the open end.',\n schema: { type: 'object', additionalProperties: true },\n },\n queryParameter('q', 'Search.', { type: 'string' }),\n queryParameter('fields', 'Comma-separated fields to include in each item.', { type: 'string' }),\n];\n\nconst resource = pathParameter('resource', 'Resource id.');\nconst id = pathParameter('id', 'Item id.');\nconst values = { type: 'object', additionalProperties: true };\n\n/** Component schemas, generated from the protocol's Zod schemas. */\nexport function createComponentSchemas(): Record<string, JsonObject> {\n const { schemas } = z.toJSONSchema(createSchemaRegistry(), {\n io: 'input',\n uri: (schemaId) => `#/components/schemas/${schemaId}`,\n });\n return Object.fromEntries(\n Object.entries(schemas).map(([schemaId, schema]) => {\n const { $schema: _schema, $id: _id, ...rest } = schema as JsonObject;\n return [schemaId, rest];\n }),\n );\n}\n\n/** The JSON Schema of the definition (`GET /definition`). */\nexport function createDefinitionJsonSchema(): JsonObject {\n return {\n $id: 'https://github.com/folkloreinc/panneau-js/blob/v5.x/packages/protocol/schema/definition.schema.json',\n ...(z.toJSONSchema(Definition, {\n io: 'input',\n metadata: createSchemaRegistry(),\n }) as JsonObject),\n };\n}\n\n/** The JSON Schema of a theme, for themes written as JSON files. */\nexport function createThemeJsonSchema(): JsonObject {\n return {\n $id: 'https://github.com/folkloreinc/panneau-js/blob/v5.x/packages/protocol/schema/theme.schema.json',\n ...(z.toJSONSchema(Theme, {\n io: 'input',\n metadata: createSchemaRegistry(),\n }) as JsonObject),\n };\n}\n\n/** The JSON Schema of the boot config, which a server writes in the page of the app. */\nexport function createBootConfigJsonSchema(): JsonObject {\n return {\n $id: 'https://github.com/folkloreinc/panneau-js/blob/v5.x/packages/protocol/schema/boot.schema.json',\n ...(z.toJSONSchema(BootConfig, {\n io: 'input',\n metadata: createSchemaRegistry(),\n }) as JsonObject),\n };\n}\n\n/** The `Panneau-Context` header, which every operation takes (decision 0045). */\nconst contextHeader: JsonObject = {\n name: CONTEXT_HEADER,\n in: 'header',\n required: false,\n description:\n 'The values of the current context, when the definition has `context`: the format of a query string, in the order of its params (`client=4&contest=12`). Responses vary with it.',\n schema: { type: 'string' },\n};\n\nconst METHODS = ['get', 'post', 'put', 'patch', 'delete'];\n\n/**\n * Adds the `Panneau-Context` header to the parameters of every path, and its `403` problem to\n * every operation that doesn't have one: a value the user can't use is refused everywhere.\n */\nfunction withContextHeader(paths: Record<string, JsonObject>): Record<string, JsonObject> {\n const parameter = { $ref: '#/components/parameters/Context' };\n return Object.fromEntries(\n Object.entries(paths).map(([path, item]) => [\n path,\n {\n ...Object.fromEntries(\n Object.entries(item).map(([key, operation]) => {\n if (!METHODS.includes(key)) {\n return [key, operation];\n }\n const { responses = {}, ...rest } = operation as JsonObject;\n return [\n key,\n {\n ...rest,\n responses: { ...problems(403), ...(responses as JsonObject) },\n },\n ];\n }),\n ),\n parameters: [...((item.parameters as JsonObject[] | undefined) ?? []), parameter],\n },\n ]),\n );\n}\n\n/** The OpenAPI 3.1 document of the Panneau HTTP API. */\nexport function createOpenApiDocument(): JsonObject {\n return {\n openapi: '3.1.0',\n info: {\n title: 'Panneau protocol',\n version: String(PROTOCOL_VERSION),\n description:\n 'The HTTP API between a Panneau frontend and its backend. Paths are relative to `api.baseUrl` of the definition. Authentication is up to the backend (session cookie or bearer token). Errors use `application/problem+json`.',\n },\n paths: withContextHeader({\n '/definition': {\n get: {\n operationId: 'getDefinition',\n summary:\n 'The definition for the current user, in the current locale, and for the values of `Panneau-Context`.',\n responses: {\n 200: ok('The definition.', ref('Definition')),\n ...problems(401, 403),\n },\n },\n },\n '/context/{param}/options': {\n parameters: [pathParameter('param', 'The name of a param of the context.')],\n get: {\n operationId: 'getContextOptions',\n summary:\n 'The choices of a param of the context without inline `options`, for the values of the params before it in `Panneau-Context`.',\n parameters: [queryParameter('q', 'Search terms.', { type: 'string' })],\n responses: {\n 200: ok(\n 'The first choices that match `q`, in the order to show them.',\n ref('ContextOptionsResponse'),\n ),\n ...problems(401, 403, 404),\n },\n },\n },\n '/resources/{resource}': {\n parameters: [resource],\n get: {\n operationId: 'listItems',\n parameters: listParameters,\n responses: {\n 200: ok('A page of items.', ref('ListResponse')),\n // A `cursor` the backend can't read (decision 0039)\n ...problems(401, 403, 404, 422),\n },\n },\n post: {\n operationId: 'createItem',\n requestBody: { required: true, content: json(values) },\n responses: {\n 201: ok('The created item.', ref('ItemResponse'), etag),\n ...problems(401, 403, 404, 409, 422),\n },\n },\n },\n '/resources/{resource}/{id}': {\n parameters: [resource, id],\n get: {\n operationId: 'getItem',\n responses: {\n 200: ok('The item.', ref('ItemResponse'), etag),\n ...problems(401, 403, 404),\n },\n },\n patch: {\n operationId: 'updateItem',\n description: 'Partial update: only the values sent are changed.',\n parameters: [\n {\n name: 'If-Match',\n in: 'header',\n required: false,\n description: 'The version the client edited.',\n schema: { type: 'string' },\n },\n ],\n requestBody: { required: true, content: json(values) },\n responses: {\n 200: ok('The updated item.', ref('ItemResponse'), etag),\n ...problems(401, 403, 404, 409, 412, 422),\n },\n },\n delete: {\n operationId: 'deleteItem',\n responses: { 204: ok('Deleted.'), ...problems(401, 403, 404, 409) },\n },\n },\n '/resources/{resource}/{id}/duplicate': {\n parameters: [resource, id],\n post: {\n operationId: 'duplicateItem',\n description:\n 'Copies an item, for the built-in `duplicate` (decision 0040). Allowed on the items whose `abilities.duplicate` is `true`.',\n responses: {\n 201: ok('The copy, a new item.', ref('ItemResponse'), etag),\n ...problems(401, 403, 404),\n 409: {\n description:\n 'The copy conflicts with another item, such as a unique value.',\n content: { [PROBLEM_CONTENT_TYPE]: { schema: ref('Problem') } },\n },\n },\n },\n },\n '/resources/{resource}/{id}/preview': {\n parameters: [resource, id],\n post: {\n operationId: 'previewItem',\n requestBody: { required: true, content: json(values) },\n responses: {\n 200: ok('A short-lived preview URL.', ref('PreviewResponse')),\n ...problems(401, 403, 404, 422),\n },\n },\n },\n '/resources/{resource}/actions/{action}': {\n parameters: [resource, pathParameter('action', 'Action id.')],\n post: {\n operationId: 'runAction',\n requestBody: {\n required: true,\n content: {\n ...json(ref('ActionRequest')),\n 'multipart/form-data': { schema: ref('ActionRequest') },\n },\n },\n responses: {\n 200: ok('The result.', ref('ActionResult')),\n 202: ok('The action runs in the background.', ref('ActionRunResponse')),\n ...problems(400, 401, 403, 404, 409, 422),\n },\n },\n },\n '/resources/{resource}/fields/{field}/check': {\n parameters: [resource, pathParameter('field', 'Name of a field with `check`.')],\n post: {\n operationId: 'checkField',\n summary:\n 'Checks a value as it is typed: whether a slug is available, and its URL. With the permission to create, or to update the item `id`.',\n requestBody: { required: true, content: json(ref('FieldCheckRequest')) },\n responses: {\n 200: ok(\n 'What the backend says about the value.',\n ref('FieldCheckResponse'),\n ),\n ...problems(401, 403, 404, 422),\n },\n },\n },\n '/actions/runs': {\n get: {\n operationId: 'listActionRuns',\n summary: \"The current user's recent runs.\",\n responses: {\n 200: ok('Runs, newest first.', {\n type: 'object',\n required: ['data'],\n properties: { data: { type: 'array', items: ref('ActionRun') } },\n }),\n ...problems(401),\n },\n },\n },\n '/actions/runs/{run}': {\n parameters: [pathParameter('run', 'Run id.')],\n get: {\n operationId: 'getActionRun',\n responses: {\n 200: ok('The run.', ref('ActionRunResponse')),\n ...problems(401, 403, 404),\n },\n },\n delete: {\n operationId: 'cancelActionRun',\n responses: { 204: ok('Cancelled.'), ...problems(401, 403, 404, 409) },\n },\n },\n '/uploads/sign': {\n post: {\n operationId: 'signUpload',\n summary:\n \"Signs a request of the browser's S3 client. The first request of a file creates its upload.\",\n requestBody: { required: true, content: json(ref('UploadSignRequest')) },\n responses: {\n 200: ok('The presigned request.', ref('UploadSignResponse')),\n ...problems(401, 403, 404, 422),\n },\n },\n },\n '/uploads/{upload}/complete': {\n parameters: [pathParameter('upload', 'Upload id: `upl_…`.')],\n post: {\n operationId: 'completeUpload',\n summary:\n 'Once the browser completed the upload in storage, checks the object and gives the upload, which values reference.',\n requestBody: {\n required: false,\n content: json({\n type: 'object',\n properties: {\n name: {\n type: 'string',\n description:\n \"The file's name, which the key doesn't keep, since the backend chose it.\",\n },\n },\n }),\n },\n responses: {\n 200: ok('The upload.', ref('UploadResponse')),\n ...problems(401, 403, 404, 422),\n },\n },\n },\n '/auth/session': {\n get: {\n operationId: 'getSession',\n responses: { 200: ok('The current user.', ref('Session')), ...problems(401) },\n },\n },\n '/auth/login': {\n post: {\n operationId: 'login',\n requestBody: {\n required: true,\n content: json({\n description:\n 'An email and a password, or the single secret of `auth.token`.',\n oneOf: [\n {\n type: 'object',\n required: ['email', 'password'],\n properties: {\n email: { type: 'string' },\n password: { type: 'string' },\n remember: { type: 'boolean' },\n },\n },\n {\n type: 'object',\n required: ['token'],\n properties: {\n token: { type: 'string' },\n remember: { type: 'boolean' },\n },\n },\n ],\n }),\n },\n responses: {\n 200: ok('Logged in.', ref('Session')),\n 202: ok(\n 'A second factor is required: answer `/auth/two-factor/challenge`.',\n ref('TwoFactorChallenge'),\n ),\n ...problems(422, 429),\n },\n },\n },\n '/auth/logout': {\n post: {\n operationId: 'logout',\n description:\n '`panneau` auth mode. In `external` mode, the browser goes to `auth.logoutUrl` instead.',\n responses: { 204: ok('Logged out.') },\n },\n },\n '/auth/providers/{provider}/redirect': {\n parameters: [pathParameter('provider', 'Provider id.')],\n get: {\n operationId: 'redirectToProvider',\n summary:\n \"Starts the login with an OAuth provider of `auth.providers`. The callback is the backend's: it goes to `next`, or to the base path of the app with `authError` when it fails.\",\n parameters: [\n queryParameter(\n 'next',\n 'Where to go after the login: a local path under the base path of the app. Another one is ignored.',\n {\n type: 'string',\n },\n ),\n ],\n responses: {\n 302: { description: 'Redirect to the provider.' },\n ...problems(404),\n },\n },\n },\n '/auth/providers/{provider}/callback': {\n parameters: [pathParameter('provider', 'Provider id.')],\n get: {\n operationId: 'providerCallback',\n summary:\n \"Optional: the callback of the provider, when the backend has it here. Its URL is the backend's, registered with the provider; the app never calls it.\",\n responses: {\n 302: {\n description:\n 'To `next`, or to the base path of the app with `authError` when the login failed.',\n },\n ...problems(404),\n },\n },\n },\n '/auth/password/forgot': {\n post: {\n operationId: 'forgotPassword',\n summary: `With \\`auth.passwordReset\\`: emails a link to the page of the app at \\`{basePath}/${AUTH_PAGE_PATHS.resetPassword}?token=…&email=…\\`.`,\n requestBody: {\n required: true,\n content: json({\n type: 'object',\n required: ['email'],\n properties: { email: { type: 'string' } },\n }),\n },\n responses: {\n 204: ok(\n \"A reset link was sent, if the address has an account. The answer is the same when it hasn't, or when a link was sent recently.\",\n ),\n ...problems(422, 429),\n },\n },\n },\n '/auth/password/reset': {\n post: {\n operationId: 'resetPassword',\n summary:\n 'With `auth.passwordReset`: sets a new password, with the token and the email of the link. It does not log in.',\n requestBody: {\n required: true,\n content: json({\n type: 'object',\n required: ['token', 'email', 'password'],\n properties: {\n token: { type: 'string' },\n email: { type: 'string' },\n password: { type: 'string' },\n },\n }),\n },\n responses: {\n 204: ok('The password was reset.'),\n ...problems(422, 429),\n },\n },\n },\n '/auth/email/verification': {\n post: {\n operationId: 'sendEmailVerification',\n summary: `With \\`auth.emailVerification\\`: emails the current user a link to the page of the app at \\`{basePath}/${AUTH_PAGE_PATHS.verifyEmail}?token=…\\`.`,\n responses: {\n 204: ok('A link was sent, or the address is already verified.'),\n ...problems(401, 429),\n },\n },\n },\n '/auth/email/verify': {\n post: {\n operationId: 'verifyEmail',\n summary:\n 'With `auth.emailVerification`: verifies the address of the token of a link. The user does not need to be logged in.',\n requestBody: {\n required: true,\n content: json({\n type: 'object',\n required: ['token'],\n properties: { token: { type: 'string' } },\n }),\n },\n responses: {\n 204: ok('The address is verified.'),\n ...problems(422, 429),\n },\n },\n },\n '/auth/two-factor/challenge': {\n post: {\n operationId: 'twoFactorChallenge',\n summary:\n 'Ends a login that answered `202`, with a code of the authenticator app or a recovery code. A login that is no longer pending is a `422`.',\n requestBody: {\n required: true,\n content: json({\n oneOf: [\n {\n type: 'object',\n required: ['code'],\n properties: { code: { type: 'string' } },\n },\n {\n type: 'object',\n required: ['recoveryCode'],\n properties: { recoveryCode: { type: 'string' } },\n },\n ],\n }),\n },\n responses: {\n 200: ok('Logged in.', ref('Session')),\n ...problems(422, 429),\n },\n },\n },\n '/auth/password/confirm': {\n post: {\n operationId: 'confirmPassword',\n summary:\n 'Confirms the password of the current user, for the operations that answer `423`.',\n requestBody: {\n required: true,\n content: json({\n type: 'object',\n required: ['password'],\n properties: { password: { type: 'string' } },\n }),\n },\n responses: {\n 204: ok('The password is confirmed.'),\n ...problems(401, 422, 429),\n },\n },\n },\n '/account/two-factor': {\n get: {\n operationId: 'getTwoFactor',\n summary: 'With `auth.twoFactor`: the two-factor authentication of the user.',\n responses: {\n 200: ok('Its status.', ref('TwoFactorStatus')),\n ...problems(401, 403),\n },\n },\n post: {\n operationId: 'enableTwoFactor',\n summary:\n 'Starts setting it up: a new secret, `pending` until `POST /account/two-factor/confirm`.',\n responses: {\n 200: ok(\n 'The secret to add to an authenticator app.',\n ref('TwoFactorSetup'),\n ),\n ...problems(401, 403, 409, 423),\n },\n },\n delete: {\n operationId: 'disableTwoFactor',\n summary: 'Turns it off. A `409` when the backend requires it for the user.',\n responses: {\n 204: ok('Turned off.'),\n ...problems(401, 403, 409, 423),\n },\n },\n },\n '/account/two-factor/confirm': {\n post: {\n operationId: 'confirmTwoFactor',\n requestBody: {\n required: true,\n content: json({\n type: 'object',\n required: ['code'],\n properties: { code: { type: 'string' } },\n }),\n },\n responses: {\n 200: ok('Turned on, with its recovery codes.', ref('RecoveryCodes')),\n ...problems(401, 403, 409, 422, 423),\n },\n },\n },\n '/account/two-factor/recovery-codes': {\n post: {\n operationId: 'regenerateRecoveryCodes',\n summary: 'New recovery codes, in place of the old ones.',\n responses: {\n 200: ok('The new codes.', ref('RecoveryCodes')),\n ...problems(401, 403, 409, 423),\n },\n },\n },\n '/auth/passkeys/options': {\n post: {\n operationId: 'passkeyLoginOptions',\n summary:\n 'With `auth.passkeys`: the options of `navigator.credentials.get()`, for any passkey of the site.',\n responses: {\n 200: ok('The options.', ref('WebAuthnOptions')),\n ...problems(429),\n },\n },\n },\n '/auth/passkeys/login': {\n post: {\n operationId: 'passkeyLogin',\n summary:\n 'Logs in with the credential of a passkey, in the JSON form of the WebAuthn spec. It does not ask for a second factor.',\n requestBody: {\n required: true,\n content: json({\n type: 'object',\n required: ['credential'],\n properties: {\n credential: { type: 'object', additionalProperties: true },\n remember: { type: 'boolean' },\n },\n }),\n },\n responses: {\n 200: ok('Logged in.', ref('Session')),\n ...problems(422, 429),\n },\n },\n },\n '/account/passkeys': {\n get: {\n operationId: 'listPasskeys',\n responses: {\n 200: ok('The passkeys of the current user.', {\n type: 'object',\n required: ['data'],\n properties: { data: { type: 'array', items: ref('Passkey') } },\n }),\n ...problems(401, 403),\n },\n },\n post: {\n operationId: 'addPasskey',\n summary:\n 'Adds a passkey, with the credential of `navigator.credentials.create()` for the options of `POST /account/passkeys/options`.',\n requestBody: {\n required: true,\n content: json({\n type: 'object',\n required: ['name', 'credential'],\n properties: {\n name: { type: 'string' },\n credential: { type: 'object', additionalProperties: true },\n },\n }),\n },\n responses: {\n 201: ok('The passkey.', {\n type: 'object',\n required: ['data'],\n properties: { data: ref('Passkey') },\n }),\n ...problems(401, 403, 409, 422, 423),\n },\n },\n },\n '/account/passkeys/options': {\n post: {\n operationId: 'passkeyRegistrationOptions',\n summary:\n \"The options of `navigator.credentials.create()`, for the current user. A `409` for a user who can't have passkeys.\",\n responses: {\n 200: ok('The options.', ref('WebAuthnOptions')),\n ...problems(401, 403, 409, 423),\n },\n },\n },\n '/account/passkeys/{passkey}': {\n parameters: [pathParameter('passkey', 'The id of the passkey.')],\n delete: {\n operationId: 'deletePasskey',\n responses: {\n 204: ok('Removed.'),\n ...problems(401, 403, 404, 423),\n },\n },\n },\n '/account': {\n get: {\n operationId: 'getAccount',\n summary: 'With `auth.account`: the current user.',\n responses: {\n 200: ok('The current user.', {\n type: 'object',\n required: ['data'],\n properties: { data: ref('User') },\n }),\n ...problems(401, 403),\n },\n },\n patch: {\n operationId: 'updateAccount',\n summary:\n 'Saves the name and the email of the current user. With `auth.emailVerification`, a new email is unverified, and gets a link.',\n requestBody: {\n required: true,\n content: json({\n type: 'object',\n properties: { name: { type: 'string' }, email: { type: 'string' } },\n }),\n },\n responses: {\n 200: ok('The updated user.', {\n type: 'object',\n required: ['data'],\n properties: { data: ref('User') },\n }),\n ...problems(401, 403, 422),\n },\n },\n },\n '/account/password': {\n put: {\n operationId: 'updatePassword',\n summary: 'Changes the password of the current user, with the current one.',\n requestBody: {\n required: true,\n content: json({\n type: 'object',\n required: ['currentPassword', 'password'],\n properties: {\n currentPassword: { type: 'string' },\n password: { type: 'string' },\n },\n }),\n },\n responses: {\n 204: ok('The password was changed.'),\n ...problems(401, 403, 422, 429),\n },\n },\n },\n '/search': {\n get: {\n operationId: 'search',\n parameters: [\n {\n ...queryParameter('q', 'Search terms, trimmed.', {\n type: 'string',\n minLength: SEARCH_MIN_LENGTH,\n maxLength: SEARCH_MAX_LENGTH,\n }),\n required: true,\n },\n queryParameter('limit', 'Items per resource.', {\n type: 'integer',\n minimum: 1,\n maximum: SEARCH_MAX_LIMIT,\n default: SEARCH_DEFAULT_LIMIT,\n }),\n queryParameter(\n 'resources',\n 'Comma-separated ids of the searchable resources to search. Defaults to every one.',\n { type: 'string' },\n ),\n ],\n responses: {\n 200: ok(\n `Results grouped by resource, in the order of the definition: at most \\`limit\\` items per resource, and ${SEARCH_MAX_LIMIT} in all.`,\n ref('SearchResponse'),\n ),\n ...problems(401, 422, 429),\n },\n },\n },\n '/embeds': {\n get: {\n operationId: 'resolveEmbed',\n parameters: [\n {\n ...queryParameter('url', 'The URL to embed.', { type: 'string' }),\n required: true,\n },\n ],\n responses: {\n 200: ok(\n \"The value of an `embed` field for the URL, from its provider's oEmbed.\",\n ref('EmbedResponse'),\n ),\n ...problems(401, 422, 429),\n },\n },\n },\n '/dashboard/widgets/{widget}': {\n parameters: [pathParameter('widget', 'Widget id.')],\n get: {\n operationId: 'getWidgetData',\n description:\n 'The data of a widget of the dashboard of the user, read as the user (decision 0064). The built-in `stat` and `list` on a resource (`settings.resource`) have none: clients read the list of the resource. A widget that is not in the dashboard of the user is a `404`; a `403` hides the widget.',\n responses: {\n 200: ok(\n \"The widget's data, in the shape of its type: `StatWidgetData`, `SeriesWidgetData` and `ListWidgetData` for the built-in types, the plugin's own object for others.\",\n {\n anyOf: [\n ref('StatWidgetData'),\n ref('SeriesWidgetData'),\n ref('ListWidgetData'),\n { type: 'object', additionalProperties: true },\n ],\n },\n ),\n ...problems(401, 403, 404, 500),\n },\n },\n },\n }),\n components: {\n schemas: createComponentSchemas(),\n parameters: { Context: contextHeader },\n },\n };\n}\n"],"mappings":";;;;;;;;;AAwBA,IAAM,OAAO,QAA4B,EAAE,MAAM,wBAAwB,KAAK;AAE9E,IAAM,QAAQ,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,cAAc,UAAU,YAAY,CAAC;IAClD,KAAK;KACD,aAAa;KACb,aACI;KACJ,WAAW;MACP,KAAK,GACD,sKACA,EACI,OAAO;OACH,IAAI,gBAAgB;OACpB,IAAI,kBAAkB;OACtB,IAAI,gBAAgB;OACpB;QAAE,MAAM;QAAU,sBAAsB;OAAK;MACjD,EACJ,CACJ;MACA,GAAG,SAAS,KAAK,KAAK,KAAK,GAAG;KAClC;IACJ;GACJ;EACJ,CAAC;EACD,YAAY;GACR,SAAS,uBAAuB;GAChC,YAAY,EAAE,SAAS,cAAc;EACzC;CACJ;AACJ"}
|
package/dist/problem.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Problem } from './schemas/api';
|
|
1
|
+
import type { Problem } from './schemas/api.js';
|
|
2
2
|
/**
|
|
3
3
|
* Whether a value is a problem details object (an API error). It checks the same shape as the
|
|
4
4
|
* `Problem` schema, without zod, so that UI packages can detect errors without loading the schemas.
|
package/dist/query.d.ts
CHANGED
|
@@ -18,12 +18,18 @@ export declare function isFilterRange(value: unknown): value is FilterRange;
|
|
|
18
18
|
* backend reads them. Numbers compare as numbers. Other values compare as strings, on the length of
|
|
19
19
|
* the bound, so that a day (`2026-01-31`) includes the times of that day (`2026-01-31T18:00:00Z`).
|
|
20
20
|
* An empty value is never in a range.
|
|
21
|
+
*
|
|
22
|
+
* A `daterange` value (`{ start, end }`) is in the range when it overlaps it: it starts on or
|
|
23
|
+
* before `to`, and ends on or after `from`. Its open bounds never limit the overlap (decision
|
|
24
|
+
* 0053).
|
|
21
25
|
*/
|
|
22
26
|
export declare function matchesFilterRange(value: unknown, range: FilterRange): boolean;
|
|
23
27
|
/** Query of a list request (`GET /resources/{resource}`). */
|
|
24
28
|
export interface ListQuery {
|
|
25
29
|
page?: number;
|
|
26
30
|
perPage?: number;
|
|
31
|
+
/** The page to get of a list whose `pagination` is `cursor`: `nextCursor` of the page before. */
|
|
32
|
+
cursor?: string;
|
|
27
33
|
/** Fields to sort by, in order. A `-` prefix sorts descending. */
|
|
28
34
|
sort?: string[];
|
|
29
35
|
filter?: Record<string, FilterValue>;
|
|
@@ -38,4 +44,16 @@ export declare function toSearchParams(query: ListQuery): URLSearchParams;
|
|
|
38
44
|
* bounds of a range (`filter[id][from]`, `filter[id][to]`) become a `FilterRange`.
|
|
39
45
|
*/
|
|
40
46
|
export declare function fromSearchParams(params: URLSearchParams): ListQuery;
|
|
47
|
+
/** The meta of a page of a list paged with cursors (`pagination: "cursor"`). */
|
|
48
|
+
export interface CursorPageMeta {
|
|
49
|
+
perPage: number;
|
|
50
|
+
nextCursor: string | null;
|
|
51
|
+
previousCursor?: string | null;
|
|
52
|
+
total?: number | null;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Whether the meta of a page of a list comes from a list paged with cursors (`nextCursor`), rather
|
|
56
|
+
* than numbered pages (`page`, `lastPage`, `total`).
|
|
57
|
+
*/
|
|
58
|
+
export declare function isCursorPage(meta: object): meta is CursorPageMeta;
|
|
41
59
|
//# sourceMappingURL=query.d.ts.map
|
package/dist/query.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,WAAW;IACxB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,MAAM,WAAW,GACnB,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GAAG,WAAW,CAAC;AAE/E,8FAA8F;AAC9F,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAElE;
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAAA;;;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AED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,cAAc,CAEjE"}
|
package/dist/query.js
CHANGED
|
@@ -4,26 +4,43 @@ function isFilterRange(value) {
|
|
|
4
4
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
5
5
|
}
|
|
6
6
|
var RANGE_BOUNDS = ["from", "to"];
|
|
7
|
+
/** Compares a value with a bound: numbers as numbers, other values on the length of the bound. */
|
|
8
|
+
function compareBound(value, bound) {
|
|
9
|
+
if (typeof value === "number" || typeof bound === "number") return Number(value) - Number(bound);
|
|
10
|
+
const prefix = String(value).slice(0, bound.length);
|
|
11
|
+
return prefix < bound ? -1 : prefix > bound ? 1 : 0;
|
|
12
|
+
}
|
|
13
|
+
function isOpen(bound) {
|
|
14
|
+
return bound === void 0 || bound === "";
|
|
15
|
+
}
|
|
16
|
+
function isEmptyBound(value) {
|
|
17
|
+
return value === null || value === void 0 || value === "";
|
|
18
|
+
}
|
|
7
19
|
/**
|
|
8
20
|
* Whether a value is within the bounds of a range filter, both inclusive: the reference of how a
|
|
9
21
|
* backend reads them. Numbers compare as numbers. Other values compare as strings, on the length of
|
|
10
22
|
* the bound, so that a day (`2026-01-31`) includes the times of that day (`2026-01-31T18:00:00Z`).
|
|
11
23
|
* An empty value is never in a range.
|
|
24
|
+
*
|
|
25
|
+
* A `daterange` value (`{ start, end }`) is in the range when it overlaps it: it starts on or
|
|
26
|
+
* before `to`, and ends on or after `from`. Its open bounds never limit the overlap (decision
|
|
27
|
+
* 0053).
|
|
12
28
|
*/
|
|
13
29
|
function matchesFilterRange(value, range) {
|
|
14
|
-
if (value
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return
|
|
19
|
-
}
|
|
20
|
-
return (range.from
|
|
30
|
+
if (isEmptyBound(value)) return false;
|
|
31
|
+
if (typeof value === "object" && !Array.isArray(value) && value !== null) {
|
|
32
|
+
const { start, end } = value;
|
|
33
|
+
if (isEmptyBound(start) && isEmptyBound(end)) return false;
|
|
34
|
+
return (isOpen(range.from) || isEmptyBound(end) || compareBound(end, range.from) >= 0) && (isOpen(range.to) || isEmptyBound(start) || compareBound(start, range.to) <= 0);
|
|
35
|
+
}
|
|
36
|
+
return (isOpen(range.from) || compareBound(value, range.from) >= 0) && (isOpen(range.to) || compareBound(value, range.to) <= 0);
|
|
21
37
|
}
|
|
22
38
|
/** Serializes a list query to the protocol's query string format. */
|
|
23
39
|
function toSearchParams(query) {
|
|
24
40
|
const params = new URLSearchParams();
|
|
25
41
|
if (query.page !== void 0) params.set("page", String(query.page));
|
|
26
42
|
if (query.perPage !== void 0) params.set("perPage", String(query.perPage));
|
|
43
|
+
if (query.cursor !== void 0 && query.cursor !== "") params.set("cursor", query.cursor);
|
|
27
44
|
if (query.sort !== void 0 && query.sort.length > 0) params.set("sort", query.sort.join(","));
|
|
28
45
|
Object.entries(query.filter ?? {}).forEach(([key, value]) => {
|
|
29
46
|
if (Array.isArray(value)) value.forEach((item) => params.append(`filter[${key}][]`, String(item)));
|
|
@@ -52,6 +69,8 @@ function fromSearchParams(params) {
|
|
|
52
69
|
if (page !== void 0) query.page = page;
|
|
53
70
|
const perPage = integer(params.get("perPage"));
|
|
54
71
|
if (perPage !== void 0) query.perPage = perPage;
|
|
72
|
+
const cursor = params.get("cursor");
|
|
73
|
+
if (cursor !== null && cursor !== "") query.cursor = cursor;
|
|
55
74
|
const sort = params.get("sort");
|
|
56
75
|
if (sort !== null && sort !== "") query.sort = sort.split(",").filter((part) => part !== "");
|
|
57
76
|
const q = params.get("q");
|
|
@@ -74,7 +93,14 @@ function fromSearchParams(params) {
|
|
|
74
93
|
});
|
|
75
94
|
return query;
|
|
76
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Whether the meta of a page of a list comes from a list paged with cursors (`nextCursor`), rather
|
|
98
|
+
* than numbered pages (`page`, `lastPage`, `total`).
|
|
99
|
+
*/
|
|
100
|
+
function isCursorPage(meta) {
|
|
101
|
+
return "nextCursor" in meta;
|
|
102
|
+
}
|
|
77
103
|
//#endregion
|
|
78
|
-
export { fromSearchParams, isFilterRange, matchesFilterRange, toSearchParams };
|
|
104
|
+
export { fromSearchParams, isCursorPage, isFilterRange, matchesFilterRange, toSearchParams };
|
|
79
105
|
|
|
80
106
|
//# sourceMappingURL=query.js.map
|
package/dist/query.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.js","names":[],"sources":["../src/query.ts"],"sourcesContent":["/**\n * The bounds of a range filter (`date-range`), both inclusive. An open end is left out. Sent as\n * `filter[published_at][from]=2026-01-01&filter[published_at][to]=2026-01-31`.\n */\nexport interface FilterRange {\n from?: string | number;\n to?: string | number;\n}\n\n/**\n * The value of a filter: one value (`filter[status]=draft`), a list that matches any of its values\n * (`filter[tags][]=a&filter[tags][]=b`), or the bounds of a range.\n */\nexport type FilterValue =\n string | number | boolean | Array<string | number | boolean> | FilterRange;\n\n/** Whether a filter value is the bounds of a range, and not one value or a list of values. */\nexport function isFilterRange(value: unknown): value is FilterRange {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n\nconst RANGE_BOUNDS = ['from', 'to'] as const;\n\n/**\n * Whether a value is within the bounds of a range filter, both inclusive: the reference of how a\n * backend reads them. Numbers compare as numbers. Other values compare as strings, on the length of\n * the bound, so that a day (`2026-01-31`) includes the times of that day (`2026-01-31T18:00:00Z`).\n * An empty value is never in a range.\n */\nexport function matchesFilterRange(value: unknown, range: FilterRange): boolean {\n if (value === null || value === undefined || value === '') {\n return false;\n }\n const compare = (bound: string | number): number => {\n if (typeof value === 'number' || typeof bound === 'number') {\n return Number(value) - Number(bound);\n }\n const prefix = String(value).slice(0, bound.length);\n return prefix < bound ? -1 : prefix > bound ? 1 : 0;\n };\n return (\n (range.from === undefined || range.from === '' || compare(range.from) >= 0) &&\n (range.to === undefined || range.to === '' || compare(range.to) <= 0)\n );\n}\n\n/** Query of a list request (`GET /resources/{resource}`). */\nexport interface ListQuery {\n page?: number;\n perPage?: number;\n /** Fields to sort by, in order. A `-` prefix sorts descending. */\n sort?: string[];\n filter?: Record<string, FilterValue>;\n q?: string;\n /** Fields to include in each item. */\n fields?: string[];\n}\n\n/** Serializes a list query to the protocol's query string format. */\nexport function toSearchParams(query: ListQuery): URLSearchParams {\n const params = new URLSearchParams();\n if (query.page !== undefined) {\n params.set('page', String(query.page));\n }\n if (query.perPage !== undefined) {\n params.set('perPage', String(query.perPage));\n }\n if (query.sort !== undefined && query.sort.length > 0) {\n params.set('sort', query.sort.join(','));\n }\n Object.entries(query.filter ?? {}).forEach(([key, value]) => {\n if (Array.isArray(value)) {\n value.forEach((item) => params.append(`filter[${key}][]`, String(item)));\n } else if (isFilterRange(value)) {\n RANGE_BOUNDS.forEach((bound) => {\n const limit = value[bound];\n if (limit !== undefined && limit !== '') {\n params.set(`filter[${key}][${bound}]`, String(limit));\n }\n });\n } else {\n params.set(`filter[${key}]`, String(value));\n }\n });\n if (query.q !== undefined && query.q !== '') {\n params.set('q', query.q);\n }\n if (query.fields !== undefined && query.fields.length > 0) {\n params.set('fields', query.fields.join(','));\n }\n return params;\n}\n\nconst FILTER_KEY = /^filter\\[([^\\]]+)\\](?:\\[(|from|to)\\])?$/;\n\n/**\n * Parses a list query from the protocol's query string format. Filter values stay strings, and the\n * bounds of a range (`filter[id][from]`, `filter[id][to]`) become a `FilterRange`.\n */\nexport function fromSearchParams(params: URLSearchParams): ListQuery {\n const query: ListQuery = {};\n const integer = (value: string | null): number | undefined => {\n if (value === null || !/^\\d+$/.test(value)) {\n return undefined;\n }\n return Number.parseInt(value, 10);\n };\n const page = integer(params.get('page'));\n if (page !== undefined) {\n query.page = page;\n }\n const perPage = integer(params.get('perPage'));\n if (perPage !== undefined) {\n query.perPage = perPage;\n }\n const sort = params.get('sort');\n if (sort !== null && sort !== '') {\n query.sort = sort.split(',').filter((part) => part !== '');\n }\n const q = params.get('q');\n if (q !== null && q !== '') {\n query.q = q;\n }\n const fields = params.get('fields');\n if (fields !== null && fields !== '') {\n query.fields = fields.split(',').filter((part) => part !== '');\n }\n params.forEach((value, key) => {\n const match = FILTER_KEY.exec(key);\n if (match?.[1] === undefined) {\n return;\n }\n query.filter ??= {};\n const name = match[1];\n const current = query.filter[name];\n if (match[2] === '') {\n query.filter[name] = [...(Array.isArray(current) ? current : []), value];\n } else if (match[2] !== undefined) {\n if (value !== '') {\n query.filter[name] = {\n ...(isFilterRange(current) ? current : {}),\n [match[2]]: value,\n };\n }\n } else {\n query.filter[name] = value;\n }\n });\n return query;\n}\n"],"mappings":";;AAiBA,SAAgB,cAAc,OAAsC;CAChE,OAAO,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AAC9E;AAEA,IAAM,eAAe,CAAC,QAAQ,IAAI;;;;;;;AAQlC,SAAgB,mBAAmB,OAAgB,OAA6B;CAC5E,IAAI,UAAU,QAAQ,UAAU,KAAA,KAAa,UAAU,IACnD,OAAO;CAEX,MAAM,WAAW,UAAmC;EAChD,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,UAC9C,OAAO,OAAO,KAAK,IAAI,OAAO,KAAK;EAEvC,MAAM,SAAS,OAAO,KAAK,CAAC,CAAC,MAAM,GAAG,MAAM,MAAM;EAClD,OAAO,SAAS,QAAQ,KAAK,SAAS,QAAQ,IAAI;CACtD;CACA,QACK,MAAM,SAAS,KAAA,KAAa,MAAM,SAAS,MAAM,QAAQ,MAAM,IAAI,KAAK,OACxE,MAAM,OAAO,KAAA,KAAa,MAAM,OAAO,MAAM,QAAQ,MAAM,EAAE,KAAK;AAE3E;;AAeA,SAAgB,eAAe,OAAmC;CAC9D,MAAM,SAAS,IAAI,gBAAgB;CACnC,IAAI,MAAM,SAAS,KAAA,GACf,OAAO,IAAI,QAAQ,OAAO,MAAM,IAAI,CAAC;CAEzC,IAAI,MAAM,YAAY,KAAA,GAClB,OAAO,IAAI,WAAW,OAAO,MAAM,OAAO,CAAC;CAE/C,IAAI,M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AAK,MAAM,GAAG,CAAC,CAAC,QAAQ,SAAS,SAAS,EAAE;CAE7D,MAAM,IAAI,OAAO,IAAI,GAAG;CACxB,IAAI,MAAM,QAAQ,MAAM,IACpB,MAAM,IAAI;CAEd,MAAM,SAAS,OAAO,IAAI,QAAQ;CAClC,IAAI,WAAW,QAAQ,WAAW,IAC9B,MAAM,SAAS,OAAO,MAAM,GAAG,CAAC,CAAC,QAAQ,SAAS,SAAS,EAAE;CAEjE,OAAO,SAAS,OAAO,QAAQ;EAC3B,MAAM,QAAQ,WAAW,KAAK,GAAG;EACjC,IAAI,QAAQ,OAAO,KAAA,GACf;EAEJ,MAAM,WAAW,CAAC;EAClB,MAAM,OAAO,MAAM;EACnB,MAAM,UAAU,MAAM,OAAO;EAC7B,IAAI,MAAM,OAAO,IACb,MAAM,OAAO,QAAQ,CAAC,GAAI,MAAM,QAAQ,OAAO,IAAI,UAAU,CAAC,GAAI,KAAK;OACpE,IAAI,MAAM,OAAO,KAAA,GAChB;OAAA,UAAU,IACV,MAAM,OAAO,QAAQ;IACjB,GAAI,cAAc,OAAO,IAAI,UAAU,CAAC;KACvC,MAAM,KAAK;GAChB;EAAA,OAGJ,MAAM,OAAO,QAAQ;CAE7B,CAAC;CACD,OAAO;AACX"}
|
|
1
|
+
{"version":3,"file":"query.js","names":[],"sources":["../src/query.ts"],"sourcesContent":["/**\n * The bounds of a range filter (`date-range`), both inclusive. An open end is left out. Sent as\n * `filter[published_at][from]=2026-01-01&filter[published_at][to]=2026-01-31`.\n */\nexport interface FilterRange {\n from?: string | number;\n to?: string | number;\n}\n\n/**\n * The value of a filter: one value (`filter[status]=draft`), a list that matches any of its values\n * (`filter[tags][]=a&filter[tags][]=b`), or the bounds of a range.\n */\nexport type FilterValue =\n string | number | boolean | Array<string | number | boolean> | FilterRange;\n\n/** Whether a filter value is the bounds of a range, and not one value or a list of values. */\nexport function isFilterRange(value: unknown): value is FilterRange {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n\nconst RANGE_BOUNDS = ['from', 'to'] as const;\n\n/** Compares a value with a bound: numbers as numbers, other values on the length of the bound. */\nfunction compareBound(value: unknown, bound: string | number): number {\n if (typeof value === 'number' || typeof bound === 'number') {\n return Number(value) - Number(bound);\n }\n const prefix = String(value).slice(0, bound.length);\n return prefix < bound ? -1 : prefix > bound ? 1 : 0;\n}\n\nfunction isOpen(bound: string | number | undefined): bound is undefined | '' {\n return bound === undefined || bound === '';\n}\n\nfunction isEmptyBound(value: unknown): boolean {\n return value === null || value === undefined || value === '';\n}\n\n/**\n * Whether a value is within the bounds of a range filter, both inclusive: the reference of how a\n * backend reads them. Numbers compare as numbers. Other values compare as strings, on the length of\n * the bound, so that a day (`2026-01-31`) includes the times of that day (`2026-01-31T18:00:00Z`).\n * An empty value is never in a range.\n *\n * A `daterange` value (`{ start, end }`) is in the range when it overlaps it: it starts on or\n * before `to`, and ends on or after `from`. Its open bounds never limit the overlap (decision\n * 0053).\n */\nexport function matchesFilterRange(value: unknown, range: FilterRange): boolean {\n if (isEmptyBound(value)) {\n return false;\n }\n if (typeof value === 'object' && !Array.isArray(value) && value !== null) {\n const { start, end } = value as { start?: unknown; end?: unknown };\n if (isEmptyBound(start) && isEmptyBound(end)) {\n return false;\n }\n return (\n (isOpen(range.from) || isEmptyBound(end) || compareBound(end, range.from) >= 0) &&\n (isOpen(range.to) || isEmptyBound(start) || compareBound(start, range.to) <= 0)\n );\n }\n return (\n (isOpen(range.from) || compareBound(value, range.from) >= 0) &&\n (isOpen(range.to) || compareBound(value, range.to) <= 0)\n );\n}\n\n/** Query of a list request (`GET /resources/{resource}`). */\nexport interface ListQuery {\n page?: number;\n perPage?: number;\n /** The page to get of a list whose `pagination` is `cursor`: `nextCursor` of the page before. */\n cursor?: string;\n /** Fields to sort by, in order. A `-` prefix sorts descending. */\n sort?: string[];\n filter?: Record<string, FilterValue>;\n q?: string;\n /** Fields to include in each item. */\n fields?: string[];\n}\n\n/** Serializes a list query to the protocol's query string format. */\nexport function toSearchParams(query: ListQuery): URLSearchParams {\n const params = new URLSearchParams();\n if (query.page !== undefined) {\n params.set('page', String(query.page));\n }\n if (query.perPage !== undefined) {\n params.set('perPage', String(query.perPage));\n }\n if (query.cursor !== undefined && query.cursor !== '') {\n params.set('cursor', query.cursor);\n }\n if (query.sort !== undefined && query.sort.length > 0) {\n params.set('sort', query.sort.join(','));\n }\n Object.entries(query.filter ?? {}).forEach(([key, value]) => {\n if (Array.isArray(value)) {\n value.forEach((item) => params.append(`filter[${key}][]`, String(item)));\n } else if (isFilterRange(value)) {\n RANGE_BOUNDS.forEach((bound) => {\n const limit = value[bound];\n if (limit !== undefined && limit !== '') {\n params.set(`filter[${key}][${bound}]`, String(limit));\n }\n });\n } else {\n params.set(`filter[${key}]`, String(value));\n }\n });\n if (query.q !== undefined && query.q !== '') {\n params.set('q', query.q);\n }\n if (query.fields !== undefined && query.fields.length > 0) {\n params.set('fields', query.fields.join(','));\n }\n return params;\n}\n\nconst FILTER_KEY = /^filter\\[([^\\]]+)\\](?:\\[(|from|to)\\])?$/;\n\n/**\n * Parses a list query from the protocol's query string format. Filter values stay strings, and the\n * bounds of a range (`filter[id][from]`, `filter[id][to]`) become a `FilterRange`.\n */\nexport function fromSearchParams(params: URLSearchParams): ListQuery {\n const query: ListQuery = {};\n const integer = (value: string | null): number | undefined => {\n if (value === null || !/^\\d+$/.test(value)) {\n return undefined;\n }\n return Number.parseInt(value, 10);\n };\n const page = integer(params.get('page'));\n if (page !== undefined) {\n query.page = page;\n }\n const perPage = integer(params.get('perPage'));\n if (perPage !== undefined) {\n query.perPage = perPage;\n }\n const cursor = params.get('cursor');\n if (cursor !== null && cursor !== '') {\n query.cursor = cursor;\n }\n const sort = params.get('sort');\n if (sort !== null && sort !== '') {\n query.sort = sort.split(',').filter((part) => part !== '');\n }\n const q = params.get('q');\n if (q !== null && q !== '') {\n query.q = q;\n }\n const fields = params.get('fields');\n if (fields !== null && fields !== '') {\n query.fields = fields.split(',').filter((part) => part !== '');\n }\n params.forEach((value, key) => {\n const match = FILTER_KEY.exec(key);\n if (match?.[1] === undefined) {\n return;\n }\n query.filter ??= {};\n const name = match[1];\n const current = query.filter[name];\n if (match[2] === '') {\n query.filter[name] = [...(Array.isArray(current) ? current : []), value];\n } else if (match[2] !== undefined) {\n if (value !== '') {\n query.filter[name] = {\n ...(isFilterRange(current) ? current : {}),\n [match[2]]: value,\n };\n }\n } else {\n query.filter[name] = value;\n }\n });\n return query;\n}\n\n/** The meta of a page of a list paged with cursors (`pagination: \"cursor\"`). */\nexport interface CursorPageMeta {\n perPage: number;\n nextCursor: string | null;\n previousCursor?: string | null;\n total?: number | null;\n}\n\n/**\n * Whether the meta of a page of a list comes from a list paged with cursors (`nextCursor`), rather\n * than numbered pages (`page`, `lastPage`, `total`).\n */\nexport function isCursorPage(meta: object): meta is CursorPageMeta {\n return 'nextCursor' in meta;\n}\n"],"mappings":";;AAiBA,SAAgB,cAAc,OAAsC;CAChE,OAAO,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AAC9E;AAEA,IAAM,eAAe,CAAC,QAAQ,IAAI;;AAGlC,SAAS,aAAa,OAAgB,OAAgC;CAClE,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,UAC9C,OAAO,OAAO,KAAK,IAAI,OAAO,KAAK;CAEvC,MAAM,SAAS,OAAO,KAAK,CAAC,CAAC,MAAM,GAAG,MAAM,MAAM;CAClD,OAAO,SAAS,QAAQ,KAAK,SAAS,QAAQ,IAAI;AACtD;AAEA,SAAS,OAAO,OAA6D;CACzE,OAAO,UAAU,KAAA,KAAa,UAAU;AAC5C;AAEA,SAAS,aAAa,OAAyB;CAC3C,OAAO,UAAU,QAAQ,UAAU,KAAA,KAAa,UAAU;AAC9D;;;;;;;;;;;AAYA,SAAgB,mBAAmB,OAAgB,OAA6B;CAC5E,IAAI,aAAa,KAAK,GAClB,OAAO;CAEX,IAAI,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,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C;EAClB,MAAM,OAAO,MAAM;EACnB,MAAM,UAAU,MAAM,OAAO;EAC7B,IAAI,MAAM,OAAO,IACb,MAAM,OAAO,QAAQ,CAAC,GAAI,MAAM,QAAQ,OAAO,IAAI,UAAU,CAAC,GAAI,KAAK;OACpE,IAAI,MAAM,OAAO,KAAA,GAChB;OAAA,UAAU,IACV,MAAM,OAAO,QAAQ;IACjB,GAAI,cAAc,OAAO,IAAI,UAAU,CAAC;KACvC,MAAM,KAAK;GAChB;EAAA,OAGJ,MAAM,OAAO,QAAQ;CAE7B,CAAC;CACD,OAAO;AACX;;;;;AAcA,SAAgB,aAAa,MAAsC;CAC/D,OAAO,gBAAgB;AAC3B"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** The key of an item, and of the body of a create, that holds its type. */
|
|
2
|
+
export declare const ITEM_TYPE_KEY = "type";
|
|
3
|
+
/** Whether a resource has types: its items each have one, chosen when they are created. */
|
|
4
|
+
export declare function hasResourceTypes(resource: {
|
|
5
|
+
types?: readonly unknown[] | undefined;
|
|
6
|
+
}): boolean;
|
|
7
|
+
/** The type of a resource with this id, or `undefined` for one it doesn't have. */
|
|
8
|
+
export declare function getResourceType<T extends {
|
|
9
|
+
id: string;
|
|
10
|
+
}>(resource: {
|
|
11
|
+
types?: readonly T[] | undefined;
|
|
12
|
+
}, id: unknown): T | undefined;
|
|
13
|
+
/** The type of an item, read from its `type`, or `undefined` when its resource doesn't have it. */
|
|
14
|
+
export declare function getItemType<T extends {
|
|
15
|
+
id: string;
|
|
16
|
+
}>(resource: {
|
|
17
|
+
types?: readonly T[] | undefined;
|
|
18
|
+
}, item: Readonly<Record<string, unknown>>): T | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* The types a user can create items of, in order: those without `abilities.create: false`. Empty
|
|
21
|
+
* for a resource without types.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getCreatableTypes<T extends {
|
|
24
|
+
abilities?: Record<string, boolean> | undefined;
|
|
25
|
+
}>(resource: {
|
|
26
|
+
types?: readonly T[] | undefined;
|
|
27
|
+
}): T[];
|
|
28
|
+
/**
|
|
29
|
+
* The fields of the items of a type: those of the resource, then those of the type. Only the
|
|
30
|
+
* resource's fields without a type, or for one it doesn't have.
|
|
31
|
+
*/
|
|
32
|
+
export declare function getTypeFields<F>(resource: {
|
|
33
|
+
fields: readonly F[];
|
|
34
|
+
types?: readonly {
|
|
35
|
+
id: string;
|
|
36
|
+
fields: readonly F[];
|
|
37
|
+
}[] | undefined;
|
|
38
|
+
}, type: unknown): F[];
|
|
39
|
+
//# sourceMappingURL=resourceTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resourceTypes.d.ts","sourceRoot":"","sources":["../src/resourceTypes.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,eAAO,MAAM,aAAa,SAAS,CAAC;AAEpC,2FAA2F;AAC3F,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE;IAAE,KAAK,CAAC,EAAE,SAAS,OAAO,EAAE,GAAG,SAAS,CAAA;CAAE,GAAG,OAAO,CAE9F;AAED,mFAAmF;AACnF,wBAAgB,eAAe,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EACpD,QAAQ,EAAE;IAAE,KAAK,CAAC,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,CAAA;CAAE,EAC9C,EAAE,EAAE,OAAO,GACZ,CAAC,GAAG,SAAS,CAEf;AAED,mGAAmG;AACnG,wBAAgB,WAAW,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAChD,QAAQ,EAAE;IAAE,KAAK,CAAC,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,CAAA;CAAE,EAC9C,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACxC,CAAC,GAAG,SAAS,CAEf;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC7B,CAAC,SAAS;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;CAAE,EAC/D,QAAQ,EAAE;IAAE,KAAK,CAAC,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,CAAA;CAAE,GAAG,CAAC,EAAE,CAErD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC3B,QAAQ,EAAE;IACN,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,SAAS,CAAC,EAAE,CAAA;KAAE,EAAE,GAAG,SAAS,CAAC;CACvE,EACD,IAAI,EAAE,OAAO,GACd,CAAC,EAAE,CAGL"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/resourceTypes.ts
|
|
2
|
+
/** The key of an item, and of the body of a create, that holds its type. */
|
|
3
|
+
var ITEM_TYPE_KEY = "type";
|
|
4
|
+
/** Whether a resource has types: its items each have one, chosen when they are created. */
|
|
5
|
+
function hasResourceTypes(resource) {
|
|
6
|
+
return (resource.types?.length ?? 0) > 0;
|
|
7
|
+
}
|
|
8
|
+
/** The type of a resource with this id, or `undefined` for one it doesn't have. */
|
|
9
|
+
function getResourceType(resource, id) {
|
|
10
|
+
return typeof id === "string" ? resource.types?.find((type) => type.id === id) : void 0;
|
|
11
|
+
}
|
|
12
|
+
/** The type of an item, read from its `type`, or `undefined` when its resource doesn't have it. */
|
|
13
|
+
function getItemType(resource, item) {
|
|
14
|
+
return getResourceType(resource, item[ITEM_TYPE_KEY]);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The types a user can create items of, in order: those without `abilities.create: false`. Empty
|
|
18
|
+
* for a resource without types.
|
|
19
|
+
*/
|
|
20
|
+
function getCreatableTypes(resource) {
|
|
21
|
+
return (resource.types ?? []).filter((type) => type.abilities?.create !== false);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The fields of the items of a type: those of the resource, then those of the type. Only the
|
|
25
|
+
* resource's fields without a type, or for one it doesn't have.
|
|
26
|
+
*/
|
|
27
|
+
function getTypeFields(resource, type) {
|
|
28
|
+
const found = getResourceType(resource, type);
|
|
29
|
+
return [...resource.fields, ...found?.fields ?? []];
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { ITEM_TYPE_KEY, getCreatableTypes, getItemType, getResourceType, getTypeFields, hasResourceTypes };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=resourceTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resourceTypes.js","names":[],"sources":["../src/resourceTypes.ts"],"sourcesContent":["/** The key of an item, and of the body of a create, that holds its type. */\nexport const ITEM_TYPE_KEY = 'type';\n\n/** Whether a resource has types: its items each have one, chosen when they are created. */\nexport function hasResourceTypes(resource: { types?: readonly unknown[] | undefined }): boolean {\n return (resource.types?.length ?? 0) > 0;\n}\n\n/** The type of a resource with this id, or `undefined` for one it doesn't have. */\nexport function getResourceType<T extends { id: string }>(\n resource: { types?: readonly T[] | undefined },\n id: unknown,\n): T | undefined {\n return typeof id === 'string' ? resource.types?.find((type) => type.id === id) : undefined;\n}\n\n/** The type of an item, read from its `type`, or `undefined` when its resource doesn't have it. */\nexport function getItemType<T extends { id: string }>(\n resource: { types?: readonly T[] | undefined },\n item: Readonly<Record<string, unknown>>,\n): T | undefined {\n return getResourceType(resource, item[ITEM_TYPE_KEY]);\n}\n\n/**\n * The types a user can create items of, in order: those without `abilities.create: false`. Empty\n * for a resource without types.\n */\nexport function getCreatableTypes<\n T extends { abilities?: Record<string, boolean> | undefined },\n>(resource: { types?: readonly T[] | undefined }): T[] {\n return (resource.types ?? []).filter((type) => type.abilities?.create !== false);\n}\n\n/**\n * The fields of the items of a type: those of the resource, then those of the type. Only the\n * resource's fields without a type, or for one it doesn't have.\n */\nexport function getTypeFields<F>(\n resource: {\n fields: readonly F[];\n types?: readonly { id: string; fields: readonly F[] }[] | undefined;\n },\n type: unknown,\n): F[] {\n const found = getResourceType(resource, type);\n return [...resource.fields, ...(found?.fields ?? [])];\n}\n"],"mappings":";;AACA,IAAa,gBAAgB;;AAG7B,SAAgB,iBAAiB,UAA+D;CAC5F,QAAQ,SAAS,OAAO,UAAU,KAAK;AAC3C;;AAGA,SAAgB,gBACZ,UACA,IACa;CACb,OAAO,OAAO,OAAO,WAAW,SAAS,OAAO,MAAM,SAAS,KAAK,OAAO,EAAE,IAAI,KAAA;AACrF;;AAGA,SAAgB,YACZ,UACA,MACa;CACb,OAAO,gBAAgB,UAAU,KAAK,cAAc;AACxD;;;;;AAMA,SAAgB,kBAEd,UAAqD;CACnD,QAAQ,SAAS,SAAS,CAAC,EAAA,CAAG,QAAQ,SAAS,KAAK,WAAW,WAAW,KAAK;AACnF;;;;;AAMA,SAAgB,cACZ,UAIA,MACG;CACH,MAAM,QAAQ,gBAAgB,UAAU,IAAI;CAC5C,OAAO,CAAC,GAAG,SAAS,QAAQ,GAAI,OAAO,UAAU,CAAC,CAAE;AACxD"}
|
package/dist/rules.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import type { Field, Rule } from './schemas/field';
|
|
1
|
+
import type { Field, Rule } from './schemas/field.js';
|
|
2
2
|
/** A rule that a value doesn't satisfy. */
|
|
3
3
|
export interface RuleFailure {
|
|
4
4
|
rule: string;
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* The rule's parameter (`max: 120` gives `120`). For `daterange`, what fails: `start` or `end`
|
|
7
|
+
* (a bound missing where the range isn't open), or `order` (the end is before the start).
|
|
8
|
+
*/
|
|
6
9
|
value?: unknown;
|
|
7
10
|
/** The message set on the rule, if any. */
|
|
8
11
|
message?: string;
|
|
@@ -17,13 +20,23 @@ export interface CheckOptions {
|
|
|
17
20
|
mode?: 'create' | 'update';
|
|
18
21
|
/** Only check the fields present in the values (partial updates). */
|
|
19
22
|
partial?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The values of the item being updated. With `partial`, conditions (`visibleWhen`) and rules
|
|
25
|
+
* that read other fields read them for the fields that aren't in the values: a field shown
|
|
26
|
+
* when `status` is `published`, sent alone, is checked on a published item (decision 0043).
|
|
27
|
+
*/
|
|
28
|
+
item?: Record<string, unknown>;
|
|
20
29
|
}
|
|
21
|
-
/**
|
|
22
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Checks one value against a field's rules. Returns the rules that fail. Rules limited to a `mode`
|
|
32
|
+
* only apply when it is given.
|
|
33
|
+
*/
|
|
34
|
+
export declare function checkRules(rules: Rule[], value: unknown, root?: Record<string, unknown>, mode?: CheckOptions['mode']): RuleFailure[];
|
|
23
35
|
/**
|
|
24
36
|
* Checks form values against the portable rules of their fields. Returns the failures keyed by
|
|
25
37
|
* the dot path of the value (`title.fr`, `blocks.2.image`), the same keys as validation errors.
|
|
26
|
-
* Hidden and read-only fields
|
|
38
|
+
* Hidden and read-only fields, and fields that forms leave out (`notInForm`), are skipped. Rules
|
|
39
|
+
* this version doesn't know are ignored.
|
|
27
40
|
*/
|
|
28
41
|
export declare function checkValues(fields: Field[], values: Record<string, unknown>, options?: CheckOptions): Record<string, RuleFailure[]>;
|
|
29
42
|
//# sourceMappingURL=rules.d.ts.map
|
package/dist/rules.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../src/rules.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../src/rules.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAInD,2CAA2C;AAC3C,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IACzB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,8EAA8E;IAC9E,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC3B,qEAAqE;IACrE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAuKD;;;GAGG;AACH,wBAAgB,UAAU,CACtB,KAAK,EAAE,IAAI,EAAE,EACb,KAAK,EAAE,OAAO,EACd,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EAClC,IAAI,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,GAC5B,WAAW,EAAE,CA8Gf;AAuOD;;;;;GAKG;AACH,wBAAgB,WAAW,CACvB,MAAM,EAAE,KAAK,EAAE,EACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,GAAE,YAAiB,GAC3B,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,CAQ/B"}
|