orez-sync-cf-host 0.4.62 → 0.4.63
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.
package/package.json
CHANGED
|
Binary file
|
|
@@ -28,6 +28,7 @@ interface Env extends SyncHostEnv {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
const runawayNamespaces = new Set<string>()
|
|
31
|
+
const numericTextNamespaces = new Set<string>()
|
|
31
32
|
let delegatedFailuresRemaining = 0
|
|
32
33
|
let delegatedAttempts = 0
|
|
33
34
|
|
|
@@ -108,6 +109,45 @@ export class DataService extends WorkerEntrypoint<Env> {
|
|
|
108
109
|
)
|
|
109
110
|
}
|
|
110
111
|
const namespace = pathname.split('/')[1] ?? ''
|
|
112
|
+
if (pathname.endsWith('/changes') && numericTextNamespaces.has(namespace)) {
|
|
113
|
+
const watermark = Number(new URL(request.url).searchParams.get('watermark') ?? 0)
|
|
114
|
+
return Promise.resolve(
|
|
115
|
+
Response.json({
|
|
116
|
+
watermark: 2,
|
|
117
|
+
changes:
|
|
118
|
+
watermark >= 2
|
|
119
|
+
? []
|
|
120
|
+
: [
|
|
121
|
+
{
|
|
122
|
+
watermark: 1,
|
|
123
|
+
tableName: 'item',
|
|
124
|
+
op: 'INSERT',
|
|
125
|
+
rowData: {
|
|
126
|
+
id: 'numeric-text',
|
|
127
|
+
label: 'SQL timestamp text',
|
|
128
|
+
rank: '2026-07-11 13:34:46',
|
|
129
|
+
done: false,
|
|
130
|
+
meta: null,
|
|
131
|
+
},
|
|
132
|
+
oldData: null,
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
watermark: 2,
|
|
136
|
+
tableName: 'item',
|
|
137
|
+
op: 'INSERT',
|
|
138
|
+
rowData: {
|
|
139
|
+
id: 'numeric-native',
|
|
140
|
+
label: 'native JSON number',
|
|
141
|
+
rank: 1783776886000,
|
|
142
|
+
done: false,
|
|
143
|
+
meta: null,
|
|
144
|
+
},
|
|
145
|
+
oldData: null,
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
})
|
|
149
|
+
)
|
|
150
|
+
}
|
|
111
151
|
if (pathname.endsWith('/changes') && runawayNamespaces.has(namespace)) {
|
|
112
152
|
return Promise.resolve(
|
|
113
153
|
Response.json({
|
|
@@ -156,6 +196,18 @@ const syncWorker = createSyncWorker(config)
|
|
|
156
196
|
export default {
|
|
157
197
|
fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
|
|
158
198
|
const url = new URL(request.url)
|
|
199
|
+
if (url.pathname.startsWith('/numeric-text-control/')) {
|
|
200
|
+
const namespace = url.pathname.slice('/numeric-text-control/'.length)
|
|
201
|
+
return request
|
|
202
|
+
.json()
|
|
203
|
+
.catch(() => ({}))
|
|
204
|
+
.then((body) => {
|
|
205
|
+
if ((body as { enabled?: unknown }).enabled === true)
|
|
206
|
+
numericTextNamespaces.add(namespace)
|
|
207
|
+
else numericTextNamespaces.delete(namespace)
|
|
208
|
+
return Response.json({ ok: true, namespace })
|
|
209
|
+
})
|
|
210
|
+
}
|
|
159
211
|
if (url.pathname.startsWith('/runaway-control/')) {
|
|
160
212
|
const namespace = url.pathname.slice('/runaway-control/'.length)
|
|
161
213
|
return request
|