@dialecte/core 0.4.5 → 0.4.7

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.
@@ -2,7 +2,7 @@ export { Document } from './document';
2
2
  export { bindExtensions } from './bind-extensions';
3
3
  export * from './query';
4
4
  export * from './transaction';
5
- export type { Context, CachedContext, PreparedTransaction, DocumentState, TransactionEntry, } from './types';
5
+ export type { ExtendedDocument, Context, CachedContext, PreparedTransaction, DocumentState, TransactionEntry, } from './types';
6
6
  export type * from './types.extensions';
7
7
  export type * from './types.ref';
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/document/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,cAAc,SAAS,CAAA;AACvB,cAAc,eAAe,CAAA;AAE7B,YAAY,EACX,OAAO,EACP,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,gBAAgB,GAChB,MAAM,SAAS,CAAA;AAEhB,mBAAmB,oBAAoB,CAAA;AACvC,mBAAmB,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/document/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,cAAc,SAAS,CAAA;AACvB,cAAc,eAAe,CAAA;AAE7B,YAAY,EACX,gBAAgB,EAChB,OAAO,EACP,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,gBAAgB,GAChB,MAAM,SAAS,CAAA;AAEhB,mBAAmB,oBAAoB,CAAA;AACvC,mBAAmB,aAAa,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-snapshot.d.ts","sourceRoot":"","sources":["../../../../src/document/query/snapshot/get-snapshot.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAqB,kBAAkB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAC7F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAc,MAAM,SAAS,CAAA;AAE3E;;;;;;;;;;;;GAYG;AACH,wBAAsB,WAAW,CAAC,aAAa,SAAS,iBAAiB,EAAE,MAAM,EAAE;IAClF,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;IAC/B,OAAO,CAAC,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAA;CAC3C,GAAG,OAAO,CAAC,aAAa,GAAG,MAAM,GAAG,cAAc,CAAC,CAmBnD"}
1
+ {"version":3,"file":"get-snapshot.d.ts","sourceRoot":"","sources":["../../../../src/document/query/snapshot/get-snapshot.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAqB,kBAAkB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAC7F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAc,MAAM,SAAS,CAAA;AAE3E;;;;;;;;;;;;GAYG;AACH,wBAAsB,WAAW,CAAC,aAAa,SAAS,iBAAiB,EAAE,MAAM,EAAE;IAClF,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;IAC/B,OAAO,CAAC,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAA;CAC3C,GAAG,OAAO,CAAC,aAAa,GAAG,MAAM,GAAG,cAAc,CAAC,CA4BnD"}
@@ -42,6 +42,13 @@ export type GetSnapshotOptions<GenericConfig extends AnyDialecteConfig, GenericE
42
42
  * nested in its file rather than a standalone document.
43
43
  */
44
44
  declareNamespaces?: boolean;
45
+ /**
46
+ * For `as: 'xml'` / `'both'`: prepend the XML prolog
47
+ * (`<?xml version="1.0" encoding="UTF-8"?>`). Defaults to `true`. Set `false`
48
+ * to emit the serialized element(s) without the declaration, e.g. for an
49
+ * excerpt embedded in another document.
50
+ */
51
+ includeXmlDeclaration?: boolean;
45
52
  };
