@beechcms/core 0.9.0 → 0.9.1

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 (203) hide show
  1. package/dist/dashboard-layout/content-view.d.ts +4 -4
  2. package/package.json +2 -2
  3. package/dist/automations-grammar-words.d.ts +0 -2
  4. package/dist/automations-grammar-words.d.ts.map +0 -1
  5. package/dist/automations-grammar-words.js +0 -8
  6. package/dist/automations.repository.interface.d.ts +0 -19
  7. package/dist/automations.repository.interface.d.ts.map +0 -1
  8. package/dist/automations.repository.interface.js +0 -3
  9. package/dist/automations.runner.interface.d.ts +0 -10
  10. package/dist/automations.runner.interface.d.ts.map +0 -1
  11. package/dist/automations.runner.interface.js +0 -3
  12. package/dist/automations.runner.stub.d.ts +0 -5
  13. package/dist/automations.runner.stub.d.ts.map +0 -1
  14. package/dist/automations.runner.stub.js +0 -7
  15. package/dist/automations.types.d.ts +0 -75
  16. package/dist/automations.types.d.ts.map +0 -1
  17. package/dist/automations.types.js +0 -3
  18. package/dist/clock.d.ts +0 -25
  19. package/dist/clock.d.ts.map +0 -1
  20. package/dist/clock.js +0 -11
  21. package/dist/content-scan.repository.d.ts +0 -9
  22. package/dist/content-scan.repository.d.ts.map +0 -1
  23. package/dist/content-scan.repository.js +0 -3
  24. package/dist/content.repository.d.ts +0 -247
  25. package/dist/content.repository.d.ts.map +0 -1
  26. package/dist/content.repository.js +0 -59
  27. package/dist/dashboard-layout/kanban/kanban-position.repository.d.ts +0 -19
  28. package/dist/dashboard-layout/kanban/kanban-position.repository.d.ts.map +0 -1
  29. package/dist/dashboard-layout/kanban/kanban-position.repository.js +0 -3
  30. package/dist/dashboard-layout.d.ts +0 -154
  31. package/dist/dashboard-layout.d.ts.map +0 -1
  32. package/dist/dashboard-layout.js +0 -186
  33. package/dist/dashboard-layout.repository.d.ts +0 -18
  34. package/dist/dashboard-layout.repository.d.ts.map +0 -1
  35. package/dist/dashboard-layout.repository.js +0 -3
  36. package/dist/dashboard-permissions.d.ts +0 -3
  37. package/dist/dashboard-permissions.d.ts.map +0 -1
  38. package/dist/dashboard-permissions.js +0 -11
  39. package/dist/dashboard-scopes.d.ts +0 -12
  40. package/dist/dashboard-scopes.d.ts.map +0 -1
  41. package/dist/dashboard-scopes.js +0 -30
  42. package/dist/define-seed.d.ts +0 -3
  43. package/dist/define-seed.d.ts.map +0 -1
  44. package/dist/define-seed.js +0 -5
  45. package/dist/demo-data.repository.d.ts +0 -5
  46. package/dist/demo-data.repository.d.ts.map +0 -1
  47. package/dist/demo-data.repository.js +0 -3
  48. package/dist/email.provider.d.ts +0 -32
  49. package/dist/email.provider.d.ts.map +0 -1
  50. package/dist/email.provider.js +0 -4
  51. package/dist/engine/ddl/seed-ddl-destructive.d.ts +0 -40
  52. package/dist/engine/ddl/seed-ddl-destructive.d.ts.map +0 -1
  53. package/dist/engine/ddl/seed-ddl-destructive.js +0 -149
  54. package/dist/engine/ddl.d.ts +0 -193
  55. package/dist/engine/ddl.d.ts.map +0 -1
  56. package/dist/engine/ddl.js +0 -518
  57. package/dist/engine/define-seed.d.ts +0 -3
  58. package/dist/engine/define-seed.d.ts.map +0 -1
  59. package/dist/engine/define-seed.js +0 -5
  60. package/dist/engine/introspection.d.ts +0 -101
  61. package/dist/engine/introspection.d.ts.map +0 -1
  62. package/dist/engine/introspection.js +0 -127
  63. package/dist/engine/localization.d.ts +0 -127
  64. package/dist/engine/localization.d.ts.map +0 -1
  65. package/dist/engine/localization.js +0 -212
  66. package/dist/engine/policies.d.ts +0 -58
  67. package/dist/engine/policies.d.ts.map +0 -1
  68. package/dist/engine/policies.js +0 -168
  69. package/dist/engine/privacy.service.d.ts +0 -65
  70. package/dist/engine/privacy.service.d.ts.map +0 -1
  71. package/dist/engine/privacy.service.js +0 -114
  72. package/dist/engine/query.d.ts +0 -23
  73. package/dist/engine/query.d.ts.map +0 -1
  74. package/dist/engine/query.js +0 -236
  75. package/dist/engine/relations.d.ts +0 -28
  76. package/dist/engine/relations.d.ts.map +0 -1
  77. package/dist/engine/relations.js +0 -25
  78. package/dist/engine/schema-fingerprint.d.ts +0 -73
  79. package/dist/engine/schema-fingerprint.d.ts.map +0 -1
  80. package/dist/engine/schema-fingerprint.js +0 -97
  81. package/dist/engine/schema-mutator.d.ts +0 -26
  82. package/dist/engine/schema-mutator.d.ts.map +0 -1
  83. package/dist/engine/schema-mutator.js +0 -3
  84. package/dist/engine/seed-ddl-destructive.d.ts +0 -40
  85. package/dist/engine/seed-ddl-destructive.d.ts.map +0 -1
  86. package/dist/engine/seed-ddl-destructive.js +0 -149
  87. package/dist/engine/seed-ddl.d.ts +0 -40
  88. package/dist/engine/seed-ddl.d.ts.map +0 -1
  89. package/dist/engine/seed-ddl.js +0 -100
  90. package/dist/engine/seed-registry.d.ts +0 -71
  91. package/dist/engine/seed-registry.d.ts.map +0 -1
  92. package/dist/engine/seed-registry.js +0 -167
  93. package/dist/engine/seed-types-generator.d.ts +0 -10
  94. package/dist/engine/seed-types-generator.d.ts.map +0 -1
  95. package/dist/engine/seed-types-generator.js +0 -89
  96. package/dist/engine/seed-validation.d.ts +0 -30
  97. package/dist/engine/seed-validation.d.ts.map +0 -1
  98. package/dist/engine/seed-validation.js +0 -319
  99. package/dist/engine/seeds.d.ts +0 -20
  100. package/dist/engine/seeds.d.ts.map +0 -1
  101. package/dist/engine/seeds.js +0 -21
  102. package/dist/engine/serialize.d.ts +0 -20
  103. package/dist/engine/serialize.d.ts.map +0 -1
  104. package/dist/engine/serialize.js +0 -160
  105. package/dist/engine.d.ts +0 -144
  106. package/dist/engine.d.ts.map +0 -1
  107. package/dist/engine.js +0 -741
  108. package/dist/file-types.d.ts +0 -13
  109. package/dist/file-types.d.ts.map +0 -1
  110. package/dist/file-types.js +0 -85
  111. package/dist/hooks.d.ts +0 -29
  112. package/dist/hooks.d.ts.map +0 -1
  113. package/dist/hooks.js +0 -3
  114. package/dist/id-generator.d.ts +0 -26
  115. package/dist/id-generator.d.ts.map +0 -1
  116. package/dist/id-generator.js +0 -12
  117. package/dist/idempotency.repository.d.ts +0 -13
  118. package/dist/idempotency.repository.d.ts.map +0 -1
  119. package/dist/idempotency.repository.js +0 -3
  120. package/dist/kanban-position.repository.d.ts +0 -19
  121. package/dist/kanban-position.repository.d.ts.map +0 -1
  122. package/dist/kanban-position.repository.js +0 -3
  123. package/dist/kanban.d.ts +0 -75
  124. package/dist/kanban.d.ts.map +0 -1
  125. package/dist/kanban.js +0 -82
  126. package/dist/layout-permissions.d.ts +0 -3
  127. package/dist/layout-permissions.d.ts.map +0 -1
  128. package/dist/layout-permissions.js +0 -11
  129. package/dist/media.repository.d.ts +0 -61
  130. package/dist/media.repository.d.ts.map +0 -1
  131. package/dist/media.repository.js +0 -3
  132. package/dist/policies.d.ts +0 -10
  133. package/dist/policies.d.ts.map +0 -1
  134. package/dist/policies.js +0 -33
  135. package/dist/queue.interface.d.ts +0 -39
  136. package/dist/queue.interface.d.ts.map +0 -1
  137. package/dist/queue.interface.js +0 -3
  138. package/dist/queue.stub.d.ts +0 -6
  139. package/dist/queue.stub.d.ts.map +0 -1
  140. package/dist/queue.stub.js +0 -8
  141. package/dist/relations.d.ts +0 -28
  142. package/dist/relations.d.ts.map +0 -1
  143. package/dist/relations.js +0 -25
  144. package/dist/richtext-render.d.ts +0 -11
  145. package/dist/richtext-render.d.ts.map +0 -1
  146. package/dist/richtext-render.js +0 -87
  147. package/dist/richtext.d.ts +0 -11
  148. package/dist/richtext.d.ts.map +0 -1
  149. package/dist/richtext.js +0 -13
  150. package/dist/scheduler.interface.d.ts +0 -4
  151. package/dist/scheduler.interface.d.ts.map +0 -1
  152. package/dist/scheduler.interface.js +0 -3
  153. package/dist/scheduler.stub.d.ts +0 -5
  154. package/dist/scheduler.stub.d.ts.map +0 -1
  155. package/dist/scheduler.stub.js +0 -7
  156. package/dist/schema-mutator.d.ts +0 -26
  157. package/dist/schema-mutator.d.ts.map +0 -1
  158. package/dist/schema-mutator.js +0 -3
  159. package/dist/seed-ddl-destructive.d.ts +0 -40
  160. package/dist/seed-ddl-destructive.d.ts.map +0 -1
  161. package/dist/seed-ddl-destructive.js +0 -149
  162. package/dist/seed-ddl.d.ts +0 -40
  163. package/dist/seed-ddl.d.ts.map +0 -1
  164. package/dist/seed-ddl.js +0 -100
  165. package/dist/seed-layout.d.ts +0 -145
  166. package/dist/seed-layout.d.ts.map +0 -1
  167. package/dist/seed-layout.js +0 -192
  168. package/dist/seed-layout.repository.d.ts +0 -22
  169. package/dist/seed-layout.repository.d.ts.map +0 -1
  170. package/dist/seed-layout.repository.js +0 -3
  171. package/dist/seed-registry.d.ts +0 -71
  172. package/dist/seed-registry.d.ts.map +0 -1
  173. package/dist/seed-registry.js +0 -143
  174. package/dist/seed-types-generator.d.ts +0 -10
  175. package/dist/seed-types-generator.d.ts.map +0 -1
  176. package/dist/seed-types-generator.js +0 -86
  177. package/dist/seed-validation.d.ts +0 -23
  178. package/dist/seed-validation.d.ts.map +0 -1
  179. package/dist/seed-validation.js +0 -224
  180. package/dist/seed.repository.d.ts +0 -37
  181. package/dist/seed.repository.d.ts.map +0 -1
  182. package/dist/seed.repository.js +0 -3
  183. package/dist/seeds.d.ts +0 -20
  184. package/dist/seeds.d.ts.map +0 -1
  185. package/dist/seeds.js +0 -21
  186. package/dist/site-settings.repository.d.ts +0 -16
  187. package/dist/site-settings.repository.d.ts.map +0 -1
  188. package/dist/site-settings.repository.js +0 -3
  189. package/dist/slug-utils.d.ts +0 -18
  190. package/dist/slug-utils.d.ts.map +0 -1
  191. package/dist/slug-utils.js +0 -32
  192. package/dist/storage.d.ts +0 -46
  193. package/dist/storage.d.ts.map +0 -1
  194. package/dist/storage.js +0 -3
  195. package/dist/types.d.ts +0 -243
  196. package/dist/types.d.ts.map +0 -1
  197. package/dist/types.js +0 -3
  198. package/dist/validation.d.ts +0 -50
  199. package/dist/validation.d.ts.map +0 -1
  200. package/dist/validation.js +0 -660
  201. package/dist/webhook-validation.d.ts +0 -3
  202. package/dist/webhook-validation.d.ts.map +0 -1
  203. package/dist/webhook-validation.js +0 -6
