orez 0.2.27 → 0.2.30
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/dist/cf-do/worker.d.ts +3 -0
- package/dist/cf-do/worker.d.ts.map +1 -1
- package/dist/cf-do/worker.js +37 -15
- package/dist/cf-do/worker.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -4
- package/src/admin/admin-data.test.ts +0 -348
- package/src/admin/http-proxy.ts +0 -252
- package/src/admin/log-store.ts +0 -192
- package/src/admin/server.ts +0 -471
- package/src/admin/ui.ts +0 -1322
- package/src/bench/proxy-throughput.bench.ts +0 -343
- package/src/bench/serial-mutations.bench.ts +0 -270
- package/src/browser.ts +0 -203
- package/src/cf-do/.wrangler/cache/cf.json +0 -1
- package/src/cf-do/.wrangler/state/v3/cache/miniflare-CacheObject/metadata.sqlite +0 -0
- package/src/cf-do/.wrangler/state/v3/cache/miniflare-CacheObject/metadata.sqlite-shm +0 -0
- package/src/cf-do/.wrangler/state/v3/cache/miniflare-CacheObject/metadata.sqlite-wal +0 -0
- package/src/cf-do/.wrangler/state/v3/do/zero-do-ZeroDO/0ffaabee41a60e04dd0eb7db3073f0a40139e6a97ccd26823967acb652b89a7b.sqlite +0 -0
- package/src/cf-do/.wrangler/state/v3/do/zero-do-ZeroDO/metadata.sqlite +0 -0
- package/src/cf-do/.wrangler/state/v3/do/zero-do-ZeroDO/metadata.sqlite-shm +0 -0
- package/src/cf-do/.wrangler/state/v3/do/zero-do-ZeroDO/metadata.sqlite-wal +0 -0
- package/src/cf-do/.wrangler/tmp/bundle-0z4CpE/middleware-insertion-facade.js +0 -11
- package/src/cf-do/.wrangler/tmp/bundle-0z4CpE/middleware-loader.entry.ts +0 -134
- package/src/cf-do/.wrangler/tmp/bundle-vYmw0E/middleware-insertion-facade.js +0 -11
- package/src/cf-do/.wrangler/tmp/bundle-vYmw0E/middleware-loader.entry.ts +0 -134
- package/src/cf-do/.wrangler/tmp/dev-cbILNo/worker.js +0 -1059
- package/src/cf-do/.wrangler/tmp/dev-cbILNo/worker.js.map +0 -8
- package/src/cf-do/.wrangler/tmp/dev-qbho19/worker.js +0 -1059
- package/src/cf-do/.wrangler/tmp/dev-qbho19/worker.js.map +0 -8
- package/src/cf-do/ARCHITECTURE.md +0 -93
- package/src/cf-do/CHAT_E2E.md +0 -213
- package/src/cf-do/watermark.test.ts +0 -103
- package/src/cf-do/watermark.ts +0 -118
- package/src/cf-do/worker.ts +0 -1041
- package/src/cf-do/wrangler.toml +0 -11
- package/src/cf-pglite/README.md +0 -19
- package/src/change-tracking.ts +0 -25
- package/src/child-process.test.ts +0 -147
- package/src/child-process.ts +0 -90
- package/src/cli-entry.ts +0 -72
- package/src/cli.test.ts +0 -40
- package/src/cli.ts +0 -1214
- package/src/config.ts +0 -150
- package/src/do-sql-tracking.test.ts +0 -19
- package/src/do-sql-tracking.ts +0 -19
- package/src/index.ts +0 -1215
- package/src/integration/integration.test.ts +0 -517
- package/src/integration/native-binary.guard.test.ts +0 -13
- package/src/integration/native-startup.test.ts +0 -44
- package/src/integration/replication-latency.test.ts +0 -428
- package/src/integration/restore-live-stress.test.ts +0 -433
- package/src/integration/restore-reset.test.ts +0 -400
- package/src/integration/restore.test.ts +0 -274
- package/src/integration/test-permissions.ts +0 -147
- package/src/load-config.ts +0 -46
- package/src/log.ts +0 -96
- package/src/mutex.ts +0 -47
- package/src/pg-proxy-browser.singledb.test.ts +0 -233
- package/src/pg-proxy-browser.ts +0 -2022
- package/src/pg-proxy-do-backend.test.ts +0 -3890
- package/src/pg-proxy-do-backend.ts +0 -7191
- package/src/pg-proxy.ts +0 -1087
- package/src/pg-sqlite-compiler/README.md +0 -53
- package/src/pg-sqlite-compiler/catalog/seed.ts +0 -524
- package/src/pg-sqlite-compiler/fixtures/pgsqlite/arithmetic.json +0 -307
- package/src/pg-sqlite-compiler/fixtures/pgsqlite/array.json +0 -377
- package/src/pg-sqlite-compiler/fixtures/pgsqlite/cast.json +0 -12
- package/src/pg-sqlite-compiler/fixtures/pgsqlite/catalog.json +0 -447
- package/src/pg-sqlite-compiler/fixtures/pgsqlite/create-table.json +0 -32
- package/src/pg-sqlite-compiler/fixtures/pgsqlite/datetime.json +0 -397
- package/src/pg-sqlite-compiler/fixtures/pgsqlite/enum.json +0 -337
- package/src/pg-sqlite-compiler/fixtures/pgsqlite/insert.json +0 -337
- package/src/pg-sqlite-compiler/fixtures/pgsqlite/json.json +0 -537
- package/src/pg-sqlite-compiler/fixtures/pgsqlite/misc.json +0 -1837
- package/src/pg-sqlite-compiler/index.ts +0 -73
- package/src/pg-sqlite-compiler/integration.test.ts +0 -136
- package/src/pg-sqlite-compiler/passes/ast-utils.ts +0 -113
- package/src/pg-sqlite-compiler/passes/catalog.ts +0 -65
- package/src/pg-sqlite-compiler/passes/datetime.ts +0 -74
- package/src/pg-sqlite-compiler/passes/index.ts +0 -49
- package/src/pg-sqlite-compiler/passes/types.ts +0 -156
- package/src/pg-sqlite-compiler/smoke.test.ts +0 -69
- package/src/pg-sqlite-compiler/test/catalog.test.ts +0 -171
- package/src/pg-sqlite-compiler/test/corpus.test.ts +0 -161
- package/src/pg-sqlite-compiler/test/datetime.oracle.test.ts +0 -102
- package/src/pg-sqlite-compiler/test/oracle.ts +0 -237
- package/src/pg-sqlite-compiler/test/types.test.ts +0 -109
- package/src/pg-sqlite-compiler/types.ts +0 -63
- package/src/pglite-ipc.test.ts +0 -116
- package/src/pglite-ipc.ts +0 -266
- package/src/pglite-manager.ts +0 -557
- package/src/pglite-web-proxy.test.ts +0 -57
- package/src/pglite-web-proxy.ts +0 -221
- package/src/pglite-web-worker.ts +0 -152
- package/src/pglite-worker-thread.ts +0 -253
- package/src/port.ts +0 -25
- package/src/process-title.ts +0 -9
- package/src/recovery.ts +0 -155
- package/src/replication/change-tracker.test.ts +0 -357
- package/src/replication/change-tracker.ts +0 -279
- package/src/replication/handler.test.ts +0 -511
- package/src/replication/handler.ts +0 -1190
- package/src/replication/pgoutput-encoder.test.ts +0 -697
- package/src/replication/pgoutput-encoder.ts +0 -373
- package/src/replication/tcp-replication.test.ts +0 -876
- package/src/replication/zero-compat.test.ts +0 -1150
- package/src/restore-stress.test.ts +0 -188
- package/src/s3-local.ts +0 -203
- package/src/shim/hooks.mjs +0 -120
- package/src/shim/register.mjs +0 -4
- package/src/sqlite-mode/apply-mode.ts +0 -224
- package/src/sqlite-mode/index.ts +0 -15
- package/src/sqlite-mode/native-binary.ts +0 -89
- package/src/sqlite-mode/package-resolve.ts +0 -17
- package/src/sqlite-mode/resolve-mode.ts +0 -80
- package/src/sqlite-mode/shim-template.ts +0 -159
- package/src/sqlite-mode/sqlite-mode.test.ts +0 -427
- package/src/sqlite-mode/types.ts +0 -30
- package/src/vite-plugin.ts +0 -67
- package/src/wasm-sqlite.test.ts +0 -537
- package/src/worker/browser-admin.ts +0 -52
- package/src/worker/browser-build-config.test.ts +0 -71
- package/src/worker/browser-build-config.ts +0 -109
- package/src/worker/browser-embed-admin.test.ts +0 -75
- package/src/worker/browser-embed.ts +0 -345
- package/src/worker/cf-patches.ts +0 -384
- package/src/worker/embed-integration.test.ts +0 -321
- package/src/worker/index.ts +0 -138
- package/src/worker/shims/fastify.test.ts +0 -255
- package/src/worker/shims/fastify.ts +0 -306
- package/src/worker/shims/http-service.test.ts +0 -355
- package/src/worker/shims/http-service.ts +0 -293
- package/src/worker/shims/node-stub.ts +0 -290
- package/src/worker/shims/oxfmt.ts +0 -3
- package/src/worker/shims/postgres-browser.ts +0 -59
- package/src/worker/shims/postgres-socket.test.ts +0 -576
- package/src/worker/shims/postgres-socket.ts +0 -310
- package/src/worker/shims/postgres.test.ts +0 -364
- package/src/worker/shims/postgres.ts +0 -1454
- package/src/worker/shims/sqlite-browser.test.ts +0 -233
- package/src/worker/shims/sqlite-browser.ts +0 -175
- package/src/worker/shims/sqlite.test.ts +0 -786
- package/src/worker/shims/sqlite.ts +0 -978
- package/src/worker/shims/stream-browser.ts +0 -15
- package/src/worker/shims/ws-browser.test.ts +0 -205
- package/src/worker/shims/ws-browser.ts +0 -248
- package/src/worker/shims/ws.test.ts +0 -288
- package/src/worker/shims/ws.ts +0 -467
- package/src/worker/shims/zero-process-env.ts +0 -11
- package/src/worker/types.ts +0 -75
- package/src/worker/worker-integration.test.ts +0 -223
- package/src/worker/worker.test.ts +0 -136
- package/src/worker/zero-cache-embed-cf.ts +0 -463
- package/src/worker/zero-cache-embed.ts +0 -277
package/src/browser.ts
DELETED
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* orez browser entry — aligned to orez-node architecture.
|
|
3
|
-
*
|
|
4
|
-
* mirrors index.ts startup sequence:
|
|
5
|
-
* 1. create PGlite Web Workers (3 instances)
|
|
6
|
-
* 2. install change tracking
|
|
7
|
-
* 3. start pg-proxy-browser (wire protocol proxy)
|
|
8
|
-
* 4. start zero-cache (SINGLE_PROCESS=1, connects to proxy)
|
|
9
|
-
*
|
|
10
|
-
* intended to run inside a Web Worker. PGlite instances run in
|
|
11
|
-
* separate Web Workers (like orez-node's worker threads).
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import { PGliteWebProxy } from './pglite-web-proxy.js'
|
|
15
|
-
import { installChangeTracking } from './replication/change-tracker.js'
|
|
16
|
-
import { resetReplicationState } from './replication/handler.js'
|
|
17
|
-
|
|
18
|
-
import type { PGlite } from '@electric-sql/pglite'
|
|
19
|
-
|
|
20
|
-
export interface OrezBrowserConfig {
|
|
21
|
-
/** app ID for zero-cache (default: 'zero') */
|
|
22
|
-
appId?: string
|
|
23
|
-
|
|
24
|
-
/** publication names for replication */
|
|
25
|
-
publications?: string[]
|
|
26
|
-
|
|
27
|
-
/** URL for PGlite web worker script */
|
|
28
|
-
pgliteWorkerUrl: string
|
|
29
|
-
|
|
30
|
-
/** URL for bedrock-sqlite WASM */
|
|
31
|
-
bedrockSqliteUrl?: string
|
|
32
|
-
|
|
33
|
-
/** init SQL to run on postgres instance after creation */
|
|
34
|
-
initSql?: string
|
|
35
|
-
|
|
36
|
-
/** log level */
|
|
37
|
-
logLevel?: string
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* intercept browser-mode orez admin routes before they reach zero-cache.
|
|
41
|
-
* default: true.
|
|
42
|
-
*/
|
|
43
|
-
disableAdminApi?: boolean
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface OrezBrowserInstance {
|
|
47
|
-
/** PGlite proxies (for direct queries from project-server) */
|
|
48
|
-
instances: {
|
|
49
|
-
postgres: PGliteWebProxy
|
|
50
|
-
cvr: PGliteWebProxy
|
|
51
|
-
cdb: PGliteWebProxy
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/** signal the replication handler that changes are available */
|
|
55
|
-
signalReplication(): void
|
|
56
|
-
|
|
57
|
-
/** handle a WebSocket connection from a Zero client */
|
|
58
|
-
handleWebSocket(ws: any, url?: string, headers?: Record<string, string>): void
|
|
59
|
-
|
|
60
|
-
/** handle an HTTP request (push/pull) */
|
|
61
|
-
handleHttp(request: {
|
|
62
|
-
method: string
|
|
63
|
-
url: string
|
|
64
|
-
headers?: Record<string, string>
|
|
65
|
-
body?: string | null
|
|
66
|
-
}): Promise<{ status: number; headers: Record<string, string>; body: string }>
|
|
67
|
-
|
|
68
|
-
/** stop everything */
|
|
69
|
-
stop(): Promise<void>
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export async function startOrezBrowser(
|
|
73
|
-
config: OrezBrowserConfig
|
|
74
|
-
): Promise<OrezBrowserInstance> {
|
|
75
|
-
const appId = config.appId || 'zero'
|
|
76
|
-
const publications = config.publications?.join(',') || `orez_${appId}_public`
|
|
77
|
-
|
|
78
|
-
// step 1: create PGlite Web Workers (3 instances, like orez-node)
|
|
79
|
-
const pgPostgresWorker = new Worker(config.pgliteWorkerUrl, {
|
|
80
|
-
type: 'module',
|
|
81
|
-
name: 'pglite-postgres',
|
|
82
|
-
})
|
|
83
|
-
const pgCvrWorker = new Worker(config.pgliteWorkerUrl, {
|
|
84
|
-
type: 'module',
|
|
85
|
-
name: 'pglite-cvr',
|
|
86
|
-
})
|
|
87
|
-
const pgCdbWorker = new Worker(config.pgliteWorkerUrl, {
|
|
88
|
-
type: 'module',
|
|
89
|
-
name: 'pglite-cdb',
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
// init each PGlite worker
|
|
93
|
-
pgPostgresWorker.postMessage({
|
|
94
|
-
type: 'init',
|
|
95
|
-
dataDir: 'idb://orez-postgres',
|
|
96
|
-
name: 'postgres',
|
|
97
|
-
})
|
|
98
|
-
pgCvrWorker.postMessage({ type: 'init', dataDir: 'idb://orez-cvr', name: 'cvr' })
|
|
99
|
-
pgCdbWorker.postMessage({ type: 'init', dataDir: 'idb://orez-cdb', name: 'cdb' })
|
|
100
|
-
|
|
101
|
-
// create proxies (like orez-node's PGliteWorkerProxy)
|
|
102
|
-
const pgPostgres = new PGliteWebProxy(pgPostgresWorker, 'postgres')
|
|
103
|
-
const pgCvr = new PGliteWebProxy(pgCvrWorker, 'cvr')
|
|
104
|
-
const pgCdb = new PGliteWebProxy(pgCdbWorker, 'cdb')
|
|
105
|
-
|
|
106
|
-
await Promise.all([pgPostgres.waitReady, pgCvr.waitReady, pgCdb.waitReady])
|
|
107
|
-
console.debug('[orez-browser] all 3 PGlite workers ready')
|
|
108
|
-
|
|
109
|
-
// step 2: install change tracking (like orez-node)
|
|
110
|
-
await installChangeTracking(pgPostgres as unknown as PGlite)
|
|
111
|
-
console.debug('[orez-browser] change tracking installed')
|
|
112
|
-
|
|
113
|
-
// run user init SQL if provided
|
|
114
|
-
if (config.initSql) {
|
|
115
|
-
await pgPostgres.exec(config.initSql)
|
|
116
|
-
console.debug('[orez-browser] init SQL complete')
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// create publication
|
|
120
|
-
try {
|
|
121
|
-
const pubs = await pgPostgres.query<{ count: string }>(
|
|
122
|
-
`SELECT count(*) as count FROM pg_publication WHERE pubname = $1`,
|
|
123
|
-
[publications]
|
|
124
|
-
)
|
|
125
|
-
if (Number(pubs.rows[0]?.count) === 0) {
|
|
126
|
-
await pgPostgres.exec(`CREATE PUBLICATION "${publications}"`)
|
|
127
|
-
}
|
|
128
|
-
} catch {}
|
|
129
|
-
|
|
130
|
-
// step 3: start pg-proxy-browser
|
|
131
|
-
// the proxy handles wire protocol, replication, mutexes — like orez-node's pg-proxy.
|
|
132
|
-
// zero-cache's postgres shim routes queries through this proxy.
|
|
133
|
-
const { createBrowserProxy } = await import('./pg-proxy-browser.js')
|
|
134
|
-
const proxy = await createBrowserProxy(
|
|
135
|
-
{
|
|
136
|
-
postgres: pgPostgres as unknown as PGlite,
|
|
137
|
-
cvr: pgCvr as unknown as PGlite,
|
|
138
|
-
cdb: pgCdb as unknown as PGlite,
|
|
139
|
-
postgresReplicas: [],
|
|
140
|
-
},
|
|
141
|
-
{ pgPassword: '', pgUser: 'user' }
|
|
142
|
-
)
|
|
143
|
-
console.debug('[orez-browser] pg-proxy-browser started')
|
|
144
|
-
|
|
145
|
-
// step 4: start zero-cache (SINGLE_PROCESS=1)
|
|
146
|
-
// zero-cache uses the real postgres package with a MessagePort socket
|
|
147
|
-
// that connects to pg-proxy-browser. identical to orez-node where
|
|
148
|
-
// zero-cache uses real postgres over TCP to pg-proxy.
|
|
149
|
-
//
|
|
150
|
-
// set up the proxy connect function for postgres-browser.ts shim
|
|
151
|
-
;(globalThis as any).__orez_proxy_connect = (port: MessagePort) => {
|
|
152
|
-
proxy.handleConnection(port)
|
|
153
|
-
}
|
|
154
|
-
;(globalThis as any).__orez_proxy_password = ''
|
|
155
|
-
;(globalThis as any).__orez_proxy_user = 'user'
|
|
156
|
-
|
|
157
|
-
// PGlite global still needed for browser-embed's sqlite setup
|
|
158
|
-
;(globalThis as any).__orez_pglite = pgPostgres
|
|
159
|
-
|
|
160
|
-
// start zero-cache via browser-embed's runWorker
|
|
161
|
-
const { startZeroCacheEmbedBrowser } = await import('./worker/browser-embed.js')
|
|
162
|
-
const zc = await startZeroCacheEmbedBrowser({
|
|
163
|
-
pglite: pgPostgres as unknown as PGlite,
|
|
164
|
-
appId,
|
|
165
|
-
publications: config.publications,
|
|
166
|
-
disableAdminApi: config.disableAdminApi ?? true,
|
|
167
|
-
env: {
|
|
168
|
-
ZERO_LOG_LEVEL: config.logLevel || 'info',
|
|
169
|
-
},
|
|
170
|
-
})
|
|
171
|
-
console.debug('[orez-browser] zero-cache started')
|
|
172
|
-
|
|
173
|
-
// step 5: expose API
|
|
174
|
-
const { signalReplicationChange } = await import('./replication/handler.js')
|
|
175
|
-
|
|
176
|
-
return {
|
|
177
|
-
instances: { postgres: pgPostgres, cvr: pgCvr, cdb: pgCdb },
|
|
178
|
-
|
|
179
|
-
signalReplication() {
|
|
180
|
-
signalReplicationChange()
|
|
181
|
-
},
|
|
182
|
-
|
|
183
|
-
handleWebSocket(ws: any, url = '/', headers?: Record<string, string>) {
|
|
184
|
-
zc.handleWebSocket(ws, url)
|
|
185
|
-
},
|
|
186
|
-
|
|
187
|
-
async handleHttp(request: {
|
|
188
|
-
method: string
|
|
189
|
-
url: string
|
|
190
|
-
headers?: Record<string, string>
|
|
191
|
-
body?: string | null
|
|
192
|
-
}) {
|
|
193
|
-
return zc.handleHttp(request)
|
|
194
|
-
},
|
|
195
|
-
|
|
196
|
-
async stop() {
|
|
197
|
-
await zc.stop()
|
|
198
|
-
proxy.close()
|
|
199
|
-
resetReplicationState()
|
|
200
|
-
await Promise.all([pgPostgres.close(), pgCvr.close(), pgCdb.close()])
|
|
201
|
-
},
|
|
202
|
-
}
|
|
203
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"httpProtocol":"HTTP/1.1","clientAcceptEncoding":"gzip, deflate, br","requestPriority":"","edgeRequestKeepAliveStatus":1,"requestHeaderNames":{},"clientTcpRtt":93,"clientQuicRtt":0,"colo":"LAX","asn":21928,"asOrganization":"T-Mobile USA, Inc.","country":"US","isEUCountry":false,"city":"Honolulu","continent":"NA","region":"Hawaii","regionCode":"HI","timezone":"Pacific/Honolulu","longitude":"-157.85833","latitude":"21.30694","postalCode":"96802","metroCode":"744","tlsVersion":"TLSv1.3","tlsCipher":"AEAD-AES256-GCM-SHA384","tlsClientRandom":"NOBIfk5ETeINfIoBd1DBYmD6uDRaF6acEMq+Zulpn5M=","tlsClientCiphersSha1":"JZtiTn8H/ntxORk+XXvU2EvNoz8=","tlsClientExtensionsSha1":"Y7DIC8A6G0/aXviZ8ie/xDbJb7g=","tlsClientExtensionsSha1Le":"6e+q3vPm88rSgMTN/h7WTTxQ2wQ=","tlsExportedAuthenticator":{"clientHandshake":"a85e53d9da621fd7034dc64d2dfb270254957262daef67d7d0d9154fe2122b1661659fb5de1b674d3de3b0c400895ad6","serverHandshake":"4bcb07df5d2694809a69b6e423f8f5ef0746be28acb143ace522036e43d345863814d80f6c874320d7d04a7ce2b8fd9d","clientFinished":"6837d9952d53a1b550e3a280c48e207d1cc58c72770940c06f9f7b9853abd5060bff06ca118d6c71d94ab26184e95116","serverFinished":"48e2c71fae5a91d7a2b4ed7ca480052da299ed950a8f908eba095d075c53270b82305d1d6bd4ead4d5550e943537b47e"},"tlsClientHelloLength":"386","tlsClientAuth":{"certPresented":"0","certVerified":"NONE","certRevoked":"0","certIssuerDN":"","certSubjectDN":"","certIssuerDNRFC2253":"","certSubjectDNRFC2253":"","certIssuerDNLegacy":"","certSubjectDNLegacy":"","certSerial":"","certIssuerSerial":"","certSKI":"","certIssuerSKI":"","certFingerprintSHA1":"","certFingerprintSHA256":"","certNotBefore":"","certNotAfter":"","certRFC9440":"","certRFC9440TooLarge":false,"certChainRFC9440":"","certChainRFC9440TooLarge":false},"verifiedBotCategory":"","edgeL4":{"deliveryRate":47048},"botManagement":{"corporateProxy":false,"verifiedBot":false,"jsDetection":{"passed":false},"staticResource":false,"detectionIds":{},"score":99}}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import worker, * as OTHER_EXPORTS from "/Users/n8/orez/src/cf-do/worker.ts";
|
|
2
|
-
import * as __MIDDLEWARE_0__ from "/Users/n8/soot/node_modules/wrangler/templates/middleware/middleware-ensure-req-body-drained.ts";
|
|
3
|
-
import * as __MIDDLEWARE_1__ from "/Users/n8/soot/node_modules/wrangler/templates/middleware/middleware-miniflare3-json-error.ts";
|
|
4
|
-
|
|
5
|
-
export * from "/Users/n8/orez/src/cf-do/worker.ts";
|
|
6
|
-
const MIDDLEWARE_TEST_INJECT = "__INJECT_FOR_TESTING_WRANGLER_MIDDLEWARE__";
|
|
7
|
-
export const __INTERNAL_WRANGLER_MIDDLEWARE__ = [
|
|
8
|
-
|
|
9
|
-
__MIDDLEWARE_0__.default,__MIDDLEWARE_1__.default
|
|
10
|
-
]
|
|
11
|
-
export default worker;
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
// This loads all middlewares exposed on the middleware object and then starts
|
|
2
|
-
// the invocation chain. The big idea is that we can add these to the middleware
|
|
3
|
-
// export dynamically through wrangler, or we can potentially let users directly
|
|
4
|
-
// add them as a sort of "plugin" system.
|
|
5
|
-
|
|
6
|
-
import ENTRY, { __INTERNAL_WRANGLER_MIDDLEWARE__ } from "/Users/n8/orez/src/cf-do/.wrangler/tmp/bundle-0z4CpE/middleware-insertion-facade.js";
|
|
7
|
-
import { __facade_invoke__, __facade_register__, Dispatcher } from "/Users/n8/soot/node_modules/wrangler/templates/middleware/common.ts";
|
|
8
|
-
import type { WorkerEntrypointConstructor } from "/Users/n8/orez/src/cf-do/.wrangler/tmp/bundle-0z4CpE/middleware-insertion-facade.js";
|
|
9
|
-
|
|
10
|
-
// Preserve all the exports from the worker
|
|
11
|
-
export * from "/Users/n8/orez/src/cf-do/.wrangler/tmp/bundle-0z4CpE/middleware-insertion-facade.js";
|
|
12
|
-
|
|
13
|
-
class __Facade_ScheduledController__ implements ScheduledController {
|
|
14
|
-
readonly #noRetry: ScheduledController["noRetry"];
|
|
15
|
-
|
|
16
|
-
constructor(
|
|
17
|
-
readonly scheduledTime: number,
|
|
18
|
-
readonly cron: string,
|
|
19
|
-
noRetry: ScheduledController["noRetry"]
|
|
20
|
-
) {
|
|
21
|
-
this.#noRetry = noRetry;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
noRetry() {
|
|
25
|
-
if (!(this instanceof __Facade_ScheduledController__)) {
|
|
26
|
-
throw new TypeError("Illegal invocation");
|
|
27
|
-
}
|
|
28
|
-
// Need to call native method immediately in case uncaught error thrown
|
|
29
|
-
this.#noRetry();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function wrapExportedHandler(worker: ExportedHandler): ExportedHandler {
|
|
34
|
-
// If we don't have any middleware defined, just return the handler as is
|
|
35
|
-
if (
|
|
36
|
-
__INTERNAL_WRANGLER_MIDDLEWARE__ === undefined ||
|
|
37
|
-
__INTERNAL_WRANGLER_MIDDLEWARE__.length === 0
|
|
38
|
-
) {
|
|
39
|
-
return worker;
|
|
40
|
-
}
|
|
41
|
-
// Otherwise, register all middleware once
|
|
42
|
-
for (const middleware of __INTERNAL_WRANGLER_MIDDLEWARE__) {
|
|
43
|
-
__facade_register__(middleware);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const fetchDispatcher: ExportedHandlerFetchHandler = function (
|
|
47
|
-
request,
|
|
48
|
-
env,
|
|
49
|
-
ctx
|
|
50
|
-
) {
|
|
51
|
-
if (worker.fetch === undefined) {
|
|
52
|
-
throw new Error("Handler does not export a fetch() function.");
|
|
53
|
-
}
|
|
54
|
-
return worker.fetch(request, env, ctx);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
return {
|
|
58
|
-
...worker,
|
|
59
|
-
fetch(request, env, ctx) {
|
|
60
|
-
const dispatcher: Dispatcher = function (type, init) {
|
|
61
|
-
if (type === "scheduled" && worker.scheduled !== undefined) {
|
|
62
|
-
const controller = new __Facade_ScheduledController__(
|
|
63
|
-
Date.now(),
|
|
64
|
-
init.cron ?? "",
|
|
65
|
-
() => {}
|
|
66
|
-
);
|
|
67
|
-
return worker.scheduled(controller, env, ctx);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
return __facade_invoke__(request, env, ctx, dispatcher, fetchDispatcher);
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function wrapWorkerEntrypoint(
|
|
76
|
-
klass: WorkerEntrypointConstructor
|
|
77
|
-
): WorkerEntrypointConstructor {
|
|
78
|
-
// If we don't have any middleware defined, just return the handler as is
|
|
79
|
-
if (
|
|
80
|
-
__INTERNAL_WRANGLER_MIDDLEWARE__ === undefined ||
|
|
81
|
-
__INTERNAL_WRANGLER_MIDDLEWARE__.length === 0
|
|
82
|
-
) {
|
|
83
|
-
return klass;
|
|
84
|
-
}
|
|
85
|
-
// Otherwise, register all middleware once
|
|
86
|
-
for (const middleware of __INTERNAL_WRANGLER_MIDDLEWARE__) {
|
|
87
|
-
__facade_register__(middleware);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// `extend`ing `klass` here so other RPC methods remain callable
|
|
91
|
-
return class extends klass {
|
|
92
|
-
#fetchDispatcher: ExportedHandlerFetchHandler<Record<string, unknown>> = (
|
|
93
|
-
request,
|
|
94
|
-
env,
|
|
95
|
-
ctx
|
|
96
|
-
) => {
|
|
97
|
-
this.env = env;
|
|
98
|
-
this.ctx = ctx;
|
|
99
|
-
if (super.fetch === undefined) {
|
|
100
|
-
throw new Error("Entrypoint class does not define a fetch() function.");
|
|
101
|
-
}
|
|
102
|
-
return super.fetch(request);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
#dispatcher: Dispatcher = (type, init) => {
|
|
106
|
-
if (type === "scheduled" && super.scheduled !== undefined) {
|
|
107
|
-
const controller = new __Facade_ScheduledController__(
|
|
108
|
-
Date.now(),
|
|
109
|
-
init.cron ?? "",
|
|
110
|
-
() => {}
|
|
111
|
-
);
|
|
112
|
-
return super.scheduled(controller);
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
fetch(request: Request<unknown, IncomingRequestCfProperties>) {
|
|
117
|
-
return __facade_invoke__(
|
|
118
|
-
request,
|
|
119
|
-
this.env,
|
|
120
|
-
this.ctx,
|
|
121
|
-
this.#dispatcher,
|
|
122
|
-
this.#fetchDispatcher
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
let WRAPPED_ENTRY: ExportedHandler | WorkerEntrypointConstructor | undefined;
|
|
129
|
-
if (typeof ENTRY === "object") {
|
|
130
|
-
WRAPPED_ENTRY = wrapExportedHandler(ENTRY);
|
|
131
|
-
} else if (typeof ENTRY === "function") {
|
|
132
|
-
WRAPPED_ENTRY = wrapWorkerEntrypoint(ENTRY);
|
|
133
|
-
}
|
|
134
|
-
export default WRAPPED_ENTRY;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import worker, * as OTHER_EXPORTS from "/Users/n8/orez/src/cf-do/worker.ts";
|
|
2
|
-
import * as __MIDDLEWARE_0__ from "/Users/n8/soot/node_modules/wrangler/templates/middleware/middleware-ensure-req-body-drained.ts";
|
|
3
|
-
import * as __MIDDLEWARE_1__ from "/Users/n8/soot/node_modules/wrangler/templates/middleware/middleware-miniflare3-json-error.ts";
|
|
4
|
-
|
|
5
|
-
export * from "/Users/n8/orez/src/cf-do/worker.ts";
|
|
6
|
-
const MIDDLEWARE_TEST_INJECT = "__INJECT_FOR_TESTING_WRANGLER_MIDDLEWARE__";
|
|
7
|
-
export const __INTERNAL_WRANGLER_MIDDLEWARE__ = [
|
|
8
|
-
|
|
9
|
-
__MIDDLEWARE_0__.default,__MIDDLEWARE_1__.default
|
|
10
|
-
]
|
|
11
|
-
export default worker;
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
// This loads all middlewares exposed on the middleware object and then starts
|
|
2
|
-
// the invocation chain. The big idea is that we can add these to the middleware
|
|
3
|
-
// export dynamically through wrangler, or we can potentially let users directly
|
|
4
|
-
// add them as a sort of "plugin" system.
|
|
5
|
-
|
|
6
|
-
import ENTRY, { __INTERNAL_WRANGLER_MIDDLEWARE__ } from "/Users/n8/orez/src/cf-do/.wrangler/tmp/bundle-vYmw0E/middleware-insertion-facade.js";
|
|
7
|
-
import { __facade_invoke__, __facade_register__, Dispatcher } from "/Users/n8/soot/node_modules/wrangler/templates/middleware/common.ts";
|
|
8
|
-
import type { WorkerEntrypointConstructor } from "/Users/n8/orez/src/cf-do/.wrangler/tmp/bundle-vYmw0E/middleware-insertion-facade.js";
|
|
9
|
-
|
|
10
|
-
// Preserve all the exports from the worker
|
|
11
|
-
export * from "/Users/n8/orez/src/cf-do/.wrangler/tmp/bundle-vYmw0E/middleware-insertion-facade.js";
|
|
12
|
-
|
|
13
|
-
class __Facade_ScheduledController__ implements ScheduledController {
|
|
14
|
-
readonly #noRetry: ScheduledController["noRetry"];
|
|
15
|
-
|
|
16
|
-
constructor(
|
|
17
|
-
readonly scheduledTime: number,
|
|
18
|
-
readonly cron: string,
|
|
19
|
-
noRetry: ScheduledController["noRetry"]
|
|
20
|
-
) {
|
|
21
|
-
this.#noRetry = noRetry;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
noRetry() {
|
|
25
|
-
if (!(this instanceof __Facade_ScheduledController__)) {
|
|
26
|
-
throw new TypeError("Illegal invocation");
|
|
27
|
-
}
|
|
28
|
-
// Need to call native method immediately in case uncaught error thrown
|
|
29
|
-
this.#noRetry();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function wrapExportedHandler(worker: ExportedHandler): ExportedHandler {
|
|
34
|
-
// If we don't have any middleware defined, just return the handler as is
|
|
35
|
-
if (
|
|
36
|
-
__INTERNAL_WRANGLER_MIDDLEWARE__ === undefined ||
|
|
37
|
-
__INTERNAL_WRANGLER_MIDDLEWARE__.length === 0
|
|
38
|
-
) {
|
|
39
|
-
return worker;
|
|
40
|
-
}
|
|
41
|
-
// Otherwise, register all middleware once
|
|
42
|
-
for (const middleware of __INTERNAL_WRANGLER_MIDDLEWARE__) {
|
|
43
|
-
__facade_register__(middleware);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const fetchDispatcher: ExportedHandlerFetchHandler = function (
|
|
47
|
-
request,
|
|
48
|
-
env,
|
|
49
|
-
ctx
|
|
50
|
-
) {
|
|
51
|
-
if (worker.fetch === undefined) {
|
|
52
|
-
throw new Error("Handler does not export a fetch() function.");
|
|
53
|
-
}
|
|
54
|
-
return worker.fetch(request, env, ctx);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
return {
|
|
58
|
-
...worker,
|
|
59
|
-
fetch(request, env, ctx) {
|
|
60
|
-
const dispatcher: Dispatcher = function (type, init) {
|
|
61
|
-
if (type === "scheduled" && worker.scheduled !== undefined) {
|
|
62
|
-
const controller = new __Facade_ScheduledController__(
|
|
63
|
-
Date.now(),
|
|
64
|
-
init.cron ?? "",
|
|
65
|
-
() => {}
|
|
66
|
-
);
|
|
67
|
-
return worker.scheduled(controller, env, ctx);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
return __facade_invoke__(request, env, ctx, dispatcher, fetchDispatcher);
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function wrapWorkerEntrypoint(
|
|
76
|
-
klass: WorkerEntrypointConstructor
|
|
77
|
-
): WorkerEntrypointConstructor {
|
|
78
|
-
// If we don't have any middleware defined, just return the handler as is
|
|
79
|
-
if (
|
|
80
|
-
__INTERNAL_WRANGLER_MIDDLEWARE__ === undefined ||
|
|
81
|
-
__INTERNAL_WRANGLER_MIDDLEWARE__.length === 0
|
|
82
|
-
) {
|
|
83
|
-
return klass;
|
|
84
|
-
}
|
|
85
|
-
// Otherwise, register all middleware once
|
|
86
|
-
for (const middleware of __INTERNAL_WRANGLER_MIDDLEWARE__) {
|
|
87
|
-
__facade_register__(middleware);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// `extend`ing `klass` here so other RPC methods remain callable
|
|
91
|
-
return class extends klass {
|
|
92
|
-
#fetchDispatcher: ExportedHandlerFetchHandler<Record<string, unknown>> = (
|
|
93
|
-
request,
|
|
94
|
-
env,
|
|
95
|
-
ctx
|
|
96
|
-
) => {
|
|
97
|
-
this.env = env;
|
|
98
|
-
this.ctx = ctx;
|
|
99
|
-
if (super.fetch === undefined) {
|
|
100
|
-
throw new Error("Entrypoint class does not define a fetch() function.");
|
|
101
|
-
}
|
|
102
|
-
return super.fetch(request);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
#dispatcher: Dispatcher = (type, init) => {
|
|
106
|
-
if (type === "scheduled" && super.scheduled !== undefined) {
|
|
107
|
-
const controller = new __Facade_ScheduledController__(
|
|
108
|
-
Date.now(),
|
|
109
|
-
init.cron ?? "",
|
|
110
|
-
() => {}
|
|
111
|
-
);
|
|
112
|
-
return super.scheduled(controller);
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
fetch(request: Request<unknown, IncomingRequestCfProperties>) {
|
|
117
|
-
return __facade_invoke__(
|
|
118
|
-
request,
|
|
119
|
-
this.env,
|
|
120
|
-
this.ctx,
|
|
121
|
-
this.#dispatcher,
|
|
122
|
-
this.#fetchDispatcher
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
let WRAPPED_ENTRY: ExportedHandler | WorkerEntrypointConstructor | undefined;
|
|
129
|
-
if (typeof ENTRY === "object") {
|
|
130
|
-
WRAPPED_ENTRY = wrapExportedHandler(ENTRY);
|
|
131
|
-
} else if (typeof ENTRY === "function") {
|
|
132
|
-
WRAPPED_ENTRY = wrapWorkerEntrypoint(ENTRY);
|
|
133
|
-
}
|
|
134
|
-
export default WRAPPED_ENTRY;
|