@sekiban/dcb-runtime 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 (153) hide show
  1. package/LICENSE +86 -0
  2. package/README.md +13 -0
  3. package/dist/allocator/AllocatorDurableObject.d.ts +36 -0
  4. package/dist/allocator/AllocatorDurableObject.js +658 -0
  5. package/dist/allocator/IssuanceLedger.d.ts +188 -0
  6. package/dist/allocator/IssuanceLedger.js +608 -0
  7. package/dist/allocator/IssuanceReconciler.d.ts +41 -0
  8. package/dist/allocator/IssuanceReconciler.js +191 -0
  9. package/dist/allocator/OrderClock.d.ts +41 -0
  10. package/dist/allocator/OrderClock.js +92 -0
  11. package/dist/allocator/SortableUniqueId.d.ts +46 -0
  12. package/dist/allocator/SortableUniqueId.js +156 -0
  13. package/dist/allocator/types.d.ts +52 -0
  14. package/dist/allocator/types.js +1 -0
  15. package/dist/bootstrap/BootstrapCoordinatorDurableObject.d.ts +28 -0
  16. package/dist/bootstrap/BootstrapCoordinatorDurableObject.js +357 -0
  17. package/dist/bootstrap/BootstrapStoreAdapter.d.ts +51 -0
  18. package/dist/bootstrap/BootstrapStoreAdapter.js +162 -0
  19. package/dist/bootstrap/OperatorBootstrap.d.ts +20 -0
  20. package/dist/bootstrap/OperatorBootstrap.js +104 -0
  21. package/dist/bootstrap/manifest.d.ts +9 -0
  22. package/dist/bootstrap/manifest.js +115 -0
  23. package/dist/bootstrap/types.d.ts +75 -0
  24. package/dist/bootstrap/types.js +1 -0
  25. package/dist/cli/OperatorRepairCli.d.ts +11 -0
  26. package/dist/cli/OperatorRepairCli.js +108 -0
  27. package/dist/cloudflare.d.ts +164 -0
  28. package/dist/cloudflare.js +19487 -0
  29. package/dist/commit/CommitWorker.d.ts +101 -0
  30. package/dist/commit/CommitWorker.js +921 -0
  31. package/dist/commit/types.d.ts +25 -0
  32. package/dist/commit/types.js +13 -0
  33. package/dist/completeness/GlobalCompletenessReconciler.d.ts +77 -0
  34. package/dist/completeness/GlobalCompletenessReconciler.js +572 -0
  35. package/dist/completeness/types.d.ts +85 -0
  36. package/dist/completeness/types.js +6 -0
  37. package/dist/composition.d.ts +123 -0
  38. package/dist/composition.js +237 -0
  39. package/dist/cosmos.d.ts +11 -0
  40. package/dist/cosmos.js +1411 -0
  41. package/dist/d1-mv.d.ts +8 -0
  42. package/dist/d1-mv.js +2001 -0
  43. package/dist/d1.d.ts +16 -0
  44. package/dist/d1.js +3418 -0
  45. package/dist/diagnostics/G60DurableHop.d.ts +99 -0
  46. package/dist/diagnostics/G60DurableHop.js +248 -0
  47. package/dist/diagnostics/G65Admission.d.ts +23 -0
  48. package/dist/diagnostics/G65Admission.js +43 -0
  49. package/dist/diagnostics/G65DirectRing.d.ts +33 -0
  50. package/dist/diagnostics/G65DirectRing.js +85 -0
  51. package/dist/diagnostics/G69AdmissionAttempt.d.ts +43 -0
  52. package/dist/diagnostics/G69AdmissionAttempt.js +22 -0
  53. package/dist/downstream/DeliveryCore.d.ts +127 -0
  54. package/dist/downstream/DeliveryCore.js +304 -0
  55. package/dist/downstream/Doorbell.d.ts +43 -0
  56. package/dist/downstream/Doorbell.js +137 -0
  57. package/dist/downstream/DownstreamAdapter.d.ts +52 -0
  58. package/dist/downstream/DownstreamAdapter.js +299 -0
  59. package/dist/downstream/ExclusionLookup.d.ts +36 -0
  60. package/dist/downstream/ExclusionLookup.js +50 -0
  61. package/dist/downstream/InconsistencyDetector.d.ts +27 -0
  62. package/dist/downstream/InconsistencyDetector.js +82 -0
  63. package/dist/downstream/OutboxDrain.d.ts +35 -0
  64. package/dist/downstream/OutboxDrain.js +126 -0
  65. package/dist/downstream/types.d.ts +77 -0
  66. package/dist/downstream/types.js +64 -0
  67. package/dist/eventIdentity.d.ts +30 -0
  68. package/dist/eventIdentity.js +49 -0
  69. package/dist/eventRecord.d.ts +26 -0
  70. package/dist/eventRecord.js +53 -0
  71. package/dist/g42-probe.d.ts +9 -0
  72. package/dist/g42-probe.js +9 -0
  73. package/dist/http/SerializedQueryWorker.d.ts +58 -0
  74. package/dist/http/SerializedQueryWorker.js +497 -0
  75. package/dist/http/commitResponse.d.ts +46 -0
  76. package/dist/http/commitResponse.js +80 -0
  77. package/dist/http/testServiceId.d.ts +17 -0
  78. package/dist/http/testServiceId.js +14 -0
  79. package/dist/index.d.ts +112 -0
  80. package/dist/index.js +19926 -0
  81. package/dist/journal/JournalDurableObject.d.ts +30 -0
  82. package/dist/journal/JournalDurableObject.js +481 -0
  83. package/dist/journal/JournalFirstTouchProbe.d.ts +190 -0
  84. package/dist/journal/JournalFirstTouchProbe.js +375 -0
  85. package/dist/journal/types.d.ts +116 -0
  86. package/dist/journal/types.js +52 -0
  87. package/dist/mv/MaterializedViewCatchUp.d.ts +60 -0
  88. package/dist/mv/MaterializedViewCatchUp.js +353 -0
  89. package/dist/mv/MaterializedViewRuntime.d.ts +80 -0
  90. package/dist/mv/MaterializedViewRuntime.js +328 -0
  91. package/dist/mv/MaterializedViewStore.d.ts +257 -0
  92. package/dist/mv/MaterializedViewStore.js +875 -0
  93. package/dist/mv/UnsafeWindowMaterializedView.d.ts +112 -0
  94. package/dist/mv/UnsafeWindowMaterializedView.js +495 -0
  95. package/dist/mv/index.d.ts +8 -0
  96. package/dist/mv/index.js +2357 -0
  97. package/dist/projection/LiveProjectionWorker.d.ts +86 -0
  98. package/dist/projection/LiveProjectionWorker.js +240 -0
  99. package/dist/projection/ProjectionRuntime.d.ts +113 -0
  100. package/dist/projection/ProjectionRuntime.js +346 -0
  101. package/dist/projection/ProjectorRegistry.d.ts +51 -0
  102. package/dist/projection/ProjectorRegistry.js +116 -0
  103. package/dist/query/ProjectionQueryStore.d.ts +102 -0
  104. package/dist/query/ProjectionQueryStore.js +185 -0
  105. package/dist/query/QueryRegistry.d.ts +22 -0
  106. package/dist/query/QueryRegistry.js +36 -0
  107. package/dist/read/SerializedReadWorker.d.ts +36 -0
  108. package/dist/read/SerializedReadWorker.js +225 -0
  109. package/dist/repair/RepairWorker.d.ts +72 -0
  110. package/dist/repair/RepairWorker.js +461 -0
  111. package/dist/safeWindow.d.ts +20 -0
  112. package/dist/safeWindow.js +36 -0
  113. package/dist/scope/ControlRouteScope.d.ts +22 -0
  114. package/dist/scope/ControlRouteScope.js +36 -0
  115. package/dist/scope/ScopeName.d.ts +34 -0
  116. package/dist/scope/ScopeName.js +67 -0
  117. package/dist/service/ServiceIdentityProvider.d.ts +35 -0
  118. package/dist/service/ServiceIdentityProvider.js +56 -0
  119. package/dist/store/CosmosEventStore.d.ts +126 -0
  120. package/dist/store/CosmosEventStore.js +950 -0
  121. package/dist/store/D1EventStore.d.ts +111 -0
  122. package/dist/store/D1EventStore.js +1111 -0
  123. package/dist/store/PostgresEventStore.d.ts +35 -0
  124. package/dist/store/PostgresEventStore.js +811 -0
  125. package/dist/store/provider.d.ts +25 -0
  126. package/dist/store/provider.js +32 -0
  127. package/dist/store/types.d.ts +205 -0
  128. package/dist/store/types.js +18 -0
  129. package/dist/tag/EventDigest.d.ts +40 -0
  130. package/dist/tag/EventDigest.js +158 -0
  131. package/dist/tag/TagDurableObject.d.ts +286 -0
  132. package/dist/tag/TagDurableObject.js +4071 -0
  133. package/dist/tag/TagSqlMeasurement.d.ts +26 -0
  134. package/dist/tag/TagSqlMeasurement.js +44 -0
  135. package/dist/tag/TagSqlSchema.d.ts +29 -0
  136. package/dist/tag/TagSqlSchema.js +211 -0
  137. package/dist/tag/types.d.ts +173 -0
  138. package/dist/tag/types.js +3 -0
  139. package/dist/tagstate/TagStateDurableObject.d.ts +57 -0
  140. package/dist/tagstate/TagStateDurableObject.js +499 -0
  141. package/dist/trace/AttributionRatio.d.ts +12 -0
  142. package/dist/trace/AttributionRatio.js +68 -0
  143. package/dist/trace/CloudflareTracing.d.ts +7 -0
  144. package/dist/trace/CloudflareTracing.js +9 -0
  145. package/dist/trace/CommitTrace.d.ts +405 -0
  146. package/dist/trace/CommitTrace.js +1008 -0
  147. package/dist/trace/CommitTraceConsoleSink.d.ts +68 -0
  148. package/dist/trace/CommitTraceConsoleSink.js +114 -0
  149. package/dist/trace/CommitTraceVerifier.d.ts +22 -0
  150. package/dist/trace/CommitTraceVerifier.js +295 -0
  151. package/dist/trace/ObservationStream.d.ts +118 -0
  152. package/dist/trace/ObservationStream.js +148 -0
  153. package/package.json +71 -0
