@panneau/protocol 0.0.0-stage → 5.0.0-alpha.0

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 (92) hide show
  1. package/README.md +31 -2
  2. package/dist/conditions.d.ts +7 -0
  3. package/dist/conditions.d.ts.map +1 -0
  4. package/dist/conditions.js +21 -0
  5. package/dist/conditions.js.map +1 -0
  6. package/dist/conformance/index.d.ts +42 -0
  7. package/dist/conformance/index.d.ts.map +1 -0
  8. package/dist/conformance/index.js +243 -0
  9. package/dist/conformance/index.js.map +1 -0
  10. package/dist/index.d.ts +10 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +19 -0
  13. package/dist/lint.d.ts +8 -0
  14. package/dist/lint.d.ts.map +1 -0
  15. package/dist/lint.js +73 -0
  16. package/dist/lint.js.map +1 -0
  17. package/dist/mock/example.d.ts +8 -0
  18. package/dist/mock/example.d.ts.map +1 -0
  19. package/dist/mock/example.js +186 -0
  20. package/dist/mock/example.js.map +1 -0
  21. package/dist/mock/index.d.ts +24 -0
  22. package/dist/mock/index.d.ts.map +1 -0
  23. package/dist/mock/index.js +250 -0
  24. package/dist/mock/index.js.map +1 -0
  25. package/dist/openapi.d.ts +11 -0
  26. package/dist/openapi.d.ts.map +1 -0
  27. package/dist/openapi.js +540 -0
  28. package/dist/openapi.js.map +1 -0
  29. package/dist/query.d.ts +17 -0
  30. package/dist/query.d.ts.map +1 -0
  31. package/dist/query.js +49 -0
  32. package/dist/query.js.map +1 -0
  33. package/dist/rules.d.ts +29 -0
  34. package/dist/rules.d.ts.map +1 -0
  35. package/dist/rules.js +143 -0
  36. package/dist/rules.js.map +1 -0
  37. package/dist/schemas/action.d.ts +166 -0
  38. package/dist/schemas/action.d.ts.map +1 -0
  39. package/dist/schemas/action.js +66 -0
  40. package/dist/schemas/action.js.map +1 -0
  41. package/dist/schemas/api.d.ts +371 -0
  42. package/dist/schemas/api.d.ts.map +1 -0
  43. package/dist/schemas/api.js +140 -0
  44. package/dist/schemas/api.js.map +1 -0
  45. package/dist/schemas/boot.d.ts +19 -0
  46. package/dist/schemas/boot.d.ts.map +1 -0
  47. package/dist/schemas/boot.js +21 -0
  48. package/dist/schemas/boot.js.map +1 -0
  49. package/dist/schemas/common.d.ts +28 -0
  50. package/dist/schemas/common.d.ts.map +1 -0
  51. package/dist/schemas/common.js +35 -0
  52. package/dist/schemas/common.js.map +1 -0
  53. package/dist/schemas/definition.d.ts +462 -0
  54. package/dist/schemas/definition.d.ts.map +1 -0
  55. package/dist/schemas/definition.js +101 -0
  56. package/dist/schemas/definition.js.map +1 -0
  57. package/dist/schemas/field.d.ts +145 -0
  58. package/dist/schemas/field.d.ts.map +1 -0
  59. package/dist/schemas/field.js +127 -0
  60. package/dist/schemas/field.js.map +1 -0
  61. package/dist/schemas/index.d.ts +1536 -0
  62. package/dist/schemas/index.d.ts.map +1 -0
  63. package/dist/schemas/index.js +68 -0
  64. package/dist/schemas/index.js.map +1 -0
  65. package/dist/schemas/layout.d.ts +29 -0
  66. package/dist/schemas/layout.d.ts.map +1 -0
  67. package/dist/schemas/layout.js +35 -0
  68. package/dist/schemas/layout.js.map +1 -0
  69. package/dist/schemas/list.d.ts +72 -0
  70. package/dist/schemas/list.d.ts.map +1 -0
  71. package/dist/schemas/list.js +48 -0
  72. package/dist/schemas/list.js.map +1 -0
  73. package/dist/schemas/resource.d.ts +328 -0
  74. package/dist/schemas/resource.d.ts.map +1 -0
  75. package/dist/schemas/resource.js +38 -0
  76. package/dist/schemas/resource.js.map +1 -0
  77. package/dist/validate.d.ts +31 -0
  78. package/dist/validate.d.ts.map +1 -0
  79. package/dist/validate.js +57 -0
  80. package/dist/validate.js.map +1 -0
  81. package/dist/values.d.ts +7 -0
  82. package/dist/values.d.ts.map +1 -0
  83. package/dist/values.js +29 -0
  84. package/dist/values.js.map +1 -0
  85. package/dist/version.d.ts +5 -0
  86. package/dist/version.d.ts.map +1 -0
  87. package/dist/version.js +9 -0
  88. package/dist/version.js.map +1 -0
  89. package/package.json +48 -5
  90. package/schema/boot.schema.json +1229 -0
  91. package/schema/definition.schema.json +1195 -0
  92. package/schema/openapi.json +3838 -0
