@panneau/protocol 5.0.0-alpha.17 → 5.0.0-alpha.19

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 (68) hide show
  1. package/dist/compound.d.ts +20 -0
  2. package/dist/compound.d.ts.map +1 -0
  3. package/dist/compound.js +27 -0
  4. package/dist/compound.js.map +1 -0
  5. package/dist/conformance/index.d.ts.map +1 -1
  6. package/dist/conformance/index.js +94 -0
  7. package/dist/conformance/index.js.map +1 -1
  8. package/dist/constants.d.ts +5 -0
  9. package/dist/constants.d.ts.map +1 -1
  10. package/dist/constants.js +6 -1
  11. package/dist/constants.js.map +1 -1
  12. package/dist/index.js +8 -5
  13. package/dist/libraries.d.ts +10 -0
  14. package/dist/libraries.d.ts.map +1 -1
  15. package/dist/libraries.js +8 -1
  16. package/dist/libraries.js.map +1 -1
  17. package/dist/lint.d.ts.map +1 -1
  18. package/dist/lint.js +59 -0
  19. package/dist/lint.js.map +1 -1
  20. package/dist/mock/index.d.ts +28 -1
  21. package/dist/mock/index.d.ts.map +1 -1
  22. package/dist/mock/index.js +65 -6
  23. package/dist/mock/index.js.map +1 -1
  24. package/dist/openapi.d.ts.map +1 -1
  25. package/dist/openapi.js +13 -6
  26. package/dist/openapi.js.map +1 -1
  27. package/dist/rules.d.ts.map +1 -1
  28. package/dist/rules.js +4 -2
  29. package/dist/rules.js.map +1 -1
  30. package/dist/runtime/index.d.ts +3 -1
  31. package/dist/runtime/index.d.ts.map +1 -1
  32. package/dist/runtime/index.js +6 -4
  33. package/dist/schemas/action.d.ts +1 -0
  34. package/dist/schemas/action.d.ts.map +1 -1
  35. package/dist/schemas/action.js +1 -0
  36. package/dist/schemas/action.js.map +1 -1
  37. package/dist/schemas/api.d.ts +15 -0
  38. package/dist/schemas/api.d.ts.map +1 -1
  39. package/dist/schemas/api.js +7 -2
  40. package/dist/schemas/api.js.map +1 -1
  41. package/dist/schemas/common.js +1 -1
  42. package/dist/schemas/common.js.map +1 -1
  43. package/dist/schemas/definition.d.ts +5 -9
  44. package/dist/schemas/definition.d.ts.map +1 -1
  45. package/dist/schemas/definition.js +3 -9
  46. package/dist/schemas/definition.js.map +1 -1
  47. package/dist/schemas/field.js +2 -2
  48. package/dist/schemas/field.js.map +1 -1
  49. package/dist/schemas/index.d.ts +81 -2
  50. package/dist/schemas/index.d.ts.map +1 -1
  51. package/dist/schemas/index.js +11 -3
  52. package/dist/schemas/index.js.map +1 -1
  53. package/dist/schemas/resource.d.ts +1 -0
  54. package/dist/schemas/resource.d.ts.map +1 -1
  55. package/dist/schemas/resource.js +1 -1
  56. package/dist/schemas/resource.js.map +1 -1
  57. package/dist/schemas/widget.d.ts +109 -0
  58. package/dist/schemas/widget.d.ts.map +1 -0
  59. package/dist/schemas/widget.js +74 -0
  60. package/dist/schemas/widget.js.map +1 -0
  61. package/dist/widgets.d.ts +42 -0
  62. package/dist/widgets.d.ts.map +1 -0
  63. package/dist/widgets.js +130 -0
  64. package/dist/widgets.js.map +1 -0
  65. package/package.json +1 -1
  66. package/schema/boot.schema.json +41 -5
  67. package/schema/definition.schema.json +41 -5
  68. package/schema/openapi.json +297 -15
