@microdelta/history 0.0.0 → 0.2.0

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 (79) hide show
  1. package/README.md +30 -4
  2. package/dist/api/history.alpha.d.ts +3 -0
  3. package/dist/api/history.beta.d.ts +3 -0
  4. package/dist/api/history.conformance.store.alpha.d.ts +3 -0
  5. package/dist/api/history.conformance.store.beta.d.ts +3 -0
  6. package/dist/api/history.conformance.store.public.d.ts +3 -0
  7. package/dist/api/history.conformance.store.raw.alpha.d.ts +215 -0
  8. package/dist/api/history.conformance.store.raw.beta.d.ts +215 -0
  9. package/dist/api/history.conformance.store.raw.public.d.ts +215 -0
  10. package/dist/api/history.conformance.store.raw.untrimmed.d.ts +215 -0
  11. package/dist/api/history.conformance.store.untrimmed.d.ts +3 -0
  12. package/dist/api/history.public.d.ts +3 -0
  13. package/dist/api/history.root.raw.alpha.d.ts +1371 -0
  14. package/dist/api/history.root.raw.beta.d.ts +425 -0
  15. package/dist/api/history.root.raw.public.d.ts +425 -0
  16. package/dist/api/history.root.raw.untrimmed.d.ts +1372 -0
  17. package/dist/api/history.shared.alpha.d.ts +1402 -0
  18. package/dist/api/history.shared.beta.d.ts +456 -0
  19. package/dist/api/history.shared.public.d.ts +456 -0
  20. package/dist/api/history.shared.untrimmed.d.ts +1403 -0
  21. package/dist/api/history.untrimmed.d.ts +3 -0
  22. package/dist/api/tsdoc-metadata.json +11 -0
  23. package/dist/src/completed-results.d.ts +99 -0
  24. package/dist/src/completed-results.d.ts.map +1 -0
  25. package/dist/src/completed-results.js +2 -0
  26. package/dist/src/completed-results.js.map +1 -0
  27. package/dist/src/durable/contracts.d.ts +612 -0
  28. package/dist/src/durable/contracts.d.ts.map +1 -0
  29. package/dist/src/durable/contracts.js +2 -0
  30. package/dist/src/durable/contracts.js.map +1 -0
  31. package/dist/src/durable/errors.d.ts +94 -0
  32. package/dist/src/durable/errors.d.ts.map +1 -0
  33. package/dist/src/durable/errors.js +118 -0
  34. package/dist/src/durable/errors.js.map +1 -0
  35. package/dist/src/durable/index.d.ts +9 -0
  36. package/dist/src/durable/index.d.ts.map +1 -0
  37. package/dist/src/durable/index.js +770 -0
  38. package/dist/src/durable/index.js.map +1 -0
  39. package/dist/src/durable/journal.d.ts +53 -0
  40. package/dist/src/durable/journal.d.ts.map +1 -0
  41. package/dist/src/durable/journal.js +174 -0
  42. package/dist/src/durable/journal.js.map +1 -0
  43. package/dist/src/durable/locator.d.ts +31 -0
  44. package/dist/src/durable/locator.d.ts.map +1 -0
  45. package/dist/src/durable/locator.js +50 -0
  46. package/dist/src/durable/locator.js.map +1 -0
  47. package/dist/src/durable/records.d.ts +40 -0
  48. package/dist/src/durable/records.d.ts.map +1 -0
  49. package/dist/src/durable/records.js +74 -0
  50. package/dist/src/durable/records.js.map +1 -0
  51. package/dist/src/durable/schema.d.ts +37 -0
  52. package/dist/src/durable/schema.d.ts.map +1 -0
  53. package/dist/src/durable/schema.js +335 -0
  54. package/dist/src/durable/schema.js.map +1 -0
  55. package/dist/src/durable/selected-index.d.ts +94 -0
  56. package/dist/src/durable/selected-index.d.ts.map +1 -0
  57. package/dist/src/durable/selected-index.js +594 -0
  58. package/dist/src/durable/selected-index.js.map +1 -0
  59. package/dist/src/index.d.ts +28 -0
  60. package/dist/src/index.d.ts.map +1 -0
  61. package/dist/src/index.js +15 -0
  62. package/dist/src/index.js.map +1 -0
  63. package/dist/src/store/index.d.ts +128 -0
  64. package/dist/src/store/index.d.ts.map +1 -0
  65. package/dist/src/store/index.js +33 -0
  66. package/dist/src/store/index.js.map +1 -0
  67. package/dist/src/store/memory/index.d.ts +24 -0
  68. package/dist/src/store/memory/index.d.ts.map +1 -0
  69. package/dist/src/store/memory/index.js +162 -0
  70. package/dist/src/store/memory/index.js.map +1 -0
  71. package/dist/src/types.d.ts +100 -0
  72. package/dist/src/types.d.ts.map +1 -0
  73. package/dist/src/types.js +2 -0
  74. package/dist/src/types.js.map +1 -0
  75. package/dist/test/conformance/store/index.d.ts +34 -0
  76. package/dist/test/conformance/store/index.d.ts.map +1 -0
  77. package/dist/test/conformance/store/index.js +368 -0
  78. package/dist/test/conformance/store/index.js.map +1 -0
  79. package/package.json +48 -8
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Distinct failure classes of the durable History authority. Diagnostics must
3
+ * distinguish stale ownership, conflicting execution identity, invalid
4
+ * lifecycle transitions, unsupported storage, journal compare-and-set
5
+ * conflicts, undeclared journal record versions and integrity failures rather
6
+ * than report a generic miss (execution.md, required validation fixtures).
7
+ * None of these classes extends `TypeError`, so a reader never mistakes a
8
+ * storage failure for Value's rejection of a selection's shape.
9
+ * @packageDocumentation
10
+ */
11
+ /**
12
+ * The store's contents contradict History's invariants or the caller's exact
13
+ * reference: a malformed, missing or wrong-scope reference, a dangling
14
+ * dependency, or index/payload content that does not match its digests.
15
+ * History never repairs such a failure by following a current pointer or
16
+ * recomputing.
17
+ * @alpha
18
+ */
19
+ export declare class HistoryIntegrityError extends Error {
20
+ /** Create an integrity failure with a diagnostic message. */
21
+ constructor(message: string);
22
+ }
23
+ /**
24
+ * The SQLite file does not hold exactly History's supported schema for the
25
+ * requested logical store: unknown, incomplete, foreign or differently
26
+ * versioned storage is rejected before any work rather than migrated by guess.
27
+ * @alpha
28
+ */
29
+ export declare class HistorySchemaError extends Error {
30
+ /** Create a schema rejection with a diagnostic message. */
31
+ constructor(message: string);
32
+ }
33
+ /**
34
+ * A presented writer lease no longer matches the durable holder, fence or
35
+ * unexpired lease, so the mutation was rejected with no change other than the
36
+ * observed clock high-water (PUB-002).
37
+ * @alpha
38
+ */
39
+ export declare class StaleWriterError extends Error {
40
+ /** Create a stale-ownership rejection with a diagnostic message. */
41
+ constructor(message: string);
42
+ }
43
+ /**
44
+ * An attempt key is already bound to a different execution intent, version
45
+ * or scoped subject. The key identifies one execution; it cannot serve another.
46
+ * @alpha
47
+ */
48
+ export declare class AttemptConflictError extends Error {
49
+ /** Create an execution-identity conflict with a diagnostic message. */
50
+ constructor(message: string);
51
+ }
52
+ /**
53
+ * A lifecycle operation was requested from a state that does not permit it,
54
+ * such as staging a completed attempt or publishing one that was never staged.
55
+ * @alpha
56
+ */
57
+ export declare class AttemptStateError extends Error {
58
+ /** Create an invalid-transition rejection with a diagnostic message. */
59
+ constructor(message: string);
60
+ }
61
+ /**
62
+ * The injected clock failed to produce a nonnegative safe-integer epoch
63
+ * millisecond reading, so the time-dependent operation was refused unchanged.
64
+ * @alpha
65
+ */
66
+ export declare class HistoryClockError extends Error {
67
+ /** Create a clock refusal with a diagnostic message. */
68
+ constructor(message: string);
69
+ }
70
+ /**
71
+ * A journal commit's compare-and-set expectation does not hold: the presented
72
+ * expected revision is not the key's current revision (a new-key expectation
73
+ * met an existing key, or an update met a later or absent revision). The
74
+ * whole commit was rolled back unchanged; the caller must re-read before
75
+ * deciding again.
76
+ * @alpha
77
+ */
78
+ export declare class JournalConflictError extends Error {
79
+ /** Create a compare-and-set rejection with a diagnostic message. */
80
+ constructor(message: string);
81
+ }
82
+ /**
83
+ * A journal record's format or format version is not one the journal port
84
+ * declared. On a write the record is refused; on a read or list the stored
85
+ * record is refused rather than returned; a commit over a current revision of
86
+ * an undeclared version is refused rather than overwriting it. History never
87
+ * interprets or converts the content of another format version.
88
+ * @alpha
89
+ */
90
+ export declare class JournalVersionError extends Error {
91
+ /** Create an undeclared-version refusal with a diagnostic message. */
92
+ constructor(message: string);
93
+ }
94
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/durable/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;;;GAOG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,6DAA6D;gBAC1C,OAAO,EAAE,MAAM;CAInC;AAED;;;;;GAKG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,2DAA2D;gBACxC,OAAO,EAAE,MAAM;CAInC;AAED;;;;;GAKG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,oEAAoE;gBACjD,OAAO,EAAE,MAAM;CAInC;AAED;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,uEAAuE;gBACpD,OAAO,EAAE,MAAM;CAInC;AAED;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,wEAAwE;gBACrD,OAAO,EAAE,MAAM;CAInC;AAED;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,wDAAwD;gBACrC,OAAO,EAAE,MAAM;CAInC;AAED;;;;;;;GAOG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,oEAAoE;gBACjD,OAAO,EAAE,MAAM;CAInC;AAED;;;;;;;GAOG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,sEAAsE;gBACnD,OAAO,EAAE,MAAM;CAInC"}
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Distinct failure classes of the durable History authority. Diagnostics must
3
+ * distinguish stale ownership, conflicting execution identity, invalid
4
+ * lifecycle transitions, unsupported storage, journal compare-and-set
5
+ * conflicts, undeclared journal record versions and integrity failures rather
6
+ * than report a generic miss (execution.md, required validation fixtures).
7
+ * None of these classes extends `TypeError`, so a reader never mistakes a
8
+ * storage failure for Value's rejection of a selection's shape.
9
+ * @packageDocumentation
10
+ */
11
+ /**
12
+ * The store's contents contradict History's invariants or the caller's exact
13
+ * reference: a malformed, missing or wrong-scope reference, a dangling
14
+ * dependency, or index/payload content that does not match its digests.
15
+ * History never repairs such a failure by following a current pointer or
16
+ * recomputing.
17
+ * @alpha
18
+ */
19
+ export class HistoryIntegrityError extends Error {
20
+ /** Create an integrity failure with a diagnostic message. */
21
+ constructor(message) {
22
+ super(message);
23
+ this.name = 'HistoryIntegrityError';
24
+ }
25
+ }
26
+ /**
27
+ * The SQLite file does not hold exactly History's supported schema for the
28
+ * requested logical store: unknown, incomplete, foreign or differently
29
+ * versioned storage is rejected before any work rather than migrated by guess.
30
+ * @alpha
31
+ */
32
+ export class HistorySchemaError extends Error {
33
+ /** Create a schema rejection with a diagnostic message. */
34
+ constructor(message) {
35
+ super(message);
36
+ this.name = 'HistorySchemaError';
37
+ }
38
+ }
39
+ /**
40
+ * A presented writer lease no longer matches the durable holder, fence or
41
+ * unexpired lease, so the mutation was rejected with no change other than the
42
+ * observed clock high-water (PUB-002).
43
+ * @alpha
44
+ */
45
+ export class StaleWriterError extends Error {
46
+ /** Create a stale-ownership rejection with a diagnostic message. */
47
+ constructor(message) {
48
+ super(message);
49
+ this.name = 'StaleWriterError';
50
+ }
51
+ }
52
+ /**
53
+ * An attempt key is already bound to a different execution intent, version
54
+ * or scoped subject. The key identifies one execution; it cannot serve another.
55
+ * @alpha
56
+ */
57
+ export class AttemptConflictError extends Error {
58
+ /** Create an execution-identity conflict with a diagnostic message. */
59
+ constructor(message) {
60
+ super(message);
61
+ this.name = 'AttemptConflictError';
62
+ }
63
+ }
64
+ /**
65
+ * A lifecycle operation was requested from a state that does not permit it,
66
+ * such as staging a completed attempt or publishing one that was never staged.
67
+ * @alpha
68
+ */
69
+ export class AttemptStateError extends Error {
70
+ /** Create an invalid-transition rejection with a diagnostic message. */
71
+ constructor(message) {
72
+ super(message);
73
+ this.name = 'AttemptStateError';
74
+ }
75
+ }
76
+ /**
77
+ * The injected clock failed to produce a nonnegative safe-integer epoch
78
+ * millisecond reading, so the time-dependent operation was refused unchanged.
79
+ * @alpha
80
+ */
81
+ export class HistoryClockError extends Error {
82
+ /** Create a clock refusal with a diagnostic message. */
83
+ constructor(message) {
84
+ super(message);
85
+ this.name = 'HistoryClockError';
86
+ }
87
+ }
88
+ /**
89
+ * A journal commit's compare-and-set expectation does not hold: the presented
90
+ * expected revision is not the key's current revision (a new-key expectation
91
+ * met an existing key, or an update met a later or absent revision). The
92
+ * whole commit was rolled back unchanged; the caller must re-read before
93
+ * deciding again.
94
+ * @alpha
95
+ */
96
+ export class JournalConflictError extends Error {
97
+ /** Create a compare-and-set rejection with a diagnostic message. */
98
+ constructor(message) {
99
+ super(message);
100
+ this.name = 'JournalConflictError';
101
+ }
102
+ }
103
+ /**
104
+ * A journal record's format or format version is not one the journal port
105
+ * declared. On a write the record is refused; on a read or list the stored
106
+ * record is refused rather than returned; a commit over a current revision of
107
+ * an undeclared version is refused rather than overwriting it. History never
108
+ * interprets or converts the content of another format version.
109
+ * @alpha
110
+ */
111
+ export class JournalVersionError extends Error {
112
+ /** Create an undeclared-version refusal with a diagnostic message. */
113
+ constructor(message) {
114
+ super(message);
115
+ this.name = 'JournalVersionError';
116
+ }
117
+ }
118
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/durable/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;;;GAOG;AACH,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC9C,6DAA6D;IAC7D,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC3C,2DAA2D;IAC3D,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACzC,oEAAoE;IACpE,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,uEAAuE;IACvE,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,wEAAwE;IACxE,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,wDAAwD;IACxD,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,oEAAoE;IACpE,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5C,sEAAsE;IACtE,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF"}
@@ -0,0 +1,9 @@
1
+ import type { IDurableHistory, IDurableHistoryOptions } from './contracts.js';
2
+ /**
3
+ * Open (creating when empty) the durable History store for one logical store.
4
+ * The file is rejected before any work unless it is empty or holds exactly
5
+ * this schema version for this logical store.
6
+ * @alpha
7
+ */
8
+ export declare function openDurableHistory(options: IDurableHistoryOptions): IDurableHistory;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/durable/index.ts"],"names":[],"mappings":"AAyCA,OAAO,KAAK,EAQV,eAAe,EACf,sBAAsB,EAiBvB,MAAM,gBAAgB,CAAC;AAyDxB;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,sBAAsB,GAAG,eAAe,CAguBnF"}