@@ -0,0 +1,38 @@
1
+ import { Abilities } from "./common.js";
2
+ import { BlockType, Field } from "./field.js";
3
+ import { LayoutNode } from "./layout.js";
4
+ import { Action } from "./action.js";
5
+ import { ListDefinition } from "./list.js";
6
+ import { z } from "zod";
7
+ //#region src/schemas/resource.ts
8
+ var ResourceFeatures = z.looseObject({
9
+ drafts: z.boolean().optional(),
10
+ revisions: z.boolean().optional(),
11
+ preview: z.union([z.null(), z.looseObject({
12
+ mode: z.enum(["component", "iframe"]),
13
+ component: z.string().optional().meta({ description: "`component`: the plugin preview." })
14
+ })]).optional(),
15
+ search: z.boolean().optional().meta({ description: "Whether the resource is in the global search." })
16
+ });
17
+ var Resource = z.looseObject({
18
+ id: z.string().min(1),
19
+ label: z.looseObject({
20
+ singular: z.string(),
21
+ plural: z.string()
22
+ }),
23
+ description: z.string().optional(),
24
+ icon: z.string().optional(),
25
+ itemTitle: z.string().optional().meta({ description: "The field used as the title of an item, in lists and pickers." }),
26
+ fields: z.array(Field),
27
+ form: z.looseObject({ layout: z.array(LayoutNode).optional() }).optional(),
28
+ list: ListDefinition.optional(),
29
+ actions: z.array(Action).optional(),
30
+ abilities: Abilities.optional(),
31
+ features: ResourceFeatures.optional(),
32
+ types: z.array(BlockType).optional().meta({ description: "Variants of the resource, each with its own extra fields." }),
33
+ settings: z.record(z.string(), z.unknown()).optional()
34
+ }).meta({ description: "A set of items managed in the admin." });
35
+ //#endregion
36
+ export { Resource, ResourceFeatures };
37
+
38
+ //# sourceMappingURL=resource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource.js","names":[],"sources":["../../src/schemas/resource.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { Action } from './action';\nimport { Abilities } from './common';\nimport { BlockType, Field } from './field';\nimport { LayoutNode } from './layout';\nimport { ListDefinition } from './list';\n\nexport const ResourceFeatures = z.looseObject({\n drafts: z.boolean().optional(),\n revisions: z.boolean().optional(),\n preview: z\n .union([\n z.null(),\n z.looseObject({\n mode: z.enum(['component', 'iframe']),\n component: z\n .string()\n .optional()\n .meta({ description: '`component`: the plugin preview.' }),\n }),\n ])\n .optional(),\n search: z\n .boolean()\n .optional()\n .meta({ description: 'Whether the resource is in the global search.' }),\n});\n\nexport const Resource = z\n .looseObject({\n id: z.string().min(1),\n label: z.looseObject({ singular: z.string(), plural: z.string() }),\n description: z.string().optional(),\n icon: z.string().optional(),\n itemTitle: z\n .string()\n .optional()\n .meta({ description: 'The field used as the title of an item, in lists and pickers.' }),\n fields: z.array(Field),\n form: z.looseObject({ layout: z.array(LayoutNode).optional() }).optional(),\n list: ListDefinition.optional(),\n actions: z.array(Action).optional(),\n abilities: Abilities.optional(),\n features: ResourceFeatures.optional(),\n types: z\n .array(BlockType)\n .optional()\n .meta({ description: 'Variants of the resource, each with its own extra fields.' }),\n settings: z.record(z.string(), z.unknown()).optional(),\n })\n .meta({ description: 'A set of items managed in the admin.' });\n\nexport type ResourceFeatures = z.infer<typeof ResourceFeatures>;\nexport type Resource = z.infer<typeof Resource>;\n/** A resource as a backend writes it, before defaults are applied. */\nexport type ResourceInput = z.input<typeof Resource>;\n"],"mappings":";;;;;;;AAQA,IAAa,mBAAmB,EAAE,YAAY;CAC1C,QAAQ,EAAE,QAAQ,CAAC,CAAC,SAAS;CAC7B,WAAW,EAAE,QAAQ,CAAC,CAAC,SAAS;CAChC,SAAS,EACJ,MAAM,CACH,EAAE,KAAK,GACP,EAAE,YAAY;EACV,MAAM,EAAE,KAAK,CAAC,aAAa,QAAQ,CAAC;EACpC,WAAW,EACN,OAAO,CAAC,CACR,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,mCAAmC,CAAC;CACjE,CAAC,CACL,CAAC,CAAC,CACD,SAAS;CACd,QAAQ,EACH,QAAQ,CAAC,CACT,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,gDAAgD,CAAC;AAC9E,CAAC;AAED,IAAa,WAAW,EACnB,YAAY;CACT,IAAI,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACpB,OAAO,EAAE,YAAY;EAAE,UAAU,EAAE,OAAO;EAAG,QAAQ,EAAE,OAAO;CAAE,CAAC;CACjE,aAAa,EAAE,OAAO,CAAC,CAAC,SAAS;CACjC,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS;CAC1B,WAAW,EACN,OAAO,CAAC,CACR,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,gEAAgE,CAAC;CAC1F,QAAQ,EAAE,MAAM,KAAK;CACrB,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS;CACzE,MAAM,eAAe,SAAS;CAC9B,SAAS,EAAE,MAAM,MAAM,CAAC,CAAC,SAAS;CAClC,WAAW,UAAU,SAAS;CAC9B,UAAU,iBAAiB,SAAS;CACpC,OAAO,EACF,MAAM,SAAS,CAAC,CAChB,SAAS,CAAC,CACV,KAAK,EAAE,aAAa,4DAA4D,CAAC;CACtF,UAAU,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS;AACzD,CAAC,CAAC,CACD,KAAK,EAAE,aAAa,uCAAuC,CAAC"}
@@ -0,0 +1,31 @@
1
+ import type { z } from 'zod';
2
+ import { Problem } from './schemas/api';
3
+ import { BootConfig } from './schemas/boot';
4
+ import { Definition } from './schemas/definition';
5
+ export interface ValidationIssue {
6
+ /** Dot path of the invalid value (`resources.0.fields.2.type`), empty for the root. */
7
+ path: string;
8
+ message: string;
9
+ }
10
+ export type ValidationResult<T> = {
11
+ success: true;
12
+ data: T;
13
+ } | {
14
+ success: false;
15
+ issues: ValidationIssue[];
16
+ };
17
+ /** Validates a value against one of the protocol's schemas. */
18
+ export declare function validate<T extends z.ZodType>(schema: T, input: unknown): ValidationResult<z.infer<T>>;
19
+ /**
20
+ * Validates a definition, as returned by `GET /definition`: against the schema, then the
21
+ * references between its parts (see `lintDefinition()`).
22
+ */
23
+ export declare function validateDefinition(input: unknown): ValidationResult<Definition>;
24
+ /**
25
+ * Validates a boot config, as a server writes it in the page: against the schema, then the
26
+ * references between the parts of its inlined definition, if any.
27
+ */
28
+ export declare function validateBootConfig(input: unknown): ValidationResult<BootConfig>;
29
+ /** Whether a value is a problem details object (an API error). */
30
+ export declare function isProblem(value: unknown): value is Problem;
31
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAG7B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,MAAM,WAAW,eAAe;IAC5B,uFAAuF;IACvF,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAC1B;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,eAAe,EAAE,CAAA;CAAE,CAAC;AAE/E,+DAA+D;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EACxC,MAAM,EAAE,CAAC,EACT,KAAK,EAAE,OAAO,GACf,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAY9B;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAO/E;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAU/E;AAED,kEAAkE;AAClE,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAE1D"}
@@ -0,0 +1,57 @@
1
+ import { Definition } from "./schemas/definition.js";
2
+ import { Problem } from "./schemas/api.js";
3
+ import { BootConfig } from "./schemas/boot.js";
4
+ import { lintDefinition } from "./lint.js";
5
+ //#region src/validate.ts
6
+ /** Validates a value against one of the protocol's schemas. */
7
+ function validate(schema, input) {
8
+ const result = schema.safeParse(input);
9
+ if (result.success) return {
10
+ success: true,
11
+ data: result.data
12
+ };
13
+ return {
14
+ success: false,
15
+ issues: result.error.issues.map((issue) => ({
16
+ path: issue.path.map(String).join("."),
17
+ message: issue.message
18
+ }))
19
+ };
20
+ }
21
+ /**
22
+ * Validates a definition, as returned by `GET /definition`: against the schema, then the
23
+ * references between its parts (see `lintDefinition()`).
24
+ */
25
+ function validateDefinition(input) {
26
+ const result = validate(Definition, input);
27
+ if (!result.success) return result;
28
+ const issues = lintDefinition(result.data);
29
+ return issues.length > 0 ? {
30
+ success: false,
31
+ issues
32
+ } : result;
33
+ }
34
+ /**
35
+ * Validates a boot config, as a server writes it in the page: against the schema, then the
36
+ * references between the parts of its inlined definition, if any.
37
+ */
38
+ function validateBootConfig(input) {
39
+ const result = validate(BootConfig, input);
40
+ if (!result.success || result.data.definition === void 0) return result;
41
+ const issues = lintDefinition(result.data.definition).map((issue) => ({
42
+ ...issue,
43
+ path: issue.path === "" ? "definition" : `definition.${issue.path}`
44
+ }));
45
+ return issues.length > 0 ? {
46
+ success: false,
47
+ issues
48
+ } : result;
49
+ }
50
+ /** Whether a value is a problem details object (an API error). */
51
+ function isProblem(value) {
52
+ return Problem.safeParse(value).success;
53
+ }
54
+ //#endregion
55
+ export { isProblem, validate, validateBootConfig, validateDefinition };
56
+
57
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","names":[],"sources":["../src/validate.ts"],"sourcesContent":["import type { z } from 'zod';\n\nimport { lintDefinition } from './lint';\nimport { Problem } from './schemas/api';\nimport { BootConfig } from './schemas/boot';\nimport { Definition } from './schemas/definition';\n\nexport interface ValidationIssue {\n /** Dot path of the invalid value (`resources.0.fields.2.type`), empty for the root. */\n path: string;\n message: string;\n}\n\nexport type ValidationResult<T> =\n { success: true; data: T } | { success: false; issues: ValidationIssue[] };\n\n/** Validates a value against one of the protocol's schemas. */\nexport function validate<T extends z.ZodType>(\n schema: T,\n input: unknown,\n): ValidationResult<z.infer<T>> {\n const result = schema.safeParse(input);\n if (result.success) {\n return { success: true, data: result.data };\n }\n return {\n success: false,\n issues: result.error.issues.map((issue) => ({\n path: issue.path.map(String).join('.'),\n message: issue.message,\n })),\n };\n}\n\n/**\n * Validates a definition, as returned by `GET /definition`: against the schema, then the\n * references between its parts (see `lintDefinition()`).\n */\nexport function validateDefinition(input: unknown): ValidationResult<Definition> {\n const result = validate(Definition, input);\n if (!result.success) {\n return result;\n }\n const issues = lintDefinition(result.data);\n return issues.length > 0 ? { success: false, issues } : result;\n}\n\n/**\n * Validates a boot config, as a server writes it in the page: against the schema, then the\n * references between the parts of its inlined definition, if any.\n */\nexport function validateBootConfig(input: unknown): ValidationResult<BootConfig> {\n const result = validate(BootConfig, input);\n if (!result.success || result.data.definition === undefined) {\n return result;\n }\n const issues = lintDefinition(result.data.definition).map((issue) => ({\n ...issue,\n path: issue.path === '' ? 'definition' : `definition.${issue.path}`,\n }));\n return issues.length > 0 ? { success: false, issues } : result;\n}\n\n/** Whether a value is a problem details object (an API error). */\nexport function isProblem(value: unknown): value is Problem {\n return Problem.safeParse(value).success;\n}\n"],"mappings":";;;;;;AAiBA,SAAgB,SACZ,QACA,OAC4B;CAC5B,MAAM,SAAS,OAAO,UAAU,KAAK;CACrC,IAAI,OAAO,SACP,OAAO;EAAE,SAAS;EAAM,MAAM,OAAO;CAAK;CAE9C,OAAO;EACH,SAAS;EACT,QAAQ,OAAO,MAAM,OAAO,KAAK,WAAW;GACxC,MAAM,MAAM,KAAK,IAAI,MAAM,CAAC,CAAC,KAAK,GAAG;GACrC,SAAS,MAAM;EACnB,EAAE;CACN;AACJ;;;;;AAMA,SAAgB,mBAAmB,OAA8C;CAC7E,MAAM,SAAS,SAAS,YAAY,KAAK;CACzC,IAAI,CAAC,OAAO,SACR,OAAO;CAEX,MAAM,SAAS,eAAe,OAAO,IAAI;CACzC,OAAO,OAAO,SAAS,IAAI;EAAE,SAAS;EAAO;CAAO,IAAI;AAC5D;;;;;AAMA,SAAgB,mBAAmB,OAA8C;CAC7E,MAAM,SAAS,SAAS,YAAY,KAAK;CACzC,IAAI,CAAC,OAAO,WAAW,OAAO,KAAK,eAAe,KAAA,GAC9C,OAAO;CAEX,MAAM,SAAS,eAAe,OAAO,KAAK,UAAU,CAAC,CAAC,KAAK,WAAW;EAClE,GAAG;EACH,MAAM,MAAM,SAAS,KAAK,eAAe,cAAc,MAAM;CACjE,EAAE;CACF,OAAO,OAAO,SAAS,IAAI;EAAE,SAAS;EAAO;CAAO,IAAI;AAC5D;;AAGA,SAAgB,UAAU,OAAkC;CACxD,OAAO,QAAQ,UAAU,KAAK,CAAC,CAAC;AACpC"}
@@ -0,0 +1,7 @@
1
+ /** Reads a value at a dot path (`blocks.2.title.fr`). */
2
+ export declare function getValue(values: unknown, path: string): unknown;
3
+ /** Whether a value counts as filled: not null, not an empty or blank string, not an empty array or object. */
4
+ export declare function isFilled(value: unknown): boolean;
5
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
6
+ export declare function isEqual(a: unknown, b: unknown): boolean;
7
+ //# sourceMappingURL=values.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"values.d.ts","sourceRoot":"","sources":["../src/values.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAU/D;AAED,8GAA8G;AAC9G,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAchD;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAQvD"}
package/dist/values.js ADDED
@@ -0,0 +1,29 @@
1
+ //#region src/values.ts
2
+ /** Reads a value at a dot path (`blocks.2.title.fr`). */
3
+ function getValue(values, path) {
4
+ if (path === "") return values;
5
+ return path.split(".").reduce((current, key) => {
6
+ if (current === null || typeof current !== "object") return;
7
+ return current[key];
8
+ }, values);
9
+ }
10
+ /** Whether a value counts as filled: not null, not an empty or blank string, not an empty array or object. */
11
+ function isFilled(value) {
12
+ if (value === null || value === void 0) return false;
13
+ if (typeof value === "string") return value.trim() !== "";
14
+ if (Array.isArray(value)) return value.length > 0;
15
+ if (typeof value === "object") return Object.keys(value).length > 0;
16
+ return true;
17
+ }
18
+ function isRecord(value) {
19
+ return value !== null && typeof value === "object" && !Array.isArray(value);
20
+ }
21
+ function isEqual(a, b) {
22
+ if (a === b) return true;
23
+ if (typeof a !== "object" || typeof b !== "object" || a === null || b === null) return false;
24
+ return JSON.stringify(a) === JSON.stringify(b);
25
+ }
26
+ //#endregion
27
+ export { getValue, isEqual, isFilled, isRecord };
28
+
29
+ //# sourceMappingURL=values.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"values.js","names":[],"sources":["../src/values.ts"],"sourcesContent":["/** Reads a value at a dot path (`blocks.2.title.fr`). */\nexport function getValue(values: unknown, path: string): unknown {\n if (path === '') {\n return values;\n }\n return path.split('.').reduce<unknown>((current, key) => {\n if (current === null || typeof current !== 'object') {\n return undefined;\n }\n return (current as Record<string, unknown>)[key];\n }, values);\n}\n\n/** Whether a value counts as filled: not null, not an empty or blank string, not an empty array or object. */\nexport function isFilled(value: unknown): boolean {\n if (value === null || value === undefined) {\n return false;\n }\n if (typeof value === 'string') {\n return value.trim() !== '';\n }\n if (Array.isArray(value)) {\n return value.length > 0;\n }\n if (typeof value === 'object') {\n return Object.keys(value).length > 0;\n }\n return true;\n}\n\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n\nexport function isEqual(a: unknown, b: unknown): boolean {\n if (a === b) {\n return true;\n }\n if (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null) {\n return false;\n }\n return JSON.stringify(a) === JSON.stringify(b);\n}\n"],"mappings":";;AACA,SAAgB,SAAS,QAAiB,MAAuB;CAC7D,IAAI,SAAS,IACT,OAAO;CAEX,OAAO,KAAK,MAAM,GAAG,CAAC,CAAC,QAAiB,SAAS,QAAQ;EACrD,IAAI,YAAY,QAAQ,OAAO,YAAY,UACvC;EAEJ,OAAQ,QAAoC;CAChD,GAAG,MAAM;AACb;;AAGA,SAAgB,SAAS,OAAyB;CAC9C,IAAI,UAAU,QAAQ,UAAU,KAAA,GAC5B,OAAO;CAEX,IAAI,OAAO,UAAU,UACjB,OAAO,MAAM,KAAK,MAAM;CAE5B,IAAI,MAAM,QAAQ,KAAK,GACnB,OAAO,MAAM,SAAS;CAE1B,IAAI,OAAO,UAAU,UACjB,OAAO,OAAO,KAAK,KAAK,CAAC,CAAC,SAAS;CAEvC,OAAO;AACX;AAEA,SAAgB,SAAS,OAAkD;CACvE,OAAO,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AAC9E;AAEA,SAAgB,QAAQ,GAAY,GAAqB;CACrD,IAAI,MAAM,GACN,OAAO;CAEX,IAAI,OAAO,MAAM,YAAY,OAAO,MAAM,YAAY,MAAM,QAAQ,MAAM,MACtE,OAAO;CAEX,OAAO,KAAK,UAAU,CAAC,MAAM,KAAK,UAAU,CAAC;AACjD"}
@@ -0,0 +1,5 @@
1
+ /** Version of the Panneau protocol described by this package. */
2
+ export declare const PROTOCOL_VERSION = 1;
3
+ /** Media type of error responses. */
4
+ export declare const PROBLEM_CONTENT_TYPE = "application/problem+json";
5
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC,qCAAqC;AACrC,eAAO,MAAM,oBAAoB,6BAA6B,CAAC"}
@@ -0,0 +1,9 @@
1
+ //#region src/version.ts
2
+ /** Version of the Panneau protocol described by this package. */
3
+ var PROTOCOL_VERSION = 1;
4
+ /** Media type of error responses. */
5
+ var PROBLEM_CONTENT_TYPE = "application/problem+json";
6
+ //#endregion
7
+ export { PROBLEM_CONTENT_TYPE, PROTOCOL_VERSION };
8
+
9
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","names":[],"sources":["../src/version.ts"],"sourcesContent":["/** Version of the Panneau protocol described by this package. */\nexport const PROTOCOL_VERSION = 1;\n\n/** Media type of error responses. */\nexport const PROBLEM_CONTENT_TYPE = 'application/problem+json';\n"],"mappings":";;AACA,IAAa,mBAAmB;;AAGhC,IAAa,uBAAuB"}
package/package.json CHANGED
@@ -1,6 +1,49 @@
1
1
  {
2
- "name": "@panneau/protocol",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@panneau/protocol",
3
+ "version": "5.0.0-alpha.0",
4
+ "description": "The Panneau protocol: definition schema, HTTP API spec and conformance kit",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/folkloreinc/panneau-js.git",
10
+ "directory": "packages/protocol"
11
+ },
12
+ "sideEffects": false,
13
+ "exports": {
14
+ ".": {
15
+ "@panneau/source": "./src/index.ts",
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.js"
18
+ },
19
+ "./mock": {
20
+ "@panneau/source": "./src/mock/index.ts",
21
+ "types": "./dist/mock/index.d.ts",
22
+ "default": "./dist/mock/index.js"
23
+ },
24
+ "./conformance": {
25
+ "@panneau/source": "./src/conformance/index.ts",
26
+ "types": "./dist/conformance/index.d.ts",
27
+ "default": "./dist/conformance/index.js"
28
+ },
29
+ "./definition.schema.json": "./schema/definition.schema.json",
30
+ "./openapi.json": "./schema/openapi.json",
31
+ "./boot.schema.json": "./schema/boot.schema.json",
32
+ "./package.json": "./package.json"
33
+ },
34
+ "files": [
35
+ "dist",
36
+ "schema"
37
+ ],
38
+ "scripts": {
39
+ "build": "vite build && tsc -p tsconfig.build.json && node scripts/generate-schemas.js",
40
+ "typecheck": "tsc --noEmit",
41
+ "api": "tsc -p tsconfig.build.json && node ../../scripts/api-report.js"
42
+ },
43
+ "publishConfig": {
44
+ "access": "public"
45
+ },
46
+ "dependencies": {
47
+ "zod": "^4.6.7"
48
+ }
49
+ }