@dynamic-entity/server 2.4.0 → 2.5.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.
package/README.md CHANGED
@@ -278,6 +278,13 @@ will name their zip `.csv`.
278
278
  comma-separated, so Excel in those locales opens them as one column — offer `xlsx` there.
279
279
  - **`.xlsx`** — through `exceljs`. Cells keep their types: a date cell arrives as a `Date` at
280
280
  UTC midnight and is read as the calendar date it is, in every timezone.
281
+ - **Dates written as text.** `2026-09-05` is always read as written. A date in digits such as
282
+ `05/09/2026` reads two ways, so it is an error unless you say which: pass
283
+ `dateOrder: 'DMY'` (day first) or `'MDY'` (month first) to `createImportRouter` or
284
+ `runImport`. It is never guessed. Releases before 2.5.0 read it month first without
285
+ saying so; see the changelog if your sheets are day first. A preview response carries the
286
+ router's `dateOrder`, so the wizard reads its review the same way and refuses to commit if
287
+ it was told a different order.
281
288
  - A pre-2007 `.xls` and a UTF-16 file are **named** rather than parsed into nonsense.
282
289
 
283
290
  ---
package/express.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { EntityFormConfig, FormRule, ImportLookups } from '@dynamic-entity/core';
1
+ import { EntityFormConfig, FormRule, ImportLookups, DateOrder } from '@dynamic-entity/core';
2
2
  import { Request, Router, Response } from 'express';
3
- import { B as BatchInfo, I as ImportLimits, T as TemplateFormat } from './write-template-CzKVVjgT.mjs';
3
+ import { B as BatchInfo, I as ImportLimits, T as TemplateFormat } from './write-template-Dqu5b00D.mjs';
4
4
  import 'node:stream';
5
5
 
6
6
  /**
@@ -41,6 +41,12 @@ interface ImportRouterOptions {
41
41
  rules?: Record<string, readonly FormRule[]>;
42
42
  /** Values for every `listName` any config mentions. A server has no `LOOKUP_REGISTRY`. */
43
43
  lookups?: ImportLookups;
44
+ /**
45
+ * The order of a date written in digits, for every import and validation this router runs:
46
+ * `DMY` for day first, `MDY` for month first. Without it, a date that reads two ways
47
+ * (`05/09/2026`) fails its row. See `RunImportOptions.dateOrder`.
48
+ */
49
+ dateOrder?: DateOrder;
44
50
  /**
45
51
  * Where records go.
46
52
  *
package/express.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { EntityFormConfig, FormRule, ImportLookups } from '@dynamic-entity/core';
1
+ import { EntityFormConfig, FormRule, ImportLookups, DateOrder } from '@dynamic-entity/core';
2
2
  import { Request, Router, Response } from 'express';
3
- import { B as BatchInfo, I as ImportLimits, T as TemplateFormat } from './write-template-CzKVVjgT.js';
3
+ import { B as BatchInfo, I as ImportLimits, T as TemplateFormat } from './write-template-Dqu5b00D.js';
4
4
  import 'node:stream';
5
5
 
6
6
  /**
@@ -41,6 +41,12 @@ interface ImportRouterOptions {
41
41
  rules?: Record<string, readonly FormRule[]>;
42
42
  /** Values for every `listName` any config mentions. A server has no `LOOKUP_REGISTRY`. */
43
43
  lookups?: ImportLookups;
44
+ /**
45
+ * The order of a date written in digits, for every import and validation this router runs:
46
+ * `DMY` for day first, `MDY` for month first. Without it, a date that reads two ways
47
+ * (`05/09/2026`) fails its row. See `RunImportOptions.dateOrder`.
48
+ */
49
+ dateOrder?: DateOrder;
44
50
  /**
45
51
  * Where records go.
46
52
  *
package/express.js CHANGED
@@ -812,6 +812,7 @@ async function runImport(options) {
812
812
  const result = core.applyMapping(rows, plan, config, {
813
813
  lang: options.lang,
814
814
  decimal,
815
+ dateOrder: options.dateOrder,
815
816
  rules: options.rules,
816
817
  lookups: options.lookups,
817
818
  firstRowNumber: firstRow
@@ -1068,6 +1069,9 @@ function createImportRouter(options) {
1068
1069
  rowCount: preview.rowCount,
1069
1070
  arrayBound: preview.arrayBound,
1070
1071
  ...preview.delimiter ? { delimiter: preview.delimiter } : {},
1072
+ // The order every import through this router is read in, so the client reads its
1073
+ // sample the same way and can refuse to commit when it was told another.
1074
+ ...options.dateOrder ? { dateOrder: options.dateOrder } : {},
1071
1075
  engineVersion: core.CORE_VERSION
1072
1076
  };
1073
1077
  response.json(body);
@@ -1105,6 +1109,7 @@ function createImportRouter(options) {
1105
1109
  config,
1106
1110
  rules: routerOptions.rules && ownValue(routerOptions.rules, entity),
1107
1111
  lookups: routerOptions.lookups,
1112
+ dateOrder: routerOptions.dateOrder,
1108
1113
  lang: language(request),
1109
1114
  limits: resolved,
1110
1115
  onBatch: write && ((records, info) => write(records, info, entity, config))