@@ -0,0 +1,74 @@
1
+ import { WIDGET_SERIES_PERIODS } from "../widgets.js";
2
+ import { z } from "zod";
3
+ //#region src/schemas/widget.ts
4
+ var ToneName = z.string().regex(/^[a-z0-9-]+$/);
5
+ var QueryValue = z.union([
6
+ z.string(),
7
+ z.number(),
8
+ z.boolean()
9
+ ]);
10
+ var WidgetSettings = z.looseObject({
11
+ resource: z.string().min(1).optional().meta({ description: "Built-in `stat` and `list`: the resource whose list feeds the widget. The client reads `GET /resources/{resource}` with `query`: a `stat` counts its items (`meta.total`), a `list` shows its first items. Such a widget has no data at `GET /dashboard/widgets/{widget}`." }),
12
+ query: z.record(z.string(), z.union([QueryValue, z.array(QueryValue)])).optional().meta({ description: "With `resource`: the query of the list, as its query parameters (`{ \"filter[status]\": \"to-judge\", \"sort\": \"-created_at\" }`), and of the link to the list. The client sets `page`, `perPage` and `cursor`." })
13
+ }).meta({ description: "The settings of a widget: `resource` and `query` for the built-in `stat` and `list` on a resource, anything else for widgets of plugins." });
14
+ var Widget = z.looseObject({
15
+ id: z.string().min(1).meta({ description: "Unique in the dashboard: the `{widget}` of its route." }),
16
+ type: z.string().min(1).meta({ description: "Built-in: `stat` (a number), `series` (a line over days, weeks or months) and `list` (a few items). Other types are widgets of plugins." }),
17
+ label: z.string().optional(),
18
+ width: z.number().int().min(1).max(12).optional().meta({ description: "Columns of a grid of 12. Defaults to 3 for a `stat`, 6 for others. One column on a phone." }),
19
+ settings: WidgetSettings.optional()
20
+ });
21
+ var WidgetBadge = z.looseObject({
22
+ label: z.string(),
23
+ tone: ToneName.optional()
24
+ }).meta({ description: "A badge: a word, in a tone of the theme." });
25
+ var StatWidgetData = z.looseObject({
26
+ value: z.number().meta({ description: "The number, in large type." }),
27
+ help: z.string().nullable().optional().meta({ description: "A line under the number, translated: `3 more than last week`." }),
28
+ tone: ToneName.nullable().optional().meta({ description: "A tone of the theme, only when the number calls for attention (`warning`, `danger`): neutral otherwise, and at 0." }),
29
+ url: z.string().nullable().optional().meta({ description: "Where the widget links: the list of what it counts." })
30
+ }).meta({ description: "The data of a `stat` widget: a number (decision 0064)." });
31
+ var SeriesPoint = z.looseObject({
32
+ date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).meta({ description: "The first day of the period: `2026-10-05`." }),
33
+ value: z.number()
34
+ });
35
+ var SeriesWidgetData = z.looseObject({
36
+ period: z.enum(WIDGET_SERIES_PERIODS).meta({ description: "The period of each point." }),
37
+ points: z.array(SeriesPoint).meta({ description: "One point per period, the dates going up. Periods without a value are points at 0." }),
38
+ total: z.number().nullable().optional().meta({ description: "The total over the points, shown with the line." })
39
+ }).superRefine((data, context) => {
40
+ data.points.forEach((point, index) => {
41
+ const previous = data.points[index - 1];
42
+ if (previous !== void 0 && point.date <= previous.date) context.addIssue({
43
+ code: "custom",
44
+ message: "The dates of the points must go up.",
45
+ path: [
46
+ "points",
47
+ index,
48
+ "date"
49
+ ]
50
+ });
51
+ });
52
+ }).meta({ description: "The data of a `series` widget: a line of values per period (decision 0064)." });
53
+ var ListWidgetItem = z.looseObject({
54
+ title: z.string(),
55
+ description: z.string().nullable().optional(),
56
+ meta: z.string().nullable().optional().meta({ description: "A short fact at the end of the item: `12 answers`." }),
57
+ url: z.string().nullable().optional(),
58
+ badge: WidgetBadge.nullable().optional()
59
+ });
60
+ var ListWidgetData = z.looseObject({
61
+ items: z.array(ListWidgetItem).max(5).meta({ description: `At most 5 items, the most useful first.` }),
62
+ empty: z.string().nullable().optional().meta({ description: "The message without items, translated: `No open contests.`" }),
63
+ url: z.string().nullable().optional().meta({ description: "Where \"See all\" links, under the items." })
64
+ }).meta({ description: "The data of a `list` widget: a few items (decision 0064)." });
65
+ /** The schema of the data of each built-in widget type. */
66
+ var widgetDataSchemas = {
67
+ stat: StatWidgetData,
68
+ series: SeriesWidgetData,
69
+ list: ListWidgetData
70
+ };
71
+ //#endregion
72
+ export { ListWidgetData, ListWidgetItem, SeriesPoint, SeriesWidgetData, StatWidgetData, Widget, WidgetBadge, WidgetSettings, widgetDataSchemas };
73
+
74
+ //# sourceMappingURL=widget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widget.js","names":[],"sources":["../../src/schemas/widget.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { WIDGET_LIST_MAX_ITEMS, WIDGET_SERIES_PERIODS } from '../widgets';\n\nconst ToneName = z.string().regex(/^[a-z0-9-]+$/);\n\nconst QueryValue = z.union([z.string(), z.number(), z.boolean()]);\n\nexport const WidgetSettings = z\n .looseObject({\n resource: z.string().min(1).optional().meta({\n description:\n 'Built-in `stat` and `list`: the resource whose list feeds the widget. The client reads `GET /resources/{resource}` with `query`: a `stat` counts its items (`meta.total`), a `list` shows its first items. Such a widget has no data at `GET /dashboard/widgets/{widget}`.',\n }),\n query: z\n .record(z.string(), z.union([QueryValue, z.array(QueryValue)]))\n .optional()\n .meta({\n description:\n 'With `resource`: the query of the list, as its query parameters (`{ \"filter[status]\": \"to-judge\", \"sort\": \"-created_at\" }`), and of the link to the list. The client sets `page`, `perPage` and `cursor`.',\n }),\n })\n .meta({\n description:\n 'The settings of a widget: `resource` and `query` for the built-in `stat` and `list` on a resource, anything else for widgets of plugins.',\n });\n\nexport const Widget = z.looseObject({\n id: z\n .string()\n .min(1)\n .meta({ description: 'Unique in the dashboard: the `{widget}` of its route.' }),\n type: z.string().min(1).meta({\n description:\n 'Built-in: `stat` (a number), `series` (a line over days, weeks or months) and `list` (a few items). Other types are widgets of plugins.',\n }),\n label: z.string().optional(),\n width: z.number().int().min(1).max(12).optional().meta({\n description:\n 'Columns of a grid of 12. Defaults to 3 for a `stat`, 6 for others. One column on a phone.',\n }),\n settings: WidgetSettings.optional(),\n});\n\nexport const WidgetBadge = z\n .looseObject({ label: z.string(), tone: ToneName.optional() })\n .meta({ description: 'A badge: a word, in a tone of the theme.' });\n\nexport const StatWidgetData = z\n .looseObject({\n value: z.number().meta({ description: 'The number, in large type.' }),\n help: z.string().nullable().optional().meta({\n description: 'A line under the number, translated: `3 more than last week`.',\n }),\n tone: ToneName.nullable().optional().meta({\n description:\n 'A tone of the theme, only when the number calls for attention (`warning`, `danger`): neutral otherwise, and at 0.',\n }),\n url: z\n .string()\n .nullable()\n .optional()\n .meta({ description: 'Where the widget links: the list of what it counts.' }),\n })\n .meta({ description: 'The data of a `stat` widget: a number (decision 0064).' });\n\nexport const SeriesPoint = z.looseObject({\n date: z\n .string()\n .regex(/^\\d{4}-\\d{2}-\\d{2}$/)\n .meta({ description: 'The first day of the period: `2026-10-05`.' }),\n value: z.number(),\n});\n\nexport const SeriesWidgetData = z\n .looseObject({\n period: z.enum(WIDGET_SERIES_PERIODS).meta({ description: 'The period of each point.' }),\n points: z.array(SeriesPoint).meta({\n description:\n 'One point per period, the dates going up. Periods without a value are points at 0.',\n }),\n total: z.number().nullable().optional().meta({\n description: 'The total over the points, shown with the line.',\n }),\n })\n .superRefine((data, context) => {\n data.points.forEach((point, index) => {\n const previous = data.points[index - 1];\n if (previous !== undefined && point.date <= previous.date) {\n context.addIssue({\n code: 'custom',\n message: 'The dates of the points must go up.',\n path: ['points', index, 'date'],\n });\n }\n });\n })\n .meta({\n description: 'The data of a `series` widget: a line of values per period (decision 0064).',\n });\n\nexport const ListWidgetItem = z.looseObject({\n title: z.string(),\n description: z.string().nullable().optional(),\n meta: z\n .string()\n .nullable()\n .optional()\n .meta({ description: 'A short fact at the end of the item: `12 answers`.' }),\n url: z.string().nullable().optional(),\n badge: WidgetBadge.nullable().optional(),\n});\n\nexport const ListWidgetData = z\n .looseObject({\n items: z\n .array(ListWidgetItem)\n .max(WIDGET_LIST_MAX_ITEMS)\n .meta({\n description: `At most ${WIDGET_LIST_MAX_ITEMS} items, the most useful first.`,\n }),\n empty: z.string().nullable().optional().meta({\n description: 'The message without items, translated: `No open contests.`',\n }),\n url: z\n .string()\n .nullable()\n .optional()\n .meta({ description: 'Where \"See all\" links, under the items.' }),\n })\n .meta({ description: 'The data of a `list` widget: a few items (decision 0064).' });\n\n/** The schema of the data of each built-in widget type. */\nexport const widgetDataSchemas = {\n stat: StatWidgetData,\n series: SeriesWidgetData,\n list: ListWidgetData,\n} as const;\n\nexport type WidgetSettings = z.infer<typeof WidgetSettings>;\nexport type Widget = z.infer<typeof Widget>;\nexport type WidgetBadge = z.infer<typeof WidgetBadge>;\nexport type StatWidgetData = z.infer<typeof StatWidgetData>;\nexport type SeriesPoint = z.infer<typeof SeriesPoint>;\nexport type SeriesWidgetData = z.infer<typeof SeriesWidgetData>;\nexport type ListWidgetItem = z.infer<typeof ListWidgetItem>;\nexport type ListWidgetData = z.infer<typeof ListWidgetData>;\n"],"mappings":";;;AAIA,IAAM,WAAW,EAAE,OAAO,CAAC,CAAC,MAAM,cAAc;AAEhD,IAAM,aAAa,EAAE,MAAM;CAAC,EAAE,OAAO;CAAG,EAAE,OAAO;CAAG,EAAE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CAAC;AAED,IAAa,iBAAiB,EACzB,YAAY;CACT,OAAO,EACF,MAAM,cAAc,CAAC,CACrB,IAAA,CAAyB,CAAC,CAC1B,KAAK,EACF,aAAa,0CACjB,CAAC;CACL,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EACzC,aAAa,6DACjB,CAAC;CACD,KAAK,EACA,OAAO,CAAC,CACR,SAAS,CAAC,CACV,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,4CAA0C,CAAC;AACxE,CAAC,CAAC,CACD,KAAK,EAAE,aAAa,4DAA4D,CAAC;;AAGtF,IAAa,oBAAoB;CAC7B,MAAM;CACN,QAAQ;CACR,MAAM;AACV"}
@@ -0,0 +1,42 @@
1
+ import { type ListQuery } from './query.js';
2
+ /** The widget types that every client draws (decision 0064). Other types are widgets of plugins. */
3
+ export declare const BUILT_IN_WIDGET_TYPES: readonly ["stat", "series", "list"];
4
+ export type BuiltInWidgetType = (typeof BUILT_IN_WIDGET_TYPES)[number];
5
+ /** The periods of the points of a `series` widget. */
6
+ export declare const WIDGET_SERIES_PERIODS: readonly ["day", "week", "month"];
7
+ export type WidgetSeriesPeriod = (typeof WIDGET_SERIES_PERIODS)[number];
8
+ /** The most items a `list` widget shows: the backend sends the most useful first. */
9
+ export declare const WIDGET_LIST_MAX_ITEMS = 5;
10
+ /** The built-in types that can read the list of a resource (`settings.resource`). */
11
+ export declare const RESOURCE_WIDGET_TYPES: readonly ["stat", "list"];
12
+ /** Query parameters that the client sets on the list of a widget on a resource, never `query`. */
13
+ export declare const WIDGET_RESERVED_QUERY_PARAMS: readonly ["page", "perPage", "cursor"];
14
+ export declare function isBuiltInWidgetType(type: string): type is BuiltInWidgetType;
15
+ /** A widget as the helpers read it: the `Widget` of the definition, or one a backend writes. */
16
+ interface WidgetLike {
17
+ type: string;
18
+ settings?: Record<string, unknown> | undefined;
19
+ }
20
+ /** A built-in widget that reads the list of a resource, with no data of its own (decision 0064). */
21
+ export interface WidgetResource {
22
+ /** The id of the resource. */
23
+ resource: string;
24
+ /** The `query` of the widget, as query parameters, without `page`, `perPage` and `cursor`. */
25
+ params: URLSearchParams;
26
+ /** The same query, parsed: the query of the list request, and of the link to the list. */
27
+ query: ListQuery;
28
+ }
29
+ /**
30
+ * The resource whose list feeds a built-in `stat` or `list` widget, and its query: `null` for a
31
+ * widget with data of its own at `GET /dashboard/widgets/{widget}`, and for widgets of plugins.
32
+ */
33
+ export declare function getWidgetResource(widget: WidgetLike): WidgetResource | null;
34
+ /**
35
+ * Checks the data of a widget against the shape of its type (decision 0064), without the schemas:
36
+ * the paths of the wrong keys (`value`, `points.2.date`), empty when it is right. The data of a
37
+ * widget of a plugin only has to be an object. The dates of a series must go up, one point per
38
+ * period.
39
+ */
40
+ export declare function checkWidgetData(type: string, data: unknown): string[];
41
+ export {};
42
+ //# sourceMappingURL=widgets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widgets.d.ts","sourceRoot":"","sources":["../src/widgets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAoB,MAAM,SAAS,CAAC;AAG3D,oGAAoG;AACpG,eAAO,MAAM,qBAAqB,qCAAsC,CAAC;AAEzE,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvE,sDAAsD;AACtD,eAAO,MAAM,qBAAqB,mCAAoC,CAAC;AAEvE,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExE,qFAAqF;AACrF,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,qFAAqF;AACrF,eAAO,MAAM,qBAAqB,2BAA4B,CAAC;AAE/D,kGAAkG;AAClG,eAAO,MAAM,4BAA4B,wCAAyC,CAAC;AAEnF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,iBAAiB,CAE3E;AAED,gGAAgG;AAChG,UAAU,UAAU;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;CAClD;AAED,oGAAoG;AACpG,MAAM,WAAW,cAAc;IAC3B,8BAA8B;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,8FAA8F;IAC9F,MAAM,EAAE,eAAe,CAAC;IACxB,0FAA0F;IAC1F,KAAK,EAAE,SAAS,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,GAAG,cAAc,GAAG,IAAI,CA4B3E;AAwGD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,EAAE,CAcrE"}
@@ -0,0 +1,130 @@
1
+ import { isRecord } from "./values.js";
2
+ import { fromSearchParams } from "./query.js";
3
+ //#region src/widgets.ts
4
+ /** The widget types that every client draws (decision 0064). Other types are widgets of plugins. */
5
+ var BUILT_IN_WIDGET_TYPES = [
6
+ "stat",
7
+ "series",
8
+ "list"
9
+ ];
10
+ /** The periods of the points of a `series` widget. */
11
+ var WIDGET_SERIES_PERIODS = [
12
+ "day",
13
+ "week",
14
+ "month"
15
+ ];
16
+ /** The most items a `list` widget shows: the backend sends the most useful first. */
17
+ var WIDGET_LIST_MAX_ITEMS = 5;
18
+ /** The built-in types that can read the list of a resource (`settings.resource`). */
19
+ var RESOURCE_WIDGET_TYPES = ["stat", "list"];
20
+ /** Query parameters that the client sets on the list of a widget on a resource, never `query`. */
21
+ var WIDGET_RESERVED_QUERY_PARAMS = [
22
+ "page",
23
+ "perPage",
24
+ "cursor"
25
+ ];
26
+ function isBuiltInWidgetType(type) {
27
+ return BUILT_IN_WIDGET_TYPES.includes(type);
28
+ }
29
+ /**
30
+ * The resource whose list feeds a built-in `stat` or `list` widget, and its query: `null` for a
31
+ * widget with data of its own at `GET /dashboard/widgets/{widget}`, and for widgets of plugins.
32
+ */
33
+ function getWidgetResource(widget) {
34
+ const resource = widget.settings?.resource;
35
+ if (!RESOURCE_WIDGET_TYPES.includes(widget.type) || typeof resource !== "string" || resource === "") return null;
36
+ const params = new URLSearchParams();
37
+ const query = widget.settings?.query;
38
+ if (isRecord(query)) Object.entries(query).forEach(([key, value]) => {
39
+ if (WIDGET_RESERVED_QUERY_PARAMS.includes(key)) return;
40
+ (Array.isArray(value) ? value : [value]).forEach((entry) => {
41
+ if (typeof entry === "string" || typeof entry === "number" || typeof entry === "boolean") params.append(key, String(entry));
42
+ });
43
+ });
44
+ return {
45
+ resource,
46
+ params,
47
+ query: fromSearchParams(params)
48
+ };
49
+ }
50
+ var DATE = /^\d{4}-\d{2}-\d{2}$/;
51
+ var TONE = /^[a-z0-9-]+$/;
52
+ var isNumber = (value) => typeof value === "number" && Number.isFinite(value);
53
+ /** Whether a key is missing, `null`, or passes the check. */
54
+ function optional(data, key, check) {
55
+ return data[key] === void 0 || data[key] === null || check(data[key]);
56
+ }
57
+ var isString = (value) => typeof value === "string";
58
+ var isTone = (value) => isString(value) && TONE.test(value);
59
+ function checkStat(data) {
60
+ const wrong = [];
61
+ if (!isNumber(data.value)) wrong.push("value");
62
+ if (!optional(data, "help", isString)) wrong.push("help");
63
+ if (!optional(data, "tone", isTone)) wrong.push("tone");
64
+ if (!optional(data, "url", isString)) wrong.push("url");
65
+ return wrong;
66
+ }
67
+ function checkSeries(data) {
68
+ const wrong = [];
69
+ if (!WIDGET_SERIES_PERIODS.includes(data.period)) wrong.push("period");
70
+ if (!Array.isArray(data.points)) wrong.push("points");
71
+ else {
72
+ let previous = "";
73
+ data.points.forEach((point, index) => {
74
+ if (!isRecord(point)) {
75
+ wrong.push(`points.${index}`);
76
+ return;
77
+ }
78
+ if (!isString(point.date) || !DATE.test(point.date) || point.date <= previous) wrong.push(`points.${index}.date`);
79
+ else previous = point.date;
80
+ if (!isNumber(point.value)) wrong.push(`points.${index}.value`);
81
+ });
82
+ }
83
+ if (!optional(data, "total", isNumber)) wrong.push("total");
84
+ return wrong;
85
+ }
86
+ function checkList(data) {
87
+ const wrong = [];
88
+ if (!Array.isArray(data.items) || data.items.length > 5) wrong.push("items");
89
+ else data.items.forEach((item, index) => {
90
+ if (!isRecord(item)) {
91
+ wrong.push(`items.${index}`);
92
+ return;
93
+ }
94
+ if (!isString(item.title)) wrong.push(`items.${index}.title`);
95
+ [
96
+ "description",
97
+ "meta",
98
+ "url"
99
+ ].forEach((key) => {
100
+ if (!optional(item, key, isString)) wrong.push(`items.${index}.${key}`);
101
+ });
102
+ const badge = item.badge;
103
+ if (badge !== void 0 && badge !== null) {
104
+ if (!isRecord(badge) || !isString(badge.label)) wrong.push(`items.${index}.badge`);
105
+ else if (!optional(badge, "tone", isTone)) wrong.push(`items.${index}.badge.tone`);
106
+ }
107
+ });
108
+ if (!optional(data, "empty", isString)) wrong.push("empty");
109
+ if (!optional(data, "url", isString)) wrong.push("url");
110
+ return wrong;
111
+ }
112
+ /**
113
+ * Checks the data of a widget against the shape of its type (decision 0064), without the schemas:
114
+ * the paths of the wrong keys (`value`, `points.2.date`), empty when it is right. The data of a
115
+ * widget of a plugin only has to be an object. The dates of a series must go up, one point per
116
+ * period.
117
+ */
118
+ function checkWidgetData(type, data) {
119
+ if (!isRecord(data)) return [""];
120
+ switch (type) {
121
+ case "stat": return checkStat(data);
122
+ case "series": return checkSeries(data);
123
+ case "list": return checkList(data);
124
+ default: return [];
125
+ }
126
+ }
127
+ //#endregion
128
+ export { BUILT_IN_WIDGET_TYPES, RESOURCE_WIDGET_TYPES, WIDGET_LIST_MAX_ITEMS, WIDGET_RESERVED_QUERY_PARAMS, WIDGET_SERIES_PERIODS, checkWidgetData, getWidgetResource, isBuiltInWidgetType };
129
+
130
+ //# sourceMappingURL=widgets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widgets.js","names":[],"sources":["../src/widgets.ts"],"sourcesContent":["import { type ListQuery, fromSearchParams } from './query';\nimport { isRecord } from './values';\n\n/** The widget types that every client draws (decision 0064). Other types are widgets of plugins. */\nexport const BUILT_IN_WIDGET_TYPES = ['stat', 'series', 'list'] as const;\n\nexport type BuiltInWidgetType = (typeof BUILT_IN_WIDGET_TYPES)[number];\n\n/** The periods of the points of a `series` widget. */\nexport const WIDGET_SERIES_PERIODS = ['day', 'week', 'month'] as const;\n\nexport type WidgetSeriesPeriod = (typeof WIDGET_SERIES_PERIODS)[number];\n\n/** The most items a `list` widget shows: the backend sends the most useful first. */\nexport const WIDGET_LIST_MAX_ITEMS = 5;\n\n/** The built-in types that can read the list of a resource (`settings.resource`). */\nexport const RESOURCE_WIDGET_TYPES = ['stat', 'list'] as const;\n\n/** Query parameters that the client sets on the list of a widget on a resource, never `query`. */\nexport const WIDGET_RESERVED_QUERY_PARAMS = ['page', 'perPage', 'cursor'] as const;\n\nexport function isBuiltInWidgetType(type: string): type is BuiltInWidgetType {\n return (BUILT_IN_WIDGET_TYPES as readonly string[]).includes(type);\n}\n\n/** A widget as the helpers read it: the `Widget` of the definition, or one a backend writes. */\ninterface WidgetLike {\n type: string;\n settings?: Record<string, unknown> | undefined;\n}\n\n/** A built-in widget that reads the list of a resource, with no data of its own (decision 0064). */\nexport interface WidgetResource {\n /** The id of the resource. */\n resource: string;\n /** The `query` of the widget, as query parameters, without `page`, `perPage` and `cursor`. */\n params: URLSearchParams;\n /** The same query, parsed: the query of the list request, and of the link to the list. */\n query: ListQuery;\n}\n\n/**\n * The resource whose list feeds a built-in `stat` or `list` widget, and its query: `null` for a\n * widget with data of its own at `GET /dashboard/widgets/{widget}`, and for widgets of plugins.\n */\nexport function getWidgetResource(widget: WidgetLike): WidgetResource | null {\n const resource = widget.settings?.resource;\n if (\n !(RESOURCE_WIDGET_TYPES as readonly string[]).includes(widget.type) ||\n typeof resource !== 'string' ||\n resource === ''\n ) {\n return null;\n }\n const params = new URLSearchParams();\n const query = widget.settings?.query;\n if (isRecord(query)) {\n Object.entries(query).forEach(([key, value]) => {\n if ((WIDGET_RESERVED_QUERY_PARAMS as readonly string[]).includes(key)) {\n return;\n }\n (Array.isArray(value) ? value : [value]).forEach((entry) => {\n if (\n typeof entry === 'string' ||\n typeof entry === 'number' ||\n typeof entry === 'boolean'\n ) {\n params.append(key, String(entry));\n }\n });\n });\n }\n return { resource, params, query: fromSearchParams(params) };\n}\n\nconst DATE = /^\\d{4}-\\d{2}-\\d{2}$/;\nconst TONE = /^[a-z0-9-]+$/;\n\nconst isNumber = (value: unknown): value is number =>\n typeof value === 'number' && Number.isFinite(value);\n\n/** Whether a key is missing, `null`, or passes the check. */\nfunction optional(\n data: Record<string, unknown>,\n key: string,\n check: (value: unknown) => boolean,\n): boolean {\n return data[key] === undefined || data[key] === null || check(data[key]);\n}\n\nconst isString = (value: unknown): value is string => typeof value === 'string';\nconst isTone = (value: unknown): boolean => isString(value) && TONE.test(value);\n\nfunction checkStat(data: Record<string, unknown>): string[] {\n const wrong: string[] = [];\n if (!isNumber(data.value)) {\n wrong.push('value');\n }\n if (!optional(data, 'help', isString)) {\n wrong.push('help');\n }\n if (!optional(data, 'tone', isTone)) {\n wrong.push('tone');\n }\n if (!optional(data, 'url', isString)) {\n wrong.push('url');\n }\n return wrong;\n}\n\nfunction checkSeries(data: Record<string, unknown>): string[] {\n const wrong: string[] = [];\n if (!(WIDGET_SERIES_PERIODS as readonly unknown[]).includes(data.period)) {\n wrong.push('period');\n }\n if (!Array.isArray(data.points)) {\n wrong.push('points');\n } else {\n let previous = '';\n data.points.forEach((point: unknown, index) => {\n if (!isRecord(point)) {\n wrong.push(`points.${index}`);\n return;\n }\n if (!isString(point.date) || !DATE.test(point.date) || point.date <= previous) {\n wrong.push(`points.${index}.date`);\n } else {\n previous = point.date;\n }\n if (!isNumber(point.value)) {\n wrong.push(`points.${index}.value`);\n }\n });\n }\n if (!optional(data, 'total', isNumber)) {\n wrong.push('total');\n }\n return wrong;\n}\n\nfunction checkList(data: Record<string, unknown>): string[] {\n const wrong: string[] = [];\n if (!Array.isArray(data.items) || data.items.length > WIDGET_LIST_MAX_ITEMS) {\n wrong.push('items');\n } else {\n data.items.forEach((item: unknown, index) => {\n if (!isRecord(item)) {\n wrong.push(`items.${index}`);\n return;\n }\n if (!isString(item.title)) {\n wrong.push(`items.${index}.title`);\n }\n ['description', 'meta', 'url'].forEach((key) => {\n if (!optional(item, key, isString)) {\n wrong.push(`items.${index}.${key}`);\n }\n });\n const badge = item.badge;\n if (badge !== undefined && badge !== null) {\n if (!isRecord(badge) || !isString(badge.label)) {\n wrong.push(`items.${index}.badge`);\n } else if (!optional(badge, 'tone', isTone)) {\n wrong.push(`items.${index}.badge.tone`);\n }\n }\n });\n }\n if (!optional(data, 'empty', isString)) {\n wrong.push('empty');\n }\n if (!optional(data, 'url', isString)) {\n wrong.push('url');\n }\n return wrong;\n}\n\n/**\n * Checks the data of a widget against the shape of its type (decision 0064), without the schemas:\n * the paths of the wrong keys (`value`, `points.2.date`), empty when it is right. The data of a\n * widget of a plugin only has to be an object. The dates of a series must go up, one point per\n * period.\n */\nexport function checkWidgetData(type: string, data: unknown): string[] {\n if (!isRecord(data)) {\n return [''];\n }\n switch (type) {\n case 'stat':\n return checkStat(data);\n case 'series':\n return checkSeries(data);\n case 'list':\n return checkList(data);\n default:\n return [];\n }\n}\n"],"mappings":";;;;AAIA,IAAa,wBAAwB;CAAC;CAAQ;CAAU;AAAM;;AAK9D,IAAa,wBAAwB;CAAC;CAAO;CAAQ;AAAO;;AAK5D,IAAa,wBAAwB;;AAGrC,IAAa,wBAAwB,CAAC,QAAQ,MAAM;;AAGpD,IAAa,+BAA+B;CAAC;CAAQ;CAAW;AAAQ;AAExE,SAAgB,oBAAoB,MAAyC;CACzE,OAAQ,sBAA4C,SAAS,IAAI;AACrE;;;;;AAsBA,SAAgB,kBAAkB,QAA2C;CACzE,MAAM,WAAW,OAAO,UAAU;CAClC,IACI,CAAE,sBAA4C,SAAS,OAAO,IAAI,KAClE,OAA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AO,QAAQ,MAAM,GACtC,MAAM,KAAK,SAAS,MAAM,YAAY;EAE9C;CACJ,CAAC;CAEL,IAAI,CAAC,SAAS,MAAM,SAAS,QAAQ,GACjC,MAAM,KAAK,OAAO;CAEtB,IAAI,CAAC,SAAS,MAAM,OAAO,QAAQ,GAC/B,MAAM,KAAK,KAAK;CAEpB,OAAO;AACX;;;;;;;AAQA,SAAgB,gBAAgB,MAAc,MAAyB;CACnE,IAAI,CAAC,SAAS,IAAI,GACd,OAAO,CAAC,EAAE;CAEd,QAAQ,MAAR;EACI,KAAK,QACD,OAAO,UAAU,IAAI;EACzB,KAAK,UACD,OAAO,YAAY,IAAI;EAC3B,KAAK,QACD,OAAO,UAAU,IAAI;EACzB,SACI,OAAO,CAAC;CAChB;AACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/protocol",
3
- "version": "5.0.0-alpha.17",
3
+ "version": "5.0.0-alpha.19",
4
4
  "description": "The Panneau protocol: definition schema, HTTP API spec and conformance kit",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1285,6 +1285,9 @@
