@jay-framework/stack-server-runtime 0.14.0 → 0.15.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/dist/index.d.ts +0 -7
- package/dist/index.js +2 -48
- package/package.json +13 -13
package/dist/index.d.ts
CHANGED
|
@@ -70,14 +70,7 @@ interface SlowlyChangingPhase {
|
|
|
70
70
|
runSlowlyForPage(pageParams: object, pageProps: PageProps, parts: Array<DevServerPagePart>, discoveredInstances?: DiscoveredHeadlessInstance[], headlessInstanceComponents?: HeadlessInstanceComponent[], jayHtmlPath?: string): Promise<AnySlowlyRenderResult>;
|
|
71
71
|
}
|
|
72
72
|
declare class DevSlowlyChangingPhase implements SlowlyChangingPhase {
|
|
73
|
-
/** Cached loadParams results per route (jayHtmlPath → array of UrlParams[] per part) */
|
|
74
|
-
private loadParamsCache;
|
|
75
73
|
runSlowlyForPage(pageParams: UrlParams, pageProps: PageProps, parts: Array<DevServerPagePart>, discoveredInstances?: DiscoveredHeadlessInstance[], headlessInstanceComponents?: HeadlessInstanceComponent[], jayHtmlPath?: string): Promise<AnySlowlyRenderResult>;
|
|
76
|
-
/**
|
|
77
|
-
* Invalidate the cached loadParams result for a given route.
|
|
78
|
-
* Called when source files change (page.ts, .jay-contract, .jay-html).
|
|
79
|
-
*/
|
|
80
|
-
invalidateLoadParamsCache(jayHtmlPath: string): void;
|
|
81
74
|
}
|
|
82
75
|
declare function runLoadParams<Refs extends object, SlowVS extends object, FastVS extends object, InteractiveVS extends object, Services extends Array<any>, Contexts extends Array<any>, PropsT extends object, Params extends UrlParams, CompCore extends JayComponentCore<PropsT, InteractiveVS>>(compDefinition: JayStackComponentDefinition<Refs, SlowVS, FastVS, InteractiveVS, Services, Contexts, PropsT, Params, CompCore>, services: Services): Promise<void>;
|
|
83
76
|
declare function runSlowlyChangingRender<Refs extends object, SlowVS extends object, FastVS extends object, InteractiveVS extends object, Services extends Array<any>, Contexts extends Array<any>, PropsT extends object, Params extends UrlParams, CompCore extends JayComponentCore<PropsT, InteractiveVS>>(compDefinition: JayStackComponentDefinition<Refs, SlowVS, FastVS, InteractiveVS, Services, Contexts, PropsT, Params, CompCore>): void;
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
import {
|
|
7
|
+
import { phaseOutput, isJayAction } from "@jay-framework/fullstack-component";
|
|
8
8
|
import "prettier";
|
|
9
9
|
import "js-beautify";
|
|
10
10
|
import fs$1 from "fs";
|
|
@@ -83,47 +83,8 @@ function getClientInitDataForKey(key) {
|
|
|
83
83
|
function clearClientInitData() {
|
|
84
84
|
clientInitData = {};
|
|
85
85
|
}
|
|
86
|
-
function isLeftSideParamsSubsetOfRightSideParams(left, right) {
|
|
87
|
-
return Object.keys(left).reduce((prev, curr) => prev && left[curr] === right[curr], true);
|
|
88
|
-
}
|
|
89
86
|
class DevSlowlyChangingPhase {
|
|
90
|
-
constructor() {
|
|
91
|
-
/** Cached loadParams results per route (jayHtmlPath → array of UrlParams[] per part) */
|
|
92
|
-
__publicField(this, "loadParamsCache", /* @__PURE__ */ new Map());
|
|
93
|
-
}
|
|
94
87
|
async runSlowlyForPage(pageParams, pageProps, parts, discoveredInstances, headlessInstanceComponents, jayHtmlPath) {
|
|
95
|
-
const loadParamsParts = parts.filter((p) => p.compDefinition.loadParams);
|
|
96
|
-
if (loadParamsParts.length > 0) {
|
|
97
|
-
let cachedParamsArray = jayHtmlPath ? this.loadParamsCache.get(jayHtmlPath) : void 0;
|
|
98
|
-
if (!cachedParamsArray) {
|
|
99
|
-
cachedParamsArray = [];
|
|
100
|
-
for (const part of loadParamsParts) {
|
|
101
|
-
const { compDefinition, contractInfo } = part;
|
|
102
|
-
const services = resolveServices(compDefinition.services);
|
|
103
|
-
const loadParamsArgs = contractInfo ? [
|
|
104
|
-
...services,
|
|
105
|
-
{
|
|
106
|
-
contractName: contractInfo.contractName,
|
|
107
|
-
metadata: contractInfo.metadata
|
|
108
|
-
}
|
|
109
|
-
] : services;
|
|
110
|
-
const compParams = compDefinition.loadParams(loadParamsArgs);
|
|
111
|
-
const collected = [];
|
|
112
|
-
for await (const batch of compParams) {
|
|
113
|
-
collected.push(...batch);
|
|
114
|
-
}
|
|
115
|
-
cachedParamsArray.push(collected);
|
|
116
|
-
}
|
|
117
|
-
if (jayHtmlPath) {
|
|
118
|
-
this.loadParamsCache.set(jayHtmlPath, cachedParamsArray);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
for (const partParams of cachedParamsArray) {
|
|
122
|
-
if (!partParams.some((p) => isLeftSideParamsSubsetOfRightSideParams(pageParams, p))) {
|
|
123
|
-
return notFound();
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
88
|
let slowlyViewState = {};
|
|
128
89
|
let carryForward = {};
|
|
129
90
|
for (const part of parts) {
|
|
@@ -204,14 +165,7 @@ class DevSlowlyChangingPhase {
|
|
|
204
165
|
carryForward.__instanceSlowViewStates = instanceSlowViewStates;
|
|
205
166
|
carryForward.__instanceResolvedData = instanceResolvedData;
|
|
206
167
|
}
|
|
207
|
-
return
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Invalidate the cached loadParams result for a given route.
|
|
211
|
-
* Called when source files change (page.ts, .jay-contract, .jay-html).
|
|
212
|
-
*/
|
|
213
|
-
invalidateLoadParamsCache(jayHtmlPath) {
|
|
214
|
-
this.loadParamsCache.delete(jayHtmlPath);
|
|
168
|
+
return phaseOutput(slowlyViewState, carryForward);
|
|
215
169
|
}
|
|
216
170
|
}
|
|
217
171
|
async function runLoadParams(compDefinition, services) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jay-framework/stack-server-runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.mts",
|
|
@@ -26,21 +26,21 @@
|
|
|
26
26
|
"test:watch": "vitest"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@jay-framework/compiler-jay-html": "^0.
|
|
30
|
-
"@jay-framework/compiler-shared": "^0.
|
|
31
|
-
"@jay-framework/component": "^0.
|
|
32
|
-
"@jay-framework/fullstack-component": "^0.
|
|
33
|
-
"@jay-framework/logger": "^0.
|
|
34
|
-
"@jay-framework/runtime": "^0.
|
|
35
|
-
"@jay-framework/ssr-runtime": "^0.
|
|
36
|
-
"@jay-framework/stack-route-scanner": "^0.
|
|
37
|
-
"@jay-framework/view-state-merge": "^0.
|
|
29
|
+
"@jay-framework/compiler-jay-html": "^0.15.0",
|
|
30
|
+
"@jay-framework/compiler-shared": "^0.15.0",
|
|
31
|
+
"@jay-framework/component": "^0.15.0",
|
|
32
|
+
"@jay-framework/fullstack-component": "^0.15.0",
|
|
33
|
+
"@jay-framework/logger": "^0.15.0",
|
|
34
|
+
"@jay-framework/runtime": "^0.15.0",
|
|
35
|
+
"@jay-framework/ssr-runtime": "^0.14.0",
|
|
36
|
+
"@jay-framework/stack-route-scanner": "^0.15.0",
|
|
37
|
+
"@jay-framework/view-state-merge": "^0.15.0",
|
|
38
38
|
"yaml": "^2.3.4"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@jay-framework/dev-environment": "^0.
|
|
42
|
-
"@jay-framework/jay-cli": "^0.
|
|
43
|
-
"@jay-framework/stack-client-runtime": "^0.
|
|
41
|
+
"@jay-framework/dev-environment": "^0.15.0",
|
|
42
|
+
"@jay-framework/jay-cli": "^0.15.0",
|
|
43
|
+
"@jay-framework/stack-client-runtime": "^0.15.0",
|
|
44
44
|
"@types/express": "^5.0.2",
|
|
45
45
|
"@types/node": "^22.15.21",
|
|
46
46
|
"nodemon": "^3.0.3",
|