@jay-framework/stack-server-runtime 0.17.2 → 0.17.4
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 +8 -2
- package/dist/index.js +26 -3
- package/package.json +13 -13
package/dist/index.d.ts
CHANGED
|
@@ -139,7 +139,7 @@ declare function slowRenderInstances(discovered: DiscoveredHeadlessInstance[], h
|
|
|
139
139
|
*/
|
|
140
140
|
declare function validateForEachInstances(forEachInstances: ForEachHeadlessInstance[], headlessInstanceComponents: HeadlessInstanceComponent[]): string[];
|
|
141
141
|
|
|
142
|
-
declare function renderFastChangingData(pageParams: object, pageProps: PageProps, carryForward: object, parts: Array<DevServerPagePart>, instancePhaseData?: InstancePhaseData, forEachInstances?: ForEachHeadlessInstance[], headlessInstanceComponents?: HeadlessInstanceComponent[], mergedSlowViewState?: object, query?: Record<string, string>): Promise<AnyFastRenderResult>;
|
|
142
|
+
declare function renderFastChangingData(pageParams: object, pageProps: PageProps, carryForward: object, parts: Array<DevServerPagePart>, instancePhaseData?: InstancePhaseData, forEachInstances?: ForEachHeadlessInstance[], headlessInstanceComponents?: HeadlessInstanceComponent[], mergedSlowViewState?: object, query?: Record<string, string>, cookies?: Record<string, string>): Promise<AnyFastRenderResult>;
|
|
143
143
|
|
|
144
144
|
/**
|
|
145
145
|
* Action metadata loaded from .jay-action files.
|
|
@@ -1261,4 +1261,10 @@ declare function mergeHeadTags(sources: HeadTag[][]): HeadTag[];
|
|
|
1261
1261
|
*/
|
|
1262
1262
|
declare function serializeHeadTags(tags: HeadTag[]): string;
|
|
1263
1263
|
|
|
1264
|
-
|
|
1264
|
+
/**
|
|
1265
|
+
* Parse a Cookie header string into a key-value record.
|
|
1266
|
+
* Handles standard cookie format: "name1=value1; name2=value2".
|
|
1267
|
+
*/
|
|
1268
|
+
declare function parseCookies(cookieHeader: string | null | undefined): Record<string, string>;
|
|
1269
|
+
|
|
1270
|
+
export { type ActionDiscoveryOptions, type ActionDiscoveryResult, type ActionErrorResponse, type ActionExecutionResult, type ActionIndexEntry, type ActionMetadata, ActionRegistry, type ActionSchema, type ContextIndexEntry, type DevServerPagePart, DevSlowlyChangingPhase, type GenerateClientScriptOptions, type HeadlessInstanceComponent, type InstancePhaseData, type InstanceSlowRenderResult, type LoadedPageParts, type MaterializeContractsOptions, type MaterializeResult, type PluginActionDiscoveryOptions, type PluginClientInitInfo, type PluginContractEntry, type PluginInitDiscoveryOptions, type PluginReferencesContext, type PluginReferencesHandler, type PluginReferencesResult, type PluginScanOptions, type PluginSetupContext, type PluginSetupHandler, type PluginSetupResult, type PluginWithInit, type PluginWithReferences, type PluginWithSetup, type PluginsIndex, type PluginsIndexEntry, type ProjectClientInitInfo, type RegisteredAction, type RegisteredActionBase, type RegisteredActionEntry, type RegisteredStreamAction, type RouteIndexEntry, type ScannedPlugin, type ScriptFragments, type ServiceIndexEntry, SlowRenderCache, type SlowRenderCacheEntry, type SlowlyChangingPhase, type ViteSSRLoader, actionRegistry, buildAutomationWrap, buildScriptFragments, clearActionRegistry, clearClientInitData, clearLifecycleCallbacks, clearServerElementCache, clearServiceRegistry, discoverAllPluginActions, discoverAndRegisterActions, discoverPluginActions, discoverPluginsWithInit, discoverPluginsWithReferences, discoverPluginsWithSetup, executeAction, executePluginReferences, executePluginServerInits, executePluginSetup, generateClientScript, generateFrozenPageHtml, generatePromiseReconstruction, generateSSRPageHtml, getActionCacheHeaders, getClientInitData, getClientInitDataForKey, getRegisteredAction, getRegisteredActionNames, getService, getServiceRegistry, hasAction, hasService, invalidateServerElementCache, listContracts, loadActionMetadata, loadPageParts, materializeContracts, mergeHeadTags, onInit, onShutdown, parseActionMetadata, parseCookies, preparePluginClientInits, registerAction, registerService, renderFastChangingData, resolveActionMetadataPath, resolveServices, resolveViewStatePromises, runInitCallbacks, runLoadParams, runShutdownCallbacks, scanPlugins, serializeHeadTags, setClientInitData, slowRenderInstances, sortPluginsByDependencies, tagIdentityKey, validateForEachInstances };
|
package/dist/index.js
CHANGED
|
@@ -395,10 +395,11 @@ function resolveBinding(binding, item) {
|
|
|
395
395
|
}
|
|
396
396
|
return binding;
|
|
397
397
|
}
|
|
398
|
-
async function renderFastChangingData(pageParams, pageProps, carryForward, parts, instancePhaseData, forEachInstances, headlessInstanceComponents, mergedSlowViewState, query = {}) {
|
|
398
|
+
async function renderFastChangingData(pageParams, pageProps, carryForward, parts, instancePhaseData, forEachInstances, headlessInstanceComponents, mergedSlowViewState, query = {}, cookies = {}) {
|
|
399
399
|
let fastViewState = {};
|
|
400
400
|
let fastCarryForward = {};
|
|
401
401
|
const fastHeadTagSources = [];
|
|
402
|
+
const responseHeaderSources = [];
|
|
402
403
|
for (const part of parts) {
|
|
403
404
|
const { compDefinition, key, contractInfo } = part;
|
|
404
405
|
if (compDefinition.fastRender) {
|
|
@@ -408,6 +409,7 @@ async function renderFastChangingData(pageParams, pageProps, carryForward, parts
|
|
|
408
409
|
...pageProps,
|
|
409
410
|
...pageParams,
|
|
410
411
|
query,
|
|
412
|
+
cookies,
|
|
411
413
|
...contractInfo && {
|
|
412
414
|
contractName: contractInfo.contractName,
|
|
413
415
|
metadata: contractInfo.metadata
|
|
@@ -425,6 +427,9 @@ async function renderFastChangingData(pageParams, pageProps, carryForward, parts
|
|
|
425
427
|
if (fastRenderedPart.headTags) {
|
|
426
428
|
fastHeadTagSources.push(fastRenderedPart.headTags);
|
|
427
429
|
}
|
|
430
|
+
if (fastRenderedPart.responseHeaders) {
|
|
431
|
+
responseHeaderSources.push(fastRenderedPart.responseHeaders);
|
|
432
|
+
}
|
|
428
433
|
} else
|
|
429
434
|
return fastRenderedPart;
|
|
430
435
|
}
|
|
@@ -445,7 +450,7 @@ async function renderFastChangingData(pageParams, pageProps, carryForward, parts
|
|
|
445
450
|
if (comp.compDefinition.fastRender) {
|
|
446
451
|
const services = resolveServices(comp.compDefinition.services);
|
|
447
452
|
const cf = instancePhaseData.carryForwards[coordKey];
|
|
448
|
-
const instanceProps = { ...instance.props, query };
|
|
453
|
+
const instanceProps = { ...instance.props, query, cookies };
|
|
449
454
|
const fastResult = comp.compDefinition.slowlyRender ? await comp.compDefinition.fastRender(instanceProps, cf, ...services) : await comp.compDefinition.fastRender(instanceProps, ...services);
|
|
450
455
|
if (fastResult.kind === "PhaseOutput") {
|
|
451
456
|
instanceViewStates[coordKey] = instanceSlowVS ? { ...instanceSlowVS, ...fastResult.rendered } : fastResult.rendered;
|
|
@@ -455,6 +460,9 @@ async function renderFastChangingData(pageParams, pageProps, carryForward, parts
|
|
|
455
460
|
if (fastResult.headTags) {
|
|
456
461
|
fastHeadTagSources.push(fastResult.headTags);
|
|
457
462
|
}
|
|
463
|
+
if (fastResult.responseHeaders) {
|
|
464
|
+
responseHeaderSources.push(fastResult.responseHeaders);
|
|
465
|
+
}
|
|
458
466
|
}
|
|
459
467
|
} else {
|
|
460
468
|
instanceViewStates[coordKey] = instanceSlowVS ?? {};
|
|
@@ -496,7 +504,7 @@ async function renderFastChangingData(pageParams, pageProps, carryForward, parts
|
|
|
496
504
|
cf = slowResult.carryForward;
|
|
497
505
|
}
|
|
498
506
|
}
|
|
499
|
-
const forEachProps = { ...props, query };
|
|
507
|
+
const forEachProps = { ...props, query, cookies };
|
|
500
508
|
const fastResult = comp.compDefinition.slowlyRender ? await comp.compDefinition.fastRender(forEachProps, cf, ...services) : await comp.compDefinition.fastRender(forEachProps, ...services);
|
|
501
509
|
if (fastResult.kind === "PhaseOutput") {
|
|
502
510
|
const coord = computeForEachInstanceKey(
|
|
@@ -522,6 +530,9 @@ async function renderFastChangingData(pageParams, pageProps, carryForward, parts
|
|
|
522
530
|
if (fastHeadTagSources.length > 0) {
|
|
523
531
|
result.headTags = fastHeadTagSources.flat();
|
|
524
532
|
}
|
|
533
|
+
if (responseHeaderSources.length > 0) {
|
|
534
|
+
result.responseHeaders = Object.assign({}, ...responseHeaderSources);
|
|
535
|
+
}
|
|
525
536
|
return Promise.resolve(result);
|
|
526
537
|
}
|
|
527
538
|
function generatePromiseReconstruction(outcomes) {
|
|
@@ -2948,6 +2959,17 @@ async function loadHandler(plugin, handlerName, viteServer) {
|
|
|
2948
2959
|
return module[handlerName];
|
|
2949
2960
|
}
|
|
2950
2961
|
}
|
|
2962
|
+
function parseCookies(cookieHeader) {
|
|
2963
|
+
const cookies = {};
|
|
2964
|
+
if (!cookieHeader)
|
|
2965
|
+
return cookies;
|
|
2966
|
+
for (const pair of cookieHeader.split(";")) {
|
|
2967
|
+
const [name, ...rest] = pair.trim().split("=");
|
|
2968
|
+
if (name)
|
|
2969
|
+
cookies[name] = decodeURIComponent(rest.join("="));
|
|
2970
|
+
}
|
|
2971
|
+
return cookies;
|
|
2972
|
+
}
|
|
2951
2973
|
export {
|
|
2952
2974
|
ActionRegistry,
|
|
2953
2975
|
DevSlowlyChangingPhase,
|
|
@@ -2992,6 +3014,7 @@ export {
|
|
|
2992
3014
|
onInit,
|
|
2993
3015
|
onShutdown,
|
|
2994
3016
|
parseActionMetadata,
|
|
3017
|
+
parseCookies,
|
|
2995
3018
|
preparePluginClientInits,
|
|
2996
3019
|
registerAction,
|
|
2997
3020
|
registerService,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jay-framework/stack-server-runtime",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.4",
|
|
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.17.
|
|
30
|
-
"@jay-framework/compiler-shared": "^0.17.
|
|
31
|
-
"@jay-framework/component": "^0.17.
|
|
32
|
-
"@jay-framework/fullstack-component": "^0.17.
|
|
33
|
-
"@jay-framework/logger": "^0.17.
|
|
34
|
-
"@jay-framework/runtime": "^0.17.
|
|
35
|
-
"@jay-framework/ssr-runtime": "^0.17.
|
|
36
|
-
"@jay-framework/stack-route-scanner": "^0.17.
|
|
37
|
-
"@jay-framework/view-state-merge": "^0.17.
|
|
29
|
+
"@jay-framework/compiler-jay-html": "^0.17.4",
|
|
30
|
+
"@jay-framework/compiler-shared": "^0.17.4",
|
|
31
|
+
"@jay-framework/component": "^0.17.4",
|
|
32
|
+
"@jay-framework/fullstack-component": "^0.17.4",
|
|
33
|
+
"@jay-framework/logger": "^0.17.4",
|
|
34
|
+
"@jay-framework/runtime": "^0.17.4",
|
|
35
|
+
"@jay-framework/ssr-runtime": "^0.17.4",
|
|
36
|
+
"@jay-framework/stack-route-scanner": "^0.17.4",
|
|
37
|
+
"@jay-framework/view-state-merge": "^0.17.4",
|
|
38
38
|
"yaml": "^2.3.4"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@jay-framework/dev-environment": "^0.17.
|
|
42
|
-
"@jay-framework/jay-cli": "^0.17.
|
|
43
|
-
"@jay-framework/stack-client-runtime": "^0.17.
|
|
41
|
+
"@jay-framework/dev-environment": "^0.17.4",
|
|
42
|
+
"@jay-framework/jay-cli": "^0.17.4",
|
|
43
|
+
"@jay-framework/stack-client-runtime": "^0.17.4",
|
|
44
44
|
"@types/express": "^5.0.2",
|
|
45
45
|
"@types/node": "^22.15.21",
|
|
46
46
|
"nodemon": "^3.0.3",
|