@@ -1,13 +0,0 @@
1
- export type FileAccept = 'image' | 'document' | 'any';
2
- export declare const IMAGE_EXTENSIONS: Set<string>;
3
- export declare const BLOCKED_IMAGE_EXTENSIONS: Set<string>;
4
- export declare const DOCUMENT_EXTENSIONS: Set<string>;
5
- export declare const ARCHIVE_EXTENSIONS: Set<string>;
6
- export declare const IMAGE_MIME_TYPES: readonly ["image/jpeg", "image/png", "image/gif", "image/webp", "image/avif", "image/bmp", "image/x-icon", "image/vnd.microsoft.icon"];
7
- export declare const BLOCKED_IMAGE_MIME_TYPES: readonly ["image/svg+xml", "image/svg"];
8
- export declare const DOCUMENT_MIME_TYPES: readonly ["application/pdf", "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.ms-powerpoint", "application/vnd.openxmlformats-officedocument.presentationml.presentation", "text/plain", "text/csv", "text/markdown"];
9
- export declare const ARCHIVE_MIME_TYPES: readonly ["application/zip", "application/x-zip-compressed", "application/x-7z-compressed", "application/x-tar", "application/gzip", "application/json"];
10
- export declare function extensionFromUrl(url: string): string | null;
11
- export declare function isExtensionAccepted(ext: string | null, accept: FileAccept): boolean;
12
- export declare function isMimeAccepted(mime: string, accept: FileAccept): boolean;
13
- //# sourceMappingURL=file-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-types.d.ts","sourceRoot":"","sources":["../src/file-types.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,UAAU,GAAG,KAAK,CAAA;AAKrD,eAAO,MAAM,gBAAgB,aAAuE,CAAA;AACpG,eAAO,MAAM,wBAAwB,aAA2B,CAAA;AAChE,eAAO,MAAM,mBAAmB,aAAoF,CAAA;AACpH,eAAO,MAAM,kBAAkB,aAA8C,CAAA;AAI7E,eAAO,MAAM,gBAAgB,wIASnB,CAAA;AAGV,eAAO,MAAM,wBAAwB,yCAA0C,CAAA;AAC/E,eAAO,MAAM,mBAAmB,yXAWtB,CAAA;AACV,eAAO,MAAM,kBAAkB,0JAOrB,CAAA;AAEV,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAS3D;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAMnF;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAcxE"}
@@ -1,85 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- // Copyright (c) 2024–2026 Flavio De Musso
3
- // SVG is intentionally excluded: SVG can embed <script> tags and is rendered
4
- // inline by browsers when served as image/svg+xml on a same-origin route,
5
- // creating a stored XSS vector (see security audit finding #4).
6
- export const IMAGE_EXTENSIONS = new Set(['jpg', 'jpeg', 'png', 'gif', 'webp', 'avif', 'bmp', 'ico']);
7
- export const BLOCKED_IMAGE_EXTENSIONS = new Set(['svg', 'svgz']);
8
- export const DOCUMENT_EXTENSIONS = new Set(['pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'csv', 'md']);
9
- export const ARCHIVE_EXTENSIONS = new Set(['zip', '7z', 'tar', 'gz', 'json']);
10
- // Explicitly enumerate safe image MIME types instead of using the wildcard
11
- // `image/*` prefix, which would permit `image/svg+xml` and other XSS vectors.
12
- export const IMAGE_MIME_TYPES = [
13
- 'image/jpeg',
14
- 'image/png',
15
- 'image/gif',
16
- 'image/webp',
17
- 'image/avif',
18
- 'image/bmp',
19
- 'image/x-icon',
20
- 'image/vnd.microsoft.icon',
21
- ];
22
- // Blocked image MIME types — listed explicitly so upload code can reject them
23
- // with a clear error rather than a generic "file type not allowed".
24
- export const BLOCKED_IMAGE_MIME_TYPES = ['image/svg+xml', 'image/svg'];
25
- export const DOCUMENT_MIME_TYPES = [
26
- 'application/pdf',
27
- 'application/msword',
28
- 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
29
- 'application/vnd.ms-excel',
30
- 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
31
- 'application/vnd.ms-powerpoint',
32
- 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
33
- 'text/plain',
34
- 'text/csv',
35
- 'text/markdown',
36
- ];
37
- export const ARCHIVE_MIME_TYPES = [
38
- 'application/zip',
39
- 'application/x-zip-compressed',
40
- 'application/x-7z-compressed',
41
- 'application/x-tar',
42
- 'application/gzip',
43
- 'application/json',
44
- ];
45
- export function extensionFromUrl(url) {
46
- try {
47
- const path = new URL(url).pathname;
48
- const dot = path.lastIndexOf('.');
49
- if (dot < 0 || dot === path.length - 1)
50
- return null;
51
- return path.slice(dot + 1).toLowerCase();
52
- }
53
- catch {
54
- return null;
55
- }
56
- }
57
- export function isExtensionAccepted(ext, accept) {
58
- if (accept === 'any')
59
- return true;
60
- if (ext == null)
61
- return false;
62
- if (accept === 'image')
63
- return IMAGE_EXTENSIONS.has(ext);
64
- if (accept === 'document')
65
- return DOCUMENT_EXTENSIONS.has(ext);
66
- return false;
67
- }
68
- export function isMimeAccepted(mime, accept) {
69
- // Normalise: strip parameters (e.g. "image/jpeg; charset=utf-8" → "image/jpeg")
70
- const normalised = mime.split(';')[0].trim().toLowerCase();
71
- // Unconditionally reject SVG regardless of accept mode — SVG can carry
72
- // embedded scripts and is rendered by browsers when served inline.
73
- if (BLOCKED_IMAGE_MIME_TYPES.includes(normalised))
74
- return false;
75
- if (accept === 'any') {
76
- return IMAGE_MIME_TYPES.includes(normalised)
77
- || DOCUMENT_MIME_TYPES.includes(normalised)
78
- || ARCHIVE_MIME_TYPES.includes(normalised);
79
- }
80
- if (accept === 'image')
81
- return IMAGE_MIME_TYPES.includes(normalised);
82
- if (accept === 'document')
83
- return DOCUMENT_MIME_TYPES.includes(normalised);
84
- return false;
85
- }
package/dist/hooks.d.ts DELETED
@@ -1,29 +0,0 @@
1
- import type { ContentRepository } from './content.repository.js';
2
- import type { Seed } from './types.js';
3
- export interface HookActor {
4
- id: string;
5
- role?: string;
6
- email?: string;
7
- }
8
- export interface HookContext {
9
- seed: Seed;
10
- /** Canale lecito per side-effect sui contenuti dagli hook (rispetta la Botanical Engine). */
11
- repository: ContentRepository;
12
- /** Utente che esegue l'operazione, estratto dal JWT. Assente per operazioni di sistema/cron. */
13
- actor?: HookActor;
14
- /**
15
- * Escape hatch per la connessione nativa (D1Database in prod, better-sqlite3 nei test).
16
- * Tipizzato `unknown` per non accoppiare @beechcms/core a Cloudflare. Usare con cautela:
17
- * scrivere qui bypassa la Botanical Engine.
18
- */
19
- db: unknown;
20
- }
21
- export interface BeechHooks {
22
- beforeCreate?: (data: Record<string, any>, ctx: HookContext) => Promise<Record<string, any> | void> | Record<string, any> | void;
23
- beforeUpdate?: (id: string, patches: Record<string, any>, ctx: HookContext) => Promise<Record<string, any> | void> | Record<string, any> | void;
24
- beforeDelete?: (id: string, ctx: HookContext) => Promise<void> | void;
25
- afterCreate?: (entry: Record<string, any>, ctx: HookContext) => Promise<void> | void;
26
- afterUpdate?: (entry: Record<string, any>, ctx: HookContext) => Promise<void> | void;
27
- afterDelete?: (id: string, ctx: HookContext) => Promise<void> | void;
28
- }
29
- //# sourceMappingURL=hooks.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEtC,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,IAAI,CAAA;IACV,6FAA6F;IAC7F,UAAU,EAAE,iBAAiB,CAAA;IAC7B,gGAAgG;IAChG,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB;;;;OAIG;IACH,EAAE,EAAE,OAAO,CAAA;CACZ;AAED,MAAM,WAAW,UAAU;IAGzB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAA;IAChI,YAAY,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAA;IAC/I,YAAY,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IAGrE,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IACpF,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IACpF,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;CACrE"}
package/dist/hooks.js DELETED
@@ -1,3 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- // Copyright (c) 2024–2026 Flavio De Musso
3
- export {};
@@ -1,26 +0,0 @@
1
- /**
2
- * Identifier abstraction. Hides direct calls to {@link crypto.randomUUID}
3
- * so callers can swap in deterministic generators during tests for stable
4
- * snapshot assertions and predictable insert ordering.
5
- */
6
- export interface IIdGenerator {
7
- /**
8
- * Generates a new universally unique identifier.
9
- * Production implementation delegates to crypto.randomUUID().
10
- * Test implementations return deterministic values for snapshot assertions.
11
- */
12
- uuid(): string;
13
- /**
14
- * Returns true when `value` has the exact shape produced by `uuid()`.
15
- * The ONLY place in the codebase that knows the id format. Never inline
16
- * a regex; always go through this method when validating a relation id,
17
- * a route param, or any user-supplied id.
18
- */
19
- isValid(value: unknown): value is string;
20
- }
21
- /**
22
- * Production singleton. Delegates to the host runtime CSPRNG-backed UUID
23
- * generator. Stateless and therefore safe to share across requests.
24
- */
25
- export declare const SystemIdGenerator: IIdGenerator;
26
- //# sourceMappingURL=id-generator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"id-generator.d.ts","sourceRoot":"","sources":["../src/id-generator.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,IAAI,IAAI,MAAM,CAAA;IAEd;;;;;OAKG;IACH,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAA;CACzC;AAMD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,YAI/B,CAAA"}
@@ -1,12 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- // Copyright (c) 2024–2026 Flavio De Musso
3
- // Internal — never exported. Callers depend on the interface, not the shape.
4
- const SYSTEM_ID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
5
- /**
6
- * Production singleton. Delegates to the host runtime CSPRNG-backed UUID
7
- * generator. Stateless and therefore safe to share across requests.
8
- */
9
- export const SystemIdGenerator = {
10
- uuid: () => crypto.randomUUID(),
11
- isValid: (value) => typeof value === 'string' && SYSTEM_ID_REGEX.test(value),
12
- };
@@ -1,13 +0,0 @@
1
- export interface IdempotencyRecord {
2
- key: string;
3
- fingerprint: string;
4
- responseStatus: number;
5
- responseBody: string;
6
- expiresAt: number;
7
- }
8
- export interface IdempotencyRepository {
9
- lookup(key: string): Promise<IdempotencyRecord | null>;
10
- store(record: IdempotencyRecord): Promise<void>;
11
- cleanup(now: number): Promise<void>;
12
- }
13
- //# sourceMappingURL=idempotency.repository.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"idempotency.repository.d.ts","sourceRoot":"","sources":["../src/idempotency.repository.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,EAAE,MAAM,CAAA;IACnB,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAA;IACtD,KAAK,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC/C,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACpC"}
@@ -1,3 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- // Copyright (c) 2024–2026 Flavio De Musso
3
- export {};
@@ -1,19 +0,0 @@
1
- export interface KanbanPositionRecord {
2
- entryId: string;
3
- position: string;
4
- }
5
- /**
6
- * Persistence contract for card ordering. The ONLY gateway to `kanban_positions`.
7
- * Handlers and the dashboard never touch the table directly (Botanical invariant).
8
- */
9
- export interface IKanbanPositionRepository {
10
- /** entryId → position for one column axis (entries without a row are omitted). */
11
- getColumn(seedSlug: string, axisBranchId: string): Promise<Map<string, string>>;
12
- /** Single-row upsert — exactly one write per drag (KB-S04b). */
13
- setPosition(seedSlug: string, entryId: string, axisBranchId: string, position: string): Promise<void>;
14
- /** Remove an entry's position row (e.g. entry deleted). */
15
- remove(seedSlug: string, entryId: string, axisBranchId: string): Promise<void>;
16
- /** Async rebalance (KB-S04f): rewrite a whole column's positions in one batch. */
17
- rebalance(seedSlug: string, axisBranchId: string, ordered: KanbanPositionRecord[]): Promise<void>;
18
- }
19
- //# sourceMappingURL=kanban-position.repository.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"kanban-position.repository.d.ts","sourceRoot":"","sources":["../src/kanban-position.repository.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC,kFAAkF;IAClF,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IAC/E,gEAAgE;IAChE,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACrG,2DAA2D;IAC3D,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9E,kFAAkF;IAClF,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAClG"}
@@ -1,3 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- // Copyright (c) 2024–2026 Flavio De Musso
3
- export {};
package/dist/kanban.d.ts DELETED
@@ -1,75 +0,0 @@
1
- import type { Seed, Branch, FilterGroup } from './types.js';
2
- /** Branch types that can form a discrete, finite set of columns (KB §2). */
3
- export type KanbanAxisBranchType = 'text' | 'tags' | 'boolean';
4
- /** A branch eligible to be the kanban axis. */
5
- export interface KanbanAxisCandidate {
6
- /** Stable branch id (br_XX) — persisted as the axis key. Never the alias. */
7
- branchId: string;
8
- alias: string;
9
- label: string;
10
- type: KanbanAxisBranchType;
11
- }
12
- /** A single column on the board, in deterministic display order (Q2). */
13
- export interface KanbanColumnDescriptor {
14
- /** The discrete axis value. `null` ⇒ the always-last "Senza valore" column. */
15
- value: string | null;
16
- label: string;
17
- }
18
- /** Per-seed, dashboard-side kanban view preferences. Persisted in
19
- * seed_layouts.view_config (KB-S02). NOT part of FormLayout. */
20
- export interface KanbanConfig {
21
- /** Chosen axis branch id, or null when the user has not configured one (KB-U02). */
22
- axisBranchId: string | null;
23
- /** Card sort inside columns. null ⇒ manual order via kanban_positions (KB-U22b). */
24
- sort: {
25
- branchId: string;
26
- dir: 'ASC' | 'DESC';
27
- } | null;
28
- /** Axis values the user chose to hide when columns exceed the cap (KB-U06c). */
29
- hiddenColumnValues?: string[];
30
- }
31
- export type KanbanIncompatibleReason = 'drafts-enabled' | 'no-candidate-branch';
32
- export interface KanbanCompatibility {
33
- compatible: boolean;
34
- reason?: KanbanIncompatibleReason;
35
- candidates: KanbanAxisCandidate[];
36
- }
37
- /**
38
- * Determines whether a seed can be displayed as a Kanban board, and which
39
- * branches may serve as the column axis. Pure — no I/O. (KB-S01)
40
- *
41
- * Q3: seeds with `allowDrafts: true` are NOT kanban-compatible.
42
- */
43
- export declare function resolveKanbanConfig(seed: Seed): KanbanCompatibility;
44
- /**
45
- * Deterministic, stable column order for a chosen axis (Q2). The "Senza valore"
46
- * (value: null) column is always appended last. Values out of `options` are NOT
47
- * given their own column (KB-U25) — the board folds them into "Senza valore".
48
- *
49
- * @param distinctTagValues unique tag values observed in data (tags axis without options).
50
- */
51
- export declare function resolveKanbanColumns(branch: Branch, distinctTagValues?: string[]): KanbanColumnDescriptor[];
52
- /**
53
- * Pure: the FilterGroup selecting one kanban column's entries for a given axis branch.
54
- * `value: null` ⇒ "Senza valore" — entries where the axis field is NULL or empty (KB-U25).
55
- * Boolean descriptor values 'true'/'false' are coerced to actual booleans for the engine.
56
- */
57
- /** Body of PATCH /:slug/:id/kanban-move. The server applies the axis change (if any)
58
- * AND the position upsert atomically (KB-S04e). */
59
- export interface KanbanMoveBody {
60
- /** Axis branch id (br_XX). Identifies which kanban_positions row + which branch to patch. */
61
- axisBranchId: string;
62
- /** New fractional-index key for this entry in the destination column (KB-S04b/d). */
63
- position: string;
64
- /** Present only on a cross-column move (axis value changed). Omit for same-column reorder. */
65
- axis?: {
66
- kind: 'scalar';
67
- value: string | null;
68
- } | {
69
- kind: 'tags';
70
- oldValue: string | null;
71
- newValue: string | null;
72
- };
73
- }
74
- export declare function kanbanColumnFilter(branch: Branch, value: string | null): FilterGroup;
75
- //# sourceMappingURL=kanban.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"kanban.d.ts","sourceRoot":"","sources":["../src/kanban.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE3D,4EAA4E;AAC5E,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;AAE9D,+CAA+C;AAC/C,MAAM,WAAW,mBAAmB;IAClC,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,oBAAoB,CAAA;CAC3B;AAED,yEAAyE;AACzE,MAAM,WAAW,sBAAsB;IACrC,+EAA+E;IAC/E,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;CACd;AAED;iEACiE;AACjE,MAAM,WAAW,YAAY;IAC3B,oFAAoF;IACpF,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,oFAAoF;IACpF,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,KAAK,GAAG,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;IACtD,gFAAgF;IAChF,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC9B;AAED,MAAM,MAAM,wBAAwB,GAAG,gBAAgB,GAAG,qBAAqB,CAAA;AAE/E,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,OAAO,CAAA;IACnB,MAAM,CAAC,EAAE,wBAAwB,CAAA;IACjC,UAAU,EAAE,mBAAmB,EAAE,CAAA;CAClC;AAgBD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG,mBAAmB,CAanE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,iBAAiB,GAAE,MAAM,EAAO,GAC/B,sBAAsB,EAAE,CAiB1B;AAED;;;;GAIG;AACH;oDACoD;AACpD,MAAM,WAAW,cAAc;IAC7B,6FAA6F;IAC7F,YAAY,EAAE,MAAM,CAAA;IACpB,qFAAqF;IACrF,QAAQ,EAAE,MAAM,CAAA;IAChB,8FAA8F;IAC9F,IAAI,CAAC,EACD;QAAE,IAAI,EAAE,QAAQ,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GACxC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAA;CACvE;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,WAAW,CAYpF"}
package/dist/kanban.js DELETED
@@ -1,82 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- // Copyright (c) 2024–2026 Flavio De Musso
3
- /** Branch types that are explicitly never an axis (KB §2). */
4
- const NON_AXIS_TYPES = new Set([
5
- 'richtext', 'file', 'number', 'date', 'json', 'relation', 'repeater',
6
- ]);
7
- function isAxisCandidate(b) {
8
- if (b.alias === 'status')
9
- return null; // system status excluded (KB §2)
10
- if (NON_AXIS_TYPES.has(b.type))
11
- return null;
12
- if (b.type === 'text')
13
- return (b.options && b.options.length > 0) ? 'text' : null;
14
- if (b.type === 'tags')
15
- return 'tags';
16
- if (b.type === 'boolean')
17
- return 'boolean';
18
- return null;
19
- }
20
- /**
21
- * Determines whether a seed can be displayed as a Kanban board, and which
22
- * branches may serve as the column axis. Pure — no I/O. (KB-S01)
23
- *
24
- * Q3: seeds with `allowDrafts: true` are NOT kanban-compatible.
25
- */
26
- export function resolveKanbanConfig(seed) {
27
- if (seed.allowDrafts) {
28
- return { compatible: false, reason: 'drafts-enabled', candidates: [] };
29
- }
30
- const candidates = [];
31
- for (const b of seed.branches) {
32
- const type = isAxisCandidate(b);
33
- if (type)
34
- candidates.push({ branchId: b.id, alias: b.alias, label: b.label, type });
35
- }
36
- if (candidates.length === 0) {
37
- return { compatible: false, reason: 'no-candidate-branch', candidates: [] };
38
- }
39
- return { compatible: true, candidates };
40
- }
41
- /**
42
- * Deterministic, stable column order for a chosen axis (Q2). The "Senza valore"
43
- * (value: null) column is always appended last. Values out of `options` are NOT
44
- * given their own column (KB-U25) — the board folds them into "Senza valore".
45
- *
46
- * @param distinctTagValues unique tag values observed in data (tags axis without options).
47
- */
48
- export function resolveKanbanColumns(branch, distinctTagValues = []) {
49
- const cols = [];
50
- if (branch.type === 'boolean') {
51
- cols.push({ value: 'false', label: 'No' }, { value: 'true', label: 'Sì' }); // [false, true]
52
- }
53
- else if (branch.type === 'text' && branch.options?.length) {
54
- for (const o of branch.options)
55
- cols.push({ value: o, label: o }); // options order
56
- }
57
- else if (branch.type === 'tags') {
58
- const ordered = branch.options?.length
59
- ? branch.options
60
- : [...distinctTagValues].sort((a, b) => a.localeCompare(b)); // alphabetical
61
- for (const o of ordered)
62
- cols.push({ value: o, label: o });
63
- }
64
- const isRequired = Boolean(branch.requiredOnCreate || branch.requiredOnUpdate);
65
- if (!isRequired) {
66
- cols.push({ value: null, label: `Senza ${branch.label}` }); // always last if not required
67
- }
68
- return cols;
69
- }
70
- export function kanbanColumnFilter(branch, value) {
71
- if (value === null) {
72
- const type = branch.type === 'boolean' ? 'boolean' : branch.type === 'tags' ? 'tags' : 'text';
73
- return { column: branch.alias, type, conditions: [{ op: 'is_empty', value: null }] };
74
- }
75
- if (branch.type === 'boolean') {
76
- return { column: branch.alias, type: 'boolean', conditions: [{ op: 'eq', value: value === 'true' }] };
77
- }
78
- if (branch.type === 'tags') {
79
- return { column: branch.alias, type: 'tags', conditions: [{ op: 'has_tag', value }] };
80
- }
81
- return { column: branch.alias, type: 'select', conditions: [{ op: 'eq', value }] };
82
- }
@@ -1,3 +0,0 @@
1
- export declare const ROLES_ALLOWED_TO_EDIT_LAYOUT: ReadonlyArray<string>;
2
- export declare function canEditLayout(role: string | undefined | null): boolean;
3
- //# sourceMappingURL=layout-permissions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"layout-permissions.d.ts","sourceRoot":"","sources":["../src/layout-permissions.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,4BAA4B,EAAE,aAAa,CAAC,MAAM,CAAa,CAAA;AAE5E,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAGtE"}
@@ -1,11 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- // Copyright (c) 2024–2026 Flavio De Musso
3
- // NOTE: change this list to extend write-access to other roles
4
- // (e.g. add 'editor', or introduce a fine-grained 'layout:edit' permission).
5
- // Single source of truth — used by both API guards and dashboard buttons.
6
- export const ROLES_ALLOWED_TO_EDIT_LAYOUT = ['admin'];
7
- export function canEditLayout(role) {
8
- if (!role)
9
- return false;
10
- return ROLES_ALLOWED_TO_EDIT_LAYOUT.includes(role);
11
- }
@@ -1,61 +0,0 @@
1
- /**
2
- * MediaRepository - Interface for tracking media assets in the database.
3
- */
4
- export interface MediaObject {
5
- key: string;
6
- filename: string;
7
- mime_type: string;
8
- size_bytes: number;
9
- uploaded_by: string;
10
- created_at: number;
11
- }
12
- export interface MediaRepository {
13
- /**
14
- * Tracks a new file upload in the database.
15
- */
16
- trackUpload(media: Omit<MediaObject, 'created_at'>): Promise<void>;
17
- /**
18
- * Retrieves tracking info for a file by its key.
19
- */
20
- getByKey(key: string): Promise<MediaObject | null>;
21
- /**
22
- * Removes tracking info for a file.
23
- */
24
- untrack(key: string): Promise<void>;
25
- /**
26
- * Lists all tracked media with pagination.
27
- */
28
- list(options: {
29
- limit: number;
30
- offset: number;
31
- }): Promise<{
32
- items: MediaObject[];
33
- total: number;
34
- }>;
35
- /**
36
- * Gets the total number of tracked media objects.
37
- */
38
- count(): Promise<number>;
39
- }
40
- /**
41
- * SystemStatsRepository - Interface for managing global system metrics.
42
- */
43
- export interface SystemStatsRepository {
44
- /**
45
- * Increments the total storage counter.
46
- */
47
- incrementStorage(bytes: number): Promise<void>;
48
- /**
49
- * Decrements the total storage counter.
50
- */
51
- decrementStorage(bytes: number): Promise<void>;
52
- /**
53
- * Sets a specific value for a storage stat (e.g. after a full sync).
54
- */
55
- setStorage(bytes: number): Promise<void>;
56
- /**
57
- * Gets the current total storage usage in bytes.
58
- */
59
- getStorageUsage(): Promise<number>;
60
- }
61
- //# sourceMappingURL=media.repository.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"media.repository.d.ts","sourceRoot":"","sources":["../src/media.repository.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnE;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAEnD;;OAEG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpC;;OAEG;IACH,IAAI,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,WAAW,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAEnG;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE/C;;OAEG;IACH,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE/C;;OAEG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzC;;OAEG;IACH,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACpC"}
@@ -1,3 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- // Copyright (c) 2024–2026 Flavio De Musso
3
- export {};
@@ -1,10 +0,0 @@
1
- import type { Branch } from './types.js';
2
- export declare function sha256hex(value: string): Promise<string>;
3
- export declare function verifyHashField(stored: string, candidate: string): Promise<boolean>;
4
- /**
5
- * Risolve le policy di un branch applicando i valori di default.
6
- * Tutta la logica di accesso ai campi deve passare per questa funzione,
7
- * mai con inline `branch.policies?.x ?? default`.
8
- */
9
- export declare function resolvePolicies(branch: Branch): Required<NonNullable<Branch['policies']>>;
10
- //# sourceMappingURL=policies.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"policies.d.ts","sourceRoot":"","sources":["../src/policies.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAExC,wBAAsB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAK9D;AAED,wBAAsB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAEzF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAgBzF"}
package/dist/policies.js DELETED
@@ -1,33 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- // Copyright (c) 2024–2026 Flavio De Musso
3
- export async function sha256hex(value) {
4
- const buf = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(value));
5
- return Array.from(new Uint8Array(buf))
6
- .map((b) => b.toString(16).padStart(2, '0'))
7
- .join('');
8
- }
9
- export async function verifyHashField(stored, candidate) {
10
- return stored === (await sha256hex(candidate));
11
- }
12
- /**
13
- * Risolve le policy di un branch applicando i valori di default.
14
- * Tutta la logica di accesso ai campi deve passare per questa funzione,
15
- * mai con inline `branch.policies?.x ?? default`.
16
- */
17
- export function resolvePolicies(branch) {
18
- const privacy = branch.policies?.privacy ?? 'plain';
19
- // Non-plain privacy implies hidden by default: the CMS hashes/encrypts on write,
20
- // so returning the stored value would leak the digest to readers.
21
- const defaultVisibility = privacy !== 'plain' ? 'hidden' : 'full';
22
- // Repeaters live in a single JSON column — never filterable, sortable, or
23
- // searchable/facetable in v1, regardless of what's set on the branch.
24
- const isRepeater = branch.type === 'repeater';
25
- return {
26
- privacy,
27
- visibility: branch.policies?.visibility ?? defaultVisibility,
28
- search: isRepeater ? false : branch.policies?.search ?? true,
29
- filter: isRepeater ? false : branch.policies?.filter ?? true,
30
- sort: isRepeater ? false : branch.policies?.sort ?? true,
31
- public: branch.policies?.public ?? true,
32
- };
33
- }
@@ -1,39 +0,0 @@
1
- import type { ContentRepository } from './content.repository.js';
2
- import type { BeechBucket } from './storage.js';
3
- import type { IClock } from './clock.js';
4
- import type { IIdGenerator } from './id-generator.js';
5
- /**
6
- * The envelope put on the wire / queue. `name` selects the handler from the
7
- * JobRegistry; `payload` is the developer-supplied, JSON-serializable body.
8
- */
9
- export interface QueueMessage<T = unknown> {
10
- name: string;
11
- payload: T;
12
- }
13
- /**
14
- * Execution context handed to every job. Botanical Invariant: jobs receive the
15
- * engine-mediated repository, NEVER a raw D1Database. `env` is a read-only,
16
- * stringly-typed view of bindings/secrets for things like fetch targets — it
17
- * deliberately does not expose `DB`.
18
- */
19
- export interface JobContext {
20
- repository: ContentRepository;
21
- bucket: BeechBucket;
22
- clock: IClock;
23
- idGenerator: IIdGenerator;
24
- env: Record<string, string | undefined>;
25
- }
26
- /** A single background worker. Receives the decoded payload + context. */
27
- export type JobHandler<T = unknown> = (payload: T, context: JobContext) => Promise<void>;
28
- /** Name -> handler map, supplied via BeechConfig.jobs. */
29
- export type JobRegistry = Record<string, JobHandler<any>>;
30
- /**
31
- * Producer port. `enqueue` schedules deferred work and returns once the message
32
- * is accepted by the transport. Like INotificationService, implementations MUST
33
- * decide their own fire-and-forget vs inline semantics and MUST NOT let a
34
- * transport failure crash the request that called enqueue.
35
- */
36
- export interface IQueueService {
37
- enqueue<T>(name: string, payload: T): Promise<void>;
38
- }
39
- //# sourceMappingURL=queue.interface.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"queue.interface.d.ts","sourceRoot":"","sources":["../src/queue.interface.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD;;;GAGG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,OAAO;IACvC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,CAAC,CAAA;CACX;AAED;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,iBAAiB,CAAA;IAC7B,MAAM,EAAE,WAAW,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,YAAY,CAAA;IACzB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;CACxC;AAED,0EAA0E;AAC1E,MAAM,MAAM,UAAU,CAAC,CAAC,GAAG,OAAO,IAAI,CACpC,OAAO,EAAE,CAAC,EACV,OAAO,EAAE,UAAU,KAChB,OAAO,CAAC,IAAI,CAAC,CAAA;AAElB,0DAA0D;AAC1D,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAA;AAEzD;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACpD"}
@@ -1,3 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- // Copyright (c) 2024–2026 Flavio De Musso
3
- export {};
@@ -1,6 +0,0 @@
1
- import type { IQueueService } from './queue.interface.js';
2
- /** Safe no-op producer (e.g. unit tests that don't assert on enqueue). */
3
- export declare class NoOpQueueService implements IQueueService {
4
- enqueue<T>(_name: string, _payload: T): Promise<void>;
5
- }
6
- //# sourceMappingURL=queue.stub.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"queue.stub.d.ts","sourceRoot":"","sources":["../src/queue.stub.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEzD,0EAA0E;AAC1E,qBAAa,gBAAiB,YAAW,aAAa;IAC9C,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAG5D"}
@@ -1,8 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- // Copyright (c) 2024–2026 Flavio De Musso
3
- /** Safe no-op producer (e.g. unit tests that don't assert on enqueue). */
4
- export class NoOpQueueService {
5
- async enqueue(_name, _payload) {
6
- // intentionally empty
7
- }
8
- }