@dialecte/core 0.1.2 → 0.1.3
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/dist/document/document.d.ts.map +1 -1
- package/dist/document/query/get/record/staged-lookup.d.ts.map +1 -1
- package/dist/document/query/get/tree/get-tree.d.ts.map +1 -1
- package/dist/document/transaction/create/create.d.ts.map +1 -1
- package/dist/document/transaction/delete/delete.d.ts.map +1 -1
- package/dist/document/transaction/stage-operations.d.ts.map +1 -1
- package/dist/document/transaction/update/update.d.ts.map +1 -1
- package/dist/errors/errors.d.ts +2 -2
- package/dist/errors/errors.d.ts.map +1 -1
- package/dist/helpers.js +12 -13
- package/dist/{index-B67NZSGJ.js → index-CqwLClK7.js} +26 -16
- package/dist/{index-CCEg5JAo.js → index-ni-jr0mc.js} +682 -705
- package/dist/index.js +2 -2
- package/dist/store/dexie-store.d.ts.map +1 -1
- package/dist/test-fixtures/index.d.ts +1 -0
- package/dist/test-fixtures/index.d.ts.map +1 -1
- package/dist/test-fixtures/test-record.d.ts +1609 -33
- package/dist/test-fixtures/test-record.d.ts.map +1 -1
- package/dist/test-fixtures/test-record.types.d.ts +8 -0
- package/dist/test-fixtures/test-record.types.d.ts.map +1 -0
- package/dist/test.js +26 -24
- package/dist/types/io.d.ts +14 -5
- package/dist/types/io.d.ts.map +1 -1
- package/dist/utils/assert.d.ts +2 -3
- package/dist/utils/assert.d.ts.map +1 -1
- package/dist/utils.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-record.d.ts","sourceRoot":"","sources":["../../src/test-fixtures/test-record.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"test-record.d.ts","sourceRoot":"","sources":["../../src/test-fixtures/test-record.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8B+D,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AnyDialecteConfig, ElementsOf, FullAttributeObjectOf, RawRecord, AttributesValueObjectOf } from '../types';
|
|
2
|
+
export type TestRecord<Config extends AnyDialecteConfig> = {
|
|
3
|
+
[E in ElementsOf<Config>]: {
|
|
4
|
+
tagName: E;
|
|
5
|
+
attributes?: AttributesValueObjectOf<Config, E> | FullAttributeObjectOf<Config, E>[];
|
|
6
|
+
} & Omit<Partial<RawRecord<Config, E>>, 'attributes'>;
|
|
7
|
+
}[ElementsOf<Config>];
|
|
8
|
+
//# sourceMappingURL=test-record.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-record.types.d.ts","sourceRoot":"","sources":["../../src/test-fixtures/test-record.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,iBAAiB,EACjB,UAAU,EACV,qBAAqB,EACrB,SAAS,EACT,uBAAuB,EACvB,MAAM,SAAS,CAAA;AAEhB,MAAM,MAAM,UAAU,CAAC,MAAM,SAAS,iBAAiB,IAAI;KACzD,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,GAAG;QAC1B,OAAO,EAAE,CAAC,CAAA;QACV,UAAU,CAAC,EAAE,uBAAuB,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,qBAAqB,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAA;KACpF,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC;CACrD,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAA"}
|
package/dist/test.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as uu, x as fu, D as hu, i as du, o as pu, e as mu } from "./index-
|
|
1
|
+
import { g as uu, x as fu, D as hu, i as du, o as pu, e as mu } from "./index-ni-jr0mc.js";
|
|
2
2
|
import { DIALECTE_DEV_NAMESPACE as gu, standardizeRecord as yu, toTreeRecord as bu, toTrackedRecord as wu } from "./helpers.js";
|
|
3
3
|
function Ha(e) {
|
|
4
4
|
const t = _u(e);
|
|
@@ -11813,7 +11813,7 @@ const Ve = {
|
|
|
11813
11813
|
uri: "http://dialecte.dev/XML/DEV-EXT",
|
|
11814
11814
|
prefix: "ext"
|
|
11815
11815
|
}
|
|
11816
|
-
},
|
|
11816
|
+
}, Tb = `xmlns="${Ve.default.uri}"`, vb = `xmlns:${Ve.dev.prefix}="${Ve.dev.uri}"`, xb = `xmlns:${Ve.ext.prefix}="${Ve.ext.uri}"`, ib = [
|
|
11817
11817
|
"A",
|
|
11818
11818
|
"AAAA_1",
|
|
11819
11819
|
"AAAA_2",
|
|
@@ -12302,7 +12302,7 @@ const bb = db(), wb = {
|
|
|
12302
12302
|
definition: bb,
|
|
12303
12303
|
hooks: {}
|
|
12304
12304
|
};
|
|
12305
|
-
async function
|
|
12305
|
+
async function $b(e) {
|
|
12306
12306
|
const { xmlString: t, dialecteConfig: n = lu } = e, r = `test-${crypto.randomUUID()}.xml`, o = new File([t], r, { type: "text/xml" }), i = (await du({
|
|
12307
12307
|
files: [o],
|
|
12308
12308
|
dialecteConfig: n,
|
|
@@ -12332,7 +12332,7 @@ async function xb(e) {
|
|
|
12332
12332
|
assertUnexpectedElementQueries: f
|
|
12333
12333
|
};
|
|
12334
12334
|
}
|
|
12335
|
-
function
|
|
12335
|
+
function Ib(e) {
|
|
12336
12336
|
const { databaseName: t, dialecteConfig: n } = e;
|
|
12337
12337
|
return {
|
|
12338
12338
|
store: new hu(t, n),
|
|
@@ -12340,35 +12340,37 @@ function $b(e) {
|
|
|
12340
12340
|
stagedOperations: []
|
|
12341
12341
|
};
|
|
12342
12342
|
}
|
|
12343
|
-
function
|
|
12344
|
-
|
|
12345
|
-
record:
|
|
12346
|
-
|
|
12347
|
-
|
|
12348
|
-
|
|
12349
|
-
|
|
12350
|
-
|
|
12351
|
-
|
|
12352
|
-
|
|
12353
|
-
|
|
12354
|
-
|
|
12355
|
-
|
|
12356
|
-
throw new Error(`Unsupported record type: ${n}`);
|
|
12343
|
+
function Cb(e) {
|
|
12344
|
+
function t(n) {
|
|
12345
|
+
const { record: r, type: o = "raw" } = n, s = yu({ record: r, dialecteConfig: e });
|
|
12346
|
+
switch (o) {
|
|
12347
|
+
case "raw":
|
|
12348
|
+
return s;
|
|
12349
|
+
case "tracked":
|
|
12350
|
+
return wu({ record: s });
|
|
12351
|
+
case "tree":
|
|
12352
|
+
return bu({ record: s });
|
|
12353
|
+
default:
|
|
12354
|
+
throw new Error(`Unsupported record type: ${o}`);
|
|
12355
|
+
}
|
|
12357
12356
|
}
|
|
12357
|
+
return t;
|
|
12358
12358
|
}
|
|
12359
|
+
const Bb = Cb(lu);
|
|
12359
12360
|
export {
|
|
12360
12361
|
_b as DATABASE_CONFIG,
|
|
12361
12362
|
Ve as DIALECTE_NAMESPACES,
|
|
12362
12363
|
wb as IO_CONFIG,
|
|
12363
12364
|
lu as TEST_DIALECTE_CONFIG,
|
|
12364
|
-
|
|
12365
|
-
|
|
12366
|
-
|
|
12365
|
+
Tb as XMLNS_DEFAULT_NAMESPACE,
|
|
12366
|
+
vb as XMLNS_DEV_NAMESPACE,
|
|
12367
|
+
xb as XMLNS_EXT_NAMESPACE,
|
|
12367
12368
|
tb as assertExpectedElementQueries,
|
|
12368
12369
|
rb as assertUnexpectedElementQueries,
|
|
12369
|
-
|
|
12370
|
-
|
|
12371
|
-
|
|
12370
|
+
Ib as createTestContext,
|
|
12371
|
+
$b as createTestDialecte,
|
|
12372
|
+
Bb as createTestRecord,
|
|
12373
|
+
Cb as createTestRecordFactory,
|
|
12372
12374
|
eb as createXmlAssertions,
|
|
12373
12375
|
Ha as splitXpathIntoSteps
|
|
12374
12376
|
};
|
package/dist/types/io.d.ts
CHANGED
|
@@ -23,6 +23,18 @@ export type ExportOptions = {
|
|
|
23
23
|
export type RecordPatch = {
|
|
24
24
|
recordId: string;
|
|
25
25
|
} & Partial<Omit<AnyRawRecord, 'id'>>;
|
|
26
|
+
/**
|
|
27
|
+
* A warning produced during import.
|
|
28
|
+
*
|
|
29
|
+
* `type` is a discriminant string owned by the dialecte (e.g. `'unresolved-reference'`).
|
|
30
|
+
* `recordId` identifies the record that triggered the warning.
|
|
31
|
+
* `details` carries dialecte-specific context — its shape is defined by the dialecte.
|
|
32
|
+
*/
|
|
33
|
+
export type ImportWarning = {
|
|
34
|
+
type: string;
|
|
35
|
+
recordId: string;
|
|
36
|
+
details?: Record<string, unknown>;
|
|
37
|
+
};
|
|
26
38
|
/**
|
|
27
39
|
* Return value of the afterImport hook.
|
|
28
40
|
* Core applies each collection in order: creates → updates → deletes.
|
|
@@ -34,14 +46,11 @@ export type AfterImportResult = {
|
|
|
34
46
|
updates?: RecordPatch[];
|
|
35
47
|
/** IDs of records to remove */
|
|
36
48
|
deletes?: string[];
|
|
49
|
+
/** Warnings collected during resolution — unresolved refs, unknown paths, etc. */
|
|
50
|
+
warnings?: ImportWarning[];
|
|
37
51
|
};
|
|
38
52
|
/**
|
|
39
53
|
* IO hooks for import/export lifecycle.
|
|
40
|
-
*
|
|
41
|
-
* - `beforeImportRecord`: called synchronously per record during streaming.
|
|
42
|
-
* Use to collect data (e.g., build path indexes) without blocking the parser.
|
|
43
|
-
* - `afterImport`: called once after all records are stored.
|
|
44
|
-
* Use for cross-record resolution (e.g., path → UUID) via bulk writes.
|
|
45
54
|
*/
|
|
46
55
|
export type IOHooks = {
|
|
47
56
|
beforeImportRecord?: (params: {
|
package/dist/types/io.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"io.d.ts","sourceRoot":"","sources":["../../src/types/io.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAE7C;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG;IAC1C,aAAa,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC3B,aAAa,EAAE,OAAO,CAAA;CACtB,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,CAAA;AAElF;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC/B,4BAA4B;IAC5B,OAAO,CAAC,EAAE,YAAY,EAAE,CAAA;IACxB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,WAAW,EAAE,CAAA;IACvB,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"io.d.ts","sourceRoot":"","sources":["../../src/types/io.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAE7C;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG;IAC1C,aAAa,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC3B,aAAa,EAAE,OAAO,CAAA;CACtB,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,CAAA;AAElF;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACjC,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC/B,4BAA4B;IAC5B,OAAO,CAAC,EAAE,YAAY,EAAE,CAAA;IACxB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,WAAW,EAAE,CAAA;IACvB,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,kFAAkF;IAClF,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAA;CAC1B,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG;IACrB,kBAAkB,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,YAAY,CAAC;QAAC,QAAQ,EAAE,SAAS,YAAY,EAAE,CAAA;KAAE,KAAK,IAAI,CAAA;IAClG,4EAA4E;IAC5E,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,iBAAiB,CAAC,CAAA;CAC9C,CAAA"}
|
package/dist/utils/assert.d.ts
CHANGED
|
@@ -3,12 +3,11 @@ import { DialecteErrorKey } from '../errors';
|
|
|
3
3
|
* Assert a condition, throwing a structured DialecteError if it fails.
|
|
4
4
|
*
|
|
5
5
|
* @example
|
|
6
|
-
* assert(record, { detail: 'addChild: parent not found'
|
|
7
|
-
* assert(ref.id, { detail: 'Singleton element has no id',
|
|
6
|
+
* assert(record, { detail: 'addChild: parent not found' })
|
|
7
|
+
* assert(ref.id, { detail: 'Singleton element has no id', key: 'ELEMENT_NOT_FOUND' })
|
|
8
8
|
*/
|
|
9
9
|
export declare function assert(condition: unknown, error: {
|
|
10
10
|
detail: string;
|
|
11
|
-
method: string;
|
|
12
11
|
key?: DialecteErrorKey;
|
|
13
12
|
ref?: {
|
|
14
13
|
tagName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/utils/assert.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAEhD;;;;;;GAMG;AACH,wBAAgB,MAAM,CACrB,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE;IACN,MAAM,EAAE,MAAM,CAAA;IACd,
|
|
1
|
+
{"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/utils/assert.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAEhD;;;;;;GAMG;AACH,wBAAgB,MAAM,CACrB,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE;IACN,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,CAAC,EAAE,gBAAgB,CAAA;IACtB,GAAG,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CACtC,GACC,OAAO,CAAC,SAAS,CAInB"}
|
package/dist/utils.js
CHANGED