rivetkit 2.0.27 → 2.0.28

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 (124) hide show
  1. package/dist/schemas/file-system-driver/v3.ts +167 -0
  2. package/dist/tsup/{chunk-4GJQDTAG.cjs → chunk-3ZC6SBX6.cjs} +652 -329
  3. package/dist/tsup/chunk-3ZC6SBX6.cjs.map +1 -0
  4. package/dist/tsup/{chunk-D7A47BVR.js → chunk-7IAEY5UZ.js} +2 -2
  5. package/dist/tsup/{chunk-6F2NCX7R.js → chunk-AE7BB3M2.js} +2 -2
  6. package/dist/tsup/{chunk-XU4GGB6J.js → chunk-AHPMXTSB.js} +503 -180
  7. package/dist/tsup/chunk-AHPMXTSB.js.map +1 -0
  8. package/dist/tsup/{chunk-XNKWXMIT.cjs → chunk-CJLXW36F.cjs} +768 -292
  9. package/dist/tsup/chunk-CJLXW36F.cjs.map +1 -0
  10. package/dist/tsup/chunk-DATRTJVZ.js +891 -0
  11. package/dist/tsup/chunk-DATRTJVZ.js.map +1 -0
  12. package/dist/tsup/{chunk-C3UREFUI.js → chunk-EJXISR3H.js} +14 -5
  13. package/dist/tsup/chunk-EJXISR3H.js.map +1 -0
  14. package/dist/tsup/{chunk-GUH2PNPG.js → chunk-IDYDUETM.js} +3 -3
  15. package/dist/tsup/{chunk-2NNICHGY.js → chunk-ILK4JEMF.js} +2 -2
  16. package/dist/tsup/chunk-JALGQWHW.cjs +129 -0
  17. package/dist/tsup/chunk-JALGQWHW.cjs.map +1 -0
  18. package/dist/tsup/{chunk-BBTOBXEO.js → chunk-KXSSOVFA.js} +578 -102
  19. package/dist/tsup/chunk-KXSSOVFA.js.map +1 -0
  20. package/dist/tsup/{chunk-DRJCTDDT.cjs → chunk-M54KFQQP.cjs} +18 -9
  21. package/dist/tsup/chunk-M54KFQQP.cjs.map +1 -0
  22. package/dist/tsup/chunk-NQZ643FB.cjs +891 -0
  23. package/dist/tsup/chunk-NQZ643FB.cjs.map +1 -0
  24. package/dist/tsup/{chunk-LZADH4QA.cjs → chunk-NR2N4UA2.cjs} +10 -10
  25. package/dist/tsup/{chunk-LZADH4QA.cjs.map → chunk-NR2N4UA2.cjs.map} +1 -1
  26. package/dist/tsup/{chunk-KSQQU7NC.js → chunk-S5URQ3CI.js} +7 -6
  27. package/dist/tsup/chunk-S5URQ3CI.js.map +1 -0
  28. package/dist/tsup/{chunk-QC4AE54W.cjs → chunk-VQRYS6VW.cjs} +3 -3
  29. package/dist/tsup/{chunk-QC4AE54W.cjs.map → chunk-VQRYS6VW.cjs.map} +1 -1
  30. package/dist/tsup/{chunk-TJ2PJ5C7.cjs → chunk-Y2AKEZRY.cjs} +3 -3
  31. package/dist/tsup/{chunk-TJ2PJ5C7.cjs.map → chunk-Y2AKEZRY.cjs.map} +1 -1
  32. package/dist/tsup/{chunk-F3SQLO3X.cjs → chunk-Y5LN2XRH.cjs} +7 -6
  33. package/dist/tsup/chunk-Y5LN2XRH.cjs.map +1 -0
  34. package/dist/tsup/{chunk-G7YZSSWV.cjs → chunk-YW2E3UPH.cjs} +6 -6
  35. package/dist/tsup/{chunk-G7YZSSWV.cjs.map → chunk-YW2E3UPH.cjs.map} +1 -1
  36. package/dist/tsup/{chunk-VRZNWBDK.js → chunk-ZL3SUOIM.js} +45 -46
  37. package/dist/tsup/chunk-ZL3SUOIM.js.map +1 -0
  38. package/dist/tsup/client/mod.cjs +8 -8
  39. package/dist/tsup/client/mod.d.cts +3 -2
  40. package/dist/tsup/client/mod.d.ts +3 -2
  41. package/dist/tsup/client/mod.js +7 -7
  42. package/dist/tsup/common/log.cjs +2 -2
  43. package/dist/tsup/common/log.d.cts +9 -1
  44. package/dist/tsup/common/log.d.ts +9 -1
  45. package/dist/tsup/common/log.js +1 -1
  46. package/dist/tsup/common/websocket.cjs +3 -3
  47. package/dist/tsup/common/websocket.js +2 -2
  48. package/dist/tsup/{config-Bo-blHpJ.d.ts → config-CcMdKDv9.d.ts} +301 -899
  49. package/dist/tsup/{config-BRDYDraU.d.cts → config-DxlmiJS1.d.cts} +301 -899
  50. package/dist/tsup/driver-helpers/mod.cjs +4 -4
  51. package/dist/tsup/driver-helpers/mod.d.cts +2 -1
  52. package/dist/tsup/driver-helpers/mod.d.ts +2 -1
  53. package/dist/tsup/driver-helpers/mod.js +3 -3
  54. package/dist/tsup/driver-test-suite/mod.cjs +71 -71
  55. package/dist/tsup/driver-test-suite/mod.d.cts +2 -1
  56. package/dist/tsup/driver-test-suite/mod.d.ts +2 -1
  57. package/dist/tsup/driver-test-suite/mod.js +10 -10
  58. package/dist/tsup/inspector/mod.cjs +5 -5
  59. package/dist/tsup/inspector/mod.d.cts +5 -4
  60. package/dist/tsup/inspector/mod.d.ts +5 -4
  61. package/dist/tsup/inspector/mod.js +4 -4
  62. package/dist/tsup/mod.cjs +9 -9
  63. package/dist/tsup/mod.d.cts +3 -2
  64. package/dist/tsup/mod.d.ts +3 -2
  65. package/dist/tsup/mod.js +8 -8
  66. package/dist/tsup/test/mod.cjs +11 -10
  67. package/dist/tsup/test/mod.cjs.map +1 -1
  68. package/dist/tsup/test/mod.d.cts +2 -6
  69. package/dist/tsup/test/mod.d.ts +2 -6
  70. package/dist/tsup/test/mod.js +10 -9
  71. package/dist/tsup/utils.cjs +2 -2
  72. package/dist/tsup/utils.js +1 -1
  73. package/package.json +7 -6
  74. package/src/actor/config.ts +21 -20
  75. package/src/actor/conn/mod.ts +5 -1
  76. package/src/actor/instance/connection-manager.ts +5 -1
  77. package/src/actor/instance/event-manager.ts +5 -1
  78. package/src/actor/instance/state-manager.ts +19 -3
  79. package/src/actor/protocol/old.ts +3 -0
  80. package/src/actor/protocol/serde.ts +5 -1
  81. package/src/actor/router-endpoints.ts +2 -0
  82. package/src/client/actor-conn.ts +2 -0
  83. package/src/client/actor-handle.ts +3 -0
  84. package/src/client/config.ts +1 -1
  85. package/src/client/utils.ts +4 -1
  86. package/src/common/router.ts +5 -1
  87. package/src/driver-helpers/utils.ts +8 -2
  88. package/src/drivers/engine/config.ts +6 -3
  89. package/src/drivers/file-system/global-state.ts +46 -1
  90. package/src/drivers/file-system/manager.ts +4 -0
  91. package/src/inspector/config.ts +1 -2
  92. package/src/manager/driver.ts +4 -0
  93. package/src/manager/router-schema.ts +7 -7
  94. package/src/manager/router.ts +4 -4
  95. package/src/registry/run-config.ts +9 -5
  96. package/src/remote-manager-driver/actor-http-client.ts +1 -1
  97. package/src/remote-manager-driver/api-utils.ts +2 -0
  98. package/src/schemas/actor-persist/versioned.ts +126 -54
  99. package/src/schemas/client-protocol/versioned.ts +173 -42
  100. package/src/schemas/file-system-driver/mod.ts +1 -1
  101. package/src/schemas/file-system-driver/versioned.ts +129 -45
  102. package/src/serde.ts +9 -2
  103. package/src/test/config.ts +13 -12
  104. package/src/test/mod.ts +56 -82
  105. package/dist/tsup/chunk-2TZH6VO6.cjs +0 -514
  106. package/dist/tsup/chunk-2TZH6VO6.cjs.map +0 -1
  107. package/dist/tsup/chunk-4GJQDTAG.cjs.map +0 -1
  108. package/dist/tsup/chunk-5YDKTW6Y.js +0 -514
  109. package/dist/tsup/chunk-5YDKTW6Y.js.map +0 -1
  110. package/dist/tsup/chunk-BBTOBXEO.js.map +0 -1
  111. package/dist/tsup/chunk-C3UREFUI.js.map +0 -1
  112. package/dist/tsup/chunk-DRJCTDDT.cjs.map +0 -1
  113. package/dist/tsup/chunk-F3SQLO3X.cjs.map +0 -1
  114. package/dist/tsup/chunk-FYZLEH57.cjs +0 -130
  115. package/dist/tsup/chunk-FYZLEH57.cjs.map +0 -1
  116. package/dist/tsup/chunk-KSQQU7NC.js.map +0 -1
  117. package/dist/tsup/chunk-VRZNWBDK.js.map +0 -1
  118. package/dist/tsup/chunk-XNKWXMIT.cjs.map +0 -1
  119. package/dist/tsup/chunk-XU4GGB6J.js.map +0 -1
  120. package/src/common/versioned-data.ts +0 -95
  121. /package/dist/tsup/{chunk-D7A47BVR.js.map → chunk-7IAEY5UZ.js.map} +0 -0
  122. /package/dist/tsup/{chunk-6F2NCX7R.js.map → chunk-AE7BB3M2.js.map} +0 -0
  123. /package/dist/tsup/{chunk-GUH2PNPG.js.map → chunk-IDYDUETM.js.map} +0 -0
  124. /package/dist/tsup/{chunk-2NNICHGY.js.map → chunk-ILK4JEMF.js.map} +0 -0