1285
1285
  "dryRun": {
1286
1286
  "type": "boolean"
1287
1287
  },
1288
+ "undoable": {
1289
+ "type": "boolean"
1290
+ },
1288
1291
  "url": {
1289
1292
  "type": "string"
1290
1293
  },
@@ -1671,11 +1674,7 @@
1671
1674
  "maximum": 12
1672
1675
  },
1673
1676
  "settings": {
1674
- "type": "object",
1675
- "propertyNames": {
1676
- "type": "string"
1677
- },
1678
- "additionalProperties": {}
1677
+ "$ref": "#/$defs/WidgetSettings"
1679
1678
  }
1680
1679
  },
1681
1680
  "required": [
@@ -1684,6 +1683,43 @@
1684
1683
  ],
1685
1684
  "additionalProperties": {}
1686
1685
  },
1686
+ "WidgetSettings": {
1687
+ "type": "object",
1688
+ "properties": {
1689
+ "resource": {
1690
+ "type": "string",
1691
+ "minLength": 1
1692
+ },
1693
+ "query": {
1694
+ "type": "object",
1695
+ "propertyNames": {
1696
+ "type": "string"
1697
+ },
1698
+ "additionalProperties": {
1699
+ "anyOf": [
1700
+ {
1701
+ "type": [
1702
+ "string",
1703
+ "number",
1704
+ "boolean"
1705
+ ]
1706
+ },
1707
+ {
1708
+ "type": "array",
1709
+ "items": {
1710
+ "type": [
1711
+ "string",
1712
+ "number",
1713
+ "boolean"
1714
+ ]
1715
+ }
1716
+ }
1717
+ ]
1718
+ }
1719
+ }
1720
+ },
1721
+ "additionalProperties": {}
1722
+ },
1687
1723
  "Uploads": {
1688
1724
  "type": "object",
1689
1725
  "properties": {
@@ -1248,6 +1248,9 @@
1248
1248
  "dryRun": {
1249
1249
  "type": "boolean"
1250
1250
  },
1251
+ "undoable": {
1252
+ "type": "boolean"
1253
+ },
1251
1254
  "url": {
1252
1255
  "type": "string"
1253
1256
  },
@@ -1634,11 +1637,7 @@
1634
1637
  "maximum": 12
1635
1638
  },
1636
1639
  "settings": {
1637
- "type": "object",
1638
- "propertyNames": {
1639
- "type": "string"
1640
- },
1641
- "additionalProperties": {}
1640
+ "$ref": "#/$defs/WidgetSettings"
1642
1641
  }
1643
1642
  },
1644
1643
  "required": [
@@ -1647,6 +1646,43 @@
1647
1646
  ],
1648
1647
  "additionalProperties": {}
1649
1648
  },
1649
+ "WidgetSettings": {
1650
+ "type": "object",
1651
+ "properties": {
1652
+ "resource": {
1653
+ "type": "string",
1654
+ "minLength": 1
1655
+ },
1656
+ "query": {
1657
+ "type": "object",
1658
+ "propertyNames": {
1659
+ "type": "string"
1660
+ },
1661
+ "additionalProperties": {
1662
+ "anyOf": [
1663
+ {
1664
+ "type": [
1665
+ "string",
1666
+ "number",
1667
+ "boolean"
1668
+ ]
1669
+ },
1670
+ {
1671
+ "type": "array",
1672
+ "items": {
1673
+ "type": [
1674
+ "string",
1675
+ "number",
1676
+ "boolean"
1677
+ ]
1678
+ }
1679
+ }
1680
+ ]
1681
+ }
1682
+ }
1683
+ },
1684
+ "additionalProperties": {}
1685
+ },
1650
1686
  "Uploads": {
1651
1687
  "type": "object",
1652
1688
  "properties": {