package/LICENSE ADDED
@@ -0,0 +1,86 @@
1
+ Elastic License 2.0
2
+
3
+ Acceptance
4
+
5
+ By using the software, you agree to all of the terms and conditions below.
6
+
7
+ Copyright License
8
+
9
+ The licensor grants you a license, under any patent claims the licensor can
10
+ license, or becomes able to license, to make, have made, use, sell, offer for
11
+ sale, import and have imported the software, in each case subject to the
12
+ limitations and conditions in this license. This license does not cover any
13
+ patent claims that you cause to be infringed by modifications or additions to
14
+ the software.
15
+
16
+ Limitations
17
+
18
+ You may not provide the software to third parties as a hosted or managed
19
+ service, where the service provides users with access to any substantial set
20
+ of the features or functionality of the software.
21
+
22
+ You may not move, change, disable, or circumvent the license key functionality
23
+ in the software, and you may not remove or obscure any functionality in the
24
+ software that is protected by the license key.
25
+
26
+ You may not alter, remove, or obscure any licensing, copyright, or other
27
+ notices of the licensor in the software. Any use of the licensor's trademarks
28
+ is subject to applicable law.
29
+
30
+ If you or your company make any written claim that the software infringes or
31
+ contributes to infringement of any patent, your patent license for the
32
+ software granted under these terms ends immediately. If your company makes
33
+ such a claim, your patent license ends immediately for work on behalf of your
34
+ company.
35
+
36
+ Notices
37
+
38
+ You must ensure that anyone who gets a copy of any part of the software from
39
+ you also gets a copy of these terms.
40
+
41
+ If you modify the software, you must include in any modified copies of the
42
+ software prominent notices stating that you have modified the software.
43
+
44
+ No Other Rights
45
+
46
+ These terms do not imply any licenses other than those expressly granted in
47
+ this license.
48
+
49
+ Termination
50
+
51
+ If you use the software in violation of this license, such use is not
52
+ licensed, and your licenses will automatically terminate. If the licensor
53
+ provides you with a notice of your violation, and you cease all violation of
54
+ this license no later than 30 days after you receive that notice, your
55
+ licenses will be reinstated retroactively. However, if you violate this
56
+ license after reinstatement, any additional violation will cause your licenses
57
+ to terminate automatically and permanently.
58
+
59
+ No Liability
60
+
61
+ As far as the law allows, the software comes as is, without any warranty or
62
+ condition, and the licensor will not be liable to you for any damages arising
63
+ out of the terms or use of the software, under any kind of legal claim.
64
+
65
+ Definitions
66
+
67
+ The licensor is the entity offering these terms, and the software is the
68
+ software the licensor makes available under these terms, including any part
69
+ of it.
70
+
71
+ you refers to the individual or entity agreeing to these terms.
72
+
73
+ your company is any legal entity, sole proprietorship, or other kind of
74
+ organization that you work for, plus all organizations that have control over,
75
+ are under the control of, or are under common control with that organization.
76
+
77
+ control means ownership of substantially all the assets of an entity, or the
78
+ power to direct its management and policies by vote, contract, or otherwise.
79
+ Control can be direct or indirect.
80
+
81
+ your licenses are all the licenses granted to you for the software under
82
+ these terms.
83
+
84
+ use means anything you do with the software requiring one of your licenses.
85
+
86
+ trademark means trademarks, service marks, and similar rights.
package/README.md ADDED
@@ -0,0 +1,13 @@
1
+ # @sekiban/dcb-runtime
2
+
3
+ Cloudflare Durable Object and HTTP runtime for Serialized DCB V1.
4
+
5
+ This package is the matched-set runtime companion to `@sekiban/dcb-core`,
6
+ `@sekiban/dcb-domain`, and `@sekiban/dcb-client`. Consumers such as the
7
+ meeting-room Cloudflare sample import public entry points (`@sekiban/dcb-runtime`,
8
+ `@sekiban/dcb-runtime/cloudflare`, `/d1`, `/d1-mv`, `/mv`, `/cosmos`) and re-export
9
+ Durable Object classes from their Worker module graph as Cloudflare requires.
10
+
11
+ ## License
12
+
13
+ Elastic License 2.0. See [LICENSE](./LICENSE).
@@ -0,0 +1,36 @@
1
+ import { type OrderClock } from "./OrderClock";
2
+ import { type NativeTracing } from "../trace/CommitTrace";
3
+ export declare function decodeSuid(suid: string): bigint;
4
+ export declare function nextSuids(watermark: string | null, count: number, clockTick: bigint): string[];
5
+ /**
6
+ * A single service-wide allocator. Every allocation uses this one Durable
7
+ * Object instance, so the transaction that writes an attempt vector and the
8
+ * allocated watermark is serialized and atomic.
9
+ */
10
+ export declare class AllocatorDurableObject implements DurableObject {
11
+ private readonly ctx;
12
+ private readonly env?;
13
+ private readonly orderClock;
14
+ private readonly nativeTracing;
15
+ /** Observation-only; it is never serialized into Durable Object storage. */
16
+ private readonly activation;
17
+ constructor(ctx: DurableObjectState, env?: {
18
+ BOOTSTRAP?: DurableObjectNamespace;
19
+ TAG?: DurableObjectNamespace;
20
+ ALLOCATOR?: DurableObjectNamespace;
21
+ } | undefined, orderClock?: OrderClock, nativeTracing?: NativeTracing);
22
+ alarm(): Promise<void>;
23
+ private rearmIssuanceRecoveryIfNeeded;
24
+ private serviceIdFromState;
25
+ fetch(request: Request): Promise<Response>;
26
+ private registrationStatus;
27
+ private certificateSnapshot;
28
+ private resolveTarget;
29
+ private pageLegacyInventory;
30
+ private completeMigrationProof;
31
+ private reconcileNow;
32
+ private installMigrationCut;
33
+ private allocate;
34
+ /** One transaction: only a never-used allocator can establish bootstrap successor state. */
35
+ private seedAfter;
36
+ }