@teyik0/furin 0.4.0-alpha.1 → 0.5.0-alpha.1
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/adapter/bun.d.ts +2 -18
- package/dist/adapter/package.d.ts +2 -2
- package/dist/adapter/runtime-build.d.ts +33 -0
- package/dist/adapter/vercel.d.ts +3 -0
- package/dist/build/client.d.ts +1 -1
- package/dist/build/compile-entry.d.ts +6 -4
- package/dist/build/compile-entry.ts +36 -77
- package/dist/build/elysia-aot.d.ts +9 -0
- package/dist/build/entry-template.d.ts +9 -3
- package/dist/build/entry-template.ts +55 -13
- package/dist/build/index.d.ts +1 -1
- package/dist/build/index.js +8912 -6391
- package/dist/build/server-app-entry.d.ts +12 -0
- package/dist/build/ssg-cache.d.ts +13 -0
- package/dist/build/types.d.ts +25 -2
- package/dist/build/virtual-entry.d.ts +8 -0
- package/dist/cache.d.ts +6 -0
- package/dist/cache.js +282 -0
- package/dist/cli/index.js +8936 -6308
- package/dist/cli/preview.d.ts +7 -0
- package/dist/client/boundaries.d.ts +1 -0
- package/dist/client/browser-events-runtime.d.ts +2 -0
- package/dist/client/browser-events.d.ts +2 -0
- package/dist/client/define-route.d.ts +9 -8
- package/dist/client/dev-error-overlay.d.ts +1 -0
- package/dist/client/dev-error-overlay.ts +201 -0
- package/dist/client/document.d.ts +1 -0
- package/dist/client/hmr.d.ts +4 -2
- package/dist/client/internal/runtime-types.d.ts +8 -1
- package/dist/client/link.js +465 -86
- package/dist/client/router/provider.d.ts +1 -1
- package/dist/client/router/sync-catch-up.d.ts +1 -1
- package/dist/client/router/types.d.ts +8 -10
- package/dist/client/sync.d.ts +1 -0
- package/dist/client.js +37 -23
- package/dist/config.d.ts +35 -17
- package/dist/config.js +10 -2
- package/dist/define-route.d.ts +282 -1015
- package/dist/devtools/protocol.d.ts +2 -2
- package/dist/furin.d.ts +21 -6
- package/dist/furin.js +12823 -8484
- package/dist/plugin/index.js +476 -7
- package/dist/plugin/routes.d.ts +10 -3
- package/dist/rsc/build/index.d.ts +5 -1
- package/dist/server/assets/production.d.ts +3 -0
- package/dist/server/auto-invalidate/plugin.d.ts +8 -24
- package/dist/server/auto-invalidate/runtime.d.ts +2 -2
- package/dist/server/browser-events/plugin.d.ts +11 -0
- package/dist/server/browser-events/types.d.ts +9 -0
- package/dist/server/cache/invalidation.d.ts +2 -3
- package/dist/server/cache/isr.d.ts +1 -0
- package/dist/server/cache/page-cache-state.d.ts +5 -0
- package/dist/server/cache/page-cache.d.ts +53 -0
- package/dist/server/cache/purger.d.ts +7 -0
- package/dist/server/cache/redis/index.d.ts +39 -0
- package/dist/server/cache/redis/index.js +396 -0
- package/dist/server/cache/redis/scripts.d.ts +6 -0
- package/dist/server/cache/runtime-cache.d.ts +21 -0
- package/dist/server/context-logger.d.ts +2 -2
- package/dist/server/dev/browser-events.d.ts +4 -0
- package/dist/server/dev/diagnostics.d.ts +39 -0
- package/dist/server/dev/error.d.ts +17 -0
- package/dist/server/dev/graph.d.ts +86 -0
- package/dist/server/dev/plugin.d.ts +9 -0
- package/dist/server/dev/request-security.d.ts +1 -0
- package/dist/server/dev/rewrite-module-specifiers.d.ts +7 -0
- package/dist/server/dev/runtime.production.d.ts +6 -0
- package/dist/server/dev/symbolicate.d.ts +11 -0
- package/dist/server/dev/transform-failure.d.ts +4 -0
- package/dist/server/dev-page-plugin.d.ts +7 -0
- package/dist/server/dev-page-plugin.production.d.ts +1 -0
- package/dist/server/devtools/hub.d.ts +3 -2
- package/dist/server/devtools/instrumentation.d.ts +1 -1
- package/dist/server/devtools/instrumentation.production.d.ts +1 -1
- package/dist/server/devtools/plugin.d.ts +1 -1
- package/dist/server/evlog.d.ts +14 -0
- package/dist/server/external-prerender.d.ts +2 -0
- package/dist/server/instance.d.ts +2 -2
- package/dist/server/internal.d.ts +20 -2
- package/dist/server/internal.js +2973 -1
- package/dist/server/render/element.d.ts +1 -0
- package/dist/server/render/index.d.ts +1 -1
- package/dist/server/render/index.ts +1 -1
- package/dist/server/render/not-found.d.ts +1 -1
- package/dist/server/render/ppr-document.d.ts +21 -0
- package/dist/server/render/ppr-request.d.ts +26 -0
- package/dist/server/render/ppr-route.d.ts +3 -1
- package/dist/server/render/shell.ts +0 -12
- package/dist/server/render/ssg.d.ts +7 -0
- package/dist/server/render/ssr.d.ts +17 -6
- package/dist/server/render/static-params.d.ts +4 -0
- package/dist/server/router/defined-route.d.ts +1 -1
- package/dist/server/router/hmr.production.d.ts +2 -0
- package/dist/server/router/patterns.d.ts +1 -0
- package/dist/server/router/plugin.d.ts +3 -1
- package/dist/server/router/schemas.d.ts +1 -0
- package/dist/server/sync/adapter.d.ts +13 -0
- package/dist/server/sync/config.d.ts +5 -5
- package/dist/server/sync/index.d.ts +6 -6
- package/dist/server/sync/index.js +1252 -599
- package/dist/server/sync/notifier.d.ts +1 -0
- package/dist/server/sync/plugin.d.ts +31 -158
- package/dist/server/sync/postgres/index.d.ts +12 -1
- package/dist/server/sync/postgres/index.js +101 -6
- package/dist/server/sync/stream.d.ts +37 -61
- package/dist/shared/await.d.ts +3 -3
- package/dist/shared/browser-events.d.ts +22 -0
- package/dist/shared/compact-json.d.ts +8 -0
- package/dist/shared/deferred-ndjson.d.ts +6 -5
- package/dist/shared/dev-diagnostics.d.ts +36 -0
- package/dist/shared/elysia-contract.d.ts +8 -14
- package/dist/shared/prefix.d.ts +2 -0
- package/package.json +26 -11
- package/src/adapter/README.md +53 -1
- package/src/adapter/bun.ts +106 -283
- package/src/adapter/package.ts +21 -11
- package/src/adapter/runtime-build.ts +382 -0
- package/src/adapter/static.ts +87 -8
- package/src/adapter/vercel.ts +876 -0
- package/src/build/client.ts +55 -13
- package/src/build/compile-entry.ts +36 -77
- package/src/build/elysia-aot.ts +102 -0
- package/src/build/entry-template.ts +55 -13
- package/src/build/hydrate.ts +60 -20
- package/src/build/index.ts +17 -8
- package/src/build/production-instrumentation.ts +56 -4
- package/src/build/server-app-entry.ts +60 -0
- package/src/build/shared.ts +5 -2
- package/src/build/ssg-cache.ts +93 -12
- package/src/build/types.ts +31 -2
- package/src/build/virtual-entry.ts +28 -0
- package/src/cache.ts +26 -0
- package/src/cli/config.ts +3 -3
- package/src/cli/index.ts +58 -3
- package/src/cli/preview.ts +90 -0
- package/src/client/boundaries.tsx +10 -1
- package/src/client/browser-events-runtime.ts +204 -0
- package/src/client/browser-events.ts +22 -0
- package/src/client/define-route.ts +7 -17
- package/src/client/dev-error-overlay.ts +201 -0
- package/src/client/document.tsx +4 -7
- package/src/client/hmr.ts +26 -3
- package/src/client/internal/runtime-types.ts +10 -1
- package/src/client/router/boundary-tree.tsx +4 -4
- package/src/client/router/provider.tsx +165 -63
- package/src/client/router/sync-catch-up.ts +3 -4
- package/src/client/router/types.ts +6 -6
- package/src/client/sync.ts +1 -0
- package/src/config.ts +28 -2
- package/src/define-route.ts +285 -134
- package/src/devtools/devtools-element.js +56 -77
- package/src/devtools/protocol.ts +2 -2
- package/src/furin.ts +272 -203
- package/src/plugin/route-config-autofix.ts +11 -2
- package/src/plugin/routes.ts +291 -65
- package/src/plugin/transform-client.ts +685 -3
- package/src/react-dom-edge.d.ts +6 -0
- package/src/rsc/build/index.ts +15 -3
- package/src/server/assets/production.ts +99 -0
- package/src/server/auto-invalidate/plugin.ts +4 -4
- package/src/server/auto-invalidate/runtime.ts +76 -41
- package/src/server/browser-events/plugin.ts +173 -0
- package/src/server/browser-events/types.ts +11 -0
- package/src/server/cache/dev-loader.ts +30 -29
- package/src/server/cache/invalidation.ts +67 -35
- package/src/server/cache/isr.ts +9 -0
- package/src/server/cache/page-cache-state.ts +22 -0
- package/src/server/cache/page-cache.ts +300 -0
- package/src/server/cache/purger.ts +41 -0
- package/src/server/cache/redis/index.ts +350 -0
- package/src/server/cache/redis/scripts.ts +160 -0
- package/src/server/cache/runtime-cache.ts +137 -0
- package/src/server/context-logger.ts +5 -5
- package/src/server/dev/browser-events.ts +54 -0
- package/src/server/dev/diagnostics.ts +297 -0
- package/src/server/dev/error.ts +148 -0
- package/src/server/dev/graph.ts +438 -0
- package/src/server/dev/plugin.ts +130 -0
- package/src/server/dev/request-security.ts +38 -0
- package/src/server/dev/rewrite-module-specifiers.ts +81 -0
- package/src/server/dev/runtime.production.ts +28 -0
- package/src/server/dev/symbolicate.ts +135 -0
- package/src/server/dev/transform-failure.ts +8 -0
- package/src/server/dev-page-plugin.production.ts +3 -0
- package/src/server/dev-page-plugin.ts +136 -53
- package/src/server/devtools/hub.ts +6 -5
- package/src/server/devtools/instrumentation.production.ts +1 -1
- package/src/server/devtools/instrumentation.ts +12 -6
- package/src/server/devtools/plugin.ts +7 -150
- package/src/server/evlog.ts +99 -0
- package/src/server/external-prerender.ts +10 -0
- package/src/server/instance.ts +3 -3
- package/src/server/internal.ts +46 -2
- package/src/server/render/assemble.ts +4 -4
- package/src/server/render/document.tsx +13 -4
- package/src/server/render/element.tsx +18 -14
- package/src/server/render/index.ts +1 -1
- package/src/server/render/isr.ts +509 -136
- package/src/server/render/loaders.ts +31 -15
- package/src/server/render/not-found.ts +32 -8
- package/src/server/render/ppr-document.ts +239 -0
- package/src/server/render/ppr-request.ts +104 -0
- package/src/server/render/ppr-route.ts +335 -28
- package/src/server/render/shell.ts +0 -12
- package/src/server/render/ssg.ts +186 -24
- package/src/server/render/ssr.ts +215 -89
- package/src/server/render/static-params.ts +174 -0
- package/src/server/render/template.ts +47 -11
- package/src/server/router/defined-route.ts +9 -40
- package/src/server/router/hmr.production.ts +7 -0
- package/src/server/router/hmr.ts +108 -67
- package/src/server/router/patterns.ts +5 -1
- package/src/server/router/plugin.ts +164 -66
- package/src/server/router/schema-merge.ts +1 -1
- package/src/server/router/schemas.ts +174 -61
- package/src/server/router/source-version.ts +3 -10
- package/src/server/sync/adapter.ts +13 -0
- package/src/server/sync/config.ts +12 -12
- package/src/server/sync/index.ts +8 -8
- package/src/server/sync/notifier.ts +1 -0
- package/src/server/sync/plugin.ts +18 -11
- package/src/server/sync/postgres/index.ts +111 -5
- package/src/server/sync/response.ts +3 -3
- package/src/server/sync/runtime.ts +12 -0
- package/src/server/sync/stream.ts +78 -113
- package/src/shared/await.tsx +3 -3
- package/src/shared/browser-events.ts +28 -0
- package/src/shared/compact-json.ts +77 -0
- package/src/shared/deferred-ndjson.ts +20 -6
- package/src/shared/dev-diagnostics.ts +44 -0
- package/src/shared/elysia-contract.ts +23 -25
- package/src/shared/prefix.ts +8 -0
- package/src/shared/route-map.ts +10 -1
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import type { RuntimeRoute } from "../../client/internal/runtime-types.ts";
|
|
2
|
-
import {
|
|
3
|
-
type FurinSchema,
|
|
4
|
-
getSchemaValidator,
|
|
5
|
-
parseQueryFromURL,
|
|
6
|
-
parseQueryStandardSchema,
|
|
7
|
-
} from "../../shared/elysia-contract.ts";
|
|
2
|
+
import { type FurinSchema, getSchemaValidator } from "../../shared/elysia-contract.ts";
|
|
8
3
|
import {
|
|
9
4
|
collectSearchDefaults,
|
|
10
5
|
type SearchParamsInput,
|
|
@@ -22,6 +17,59 @@ interface QueryKeyMap {
|
|
|
22
17
|
[key: string]: 1;
|
|
23
18
|
}
|
|
24
19
|
|
|
20
|
+
function decodeQueryPart(value: string): string {
|
|
21
|
+
return new URLSearchParams(`value=${value}`).get("value") ?? "";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function parseArrayQueryValue(raw: string, decoded: string, repeated: boolean): string[] {
|
|
25
|
+
const rawBracketed = raw.startsWith("[") && raw.endsWith("]");
|
|
26
|
+
const decodedBracketed = decoded.startsWith("[") && decoded.endsWith("]");
|
|
27
|
+
if (repeated && !rawBracketed && !decodedBracketed) {
|
|
28
|
+
return [decoded];
|
|
29
|
+
}
|
|
30
|
+
if (decoded === "[]") {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
if (rawBracketed) {
|
|
34
|
+
return raw.slice(1, -1).split(",").map(decodeQueryPart);
|
|
35
|
+
}
|
|
36
|
+
if (decodedBracketed) {
|
|
37
|
+
return decoded.slice(1, -1).split(",");
|
|
38
|
+
}
|
|
39
|
+
return raw.includes(",") ? raw.split(",").map(decodeQueryPart) : [decoded];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function parseQueryFromURL(search: string, arrayKeys?: QueryKeyMap): UnknownObject {
|
|
43
|
+
const query: UnknownObject = Object.create(null);
|
|
44
|
+
if (!arrayKeys) {
|
|
45
|
+
for (const [key, value] of new URLSearchParams(search)) {
|
|
46
|
+
query[key] = value;
|
|
47
|
+
}
|
|
48
|
+
return query;
|
|
49
|
+
}
|
|
50
|
+
for (const pair of search.slice(1).split("&")) {
|
|
51
|
+
const entry = new URLSearchParams(pair).entries().next().value;
|
|
52
|
+
if (!entry) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
const [key, value] = entry;
|
|
56
|
+
if (!arrayKeys[key]) {
|
|
57
|
+
query[key] = value;
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
const equalIndex = pair.indexOf("=");
|
|
61
|
+
const rawValue = equalIndex === -1 ? "" : pair.slice(equalIndex + 1);
|
|
62
|
+
const previous = query[key];
|
|
63
|
+
const values = parseArrayQueryValue(rawValue, value, Array.isArray(previous));
|
|
64
|
+
if (Array.isArray(previous)) {
|
|
65
|
+
previous.push(...values);
|
|
66
|
+
} else {
|
|
67
|
+
query[key] = values;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return query;
|
|
71
|
+
}
|
|
72
|
+
|
|
25
73
|
/**
|
|
26
74
|
* Parses the `?path=` argument of `/_furin/data`, rejecting absolute /
|
|
27
75
|
* protocol-relative inputs that would let a caller smuggle a foreign origin
|
|
@@ -60,50 +108,54 @@ function isStandardSchema(schema: unknown): boolean {
|
|
|
60
108
|
}
|
|
61
109
|
|
|
62
110
|
function collectQueryArrayKeys(schema: unknown): QueryKeyMap | undefined {
|
|
63
|
-
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const keys: QueryKeyMap = {};
|
|
68
|
-
for (const [key, value] of Object.entries(schema.properties)) {
|
|
69
|
-
const effectiveSchema = findEffectiveAnyOfMember(value, "array") ?? value;
|
|
70
|
-
if (isObjectSchema(effectiveSchema) && effectiveSchema.type === "array") {
|
|
71
|
-
keys[key] = 1;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return Object.keys(keys).length > 0 ? keys : undefined;
|
|
111
|
+
return collectQueryKeys(schema, "array");
|
|
76
112
|
}
|
|
77
113
|
|
|
78
114
|
function collectQueryObjectKeys(schema: unknown): QueryKeyMap | undefined {
|
|
79
|
-
|
|
115
|
+
return collectQueryKeys(schema, "object");
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function collectQueryKeys(schema: unknown, type: "array" | "object"): QueryKeyMap | undefined {
|
|
119
|
+
if (!isObjectSchema(schema)) {
|
|
80
120
|
return;
|
|
81
121
|
}
|
|
82
122
|
|
|
83
123
|
const keys: QueryKeyMap = {};
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
124
|
+
if (isObjectSchema(schema.properties)) {
|
|
125
|
+
for (const [key, value] of Object.entries(schema.properties)) {
|
|
126
|
+
if (hasSchemaType(value, type)) {
|
|
127
|
+
keys[key] = 1;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
for (const keyword of ["allOf", "anyOf"] as const) {
|
|
133
|
+
const members = schema[keyword];
|
|
134
|
+
if (!Array.isArray(members)) {
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
for (const member of members) {
|
|
138
|
+
Object.assign(keys, collectQueryKeys(member, type));
|
|
88
139
|
}
|
|
89
140
|
}
|
|
90
141
|
|
|
91
142
|
return Object.keys(keys).length > 0 ? keys : undefined;
|
|
92
143
|
}
|
|
93
144
|
|
|
94
|
-
function
|
|
95
|
-
schema
|
|
96
|
-
|
|
97
|
-
): UnknownObject | undefined {
|
|
98
|
-
if (!(isObjectSchema(schema) && Array.isArray(schema.anyOf))) {
|
|
99
|
-
return;
|
|
145
|
+
function hasSchemaType(schema: unknown, type: "array" | "object"): boolean {
|
|
146
|
+
if (!isObjectSchema(schema)) {
|
|
147
|
+
return false;
|
|
100
148
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
149
|
+
if (schema.type === type) {
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
for (const keyword of ["allOf", "anyOf"] as const) {
|
|
153
|
+
const members = schema[keyword];
|
|
154
|
+
if (Array.isArray(members) && members.some((member) => hasSchemaType(member, type))) {
|
|
155
|
+
return true;
|
|
105
156
|
}
|
|
106
157
|
}
|
|
158
|
+
return false;
|
|
107
159
|
}
|
|
108
160
|
|
|
109
161
|
function parseJsonQueryObjects(
|
|
@@ -129,6 +181,72 @@ function parseJsonQueryObjects(
|
|
|
129
181
|
return parsed;
|
|
130
182
|
}
|
|
131
183
|
|
|
184
|
+
function coerceUnionValue(members: unknown[], value: unknown): unknown {
|
|
185
|
+
for (const member of members) {
|
|
186
|
+
const candidate = coerceSchemaValue(member, value);
|
|
187
|
+
const validator = getSchemaValidator(member as FurinSchema);
|
|
188
|
+
if (validator?.Check(candidate)) {
|
|
189
|
+
return candidate;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return value;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function coerceObjectValue(properties: UnknownObject, value: UnknownObject): UnknownObject {
|
|
196
|
+
const coerced = { ...value };
|
|
197
|
+
for (const [key, propertySchema] of Object.entries(properties)) {
|
|
198
|
+
if (key in coerced) {
|
|
199
|
+
coerced[key] = coerceSchemaValue(propertySchema, coerced[key]);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return coerced;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function coerceStringValue(schema: UnknownObject, value: string): unknown {
|
|
206
|
+
if (value.length === 0) {
|
|
207
|
+
return value;
|
|
208
|
+
}
|
|
209
|
+
if (schema.type === "boolean") {
|
|
210
|
+
if (value === "true") {
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
213
|
+
if (value === "false") {
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
return value;
|
|
217
|
+
}
|
|
218
|
+
if (schema.type === "number" || schema.type === "integer") {
|
|
219
|
+
const number = Number(value);
|
|
220
|
+
if (Number.isFinite(number) && (schema.type !== "integer" || Number.isInteger(number))) {
|
|
221
|
+
return number;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return value;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function coerceSchemaValue(schema: unknown, value: unknown): unknown {
|
|
228
|
+
if (!isObjectSchema(schema)) {
|
|
229
|
+
return value;
|
|
230
|
+
}
|
|
231
|
+
if (Array.isArray(schema.anyOf)) {
|
|
232
|
+
return coerceUnionValue(schema.anyOf, value);
|
|
233
|
+
}
|
|
234
|
+
if (Array.isArray(schema.allOf)) {
|
|
235
|
+
return schema.allOf.reduce((candidate, member) => coerceSchemaValue(member, candidate), value);
|
|
236
|
+
}
|
|
237
|
+
if (schema.type === "object" && isObjectSchema(schema.properties) && isObjectSchema(value)) {
|
|
238
|
+
return coerceObjectValue(schema.properties, value);
|
|
239
|
+
}
|
|
240
|
+
if (schema.type === "array" && Array.isArray(value)) {
|
|
241
|
+
return value.map((entry) => coerceSchemaValue(schema.items, entry));
|
|
242
|
+
}
|
|
243
|
+
return typeof value === "string" ? coerceStringValue(schema, value) : value;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export function coerceRouteInput(schema: FurinSchema, value: UnknownObject): UnknownObject {
|
|
247
|
+
return coerceSchemaValue(schema, value) as UnknownObject;
|
|
248
|
+
}
|
|
249
|
+
|
|
132
250
|
export type ParseRouteQueryResult =
|
|
133
251
|
| { ok: true; query: SearchParamsInput }
|
|
134
252
|
| { errors: unknown; ok: false };
|
|
@@ -143,30 +261,25 @@ type RouteInputValidationResult =
|
|
|
143
261
|
|
|
144
262
|
async function validateRouteInput(
|
|
145
263
|
input: UnknownObject,
|
|
146
|
-
schema: FurinSchema
|
|
264
|
+
schema: FurinSchema,
|
|
265
|
+
type: "params" | "query"
|
|
147
266
|
): Promise<RouteInputValidationResult> {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
return {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
return { errors: [...(validator?.Errors(inputWithDefaults) ?? [])], ok: false };
|
|
267
|
+
const inputWithDefaults = isStandardSchema(schema)
|
|
268
|
+
? input
|
|
269
|
+
: applySchemaDefaults(schema as UnknownObject, input);
|
|
270
|
+
const valueToValidate = isStandardSchema(schema)
|
|
271
|
+
? inputWithDefaults
|
|
272
|
+
: coerceRouteInput(schema, inputWithDefaults);
|
|
273
|
+
const validator = getSchemaValidator(schema);
|
|
274
|
+
try {
|
|
275
|
+
const parsed = await validator?.parse(valueToValidate, type);
|
|
276
|
+
return {
|
|
277
|
+
ok: true,
|
|
278
|
+
value: (parsed ?? valueToValidate) as UnknownObject,
|
|
279
|
+
};
|
|
280
|
+
} catch {
|
|
281
|
+
return { errors: [...(validator?.Errors(valueToValidate) ?? [])], ok: false };
|
|
164
282
|
}
|
|
165
|
-
|
|
166
|
-
return {
|
|
167
|
-
ok: true,
|
|
168
|
-
value: (validator?.parse(inputWithDefaults) ?? inputWithDefaults) as UnknownObject,
|
|
169
|
-
};
|
|
170
283
|
}
|
|
171
284
|
|
|
172
285
|
/**
|
|
@@ -181,16 +294,16 @@ export async function parseRouteQuery(
|
|
|
181
294
|
schema: FurinSchema | undefined
|
|
182
295
|
): Promise<ParseRouteQueryResult> {
|
|
183
296
|
if (!schema) {
|
|
184
|
-
return { ok: true, query: parseQueryFromURL(url.search
|
|
297
|
+
return { ok: true, query: parseQueryFromURL(url.search) as SearchParamsInput };
|
|
185
298
|
}
|
|
186
299
|
|
|
187
300
|
const rawQuery = isStandardSchema(schema)
|
|
188
|
-
? (
|
|
301
|
+
? parseQueryFromURL(url.search)
|
|
189
302
|
: parseJsonQueryObjects(
|
|
190
|
-
parseQueryFromURL(url.search,
|
|
303
|
+
parseQueryFromURL(url.search, collectQueryArrayKeys(schema)),
|
|
191
304
|
collectQueryObjectKeys(schema)
|
|
192
305
|
);
|
|
193
|
-
const result = await validateRouteInput(rawQuery, schema);
|
|
306
|
+
const result = await validateRouteInput(rawQuery, schema, "query");
|
|
194
307
|
return result.ok ? { ok: true, query: result.value as SearchParamsInput } : result;
|
|
195
308
|
}
|
|
196
309
|
|
|
@@ -209,7 +322,7 @@ export async function parseRouteParams(
|
|
|
209
322
|
return { ok: true, params };
|
|
210
323
|
}
|
|
211
324
|
|
|
212
|
-
const result = await validateRouteInput(params, schema);
|
|
325
|
+
const result = await validateRouteInput(params, schema, "params");
|
|
213
326
|
return result.ok ? { ok: true, params: result.value } : result;
|
|
214
327
|
}
|
|
215
328
|
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
let routeModuleGeneration = 0;
|
|
1
|
+
import { devGraph } from "../dev/graph.ts";
|
|
4
2
|
|
|
5
3
|
export function routeModuleSourceVersion(path: string): string {
|
|
6
|
-
|
|
7
|
-
const stats = statSync(path, { bigint: true });
|
|
8
|
-
return Bun.hash(`${stats.mtimeNs}:${stats.size}:${routeModuleGeneration}`).toString();
|
|
9
|
-
} catch {
|
|
10
|
-
return Bun.hash(`missing:${routeModuleGeneration}`).toString();
|
|
11
|
-
}
|
|
4
|
+
return devGraph(undefined).sourceVersion(path);
|
|
12
5
|
}
|
|
13
6
|
|
|
14
7
|
export function invalidateRouteModuleSourceVersions(): void {
|
|
15
|
-
|
|
8
|
+
devGraph(undefined).invalidateModules();
|
|
16
9
|
}
|
|
@@ -58,6 +58,10 @@ export interface SyncAdapter {
|
|
|
58
58
|
beginMutation: (input: BeginMutationInput) => Promise<BeginMutationResult>;
|
|
59
59
|
completeMutation: (input: CompleteMutationInput) => Promise<CompleteMutationResult>;
|
|
60
60
|
currentCursor: () => Promise<string>;
|
|
61
|
+
/**
|
|
62
|
+
* Identifies a notification channel published transactionally by completeMutation.
|
|
63
|
+
*/
|
|
64
|
+
readonly notificationChannel?: string;
|
|
61
65
|
readChanges: (input: ReadChangesInput) => Promise<ChangePage>;
|
|
62
66
|
renewMutation: (lease: MutationLease) => Promise<"lost" | "renewed">;
|
|
63
67
|
readonly scope: "distributed" | "host-local" | "process-local";
|
|
@@ -68,7 +72,16 @@ export interface SyncSubscription {
|
|
|
68
72
|
}
|
|
69
73
|
|
|
70
74
|
export interface SyncNotifier {
|
|
75
|
+
/**
|
|
76
|
+
* Matches a SyncAdapter channel when durable completion already publishes the wake-up.
|
|
77
|
+
*/
|
|
78
|
+
readonly notificationChannel?: string;
|
|
71
79
|
publish: (cursor: string) => Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Declares that the notifier independently recovers missed wake-ups, so the
|
|
82
|
+
* SSE coordinator does not need its compatibility safety poll.
|
|
83
|
+
*/
|
|
84
|
+
readonly recovery?: "self";
|
|
72
85
|
subscribe: (listener: (cursor: string) => void) => Promise<SyncSubscription>;
|
|
73
86
|
}
|
|
74
87
|
|
|
@@ -2,39 +2,39 @@ import { AsyncLocalStorage } from "node:async_hooks";
|
|
|
2
2
|
import { currentInstance } from "../instance.ts";
|
|
3
3
|
import type { SyncRuntimeOptions } from "./adapter.ts";
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const SYNC_DEFAULT_PATH = "/_furin/sync";
|
|
6
6
|
|
|
7
7
|
// Explicit override scope (tests, synthetic renders). When unset, the sync
|
|
8
|
-
//
|
|
9
|
-
const
|
|
8
|
+
// path comes from the current furin instance.
|
|
9
|
+
const requestSyncPath = new AsyncLocalStorage<string | undefined>();
|
|
10
10
|
|
|
11
11
|
export interface FurinSyncOptions extends SyncRuntimeOptions {
|
|
12
|
-
|
|
12
|
+
path?: string;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export type FurinSyncOption = FurinSyncOptions | false;
|
|
16
16
|
|
|
17
|
-
export function
|
|
17
|
+
export function resolveSyncPath(sync: FurinSyncOption | undefined): string | undefined {
|
|
18
18
|
if (!sync) {
|
|
19
19
|
return;
|
|
20
20
|
}
|
|
21
|
-
return sync.
|
|
21
|
+
return sync.path ?? SYNC_DEFAULT_PATH;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
* Logical (unprefixed) sync
|
|
25
|
+
* Logical (unprefixed) sync path for the current request — injected
|
|
26
26
|
* into rendered HTML; the client prepends its own basePath before connecting.
|
|
27
27
|
*/
|
|
28
|
-
export function
|
|
29
|
-
const override =
|
|
28
|
+
export function getSyncPath(): string | undefined {
|
|
29
|
+
const override = requestSyncPath.getStore();
|
|
30
30
|
if (override !== undefined) {
|
|
31
31
|
return override;
|
|
32
32
|
}
|
|
33
|
-
return currentInstance().
|
|
33
|
+
return currentInstance().syncPath;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
export function
|
|
37
|
-
return
|
|
36
|
+
export function runWithSyncPath<T>(path: string | undefined, fn: () => T): T {
|
|
37
|
+
return requestSyncPath.run(path, fn);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
export function syncRuntimeOptions(sync: FurinSyncOptions): SyncRuntimeOptions {
|
package/src/server/sync/index.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
// biome-ignore-all lint/performance/noBarrelFile: sync has a small public/internal surface
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
getSyncPath as getSyncPathImplementation,
|
|
5
|
+
resolveSyncPath as resolveSyncPathImplementation,
|
|
6
|
+
runWithSyncPath as runWithSyncPathImplementation,
|
|
7
7
|
} from "./config.ts";
|
|
8
8
|
import { PollingSyncNotifier as PollingSyncNotifierImplementation } from "./notifier.ts";
|
|
9
9
|
import { furinSync as furinSyncImplementation } from "./plugin.ts";
|
|
10
|
-
import {
|
|
10
|
+
import { createSyncChangesPlugin as createSyncChangesPluginImplementation } from "./stream.ts";
|
|
11
11
|
|
|
12
|
-
export const
|
|
12
|
+
export const createSyncChangesPlugin = createSyncChangesPluginImplementation;
|
|
13
13
|
export const furinSync = furinSyncImplementation;
|
|
14
|
-
export const
|
|
14
|
+
export const getSyncPath = getSyncPathImplementation;
|
|
15
15
|
export const PollingSyncNotifier = PollingSyncNotifierImplementation;
|
|
16
|
-
export const
|
|
17
|
-
export const
|
|
16
|
+
export const resolveSyncPath = resolveSyncPathImplementation;
|
|
17
|
+
export const runWithSyncPath = runWithSyncPathImplementation;
|
|
18
18
|
|
|
19
19
|
export type PollingSyncNotifier = PollingSyncNotifierImplementation;
|
|
20
20
|
|
|
@@ -5,6 +5,7 @@ interface ListenerSubscription {
|
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
export class PollingSyncNotifier implements SyncNotifier {
|
|
8
|
+
readonly recovery = "self" as const;
|
|
8
9
|
private readonly adapter: SyncAdapter;
|
|
9
10
|
private readonly intervalMs: number;
|
|
10
11
|
private readonly listeners = new Set<ListenerSubscription>();
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
} from "../auto-invalidate/runtime.ts";
|
|
7
7
|
import type { InvalidationInput } from "../auto-invalidate/types.ts";
|
|
8
8
|
import { peekPendingInvalidations } from "../cache/invalidation.ts";
|
|
9
|
+
import { getLogger } from "../context-logger.ts";
|
|
9
10
|
import type { MutationLease, SyncInvalidation, SyncRuntimeOptions } from "./adapter.ts";
|
|
10
11
|
import { createMutationFingerprint } from "./fingerprint.ts";
|
|
11
12
|
import { mergeStoredResponseHeaders, replayResponse, storeResponse } from "./response.ts";
|
|
@@ -41,11 +42,7 @@ interface MutationContext {
|
|
|
41
42
|
|
|
42
43
|
type TransportHook<TContext> = (context: TContext) => Promise<void>;
|
|
43
44
|
|
|
44
|
-
type CompletionContext = MutationContext &
|
|
45
|
-
Pick<Context, "set"> & {
|
|
46
|
-
response?: unknown;
|
|
47
|
-
responseValue?: unknown;
|
|
48
|
-
};
|
|
45
|
+
type CompletionContext = MutationContext & Parameters<typeof isSuccessfulMutationResponse>[0];
|
|
49
46
|
type PathInvalidation = Extract<SyncInvalidation, { kind: "path" }>;
|
|
50
47
|
|
|
51
48
|
const routeMetadata = new WeakMap<Request, RouteSyncMetadata>();
|
|
@@ -213,8 +210,15 @@ export function furinSync(options: SyncRuntimeOptions) {
|
|
|
213
210
|
const result = await storeResponse(ctx.responseValue, ctx.set);
|
|
214
211
|
const manualPending = peekPendingInvalidations();
|
|
215
212
|
const invalidate = routeMetadata.get(ctx.request)?.invalidate;
|
|
213
|
+
const logger = getLogger();
|
|
216
214
|
if (invalidate) {
|
|
217
|
-
|
|
215
|
+
try {
|
|
216
|
+
await runInvalidationRules(invalidate);
|
|
217
|
+
} catch {
|
|
218
|
+
logger.warn(
|
|
219
|
+
"Sync cache invalidation failed after mutation; preserving the idempotent result"
|
|
220
|
+
);
|
|
221
|
+
}
|
|
218
222
|
}
|
|
219
223
|
const pending = appendPendingInvalidationHeader(ctx.set);
|
|
220
224
|
if (pending.length > 0) {
|
|
@@ -240,7 +244,10 @@ export function furinSync(options: SyncRuntimeOptions) {
|
|
|
240
244
|
if (completion.kind === "lost") {
|
|
241
245
|
return leaseLostResponse();
|
|
242
246
|
}
|
|
243
|
-
|
|
247
|
+
const notificationAlreadyPublished =
|
|
248
|
+
runtime.adapter.notificationChannel !== undefined &&
|
|
249
|
+
runtime.adapter.notificationChannel === runtime.notifier.notificationChannel;
|
|
250
|
+
if (completion.cursor !== undefined && !notificationAlreadyPublished) {
|
|
244
251
|
runtime.notifier.publish(completion.cursor).catch(() => undefined);
|
|
245
252
|
}
|
|
246
253
|
if (result.kind === "unreplayable") {
|
|
@@ -274,6 +281,9 @@ export function furinSync(options: SyncRuntimeOptions) {
|
|
|
274
281
|
const finishMutationHook = hideTransportResponse(finishMutation);
|
|
275
282
|
|
|
276
283
|
return new Elysia({ name: "furin-sync" })
|
|
284
|
+
.beforeHandle("global", beginMutationHook)
|
|
285
|
+
.afterHandle("global", finishMutationHook)
|
|
286
|
+
.error("global", ({ request }) => abortMutation(request))
|
|
277
287
|
.macro({
|
|
278
288
|
sync(input: SyncRouteOption) {
|
|
279
289
|
return {
|
|
@@ -287,8 +297,5 @@ export function furinSync(options: SyncRuntimeOptions) {
|
|
|
287
297
|
},
|
|
288
298
|
};
|
|
289
299
|
},
|
|
290
|
-
})
|
|
291
|
-
.onBeforeHandle({ as: "global" }, beginMutationHook)
|
|
292
|
-
.onAfterHandle({ as: "global" }, finishMutationHook)
|
|
293
|
-
.onError({ as: "global" }, ({ request }) => abortMutation(request));
|
|
300
|
+
});
|
|
294
301
|
}
|
|
@@ -11,11 +11,15 @@ import type {
|
|
|
11
11
|
SyncAdapter,
|
|
12
12
|
SyncChange,
|
|
13
13
|
SyncInvalidation,
|
|
14
|
+
SyncNotifier,
|
|
15
|
+
SyncSubscription,
|
|
14
16
|
} from "../adapter.ts";
|
|
15
17
|
|
|
16
18
|
const CHANGE_RETENTION = 1000;
|
|
17
19
|
const LEASE_MS = 30_000;
|
|
18
20
|
const MUTATION_TTL_MS = 24 * 60 * 60 * 1000;
|
|
21
|
+
const RECOVERY_RETRY_INITIAL_MS = 250;
|
|
22
|
+
const RECOVERY_RETRY_MAX_MS = 32_000;
|
|
19
23
|
const UNSIGNED_INTEGER_PATTERN = /^\d+$/;
|
|
20
24
|
|
|
21
25
|
export interface PostgresSyncAdapterOptions {
|
|
@@ -43,6 +47,18 @@ interface ChangeRow {
|
|
|
43
47
|
invalidations: SyncInvalidation[];
|
|
44
48
|
}
|
|
45
49
|
|
|
50
|
+
function notificationChannel(namespace: string): string {
|
|
51
|
+
const digest = new Bun.CryptoHasher("sha256").update(namespace).digest("hex");
|
|
52
|
+
return `furin_sync_${digest.slice(0, 52)}`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async function readCurrentCursor(sql: SQL, namespace: string): Promise<string> {
|
|
56
|
+
const rows = await sql<Pick<CursorRow, "current_cursor">[]>`
|
|
57
|
+
SELECT current_cursor FROM furin_sync.streams WHERE namespace = ${namespace}
|
|
58
|
+
`;
|
|
59
|
+
return String(rows[0]?.current_cursor ?? 0);
|
|
60
|
+
}
|
|
61
|
+
|
|
46
62
|
function mutationKey(input: Pick<MutationLease, "key" | "principal">): string {
|
|
47
63
|
return new Bun.CryptoHasher("sha256")
|
|
48
64
|
.update(`${input.principal.length}:${input.principal}${input.key}`)
|
|
@@ -61,6 +77,7 @@ function storedResponse(row: MutationRow): StoredResponse {
|
|
|
61
77
|
}
|
|
62
78
|
|
|
63
79
|
export class PostgresSyncAdapter implements SyncAdapter {
|
|
80
|
+
readonly notificationChannel: string;
|
|
64
81
|
readonly scope = "distributed" as const;
|
|
65
82
|
private readonly namespace: string;
|
|
66
83
|
private readonly sql: SQL;
|
|
@@ -69,6 +86,7 @@ export class PostgresSyncAdapter implements SyncAdapter {
|
|
|
69
86
|
if (options.namespace.length === 0) {
|
|
70
87
|
throw new Error("[furin-sync-postgres] namespace must not be empty.");
|
|
71
88
|
}
|
|
89
|
+
this.notificationChannel = notificationChannel(options.namespace);
|
|
72
90
|
this.namespace = options.namespace;
|
|
73
91
|
this.sql = options.sql;
|
|
74
92
|
}
|
|
@@ -221,6 +239,9 @@ export class PostgresSyncAdapter implements SyncAdapter {
|
|
|
221
239
|
AND mutation_key = ${key}
|
|
222
240
|
AND mutation_id = ${input.lease.id}
|
|
223
241
|
`;
|
|
242
|
+
if (cursor !== undefined) {
|
|
243
|
+
await tx.notify(this.notificationChannel, cursor);
|
|
244
|
+
}
|
|
224
245
|
return { cursor, kind: "committed" } as const;
|
|
225
246
|
});
|
|
226
247
|
}
|
|
@@ -235,11 +256,8 @@ export class PostgresSyncAdapter implements SyncAdapter {
|
|
|
235
256
|
`;
|
|
236
257
|
}
|
|
237
258
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
SELECT current_cursor FROM furin_sync.streams WHERE namespace = ${this.namespace}
|
|
241
|
-
`;
|
|
242
|
-
return String(rows[0]?.current_cursor ?? 0);
|
|
259
|
+
currentCursor(): Promise<string> {
|
|
260
|
+
return readCurrentCursor(this.sql, this.namespace);
|
|
243
261
|
}
|
|
244
262
|
|
|
245
263
|
async readChanges(input: ReadChangesInput): Promise<ChangePage> {
|
|
@@ -299,3 +317,91 @@ export class PostgresSyncAdapter implements SyncAdapter {
|
|
|
299
317
|
export function postgresSyncAdapter(options: PostgresSyncAdapterOptions): PostgresSyncAdapter {
|
|
300
318
|
return new PostgresSyncAdapter(options);
|
|
301
319
|
}
|
|
320
|
+
|
|
321
|
+
export class PostgresSyncNotifier implements SyncNotifier {
|
|
322
|
+
readonly notificationChannel: string;
|
|
323
|
+
readonly recovery = "self" as const;
|
|
324
|
+
private readonly namespace: string;
|
|
325
|
+
private readonly sql: SQL;
|
|
326
|
+
|
|
327
|
+
constructor(options: PostgresSyncAdapterOptions) {
|
|
328
|
+
if (options.namespace.length === 0) {
|
|
329
|
+
throw new Error("[furin-sync-postgres] namespace must not be empty.");
|
|
330
|
+
}
|
|
331
|
+
this.notificationChannel = notificationChannel(options.namespace);
|
|
332
|
+
this.namespace = options.namespace;
|
|
333
|
+
this.sql = options.sql;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
publish(cursor: string): Promise<void> {
|
|
337
|
+
return this.sql.notify(this.notificationChannel, cursor);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
async subscribe(listener: (cursor: string) => void): Promise<SyncSubscription> {
|
|
341
|
+
let active = true;
|
|
342
|
+
let currentCursor: bigint | undefined;
|
|
343
|
+
let recovery: Promise<void> | undefined;
|
|
344
|
+
let retry: ReturnType<typeof setTimeout> | undefined;
|
|
345
|
+
let retryDelayMs = RECOVERY_RETRY_INITIAL_MS;
|
|
346
|
+
const emit = (cursor: string) => {
|
|
347
|
+
if (!(active && UNSIGNED_INTEGER_PATTERN.test(cursor))) {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
const nextCursor = BigInt(cursor);
|
|
351
|
+
if (currentCursor !== undefined && nextCursor <= currentCursor) {
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
currentCursor = nextCursor;
|
|
355
|
+
try {
|
|
356
|
+
listener(cursor);
|
|
357
|
+
} catch {
|
|
358
|
+
// Notifications are best-effort wake-ups; durable recovery reads the change log.
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
const scheduleRecovery = () => {
|
|
362
|
+
if (!active || retry) {
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
const delayMs = retryDelayMs;
|
|
366
|
+
retryDelayMs = Math.min(retryDelayMs * 2, RECOVERY_RETRY_MAX_MS);
|
|
367
|
+
retry = setTimeout(() => {
|
|
368
|
+
retry = undefined;
|
|
369
|
+
recover();
|
|
370
|
+
}, delayMs);
|
|
371
|
+
retry.unref?.();
|
|
372
|
+
};
|
|
373
|
+
const recover = () => {
|
|
374
|
+
if (!active || recovery) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
if (retry) {
|
|
378
|
+
clearTimeout(retry);
|
|
379
|
+
retry = undefined;
|
|
380
|
+
}
|
|
381
|
+
recovery = readCurrentCursor(this.sql, this.namespace)
|
|
382
|
+
.then((cursor) => {
|
|
383
|
+
retryDelayMs = RECOVERY_RETRY_INITIAL_MS;
|
|
384
|
+
emit(cursor);
|
|
385
|
+
})
|
|
386
|
+
.catch(scheduleRecovery)
|
|
387
|
+
.finally(() => {
|
|
388
|
+
recovery = undefined;
|
|
389
|
+
});
|
|
390
|
+
};
|
|
391
|
+
const subscription = await this.sql.listen(this.notificationChannel, emit, recover);
|
|
392
|
+
return {
|
|
393
|
+
unsubscribe: () => {
|
|
394
|
+
active = false;
|
|
395
|
+
if (retry) {
|
|
396
|
+
clearTimeout(retry);
|
|
397
|
+
retry = undefined;
|
|
398
|
+
}
|
|
399
|
+
return subscription.unlisten();
|
|
400
|
+
},
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
export function postgresSyncNotifier(options: PostgresSyncAdapterOptions): PostgresSyncNotifier {
|
|
406
|
+
return new PostgresSyncNotifier(options);
|
|
407
|
+
}
|