@panneau/protocol 5.0.0-alpha.39 → 5.0.0-alpha.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/conformance/index.d.ts.map +1 -1
  2. package/dist/conformance/index.js +29 -7
  3. package/dist/conformance/index.js.map +1 -1
  4. package/dist/index.js +4 -4
  5. package/dist/lint.d.ts.map +1 -1
  6. package/dist/lint.js +176 -20
  7. package/dist/lint.js.map +1 -1
  8. package/dist/mock/index.js +2 -2
  9. package/dist/mock/index.js.map +1 -1
  10. package/dist/openapi.d.ts.map +1 -1
  11. package/dist/openapi.js +3 -1
  12. package/dist/openapi.js.map +1 -1
  13. package/dist/periods.d.ts +12 -0
  14. package/dist/periods.d.ts.map +1 -1
  15. package/dist/periods.js +38 -1
  16. package/dist/periods.js.map +1 -1
  17. package/dist/runtime/index.d.ts +2 -2
  18. package/dist/runtime/index.d.ts.map +1 -1
  19. package/dist/runtime/index.js +3 -3
  20. package/dist/schemas/definition.d.ts +930 -2
  21. package/dist/schemas/definition.d.ts.map +1 -1
  22. package/dist/schemas/index.d.ts +4158 -4
  23. package/dist/schemas/index.d.ts.map +1 -1
  24. package/dist/schemas/index.js +14 -3
  25. package/dist/schemas/index.js.map +1 -1
  26. package/dist/schemas/resource.d.ts +464 -0
  27. package/dist/schemas/resource.d.ts.map +1 -1
  28. package/dist/schemas/theme.d.ts +2 -2
  29. package/dist/schemas/widget.d.ts +4210 -0
  30. package/dist/schemas/widget.d.ts.map +1 -1
  31. package/dist/schemas/widget.js +184 -17
  32. package/dist/schemas/widget.js.map +1 -1
  33. package/dist/widgets.d.ts +158 -7
  34. package/dist/widgets.d.ts.map +1 -1
  35. package/dist/widgets.js +469 -40
  36. package/dist/widgets.js.map +1 -1
  37. package/package.json +1 -1
  38. package/schema/boot.schema.json +459 -0
  39. package/schema/definition.schema.json +459 -0
  40. package/schema/openapi.json +976 -5
