doxum 0.1.16 → 0.1.18

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 (37) hide show
  1. package/README.md +31 -4
  2. package/dist/advanced-DgRnyRAc.js +233 -0
  3. package/dist/advanced-DgRnyRAc.js.map +1 -0
  4. package/dist/advanced-Dgu8-bPS.cjs +274 -0
  5. package/dist/advanced-Dgu8-bPS.cjs.map +1 -0
  6. package/dist/advanced-GTwIWcn6.d.cts +138 -0
  7. package/dist/advanced-c0F3gpLG.d.ts +138 -0
  8. package/dist/advanced.cjs +2 -165
  9. package/dist/advanced.d.cts +2 -42
  10. package/dist/advanced.d.ts +2 -42
  11. package/dist/advanced.js +1 -164
  12. package/dist/index.cjs +1195 -874
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +26 -4
  15. package/dist/index.d.ts +26 -4
  16. package/dist/index.js +1192 -871
  17. package/dist/index.js.map +1 -1
  18. package/dist/react.cjs +5 -10
  19. package/dist/react.cjs.map +1 -1
  20. package/dist/react.d.cts +6 -8
  21. package/dist/react.d.ts +6 -8
  22. package/dist/react.js +6 -10
  23. package/dist/react.js.map +1 -1
  24. package/package.json +3 -2
  25. package/skills/doxum-runtime/SKILL.md +2 -1
  26. package/skills/doxum-runtime/references/patterns.en.md +4 -4
  27. package/skills/doxum-runtime/references/patterns.zh-CN.md +2 -2
  28. package/skills/doxum-runtime/references/projections.en.md +19 -4
  29. package/skills/doxum-runtime/references/projections.zh-CN.md +15 -4
  30. package/dist/advanced.cjs.map +0 -1
  31. package/dist/advanced.js.map +0 -1
  32. package/dist/definition-C__VJqA4.d.cts +0 -136
  33. package/dist/definition-Dc1Udkop.d.ts +0 -136
  34. package/dist/definition-Z6TagMup.cjs +0 -107
  35. package/dist/definition-Z6TagMup.cjs.map +0 -1
  36. package/dist/definition-c6XQXzvK.js +0 -72
  37. package/dist/definition-c6XQXzvK.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { $ as OptionalNode, B as DocumentAddress, C as Draft, E as snapshot, F as MemberChange, G as DocumentTreeValue, H as DocumentListConfig, I as ValueTransition, J as Infer, K as FieldNode, N as Change, P as ChangeSet, Q as ObjectShape, S as DocumentImpact, T as replace, U as DocumentNode, V as DocumentAnchor, W as DocumentTreeNode, X as MapNode, Y as ListNode, Z as ObjectNode, _ as Unsubscribe, _t as Validator, a as DocumentDisposedError, at as VariantNode, b as MutationIssueCode, c as DocumentReentrancyError, ct as list, d as LocalHistory, dt as optional, et as PathValueOf, f as ObserverError, ft as table, g as TransactionResult, gt as ParseIssue, h as TransactionRejected, ht as ParseError, i as DocumentDiagnostic, it as TreeNode, l as DocumentRuntime, lt as map, mt as variant, n as CommitSource, nt as SchemaPath, o as DocumentProblem, ot as VariantShape, p as OperationResult, pt as tree, r as DocumentCommit, rt as TableNode, s as DocumentReadable, st as field, tt as ReadonlyValue, u as HistoryState, ut as object, v as Readable, vt as parse, w as Read, x as CollectionImpact, y as MutationIssue } from "./contract-XmKnroJq.cjs";
2
- import { _ as ExternalValueEvent, a as ProjectionValues, b as ProjectionError, c as input, g as ExternalCollectionSource, h as ExternalCollectionRead, i as ProjectionChanges, l as observe, m as ExternalCollectionEvent, n as Input, o as PublicCollection, r as Projection, s as derive, u as BatchOptions, v as ExternalValueSource, y as ProjectionDisposedError } from "./definition-C__VJqA4.cjs";
2
+ import { _ as ExternalValueSource, c as Projection, d as observe, f as CollectionChange, g as ExternalValueEvent, h as ExternalCollectionSource, l as derive, m as ExternalCollectionRead, o as incremental, p as ExternalCollectionEvent, s as Input, u as input, v as ProjectionDisposedError, y as ProjectionError } from "./advanced-GTwIWcn6.cjs";
3
3
 
4
4
  //#region core/src/runtime.d.ts
