doxum 0.1.7 → 0.1.9

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 (70) hide show
  1. package/README.md +217 -296
  2. package/dist/contract-BNStLbSE.d.ts +441 -0
  3. package/dist/contract-CIU5FCC1.d.cts +441 -0
  4. package/dist/driver-BlR81Dqg.js +200 -0
  5. package/dist/driver-BlR81Dqg.js.map +1 -0
  6. package/dist/driver-xOIkwrB8.cjs +241 -0
  7. package/dist/driver-xOIkwrB8.cjs.map +1 -0
  8. package/dist/index.cjs +666 -2222
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.d.cts +10 -20
  11. package/dist/index.d.ts +10 -18
  12. package/dist/index.js +634 -2189
  13. package/dist/index.js.map +1 -1
  14. package/dist/{integration-CZwCwFBS.cjs → integration-C87tjRop.cjs} +4 -9
  15. package/dist/integration-C87tjRop.cjs.map +1 -0
  16. package/dist/{integration-B56u1l9V.js → integration-D5XCBLJ8.js} +2 -7
  17. package/dist/integration-D5XCBLJ8.js.map +1 -0
  18. package/dist/integration.cjs +11 -11
  19. package/dist/integration.d.cts +10 -4
  20. package/dist/integration.d.ts +10 -4
  21. package/dist/integration.js +4 -3
  22. package/dist/issue-DVaGQGeP.js +576 -0
  23. package/dist/issue-DVaGQGeP.js.map +1 -0
  24. package/dist/issue-DhrNdQNg.cjs +797 -0
  25. package/dist/issue-DhrNdQNg.cjs.map +1 -0
  26. package/dist/local-sync.cjs +67 -39
  27. package/dist/local-sync.cjs.map +1 -1
  28. package/dist/local-sync.d.cts +10 -10
  29. package/dist/local-sync.d.ts +10 -10
  30. package/dist/local-sync.js +66 -38
  31. package/dist/local-sync.js.map +1 -1
  32. package/dist/react.cjs +23 -4
  33. package/dist/react.cjs.map +1 -1
  34. package/dist/react.d.cts +8 -3
  35. package/dist/react.d.ts +8 -3
  36. package/dist/react.js +21 -6
  37. package/dist/react.js.map +1 -1
  38. package/dist/store-1Uob0Ghk.cjs +2750 -0
  39. package/dist/store-1Uob0Ghk.cjs.map +1 -0
  40. package/dist/store-CD0KdGsq.d.cts +262 -0
  41. package/dist/store-D7QH6Rzw.js +2511 -0
  42. package/dist/store-D7QH6Rzw.js.map +1 -0
  43. package/dist/store-cp5CpfCy.d.ts +262 -0
  44. package/package.json +1 -1
  45. package/skills/doxum-runtime/SKILL.md +26 -44
  46. package/skills/doxum-runtime/references/guide.en.md +95 -359
  47. package/skills/doxum-runtime/references/guide.zh-CN.md +80 -285
  48. package/skills/doxum-runtime/references/invariants.en.md +42 -165
  49. package/skills/doxum-runtime/references/invariants.zh-CN.md +34 -97
  50. package/skills/doxum-runtime/references/patterns.en.md +73 -225
  51. package/skills/doxum-runtime/references/patterns.zh-CN.md +73 -179
  52. package/dist/chunk-pbuEa-1d.js +0 -13
  53. package/dist/contract-DNZ4D53r.d.ts +0 -563
  54. package/dist/contract-j3SLGAwh.d.cts +0 -563
  55. package/dist/driver-CNxqMVFH.cjs +0 -69
  56. package/dist/driver-CNxqMVFH.cjs.map +0 -1
  57. package/dist/driver-CbzfW5MR.js +0 -46
  58. package/dist/driver-CbzfW5MR.js.map +0 -1
  59. package/dist/integration-B56u1l9V.js.map +0 -1
  60. package/dist/integration-CZwCwFBS.cjs.map +0 -1
  61. package/dist/ownership-CY0nPXGF.cjs +0 -304
  62. package/dist/ownership-CY0nPXGF.cjs.map +0 -1
  63. package/dist/ownership-CduRygE7.js +0 -245
  64. package/dist/ownership-CduRygE7.js.map +0 -1
  65. package/dist/runtime-0mOFbe_H.cjs +0 -2439
  66. package/dist/runtime-0mOFbe_H.cjs.map +0 -1
  67. package/dist/runtime-B22tuj9A.d.cts +0 -150
  68. package/dist/runtime-BFmhzPpZ.d.ts +0 -150
  69. package/dist/runtime-DF1q9Gje.js +0 -2129
  70. package/dist/runtime-DF1q9Gje.js.map +0 -1
