@pylonsync/react 0.3.383 → 0.3.385
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/ssr.d.ts +18 -0
- package/package.json +3 -3
- package/src/ssr.ts +18 -0
package/dist/ssr.d.ts
CHANGED
|
@@ -94,6 +94,24 @@ export interface ServerData {
|
|
|
94
94
|
total: number;
|
|
95
95
|
tookMs?: number;
|
|
96
96
|
}>;
|
|
97
|
+
/**
|
|
98
|
+
* Run a registered QUERY function during the render, with this page's own
|
|
99
|
+
* auth context (anonymous on a public page). Use when the safe projection
|
|
100
|
+
* of your data lives in a gated query rather than open row policies —
|
|
101
|
+
* the query stays the single source of truth for SSR and client alike.
|
|
102
|
+
*
|
|
103
|
+
* ```tsx
|
|
104
|
+
* const schedule = use(
|
|
105
|
+
* serverData.fn<Session[]>("getPublicSchedule", { eventId }),
|
|
106
|
+
* );
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* Queries only — mutations/actions are rejected (a GET render must not
|
|
110
|
+
* mutate). The result is serialized into the hydration payload like any
|
|
111
|
+
* other serverData read; calling this with a signed-in identity opts the
|
|
112
|
+
* render out of shared SSR caching (the query may read `ctx.auth`).
|
|
113
|
+
*/
|
|
114
|
+
fn<T = unknown>(name: string, args?: Record<string, unknown>): Promise<T>;
|
|
97
115
|
}
|
|
98
116
|
/**
|
|
99
117
|
* Props every `page.tsx` / `layout.tsx` receives. Generic over the dynamic
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.3.
|
|
6
|
+
"version": "0.3.385",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./src/index.ts",
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"prepack": "bun run build"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@pylonsync/sdk": "0.3.
|
|
18
|
-
"@pylonsync/sync": "0.3.
|
|
17
|
+
"@pylonsync/sdk": "0.3.385",
|
|
18
|
+
"@pylonsync/sync": "0.3.385"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"react": ">=19.0.0"
|
package/src/ssr.ts
CHANGED
|
@@ -121,6 +121,24 @@ export interface ServerData {
|
|
|
121
121
|
total: number;
|
|
122
122
|
tookMs?: number;
|
|
123
123
|
}>;
|
|
124
|
+
/**
|
|
125
|
+
* Run a registered QUERY function during the render, with this page's own
|
|
126
|
+
* auth context (anonymous on a public page). Use when the safe projection
|
|
127
|
+
* of your data lives in a gated query rather than open row policies —
|
|
128
|
+
* the query stays the single source of truth for SSR and client alike.
|
|
129
|
+
*
|
|
130
|
+
* ```tsx
|
|
131
|
+
* const schedule = use(
|
|
132
|
+
* serverData.fn<Session[]>("getPublicSchedule", { eventId }),
|
|
133
|
+
* );
|
|
134
|
+
* ```
|
|
135
|
+
*
|
|
136
|
+
* Queries only — mutations/actions are rejected (a GET render must not
|
|
137
|
+
* mutate). The result is serialized into the hydration payload like any
|
|
138
|
+
* other serverData read; calling this with a signed-in identity opts the
|
|
139
|
+
* render out of shared SSR caching (the query may read `ctx.auth`).
|
|
140
|
+
*/
|
|
141
|
+
fn<T = unknown>(name: string, args?: Record<string, unknown>): Promise<T>;
|
|
124
142
|
}
|
|
125
143
|
|
|
126
144
|
/**
|