orez-sync-cf-host 0.5.7 → 0.5.9
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 +1 -1
- package/src/generated/sync_wasm_bg.wasm +0 -0
- package/src/host.ts +11 -9
package/package.json
CHANGED
|
Binary file
|
package/src/host.ts
CHANGED
|
@@ -897,6 +897,14 @@ export function createSyncDurableObject<Env extends SyncHostEnv>(
|
|
|
897
897
|
(typeof config.queryAware === 'function'
|
|
898
898
|
? config.queryAware(claims)
|
|
899
899
|
: (config.queryAware ?? Boolean(config.resolveQuery)))
|
|
900
|
+
const transformVersion = queryAware
|
|
901
|
+
? typeof config.queryTransformVersion === 'function'
|
|
902
|
+
? config.queryTransformVersion(claims)
|
|
903
|
+
: (config.queryTransformVersion ?? 0)
|
|
904
|
+
: 0
|
|
905
|
+
if (!Number.isSafeInteger(transformVersion) || transformVersion < 0) {
|
|
906
|
+
throw new TypeError('queryTransformVersion must be a non-negative safe integer')
|
|
907
|
+
}
|
|
900
908
|
if (queryAware && body.queries) {
|
|
901
909
|
const queries = body.queries as {
|
|
902
910
|
version?: unknown
|
|
@@ -929,15 +937,6 @@ export function createSyncDurableObject<Env extends SyncHostEnv>(
|
|
|
929
937
|
} catch (error) {
|
|
930
938
|
throw requestError(`unknown or unsupported named query: ${op.name}`)
|
|
931
939
|
}
|
|
932
|
-
const transformVersion =
|
|
933
|
-
typeof config.queryTransformVersion === 'function'
|
|
934
|
-
? config.queryTransformVersion(claims)
|
|
935
|
-
: (config.queryTransformVersion ?? 0)
|
|
936
|
-
if (!Number.isSafeInteger(transformVersion) || transformVersion < 0) {
|
|
937
|
-
throw new TypeError(
|
|
938
|
-
'queryTransformVersion must be a non-negative safe integer'
|
|
939
|
-
)
|
|
940
|
-
}
|
|
941
940
|
patch.push({
|
|
942
941
|
op: 'put',
|
|
943
942
|
hash: op.hash,
|
|
@@ -949,6 +948,9 @@ export function createSyncDurableObject<Env extends SyncHostEnv>(
|
|
|
949
948
|
body = { ...body, queries: { ...queries, patch } }
|
|
950
949
|
}
|
|
951
950
|
}
|
|
951
|
+
if (queryAware) {
|
|
952
|
+
body = { ...body, _serverQueryTransformVersion: transformVersion }
|
|
953
|
+
}
|
|
952
954
|
const clientID = typeof body.clientID === 'string' ? body.clientID : ''
|
|
953
955
|
this.#pulling.add(clientID)
|
|
954
956
|
let response: Record<string, unknown>
|