5
5
  declare const createDocument: <S extends ObjectNode>(input: {
@@ -17,19 +17,41 @@ declare const asReadable: <TSchema extends ObjectNode>(runtime: DocumentRuntime<
17
17
  type DocumentSelector<TSchema extends ObjectNode, TResult> = (read: Read<TSchema>) => TResult;
18
18
  declare const read: <TSchema extends ObjectNode, TResult>(runtime: DocumentReadable<TSchema>, selector: DocumentSelector<TSchema, TResult>) => TResult;
19
19
  //#endregion
20
- //#region core/src/projection/store.d.ts
20
+ //#region core/src/projection/runtime.d.ts
21
+ type KeyedDraft<K extends string, V> = {
22
+ get(key: K): V | undefined;
23
+ has(key: K): boolean;
24
+ set(key: K, value: V): void;
25
+ remove(key: K): void;
26
+ };
21
27
  type ProjectionRuntime = {
22
28
  get<T>(projection: Projection<T, unknown>): T;
23
29
  readable<T>(projection: Projection<T, unknown>): Readable<T>;
24
30
  readable<T, R>(projection: Projection<T, unknown>, selector: (value: T) => R, equality?: (previous: R, next: R) => boolean): Readable<R>;
25
31
  set<T>(input: Input<T>, value: T): void;
32
+ update<K extends string, V>(input: Input<ReadonlyMap<K, V>, CollectionChange<K, V>>, run: (draft: KeyedDraft<K, V>) => void): void;
26
33
  batch<T>(run: () => T): T;
27
- batch<T>(options: BatchOptions, run: () => T): T;
34
+ batch<T>(options: {
35
+ readonly cause?: unknown;
36
+ }, run: () => T): T;
37
+ scope(): ProjectionScope;
38
+ dispose(): void;
39
+ };
40
+ type ProjectionScope = {
41
+ readonly input: typeof input;
42
+ readonly derive: typeof derive;
43
+ readonly incremental: typeof incremental;
44
+ get<T>(projection: Projection<T, unknown>): T;
45
+ readable<T>(projection: Projection<T, unknown>): Readable<T>;
46
+ readable<T, R>(projection: Projection<T, unknown>, selector: (value: T) => R, equality?: (previous: R, next: R) => boolean): Readable<R>;
47
+ set<T>(input: Input<T>, value: T): void;
48
+ update<K extends string, V>(input: Input<ReadonlyMap<K, V>, CollectionChange<K, V>>, run: (draft: KeyedDraft<K, V>) => void): void;
49
+ batch: ProjectionRuntime['batch'];
28
50
  dispose(): void;
29
51
  };
30
52
  declare const createProjectionRuntime: (options?: {
31
53
  readonly onError?: (error: ProjectionError) => void;
32
54
  }) => ProjectionRuntime;
33
55
  //#endregion
34
- export { type Change, type ChangeSet, type CollectionImpact, type CommitSource, type DocumentAddress, type DocumentAnchor, type DocumentCommit, type DocumentDiagnostic, DocumentDisposedError, type DocumentImpact, type DocumentListConfig, type DocumentNode, type DocumentProblem, type DocumentReadable, DocumentReentrancyError, type DocumentRuntime, type DocumentSelector, type DocumentTreeNode, type DocumentTreeValue, type Draft, type ExternalCollectionEvent, type ExternalCollectionRead, type ExternalCollectionSource, type ExternalValueEvent, type ExternalValueSource, type FieldNode, type HistoryState, type Infer, type Input, type ListNode, type LocalHistory, type MapNode, type MemberChange, type MutationIssue, type MutationIssueCode, type ObjectNode, type ObjectShape, type ObserverError, type OperationResult, type OptionalNode, ParseError, type ParseIssue, type PathValueOf, type Projection, type ProjectionChanges, ProjectionDisposedError, ProjectionError, type ProjectionRuntime, type ProjectionValues, type PublicCollection, type Read, type Readable, type ReadonlyValue, type SchemaPath, type TableNode, TransactionRejected, type TransactionResult, type TreeNode, type Unsubscribe, type Validator, type ValueTransition, type VariantNode, type VariantShape, asReadable, createDocument, createProjectionRuntime, derive, field, input, list, map, object, observe, optional, parse, read, replace, snapshot, table, tree, variant };
56
+ export { type Change, type ChangeSet, type CollectionChange, type CollectionImpact, type CommitSource, type DocumentAddress, type DocumentAnchor, type DocumentCommit, type DocumentDiagnostic, DocumentDisposedError, type DocumentImpact, type DocumentListConfig, type DocumentNode, type DocumentProblem, type DocumentReadable, DocumentReentrancyError, type DocumentRuntime, type DocumentSelector, type DocumentTreeNode, type DocumentTreeValue, type Draft, type ExternalCollectionEvent, type ExternalCollectionRead, type ExternalCollectionSource, type ExternalValueEvent, type ExternalValueSource, type FieldNode, type HistoryState, type Infer, type Input, type ListNode, type LocalHistory, type MapNode, type MemberChange, type MutationIssue, type MutationIssueCode, type ObjectNode, type ObjectShape, type ObserverError, type OperationResult, type OptionalNode, ParseError, type ParseIssue, type PathValueOf, type Projection, ProjectionDisposedError, ProjectionError, type ProjectionRuntime, type ProjectionScope, type Read, type Readable, type ReadonlyValue, type SchemaPath, type TableNode, TransactionRejected, type TransactionResult, type TreeNode, type Unsubscribe, type Validator, type ValueTransition, type VariantNode, type VariantShape, asReadable, createDocument, createProjectionRuntime, derive, field, input, list, map, object, observe, optional, parse, read, replace, snapshot, table, tree, variant };
35
57
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { $ as OptionalNode, B as DocumentAddress, C as Draft, E as snapshot, F as MemberChange, G as DocumentTreeValue, H as DocumentListConfig, I as ValueTransition, J as Infer, K as FieldNode, N as Change, P as ChangeSet, Q as ObjectShape, S as DocumentImpact, T as replace, U as DocumentNode, V as DocumentAnchor, W as DocumentTreeNode, X as MapNode, Y as ListNode, Z as ObjectNode, _ as Unsubscribe, _t as Validator, a as DocumentDisposedError, at as VariantNode, b as MutationIssueCode, c as DocumentReentrancyError, ct as list, d as LocalHistory, dt as optional, et as PathValueOf, f as ObserverError, ft as table, g as TransactionResult, gt as ParseIssue, h as TransactionRejected, ht as ParseError, i as DocumentDiagnostic, it as TreeNode, l as DocumentRuntime, lt as map, mt as variant, n as CommitSource, nt as SchemaPath, o as DocumentProblem, ot as VariantShape, p as OperationResult, pt as tree, r as DocumentCommit, rt as TableNode, s as DocumentReadable, st as field, tt as ReadonlyValue, u as HistoryState, ut as object, v as Readable, vt as parse, w as Read, x as CollectionImpact, y as MutationIssue } from "./contract-CATCCVu5.js";
2
- import { _ as ExternalValueEvent, a as ProjectionValues, b as ProjectionError, c as input, g as ExternalCollectionSource, h as ExternalCollectionRead, i as ProjectionChanges, l as observe, m as ExternalCollectionEvent, n as Input, o as PublicCollection, r as Projection, s as derive, u as BatchOptions, v as ExternalValueSource, y as ProjectionDisposedError } from "./definition-Dc1Udkop.js";
2
+ import { _ as ExternalValueSource, c as Projection, d as observe, f as CollectionChange, g as ExternalValueEvent, h as ExternalCollectionSource, l as derive, m as ExternalCollectionRead, o as incremental, p as ExternalCollectionEvent, s as Input, u as input, v as ProjectionDisposedError, y as ProjectionError } from "./advanced-c0F3gpLG.js";
3
3
 
4
4
  //#region core/src/runtime.d.ts
5
5
  declare const createDocument: <S extends ObjectNode>(input: {
@@ -17,19 +17,41 @@ declare const asReadable: <TSchema extends ObjectNode>(runtime: DocumentRuntime<
17
17
  type DocumentSelector<TSchema extends ObjectNode, TResult> = (read: Read<TSchema>) => TResult;
18
18
  declare const read: <TSchema extends ObjectNode, TResult>(runtime: DocumentReadable<TSchema>, selector: DocumentSelector<TSchema, TResult>) => TResult;
19
19
  //#endregion
20
- //#region core/src/projection/store.d.ts
20
+ //#region core/src/projection/runtime.d.ts
21
+ type KeyedDraft<K extends string, V> = {
22
+ get(key: K): V | undefined;
23
+ has(key: K): boolean;
24
+ set(key: K, value: V): void;
25
+ remove(key: K): void;
26
+ };
21
27
  type ProjectionRuntime = {
22
28
  get<T>(projection: Projection<T, unknown>): T;
23
29
  readable<T>(projection: Projection<T, unknown>): Readable<T>;
24
30
  readable<T, R>(projection: Projection<T, unknown>, selector: (value: T) => R, equality?: (previous: R, next: R) => boolean): Readable<R>;
25
31
  set<T>(input: Input<T>, value: T): void;
32
+ update<K extends string, V>(input: Input<ReadonlyMap<K, V>, CollectionChange<K, V>>, run: (draft: KeyedDraft<K, V>) => void): void;
26
33
  batch<T>(run: () => T): T;
27
- batch<T>(options: BatchOptions, run: () => T): T;
34
+ batch<T>(options: {
35
+ readonly cause?: unknown;
36
+ }, run: () => T): T;
37
+ scope(): ProjectionScope;
38
+ dispose(): void;
39
+ };
40
+ type ProjectionScope = {
41
+ readonly input: typeof input;
42
+ readonly derive: typeof derive;
43
+ readonly incremental: typeof incremental;
44
+ get<T>(projection: Projection<T, unknown>): T;
45
+ readable<T>(projection: Projection<T, unknown>): Readable<T>;
46
+ readable<T, R>(projection: Projection<T, unknown>, selector: (value: T) => R, equality?: (previous: R, next: R) => boolean): Readable<R>;
47
+ set<T>(input: Input<T>, value: T): void;
48
+ update<K extends string, V>(input: Input<ReadonlyMap<K, V>, CollectionChange<K, V>>, run: (draft: KeyedDraft<K, V>) => void): void;
49
+ batch: ProjectionRuntime['batch'];
28
50
  dispose(): void;
29
51
  };
30
52
  declare const createProjectionRuntime: (options?: {
31
53
  readonly onError?: (error: ProjectionError) => void;
32
54
  }) => ProjectionRuntime;
33
55
  //#endregion
34
- export { type Change, type ChangeSet, type CollectionImpact, type CommitSource, type DocumentAddress, type DocumentAnchor, type DocumentCommit, type DocumentDiagnostic, DocumentDisposedError, type DocumentImpact, type DocumentListConfig, type DocumentNode, type DocumentProblem, type DocumentReadable, DocumentReentrancyError, type DocumentRuntime, type DocumentSelector, type DocumentTreeNode, type DocumentTreeValue, type Draft, type ExternalCollectionEvent, type ExternalCollectionRead, type ExternalCollectionSource, type ExternalValueEvent, type ExternalValueSource, type FieldNode, type HistoryState, type Infer, type Input, type ListNode, type LocalHistory, type MapNode, type MemberChange, type MutationIssue, type MutationIssueCode, type ObjectNode, type ObjectShape, type ObserverError, type OperationResult, type OptionalNode, ParseError, type ParseIssue, type PathValueOf, type Projection, type ProjectionChanges, ProjectionDisposedError, ProjectionError, type ProjectionRuntime, type ProjectionValues, type PublicCollection, type Read, type Readable, type ReadonlyValue, type SchemaPath, type TableNode, TransactionRejected, type TransactionResult, type TreeNode, type Unsubscribe, type Validator, type ValueTransition, type VariantNode, type VariantShape, asReadable, createDocument, createProjectionRuntime, derive, field, input, list, map, object, observe, optional, parse, read, replace, snapshot, table, tree, variant };
56
+ export { type Change, type ChangeSet, type CollectionChange, type CollectionImpact, type CommitSource, type DocumentAddress, type DocumentAnchor, type DocumentCommit, type DocumentDiagnostic, DocumentDisposedError, type DocumentImpact, type DocumentListConfig, type DocumentNode, type DocumentProblem, type DocumentReadable, DocumentReentrancyError, type DocumentRuntime, type DocumentSelector, type DocumentTreeNode, type DocumentTreeValue, type Draft, type ExternalCollectionEvent, type ExternalCollectionRead, type ExternalCollectionSource, type ExternalValueEvent, type ExternalValueSource, type FieldNode, type HistoryState, type Infer, type Input, type ListNode, type LocalHistory, type MapNode, type MemberChange, type MutationIssue, type MutationIssueCode, type ObjectNode, type ObjectShape, type ObserverError, type OperationResult, type OptionalNode, ParseError, type ParseIssue, type PathValueOf, type Projection, ProjectionDisposedError, ProjectionError, type ProjectionRuntime, type ProjectionScope, type Read, type Readable, type ReadonlyValue, type SchemaPath, type TableNode, TransactionRejected, type TransactionResult, type TreeNode, type Unsubscribe, type Validator, type ValueTransition, type VariantNode, type VariantShape, asReadable, createDocument, createProjectionRuntime, derive, field, input, list, map, object, observe, optional, parse, read, replace, snapshot, table, tree, variant };
35
57
  //# sourceMappingURL=index.d.ts.map