@@ -1 +1 @@
1
- {"version":3,"file":"openapi.js","names":[],"sources":["../src/openapi.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { AGGREGATE_MAX_POINTS } from './aggregates';\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 { OVERVIEW_PERIODS } from './periods';\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';\nimport { WIDGET_BREAKDOWN_MAX_ITEMS } from './widgets';\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\n/** The parameters of `GET /resources/{resource}/aggregate`: the filters and search of the list. */\nconst aggregateParameters = [\n ...listParameters.filter((parameter) => ['filter', 'q'].includes(String(parameter.name))),\n queryParameter(\n 'measure',\n 'What is measured of the items: `count` (the default), or `sum:{field}` of a field of the `sum` of the aggregates of the list. A sum of `money` adds the amounts, in minor units.',\n { type: 'string', pattern: '^(count|sum:.+)$', default: 'count' },\n ),\n queryParameter(\n 'group',\n 'How the items are grouped: `{period}:{date field}`, where the period is `day`, `week` (from Monday) or `month` and the field is in the `dates` of the aggregates, or a field of their `groupBy`. Without it, the answer is a stat.',\n { type: 'string', pattern: '^((day|week|month):.+|[^:]+)$' },\n ),\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 '/locale/{locale}': {\n parameters: [pathParameter('locale', 'A `locale` of `interfaceLocales`.')],\n get: {\n operationId: 'switchLocale',\n summary:\n 'Optional: switches the interface to a locale of `interfaceLocales`, when their `url` is here (decision 0083). The app comes with a full navigation, and the next page load gets the definition in that locale.',\n parameters: [\n queryParameter(\n 'next',\n 'Where to go next: a local path under the base path of the app. Another one is ignored.',\n { type: 'string' },\n ),\n ],\n responses: {\n 302: { description: 'To `next`, or to the base path of the app.' },\n ...problems(401, 404),\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}/aggregate': {\n parameters: [resource],\n get: {\n operationId: 'getResourceAggregate',\n description: `The count or the sum of the items of the list that the user can list, with the filters and the search of the list, in the shape of a widget (decision 0084). Only what \\`list.aggregates\\` declares is aggregated: a resource without it is a \\`404\\`, and an undeclared field, or a measure or a group in the wrong format, a \\`422\\` with \\`errors\\` keyed by \\`measure\\` or \\`group\\`. Without a group, a \\`StatWidgetData\\`. By a period, a \\`SeriesWidgetData\\`: a point per period, at 0 without items, from the period of the \\`from\\` bound of the \\`date-range\\` filter whose id is the date field to the period of its \\`to\\` bound, or without a bound, of the first or the last item; at most ${AGGREGATE_MAX_POINTS} points, the latest, and their sum in \\`total\\`. By a field, a \\`BreakdownWidgetData\\`: a part per value, the largest first, at most ${WIDGET_BREAKDOWN_MAX_ITEMS}, the rest in \\`other\\`, each with its \\`key\\` (\\`null\\` for the items without a value), the label and the tone of its option for a \\`select\\`, and the measure of every item in \\`total\\`.`,\n parameters: aggregateParameters,\n responses: {\n 200: ok('The aggregate, in the shape of a widget.', {\n anyOf: [\n ref('StatWidgetData'),\n ref('SeriesWidgetData'),\n ref('BreakdownWidgetData'),\n ],\n }),\n ...problems(401, 403, 404, 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 a dashboard of the user, read as the user (decision 0064): the home page, the dashboard page of `page`, or the summary above the list of `resource`, with the filters and the search of the list (decision 0084). The built-in widgets on a resource (`settings.resource`) have none: clients read the list or the aggregates of the resource. A widget that is not on that page or in that summary of the user is a `404`; a `403` hides the widget. `page` and `resource` together are a `422`.',\n parameters: [\n queryParameter(\n 'page',\n 'The id of the dashboard page of the widget, in `pages`. Defaults to `home`, the home page, whose widgets are `pages.home.widgets` or `dashboard.widgets`. Not with `resource`.',\n { type: 'string', minLength: 1 },\n ),\n queryParameter(\n 'resource',\n \"The id of the resource whose summary (`summary.widgets`) holds the widget, instead of a page. The request then has the list's current filters and search (`filter`, `q`), unless the widget has `settings.followsList: false`; never its sort or paging.\",\n { type: 'string', minLength: 1 },\n ),\n ...listParameters.filter((parameter) =>\n ['filter', 'q'].includes(String(parameter.name)),\n ),\n {\n name: 'period',\n in: 'query',\n required: false,\n style: 'deepObject',\n explode: true,\n description:\n 'The period chosen in the overview of the widget (decision 0084), unless the widget has `settings.period: false`: `period[option]=30d&period[from]=2026-10-19&period[to]=2026-11-17`. `from` and `to` are its first and last days, both inclusive, in the time zone of the browser. A wrong period is a `422` keyed by `period`.',\n schema: {\n type: 'object',\n properties: {\n option: { type: 'string', enum: [...OVERVIEW_PERIODS] },\n from: { type: 'string', format: 'date' },\n to: { type: 'string', format: 'date' },\n },\n required: ['option', 'from', 'to'],\n },\n },\n ],\n responses: {\n 200: ok(\n \"The widget's data, in the shape of its type: `StatWidgetData`, `SeriesWidgetData`, `ListWidgetData` and `BreakdownWidgetData` 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 ref('BreakdownWidgetData'),\n { type: 'object', additionalProperties: true },\n ],\n },\n ),\n ...problems(401, 403, 404, 422, 500),\n },\n },\n },\n }),\n components: {\n schemas: createComponentSchemas(),\n parameters: { Context: contextHeader },\n },\n };\n}\n"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,MAAM;QACN,YAAY;SACR,QAAQ;UAAE,MAAM;UAAU,MAAM,CAAC,GAAG,gBAAgB;SAAE;SACtD,MAAM;UAAE,MAAM;UAAU,QAAQ;SAAO;SACvC,IAAI;UAAE,MAAM;UAAU,QAAQ;SAAO;QACzC;QACA,UAAU;SAAC;SAAU;SAAQ;QAAI;OACrC;MACJ;KACJ;KACA,WAAW;MACP,KAAK,GACD,6LACA,EACI,OAAO;OACH,IAAI,gBAAgB;OACpB,IAAI,kBAAkB;OACtB,IAAI,gBAAgB;OACpB,IAAI,qBAAqB;OACzB;QAAE,MAAM;QAAU,sBAAsB;OAAK;MACjD,EACJ,CACJ;MACA,GAAG,SAAS,KAAK,KAAK,KAAK,KAAK,GAAG;KACvC;IACJ;GACJ;EACJ,CAAC;EACD,YAAY;GACR,SAAS,uBAAuB;GAChC,YAAY,EAAE,SAAS,cAAc;EACzC;CACJ;AACJ"}
1
+ {"version":3,"file":"openapi.js","names":[],"sources":["../src/openapi.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { AGGREGATE_MAX_POINTS } from './aggregates';\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 { OVERVIEW_PERIODS } from './periods';\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';\nimport { WIDGET_BREAKDOWN_MAX_ITEMS } from './widgets';\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\n/** The parameters of `GET /resources/{resource}/aggregate`: the filters and search of the list. */\nconst aggregateParameters = [\n ...listParameters.filter((parameter) => ['filter', 'q'].includes(String(parameter.name))),\n queryParameter(\n 'measure',\n 'What is measured of the items: `count` (the default), or `sum:{field}` of a field of the `sum` of the aggregates of the list. A sum of `money` adds the amounts, in minor units.',\n { type: 'string', pattern: '^(count|sum:.+)$', default: 'count' },\n ),\n queryParameter(\n 'group',\n 'How the items are grouped: `{period}:{date field}`, where the period is `day`, `week` (from Monday) or `month` and the field is in the `dates` of the aggregates, or a field of their `groupBy`. Without it, the answer is a stat.',\n { type: 'string', pattern: '^((day|week|month):.+|[^:]+)$' },\n ),\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 '/locale/{locale}': {\n parameters: [pathParameter('locale', 'A `locale` of `interfaceLocales`.')],\n get: {\n operationId: 'switchLocale',\n summary:\n 'Optional: switches the interface to a locale of `interfaceLocales`, when their `url` is here (decision 0083). The app comes with a full navigation, and the next page load gets the definition in that locale.',\n parameters: [\n queryParameter(\n 'next',\n 'Where to go next: a local path under the base path of the app. Another one is ignored.',\n { type: 'string' },\n ),\n ],\n responses: {\n 302: { description: 'To `next`, or to the base path of the app.' },\n ...problems(401, 404),\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}/aggregate': {\n parameters: [resource],\n get: {\n operationId: 'getResourceAggregate',\n description: `The count or the sum of the items of the list that the user can list, with the filters and the search of the list, in the shape of a widget (decision 0084). Only what \\`list.aggregates\\` declares is aggregated: a resource without it is a \\`404\\`, and an undeclared field, or a measure or a group in the wrong format, a \\`422\\` with \\`errors\\` keyed by \\`measure\\` or \\`group\\`. Without a group, a \\`StatWidgetData\\`. By a period, a \\`SeriesWidgetData\\`: a point per period, at 0 without items, from the period of the \\`from\\` bound of the \\`date-range\\` filter whose id is the date field to the period of its \\`to\\` bound, or without a bound, of the first or the last item; at most ${AGGREGATE_MAX_POINTS} points, the latest, and their sum in \\`total\\`. By a field, a \\`BreakdownWidgetData\\`: a part per value, the largest first, at most ${WIDGET_BREAKDOWN_MAX_ITEMS}, the rest in \\`other\\`, each with its \\`key\\` (\\`null\\` for the items without a value), the label and the tone of its option for a \\`select\\`, and the measure of every item in \\`total\\`.`,\n parameters: aggregateParameters,\n responses: {\n 200: ok('The aggregate, in the shape of a widget.', {\n anyOf: [\n ref('StatWidgetData'),\n ref('SeriesWidgetData'),\n ref('BreakdownWidgetData'),\n ],\n }),\n ...problems(401, 403, 404, 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 a dashboard of the user, read as the user (decision 0064): the home page, the dashboard page of `page`, or the summary above the list of `resource`, with the filters and the search of the list (decision 0084). The built-in widgets on a resource (`settings.resource`) have none: clients read the list or the aggregates of the resource. A widget that is not on that page or in that summary of the user is a `404`; a `403` hides the widget. `page` and `resource` together are a `422`.',\n parameters: [\n queryParameter(\n 'page',\n 'The id of the dashboard page of the widget, in `pages`. Defaults to `home`, the home page, whose widgets are `pages.home.widgets` or `dashboard.widgets`. Not with `resource`.',\n { type: 'string', minLength: 1 },\n ),\n queryParameter(\n 'resource',\n \"The id of the resource whose summary (`summary.widgets`) holds the widget, instead of a page. The request then has the list's current filters and search (`filter`, `q`), unless the widget has `settings.followsList: false`; never its sort or paging.\",\n { type: 'string', minLength: 1 },\n ),\n ...listParameters.filter((parameter) =>\n ['filter', 'q'].includes(String(parameter.name)),\n ),\n {\n name: 'period',\n in: 'query',\n required: false,\n style: 'deepObject',\n explode: true,\n description:\n 'The period chosen in the overview of the widget (decision 0084), unless the widget has `settings.period: false`: `period[option]=30d&period[from]=2026-10-19&period[to]=2026-11-17`. `from` and `to` are its first and last days, both inclusive, in the time zone of the browser. A wrong period is a `422` keyed by `period`.',\n schema: {\n type: 'object',\n properties: {\n option: { type: 'string', enum: [...OVERVIEW_PERIODS] },\n from: { type: 'string', format: 'date' },\n to: { type: 'string', format: 'date' },\n },\n required: ['option', 'from', 'to'],\n },\n },\n ],\n responses: {\n 200: ok(\n \"The widget's data, in the shape of its type: `StatWidgetData`, `SeriesWidgetData`, `ListWidgetData`, `BreakdownWidgetData`, `MetricWidgetData` and `TableWidgetData` for the built-in types, the plugin's own object for others. A `metric` that follows the period has `previous`, its value over the days of `getPreviousRange()`: the same number of days just before (`7d`, `30d`, `90d`), the same days of the month before (`month`), or of the year before (`year`).\",\n {\n anyOf: [\n ref('StatWidgetData'),\n ref('SeriesWidgetData'),\n ref('ListWidgetData'),\n ref('BreakdownWidgetData'),\n ref('MetricWidgetData'),\n ref('TableWidgetData'),\n { type: 'object', additionalProperties: true },\n ],\n },\n ),\n ...problems(401, 403, 404, 422, 500),\n },\n },\n },\n }),\n components: {\n schemas: createComponentSchemas(),\n parameters: { Context: contextHeader },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;AA2BA,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,6BAA6B,eAAe,oDAAoD,qBAAqB,8HAA8H,8BAA8B,4IAA4I,iCAAiC;CACnc,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK,+FAA+F,mCAAm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IACJ;GACJ;EACJ,CAAC;EACD,YAAY;GACR,SAAS,uBAAuB;GAChC,YAAY,EAAE,SAAS,cAAc;EACzC;CACJ;AACJ"}
package/dist/periods.d.ts CHANGED
@@ -37,6 +37,18 @@ export declare function localDay(date?: Date): string;
37
37
  * user.
38
38
  */
39
39
  export declare function getPeriodRange(option: OverviewPeriodOption, today?: string | Date): PeriodRange;
40
+ /**
41
+ * The days a period is compared with, both inclusive (decision 0089): the change of a `metric` or a
42
+ * `table` is from them.
43
+ *
44
+ * - `7d`, `30d`, `90d`, and a range without an option: the same number of days, just before it;
45
+ * - `month`: the same days of the month before, to its last day when it is shorter (March 1 to 31
46
+ * after February 1 to 28);
47
+ * - `year`: the same days a year before.
48
+ *
49
+ * A backend computes `previous` of the data of a `metric` over these days.
50
+ */
51
+ export declare function getPreviousRange(range: PeriodRange, option?: OverviewPeriodOption | null): PeriodRange;
40
52
  /** The period an overview starts on: its `default`, or its first option. */
41
53
  export declare function getDefaultPeriod(period: PeriodLike): OverviewPeriodOption | null;
42
54
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"periods.d.ts","sourceRoot":"","sources":["../src/periods.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,gBAAgB,gDAAiD,CAAC;AAE/E,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE,0FAA0F;AAC1F,eAAO,MAAM,YAAY,WAAW,CAAC;AAErC,yFAAyF;AACzF,MAAM,WAAW,UAAU;IACvB,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAED,0EAA0E;AAC1E,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACd;AAED,2FAA2F;AAC3F,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC7C,MAAM,EAAE,oBA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,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACd;AAED,2FAA2F;AAC3F,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC7C,MAAM,EAAE,oBAAoB,CAAC;CAChC;AAKD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,oBAAoB,CAE9E;AAED,4DAA4D;AAC5D,wBAAgB,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAUrD;AAED,2FAA2F;AAC3F,wBAAgB,QAAQ,CAAC,IAAI,GAAE,IAAiB,GAAG,MAAM,CAGxD;AAaD;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAC1B,MAAM,EAAE,oBAAoB,EAC5B,KAAK,GAAE,MAAM,GAAG,IAAiB,GAClC,WAAW,CAYb;AAQD;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC5B,KAAK,EAAE,WAAW,EAClB,MAAM,CAAC,EAAE,oBAAoB,GAAG,IAAI,GACrC,WAAW,CA2Bb;AAED,4EAA4E;AAC5E,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,oBAAoB,GAAG,IAAI,CAGhF;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC5B,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAChC,MAAM,EAAE,UAAU,GACnB,oBAAoB,GAAG,IAAI,CAI7B;AAED,yFAAyF;AACzF,wBAAgB,gBAAgB,CAC5B,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,UAAU,EAClB,KAAK,GAAE,MAAM,GAAG,IAAiB,GAClC,oBAAoB,GAAG,IAAI,CAW7B"}
package/dist/periods.js CHANGED
@@ -66,6 +66,43 @@ function getPeriodRange(option, today = /* @__PURE__ */ new Date()) {
66
66
  to
67
67
  };
68
68
  }
69
+ var DAY_MS = 864e5;
70
+ /** The number of days of a month, of a year and a month from 0. */
71
+ var daysInMonth = (year, month) => new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
72
+ /**
73
+ * The days a period is compared with, both inclusive (decision 0089): the change of a `metric` or a
74
+ * `table` is from them.
75
+ *
76
+ * - `7d`, `30d`, `90d`, and a range without an option: the same number of days, just before it;
77
+ * - `month`: the same days of the month before, to its last day when it is shorter (March 1 to 31
78
+ * after February 1 to 28);
79
+ * - `year`: the same days a year before.
80
+ *
81
+ * A backend computes `previous` of the data of a `metric` over these days.
82
+ */
83
+ function getPreviousRange(range, option) {
84
+ const from = utcDay(range.from);
85
+ const to = utcDay(range.to);
86
+ if (option === "month" || option === "year") {
87
+ const back = option === "month" ? 1 : 12;
88
+ const shift = (date) => {
89
+ const year = date.getUTCFullYear();
90
+ const month = date.getUTCMonth() - back;
91
+ const target = new Date(Date.UTC(year, month, 1));
92
+ const last = daysInMonth(target.getUTCFullYear(), target.getUTCMonth());
93
+ return toDay(new Date(Date.UTC(target.getUTCFullYear(), target.getUTCMonth(), Math.min(date.getUTCDate(), last))));
94
+ };
95
+ return {
96
+ from: shift(from),
97
+ to: shift(to)
98
+ };
99
+ }
100
+ const days = Math.round((to.getTime() - from.getTime()) / DAY_MS) + 1;
101
+ return {
102
+ from: toDay(/* @__PURE__ */ new Date(from.getTime() - days * DAY_MS)),
103
+ to: toDay(/* @__PURE__ */ new Date(from.getTime() - DAY_MS))
104
+ };
105
+ }
69
106
  /** The period an overview starts on: its `default`, or its first option. */
70
107
  function getDefaultPeriod(period) {
71
108
  const candidate = period.default ?? period.options[0];
@@ -88,6 +125,6 @@ function findPeriodOption(range, period, today = /* @__PURE__ */ new Date()) {
88
125
  }) ?? null;
89
126
  }
90
127
  //#endregion
91
- export { OVERVIEW_PERIODS, PERIOD_PARAM, findPeriodOption, getDefaultPeriod, getPeriodRange, isDay, isOverviewPeriod, localDay, readPeriodOption };
128
+ export { OVERVIEW_PERIODS, PERIOD_PARAM, findPeriodOption, getDefaultPeriod, getPeriodRange, getPreviousRange, isDay, isOverviewPeriod, localDay, readPeriodOption };
92
129
 
93
130
  //# sourceMappingURL=periods.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"periods.js","names":[],"sources":["../src/periods.ts"],"sourcesContent":["import { type FilterRange, isFilterRange } from './query';\n\n/**\n * The periods an overview can offer (decision 0084): the 7, 30 or 90 days ending today, the current\n * calendar month, and the last 12 months.\n */\nexport const OVERVIEW_PERIODS = ['7d', '30d', '90d', 'month', 'year'] as const;\n\nexport type OverviewPeriodOption = (typeof OVERVIEW_PERIODS)[number];\n\n/** The query parameter of the chosen period, in the URL of a dashboard page or a list. */\nexport const PERIOD_PARAM = 'period';\n\n/** A period as the helpers read it: the `period` of a dashboard page or of a summary. */\nexport interface PeriodLike {\n options: readonly string[];\n default?: string | undefined;\n}\n\n/** The days of a period, both inclusive: `2026-10-19` to `2026-11-17`. */\nexport interface PeriodRange {\n from: string;\n to: string;\n}\n\n/** The chosen period of an overview, with its days, as widgets with an endpoint get it. */\nexport interface WidgetPeriod extends PeriodRange {\n option: OverviewPeriodOption;\n}\n\nconst DAY = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\nconst DAYS: Record<string, number> = { '7d': 7, '30d': 30, '90d': 90 };\n\nexport function isOverviewPeriod(value: unknown): value is OverviewPeriodOption {\n return (OVERVIEW_PERIODS as readonly unknown[]).includes(value);\n}\n\n/** Whether a string is a day, `2026-11-17`, that exists. */\nexport function isDay(value: unknown): value is string {\n if (typeof value !== 'string') {\n return false;\n }\n const match = DAY.exec(value);\n if (match === null) {\n return false;\n }\n const date = new Date(Date.UTC(Number(match[1]), Number(match[2]) - 1, Number(match[3])));\n return date.toISOString().slice(0, 10) === value;\n}\n\n/** The day of a date in the time zone of the browser (or of the runtime): `2026-11-17`. */\nexport function localDay(date: Date = new Date()): string {\n const pad = (value: number) => String(value).padStart(2, '0');\n return `${String(date.getFullYear())}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;\n}\n\n/** A day as a date at midnight UTC, for the arithmetic of days. */\nfunction utcDay(day: string): Date {\n const match = DAY.exec(day);\n if (match === null) {\n throw new Error(`Not a day: ${day}.`);\n }\n return new Date(Date.UTC(Number(match[1]), Number(match[2]) - 1, Number(match[3])));\n}\n\nconst toDay = (date: Date) => date.toISOString().slice(0, 10);\n\n/**\n * The days of a period, both inclusive, ending `today` (decision 0084):\n *\n * - `7d`, `30d`, `90d`: the 7, 30 or 90 days ending today, today included;\n * - `month`: the current calendar month, from its first day to today;\n * - `year`: the last 12 months, the current month and the 11 before it, from the first day of the\n * month 11 months ago to today.\n *\n * `today` is a day (`2026-11-17`), or a date read in the local time zone: the browser's, for the\n * user.\n */\nexport function getPeriodRange(\n option: OverviewPeriodOption,\n today: string | Date = new Date(),\n): PeriodRange {\n const to = typeof today === 'string' ? today : localDay(today);\n const end = utcDay(to);\n const days = DAYS[option];\n if (days !== undefined) {\n return { from: toDay(new Date(end.getTime() - (days - 1) * 86_400_000)), to };\n }\n const back = option === 'year' ? 11 : 0;\n return {\n from: toDay(new Date(Date.UTC(end.getUTCFullYear(), end.getUTCMonth() - back, 1))),\n to,\n };\n}\n\n/** The period an overview starts on: its `default`, or its first option. */\nexport function getDefaultPeriod(period: PeriodLike): OverviewPeriodOption | null {\n const candidate = period.default ?? period.options[0];\n return isOverviewPeriod(candidate) ? candidate : null;\n}\n\n/**\n * The period chosen in a URL (`?period=90d`), when it is an option of the overview: else its\n * default.\n */\nexport function readPeriodOption(\n value: string | null | undefined,\n period: PeriodLike,\n): OverviewPeriodOption | null {\n return isOverviewPeriod(value) && period.options.includes(value)\n ? value\n : getDefaultPeriod(period);\n}\n\n/** The option of an overview whose days are those of a range, if one is: else `null`. */\nexport function findPeriodOption(\n range: unknown,\n period: PeriodLike,\n today: string | Date = new Date(),\n): OverviewPeriodOption | null {\n if (!isFilterRange(range)) {\n return null;\n }\n const { from, to } = range as FilterRange;\n return (\n period.options.filter(isOverviewPeriod).find((option) => {\n const days = getPeriodRange(option, today);\n return days.from === String(from) && days.to === String(to);\n }) ?? null\n );\n}\n"],"mappings":";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,MAAM,MAAM,OAAO,EAAE;CACrB,MAAM,OAAO,KAAK;CAClB,IAAI,SAAS,KAAA,GACT,OAAO;EAAE,MAAM,sBAAM,IAAI,KAAK,IAAI,QAAQ,KAAK,OAAO,KAAK,KAAU,CAAC;EAAG;CAAG;CAEhF,MAAM,OAAO,WAAW,SAAS,KAAK;CACtC,OAAO;EACH,MAAM,MAAM,IAAI,KAAK,KAAK,IAAI,IAAI,eAAe,GAAG,IAAI,YAAY,IAAI,MAAM,CAAC,CAAC,CAAC;EACjF;CACJ;AACJ;;AAGA,SAAgB,iBAAiB,QAAiD;CAC9E,MAAM,YAAY,OAAO,WAAW,OAAO,QAAQ;CACnD,OAAO,iBAAiB,SAAS,IAAI,YAAY;AACrD;;;;;AAMA,SAAgB,iBACZ,OACA,QAC2B;CAC3B,OAAO,iBAAiB,KAAK,KAAK,OAAO,QAAQ,SAAS,KAAK,IACzD,QACA,iBAAiB,MAAM;AACjC;;AAGA,SAAgB,iBACZ,OACA,QACA,wBAAuB,IAAI,KAAK,GACL;CAC3B,IAAI,CAAC,cAAc,KAAK,GACpB,OAAO;CAEX,MAAM,EAAE,MAAM,OAAO;CACrB,OACI,OAAO,QAAQ,OAAO,gBAAgB,CAAC,CAAC,MAAM,WAAW;EACrD,MAAM,OAAO,eAAe,QAAQ,KAAK;EACzC,OAAO,KAAK,SAAS,OAAO,IAAI,KAAK,KAAK,OAAO,OAAO,EAAE;CAC9D,CAAC,KAAK;AAEd"}
1
+ {"version":3,"file":"periods.js","names":[],"sources":["../src/periods.ts"],"sourcesContent":["import { type FilterRange, isFilterRange } from './query';\n\n/**\n * The periods an overview can offer (decision 0084): the 7, 30 or 90 days ending today, the current\n * calendar month, and the last 12 months.\n */\nexport const OVERVIEW_PERIODS = ['7d', '30d', '90d', 'month', 'year'] as const;\n\nexport type OverviewPeriodOption = (typeof OVERVIEW_PERIODS)[number];\n\n/** The query parameter of the chosen period, in the URL of a dashboard page or a list. */\nexport const PERIOD_PARAM = 'period';\n\n/** A period as the helpers read it: the `period` of a dashboard page or of a summary. */\nexport interface PeriodLike {\n options: readonly string[];\n default?: string | undefined;\n}\n\n/** The days of a period, both inclusive: `2026-10-19` to `2026-11-17`. */\nexport interface PeriodRange {\n from: string;\n to: string;\n}\n\n/** The chosen period of an overview, with its days, as widgets with an endpoint get it. */\nexport interface WidgetPeriod extends PeriodRange {\n option: OverviewPeriodOption;\n}\n\nconst DAY = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\nconst DAYS: Record<string, number> = { '7d': 7, '30d': 30, '90d': 90 };\n\nexport function isOverviewPeriod(value: unknown): value is OverviewPeriodOption {\n return (OVERVIEW_PERIODS as readonly unknown[]).includes(value);\n}\n\n/** Whether a string is a day, `2026-11-17`, that exists. */\nexport function isDay(value: unknown): value is string {\n if (typeof value !== 'string') {\n return false;\n }\n const match = DAY.exec(value);\n if (match === null) {\n return false;\n }\n const date = new Date(Date.UTC(Number(match[1]), Number(match[2]) - 1, Number(match[3])));\n return date.toISOString().slice(0, 10) === value;\n}\n\n/** The day of a date in the time zone of the browser (or of the runtime): `2026-11-17`. */\nexport function localDay(date: Date = new Date()): string {\n const pad = (value: number) => String(value).padStart(2, '0');\n return `${String(date.getFullYear())}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;\n}\n\n/** A day as a date at midnight UTC, for the arithmetic of days. */\nfunction utcDay(day: string): Date {\n const match = DAY.exec(day);\n if (match === null) {\n throw new Error(`Not a day: ${day}.`);\n }\n return new Date(Date.UTC(Number(match[1]), Number(match[2]) - 1, Number(match[3])));\n}\n\nconst toDay = (date: Date) => date.toISOString().slice(0, 10);\n\n/**\n * The days of a period, both inclusive, ending `today` (decision 0084):\n *\n * - `7d`, `30d`, `90d`: the 7, 30 or 90 days ending today, today included;\n * - `month`: the current calendar month, from its first day to today;\n * - `year`: the last 12 months, the current month and the 11 before it, from the first day of the\n * month 11 months ago to today.\n *\n * `today` is a day (`2026-11-17`), or a date read in the local time zone: the browser's, for the\n * user.\n */\nexport function getPeriodRange(\n option: OverviewPeriodOption,\n today: string | Date = new Date(),\n): PeriodRange {\n const to = typeof today === 'string' ? today : localDay(today);\n const end = utcDay(to);\n const days = DAYS[option];\n if (days !== undefined) {\n return { from: toDay(new Date(end.getTime() - (days - 1) * 86_400_000)), to };\n }\n const back = option === 'year' ? 11 : 0;\n return {\n from: toDay(new Date(Date.UTC(end.getUTCFullYear(), end.getUTCMonth() - back, 1))),\n to,\n };\n}\n\nconst DAY_MS = 86_400_000;\n\n/** The number of days of a month, of a year and a month from 0. */\nconst daysInMonth = (year: number, month: number) =>\n new Date(Date.UTC(year, month + 1, 0)).getUTCDate();\n\n/**\n * The days a period is compared with, both inclusive (decision 0089): the change of a `metric` or a\n * `table` is from them.\n *\n * - `7d`, `30d`, `90d`, and a range without an option: the same number of days, just before it;\n * - `month`: the same days of the month before, to its last day when it is shorter (March 1 to 31\n * after February 1 to 28);\n * - `year`: the same days a year before.\n *\n * A backend computes `previous` of the data of a `metric` over these days.\n */\nexport function getPreviousRange(\n range: PeriodRange,\n option?: OverviewPeriodOption | null,\n): PeriodRange {\n const from = utcDay(range.from);\n const to = utcDay(range.to);\n if (option === 'month' || option === 'year') {\n const back = option === 'month' ? 1 : 12;\n const shift = (date: Date) => {\n const year = date.getUTCFullYear();\n const month = date.getUTCMonth() - back;\n const target = new Date(Date.UTC(year, month, 1));\n const last = daysInMonth(target.getUTCFullYear(), target.getUTCMonth());\n return toDay(\n new Date(\n Date.UTC(\n target.getUTCFullYear(),\n target.getUTCMonth(),\n Math.min(date.getUTCDate(), last),\n ),\n ),\n );\n };\n return { from: shift(from), to: shift(to) };\n }\n const days = Math.round((to.getTime() - from.getTime()) / DAY_MS) + 1;\n return {\n from: toDay(new Date(from.getTime() - days * DAY_MS)),\n to: toDay(new Date(from.getTime() - DAY_MS)),\n };\n}\n\n/** The period an overview starts on: its `default`, or its first option. */\nexport function getDefaultPeriod(period: PeriodLike): OverviewPeriodOption | null {\n const candidate = period.default ?? period.options[0];\n return isOverviewPeriod(candidate) ? candidate : null;\n}\n\n/**\n * The period chosen in a URL (`?period=90d`), when it is an option of the overview: else its\n * default.\n */\nexport function readPeriodOption(\n value: string | null | undefined,\n period: PeriodLike,\n): OverviewPeriodOption | null {\n return isOverviewPeriod(value) && period.options.includes(value)\n ? value\n : getDefaultPeriod(period);\n}\n\n/** The option of an overview whose days are those of a range, if one is: else `null`. */\nexport function findPeriodOption(\n range: unknown,\n period: PeriodLike,\n today: string | Date = new Date(),\n): OverviewPeriodOption | null {\n if (!isFilterRange(range)) {\n return null;\n }\n const { from, to } = range as FilterRange;\n return (\n period.options.filter(isOverviewPeriod).find((option) => {\n const days = getPeriodRange(option, today);\n return days.from === String(from) && days.to === String(to);\n }) ?? null\n );\n}\n"],"mappings":";;;;;;AAMA,IAAa,mBAAmB;CAAC;CAAM;CAAO;CAAO;CAAS;AAAM;;AAKpE,IAAa,eAAe;AAmB5B,IAAM,MAAM;AACZ,IAAM,OAA+B;CAAE,MAAM;CAAG,OAAO;CAAI,OAAO;AAAG;AAErE,SAAgB,iBAAiB,OAA+C;CAC5E,OAAQ,iBAAwC,SAAS,KAAK;AAClE;;AAGA,SAAgB,MAAM,OAAiC;CACnD,IAAI,OAAO,UAAU,UACjB,OAAO;CAEX,MAAM,QAAQ,IAAI,KAAK,KAAK;CAC5B,IAAI,UAAU,MACV,OAAO;CAGX,OAAO,IADU,KAAK,KAAK,IAAI,OAAO,MAAM,EAAE,GAAG,OAAO,MAAM,EAAE,IAAI,GAAG,OAAO,MAAM,EAAE,CAAC,CAChF,CAAA,CAAK,YAAY,CAAC,CAAC,MAAM,GAAG,EAAE,MAAM;AAC/C;;AAGA,SAAgB,SAAS,uBAAa,IAAI,KAAK,GAAW;CACtD,MAAM,OAAO,UAAkB,OAAO,KAAK,CAAC,CAAC,SAAS,GAAG,GAAG;CAC5D,OAAO,GAAG,OAAO,KAAK,YAAY,CAAC,EAAE,GAAG,IAAI,KAAK,SAAS,IAAI,CAAC,EAAE,GA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AAM,SAAS,IAAI,KAAK,KAAK,IAAI,MAAM,OAAO,CAAC,CAAC;GAChD,MAAM,OAAO,YAAY,OAAO,eAAe,GAAG,OAAO,YAAY,CAAC;GACtE,OAAO,MACH,IAAI,KACA,KAAK,IACD,OAAO,eAAe,GACtB,OAAO,YAAY,GACnB,KAAK,IAAI,KAAK,WAAW,GAAG,IAAI,CACpC,CACJ,CACJ;EACJ;EACA,OAAO;GAAE,MAAM,MAAM,IAAI;GAAG,IAAI,MAAM,EAAE;EAAE;CAC9C;CACA,MAAM,OAAO,KAAK,OAAO,GAAG,QAAQ,IAAI,KAAK,QAAQ,KAAK,MAAM,IAAI;CACpE,OAAO;EACH,MAAM,sBAAM,IAAI,KAAK,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC;EACpD,IAAI,sBAAM,IAAI,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC;CAC/C;AACJ;;AAGA,SAAgB,iBAAiB,QAAiD;CAC9E,MAAM,YAAY,OAAO,WAAW,OAAO,QAAQ;CACnD,OAAO,iBAAiB,SAAS,IAAI,YAAY;AACrD;;;;;AAMA,SAAgB,iBACZ,OACA,QAC2B;CAC3B,OAAO,iBAAiB,KAAK,KAAK,OAAO,QAAQ,SAAS,KAAK,IACzD,QACA,iBAAiB,MAAM;AACjC;;AAGA,SAAgB,iBACZ,OACA,QACA,wBAAuB,IAAI,KAAK,GACL;CAC3B,IAAI,CAAC,cAAc,KAAK,GACpB,OAAO;CAEX,MAAM,EAAE,MAAM,OAAO;CACrB,OACI,OAAO,QAAQ,OAAO,gBAAgB,CAAC,CAAC,MAAM,WAAW;EACrD,MAAM,OAAO,eAAe,QAAQ,KAAK;EACzC,OAAO,KAAK,SAAS,OAAO,IAAI,KAAK,KAAK,OAAO,OAAO,EAAE;CAC9D,CAAC,KAAK;AAEd"}
@@ -18,7 +18,7 @@ export { type ContextValues, contextBefore, formatContextHeader, parseContextHea
18
18
  export { isProblem } from '../problem.js';
19
19
  export { type PartialTheme, mergeThemes } from '../themes.js';
20
20
  export { type ReadWidgetDataQueryResult, type WidgetDataRequest, type WidgetListQuery, DASHBOARD_COMPONENT, HOME_PAGE, getDashboardPages, getDashboardPeriod, getDashboardWidgets, getSummaryPeriodFilter, getSummaryResources, getSummaryWidgets, readWidgetDataQuery, toWidgetDataParams, } from '../dashboards.js';
21
- export { type BuiltInWidgetType, type WidgetAggregate, type WidgetResource, type WidgetSeriesPeriod, BUILT_IN_WIDGET_TYPES, GROUPED_WIDGET_TYPES, RESOURCE_WIDGET_TYPES, WIDGET_BREAKDOWN_MAX_ITEMS, WIDGET_LIST_MAX_ITEMS, WIDGET_RESERVED_QUERY_PARAMS, WIDGET_SERIES_PERIODS, checkWidgetData, followsList, followsPeriod, getWidgetResource, isBuiltInWidgetType, } from '../widgets.js';
21
+ export { type BuiltInWidgetType, type WidgetAggregate, type WidgetAggregateRead, type WidgetAggregateRole, type WidgetChange, type WidgetGoodWhen, type WidgetResource, type WidgetSeriesPeriod, type WidgetSource, type WidgetSourceAlert, BUILT_IN_WIDGET_TYPES, GROUPED_WIDGET_TYPES, RESOURCE_WIDGET_TYPES, WIDGET_BREAKDOWN_MAX_ITEMS, WIDGET_FORMAT_CURRENCY_DISPLAYS, WIDGET_FORMAT_NOTATIONS, WIDGET_FORMAT_SIGN_DISPLAYS, WIDGET_FORMAT_STYLES, WIDGET_FORMAT_UNIT_DISPLAYS, WIDGET_FORMAT_UNITS, WIDGET_GOOD_WHEN, WIDGET_LIST_MAX_ITEMS, WIDGET_METRIC_MAX_PARTS, WIDGET_RESERVED_QUERY_PARAMS, WIDGET_SERIES_MAX_SERIES, WIDGET_SERIES_PERIODS, WIDGET_SOURCES_MAX, WIDGET_TABLE_ALIGNS, WIDGET_TABLE_MAX_COLUMNS, WIDGET_TABLE_MAX_ROWS, checkWidgetData, followsList, followsPeriod, getChangeTone, getWidgetAggregates, getWidgetChange, getWidgetResource, getWidgetSources, isBuiltInWidgetType, isCombinedWidget, isWidgetDataEmpty, isWidgetUnit, readWidgetFormat, readsResources, } from '../widgets.js';
22
22
  export { type AggregateField, type AggregateGroup, type AggregateItemsOptions, type AggregateMeasure, type AggregateQuery, type AggregateRequest, type AggregateWidgetType, type ListAggregatesLike, type ReadAggregateQueryResult, AGGREGATE_COUNT, AGGREGATE_MAX_POINTS, aggregateItems, getAggregateWidgetType, getFilterRange, listPeriods, nextPeriod, parseAggregateGroup, parseAggregateMeasure, readAggregateQuery, startOfPeriod, toAggregateParams, } from '../aggregates.js';
23
- export { type OverviewPeriodOption, type PeriodLike, type PeriodRange, type WidgetPeriod, OVERVIEW_PERIODS, PERIOD_PARAM, findPeriodOption, getDefaultPeriod, getPeriodRange, isDay, isOverviewPeriod, localDay, readPeriodOption, } from '../periods.js';
23
+ export { type OverviewPeriodOption, type PeriodLike, type PeriodRange, type WidgetPeriod, OVERVIEW_PERIODS, PERIOD_PARAM, findPeriodOption, getDefaultPeriod, getPeriodRange, getPreviousRange, isDay, isOverviewPeriod, localDay, readPeriodOption, } from '../periods.js';
24
24
  //# 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,EACH,KAAK,YAAY,EACjB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,YAAY,GACf,MAAM,eAAe,CAAC;AACvB,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,KAAK,WAAW,EAAE,cAAc,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACpG,OAAO,EACH,qBAAqB,EACrB,uBAAuB,EACvB,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,EACH,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,mBAAmB,EACnB,SAAS,EACT,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACH,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,0BAA0B,EAC1B,qBAAqB,EACrB,4BAA4B,EAC5B,qBAAqB,EACrB,eAAe,EACf,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,mBAAmB,GACtB,MAAM,YAAY,CAAC;AACpB,OAAO,EACH,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,sBAAsB,EACtB,cAAc,EACd,WAAW,EACX,UAAU,EACV,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,iBAAiB,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACH,KAAK,oBAAoB,EACzB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,KAAK,EACL,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,GACnB,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;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,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,cAAc,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EACH,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,sBAAsB,EACtB,cAAc,EACd,WAAW,EACX,UAAU,EACV,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,iBAAiB,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACH,KAAK,oBAAoB,EACzB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,KAAK,EACL,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,GACnB,MAAM,YAAY,CAAC"}
@@ -11,13 +11,13 @@ import { checkRules, checkValues } from "../rules.js";
11
11
  import { getImageUrl, getItemImageField, getMediaLibraries } from "../libraries.js";
12
12
  import { ITEM_TYPE_KEY, getCreatableTypes, getItemType, getResourceType, getTypeFields, hasResourceTypes } from "../resourceTypes.js";
13
13
  import { fromSearchParams, isCursorPage, isFilterRange, matchesFilterRange, toSearchParams } from "../query.js";
14
- import { BUILT_IN_WIDGET_TYPES, GROUPED_WIDGET_TYPES, RESOURCE_WIDGET_TYPES, WIDGET_BREAKDOWN_MAX_ITEMS, WIDGET_LIST_MAX_ITEMS, WIDGET_RESERVED_QUERY_PARAMS, WIDGET_SERIES_PERIODS, checkWidgetData, followsList, followsPeriod, getWidgetResource, isBuiltInWidgetType } from "../widgets.js";
14
+ import { BUILT_IN_WIDGET_TYPES, GROUPED_WIDGET_TYPES, RESOURCE_WIDGET_TYPES, WIDGET_BREAKDOWN_MAX_ITEMS, WIDGET_FORMAT_CURRENCY_DISPLAYS, WIDGET_FORMAT_NOTATIONS, WIDGET_FORMAT_SIGN_DISPLAYS, WIDGET_FORMAT_STYLES, WIDGET_FORMAT_UNITS, WIDGET_FORMAT_UNIT_DISPLAYS, WIDGET_GOOD_WHEN, WIDGET_LIST_MAX_ITEMS, WIDGET_METRIC_MAX_PARTS, WIDGET_RESERVED_QUERY_PARAMS, WIDGET_SERIES_MAX_SERIES, WIDGET_SERIES_PERIODS, WIDGET_SOURCES_MAX, WIDGET_TABLE_ALIGNS, WIDGET_TABLE_MAX_COLUMNS, WIDGET_TABLE_MAX_ROWS, checkWidgetData, followsList, followsPeriod, getChangeTone, getWidgetAggregates, getWidgetChange, getWidgetResource, getWidgetSources, isBuiltInWidgetType, isCombinedWidget, isWidgetDataEmpty, isWidgetUnit, readWidgetFormat, readsResources } from "../widgets.js";
15
15
  import { AGGREGATE_COUNT, AGGREGATE_MAX_POINTS, aggregateItems, getAggregateWidgetType, getFilterRange, listPeriods, nextPeriod, parseAggregateGroup, parseAggregateMeasure, readAggregateQuery, startOfPeriod, toAggregateParams } from "../aggregates.js";
16
- import { OVERVIEW_PERIODS, PERIOD_PARAM, findPeriodOption, getDefaultPeriod, getPeriodRange, isDay, isOverviewPeriod, localDay, readPeriodOption } from "../periods.js";
16
+ import { OVERVIEW_PERIODS, PERIOD_PARAM, findPeriodOption, getDefaultPeriod, getPeriodRange, getPreviousRange, isDay, isOverviewPeriod, localDay, readPeriodOption } from "../periods.js";
17
17
  import { DASHBOARD_COMPONENT, HOME_PAGE, getDashboardPages, getDashboardPeriod, getDashboardWidgets, getSummaryPeriodFilter, getSummaryResources, getSummaryWidgets, readWidgetDataQuery, toWidgetDataParams } from "../dashboards.js";
18
18
  import { lintDefinition } from "../lint.js";
19
19
  import { SEARCH_DEFAULT_LIMIT, SEARCH_MAX_LENGTH, SEARCH_MAX_LIMIT, SEARCH_MIN_LENGTH, isSearchableResource, readSearchQuery, toSearchQueryParams } from "../search.js";
20
20
  import { contextBefore, formatContextHeader, parseContextHeader } from "../context.js";
21
21
  import { isProblem } from "../problem.js";
22
22
  import { mergeThemes } from "../themes.js";
23
- export { ADDRESS_PARTS, AGGREGATE_COUNT, AGGREGATE_MAX_POINTS, AUTH_ERROR_CODES, AUTH_ERROR_PARAM, AUTH_PAGE_PATHS, BOOT_CONFIG_ELEMENT_ID, BUILT_IN_ACTIONS, BUILT_IN_FIELD_TYPES, BUILT_IN_ITEM_ACTIONS, BUILT_IN_LAYOUT_NODE_TYPES, BUILT_IN_LINK_ACTIONS, BUILT_IN_LINK_TYPES, BUILT_IN_LIST_LAYOUTS, BUILT_IN_WIDGET_TYPES, CONTEXT_HEADER, CONTEXT_PROBLEM_TYPE, CURRENCY_CODES, DASHBOARD_COMPONENT, DATE_RANGE_OPEN_BOUNDS, DEFAULT_ADDRESS_REQUIRED_PARTS, DURATION_UNITS, EMAIL_UNVERIFIED_PROBLEM_TYPE, GROUPED_WIDGET_TYPES, HOME_PAGE, IDS_FILTER, IDS_FILTER_LIMIT, ITEM_ACTION_ABILITIES, ITEM_TYPE_KEY, OVERVIEW_PERIODS, PASSWORD_CONFIRMATION_PROBLEM_TYPE, PERIOD_PARAM, PORTABLE_RULES, POSTAL_CODE_COUNTRIES, PROBLEM_CONTENT_TYPE, PROTOCOL_VERSION, RESERVED_ROUTE_SEGMENTS, RESOURCE_WIDGET_TYPES, RICH_TEXT_STYLE_ELEMENTS, SEARCH_DEFAULT_LIMIT, SEARCH_MAX_LENGTH, SEARCH_MAX_LIMIT, SEARCH_MIN_LENGTH, TWO_FACTOR_REQUIRED_PROBLEM_TYPE, UNDO_LIMIT, WIDGET_BREAKDOWN_MAX_ITEMS, WIDGET_LIST_MAX_ITEMS, WIDGET_RESERVED_QUERY_PARAMS, WIDGET_SERIES_PERIODS, aggregateItems, checkRules, checkValues, checkWidgetData, contextBefore, evaluateCondition, findPeriodOption, followsList, followsPeriod, formatContextHeader, fromMinorUnits, fromSearchParams, getAddressRequiredParts, getAggregateWidgetType, getCreatableTypes, getCurrencyDigits, getDashboardPages, getDashboardPeriod, getDashboardWidgets, getDefaultPeriod, getFilterRange, getImageUrl, getItemImageField, getItemType, getLinkNewTab, getLinkTypes, getMediaLibraries, getNestedShape, getPeriodRange, getResourceType, getSummaryPeriodFilter, getSummaryResources, getSummaryWidgets, getTypeFields, getValue, getWidgetResource, hasResourceTypes, isAddressPart, isBuiltInFieldType, isBuiltInItemAction, isBuiltInLink, isBuiltInLinkType, isBuiltInWidgetType, isCompoundField, isCurrencyCode, isCursorPage, isDay, isExternalUrl, isFilled, isFilterRange, isOverviewPeriod, isPostalCode, isProblem, isSearchableResource, lintDefinition, listPeriods, localDay, matchesFilterRange, matchesRatio, mergeThemes, nextPeriod, normalizePostalCode, parseAggregateGroup, parseAggregateMeasure, parseContextHeader, parseRatio, readAggregateQuery, readPeriodOption, readSearchQuery, readWidgetDataQuery, renderedCropSize, resolveLinkNewTab, startOfPeriod, toAggregateParams, toMinorUnits, toSearchParams, toSearchQueryParams, toWidgetDataParams };
23
+ export { ADDRESS_PARTS, AGGREGATE_COUNT, AGGREGATE_MAX_POINTS, AUTH_ERROR_CODES, AUTH_ERROR_PARAM, AUTH_PAGE_PATHS, BOOT_CONFIG_ELEMENT_ID, BUILT_IN_ACTIONS, BUILT_IN_FIELD_TYPES, BUILT_IN_ITEM_ACTIONS, BUILT_IN_LAYOUT_NODE_TYPES, BUILT_IN_LINK_ACTIONS, BUILT_IN_LINK_TYPES, BUILT_IN_LIST_LAYOUTS, BUILT_IN_WIDGET_TYPES, CONTEXT_HEADER, CONTEXT_PROBLEM_TYPE, CURRENCY_CODES, DASHBOARD_COMPONENT, DATE_RANGE_OPEN_BOUNDS, DEFAULT_ADDRESS_REQUIRED_PARTS, DURATION_UNITS, EMAIL_UNVERIFIED_PROBLEM_TYPE, GROUPED_WIDGET_TYPES, HOME_PAGE, IDS_FILTER, IDS_FILTER_LIMIT, ITEM_ACTION_ABILITIES, ITEM_TYPE_KEY, OVERVIEW_PERIODS, PASSWORD_CONFIRMATION_PROBLEM_TYPE, PERIOD_PARAM, PORTABLE_RULES, POSTAL_CODE_COUNTRIES, PROBLEM_CONTENT_TYPE, PROTOCOL_VERSION, RESERVED_ROUTE_SEGMENTS, RESOURCE_WIDGET_TYPES, RICH_TEXT_STYLE_ELEMENTS, SEARCH_DEFAULT_LIMIT, SEARCH_MAX_LENGTH, SEARCH_MAX_LIMIT, SEARCH_MIN_LENGTH, TWO_FACTOR_REQUIRED_PROBLEM_TYPE, UNDO_LIMIT, WIDGET_BREAKDOWN_MAX_ITEMS, WIDGET_FORMAT_CURRENCY_DISPLAYS, WIDGET_FORMAT_NOTATIONS, WIDGET_FORMAT_SIGN_DISPLAYS, WIDGET_FORMAT_STYLES, WIDGET_FORMAT_UNITS, WIDGET_FORMAT_UNIT_DISPLAYS, WIDGET_GOOD_WHEN, WIDGET_LIST_MAX_ITEMS, WIDGET_METRIC_MAX_PARTS, WIDGET_RESERVED_QUERY_PARAMS, WIDGET_SERIES_MAX_SERIES, WIDGET_SERIES_PERIODS, WIDGET_SOURCES_MAX, WIDGET_TABLE_ALIGNS, WIDGET_TABLE_MAX_COLUMNS, WIDGET_TABLE_MAX_ROWS, aggregateItems, checkRules, checkValues, checkWidgetData, contextBefore, evaluateCondition, findPeriodOption, followsList, followsPeriod, formatContextHeader, fromMinorUnits, fromSearchParams, getAddressRequiredParts, getAggregateWidgetType, getChangeTone, getCreatableTypes, getCurrencyDigits, getDashboardPages, getDashboardPeriod, getDashboardWidgets, getDefaultPeriod, getFilterRange, getImageUrl, getItemImageField, getItemType, getLinkNewTab, getLinkTypes, getMediaLibraries, getNestedShape, getPeriodRange, getPreviousRange, getResourceType, getSummaryPeriodFilter, getSummaryResources, getSummaryWidgets, getTypeFields, getValue, getWidgetAggregates, getWidgetChange, getWidgetResource, getWidgetSources, hasResourceTypes, isAddressPart, isBuiltInFieldType, isBuiltInItemAction, isBuiltInLink, isBuiltInLinkType, isBuiltInWidgetType, isCombinedWidget, isCompoundField, isCurrencyCode, isCursorPage, isDay, isExternalUrl, isFilled, isFilterRange, isOverviewPeriod, isPostalCode, isProblem, isSearchableResource, isWidgetDataEmpty, isWidgetUnit, lintDefinition, listPeriods, localDay, matchesFilterRange, matchesRatio, mergeThemes, nextPeriod, normalizePostalCode, parseAggregateGroup, parseAggregateMeasure, parseContextHeader, parseRatio, readAggregateQuery, readPeriodOption, readSearchQuery, readWidgetDataQuery, readWidgetFormat, readsResources, renderedCropSize, resolveLinkNewTab, startOfPeriod, toAggregateParams, toMinorUnits, toSearchParams, toSearchQueryParams, toWidgetDataParams };