@fieldia/core 0.21.0 → 0.23.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 (127) hide show
  1. package/README.md +116 -1
  2. package/package.json +1 -1
  3. package/schema/page.schema.json +149 -1
  4. package/src/index.d.mts +2 -2
  5. package/src/index.d.ts +2 -2
  6. package/src/index.js +3 -1
  7. package/src/index.js.map +1 -1
  8. package/src/index.mjs +2 -2
  9. package/src/index.mjs.map +1 -1
  10. package/src/lib/format/check-page.d.mts +3 -2
  11. package/src/lib/format/check-page.d.ts +3 -2
  12. package/src/lib/format/check-page.js +9 -4
  13. package/src/lib/format/check-page.js.map +1 -1
  14. package/src/lib/format/check-page.mjs +10 -5
  15. package/src/lib/format/check-page.mjs.map +1 -1
  16. package/src/lib/format/field.d.mts +85 -0
  17. package/src/lib/format/field.d.ts +85 -0
  18. package/src/lib/format/field.js +14 -1
  19. package/src/lib/format/field.js.map +1 -1
  20. package/src/lib/format/field.mjs +13 -0
  21. package/src/lib/format/field.mjs.map +1 -1
  22. package/src/lib/format/layout.d.mts +142 -17
  23. package/src/lib/format/layout.d.ts +142 -17
  24. package/src/lib/format/layout.js +18 -1
  25. package/src/lib/format/layout.js.map +1 -1
  26. package/src/lib/format/layout.mjs +17 -0
  27. package/src/lib/format/layout.mjs.map +1 -1
  28. package/src/lib/format/layout.types.d.mts +6 -2
  29. package/src/lib/format/layout.types.d.ts +6 -2
  30. package/src/lib/format/page.d.mts +69 -10
  31. package/src/lib/format/page.d.ts +69 -10
  32. package/src/lib/format/page.js +4 -1
  33. package/src/lib/format/page.js.map +1 -1
  34. package/src/lib/format/page.mjs +5 -2
  35. package/src/lib/format/page.mjs.map +1 -1
  36. package/src/lib/format/references.d.mts +7 -0
  37. package/src/lib/format/references.d.ts +7 -0
  38. package/src/lib/format/references.js +46 -0
  39. package/src/lib/format/references.js.map +1 -1
  40. package/src/lib/format/references.mjs +46 -0
  41. package/src/lib/format/references.mjs.map +1 -1
  42. package/src/lib/format/translate.js +3 -2
  43. package/src/lib/format/translate.js.map +1 -1
  44. package/src/lib/format/translate.mjs +3 -2
  45. package/src/lib/format/translate.mjs.map +1 -1
  46. package/src/lib/format/upgrade.d.mts +41 -0
  47. package/src/lib/format/upgrade.d.ts +41 -0
  48. package/src/lib/format/upgrade.js +41 -0
  49. package/src/lib/format/upgrade.js.map +1 -0
  50. package/src/lib/format/upgrade.mjs +37 -0
  51. package/src/lib/format/upgrade.mjs.map +1 -0
  52. package/src/lib/format/validate.d.mts +2 -1
  53. package/src/lib/format/validate.d.ts +2 -1
  54. package/src/lib/format/validate.js +4 -2
  55. package/src/lib/format/validate.js.map +1 -1
  56. package/src/lib/format/validate.mjs +4 -2
  57. package/src/lib/format/validate.mjs.map +1 -1
  58. package/src/lib/format/version.d.mts +16 -1
  59. package/src/lib/format/version.d.ts +16 -1
  60. package/src/lib/format/version.js +39 -2
  61. package/src/lib/format/version.js.map +1 -1
  62. package/src/lib/format/version.mjs +36 -1
  63. package/src/lib/format/version.mjs.map +1 -1
  64. package/src/lib/record/data-source.d.mts +224 -10
  65. package/src/lib/record/data-source.d.ts +224 -10
  66. package/src/lib/record/data-source.js +29 -0
  67. package/src/lib/record/data-source.js.map +1 -1
  68. package/src/lib/record/data-source.mjs +25 -0
  69. package/src/lib/record/data-source.mjs.map +1 -1
  70. package/src/lib/record/form.d.mts +144 -5
  71. package/src/lib/record/form.d.ts +144 -5
  72. package/src/lib/record/form.js +792 -42
  73. package/src/lib/record/form.js.map +1 -1
  74. package/src/lib/record/form.mjs +791 -43
  75. package/src/lib/record/form.mjs.map +1 -1
  76. package/src/lib/record/locales/ar.js +10 -0
  77. package/src/lib/record/locales/ar.js.map +1 -1
  78. package/src/lib/record/locales/ar.mjs +10 -0
  79. package/src/lib/record/locales/ar.mjs.map +1 -1
  80. package/src/lib/record/locales/de.js +10 -0
  81. package/src/lib/record/locales/de.js.map +1 -1
  82. package/src/lib/record/locales/de.mjs +10 -0
  83. package/src/lib/record/locales/de.mjs.map +1 -1
  84. package/src/lib/record/locales/fr.js +10 -0
  85. package/src/lib/record/locales/fr.js.map +1 -1
  86. package/src/lib/record/locales/fr.mjs +10 -0
  87. package/src/lib/record/locales/fr.mjs.map +1 -1
  88. package/src/lib/record/memory-data-source.d.mts +40 -3
  89. package/src/lib/record/memory-data-source.d.ts +40 -3
  90. package/src/lib/record/memory-data-source.js +164 -20
  91. package/src/lib/record/memory-data-source.js.map +1 -1
  92. package/src/lib/record/memory-data-source.mjs +164 -20
  93. package/src/lib/record/memory-data-source.mjs.map +1 -1
  94. package/src/lib/record/messages.d.mts +21 -0
  95. package/src/lib/record/messages.d.ts +21 -0
  96. package/src/lib/record/messages.js +10 -0
  97. package/src/lib/record/messages.js.map +1 -1
  98. package/src/lib/record/messages.mjs +10 -0
  99. package/src/lib/record/messages.mjs.map +1 -1
  100. package/src/lib/record/run.d.mts +50 -7
  101. package/src/lib/record/run.d.ts +50 -7
  102. package/src/lib/record/run.js +67 -20
  103. package/src/lib/record/run.js.map +1 -1
  104. package/src/lib/record/run.mjs +67 -20
  105. package/src/lib/record/run.mjs.map +1 -1
  106. package/src/lib/record/upload-to.d.mts +50 -0
  107. package/src/lib/record/upload-to.d.ts +50 -0
  108. package/src/lib/record/upload-to.js +117 -0
  109. package/src/lib/record/upload-to.js.map +1 -0
  110. package/src/lib/record/upload-to.mjs +114 -0
  111. package/src/lib/record/upload-to.mjs.map +1 -0
  112. package/src/lib/record/uploads.d.mts +152 -0
  113. package/src/lib/record/uploads.d.ts +152 -0
  114. package/src/lib/record/uploads.js +345 -0
  115. package/src/lib/record/uploads.js.map +1 -0
  116. package/src/lib/record/uploads.mjs +337 -0
  117. package/src/lib/record/uploads.mjs.map +1 -0
  118. package/src/lib/record/values.d.mts +6 -0
  119. package/src/lib/record/values.d.ts +6 -0
  120. package/src/lib/record/values.js.map +1 -1
  121. package/src/lib/record/values.mjs.map +1 -1
  122. package/src/runtime.d.mts +10 -6
  123. package/src/runtime.d.ts +10 -6
  124. package/src/runtime.js +19 -2
  125. package/src/runtime.js.map +1 -1
  126. package/src/runtime.mjs +7 -3
  127. package/src/runtime.mjs.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/format/validate.ts"],"names":[],"mappings":";;AAeA,oCAQC;AAtBD,iCAA+C;AAC/C,6CAAmE;AAInE;;;;;;;;GAQG;AACH,SAAgB,YAAY,CAAC,KAAc;IACzC,MAAM,MAAM,GAAG,iBAAU,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC3C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IACjI,CAAC;IACD,MAAM,IAAI,GAAS,MAAM,CAAC,IAAI,CAAC;IAC/B,MAAM,MAAM,GAAG,IAAI,2BAAc,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC;IAC9C,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACpE,CAAC;AAED,SAAS,UAAU,CAAC,IAA4B;IAC9C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAC;IACvC,OAAO,IAAI;SACR,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,OA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AC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACpE,CAAC;AAED,SAAS,UAAU,CAAC,IAA4B;IAC9C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAC;IACvC,OAAO,IAAI;SACR,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;SACvH,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED,SAAS,QAAQ,CAAC,KAAuB;IACvC,IAAI,KAAK,CAAC,IAAI,KAAK,eAAe,IAAI,eAAe,IAAI,KAAK,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC;QACtF,OAAO,IAAI,KAAK,CAAC,aAAa,wCAAwC,CAAC;IACzE,CAAC;IACD,OAAO,KAAK,CAAC,OAAO,CAAC;AACvB,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { PageSchema } from './page.mjs';