@@ -0,0 +1,167 @@
1
+ import * as bare from "@bare-ts/lib"
2
+
3
+ const config = /* @__PURE__ */ bare.Config({})
4
+
5
+ export type u64 = bigint
6
+ export type uint = bigint
7
+
8
+ export type ActorKvEntry = {
9
+ readonly key: ArrayBuffer,
10
+ readonly value: ArrayBuffer,
11
+ }
12
+
13
+ export function readActorKvEntry(bc: bare.ByteCursor): ActorKvEntry {
14
+ return {
15
+ key: bare.readData(bc),
16
+ value: bare.readData(bc),
17
+ }
18
+ }
19
+
20
+ export function writeActorKvEntry(bc: bare.ByteCursor, x: ActorKvEntry): void {
21
+ bare.writeData(bc, x.key)
22
+ bare.writeData(bc, x.value)
23
+ }
24
+
25
+ function read0(bc: bare.ByteCursor): readonly string[] {
26
+ const len = bare.readUintSafe(bc)
27
+ if (len === 0) { return [] }
28
+ const result = [bare.readString(bc)]
29
+ for (let i = 1; i < len; i++) {
30
+ result[i] = bare.readString(bc)
31
+ }
32
+ return result
33
+ }
34
+
35
+ function write0(bc: bare.ByteCursor, x: readonly string[]): void {
36
+ bare.writeUintSafe(bc, x.length)
37
+ for (let i = 0; i < x.length; i++) {
38
+ bare.writeString(bc, x[i])
39
+ }
40
+ }
41
+
42
+ function read1(bc: bare.ByteCursor): readonly ActorKvEntry[] {
43
+ const len = bare.readUintSafe(bc)
44
+ if (len === 0) { return [] }
45
+ const result = [readActorKvEntry(bc)]
46
+ for (let i = 1; i < len; i++) {
47
+ result[i] = readActorKvEntry(bc)
48
+ }
49
+ return result
50
+ }
51
+
52
+ function write1(bc: bare.ByteCursor, x: readonly ActorKvEntry[]): void {
53
+ bare.writeUintSafe(bc, x.length)
54
+ for (let i = 0; i < x.length; i++) {
55
+ writeActorKvEntry(bc, x[i])
56
+ }
57
+ }
58
+
59
+ function read2(bc: bare.ByteCursor): u64 | null {
60
+ return bare.readBool(bc)
61
+ ? bare.readU64(bc)
62
+ : null
63
+ }
64
+
65
+ function write2(bc: bare.ByteCursor, x: u64 | null): void {
66
+ bare.writeBool(bc, x !== null)
67
+ if (x !== null) {
68
+ bare.writeU64(bc, x)
69
+ }
70
+ }
71
+
72
+ export type ActorState = {
73
+ readonly actorId: string,
74
+ readonly name: string,
75
+ readonly key: readonly string[],
76
+ readonly kvStorage: readonly ActorKvEntry[],
77
+ readonly createdAt: u64,
78
+ readonly startTs: u64 | null,
79
+ readonly connectableTs: u64 | null,
80
+ readonly sleepTs: u64 | null,
81
+ readonly destroyTs: u64 | null,
82
+ }
83
+
84
+ export function readActorState(bc: bare.ByteCursor): ActorState {
85
+ return {
86
+ actorId: bare.readString(bc),
87
+ name: bare.readString(bc),
88
+ key: read0(bc),
89
+ kvStorage: read1(bc),
90
+ createdAt: bare.readU64(bc),
91
+ startTs: read2(bc),
92
+ connectableTs: read2(bc),
93
+ sleepTs: read2(bc),
94
+ destroyTs: read2(bc),
95
+ }
96
+ }
97
+
98
+ export function writeActorState(bc: bare.ByteCursor, x: ActorState): void {
99
+ bare.writeString(bc, x.actorId)
100
+ bare.writeString(bc, x.name)
101
+ write0(bc, x.key)
102
+ write1(bc, x.kvStorage)
103
+ bare.writeU64(bc, x.createdAt)
104
+ write2(bc, x.startTs)
105
+ write2(bc, x.connectableTs)
106
+ write2(bc, x.sleepTs)
107
+ write2(bc, x.destroyTs)
108
+ }
109
+
110
+ export function encodeActorState(x: ActorState): Uint8Array {
111
+ const bc = new bare.ByteCursor(
112
+ new Uint8Array(config.initialBufferLength),
113
+ config
114
+ )
115
+ writeActorState(bc, x)
116
+ return new Uint8Array(bc.view.buffer, bc.view.byteOffset, bc.offset)
117
+ }
118
+
119
+ export function decodeActorState(bytes: Uint8Array): ActorState {
120
+ const bc = new bare.ByteCursor(bytes, config)
121
+ const result = readActorState(bc)
122
+ if (bc.offset < bc.view.byteLength) {
123
+ throw new bare.BareError(bc.offset, "remaining bytes")
124
+ }
125
+ return result
126
+ }
127
+
128
+ export type ActorAlarm = {
129
+ readonly actorId: string,
130
+ readonly timestamp: uint,
131
+ }
132
+
133
+ export function readActorAlarm(bc: bare.ByteCursor): ActorAlarm {
134
+ return {
135
+ actorId: bare.readString(bc),
136
+ timestamp: bare.readUint(bc),
137
+ }
138
+ }
139
+
140
+ export function writeActorAlarm(bc: bare.ByteCursor, x: ActorAlarm): void {
141
+ bare.writeString(bc, x.actorId)
142
+ bare.writeUint(bc, x.timestamp)
143
+ }
144
+
145
+ export function encodeActorAlarm(x: ActorAlarm): Uint8Array {
146
+ const bc = new bare.ByteCursor(
147
+ new Uint8Array(config.initialBufferLength),
148
+ config
149
+ )
150
+ writeActorAlarm(bc, x)
151
+ return new Uint8Array(bc.view.buffer, bc.view.byteOffset, bc.offset)
152
+ }
153
+
154
+ export function decodeActorAlarm(bytes: Uint8Array): ActorAlarm {
155
+ const bc = new bare.ByteCursor(bytes, config)
156
+ const result = readActorAlarm(bc)
157
+ if (bc.offset < bc.view.byteLength) {
158
+ throw new bare.BareError(bc.offset, "remaining bytes")
159
+ }
160
+ return result
161
+ }
162
+
163
+
164
+ function assert(condition: boolean, message?: string): asserts condition {
165
+ if (!condition) throw new Error(message ?? "Assertion failed")
166
+ }
167
+