@panneau/protocol 5.0.0-alpha.1 → 5.0.0-alpha.2
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/README.md +10 -9
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/openapi.d.ts +2 -0
- package/dist/openapi.d.ts.map +1 -1
- package/dist/openapi.js +12 -1
- package/dist/openapi.js.map +1 -1
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +2 -1
- package/dist/schemas/definition.d.ts +54 -1
- package/dist/schemas/definition.d.ts.map +1 -1
- package/dist/schemas/definition.js +2 -5
- package/dist/schemas/definition.js.map +1 -1
- package/dist/schemas/index.d.ts +224 -1
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +10 -1
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/theme.d.ts +179 -0
- package/dist/schemas/theme.d.ts.map +1 -0
- package/dist/schemas/theme.js +66 -0
- package/dist/schemas/theme.js.map +1 -0
- package/dist/themes.d.ts +11 -0
- package/dist/themes.d.ts.map +1 -0
- package/dist/themes.js +80 -0
- package/dist/themes.js.map +1 -0
- package/package.json +2 -1
- package/schema/boot.schema.json +255 -12
- package/schema/definition.schema.json +255 -12
- package/schema/openapi.json +418 -12
- package/schema/theme.schema.json +234 -0
package/README.md
CHANGED
|
@@ -18,15 +18,16 @@ import { checkValues, evaluateCondition } from '@panneau/protocol/runtime';
|
|
|
18
18
|
|
|
19
19
|
**In the browser,** import the helpers from `@panneau/protocol/runtime`, and only types from `@panneau/protocol`. The main entry point loads zod and builds every schema, which bundlers can't drop (about 360 KB of source). `@panneau/core`, `fields`, `forms` and `lists` follow this rule, and ESLint enforces it in them.
|
|
20
20
|
|
|
21
|
-
| Export | Content
|
|
22
|
-
| ------------------------------------------ |
|
|
23
|
-
| `@panneau/protocol` | Schemas (Zod) and types, `validateDefinition()`, `validateBootConfig()`, `lintDefinition()`, `checkValues()` (portable rules), `evaluateCondition()`, list query helpers, OpenAPI and JSON Schema generators
|
|
24
|
-
| `@panneau/protocol/runtime` | The constants and the helpers that run in the browser, without zod: `checkValues()`, `checkRules()`, `evaluateCondition()`, `lintDefinition()`, `getValue()`, `isFilled()`, `isProblem()`, `toSearchParams()`, `fromSearchParams()`, `isFilterRange()`, `matchesFilterRange()`. The main entry point also exports them |
|
|
25
|
-
| `@panneau/protocol/mock` | `createMockBackend()`: an in-memory backend for tests and development
|
|
26
|
-
| `@panneau/protocol/conformance` | `runConformance()`: checks a live backend against the protocol
|
|
27
|
-
| `@panneau/protocol/definition.schema.json` | JSON Schema of the definition
|
|
28
|
-
| `@panneau/protocol/openapi.json` | OpenAPI 3.1 document of the API
|
|
29
|
-
| `@panneau/protocol/boot.schema.json` | JSON Schema of the boot config, which a server writes in the page of the app
|
|
21
|
+
| Export | Content |
|
|
22
|
+
| ------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
23
|
+
| `@panneau/protocol` | Schemas (Zod) and types, `validateDefinition()`, `validateBootConfig()`, `lintDefinition()`, `checkValues()` (portable rules), `evaluateCondition()`, list query helpers, OpenAPI and JSON Schema generators |
|
|
24
|
+
| `@panneau/protocol/runtime` | The constants and the helpers that run in the browser, without zod: `checkValues()`, `checkRules()`, `evaluateCondition()`, `lintDefinition()`, `getValue()`, `isFilled()`, `isProblem()`, `toSearchParams()`, `fromSearchParams()`, `isFilterRange()`, `matchesFilterRange()`, `mergeThemes()`. The main entry point also exports them |
|
|
25
|
+
| `@panneau/protocol/mock` | `createMockBackend()`: an in-memory backend for tests and development |
|
|
26
|
+
| `@panneau/protocol/conformance` | `runConformance()`: checks a live backend against the protocol |
|
|
27
|
+
| `@panneau/protocol/definition.schema.json` | JSON Schema of the definition |
|
|
28
|
+
| `@panneau/protocol/openapi.json` | OpenAPI 3.1 document of the API |
|
|
29
|
+
| `@panneau/protocol/boot.schema.json` | JSON Schema of the boot config, which a server writes in the page of the app |
|
|
30
|
+
| `@panneau/protocol/theme.schema.json` | JSON Schema of a theme of `@panneau/ui`, for themes written as JSON files |
|
|
30
31
|
|
|
31
32
|
## Changing the protocol
|
|
32
33
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from './runtime';
|
|
2
2
|
export * from './schemas';
|
|
3
3
|
export { type ValidationIssue, type ValidationResult, validate, validateBootConfig, validateDefinition, } from './validate';
|
|
4
|
-
export { createBootConfigJsonSchema, createComponentSchemas, createDefinitionJsonSchema, createOpenApiDocument, } from './openapi';
|
|
4
|
+
export { createBootConfigJsonSchema, createComponentSchemas, createDefinitionJsonSchema, createOpenApiDocument, createThemeJsonSchema, } from './openapi';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,OAAO,EACH,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,QAAQ,EACR,kBAAkB,EAClB,kBAAkB,GACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EACH,0BAA0B,EAC1B,sBAAsB,EACtB,0BAA0B,EAC1B,qBAAqB,GACxB,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,OAAO,EACH,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,QAAQ,EACR,kBAAkB,EAClB,kBAAkB,GACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EACH,0BAA0B,EAC1B,sBAAsB,EACtB,0BAA0B,EAC1B,qBAAqB,EACrB,qBAAqB,GACxB,MAAM,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -6,16 +6,18 @@ import { checkRules, checkValues } from "./rules.js";
|
|
|
6
6
|
import { lintDefinition } from "./lint.js";
|
|
7
7
|
import { fromSearchParams, isFilterRange, matchesFilterRange, toSearchParams } from "./query.js";
|
|
8
8
|
import { isProblem } from "./problem.js";
|
|
9
|
+
import { mergeThemes } from "./themes.js";
|
|
9
10
|
import { Abilities, Condition, Id, Option, RouteReference } from "./schemas/common.js";
|
|
10
11
|
import { BlockType, Field, Rule } from "./schemas/field.js";
|
|
11
12
|
import { LayoutNode } from "./schemas/layout.js";
|
|
12
13
|
import { Action, ActionConfirm, ActionPlacement, ActionScope } from "./schemas/action.js";
|
|
13
14
|
import { Column, Filter, ListDefinition } from "./schemas/list.js";
|
|
14
15
|
import { Resource, ResourceFeatures } from "./schemas/resource.js";
|
|
16
|
+
import { DefinitionTheme, Theme, ThemeFont, ThemeFontFace, ThemeFontStylesheet, ThemeTokens, ToneInput, ToneValues } from "./schemas/theme.js";
|
|
15
17
|
import { Auth, AuthProvider, Definition, MenuItem, Page, Uploads, User, Widget } from "./schemas/definition.js";
|
|
16
18
|
import { ActionItemResult, ActionRequest, ActionResult, ActionRun, ActionRunResponse, Item, ItemResponse, ListResponse, Media, MediaListResponse, MediaResponse, MediaTransform, Pagination, PreviewResponse, Problem, SearchResponse, Selection, Session } from "./schemas/api.js";
|
|
17
19
|
import { BootConfig } from "./schemas/boot.js";
|
|
18
20
|
import { createSchemaRegistry, namedSchemas } from "./schemas/index.js";
|
|
19
21
|
import { validate, validateBootConfig, validateDefinition } from "./validate.js";
|
|
20
|
-
import { createBootConfigJsonSchema, createComponentSchemas, createDefinitionJsonSchema, createOpenApiDocument } from "./openapi.js";
|
|
21
|
-
export { Abilities, Action, ActionConfirm, ActionItemResult, ActionPlacement, ActionRequest, ActionResult, ActionRun, ActionRunResponse, ActionScope, Auth, AuthProvider, BOOT_CONFIG_ELEMENT_ID, BUILT_IN_ACTIONS, BUILT_IN_FIELD_TYPES, BUILT_IN_LAYOUT_NODE_TYPES, BUILT_IN_LIST_LAYOUTS, BlockType, BootConfig, Column, Condition, Definition, Field, Filter, Id, Item, ItemResponse, LayoutNode, ListDefinition, ListResponse, Media, MediaListResponse, MediaResponse, MediaTransform, MenuItem, Option, PORTABLE_RULES, PROBLEM_CONTENT_TYPE, PROTOCOL_VERSION, Page, Pagination, PreviewResponse, Problem, Resource, ResourceFeatures, RouteReference, Rule, SearchResponse, Selection, Session, Uploads, User, Widget, checkRules, checkValues, createBootConfigJsonSchema, createComponentSchemas, createDefinitionJsonSchema, createOpenApiDocument, createSchemaRegistry, evaluateCondition, fromSearchParams, getValue, isFilled, isFilterRange, isProblem, lintDefinition, matchesFilterRange, namedSchemas, toSearchParams, validate, validateBootConfig, validateDefinition };
|
|
22
|
+
import { createBootConfigJsonSchema, createComponentSchemas, createDefinitionJsonSchema, createOpenApiDocument, createThemeJsonSchema } from "./openapi.js";
|
|
23
|
+
export { Abilities, Action, ActionConfirm, ActionItemResult, ActionPlacement, ActionRequest, ActionResult, ActionRun, ActionRunResponse, ActionScope, Auth, AuthProvider, BOOT_CONFIG_ELEMENT_ID, BUILT_IN_ACTIONS, BUILT_IN_FIELD_TYPES, BUILT_IN_LAYOUT_NODE_TYPES, BUILT_IN_LIST_LAYOUTS, BlockType, BootConfig, Column, Condition, Definition, DefinitionTheme, Field, Filter, Id, Item, ItemResponse, LayoutNode, ListDefinition, ListResponse, Media, MediaListResponse, MediaResponse, MediaTransform, MenuItem, Option, PORTABLE_RULES, PROBLEM_CONTENT_TYPE, PROTOCOL_VERSION, Page, Pagination, PreviewResponse, Problem, Resource, ResourceFeatures, RouteReference, Rule, SearchResponse, Selection, Session, Theme, ThemeFont, ThemeFontFace, ThemeFontStylesheet, ThemeTokens, ToneInput, ToneValues, Uploads, User, Widget, checkRules, checkValues, createBootConfigJsonSchema, createComponentSchemas, createDefinitionJsonSchema, createOpenApiDocument, createSchemaRegistry, createThemeJsonSchema, evaluateCondition, fromSearchParams, getValue, isFilled, isFilterRange, isProblem, lintDefinition, matchesFilterRange, mergeThemes, namedSchemas, toSearchParams, validate, validateBootConfig, validateDefinition };
|
package/dist/openapi.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ type JsonObject = Record<string, unknown>;
|
|
|
3
3
|
export declare function createComponentSchemas(): Record<string, JsonObject>;
|
|
4
4
|
/** The JSON Schema of the definition (`GET /definition`). */
|
|
5
5
|
export declare function createDefinitionJsonSchema(): JsonObject;
|
|
6
|
+
/** The JSON Schema of a theme, for themes written as JSON files. */
|
|
7
|
+
export declare function createThemeJsonSchema(): JsonObject;
|
|
6
8
|
/** The JSON Schema of the boot config, which a server writes in the page of the app. */
|
|
7
9
|
export declare function createBootConfigJsonSchema(): JsonObject;
|
|
8
10
|
/** The OpenAPI 3.1 document of the Panneau HTTP API. */
|
package/dist/openapi.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../src/openapi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../src/openapi.ts"],"names":[],"mappings":"AAQA,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AA2E1C,oEAAoE;AACpE,wBAAgB,sBAAsB,IAAI,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAWnE;AAED,6DAA6D;AAC7D,wBAAgB,0BAA0B,IAAI,UAAU,CAQvD;AAED,oEAAoE;AACpE,wBAAgB,qBAAqB,IAAI,UAAU,CAQlD;AAED,wFAAwF;AACxF,wBAAgB,0BAA0B,IAAI,UAAU,CAQvD;AAED,wDAAwD;AACxD,wBAAgB,qBAAqB,IAAI,UAAU,CAialD"}
|
package/dist/openapi.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PROBLEM_CONTENT_TYPE } from "./version.js";
|
|
2
|
+
import { Theme } from "./schemas/theme.js";
|
|
2
3
|
import { Definition } from "./schemas/definition.js";
|
|
3
4
|
import { BootConfig } from "./schemas/boot.js";
|
|
4
5
|
import { createSchemaRegistry } from "./schemas/index.js";
|
|
@@ -95,6 +96,16 @@ function createDefinitionJsonSchema() {
|
|
|
95
96
|
})
|
|
96
97
|
};
|
|
97
98
|
}
|
|
99
|
+
/** The JSON Schema of a theme, for themes written as JSON files. */
|
|
100
|
+
function createThemeJsonSchema() {
|
|
101
|
+
return {
|
|
102
|
+
$id: "https://github.com/folkloreinc/panneau-js/blob/v5.x/packages/protocol/schema/theme.schema.json",
|
|
103
|
+
...z.toJSONSchema(Theme, {
|
|
104
|
+
io: "input",
|
|
105
|
+
metadata: createSchemaRegistry()
|
|
106
|
+
})
|
|
107
|
+
};
|
|
108
|
+
}
|
|
98
109
|
/** The JSON Schema of the boot config, which a server writes in the page of the app. */
|
|
99
110
|
function createBootConfigJsonSchema() {
|
|
100
111
|
return {
|
|
@@ -535,6 +546,6 @@ function createOpenApiDocument() {
|
|
|
535
546
|
};
|
|
536
547
|
}
|
|
537
548
|
//#endregion
|
|
538
|
-
export { createBootConfigJsonSchema, createComponentSchemas, createDefinitionJsonSchema, createOpenApiDocument };
|
|
549
|
+
export { createBootConfigJsonSchema, createComponentSchemas, createDefinitionJsonSchema, createOpenApiDocument, createThemeJsonSchema };
|
|
539
550
|
|
|
540
551
|
//# sourceMappingURL=openapi.js.map
|
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 { 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 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 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(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":";;;;;;AASA,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;CACr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gB,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 { 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 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(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;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,UA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uBAAuB,EAAE;CACpD;AACJ"}
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -7,4 +7,5 @@ export type { ValidationIssue } from '../validate';
|
|
|
7
7
|
export { type FilterRange, type FilterValue, type ListQuery, fromSearchParams, isFilterRange, matchesFilterRange, toSearchParams, } from '../query';
|
|
8
8
|
export { getValue, isFilled } from '../values';
|
|
9
9
|
export { isProblem } from '../problem';
|
|
10
|
+
export { type PartialTheme, mergeThemes } from '../themes';
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACpE,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACH,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,cAAc,GACjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACpE,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EACH,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,cAAc,GACjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/runtime/index.js
CHANGED
|
@@ -6,4 +6,5 @@ import { checkRules, checkValues } from "../rules.js";
|
|
|
6
6
|
import { lintDefinition } from "../lint.js";
|
|
7
7
|
import { fromSearchParams, isFilterRange, matchesFilterRange, toSearchParams } from "../query.js";
|
|
8
8
|
import { isProblem } from "../problem.js";
|
|
9
|
-
|
|
9
|
+
import { mergeThemes } from "../themes.js";
|
|
10
|
+
export { BOOT_CONFIG_ELEMENT_ID, BUILT_IN_ACTIONS, BUILT_IN_FIELD_TYPES, BUILT_IN_LAYOUT_NODE_TYPES, BUILT_IN_LIST_LAYOUTS, PORTABLE_RULES, PROBLEM_CONTENT_TYPE, PROTOCOL_VERSION, checkRules, checkValues, evaluateCondition, fromSearchParams, getValue, isFilled, isFilterRange, isProblem, lintDefinition, matchesFilterRange, mergeThemes, toSearchParams };
|
|
@@ -435,11 +435,64 @@ export declare const Definition: z.ZodObject<{
|
|
|
435
435
|
maxSize: z.ZodOptional<z.ZodNumber>;
|
|
436
436
|
}, z.core.$loose>>;
|
|
437
437
|
theme: z.ZodOptional<z.ZodObject<{
|
|
438
|
+
tokens: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
438
439
|
colorScheme: z.ZodOptional<z.ZodEnum<{
|
|
439
|
-
light: "light";
|
|
440
440
|
dark: "dark";
|
|
441
441
|
auto: "auto";
|
|
442
|
+
light: "light";
|
|
442
443
|
}>>;
|
|
444
|
+
density: z.ZodOptional<z.ZodEnum<{
|
|
445
|
+
auto: "auto";
|
|
446
|
+
compact: "compact";
|
|
447
|
+
comfortable: "comfortable";
|
|
448
|
+
touch: "touch";
|
|
449
|
+
}>>;
|
|
450
|
+
extends: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
451
|
+
label: z.ZodOptional<z.ZodString>;
|
|
452
|
+
dark: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
453
|
+
palette: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
454
|
+
tones: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
455
|
+
text: z.ZodString;
|
|
456
|
+
subtle: z.ZodString;
|
|
457
|
+
border: z.ZodString;
|
|
458
|
+
outline: z.ZodString;
|
|
459
|
+
solid: z.ZodString;
|
|
460
|
+
solidHover: z.ZodString;
|
|
461
|
+
solidText: z.ZodString;
|
|
462
|
+
dark: z.ZodOptional<z.ZodObject<{
|
|
463
|
+
text: z.ZodOptional<z.ZodString>;
|
|
464
|
+
subtle: z.ZodOptional<z.ZodString>;
|
|
465
|
+
border: z.ZodOptional<z.ZodString>;
|
|
466
|
+
outline: z.ZodOptional<z.ZodString>;
|
|
467
|
+
solid: z.ZodOptional<z.ZodString>;
|
|
468
|
+
solidHover: z.ZodOptional<z.ZodString>;
|
|
469
|
+
solidText: z.ZodOptional<z.ZodString>;
|
|
470
|
+
}, z.core.$loose>>;
|
|
471
|
+
}, z.core.$loose>]>>>;
|
|
472
|
+
components: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
473
|
+
variants: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
474
|
+
}, z.core.$loose>>>;
|
|
475
|
+
densities: z.ZodOptional<z.ZodObject<{
|
|
476
|
+
compact: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
477
|
+
comfortable: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
478
|
+
touch: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
479
|
+
}, z.core.$loose>>;
|
|
480
|
+
fonts: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
481
|
+
family: z.ZodString;
|
|
482
|
+
src: z.ZodString;
|
|
483
|
+
weight: z.ZodOptional<z.ZodString>;
|
|
484
|
+
style: z.ZodOptional<z.ZodString>;
|
|
485
|
+
display: z.ZodOptional<z.ZodEnum<{
|
|
486
|
+
optional: "optional";
|
|
487
|
+
auto: "auto";
|
|
488
|
+
block: "block";
|
|
489
|
+
swap: "swap";
|
|
490
|
+
fallback: "fallback";
|
|
491
|
+
}>>;
|
|
492
|
+
unicodeRange: z.ZodOptional<z.ZodString>;
|
|
493
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
494
|
+
stylesheet: z.ZodString;
|
|
495
|
+
}, z.core.$loose>]>>>;
|
|
443
496
|
}, z.core.$loose>>;
|
|
444
497
|
user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
445
498
|
id: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/schemas/definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/schemas/definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,IAAI;;;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CAAC,OAAO,IAAI,CAAC,CAAC;AACxC,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAChD,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AACxC,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC;AAC5C,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,CAAC;AAC9C,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AACpD,wEAAwE;AACxE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "../version.js";
|
|
2
2
|
import { Abilities, Id } from "./common.js";
|
|
3
3
|
import { Resource } from "./resource.js";
|
|
4
|
+
import { DefinitionTheme } from "./theme.js";
|
|
4
5
|
import { z } from "zod";
|
|
5
6
|
//#region src/schemas/definition.ts
|
|
6
7
|
var User = z.looseObject({
|
|
@@ -74,11 +75,7 @@ var Definition = z.looseObject({
|
|
|
74
75
|
dashboard: z.looseObject({ widgets: z.array(Widget) }).optional(),
|
|
75
76
|
search: z.looseObject({ enabled: z.boolean() }).optional(),
|
|
76
77
|
uploads: Uploads.optional(),
|
|
77
|
-
theme:
|
|
78
|
-
"light",
|
|
79
|
-
"dark",
|
|
80
|
-
"auto"
|
|
81
|
-
]).optional() }).optional(),
|
|
78
|
+
theme: DefinitionTheme.optional(),
|
|
82
79
|
user: User.nullable().optional()
|
|
83
80
|
}).superRefine((definition, context) => {
|
|
84
81
|
const ids = /* @__PURE__ */ new Set();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.js","names":[],"sources":["../../src/schemas/definition.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { PROTOCOL_VERSION } from '../version';\nimport { Abilities, Id } from './common';\nimport { Resource } from './resource';\n\nexport const User = z.looseObject({\n id: Id,\n name: z.string(),\n email: z.string().optional(),\n avatarUrl: z.string().optional(),\n abilities: Abilities.optional(),\n});\n\nexport const AuthProvider = z.looseObject({\n id: z.string().min(1),\n label: z.string(),\n url: z.string().optional().meta({ description: 'Where the login with this provider starts.' }),\n icon: z.string().optional(),\n});\n\nexport const Auth = z.looseObject({\n mode: z.enum(['panneau', 'external']).meta({\n description: \"`panneau`: Panneau's own login pages. `external`: the site handles login.\",\n }),\n loginUrl: z\n .string()\n .nullable()\n .optional()\n .meta({ description: '`external`: where unauthenticated users are sent.' }),\n password: z.boolean().optional(),\n providers: z.array(AuthProvider).optional(),\n passwordReset: z.boolean().optional(),\n twoFactor: z.boolean().optional(),\n passkeys: z.boolean().optional(),\n emailVerification: z.boolean().optional(),\n});\n\nexport const MenuItem = z\n .looseObject({\n type: z.string().min(1).meta({\n description: 'Built-in: `resources`, `resource`, `page`, `link`, `separator`, `group`.',\n }),\n label: z.string().optional(),\n icon: z.string().optional(),\n resource: z.string().optional(),\n page: z.string().optional(),\n url: z.string().optional(),\n external: z.boolean().optional(),\n // The return type is written out so that declaration files keep the recursion.\n get children(): z.ZodOptional<z.ZodArray<typeof MenuItem>> {\n return z.array(MenuItem).optional();\n },\n })\n .meta({ description: 'An entry of a menu.' });\n\nexport const Page = z.looseObject({\n component: z\n .string()\n .min(1)\n .meta({ description: 'A page provided by a plugin, or a built-in page.' }),\n path: z.string().optional().meta({ description: 'Path of a custom page.' }),\n label: z.string().optional(),\n props: z.record(z.string(), z.unknown()).optional(),\n});\n\nexport const Widget = z.looseObject({\n id: z.string().min(1),\n type: z.string().min(1).meta({\n description: 'Built-in: `stat`, `chart`, `recent-items`, `shortcuts`, `welcome`.',\n }),\n label: z.string().optional(),\n width: z.number().int().min(1).max(12).optional(),\n settings: z.record(z.string(), z.unknown()).optional(),\n});\n\nexport const Uploads = z.looseObject({\n mode: z.enum(['multipart', 'tus', 'presigned']),\n endpoint: z.string().optional(),\n maxSize: z.number().int().positive().optional(),\n});\n\nexport const Definition = z\n .looseObject({\n protocol: z.literal(PROTOCOL_VERSION),\n name: z.string(),\n locale: z\n .string()\n .min(2)\n .meta({ description: 'BCP 47 locale of the labels and messages.' }),\n locales: z\n .array(z.string().min(2))\n .min(1)\n .meta({ description: 'Locales of localized content fields.' }),\n api: z.looseObject({ baseUrl: z.string() }),\n resources: z.array(Resource),\n pages: z.record(z.string(), Page).optional(),\n menus: z.record(z.string(), z.array(MenuItem)).optional(),\n routes: z.record(z.string(), z.string()).optional().meta({\n description: 'Named paths of the frontend, for `link` actions and redirects.',\n }),\n auth: Auth.optional(),\n dashboard: z.looseObject({ widgets: z.array(Widget) }).optional(),\n search: z.looseObject({ enabled: z.boolean() }).optional(),\n uploads: Uploads.optional(),\n theme:
|
|
1
|
+
{"version":3,"file":"definition.js","names":[],"sources":["../../src/schemas/definition.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { PROTOCOL_VERSION } from '../version';\nimport { Abilities, Id } from './common';\nimport { Resource } from './resource';\nimport { DefinitionTheme } from './theme';\n\nexport const User = z.looseObject({\n id: Id,\n name: z.string(),\n email: z.string().optional(),\n avatarUrl: z.string().optional(),\n abilities: Abilities.optional(),\n});\n\nexport const AuthProvider = z.looseObject({\n id: z.string().min(1),\n label: z.string(),\n url: z.string().optional().meta({ description: 'Where the login with this provider starts.' }),\n icon: z.string().optional(),\n});\n\nexport const Auth = z.looseObject({\n mode: z.enum(['panneau', 'external']).meta({\n description: \"`panneau`: Panneau's own login pages. `external`: the site handles login.\",\n }),\n loginUrl: z\n .string()\n .nullable()\n .optional()\n .meta({ description: '`external`: where unauthenticated users are sent.' }),\n password: z.boolean().optional(),\n providers: z.array(AuthProvider).optional(),\n passwordReset: z.boolean().optional(),\n twoFactor: z.boolean().optional(),\n passkeys: z.boolean().optional(),\n emailVerification: z.boolean().optional(),\n});\n\nexport const MenuItem = z\n .looseObject({\n type: z.string().min(1).meta({\n description: 'Built-in: `resources`, `resource`, `page`, `link`, `separator`, `group`.',\n }),\n label: z.string().optional(),\n icon: z.string().optional(),\n resource: z.string().optional(),\n page: z.string().optional(),\n url: z.string().optional(),\n external: z.boolean().optional(),\n // The return type is written out so that declaration files keep the recursion.\n get children(): z.ZodOptional<z.ZodArray<typeof MenuItem>> {\n return z.array(MenuItem).optional();\n },\n })\n .meta({ description: 'An entry of a menu.' });\n\nexport const Page = z.looseObject({\n component: z\n .string()\n .min(1)\n .meta({ description: 'A page provided by a plugin, or a built-in page.' }),\n path: z.string().optional().meta({ description: 'Path of a custom page.' }),\n label: z.string().optional(),\n props: z.record(z.string(), z.unknown()).optional(),\n});\n\nexport const Widget = z.looseObject({\n id: z.string().min(1),\n type: z.string().min(1).meta({\n description: 'Built-in: `stat`, `chart`, `recent-items`, `shortcuts`, `welcome`.',\n }),\n label: z.string().optional(),\n width: z.number().int().min(1).max(12).optional(),\n settings: z.record(z.string(), z.unknown()).optional(),\n});\n\nexport const Uploads = z.looseObject({\n mode: z.enum(['multipart', 'tus', 'presigned']),\n endpoint: z.string().optional(),\n maxSize: z.number().int().positive().optional(),\n});\n\nexport const Definition = z\n .looseObject({\n protocol: z.literal(PROTOCOL_VERSION),\n name: z.string(),\n locale: z\n .string()\n .min(2)\n .meta({ description: 'BCP 47 locale of the labels and messages.' }),\n locales: z\n .array(z.string().min(2))\n .min(1)\n .meta({ description: 'Locales of localized content fields.' }),\n api: z.looseObject({ baseUrl: z.string() }),\n resources: z.array(Resource),\n pages: z.record(z.string(), Page).optional(),\n menus: z.record(z.string(), z.array(MenuItem)).optional(),\n routes: z.record(z.string(), z.string()).optional().meta({\n description: 'Named paths of the frontend, for `link` actions and redirects.',\n }),\n auth: Auth.optional(),\n dashboard: z.looseObject({ widgets: z.array(Widget) }).optional(),\n search: z.looseObject({ enabled: z.boolean() }).optional(),\n uploads: Uploads.optional(),\n theme: DefinitionTheme.optional(),\n user: User.nullable().optional(),\n })\n .superRefine((definition, context) => {\n const ids = new Set<string>();\n definition.resources.forEach((resource, index) => {\n if (ids.has(resource.id)) {\n context.addIssue({\n code: 'custom',\n message: `Duplicate resource id \\`${resource.id}\\`.`,\n path: ['resources', index, 'id'],\n });\n }\n ids.add(resource.id);\n });\n })\n .meta({ description: 'Everything a frontend needs to render the admin for the current user.' });\n\nexport type User = z.infer<typeof User>;\nexport type AuthProvider = z.infer<typeof AuthProvider>;\nexport type Auth = z.infer<typeof Auth>;\nexport type MenuItem = z.infer<typeof MenuItem>;\nexport type Page = z.infer<typeof Page>;\nexport type Widget = z.infer<typeof Widget>;\nexport type Uploads = z.infer<typeof Uploads>;\nexport type Definition = z.infer<typeof Definition>;\n/** A definition as a backend writes it, before defaults are applied. */\nexport type DefinitionInput = z.input<typeof Definition>;\n"],"mappings":";;;;;;AAOA,IAAa,OAAO,EAAE,YAAY;CAC9B,IAAI;CACJ,MAAM,EAAE,OAAO;CACf,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS;CAC3B,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,WAAW,UAAU,SAAS;AAClC,CAAC;AAED,IAAa,eAAe,EAAE,YAAY;CACtC,IAAI,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACpB,OAAO,EAAE,OAAO;CAChB,KAAK,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,aAAa,6CAA6C,CAAC;CAC7F,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS;AAC9B,CAAC;AAED,IAAa,OAAO,EAAE,YAAY;CAC9B,MAAM,EAAE,KAAK,CAAC,WAAW,UAAU,CAAC,CAAC,CAAC,KAAK,EACvC,aAAa,4EACjB,CAAC;CACD,UAAU,EACL,OAAO,CAAC,CACR,SAAS,CAAC,CACV,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,oDAAoD,CAAC;CAC9E,UAAU,EAAE,QAAQ,CAAC,CAA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