orez 0.9.7 → 0.10.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.
- package/README.md +27 -19
- package/dist/config.d.ts +0 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +0 -1
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -43
- package/dist/index.js.map +1 -1
- package/package.json +7 -71
- package/dist/cf-deploy/bundle.d.ts +0 -21
- package/dist/cf-deploy/bundle.d.ts.map +0 -1
- package/dist/cf-deploy/bundle.js +0 -347
- package/dist/cf-deploy/bundle.js.map +0 -1
- package/dist/cf-deploy/config.d.ts +0 -52
- package/dist/cf-deploy/config.d.ts.map +0 -1
- package/dist/cf-deploy/config.js +0 -23
- package/dist/cf-deploy/config.js.map +0 -1
- package/dist/cf-deploy/index.d.ts +0 -11
- package/dist/cf-deploy/index.d.ts.map +0 -1
- package/dist/cf-deploy/index.js +0 -17
- package/dist/cf-deploy/index.js.map +0 -1
- package/dist/cf-deploy/leaves.d.ts +0 -19
- package/dist/cf-deploy/leaves.d.ts.map +0 -1
- package/dist/cf-deploy/leaves.js +0 -109
- package/dist/cf-deploy/leaves.js.map +0 -1
- package/dist/cf-deploy/migration.d.ts +0 -40
- package/dist/cf-deploy/migration.d.ts.map +0 -1
- package/dist/cf-deploy/migration.js +0 -891
- package/dist/cf-deploy/migration.js.map +0 -1
- package/dist/cf-deploy/nativeMigrations.d.ts +0 -24
- package/dist/cf-deploy/nativeMigrations.d.ts.map +0 -1
- package/dist/cf-deploy/nativeMigrations.js +0 -185
- package/dist/cf-deploy/nativeMigrations.js.map +0 -1
- package/dist/cf-deploy/prune.d.ts +0 -14
- package/dist/cf-deploy/prune.d.ts.map +0 -1
- package/dist/cf-deploy/prune.js +0 -235
- package/dist/cf-deploy/prune.js.map +0 -1
- package/dist/cf-deploy/shims.d.ts +0 -13
- package/dist/cf-deploy/shims.d.ts.map +0 -1
- package/dist/cf-deploy/shims.js +0 -737
- package/dist/cf-deploy/shims.js.map +0 -1
- package/dist/cf-deploy/smoke.d.ts +0 -15
- package/dist/cf-deploy/smoke.d.ts.map +0 -1
- package/dist/cf-deploy/smoke.js +0 -141
- package/dist/cf-deploy/smoke.js.map +0 -1
- package/dist/cf-deploy/sources.d.ts +0 -9
- package/dist/cf-deploy/sources.d.ts.map +0 -1
- package/dist/cf-deploy/sources.js +0 -276
- package/dist/cf-deploy/sources.js.map +0 -1
- package/dist/cf-deploy/wrangler.d.ts +0 -6
- package/dist/cf-deploy/wrangler.d.ts.map +0 -1
- package/dist/cf-deploy/wrangler.js +0 -168
- package/dist/cf-deploy/wrangler.js.map +0 -1
- package/dist/cf-do/application-sql.d.ts +0 -49
- package/dist/cf-do/application-sql.d.ts.map +0 -1
- package/dist/cf-do/application-sql.js +0 -124
- package/dist/cf-do/application-sql.js.map +0 -1
- package/dist/cf-do/cdc.d.ts +0 -155
- package/dist/cf-do/cdc.d.ts.map +0 -1
- package/dist/cf-do/cdc.js +0 -719
- package/dist/cf-do/cdc.js.map +0 -1
- package/dist/cf-do/cursor-pull.d.ts +0 -27
- package/dist/cf-do/cursor-pull.d.ts.map +0 -1
- package/dist/cf-do/cursor-pull.js +0 -78
- package/dist/cf-do/cursor-pull.js.map +0 -1
- package/dist/cf-do/row-undo.d.ts +0 -36
- package/dist/cf-do/row-undo.d.ts.map +0 -1
- package/dist/cf-do/row-undo.js +0 -221
- package/dist/cf-do/row-undo.js.map +0 -1
- package/dist/cf-do/tx-journal.d.ts +0 -119
- package/dist/cf-do/tx-journal.d.ts.map +0 -1
- package/dist/cf-do/tx-journal.js +0 -718
- package/dist/cf-do/tx-journal.js.map +0 -1
- package/dist/cf-do/watermark.d.ts +0 -29
- package/dist/cf-do/watermark.d.ts.map +0 -1
- package/dist/cf-do/watermark.js +0 -105
- package/dist/cf-do/watermark.js.map +0 -1
- package/dist/cf-do/worker.d.ts +0 -287
- package/dist/cf-do/worker.d.ts.map +0 -1
- package/dist/cf-do/worker.js +0 -1961
- package/dist/cf-do/worker.js.map +0 -1
- package/dist/do-sql-tracking.d.ts +0 -104
- package/dist/do-sql-tracking.d.ts.map +0 -1
- package/dist/do-sql-tracking.js +0 -255
- package/dist/do-sql-tracking.js.map +0 -1
- package/dist/pg-proxy-do-backend.d.ts +0 -211
- package/dist/pg-proxy-do-backend.d.ts.map +0 -1
- package/dist/pg-proxy-do-backend.js +0 -7884
- package/dist/pg-proxy-do-backend.js.map +0 -1
- package/dist/pg-sqlite-compiler/catalog/seed.d.ts +0 -67
- package/dist/pg-sqlite-compiler/catalog/seed.d.ts.map +0 -1
- package/dist/pg-sqlite-compiler/catalog/seed.js +0 -436
- package/dist/pg-sqlite-compiler/catalog/seed.js.map +0 -1
- package/dist/pg-sqlite-compiler/compiler.d.ts +0 -17
- package/dist/pg-sqlite-compiler/compiler.d.ts.map +0 -1
- package/dist/pg-sqlite-compiler/compiler.js +0 -86
- package/dist/pg-sqlite-compiler/compiler.js.map +0 -1
- package/dist/pg-sqlite-compiler/index.d.ts +0 -2
- package/dist/pg-sqlite-compiler/index.d.ts.map +0 -1
- package/dist/pg-sqlite-compiler/index.js +0 -13
- package/dist/pg-sqlite-compiler/index.js.map +0 -1
- package/dist/pg-sqlite-compiler/passes/array.d.ts +0 -3
- package/dist/pg-sqlite-compiler/passes/array.d.ts.map +0 -1
- package/dist/pg-sqlite-compiler/passes/array.js +0 -223
- package/dist/pg-sqlite-compiler/passes/array.js.map +0 -1
- package/dist/pg-sqlite-compiler/passes/ast-utils.d.ts +0 -48
- package/dist/pg-sqlite-compiler/passes/ast-utils.d.ts.map +0 -1
- package/dist/pg-sqlite-compiler/passes/ast-utils.js +0 -93
- package/dist/pg-sqlite-compiler/passes/ast-utils.js.map +0 -1
- package/dist/pg-sqlite-compiler/passes/catalog.d.ts +0 -34
- package/dist/pg-sqlite-compiler/passes/catalog.d.ts.map +0 -1
- package/dist/pg-sqlite-compiler/passes/catalog.js +0 -30
- package/dist/pg-sqlite-compiler/passes/catalog.js.map +0 -1
- package/dist/pg-sqlite-compiler/passes/datetime.d.ts +0 -23
- package/dist/pg-sqlite-compiler/passes/datetime.d.ts.map +0 -1
- package/dist/pg-sqlite-compiler/passes/datetime.js +0 -55
- package/dist/pg-sqlite-compiler/passes/datetime.js.map +0 -1
- package/dist/pg-sqlite-compiler/passes/dml-cte.d.ts +0 -22
- package/dist/pg-sqlite-compiler/passes/dml-cte.d.ts.map +0 -1
- package/dist/pg-sqlite-compiler/passes/dml-cte.js +0 -161
- package/dist/pg-sqlite-compiler/passes/dml-cte.js.map +0 -1
- package/dist/pg-sqlite-compiler/passes/index.d.ts +0 -24
- package/dist/pg-sqlite-compiler/passes/index.d.ts.map +0 -1
- package/dist/pg-sqlite-compiler/passes/index.js +0 -52
- package/dist/pg-sqlite-compiler/passes/index.js.map +0 -1
- package/dist/pg-sqlite-compiler/passes/json-functions.d.ts +0 -3
- package/dist/pg-sqlite-compiler/passes/json-functions.d.ts.map +0 -1
- package/dist/pg-sqlite-compiler/passes/json-functions.js +0 -57
- package/dist/pg-sqlite-compiler/passes/json-functions.js.map +0 -1
- package/dist/pg-sqlite-compiler/passes/row-json.d.ts +0 -3
- package/dist/pg-sqlite-compiler/passes/row-json.d.ts.map +0 -1
- package/dist/pg-sqlite-compiler/passes/row-json.js +0 -230
- package/dist/pg-sqlite-compiler/passes/row-json.js.map +0 -1
- package/dist/pg-sqlite-compiler/passes/schema.d.ts +0 -4
- package/dist/pg-sqlite-compiler/passes/schema.d.ts.map +0 -1
- package/dist/pg-sqlite-compiler/passes/schema.js +0 -128
- package/dist/pg-sqlite-compiler/passes/schema.js.map +0 -1
- package/dist/pg-sqlite-compiler/passes/string-functions.d.ts +0 -11
- package/dist/pg-sqlite-compiler/passes/string-functions.d.ts.map +0 -1
- package/dist/pg-sqlite-compiler/passes/string-functions.js +0 -37
- package/dist/pg-sqlite-compiler/passes/string-functions.js.map +0 -1
- package/dist/pg-sqlite-compiler/passes/types.d.ts +0 -41
- package/dist/pg-sqlite-compiler/passes/types.d.ts.map +0 -1
- package/dist/pg-sqlite-compiler/passes/types.js +0 -115
- package/dist/pg-sqlite-compiler/passes/types.js.map +0 -1
- package/dist/pg-sqlite-compiler/passes/unsupported.d.ts +0 -3
- package/dist/pg-sqlite-compiler/passes/unsupported.d.ts.map +0 -1
- package/dist/pg-sqlite-compiler/passes/unsupported.js +0 -57
- package/dist/pg-sqlite-compiler/passes/unsupported.js.map +0 -1
- package/dist/pg-sqlite-compiler/test/oracle.d.ts +0 -34
- package/dist/pg-sqlite-compiler/test/oracle.d.ts.map +0 -1
- package/dist/pg-sqlite-compiler/test/oracle.js +0 -204
- package/dist/pg-sqlite-compiler/test/oracle.js.map +0 -1
- package/dist/pg-sqlite-compiler/types.d.ts +0 -66
- package/dist/pg-sqlite-compiler/types.d.ts.map +0 -1
- package/dist/pg-sqlite-compiler/types.js +0 -2
- package/dist/pg-sqlite-compiler/types.js.map +0 -1
- package/dist/sync-browser-host/generated/sqlite3-browser.wasm +0 -0
- package/dist/sync-browser-host/generated/sync_wasm.js +0 -922
- package/dist/sync-browser-host/generated/sync_wasm_bg.wasm +0 -0
- package/dist/sync-browser-host/host.d.ts +0 -10
- package/dist/sync-browser-host/host.d.ts.map +0 -1
- package/dist/sync-browser-host/host.js +0 -496
- package/dist/sync-browser-host/host.js.map +0 -1
- package/dist/sync-browser-host/idb-snapshot.d.ts +0 -11
- package/dist/sync-browser-host/idb-snapshot.d.ts.map +0 -1
- package/dist/sync-browser-host/idb-snapshot.js +0 -122
- package/dist/sync-browser-host/idb-snapshot.js.map +0 -1
- package/dist/sync-browser-host/index.d.ts +0 -5
- package/dist/sync-browser-host/index.d.ts.map +0 -1
- package/dist/sync-browser-host/index.js +0 -5
- package/dist/sync-browser-host/index.js.map +0 -1
- package/dist/sync-browser-host/message-port.d.ts +0 -7
- package/dist/sync-browser-host/message-port.d.ts.map +0 -1
- package/dist/sync-browser-host/message-port.js +0 -188
- package/dist/sync-browser-host/message-port.js.map +0 -1
- package/dist/sync-browser-host/sqlite-adapter.d.ts +0 -67
- package/dist/sync-browser-host/sqlite-adapter.d.ts.map +0 -1
- package/dist/sync-browser-host/sqlite-adapter.js +0 -145
- package/dist/sync-browser-host/sqlite-adapter.js.map +0 -1
- package/dist/sync-browser-host/types.d.ts +0 -52
- package/dist/sync-browser-host/types.d.ts.map +0 -1
- package/dist/sync-browser-host/types.js +0 -2
- package/dist/sync-browser-host/types.js.map +0 -1
- package/dist/sync-cf-host.d.ts +0 -2
- package/dist/sync-cf-host.d.ts.map +0 -1
- package/dist/sync-cf-host.js +0 -2
- package/dist/sync-cf-host.js.map +0 -1
- package/dist/sync-executor.d.ts +0 -2
- package/dist/sync-executor.d.ts.map +0 -1
- package/dist/sync-executor.js +0 -2
- package/dist/sync-executor.js.map +0 -1
- package/dist/wake.d.ts +0 -22
- package/dist/wake.d.ts.map +0 -1
- package/dist/wake.js +0 -114
- package/dist/wake.js.map +0 -1
- package/dist/worker/cf-do-shim.d.ts +0 -55
- package/dist/worker/cf-do-shim.d.ts.map +0 -1
- package/dist/worker/cf-do-shim.js +0 -58
- package/dist/worker/cf-do-shim.js.map +0 -1
- package/dist/worker/cf-patches.d.ts +0 -43
- package/dist/worker/cf-patches.d.ts.map +0 -1
- package/dist/worker/cf-patches.js +0 -840
- package/dist/worker/cf-patches.js.map +0 -1
- package/dist/worker/local-sql-backend.d.ts +0 -35
- package/dist/worker/local-sql-backend.d.ts.map +0 -1
- package/dist/worker/local-sql-backend.js +0 -217
- package/dist/worker/local-sql-backend.js.map +0 -1
- package/dist/worker/zero-cache-embed-cf.d.ts +0 -92
- package/dist/worker/zero-cache-embed-cf.d.ts.map +0 -1
- package/dist/worker/zero-cache-embed-cf.js +0 -764
- package/dist/worker/zero-cache-embed-cf.js.map +0 -1
- package/dist/worker/zero-sql-write-circuit.d.ts +0 -46
- package/dist/worker/zero-sql-write-circuit.d.ts.map +0 -1
- package/dist/worker/zero-sql-write-circuit.js +0 -161
- package/dist/worker/zero-sql-write-circuit.js.map +0 -1
- package/dist/zero-http/encrypted-column-codec.d.ts +0 -46
- package/dist/zero-http/encrypted-column-codec.d.ts.map +0 -1
- package/dist/zero-http/encrypted-column-codec.js +0 -676
- package/dist/zero-http/encrypted-column-codec.js.map +0 -1
- package/dist/zero-http/encrypted-column-conformance.d.ts +0 -7
- package/dist/zero-http/encrypted-column-conformance.d.ts.map +0 -1
- package/dist/zero-http/encrypted-column-conformance.js +0 -161
- package/dist/zero-http/encrypted-column-conformance.js.map +0 -1
- package/dist/zero-http/fixture-schema.d.ts +0 -127
- package/dist/zero-http/fixture-schema.d.ts.map +0 -1
- package/dist/zero-http/fixture-schema.js +0 -56
- package/dist/zero-http/fixture-schema.js.map +0 -1
- package/dist/zero-http/mount.d.ts +0 -71
- package/dist/zero-http/mount.d.ts.map +0 -1
- package/dist/zero-http/mount.js +0 -594
- package/dist/zero-http/mount.js.map +0 -1
- package/dist/zero-http/payload-codec.d.ts +0 -91
- package/dist/zero-http/payload-codec.d.ts.map +0 -1
- package/dist/zero-http/payload-codec.js +0 -10
- package/dist/zero-http/payload-codec.js.map +0 -1
- package/dist/zero-http/server.d.ts +0 -16
- package/dist/zero-http/server.d.ts.map +0 -1
- package/dist/zero-http/server.js +0 -270
- package/dist/zero-http/server.js.map +0 -1
- package/dist/zero-http/test-harness.d.ts +0 -32
- package/dist/zero-http/test-harness.d.ts.map +0 -1
- package/dist/zero-http/test-harness.js +0 -77
- package/dist/zero-http/test-harness.js.map +0 -1
- package/dist/zero-http/transport.d.ts +0 -71
- package/dist/zero-http/transport.d.ts.map +0 -1
- package/dist/zero-http/transport.js +0 -1106
- package/dist/zero-http/transport.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../packages/sync-browser-host/src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gB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ources":["../../packages/sync-browser-host/src/types.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,UAAU,GAKX,MAAM,8BAA8B,CAAA"}
|
package/dist/sync-cf-host.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sync-cf-host.d.ts","sourceRoot":"","sources":["../src/sync-cf-host.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
|
package/dist/sync-cf-host.js
DELETED
package/dist/sync-cf-host.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sync-cf-host.js","sourceRoot":"","sources":["../src/sync-cf-host.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
|
package/dist/sync-executor.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sync-executor.d.ts","sourceRoot":"","sources":["../src/sync-executor.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
|
package/dist/sync-executor.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sync-executor.js","sourceRoot":"","sources":["../src/sync-executor.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
|
package/dist/wake.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export type WakeCapability = {
|
|
2
|
-
readonly namespace: string;
|
|
3
|
-
readonly identity: string;
|
|
4
|
-
readonly expiresAt: number;
|
|
5
|
-
};
|
|
6
|
-
export type MintWakeCapabilityOptions = {
|
|
7
|
-
readonly namespace: string;
|
|
8
|
-
readonly identity: string;
|
|
9
|
-
readonly ttlMs: number;
|
|
10
|
-
};
|
|
11
|
-
export type VerifyWakeCapabilityOptions = {
|
|
12
|
-
readonly namespace: string;
|
|
13
|
-
readonly ttlMs: number;
|
|
14
|
-
};
|
|
15
|
-
export declare function timingSafeEqual(left: string | Uint8Array, right: string | Uint8Array): boolean;
|
|
16
|
-
export declare function verifySharedSecretHeader(request: Request, secret: string, headerName?: string): boolean;
|
|
17
|
-
export declare function mintWakeCapability(secret: string, options: MintWakeCapabilityOptions): Promise<{
|
|
18
|
-
readonly token: string;
|
|
19
|
-
readonly expiresAt: number;
|
|
20
|
-
}>;
|
|
21
|
-
export declare function verifyWakeCapability(secret: string, token: string | null | undefined, options: VerifyWakeCapabilityOptions): Promise<WakeCapability | null>;
|
|
22
|
-
//# sourceMappingURL=wake.d.ts.map
|
package/dist/wake.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wake.d.ts","sourceRoot":"","sources":["../src/wake.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG;IACxC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB,CAAA;AAqDD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU,WASpF;AAED,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,UAAU,SAAgB,GACzB,OAAO,CAGT;AAED,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAkBjE;AAED,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAChC,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAwChC"}
|
package/dist/wake.js
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
const TOKEN_VERSION = 'v1';
|
|
2
|
-
const SIGNATURE_CONTEXT = 'orez-wake-capability-v1:';
|
|
3
|
-
const MAX_TOKEN_LENGTH = 2048;
|
|
4
|
-
const MAX_NAMESPACE_LENGTH = 200;
|
|
5
|
-
const MAX_IDENTITY_LENGTH = 200;
|
|
6
|
-
const encoder = new TextEncoder();
|
|
7
|
-
const decoder = new TextDecoder();
|
|
8
|
-
function validateSecret(secret) {
|
|
9
|
-
if (!secret)
|
|
10
|
-
throw new TypeError('wake capability secret must not be empty');
|
|
11
|
-
}
|
|
12
|
-
function validateNamespace(namespace) {
|
|
13
|
-
if (!namespace || namespace.length > MAX_NAMESPACE_LENGTH) {
|
|
14
|
-
throw new TypeError('wake capability namespace is invalid');
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
function validateIdentity(identity) {
|
|
18
|
-
if (!identity || identity.length > MAX_IDENTITY_LENGTH) {
|
|
19
|
-
throw new TypeError('wake capability identity is invalid');
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function validateTtl(ttlMs) {
|
|
23
|
-
if (!Number.isSafeInteger(ttlMs) || ttlMs <= 0) {
|
|
24
|
-
throw new TypeError('wake capability ttlMs must be a positive integer');
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function encodeBase64Url(bytes) {
|
|
28
|
-
let binary = '';
|
|
29
|
-
for (const byte of bytes)
|
|
30
|
-
binary += String.fromCharCode(byte);
|
|
31
|
-
return btoa(binary).replaceAll('+', '-').replaceAll('/', '_').replace(/=+$/, '');
|
|
32
|
-
}
|
|
33
|
-
function decodeBase64Url(value) {
|
|
34
|
-
if (!/^[A-Za-z0-9_-]+$/.test(value))
|
|
35
|
-
throw new TypeError('invalid base64url');
|
|
36
|
-
const base64 = value.replaceAll('-', '+').replaceAll('_', '/');
|
|
37
|
-
const binary = atob(base64.padEnd(Math.ceil(base64.length / 4) * 4, '='));
|
|
38
|
-
return Uint8Array.from(binary, (character) => character.charCodeAt(0));
|
|
39
|
-
}
|
|
40
|
-
async function sign(secret, payload) {
|
|
41
|
-
const key = await crypto.subtle.importKey('raw', encoder.encode(secret), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign']);
|
|
42
|
-
return new Uint8Array(await crypto.subtle.sign('HMAC', key, encoder.encode(SIGNATURE_CONTEXT + payload)));
|
|
43
|
-
}
|
|
44
|
-
export function timingSafeEqual(left, right) {
|
|
45
|
-
const leftBytes = typeof left === 'string' ? encoder.encode(left) : left;
|
|
46
|
-
const rightBytes = typeof right === 'string' ? encoder.encode(right) : right;
|
|
47
|
-
const length = Math.max(leftBytes.length, rightBytes.length);
|
|
48
|
-
let difference = leftBytes.length ^ rightBytes.length;
|
|
49
|
-
for (let index = 0; index < length; index++) {
|
|
50
|
-
difference |= (leftBytes[index] ?? 0) ^ (rightBytes[index] ?? 0);
|
|
51
|
-
}
|
|
52
|
-
return difference === 0;
|
|
53
|
-
}
|
|
54
|
-
export function verifySharedSecretHeader(request, secret, headerName = 'x-admin-key') {
|
|
55
|
-
const received = request.headers.get(headerName);
|
|
56
|
-
return received !== null && secret.length > 0 && timingSafeEqual(received, secret);
|
|
57
|
-
}
|
|
58
|
-
export async function mintWakeCapability(secret, options) {
|
|
59
|
-
validateSecret(secret);
|
|
60
|
-
validateNamespace(options.namespace);
|
|
61
|
-
validateIdentity(options.identity);
|
|
62
|
-
validateTtl(options.ttlMs);
|
|
63
|
-
const expiresAt = Date.now() + options.ttlMs;
|
|
64
|
-
const payload = encodeBase64Url(encoder.encode(JSON.stringify({
|
|
65
|
-
namespace: options.namespace,
|
|
66
|
-
identity: options.identity,
|
|
67
|
-
expiresAt,
|
|
68
|
-
})));
|
|
69
|
-
const signature = encodeBase64Url(await sign(secret, payload));
|
|
70
|
-
return { token: `${TOKEN_VERSION}.${payload}.${signature}`, expiresAt };
|
|
71
|
-
}
|
|
72
|
-
export async function verifyWakeCapability(secret, token, options) {
|
|
73
|
-
validateSecret(secret);
|
|
74
|
-
validateNamespace(options.namespace);
|
|
75
|
-
validateTtl(options.ttlMs);
|
|
76
|
-
if (!token || token.length > MAX_TOKEN_LENGTH)
|
|
77
|
-
return null;
|
|
78
|
-
const parts = token.split('.');
|
|
79
|
-
if (parts.length !== 3 || parts[0] !== TOKEN_VERSION)
|
|
80
|
-
return null;
|
|
81
|
-
const payload = parts[1];
|
|
82
|
-
const encodedSignature = parts[2];
|
|
83
|
-
if (!payload || !encodedSignature)
|
|
84
|
-
return null;
|
|
85
|
-
try {
|
|
86
|
-
const signature = decodeBase64Url(encodedSignature);
|
|
87
|
-
if (!timingSafeEqual(signature, await sign(secret, payload)))
|
|
88
|
-
return null;
|
|
89
|
-
const value = JSON.parse(decoder.decode(decodeBase64Url(payload)));
|
|
90
|
-
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
91
|
-
return null;
|
|
92
|
-
const capability = value;
|
|
93
|
-
const now = Date.now();
|
|
94
|
-
if (capability.namespace !== options.namespace ||
|
|
95
|
-
typeof capability.identity !== 'string' ||
|
|
96
|
-
!capability.identity ||
|
|
97
|
-
capability.identity.length > MAX_IDENTITY_LENGTH ||
|
|
98
|
-
typeof capability.expiresAt !== 'number' ||
|
|
99
|
-
!Number.isSafeInteger(capability.expiresAt) ||
|
|
100
|
-
capability.expiresAt <= now ||
|
|
101
|
-
capability.expiresAt > now + options.ttlMs) {
|
|
102
|
-
return null;
|
|
103
|
-
}
|
|
104
|
-
return {
|
|
105
|
-
namespace: options.namespace,
|
|
106
|
-
identity: capability.identity,
|
|
107
|
-
expiresAt: capability.expiresAt,
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
catch {
|
|
111
|
-
return null;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
//# sourceMappingURL=wake.js.map
|
package/dist/wake.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wake.js","sourceRoot":"","sources":["../src/wake.ts"],"names":[],"mappings":"AAAA,MAAM,aAAa,GAAG,IAAI,CAAA;AAC1B,MAAM,iBAAiB,GAAG,0BAA0B,CAAA;AACpD,MAAM,gBAAgB,GAAG,IAAI,CAAA;AAC7B,MAAM,oBAAoB,GAAG,GAAG,CAAA;AAChC,MAAM,mBAAmB,GAAG,GAAG,CAAA;AAmB/B,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAA;AACjC,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAA;AAEjC,SAAS,cAAc,CAAC,MAAc;IACpC,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,SAAS,CAAC,0CAA0C,CAAC,CAAA;AAC9E,CAAC;AAED,SAAS,iBAAiB,CAAC,SAAiB;IAC1C,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,oBAAoB,EAAE,CAAC;QAC1D,MAAM,IAAI,SAAS,CAAC,sCAAsC,CAAC,CAAA;IAC7D,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,QAAgB;IACxC,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAM,GAAG,mBAAmB,EAAE,CAAC;QACvD,MAAM,IAAI,SAAS,CAAC,qCAAqC,CAAC,CAAA;IAC5D,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,KAAa;IAChC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QAC/C,MAAM,IAAI,SAAS,CAAC,kDAAkD,CAAC,CAAA;IACzE,CAAC;AACH,CAAC;AAED,SAAS,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
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* namespace routing primitives for the Cloudflare Durable Object deploy.
|
|
3
|
-
*
|
|
4
|
-
* a multi-tenant CF/orez deploy shards data into one DO instance per tenant
|
|
5
|
-
* namespace (`ns:<scope>-<id>`) plus a control-plane `singleton`. the worker
|
|
6
|
-
* tiers carry the chosen namespace in a header (and re-stamp it so an inbound
|
|
7
|
-
* value is never trusted) and must validate its shape before routing — an
|
|
8
|
-
* unvalidated namespace would let a client mint unbounded DO instances.
|
|
9
|
-
*
|
|
10
|
-
* the deployed worker entry classes are bundled strings in the consumer's
|
|
11
|
-
* deploy integration (awkward to unit-test), so the routing decision and the
|
|
12
|
-
* security-relevant shape validation live here as pure functions, tested in
|
|
13
|
-
* cf-do-shim.test.ts. consumers import these into their worker shims instead of
|
|
14
|
-
* copy-pasting the validation regex at every routing site.
|
|
15
|
-
*/
|
|
16
|
-
export interface NamespaceRoutingOptions {
|
|
17
|
-
/** allowed namespace scope prefixes. default `['proj', 'test']`. */
|
|
18
|
-
scopes?: readonly string[];
|
|
19
|
-
/**
|
|
20
|
-
* namespace values that resolve to the control-plane `singleton` instance,
|
|
21
|
-
* in addition to the empty string (which is always the singleton).
|
|
22
|
-
*/
|
|
23
|
-
controlPlaneNamespaces?: readonly string[];
|
|
24
|
-
/** request header the worker tiers carry the namespace in. default `x-orez-ns`. */
|
|
25
|
-
nsHeader?: string;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* true when `ns` is a structurally valid tenant namespace: a configured scope
|
|
29
|
-
* prefix followed by a 1-64 char `[A-Za-z0-9_-]` id. this is the gate that
|
|
30
|
-
* keeps a stray header from minting an unbounded DO instance, so every routing
|
|
31
|
-
* site that forwards a namespace should run it.
|
|
32
|
-
*/
|
|
33
|
-
export declare function isValidNamespace(ns: string, opts?: NamespaceRoutingOptions): boolean;
|
|
34
|
-
/**
|
|
35
|
-
* resolve a raw namespace string to a DO instance name:
|
|
36
|
-
* - `''` or a control-plane alias -> `'singleton'`
|
|
37
|
-
* - a valid tenant namespace -> `'ns:<ns>'`
|
|
38
|
-
* - anything else -> `null` (caller should reject the request)
|
|
39
|
-
*/
|
|
40
|
-
export declare function doInstanceName(ns: string, opts?: NamespaceRoutingOptions): string | null;
|
|
41
|
-
interface HeaderReader {
|
|
42
|
-
get(name: string): string | null;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* read the namespace from a request (the configured header, falling back to the
|
|
46
|
-
* `?ns=` query param) and resolve it to a DO instance name. returns `null` for a
|
|
47
|
-
* structurally invalid namespace so the worker can reply 400 instead of routing.
|
|
48
|
-
*/
|
|
49
|
-
export declare function doInstanceNameForRequest(request: {
|
|
50
|
-
headers: HeaderReader;
|
|
51
|
-
}, url: {
|
|
52
|
-
searchParams: HeaderReader;
|
|
53
|
-
}, opts?: NamespaceRoutingOptions): string | null;
|
|
54
|
-
export {};
|
|
55
|
-
//# sourceMappingURL=cf-do-shim.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cf-do-shim.d.ts","sourceRoot":"","sources":["../../src/worker/cf-do-shim.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,MAAM,WAAW,uBAAuB;IACtC,oEAAoE;IACpE,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC1B;;;OAGG;IACH,sBAAsB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC1C,mFAAmF;IACnF,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAWD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,MAAM,EACV,IAAI,GAAE,uBAA4B,GACjC,OAAO,CAET;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,EAAE,EAAE,MAAM,EACV,IAAI,GAAE,uBAA4B,GACjC,MAAM,GAAG,IAAI,CAKf;AAED,UAAU,YAAY;IACpB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;CACjC;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE;IAAE,OAAO,EAAE,YAAY,CAAA;CAAE,EAClC,GAAG,EAAE;IAAE,YAAY,EAAE,YAAY,CAAA;CAAE,EACnC,IAAI,GAAE,uBAA4B,GACjC,MAAM,GAAG,IAAI,CAIf"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* namespace routing primitives for the Cloudflare Durable Object deploy.
|
|
3
|
-
*
|
|
4
|
-
* a multi-tenant CF/orez deploy shards data into one DO instance per tenant
|
|
5
|
-
* namespace (`ns:<scope>-<id>`) plus a control-plane `singleton`. the worker
|
|
6
|
-
* tiers carry the chosen namespace in a header (and re-stamp it so an inbound
|
|
7
|
-
* value is never trusted) and must validate its shape before routing — an
|
|
8
|
-
* unvalidated namespace would let a client mint unbounded DO instances.
|
|
9
|
-
*
|
|
10
|
-
* the deployed worker entry classes are bundled strings in the consumer's
|
|
11
|
-
* deploy integration (awkward to unit-test), so the routing decision and the
|
|
12
|
-
* security-relevant shape validation live here as pure functions, tested in
|
|
13
|
-
* cf-do-shim.test.ts. consumers import these into their worker shims instead of
|
|
14
|
-
* copy-pasting the validation regex at every routing site.
|
|
15
|
-
*/
|
|
16
|
-
/** default namespace scope prefixes (`proj-<id>`, `test-<id>`). */
|
|
17
|
-
const DEFAULT_SCOPES = ['proj', 'test'];
|
|
18
|
-
function escapeForRegExp(value) {
|
|
19
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
20
|
-
}
|
|
21
|
-
function namespacePattern(scopes) {
|
|
22
|
-
const group = scopes.map(escapeForRegExp).join('|');
|
|
23
|
-
return new RegExp(`^(?:${group})-[A-Za-z0-9_-]{1,64}$`);
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* true when `ns` is a structurally valid tenant namespace: a configured scope
|
|
27
|
-
* prefix followed by a 1-64 char `[A-Za-z0-9_-]` id. this is the gate that
|
|
28
|
-
* keeps a stray header from minting an unbounded DO instance, so every routing
|
|
29
|
-
* site that forwards a namespace should run it.
|
|
30
|
-
*/
|
|
31
|
-
export function isValidNamespace(ns, opts = {}) {
|
|
32
|
-
return namespacePattern(opts.scopes ?? DEFAULT_SCOPES).test(ns);
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* resolve a raw namespace string to a DO instance name:
|
|
36
|
-
* - `''` or a control-plane alias -> `'singleton'`
|
|
37
|
-
* - a valid tenant namespace -> `'ns:<ns>'`
|
|
38
|
-
* - anything else -> `null` (caller should reject the request)
|
|
39
|
-
*/
|
|
40
|
-
export function doInstanceName(ns, opts = {}) {
|
|
41
|
-
if (!ns)
|
|
42
|
-
return 'singleton';
|
|
43
|
-
if ((opts.controlPlaneNamespaces ?? []).includes(ns))
|
|
44
|
-
return 'singleton';
|
|
45
|
-
if (!isValidNamespace(ns, opts))
|
|
46
|
-
return null;
|
|
47
|
-
return 'ns:' + ns;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* read the namespace from a request (the configured header, falling back to the
|
|
51
|
-
* `?ns=` query param) and resolve it to a DO instance name. returns `null` for a
|
|
52
|
-
* structurally invalid namespace so the worker can reply 400 instead of routing.
|
|
53
|
-
*/
|
|
54
|
-
export function doInstanceNameForRequest(request, url, opts = {}) {
|
|
55
|
-
const ns = request.headers.get(opts.nsHeader ?? 'x-orez-ns') || url.searchParams.get('ns') || '';
|
|
56
|
-
return doInstanceName(ns, opts);
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=cf-do-shim.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cf-do-shim.js","sourceRoot":"","sources":["../../src/worker/cf-do-shim.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,mEAAmE;AACnE,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,MAAM,CAAU,CAAA;AAch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* zero-cache CF Workers overlay.
|
|
3
|
-
*
|
|
4
|
-
* copies @rocicorp/zero's compiled `out/` tree into a generated overlay and
|
|
5
|
-
* applies CF Worker patches there. the installed package in node_modules is
|
|
6
|
-
* never modified.
|
|
7
|
-
*
|
|
8
|
-
* eleven patches:
|
|
9
|
-
* 1. worker-urls.js — replace file:// URLs with zero-worker:// identifiers
|
|
10
|
-
* 2. server worker entrypoints — disable CLI auto-start blocks
|
|
11
|
-
* 3. worker state — localize log contexts and disable process-global telemetry
|
|
12
|
-
* 4. processes.js — replace dynamic import() with static worker module lookup
|
|
13
|
-
* 5. process lifecycle — stop and join a cancelled in-process worker tree
|
|
14
|
-
* 6. write-worker-client.js — run zero-cache's replica writer in-process
|
|
15
|
-
* 7. custom/fetch.js — route mutate/query fetches by logical DO identity
|
|
16
|
-
* 8. initial-sync.js — cap DO batch parameter counts
|
|
17
|
-
* 9. litestream commands.js — retain the durable replica on restart
|
|
18
|
-
* 10. change-streamer-service.js — keep cleanup alive after no-subscriber ticks
|
|
19
|
-
* 11. pgsql-parser — load libpg-query as a precompiled Worker wasm module
|
|
20
|
-
*
|
|
21
|
-
* usage in a worker build script:
|
|
22
|
-
*
|
|
23
|
-
* import { prepareZeroCacheForCF } from 'orez/worker/cf-patches'
|
|
24
|
-
* import { getBrowserAliases } from 'orez/worker/browser-build-config'
|
|
25
|
-
*
|
|
26
|
-
* const zero = prepareZeroCacheForCF({ nodeModulesPath: './node_modules' })
|
|
27
|
-
* const alias = getBrowserAliases(zero)
|
|
28
|
-
*
|
|
29
|
-
* idempotent: safe to run multiple times. the overlay directory is recreated.
|
|
30
|
-
*/
|
|
31
|
-
export interface ZeroCacheCFPrepareOptions {
|
|
32
|
-
nodeModulesPath: string;
|
|
33
|
-
outDir?: string;
|
|
34
|
-
}
|
|
35
|
-
export interface ZeroCacheCFPrepareResult {
|
|
36
|
-
nodeModulesPath: string;
|
|
37
|
-
outDir: string;
|
|
38
|
-
zeroOutDir: string;
|
|
39
|
-
zeroCacheSrcDir: string;
|
|
40
|
-
aliases: Record<string, string>;
|
|
41
|
-
}
|
|
42
|
-
export declare function prepareZeroCacheForCF(input: string | ZeroCacheCFPrepareOptions): ZeroCacheCFPrepareResult;
|
|
43
|
-
//# sourceMappingURL=cf-patches.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cf-patches.d.ts","sourceRoot":"","sources":["../../src/worker/cf-patches.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAsCH,MAAM,WAAW,yBAAyB;IACxC,eAAe,EAAE,MAAM,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,wBAAwB;IACvC,eAAe,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,MAAM,CAAA;IACvB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAChC;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,GAAG,yBAAyB,GACxC,wBAAwB,CAoF1B"}
|