46
53
  export type SnapshotResult = {
47
54
  tree: AnyTreeRecord;
@@ -1 +1 @@
1
- {"version":3,"file":"snapshot.types.d.ts","sourceRoot":"","sources":["../../../../src/document/query/snapshot/snapshot.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAE7F,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAA;AAEpD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,kBAAkB,CAC7B,aAAa,SAAS,iBAAiB,EACvC,cAAc,SAAS,UAAU,CAAC,aAAa,CAAC,GAAG,UAAU,CAAC,aAAa,CAAC,IACzE;IACH,GAAG,CAAC,EAAE,WAAW,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;IAChD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,GAAG;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;IACzC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,IAAI,CAAC,EAAE,SAAS,CAAC,aAAa,CAAC,EAAE,CAAA;IACjC,MAAM,CAAC,EAAE,UAAU,CAAC,aAAa,CAAC,EAAE,CAAA;IACpC,EAAE,CAAC,EAAE,cAAc,CAAA;IACnB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM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EAAE,cAAc,CAAA;IACnB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B;;;;;OAKG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAC/B,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,aAAa,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,gEAAgE;AAChE,MAAM,MAAM,iBAAiB,GAAG;IAC/B,+EAA+E;IAC/E,WAAW,EAAE,gBAAgB,EAAE,CAAA;IAC/B,wEAAwE;IACxE,cAAc,EAAE,gBAAgB,EAAE,CAAA;IAClC,mEAAmE;IACnE,MAAM,EAAE,MAAM,CAAA;CACd,CAAA"}
@@ -1,8 +1,20 @@
1
+ import { Document } from './document';
1
2
  import { Query } from './query';
2
- import { ExtensionsRegistry, QueryExtensions } from './types.extensions';
3
+ import { ExtensionsRegistry, QueryExtensions, ExtensionModules, MergedExtensions } from './types.extensions';
3
4
  import { DialecteError } from '../errors';
4
5
  import { Store } from '../store';
5
6
  import { AnyDialecteConfig, Operation, AnyRawRecord } from '../types';
7
+ /**
8
+ * The document a project configured with `GenericModules` yields — i.e. the
9
+ * return type of `Project<Config, Modules>['openDocument']`. Both the query
10
+ * surface and the transaction callback are typed through the extension system.
11
+ *
12
+ * This is the single source of truth for "a `Document` augmented with modules".
13
+ * Config packages hydrate it into a one-parameter helper by fixing the config
14
+ * and pre-merging their base modules, e.g.
15
+ * `type ExtendedDocument<Custom> = Core.ExtendedDocument<Config, BaseModules & Custom>`.
16
+ */
17
+ export type ExtendedDocument<GenericConfig extends AnyDialecteConfig, GenericModules extends ExtensionModules> = Document<GenericConfig, MergedExtensions<GenericModules>>;
6
18
  /**
7
19
  * Context passed to methods.
8
20
  *
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/document/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAA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,CAAA;CACf,CAAA;AAID,MAAM,MAAM,gBAAgB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,GAAG,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAA;CACrC,CAAA;AAED;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG;IAC3B,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,aAAa,GAAG,IAAI,CAAA;IAE3B,6EAA6E;IAC7E,QAAQ,EAAE;QACT,OAAO,EAAE,MAAM,CAAA;QACf,OAAO,EAAE,MAAM,CAAA;QACf,KAAK,EAAE,MAAM,CAAA;KACb,GAAG,IAAI,CAAA;IAER,4DAA4D;IAC5D,OAAO,EAAE,gBAAgB,EAAE,CAAA;IAE3B;;;;OAIG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB,CAAA"}
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as u, K as d, L as f, M as p, N as m, O as h, P as g, Q as _, R as v, S as y, T as b, U as x, V as S, W as C, X as w, Y as T, Z as E, _ as D, a as O, at as k, b as A, c as j, ct as M, d as N, et as P, f as F, g as I, h as L, i as R, it as z, j as B, k as V, l as H, lt as U, m as W, n as G, nt as K, o as q, ot as J, p as Y, q as X, r as Z, rt as Q, s as $, st as ee, t as te, tt as ne, u as re, ut as ie, v as ae, w as oe, x as se, y as ce } from "./project-wohrish5.js";
1
+ import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as u, K as d, L as f, M as p, N as m, O as h, P as g, Q as _, R as v, S as y, T as b, U as x, V as S, W as C, X as w, Y as T, Z as E, _ as D, a as O, at as k, b as A, c as j, ct as M, d as N, et as P, f as F, g as I, h as L, i as R, it as z, j as B, k as V, l as H, lt as U, m as W, n as G, nt as K, o as q, ot as J, p as Y, q as X, r as Z, rt as Q, s as $, st as ee, t as te, tt as ne, u as re, ut as ie, v as ae, w as oe, x as se, y as ce } from "./project-DxIu-3AU.js";
2
2
  import { m as le, p as ue } from "./utils-C5_11hqg.js";
3
3
  export { V as AnyQuery, i as AnyTransaction, N as BLOBS_SCHEMA, F as BLOB_DATA_SCHEMA, Y as CHANGELOG_SCHEMA, W as DOCUMENTS_SCHEMA, re as DexieStore, oe as Document, le as ERROR_CATALOG, H as InMemoryStore, L as META_SCHEMA, p as ParseSession, te as Project, h as Query, I as TABLE_BLOBS, D as TABLE_BLOB_PREFIX, ae as TABLE_CHANGELOG, ce as TABLE_DOCUMENTS, A as TABLE_META, se as TABLE_RECORD_PREFIX, f as TEMP_IDB_ID_ATTRIBUTE_NAME, a as Transaction, C as applyOmit, x as applyOrder, u as applyUnwrap, ie as bindExtensions, y as blobTableName, R as buildDocumentState, g as buildXmlDocument, S as collectSnapshotRecords, o as downloadFile, q as exportBlob, $ as exportDocument, K as findAncestors, P as findByAttributes, e as findDescendants, v as formatXml, E as getAttribute, _ as getAttributeFullObject, T as getAttributes, w as getAttributesFullObject, z as getChild, Q as getChildren, ee as getRecord, J as getRecords, k as getRecordsByTagName, t as getSnapshot, c as getTree, Z as importDocument, M as indexStagedDeletesByParent, G as initEmptyDocument, m as inspectXml, s as isOmitted, b as isTransactionContext, ne as matchesAttributeFilter, U as overlayAllStaged, d as parseOmit, B as parseXmlFile, O as reconcileDocumentState, r as recordTableName, n as recordsToTree, j as resolveStore, X as shouldStopTraversal, ue as throwDialecteError, l as xmlDocumentToString };
@@ -1305,8 +1305,9 @@ function Ge(e) {
1305
1305
  var Ke = "_temp-idb-id";
1306
1306
  //#endregion
1307
1307
  //#region src/xml/build/serialize.ts
1308
- function qe(e) {
1309
- return Ge("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + new XMLSerializer().serializeToString(e));
1308
+ function qe(e, t = {}) {
1309
+ let { includeXmlDeclaration: n = !0 } = t, r = new XMLSerializer().serializeToString(e);
1310
+ return Ge(n ? "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + r : r);
1310
1311
  }
1311
1312
  //#endregion
1312
1313
  //#region src/xml/build/download-file.ts
@@ -2654,14 +2655,14 @@ async function V(e) {
2654
2655
  depth: o,
2655
2656
  includeDeleted: s
2656
2657
  });
2657
- if (u === "xml") return Dt(t, d, n.declareNamespaces);
2658
+ if (u === "xml") return Dt(t, d, n.declareNamespaces, n.includeXmlDeclaration);
2658
2659
  let f = Et(t, d, {
2659
2660
  omit: c,
2660
2661
  unwrap: l
2661
2662
  });
2662
2663
  return u === "tree" ? f : {
2663
2664
  tree: f,
2664
- xmlString: Dt(t, d, n.declareNamespaces)
2665
+ xmlString: Dt(t, d, n.declareNamespaces, n.includeXmlDeclaration)
2665
2666
  };
2666
2667
  }
2667
2668
  function Et(e, t, n) {
@@ -2679,13 +2680,13 @@ function Et(e, t, n) {
2679
2680
  childrenConfig: e.dialecteConfig.children
2680
2681
  }), r;
2681
2682
  }
2682
- function Dt(e, t, n) {
2683
+ function Dt(e, t, n, r) {
2683
2684
  return qe(Ye({
2684
2685
  records: t.liveRecords,
2685
2686
  config: e.dialecteConfig,
2686
2687
  rootId: t.rootId,
2687
2688
  declareNamespaces: n
2688
- }));
2689
+ }), { includeXmlDeclaration: r });
2689
2690
  }
2690
2691
  //#endregion
2691
2692
  //#region src/document/query/any/any-query.ts
package/dist/test.js CHANGED
@@ -1,4 +1,4 @@
1
- import { dt as e, t, u as n, z as r } from "./project-wohrish5.js";
1
+ import { dt as e, t, u as n, z as r } from "./project-DxIu-3AU.js";
2
2
  import { DIALECTE_NAMESPACES as i, standardizeRecord as a, toTrackedRecord as o, toTreeRecord as s } from "./helpers.js";
3
3
  import { expect as c, it as l } from "vitest";
4
4
  //#region src/test/assert-xml/xpath-parser.ts
@@ -1,9 +1,11 @@
1
+ import { SerializeOptions } from './serialize.types';
1
2
  /**
2
3
  * Serialize an XMLDocument to a formatted XML string.
3
4
  *
4
- * Adds the XML declaration and runs the deterministic formatter.
5
- * Shared by file download and transaction snapshots so both produce
5
+ * Adds the XML declaration (unless opted out via
6
+ * {@link SerializeOptions.includeXmlDeclaration}) and runs the deterministic
7
+ * formatter. Shared by file download and transaction snapshots so both produce
6
8
  * byte-identical output for the same document.
7
9
  */
8
- export declare function xmlDocumentToString(xmlDocument: XMLDocument): string;
10
+ export declare function xmlDocumentToString(xmlDocument: XMLDocument, options?: SerializeOptions): string;
9
11
  //# sourceMappingURL=serialize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../../src/xml/build/serialize.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAMpE"}
1
+ {"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../../src/xml/build/serialize.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAEzD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAClC,WAAW,EAAE,WAAW,EACxB,OAAO,GAAE,gBAAqB,GAC5B,MAAM,CASR"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Render controls for {@link xmlDocumentToString}.
3
+ */
4
+ export type SerializeOptions = {
5
+ /**
6
+ * Prepend the XML prolog (`<?xml version="1.0" encoding="UTF-8"?>`).
7
+ * Defaults to `true`. Set `false` to emit the serialized element(s) without
8
+ * the declaration, e.g. for an excerpt embedded in another document.
9
+ */
10
+ includeXmlDeclaration?: boolean;
11
+ };
12
+ //# sourceMappingURL=serialize.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serialize.types.d.ts","sourceRoot":"","sources":["../../../src/xml/build/serialize.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC9B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAC/B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dialecte/core",
3
- "version": "0.4.5",
3
+ "version": "0.4.7",
4
4
  "description": "Dialecte - Core functionality for Dialecte SDK",
5
5
  "license": "MIT",
6
6
  "repository": {