2
+ import { upgradePage } from './upgrade.mjs';
2
3
  import { ReferenceCheck } from './references.mjs';
3
4
  /**
4
5
  * Check a page in two passes: its shape against the format, then every
@@ -7,10 +8,11 @@ import { ReferenceCheck } from './references.mjs';
7
8
  * readable and reading only fields of this page.
8
9
  *
9
10
  * Returns the page as validated. Nothing is coerced or filled in: a page that
10
- * passes is returned equal to the input.
11
+ * passes is returned equal to the input — one in an older format, brought up to
12
+ * date first (`upgradePage`), as every reader of it does.
11
13
  */
12
14
  export function validatePage(input) {
13
- const parsed = PageSchema.safeParse(input);
15
+ const parsed = PageSchema.safeParse(upgradePage(input));
14
16
  if (!parsed.success) {
15
17
  return { ok: false, issues: parsed.error.issues.map((issue) => ({ path: formatPath(issue.path), message: describe(issue) })) };
16
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"validate.mjs","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/format/validate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAa,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAuB,MAAM,cAAc,CAAC;AAInE;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,MAAM,MAAM,GAAG,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC3C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IACjI,CAAC;IACD,MAAM,IAAI,GAAS,MAAM,CAAC,IAAI,CAAC;IAC/B,MAAM,MAAM,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC;IAC9C,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACpE,CAAC;AAED,SAAS,UAAU,CAAC,IAA4B;IAC9C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAC;IACvC,OAAO,IAAI;SACR,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,OAAO,K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/B,MAAM,MAAM,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC;IAC9C,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACpE,CAAC;AAED,SAAS,UAAU,CAAC,IAA4B;IAC9C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAC;IACvC,OAAO,IAAI;SACR,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;SACvH,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED,SAAS,QAAQ,CAAC,KAAuB;IACvC,IAAI,KAAK,CAAC,IAAI,KAAK,eAAe,IAAI,eAAe,IAAI,KAAK,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC;QACtF,OAAO,IAAI,KAAK,CAAC,aAAa,wCAAwC,CAAC;IACzE,CAAC;IACD,OAAO,KAAK,CAAC,OAAO,CAAC;AACvB,CAAC"}
@@ -1,2 +1,17 @@
1
1
  /** The page format version this build reads and writes. */
2
- export declare const FORMAT_VERSION: "0.1";
2
+ export declare const FORMAT_VERSION: "0.2";
3
+ /**
4
+ * Every format Fieldia has had, oldest first; the last is FORMAT_VERSION. A page in an older one is brought up to date
5
+ * by `upgradePage`, step by step (`PAGE_UPGRADES`), wherever it is read: `checkPage`, `validatePage`, the viewer, the
6
+ * designer. A release that changes what a page may say adds its version here (see the format's docs, "Versions").
7
+ */
8
+ export declare const FORMAT_VERSIONS: readonly ["0.1", "0.2"];
9
+ /** A format Fieldia has had: a page may say any of them, and is read in the current one. */
10
+ export type FormatVersion = (typeof FORMAT_VERSIONS)[number];
11
+ /** Which of two format versions is newer: below 0 when `a` is older, 0 when they are the same, null when either is not a version. */
12
+ export declare function compareFormats(a: unknown, b: unknown): number | null;
13
+ /**
14
+ * What is wrong with a page's `fieldia`, in words, or null when it is the current format. A page newer than this
15
+ * build says to update Fieldia; an older one, that `upgradePage` brings it up to date (the checks do that themselves).
16
+ */
17
+ export declare function formatProblem(version: unknown, versions?: readonly string[]): string | null;
@@ -1,2 +1,17 @@
1
1
  /** The page format version this build reads and writes. */
2
- export declare const FORMAT_VERSION: "0.1";
2
+ export declare const FORMAT_VERSION: "0.2";
3
+ /**
4
+ * Every format Fieldia has had, oldest first; the last is FORMAT_VERSION. A page in an older one is brought up to date
5
+ * by `upgradePage`, step by step (`PAGE_UPGRADES`), wherever it is read: `checkPage`, `validatePage`, the viewer, the
6
+ * designer. A release that changes what a page may say adds its version here (see the format's docs, "Versions").
7
+ */
8
+ export declare const FORMAT_VERSIONS: readonly ["0.1", "0.2"];
9
+ /** A format Fieldia has had: a page may say any of them, and is read in the current one. */
10
+ export type FormatVersion = (typeof FORMAT_VERSIONS)[number];
11
+ /** Which of two format versions is newer: below 0 when `a` is older, 0 when they are the same, null when either is not a version. */
12
+ export declare function compareFormats(a: unknown, b: unknown): number | null;
13
+ /**
14
+ * What is wrong with a page's `fieldia`, in words, or null when it is the current format. A page newer than this
15
+ * build says to update Fieldia; an older one, that `upgradePage` brings it up to date (the checks do that themselves).
16
+ */
17
+ export declare function formatProblem(version: unknown, versions?: readonly string[]): string | null;
@@ -1,6 +1,43 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FORMAT_VERSION = void 0;
3
+ exports.FORMAT_VERSIONS = exports.FORMAT_VERSION = void 0;
4
+ exports.compareFormats = compareFormats;
5
+ exports.formatProblem = formatProblem;
4
6
  /** The page format version this build reads and writes. */
5
- exports.FORMAT_VERSION = '0.1';
7
+ exports.FORMAT_VERSION = '0.2';
8
+ /**
9
+ * Every format Fieldia has had, oldest first; the last is FORMAT_VERSION. A page in an older one is brought up to date
10
+ * by `upgradePage`, step by step (`PAGE_UPGRADES`), wherever it is read: `checkPage`, `validatePage`, the viewer, the
11
+ * designer. A release that changes what a page may say adds its version here (see the format's docs, "Versions").
12
+ */
13
+ exports.FORMAT_VERSIONS = ['0.1', '0.2'];
14
+ /** `major.minor` as two numbers, or null when it is not a version at all. */
15
+ function parts(version) {
16
+ const match = typeof version === 'string' ? /^(\d+)\.(\d+)$/.exec(version) : null;
17
+ return match ? [Number(match[1]), Number(match[2])] : null;
18
+ }
19
+ /** Which of two format versions is newer: below 0 when `a` is older, 0 when they are the same, null when either is not a version. */
20
+ function compareFormats(a, b) {
21
+ const [x, y] = [parts(a), parts(b)];
22
+ if (!x || !y)
23
+ return null;
24
+ return x[0] - y[0] || x[1] - y[1];
25
+ }
26
+ /**
27
+ * What is wrong with a page's `fieldia`, in words, or null when it is the current format. A page newer than this
28
+ * build says to update Fieldia; an older one, that `upgradePage` brings it up to date (the checks do that themselves).
29
+ */
30
+ function formatProblem(version, versions = exports.FORMAT_VERSIONS) {
31
+ const current = versions[versions.length - 1];
32
+ if (version === current)
33
+ return null;
34
+ const compared = compareFormats(version, current);
35
+ if (compared === null)
36
+ return `"fieldia" says which format the page is written in: "${current}" for this Fieldia`;
37
+ if (compared > 0)
38
+ return `this page is in format ${version}, newer than this Fieldia reads (${current}): update Fieldia to show it`;
39
+ if (versions.includes(version))
40
+ return `this page is in format ${version}: upgradePage(page) brings it to ${current}`;
41
+ return `format ${version} is not one Fieldia has had: this Fieldia reads ${current}`;
42
+ }
6
43
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/format/version.ts"],"names":[],"mappings":";;;AAAA,2DAA2D;AAC9C,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rC,MAAM,QAAQ,GAAG,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAClD,IAAI,QAAQ,KAAK,IAAI;QAAE,OAAO,wDAAwD,OAAO,oBAAoB,CAAC;IAClH,IAAI,QAAQ,GAAG,CAAC;QAAE,OAAO,0BAA0B,OAAiB,oCAAoC,OAAO,8BAA8B,CAAC;IAC9I,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAiB,CAAC;QAAE,OAAO,0BAA0B,OAAiB,oCAAoC,OAAO,EAAE,CAAC;IAC1I,OAAO,UAAU,OAAiB,mDAAmD,OAAO,EAAE,CAAC;AACjG,CAAC"}
@@ -1,3 +1,38 @@
1
1
  /** The page format version this build reads and writes. */
2
- export const FORMAT_VERSION = '0.1';
2
+ export const FORMAT_VERSION = '0.2';
3
+ /**
4
+ * Every format Fieldia has had, oldest first; the last is FORMAT_VERSION. A page in an older one is brought up to date
5
+ * by `upgradePage`, step by step (`PAGE_UPGRADES`), wherever it is read: `checkPage`, `validatePage`, the viewer, the
6
+ * designer. A release that changes what a page may say adds its version here (see the format's docs, "Versions").
7
+ */
8
+ export const FORMAT_VERSIONS = ['0.1', '0.2'];
9
+ /** `major.minor` as two numbers, or null when it is not a version at all. */
10
+ function parts(version) {
11
+ const match = typeof version === 'string' ? /^(\d+)\.(\d+)$/.exec(version) : null;
12
+ return match ? [Number(match[1]), Number(match[2])] : null;
13
+ }
14
+ /** Which of two format versions is newer: below 0 when `a` is older, 0 when they are the same, null when either is not a version. */
15
+ export function compareFormats(a, b) {
16
+ const [x, y] = [parts(a), parts(b)];
17
+ if (!x || !y)
18
+ return null;
19
+ return x[0] - y[0] || x[1] - y[1];
20
+ }
21
+ /**
22
+ * What is wrong with a page's `fieldia`, in words, or null when it is the current format. A page newer than this
23
+ * build says to update Fieldia; an older one, that `upgradePage` brings it up to date (the checks do that themselves).
24
+ */
25
+ export function formatProblem(version, versions = FORMAT_VERSIONS) {
26
+ const current = versions[versions.length - 1];
27
+ if (version === current)
28
+ return null;
29
+ const compared = compareFormats(version, current);
30
+ if (compared === null)
31
+ return `"fieldia" says which format the page is written in: "${current}" for this Fieldia`;
32
+ if (compared > 0)
33
+ return `this page is in format ${version}, newer than this Fieldia reads (${current}): update Fieldia to show it`;
34
+ if (versions.includes(version))
35
+ return `this page is in format ${version}: upgradePage(page) brings it to ${current}`;
36
+ return `format ${version} is not one Fieldia has had: this Fieldia reads ${current}`;
37
+ }
3
38
  //# sourceMappingURL=version.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.mjs","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/format/version.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,MAAM,CAAC,MAAM,cAAc,GAAG,KAAc,CAAC"}
1
+ {"version":3,"file":"version.mjs","sourceRoot":"","sources":["../../../../../../libs/core/src/lib/format/version.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,MAAM,CAAC,MAAM,cAAc,GAAG,KAAc,CAAC;AAE7C;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,KAAK,CAAsC,CAAC;AAKnF,6EAA6E;AAC7E,SAAS,KAAK,CAAC,OAAgB;IAC7B,MAAM,KAAK,GAAG,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAClF,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7D,CAAC;AAED,qIAAqI;AACrI,MAAM,UAAU,cAAc,CAAC,CAAU,EAAE,CAAU;IACnD,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1B,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACpC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,OAAgB,EAAE,WAA8B,eAAe;IAC3F,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC9C,IAAI,OAAO,KAAK,OAAO;QAAE,OAAO,IAAI,CAAC;IACrC,MAAM,QAAQ,GAAG,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAClD,IAAI,QAAQ,KAAK,IAAI;QAAE,OAAO,wDAAwD,OAAO,oBAAoB,CAAC;IAClH,IAAI,QAAQ,GAAG,CAAC;QAAE,OAAO,0BAA0B,OAAiB,oCAAoC,OAAO,8BAA8B,CAAC;IAC9I,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAiB,CAAC;QAAE,OAAO,0BAA0B,OAAiB,oCAAoC,OAAO,EAAE,CAAC;IAC1I,OAAO,UAAU,OAAiB,mDAAmD,OAAO,EAAE,CAAC;AACjG,CAAC"}
@@ -8,9 +8,18 @@ import type { RunStop } from './run.mjs';
8
8
  * and every method is optional so a page uses only what it needs.
9
9
  */
10
10
  export interface DataSource {
11
- /** Read a record. Needed to edit an existing record. */
12
- load?(request: LoadRequest): Promise<Values>;
13
- /** Create (`id: null`) or update a record. Needed to save a record page. */
11
+ /**
12
+ * Read a record. Needed to edit an existing record. Its values, or
13
+ * `loadedRecord(values, { version, can })` to tell also its version — so a
14
+ * save can tell that someone else changed it since — and what this person
15
+ * may do with it. `loadedRecordOf` reads either the same way.
16
+ */
17
+ load?(request: LoadRequest): Promise<Values | LoadedRecord>;
18
+ /**
19
+ * Create (`id: null`) or update a record. Needed to save a record page. A
20
+ * source that keeps versions compares `request.version` with the record's
21
+ * and throws a `ConflictError` when someone else saved it since.
22
+ */
14
23
  save?(request: SaveRequest): Promise<SaveResult>;
15
24
  /** Recalculate after a value changes, the way a backend's onchange does. */
16
25
  onchange?(request: OnchangeRequest): Promise<OnchangeResult>;
@@ -20,7 +29,7 @@ export interface DataSource {
20
29
  create?(request: CreateRequest): Promise<RelatedRecord>;
21
30
  /** Store one response to a `responses` page, such as a survey. */
22
31
  submit?(request: SubmitRequest): Promise<SubmitResult>;
23
- /** Records for a list: filtered, sorted and one page of them, with how many there are in all. */
32
+ /** Records for a list: filtered, sorted and one page of them, with how many there are in all; with `allIds`, the ids of every one that matches. */
24
33
  list?(request: ListRequest): Promise<ListResult>;
25
34
  /** How many records fall under each value of a field, for a list's Group By. */
26
35
  groups?(request: GroupRequest): Promise<Group[]>;
@@ -43,7 +52,76 @@ export interface DataSource {
43
52
  * preview: each a file with its `url` (or its `data`) and its media type.
44
53
  */
45
54
  attachments?(request: RecordRequest): Promise<FileValue[]>;
55
+ /**
56
+ * Totals over the records a search finds — each field's sum, average,
57
+ * least, most or count — over them all and, with `groupBy`, under each
58
+ * value of a field: the row under a list and the sums on its Group By
59
+ * headings. Without it, a list shows no totals.
60
+ */
61
+ totals?(request: TotalsRequest): Promise<TotalsResult>;
62
+ /**
63
+ * Store one file where the app keeps files, as soon as it is picked, for a
64
+ * file or picture field: the record then keeps only its link. Without it,
65
+ * a file travels inside the record as base64, as it always has. To fail,
66
+ * throw: the field offers Retry, except after `saveRefused({ kind: 'rule',
67
+ * message })`, which says the store refuses this file (its kind, its
68
+ * size) and is shown as it is.
69
+ */
70
+ upload?(file: UploadFile, request: UploadRequest): Promise<UploadedFile>;
71
+ }
72
+ /**
73
+ * Which state of a record a page opened, as its source keeps it: an etag, a
74
+ * write date, a revision number — Fieldia only hands `token` back — with who
75
+ * changed the record last and when, for the words a conflict shows ("Mona
76
+ * changed this at 10:42").
77
+ */
78
+ export interface RecordVersion {
79
+ token: string;
80
+ /** Who changed it last, by the name people know them by. */
81
+ by?: string;
82
+ /** When, as an ISO date and time: `2026-10-13T10:42:00Z`. */
83
+ at?: string;
84
+ }
85
+ /**
86
+ * What this person may do with one record. Each is allowed unless it says
87
+ * `false`, so a source that tells nothing keeps today's behaviour. The page
88
+ * hides what is not allowed — never shows it disabled — and says why.
89
+ */
90
+ export interface RecordPermissions {
91
+ /** False: the form is read-only for this person, and Save is hidden. */
92
+ edit?: boolean;
93
+ /** False: Delete is hidden, and the `delete` step's buttons. */
94
+ delete?: boolean;
95
+ /** False: Archive and Unarchive are hidden, and those steps' buttons. */
96
+ archive?: boolean;
97
+ /** False: Duplicate is hidden, and the `duplicate` step's buttons. */
98
+ duplicate?: boolean;
99
+ /** Fields this person may see but not change on this record, by name. */
100
+ readonlyFields?: string[];
101
+ /** Fields this person may not see on this record, by name: hidden, and the source leaves their values out. */
102
+ hiddenFields?: string[];
103
+ /** Why not everything is allowed, in the person's language, for the page to say: "Only Mona, the lead's agent, can change it." */
104
+ reason?: string;
46
105
  }
106
+ /**
107
+ * A record as `load` gives it to tell more than its values. A field cannot
108
+ * be named `$loaded`, so the mark keeps it apart from bare values.
109
+ */
110
+ export interface LoadedRecord {
111
+ $loaded: true;
112
+ values: Values;
113
+ /** The version it was read at: each save carries it back. */
114
+ version?: RecordVersion;
115
+ /** What this person may do with it. */
116
+ can?: RecordPermissions;
117
+ }
118
+ /** What `load` returns to tell a record's version, or what this person may do with it, beside its values. */
119
+ export declare function loadedRecord(values: Values, more?: {
120
+ version?: RecordVersion;
121
+ can?: RecordPermissions;
122
+ }): LoadedRecord;
123
+ /** What a load gave, in one shape: bare values, as every source gave them before, are a record with nothing more to tell. */
124
+ export declare function loadedRecordOf(loaded: Values | LoadedRecord): LoadedRecord;
47
125
  /** One stored record, by its model and id. */
48
126
  export interface RecordRequest {
49
127
  model: string;
@@ -83,11 +161,31 @@ export interface SaveRequest {
83
161
  changes: RecordChanges;
84
162
  /** Every value, for sources that save whole records. */
85
163
  values: Values;
164
+ /**
165
+ * True when the save carries some of the record's fields, not all of it:
166
+ * `values` then holds the fields in `changes` alone and `fields` names
167
+ * them alone — a save from outside a form, which never had the rest, as a
168
+ * calendar's move and its Undo. A source that saves whole records writes
169
+ * these over the record as stored and keeps every other field.
170
+ */
171
+ partial?: boolean;
172
+ /**
173
+ * The version the record was opened at — from its load, or from the last
174
+ * save — for a source that refuses a save over someone else's. None for a
175
+ * new record, nor from a source that tells no versions. "Keep mine" after
176
+ * a conflict saves again with the conflict's `version`: these changes over
177
+ * the record as it is now.
178
+ */
179
+ version?: RecordVersion;
86
180
  }
87
181
  export interface SaveResult {
88
182
  id: RecordId;
89
183
  /** The record as stored, when the source recalculated anything. */
90
184
  values?: Values;
185
+ /** Its version now, for the next save to carry. */
186
+ version?: RecordVersion;
187
+ /** What the person may do with it now, when the save changed that (a stage that locks it). */
188
+ can?: RecordPermissions;
91
189
  }
92
190
  export interface OnchangeRequest {
93
191
  model: string;
@@ -137,14 +235,28 @@ export interface ListRequest {
137
235
  sort: SortOrder[];
138
236
  offset: number;
139
237
  limit: number;
238
+ /**
239
+ * Give also the id of every record that matches, in this order, in
240
+ * `ListResult.allIds`: for "Select all 1,284 that match", export and bulk
241
+ * edit. A source that leaves it out is paged through instead.
242
+ */
243
+ allIds?: boolean;
140
244
  }
141
245
  export interface ListResult {
142
- records: {
143
- id: RecordId;
144
- values: Values;
145
- }[];
246
+ records: ListedRecord[];
146
247
  /** How many records match in all, for the pager. */
147
248
  total: number;
249
+ /** With `allIds`: every matching record's id. Fewer than `total` means the source stopped short, and the page says so. */
250
+ allIds?: RecordId[];
251
+ }
252
+ /** One row of a list. */
253
+ export interface ListedRecord {
254
+ id: RecordId;
255
+ values: Values;
256
+ /** Its version, for a bulk edit that saves it to carry. */
257
+ version?: RecordVersion;
258
+ /** What the person may do with it: its row's buttons and a bulk edit keep to it. */
259
+ can?: RecordPermissions;
148
260
  }
149
261
  export interface GroupRequest {
150
262
  model: string;
@@ -157,6 +269,82 @@ export interface Group {
157
269
  label: string;
158
270
  count: number;
159
271
  }
272
+ /** How a field is totalled: added up, averaged, its least or its most, or how many records hold a value in it. */
273
+ export type TotalKind = 'sum' | 'avg' | 'min' | 'max' | 'count';
274
+ export interface TotalsRequest {
275
+ model: string;
276
+ /** The list's search, as `list` gets it. For the ticked rows alone, add `{ field: 'id', op: 'in', value: ids }`. */
277
+ filter: ResolvedFilter[];
278
+ /** What to total, by field: `{ amount: ['sum'], hours: ['sum', 'avg'] }`. */
279
+ totals: Record<string, TotalKind[]>;
280
+ /** Total under each value of this field as well, grouped as `groups` groups it: a Group By heading's sums. */
281
+ groupBy?: string;
282
+ }
283
+ /**
284
+ * Each field's totals, by field and then by kind: `totals.amount.sum`. The
285
+ * sum and the count of nothing are 0, the others null. A total the source
286
+ * cannot make honestly — amounts in more than one currency — is null, and
287
+ * the page shows none.
288
+ */
289
+ export type Totals = Record<string, Partial<Record<TotalKind, number | null>>>;
290
+ export interface TotalsResult {
291
+ /** How many records match. */
292
+ count: number;
293
+ totals: Totals;
294
+ /** With `groupBy`: each value's totals, in the order `groups` gives them. */
295
+ groups?: TotalsGroup[];
296
+ }
297
+ export interface TotalsGroup extends Group {
298
+ totals: Totals;
299
+ }
300
+ /**
301
+ * A file to store: what an upload reads of a browser's `File`. Core names no
302
+ * DOM types; an adapter may type its parameter `File` and hand it to `fetch`
303
+ * or a storage SDK as it is.
304
+ */
305
+ export interface UploadFile {
306
+ readonly name: string;
307
+ readonly size: number;
308
+ readonly type: string;
309
+ arrayBuffer(): Promise<ArrayBuffer>;
310
+ }
311
+ /** An `AbortSignal`, as far as an upload listens to it. */
312
+ export interface UploadSignal {
313
+ readonly aborted: boolean;
314
+ addEventListener(type: 'abort', listener: () => void): void;
315
+ removeEventListener(type: 'abort', listener: () => void): void;
316
+ }
317
+ export interface UploadRequest {
318
+ /** The page's model: for a saved form placed in a record, the record's. */
319
+ model: string;
320
+ /**
321
+ * The file or picture field the file is for. In a saved form placed in a
322
+ * record, whose answers the record keeps under the part's name, the field's
323
+ * place in them: `consent.doc`, as a line's table is `consent.items`.
324
+ */
325
+ field: string;
326
+ /** The record it is for; null while that record is new — its first save links the file to it. */
327
+ recordId: RecordId | null;
328
+ /** For a field on a line of a table: the table's field, the line's key and, once saved, its id. */
329
+ line?: {
330
+ field: string;
331
+ key: string;
332
+ id?: RecordId;
333
+ };
334
+ /** Aborts when the person takes the file away or leaves before it is stored: stop, and reject with an error named `AbortError`. */
335
+ signal?: UploadSignal;
336
+ /** How far it has got, bytes sent of the bytes in all, for its progress bar; without a call the bar moves with no number. */
337
+ onProgress?: (sent: number, total: number) => void;
338
+ }
339
+ /** A stored file, as the field keeps it — a `FileValue` with its link instead of its bytes. */
340
+ export interface UploadedFile {
341
+ url: string;
342
+ name: string;
343
+ size: number;
344
+ type: string;
345
+ /** Its id, where the source keeps files as records of their own (Flectra's attachments): a save links it by this. */
346
+ fileId?: RecordId;
347
+ }
160
348
  /**
161
349
  * A filter as a search receives it: each `valueFrom` already replaced by its
162
350
  * value. An adapter must keep the groups: `any` is an OR, `all` an AND.
@@ -213,16 +401,42 @@ export type LinkOp = {
213
401
  /**
214
402
  * Why a save was refused, so each kind is shown where it belongs: `fields`
215
403
  * under those fields, a `rule` (a backend's business rule) in a dialog,
216
- * `network` in a banner with Retry, and `other` beside Save with Retry.
404
+ * `network` in a banner with Retry, `other` beside Save with Retry, and a
405
+ * `conflict` with Reload and Keep mine.
217
406
  */
218
407
  export interface SaveProblem {
219
408
  /** `stopped`: a step of the page's `beforeSave` stopped it, with `reason` — no data source was asked. */
220
- kind: 'fields' | 'rule' | 'network' | 'other' | 'stopped';
409
+ kind: 'fields' | 'rule' | 'network' | 'other' | 'stopped' | 'conflict';
221
410
  message: string;
222
411
  /** For `fields`: a message for each field, by name. */
223
412
  fields?: Record<string, string>;
224
413
  /** For `stopped`: why the step stopped. */
225
414
  reason?: RunStop;
415
+ /** For `conflict`: who changed the record, when, and what it holds now. */
416
+ conflict?: SaveConflict;
417
+ }
418
+ /** Someone else saved the record after this page opened it. */
419
+ export interface SaveConflict {
420
+ /** The version the record has now, with who changed it and when. Saving with it is "Keep mine". */
421
+ version: RecordVersion;
422
+ /**
423
+ * The record as the other person left it, when the source has it: what
424
+ * Reload shows without asking again, and what a source that saves whole
425
+ * records keeps of theirs under Keep mine — their values, with this
426
+ * person's changes over them.
427
+ */
428
+ theirs?: Values;
429
+ }
430
+ /**
431
+ * What a source's save throws when the record changed after the page opened
432
+ * it: `saveProblemOf` reads it as a `conflict`, and the page names who
433
+ * changed it and when (`conflict.version.by`, `.at`) and offers Reload or
434
+ * Keep mine.
435
+ */
436
+ export declare class ConflictError extends Error {
437
+ readonly conflict: SaveConflict;
438
+ readonly problem: SaveProblem;
439
+ constructor(conflict: SaveConflict, message?: string);
226
440
  }
227
441
  /** An error for a data source's save to throw when the backend refuses it. */
228
442
  export declare function saveRefused(problem: SaveProblem): Error & {