@dialecte/core 0.4.6 → 0.4.8

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.
@@ -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;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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;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,10 +1,32 @@
1
1
  import { Ref, RefOrRecord } from '../document';
2
- import { RawRecord, TrackedRecord, TreeRecord, AnyDialecteConfig, AttributeInputOf, ElementsOf, FullAttributeObjectOf, AttributesValueObjectOf, OperationStatus, ParentRelationship, ChildRelationship } from '../types';
2
+ import { RawRecord, TrackedRecord, TreeRecord, AnyDialecteConfig, Attribute, AttributeInputOf, ElementsOf, FullAttributeObjectOf, AttributesValueObjectOf, OperationStatus, ParentRelationship, ChildRelationship } from '../types';
3
3
  /**
4
4
  * Converts a TrackedRecord | TreeRecord to RawRecord
5
5
  * If already a RawRecord, returns as-is.
6
6
  */
7
7
  export declare function toRawRecord<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>>(record: RawRecord<GenericConfig, GenericElement> | TrackedRecord<GenericConfig, GenericElement> | TreeRecord<GenericConfig, GenericElement>): RawRecord<GenericConfig, GenericElement>;
8
+ /**
9
+ * Widen any per-element dialecte value to its element-union form — the same value,
10
+ * with its element type parameter widened from a specific `GenericElement` to
11
+ * `ElementsOf<GenericConfig>`.
12
+ *
13
+ * A `RawRecord<Config, GenericElement>` (or `Ref`, `Attribute`, …) is semantically
14
+ * one of the element union, but these types are invariant in their element
15
+ * parameter (the attribute `name`/`tagName` narrows per element), so TypeScript
16
+ * cannot verify the upcast for an unresolved type parameter. `widen` performs it
17
+ * in one place, behind overloads that keep it a *widening* (not an arbitrary cast):
18
+ * the config is inferred from the argument, so callers write `widen(record)` with
19
+ * no type arguments. At runtime it is the identity function.
20
+ *
21
+ * Use it wherever a per-element value must flow into an element-union API — e.g.
22
+ * building an `Operation`, or passing a `Ref<Config, GenericElement>` to a
23
+ * union-typed method.
24
+ */
25
+ export declare function widen<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>>(thing: TreeRecord<GenericConfig, GenericElement>): TreeRecord<GenericConfig, ElementsOf<GenericConfig>>;
26
+ export declare function widen<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>>(thing: TrackedRecord<GenericConfig, GenericElement>): TrackedRecord<GenericConfig, ElementsOf<GenericConfig>>;
27
+ export declare function widen<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>>(thing: RawRecord<GenericConfig, GenericElement>): RawRecord<GenericConfig, ElementsOf<GenericConfig>>;
28
+ export declare function widen<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>>(thing: Ref<GenericConfig, GenericElement>): Ref<GenericConfig, ElementsOf<GenericConfig>>;
29
+ export declare function widen<GenericConfig extends AnyDialecteConfig, GenericElement extends ElementsOf<GenericConfig>>(thing: Attribute<GenericConfig, GenericElement>): Attribute<GenericConfig, ElementsOf<GenericConfig>>;
8
30
  /**
9
31
  * Converts a RawRecord | TreeRecord to TrackedRecord
10
32
  * If already a TrackedRecord, returns as-is.
@@ -1 +1 @@
1
- {"version":3,"file":"converter.d.ts","sourceRoot":"","sources":["../../src/help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,CAAC,aAAa,EAAE,cAAc,CAAC,GACxC,aAAa,CAAC,aAAa,EAAE,cAAc,CAAC,GAC5C,UAAU,CAAC,aAAa,EAAE,cAAc,CAAC,GACzC,SAAS,GACV,GAAG,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;AACrC,wBAAgB,KAAK,CACpB,aAAa,SAAS,iBAAiB,EACvC,cAAc,SAAS,UAAU,CAAC,aAAa,CAAC,EAC/C,KAAK,EAAE,WAAW,CAAC,aAAa,EAAE,cAAc,CAAC,GAAG,SAAS,GAAG,GAAG,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA"}
package/dist/helpers.js CHANGED
@@ -64,35 +64,38 @@ function E(e) {
64
64
  };
65
65
  }
66
66
  function D(e) {
67
+ return e;
68
+ }
69
+ function O(e) {
67
70
  let { record: t, status: n } = e, r = n ?? ("status" in t ? t.status : "unchanged");
68
71
  return {
69
72
  ...E(t),
70
73
  status: r
71
74
  };
72
75
  }
73
- function O(e) {
76
+ function k(e) {
74
77
  let { record: t, status: n, tree: r } = e, i = r ?? ("tree" in t ? t.tree : []);
75
78
  return {
76
- ...D({
79
+ ...O({
77
80
  record: t,
78
81
  status: n
79
82
  }),
80
83
  tree: i
81
84
  };
82
85
  }
83
- function k(e) {
86
+ function A(e) {
84
87
  let { dialecteConfig: t, tagName: n, attributes: r } = e;
85
88
  return (Array.isArray(r) ? r : Object.entries(r).map(([e, r]) => ({
86
89
  name: e,
87
90
  value: r,
88
91
  namespace: t.definition[n]?.attributes.details[e]?.namespace || void 0
89
- }))).map((e) => A({
92
+ }))).map((e) => j({
90
93
  attribute: e,
91
94
  dialecteConfig: t,
92
95
  tagName: n
93
96
  }));
94
97
  }
95
- function A(t) {
98
+ function j(t) {
96
99
  let { attribute: r, dialecteConfig: a, tagName: s } = t, c;
97
100
  typeof r.namespace == "string" ? (c = o(a, r.namespace), c || i("UNKNOWN_NAMESPACE_PREFIX", {
98
101
  detail: `Unknown namespace '${r.namespace}' on attribute '${r.name}' — use a registered namespace key or pass a full { name, namespace: { prefix, uri } }.`,
@@ -115,7 +118,7 @@ function A(t) {
115
118
  namespace: c
116
119
  });
117
120
  }
118
- function j(e) {
121
+ function M(e) {
119
122
  return a(e, { detail: "The record or ref is undefined" }), {
120
123
  id: e.id,
121
124
  tagName: e.tagName
@@ -123,8 +126,8 @@ function j(e) {
123
126
  }
124
127
  //#endregion
125
128
  //#region src/helpers/standardizing.ts
126
- function M(e) {
127
- let { dialecteConfig: n, hooks: r, record: i } = e, { id: a, tagName: o, attributes: s, namespace: c, value: l } = i, u = a ?? crypto.randomUUID(), d = s ? k({
129
+ function N(e) {
130
+ let { dialecteConfig: n, hooks: r, record: i } = e, { id: a, tagName: o, attributes: s, namespace: c, value: l } = i, u = a ?? crypto.randomUUID(), d = s ? A({
128
131
  tagName: o,
129
132
  attributes: s,
130
133
  dialecteConfig: n
@@ -164,7 +167,7 @@ function M(e) {
164
167
  }
165
168
  //#endregion
166
169
  //#region src/helpers/assert-fixed.ts
167
- function N(e) {
170
+ function P(e) {
168
171
  let { dialecteConfig: t, tagName: n, attributes: a } = e;
169
172
  for (let e of a) {
170
173
  let a = r({
@@ -180,7 +183,7 @@ function N(e) {
180
183
  }
181
184
  //#endregion
182
185
  //#region src/helpers/merge-extensions.ts
183
- function P(e, t, n, r) {
186
+ function F(e, t, n, r) {
184
187
  if (!e || !t) return;
185
188
  let i = Object.keys(t).filter((t) => t in e);
186
189
  a(i.length === 0, {
@@ -188,12 +191,12 @@ function P(e, t, n, r) {
188
191
  detail: `Module "${n}" has conflicting ${r} method(s): ${i.map((e) => `"${e}"`).join(", ")}`
189
192
  });
190
193
  }
191
- function F(e) {
194
+ function I(e) {
192
195
  let t = {}, n = {}, r = [...Object.entries(e.base ?? {}), ...Object.entries(e.custom ?? {})];
193
- for (let [e, i] of r) i.query && (P(t[e], i.query, e, "query"), t[e] = {
196
+ for (let [e, i] of r) i.query && (F(t[e], i.query, e, "query"), t[e] = {
194
197
  ...t[e],
195
198
  ...i.query
196
- }), i.transaction && (P(n[e], i.transaction, e, "transaction"), n[e] = {
199
+ }), i.transaction && (F(n[e], i.transaction, e, "transaction"), n[e] = {
197
200
  ...n[e],
198
201
  ...i.transaction
199
202
  });
@@ -204,15 +207,15 @@ function F(e) {
204
207
  }
205
208
  //#endregion
206
209
  //#region src/helpers/strip-attributes.ts
207
- function I(e, t) {
210
+ function L(e, t) {
208
211
  let n = new Set(t), r = {
209
212
  ...e,
210
213
  attributes: e.attributes.filter((e) => !n.has(e.name))
211
214
  };
212
215
  return "tree" in e ? {
213
216
  ...r,
214
- tree: e.tree.map((e) => I(e, t))
217
+ tree: e.tree.map((e) => L(e, t))
215
218
  } : r;
216
219
  }
217
220
  //#endregion
218
- export { l as CUSTOM_RECORD_ID_ATTRIBUTE, s as CUSTOM_RECORD_ID_ATTRIBUTE_NAME, c as DIALECTE_DEV_NAMESPACE, f as DIALECTE_NAMESPACES, d as XMLNS_XSI_NAMESPACE, u as XSI_NAMESPACE, N as assertNoFixedViolation, T as isAttributeOf, S as isChildOf, w as isElementOf, _ as isFullAttributeArray, C as isParentOf, v as isRawRecord, x as isRecordOf, y as isTrackedRecord, b as isTreeRecord, F as mergeExtensions, M as standardizeRecord, I as stripAttributes, k as toFullAttributeArray, E as toRawRecord, j as toRef, D as toTrackedRecord, O as toTreeRecord };
221
+ export { l as CUSTOM_RECORD_ID_ATTRIBUTE, s as CUSTOM_RECORD_ID_ATTRIBUTE_NAME, c as DIALECTE_DEV_NAMESPACE, f as DIALECTE_NAMESPACES, d as XMLNS_XSI_NAMESPACE, u as XSI_NAMESPACE, P as assertNoFixedViolation, T as isAttributeOf, S as isChildOf, w as isElementOf, _ as isFullAttributeArray, C as isParentOf, v as isRawRecord, x as isRecordOf, y as isTrackedRecord, b as isTreeRecord, I as mergeExtensions, N as standardizeRecord, L as stripAttributes, A as toFullAttributeArray, E as toRawRecord, M as toRef, O as toTrackedRecord, k as toTreeRecord, D as widen };
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.6",
3
+ "version": "0.4.8",
4
4
  "description": "Dialecte - Core functionality for Dialecte SDK",
5
5
  "license": "MIT",
6
6
  "repository": {