@@ -1,150 +0,0 @@
1
- import { A as CollectionImpact, H as CollectionReader, Rt as SchemaPath, W as DocumentReader, _ as Unsubscribe, _t as CollectionNode, h as Synchronous, jt as ImpactTarget, kt as EntitySchemaNode, n as DocumentCommit, o as DocumentReadable, q as ReaderOfNode, v as Readable, vt as CollectionPath, wt as DocumentSchema, yt as CollectionSelector } from "./contract-DNZ4D53r.js";
2
-
3
- //#region core/src/projection/contract.d.ts
4
- declare const sourceContext: unique symbol;
5
- type ProjectionSource<T> = {
6
- readonly [sourceContext]: T;
7
- };
8
- type ProjectionSources = Readonly<Record<string, ProjectionSource<unknown>>>;
9
- type ProjectionInputs<S extends ProjectionSources> = { readonly [K in keyof S]: S[K] extends ProjectionSource<infer T> ? T : never };
10
- type DocumentInput<S extends DocumentSchema> = {
11
- readonly read: DocumentReader<S>;
12
- readonly revision: number;
13
- readonly commits: readonly DocumentCommit<S>[];
14
- readonly reset: boolean;
15
- };
16
- type DocumentCollectionInput<S extends DocumentSchema, N extends EntitySchemaNode> = {
17
- readonly read: CollectionReader<string, N>;
18
- readonly target: CollectionSelector<string, N>;
19
- readonly revision: number;
20
- readonly commits: readonly DocumentCommit<S>[];
21
- readonly reset: boolean;
22
- readonly candidates: {
23
- readonly keys: readonly string[];
24
- readonly orderDirty: boolean;
25
- };
26
- };
27
- type DocumentSource<S extends DocumentSchema> = ProjectionSource<DocumentInput<S>> & {
28
- collection<P extends CollectionPath>(pick: (path: SchemaPath<S['shape']>) => P): DocumentCollectionSource<S, CollectionNode<P>>;
29
- targets(...targets: readonly [ImpactTarget, ...ImpactTarget[]]): ProjectionSource<DocumentInput<S>>;
30
- };
31
- type DocumentCollectionSource<S extends DocumentSchema, N extends EntitySchemaNode> = ProjectionSource<DocumentCollectionInput<S, N>>;
32
- type ValueInput<T> = {
33
- readonly value: T;
34
- readonly previous: T;
35
- readonly changed: boolean;
36
- readonly revision: number;
37
- readonly reset: boolean;
38
- };
39
- type ProjectionInput<T> = {
40
- readonly source: ProjectionSource<ValueInput<T>>;
41
- set(value: T): void;
42
- };
43
- type ValueUpdate<T> = {
44
- readonly kind: 'unchanged';
45
- } | {
46
- readonly kind: 'changed';
47
- readonly value: T;
48
- } | {
49
- readonly kind: 'rebuild';
50
- };
51
- type ValueSpec<S extends ProjectionSources, T> = {
52
- readonly name?: string;
53
- readonly sources: S;
54
- readonly build: (sources: ProjectionInputs<S>) => {
55
- readonly value: T;
56
- readonly update: (sources: ProjectionInputs<S>) => ValueUpdate<NoInfer<T>>;
57
- };
58
- };
59
- type ProjectionValue<T> = Readable<T> & ProjectionSource<ValueInput<T>> & {
60
- rebuild(): void;
61
- dispose(): void;
62
- };
63
- type CollectionRead<K extends string, V> = {
64
- get(key: K): V | undefined;
65
- has(key: K): boolean;
66
- ids(): readonly K[];
67
- };
68
- type CollectionInput<K extends string, V> = CollectionRead<K, V> & {
69
- readonly change: CollectionImpact<K> | undefined;
70
- readonly revision: number;
71
- readonly reset: boolean;
72
- };
73
- type ProjectionCollection<K extends string, V> = ProjectionSource<CollectionInput<K, V>> & {
74
- readonly ids: Readable<readonly K[]>;
75
- readonly all: Readable<readonly V[]>;
76
- item(key: K): Readable<V | undefined>;
77
- revision(): number;
78
- subscribe(listener: (change: CollectionImpact<K>) => void): Unsubscribe;
79
- rebuild(): void;
80
- dispose(): void;
81
- };
82
- type ProjectionCollectionWriter<K extends string, V> = {
83
- set(key: K, value: V): void;
84
- remove(key: K): void;
85
- order(ids: readonly K[]): void;
86
- replace(entries: readonly (readonly [K, V])[]): void;
87
- };
88
- type CollectionProcess<S extends ProjectionSources, K extends string, V> = {
89
- readonly sources: ProjectionInputs<S>;
90
- readonly previous: CollectionRead<K, V>;
91
- readonly next: CollectionRead<K, V>;
92
- readonly writer: ProjectionCollectionWriter<K, V>;
93
- };
94
- type CollectionSpec<S extends ProjectionSources, K extends string, V> = {
95
- readonly name?: string;
96
- readonly sources: S;
97
- readonly isEqual?: (previous: V, next: V) => boolean;
98
- readonly build: (input: CollectionProcess<S, K, V>) => {
99
- readonly update: (input: CollectionProcess<S, K, V>) => void | {
100
- readonly kind: 'rebuild';
101
- };
102
- };
103
- };
104
- declare class ProjectionError extends Error {
105
- readonly phase: 'processor' | 'listener' | 'source' | 'blocked';
106
- readonly identity: string;
107
- readonly revisions: readonly number[];
108
- constructor(phase: 'processor' | 'listener' | 'source' | 'blocked', identity: string, revisions: readonly number[], cause: unknown);
109
- }
110
- declare class ProjectionDisposedError extends Error {
111
- constructor();
112
- }
113
- type ProjectionRuntime = {
114
- document<S extends DocumentSchema>(runtime: DocumentReadable<S>): DocumentSource<S>;
115
- fromReadable<T>(readable: Readable<T>, options?: {
116
- readonly isEqual?: (a: T, b: T) => boolean;
117
- }): ProjectionSource<ValueInput<T>>;
118
- input<T>(initial: T, options?: {
119
- readonly isEqual?: (a: T, b: T) => boolean;
120
- }): ProjectionInput<T>;
121
- value<S extends ProjectionSources, T>(sources: S, compute: (sources: ProjectionInputs<S>) => Synchronous<T>, options?: {
122
- readonly isEqual?: (a: NoInfer<T>, b: NoInfer<T>) => boolean;
123
- }): ProjectionValue<T>;
124
- value<S extends ProjectionSources, T>(spec: ValueSpec<S, T>, options?: {
125
- readonly isEqual?: (a: NoInfer<T>, b: NoInfer<T>) => boolean;
126
- }): ProjectionValue<T>;
127
- collection<V, K extends string = string>(): <S extends ProjectionSources>(spec: CollectionSpec<S, K, V>) => ProjectionCollection<K, V>;
128
- map<S extends DocumentSchema, N extends EntitySchemaNode, V>(source: DocumentCollectionSource<S, N>, mapper: (id: string, entry: ReaderOfNode<N>) => Synchronous<V>, options?: {
129
- readonly isEqual?: (a: V, b: V) => boolean;
130
- }): ProjectionCollection<string, V>;
131
- map<K extends string, V, R>(source: ProjectionCollection<K, V>, mapper: (id: K, entry: V) => Synchronous<R>, options?: {
132
- readonly isEqual?: (a: NoInfer<R>, b: NoInfer<R>) => boolean;
133
- }): ProjectionCollection<K, R>;
134
- batch<T>(run: () => Synchronous<T>): T;
135
- dispose(): void;
136
- };
137
- //#endregion
138
- //#region core/src/projection/runtime.d.ts
139
- declare const projectionDebug: (runtime: ProjectionRuntime) => Readonly<{
140
- nodes: number;
141
- sources: number;
142
- subscriptions: number;
143
- pending: number;
144
- }>;
145
- declare const createProjectionRuntime: (options: {
146
- readonly onError: (error: ProjectionError) => void;
147
- }) => ProjectionRuntime;
148
- //#endregion
149
- export { DocumentSource as a, ProjectionError as c, ProjectionSource as d, ProjectionValue as f, DocumentCollectionSource as i, ProjectionInput as l, projectionDebug as n, ProjectionCollection as o, ValueSpec as p, CollectionSpec as r, ProjectionDisposedError as s, createProjectionRuntime as t, ProjectionRuntime as u };
150
- //# sourceMappingURL=runtime-BFmhzPpZ.d.ts.map