@livestore/sync-cf 0.0.0-snapshot-870cb544d0c8d1f1b0353219e9d4160d5bc9d58e → 0.0.58-dev.10
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/.wrangler/state/v3/d1/miniflare-D1DatabaseObject/8ee300993f9a2c909aede59646369fa0cc28d25304b9b9af94f54d4543ad60f4.sqlite +0 -0
- package/.wrangler/state/v3/do/websocket-server-WebSocketServer/037646d8e1e6ad005a1f4ff1c53fd716bec6a458a8b35ebffd9d5b78ec4ea8a3.sqlite +0 -0
- package/.wrangler/state/v3/do/websocket-server-WebSocketServer/1471dd2fd02c2d9eb229fcf3cad5fd330cd295bfdee44481714d91b883756b11.sqlite +0 -0
- package/.wrangler/state/v3/do/websocket-server-WebSocketServer/23a5a193673cd4aa1f412953ff8ee7cf6169b146127a42e9b84ce79993672b0a.sqlite +0 -0
- package/.wrangler/state/v3/do/websocket-server-WebSocketServer/31569057f8ec82f1d479956671fe58b9f0f4e32a64a68c3ba9c3cb6744f74b3d.sqlite +0 -0
- package/.wrangler/state/v3/do/websocket-server-WebSocketServer/33d6e9d204e8c535d55150b9258a9388ddf594a89f30fc1d557e64546a59e731.sqlite +0 -0
- package/.wrangler/state/v3/do/websocket-server-WebSocketServer/354c1d4fbf3d44a1e359b6595b4e7f2e0c320e607cad72290b0f842246dea4c3.sqlite +0 -0
- package/.wrangler/state/v3/do/websocket-server-WebSocketServer/472d06f3610154b855a10d98212ec0ae8aa4022def5c932134cafe07ddca6cc4.sqlite +0 -0
- package/.wrangler/state/v3/do/websocket-server-WebSocketServer/472d06f3610154b855a10d98212ec0ae8aa4022def5c932134cafe07ddca6cc4.sqlite-shm +0 -0
- package/.wrangler/state/v3/do/websocket-server-WebSocketServer/472d06f3610154b855a10d98212ec0ae8aa4022def5c932134cafe07ddca6cc4.sqlite-wal +0 -0
- package/.wrangler/state/v3/do/websocket-server-WebSocketServer/56fc052bba96d75e557bb09c4826387d0d3500ab0eb8de9e9b7379b795277338.sqlite +0 -0
- package/.wrangler/state/v3/do/websocket-server-WebSocketServer/629b396dda2efd8d251356403fe1c72599dd34b1d0a420ef4aa4f2cec86b7ed8.sqlite +0 -0
- package/.wrangler/state/v3/do/websocket-server-WebSocketServer/70a851401fda75ce3a534dacc3f979fceaff8234430fc6333f22112519388493.sqlite +0 -0
- package/.wrangler/state/v3/do/websocket-server-WebSocketServer/82afe32c9f3dfe706e088859636f9137e1824b12206e1c0870eef31abcb77d2e.sqlite +0 -0
- package/.wrangler/state/v3/do/websocket-server-WebSocketServer/83b7880fabbc105109963ee7d1b9b8560b31a560b6b06cf2c326f4f1eca6e80f.sqlite +0 -0
- package/.wrangler/state/v3/do/websocket-server-WebSocketServer/985f28c526c3fe0133b72007b09233c1a827ae9a588ca5cff0e740f2f5da7dd3.sqlite +0 -0
- package/.wrangler/state/v3/do/websocket-server-WebSocketServer/a0f452412c79c524292ab9f6895e09605492f5980d8ad6cfc34c0fb88ee6d1cd.sqlite +0 -0
- package/.wrangler/state/v3/do/websocket-server-WebSocketServer/a58eeee7c3798f238d9446895cd2d0f140b06589dcdf9a777ed79131eb83ea5b.sqlite +0 -0
- package/.wrangler/state/v3/do/websocket-server-WebSocketServer/baf2225931d572afb47e60d5e189ae58b9764ea0a8a501e0ac202a35c2b35084.sqlite +0 -0
- package/.wrangler/state/v3/do/websocket-server-WebSocketServer/c27c5b00d9c92102951df7d882fb0b9c9f1a9466e0752265b255041c6c3dc739.sqlite +0 -0
- package/.wrangler/state/v3/do/websocket-server-WebSocketServer/c4aa0e61dcd784604bee52282348e0538ab69ec76e1652322bbccd539d9ff3ee.sqlite +0 -0
- package/.wrangler/state/v3/do/websocket-server-WebSocketServer/d2245ee36dd16e1f76180d89bd2503f0d4808a5986a58b8677f9a365a793acc6.sqlite +0 -0
- package/.wrangler/state/v3/do/websocket-server-WebSocketServer/d87433156774c933da83e962eba16107cf02ade2f133d7205963558fe47db3ff.sqlite +0 -0
- package/.wrangler/tmp/bundle-WvptCL/checked-fetch.js +30 -0
- package/.wrangler/tmp/bundle-WvptCL/middleware-insertion-facade.js +11 -0
- package/.wrangler/tmp/bundle-WvptCL/middleware-loader.entry.ts +134 -0
- package/.wrangler/tmp/dev-33iU4b/index.js +42167 -0
- package/.wrangler/tmp/dev-33iU4b/index.js.map +8 -0
- package/.wrangler/tmp/dev-9rcIR8/index.js +18887 -0
- package/.wrangler/tmp/dev-9rcIR8/index.js.map +8 -0
- package/.wrangler/tmp/dev-EkPm0f/index.js +45575 -0
- package/.wrangler/tmp/dev-EkPm0f/index.js.map +8 -0
- package/.wrangler/tmp/dev-rI63Kk/index.js +42165 -0
- package/.wrangler/tmp/dev-rI63Kk/index.js.map +8 -0
- package/.wrangler/tmp/dev-txPodK/index.js +42118 -0
- package/.wrangler/tmp/dev-txPodK/index.js.map +8 -0
- package/dist/.tsbuildinfo +1 -1
- package/package.json +3 -3
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const urls = new Set();
|
|
2
|
+
|
|
3
|
+
function checkURL(request, init) {
|
|
4
|
+
const url =
|
|
5
|
+
request instanceof URL
|
|
6
|
+
? request
|
|
7
|
+
: new URL(
|
|
8
|
+
(typeof request === "string"
|
|
9
|
+
? new Request(request, init)
|
|
10
|
+
: request
|
|
11
|
+
).url
|
|
12
|
+
);
|
|
13
|
+
if (url.port && url.port !== "443" && url.protocol === "https:") {
|
|
14
|
+
if (!urls.has(url.toString())) {
|
|
15
|
+
urls.add(url.toString());
|
|
16
|
+
console.warn(
|
|
17
|
+
`WARNING: known issue with \`fetch()\` requests to custom HTTPS ports in published Workers:\n` +
|
|
18
|
+
` - ${url.toString()} - the custom port will be ignored when the Worker is published using the \`wrangler deploy\` command.\n`
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
globalThis.fetch = new Proxy(globalThis.fetch, {
|
|
25
|
+
apply(target, thisArg, argArray) {
|
|
26
|
+
const [request, init] = argArray;
|
|
27
|
+
checkURL(request, init);
|
|
28
|
+
return Reflect.apply(target, thisArg, argArray);
|
|
29
|
+
},
|
|
30
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import worker, * as OTHER_EXPORTS from "/Users/schickling/Code/overtone/submodules/livestore/packages/@livestore/sync-cf/src/cf-worker/index.ts";
|
|
2
|
+
import * as __MIDDLEWARE_0__ from "/Users/schickling/Code/overtone/node_modules/.pnpm/wrangler@3.84.0_@cloudflare+workers-types@4.20241022.0/node_modules/wrangler/templates/middleware/middleware-ensure-req-body-drained.ts";
|
|
3
|
+
import * as __MIDDLEWARE_1__ from "/Users/schickling/Code/overtone/node_modules/.pnpm/wrangler@3.84.0_@cloudflare+workers-types@4.20241022.0/node_modules/wrangler/templates/middleware/middleware-miniflare3-json-error.ts";
|
|
4
|
+
|
|
5
|
+
export * from "/Users/schickling/Code/overtone/submodules/livestore/packages/@livestore/sync-cf/src/cf-worker/index.ts";
|
|
6
|
+
|
|
7
|
+
export const __INTERNAL_WRANGLER_MIDDLEWARE__ = [
|
|
8
|
+
|
|
9
|
+
__MIDDLEWARE_0__.default,__MIDDLEWARE_1__.default
|
|
10
|
+
]
|
|
11
|
+
export default worker;
|
|
@@ -0,0 +1,134 @@
|
|
|
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/schickling/Code/overtone/submodules/livestore/packages/@livestore/sync-cf/.wrangler/tmp/bundle-WvptCL/middleware-insertion-facade.js";
|
|
7
|
+
import { __facade_invoke__, __facade_register__, Dispatcher } from "/Users/schickling/Code/overtone/node_modules/.pnpm/wrangler@3.84.0_@cloudflare+workers-types@4.20241022.0/node_modules/wrangler/templates/middleware/common.ts";
|
|
8
|
+
import type { WorkerEntrypointConstructor } from "/Users/schickling/Code/overtone/submodules/livestore/packages/@livestore/sync-cf/.wrangler/tmp/bundle-WvptCL/middleware-insertion-facade.js";
|
|
9
|
+
|
|
10
|
+
// Preserve all the exports from the worker
|
|
11
|
+
export * from "/Users/schickling/Code/overtone/submodules/livestore/packages/@livestore/sync-cf/.wrangler/tmp/bundle-WvptCL/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;
|