@bleedingdev/modern-js-runtime-extensions 3.9.0-ultramodern.2 → 3.9.0-ultramodern.21
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/cjs/buildIdentity.js +73 -0
- package/dist/cjs/contextExtensions.js +74 -0
- package/dist/cjs/headRuntime.js +91 -0
- package/dist/cjs/helmetContext.js +54 -0
- package/dist/cjs/index.js +18 -4
- package/dist/cjs/localisedLoaderIdentity.js +51 -0
- package/dist/cjs/localisedUrls/config.js +49 -0
- package/dist/cjs/localisedUrls/index.js +95 -0
- package/dist/cjs/localisedUrls/normalise.js +87 -0
- package/dist/cjs/localisedUrls/pathname.js +68 -0
- package/dist/cjs/localisedUrls/patterns.js +214 -0
- package/dist/cjs/localisedUrls/redirect.js +100 -0
- package/dist/cjs/localisedUrls/resolve.js +78 -0
- package/dist/cjs/localisedUrls/routeIdentity.js +92 -0
- package/dist/cjs/localisedUrls/routes.js +217 -0
- package/dist/cjs/localisedUrls/types.js +18 -0
- package/dist/cjs/prefetchPolicy.js +52 -0
- package/dist/cjs/rendererHead.js +18 -5
- package/dist/cjs/request-policy/browser.js +139 -0
- package/dist/cjs/request-policy/client.js +234 -0
- package/dist/cjs/request-policy/node.js +149 -0
- package/dist/cjs/request-policy/policyCore.js +266 -0
- package/dist/cjs/request-policy/requestContext.js +137 -0
- package/dist/cjs/request-policy/traceparent.js +56 -0
- package/dist/cjs/request-policy/transport.js +234 -0
- package/dist/cjs/request-policy/types.js +57 -0
- package/dist/cjs/routeHydration.js +127 -0
- package/dist/cjs/routerPrefetchPolicy.js +153 -0
- package/dist/cjs/routerProvider.js +105 -0
- package/dist/cjs/routerState.js +175 -0
- package/dist/cjs/routerStatePlugin.js +113 -0
- package/dist/cjs/routerStateTypes.js +18 -0
- package/dist/cjs/rsc-disabled/rscDisabledClientBrowserRuntime.js +69 -0
- package/dist/cjs/rsc-disabled/rscDisabledClientEdgeRuntime.js +61 -0
- package/dist/cjs/rsc-disabled/rscDisabledClientNodeRuntime.js +65 -0
- package/dist/cjs/rsc-disabled/rscDisabledRuntimeError.js +42 -0
- package/dist/cjs/rsc-disabled/rscDisabledServerEdgeRuntime.js +93 -0
- package/dist/cjs/rsc-disabled/rscDisabledServerNodeRuntime.js +101 -0
- package/dist/cjs/runtimeContextProjection.js +112 -0
- package/dist/cjs/server-config/bffRuntime.js +18 -0
- package/dist/cjs/server-config/index.js +18 -0
- package/dist/cjs/server-config/serverTelemetry.js +18 -0
- package/dist/cjs/shellStream.js +34 -2
- package/dist/cjs/workspaceEvents.js +159 -0
- package/dist/esm/buildIdentity.mjs +35 -0
- package/dist/esm/contextExtensions.mjs +33 -0
- package/dist/esm/headRuntime.mjs +43 -0
- package/dist/esm/helmetContext.mjs +13 -0
- package/dist/esm/index.mjs +2 -0
- package/dist/esm/localisedLoaderIdentity.mjs +13 -0
- package/dist/esm/localisedUrls/config.mjs +11 -0
- package/dist/esm/localisedUrls/index.mjs +8 -0
- package/dist/esm/localisedUrls/normalise.mjs +37 -0
- package/dist/esm/localisedUrls/pathname.mjs +24 -0
- package/dist/esm/localisedUrls/patterns.mjs +152 -0
- package/dist/esm/localisedUrls/redirect.mjs +53 -0
- package/dist/esm/localisedUrls/resolve.mjs +37 -0
- package/dist/esm/localisedUrls/routeIdentity.mjs +54 -0
- package/dist/esm/localisedUrls/routes.mjs +176 -0
- package/dist/esm/localisedUrls/types.mjs +0 -0
- package/dist/esm/prefetchPolicy.mjs +11 -0
- package/dist/esm/rendererHead.mjs +14 -5
- package/dist/esm/request-policy/browser.mjs +11 -0
- package/dist/esm/request-policy/client.mjs +195 -0
- package/dist/esm/request-policy/policyCore.mjs +171 -0
- package/dist/esm/request-policy/requestContext.mjs +75 -0
- package/dist/esm/request-policy/traceparent.mjs +18 -0
- package/dist/esm/request-policy/transport.mjs +196 -0
- package/dist/esm/request-policy/types.mjs +10 -0
- package/dist/esm/routeHydration.mjs +77 -0
- package/dist/esm/routerPrefetchPolicy.mjs +115 -0
- package/dist/esm/routerProvider.mjs +58 -0
- package/dist/esm/routerState.mjs +113 -0
- package/dist/esm/routerStatePlugin.mjs +75 -0
- package/dist/esm/routerStateTypes.mjs +0 -0
- package/dist/esm/rsc-disabled/rscDisabledClientBrowserRuntime.mjs +10 -0
- package/dist/esm/rsc-disabled/rscDisabledClientEdgeRuntime.mjs +8 -0
- package/dist/esm/rsc-disabled/rscDisabledClientNodeRuntime.mjs +9 -0
- package/dist/esm/rsc-disabled/rscDisabledRuntimeError.mjs +4 -0
- package/dist/esm/rsc-disabled/rscDisabledServerEdgeRuntime.mjs +16 -0
- package/dist/esm/rsc-disabled/rscDisabledServerNodeRuntime.mjs +18 -0
- package/dist/esm/runtimeContextProjection.mjs +74 -0
- package/dist/esm/server-config/bffRuntime.mjs +0 -0
- package/dist/esm/server-config/index.mjs +0 -0
- package/dist/esm/server-config/serverTelemetry.mjs +0 -0
- package/dist/esm/shellStream.mjs +34 -2
- package/dist/esm/workspaceEvents.mjs +66 -0
- package/dist/esm-node/buildIdentity.mjs +36 -0
- package/dist/esm-node/contextExtensions.mjs +34 -0
- package/dist/esm-node/headRuntime.mjs +44 -0
- package/dist/esm-node/helmetContext.mjs +14 -0
- package/dist/esm-node/index.mjs +2 -0
- package/dist/esm-node/localisedLoaderIdentity.mjs +14 -0
- package/dist/esm-node/localisedUrls/config.mjs +12 -0
- package/dist/esm-node/localisedUrls/index.mjs +9 -0
- package/dist/esm-node/localisedUrls/normalise.mjs +38 -0
- package/dist/esm-node/localisedUrls/pathname.mjs +25 -0
- package/dist/esm-node/localisedUrls/patterns.mjs +153 -0
- package/dist/esm-node/localisedUrls/redirect.mjs +54 -0
- package/dist/esm-node/localisedUrls/resolve.mjs +38 -0
- package/dist/esm-node/localisedUrls/routeIdentity.mjs +55 -0
- package/dist/esm-node/localisedUrls/routes.mjs +177 -0
- package/dist/esm-node/localisedUrls/types.mjs +1 -0
- package/dist/esm-node/prefetchPolicy.mjs +12 -0
- package/dist/esm-node/rendererHead.mjs +14 -5
- package/dist/esm-node/request-policy/browser.mjs +12 -0
- package/dist/esm-node/request-policy/client.mjs +196 -0
- package/dist/esm-node/request-policy/node.mjs +22 -0
- package/dist/esm-node/request-policy/policyCore.mjs +172 -0
- package/dist/esm-node/request-policy/requestContext.mjs +76 -0
- package/dist/esm-node/request-policy/traceparent.mjs +19 -0
- package/dist/esm-node/request-policy/transport.mjs +197 -0
- package/dist/esm-node/request-policy/types.mjs +11 -0
- package/dist/esm-node/routeHydration.mjs +78 -0
- package/dist/esm-node/routerPrefetchPolicy.mjs +116 -0
- package/dist/esm-node/routerProvider.mjs +59 -0
- package/dist/esm-node/routerState.mjs +114 -0
- package/dist/esm-node/routerStatePlugin.mjs +76 -0
- package/dist/esm-node/routerStateTypes.mjs +1 -0
- package/dist/esm-node/rsc-disabled/rscDisabledClientBrowserRuntime.mjs +11 -0
- package/dist/esm-node/rsc-disabled/rscDisabledClientEdgeRuntime.mjs +9 -0
- package/dist/esm-node/rsc-disabled/rscDisabledClientNodeRuntime.mjs +10 -0
- package/dist/esm-node/rsc-disabled/rscDisabledRuntimeError.mjs +5 -0
- package/dist/esm-node/rsc-disabled/rscDisabledServerEdgeRuntime.mjs +17 -0
- package/dist/esm-node/rsc-disabled/rscDisabledServerNodeRuntime.mjs +19 -0
- package/dist/esm-node/runtimeContextProjection.mjs +75 -0
- package/dist/esm-node/server-config/bffRuntime.mjs +1 -0
- package/dist/esm-node/server-config/index.mjs +1 -0
- package/dist/esm-node/server-config/serverTelemetry.mjs +1 -0
- package/dist/esm-node/shellStream.mjs +34 -2
- package/dist/esm-node/workspaceEvents.mjs +67 -0
- package/dist/types/buildIdentity.d.ts +37 -0
- package/dist/types/contextExtensions.d.ts +34 -0
- package/dist/types/headRuntime.d.ts +12 -0
- package/dist/types/helmetCompat.d.ts +1 -1
- package/dist/types/helmetContext.d.ts +10 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/localisedLoaderIdentity.d.ts +10 -0
- package/dist/types/localisedUrls/config.d.ts +9 -0
- package/dist/types/localisedUrls/index.d.ts +10 -0
- package/dist/types/localisedUrls/normalise.d.ts +10 -0
- package/dist/types/localisedUrls/pathname.d.ts +4 -0
- package/dist/types/localisedUrls/patterns.d.ts +11 -0
- package/dist/types/localisedUrls/redirect.d.ts +19 -0
- package/dist/types/localisedUrls/resolve.d.ts +7 -0
- package/dist/types/localisedUrls/routeIdentity.d.ts +22 -0
- package/dist/types/localisedUrls/routes.d.ts +3 -0
- package/dist/types/localisedUrls/types.d.ts +14 -0
- package/dist/types/prefetchPolicy.d.ts +4 -0
- package/dist/types/rendererHead.d.ts +5 -3
- package/dist/types/request-policy/browser.d.ts +10 -0
- package/dist/types/request-policy/client.d.ts +14 -0
- package/dist/types/request-policy/node.d.ts +10 -0
- package/dist/types/request-policy/policyCore.d.ts +107 -0
- package/dist/types/request-policy/requestContext.d.ts +22 -0
- package/dist/types/request-policy/traceparent.d.ts +10 -0
- package/dist/types/request-policy/transport.d.ts +12 -0
- package/dist/types/request-policy/types.d.ts +144 -0
- package/dist/types/routeHydration.d.ts +24 -0
- package/dist/types/routerPrefetchPolicy.d.ts +28 -0
- package/dist/types/routerProvider.d.ts +55 -0
- package/dist/types/routerState.d.ts +17 -0
- package/dist/types/routerStatePlugin.d.ts +19 -0
- package/dist/types/routerStateTypes.d.ts +70 -0
- package/dist/types/rsc-disabled/rscDisabledClientBrowserRuntime.d.ts +9 -0
- package/dist/types/rsc-disabled/rscDisabledClientEdgeRuntime.d.ts +7 -0
- package/dist/types/rsc-disabled/rscDisabledClientNodeRuntime.d.ts +8 -0
- package/dist/types/rsc-disabled/rscDisabledRuntimeError.d.ts +1 -0
- package/dist/types/rsc-disabled/rscDisabledServerEdgeRuntime.d.ts +15 -0
- package/dist/types/rsc-disabled/rscDisabledServerNodeRuntime.d.ts +17 -0
- package/dist/types/runtimeContextProjection.d.ts +30 -0
- package/dist/types/server-config/bffRuntime.d.ts +122 -0
- package/dist/types/server-config/index.d.ts +2 -0
- package/dist/types/server-config/serverTelemetry.d.ts +322 -0
- package/dist/types/workspaceEvents.d.ts +62 -0
- package/package.json +240 -15
- package/rslib.config.mts +17 -2
- package/rstest.config.mts +33 -2
- package/src/buildIdentity.ts +61 -0
- package/src/contextExtensions.ts +81 -0
- package/src/headRuntime.tsx +77 -0
- package/src/helmetCompat.ts +1 -1
- package/src/helmetContext.ts +31 -0
- package/src/index.ts +2 -0
- package/src/localisedLoaderIdentity.ts +30 -0
- package/src/localisedUrls/config.ts +18 -0
- package/src/localisedUrls/index.ts +25 -0
- package/src/localisedUrls/normalise.ts +62 -0
- package/src/localisedUrls/pathname.ts +60 -0
- package/src/localisedUrls/patterns.ts +283 -0
- package/src/localisedUrls/redirect.ts +107 -0
- package/src/localisedUrls/resolve.ts +106 -0
- package/src/localisedUrls/routeIdentity.ts +83 -0
- package/src/localisedUrls/routes.ts +451 -0
- package/src/localisedUrls/types.ts +18 -0
- package/src/prefetchPolicy.ts +33 -0
- package/src/rendererHead.ts +25 -8
- package/src/request-policy/browser.ts +22 -0
- package/src/request-policy/client.ts +404 -0
- package/src/request-policy/node.ts +41 -0
- package/src/request-policy/policyCore.ts +424 -0
- package/src/request-policy/requestContext.ts +149 -0
- package/src/request-policy/traceparent.ts +43 -0
- package/src/request-policy/transport.ts +349 -0
- package/src/request-policy/types.ts +229 -0
- package/src/routeHydration.ts +208 -0
- package/src/routerPrefetchPolicy.ts +195 -0
- package/src/routerProvider.ts +160 -0
- package/src/routerState.ts +220 -0
- package/src/routerStatePlugin.ts +125 -0
- package/src/routerStateTypes.ts +76 -0
- package/src/rsc-disabled/rscDisabledClientBrowserRuntime.ts +10 -0
- package/src/rsc-disabled/rscDisabledClientEdgeRuntime.ts +8 -0
- package/src/rsc-disabled/rscDisabledClientNodeRuntime.ts +9 -0
- package/src/rsc-disabled/rscDisabledRuntimeError.ts +3 -0
- package/src/rsc-disabled/rscDisabledServerEdgeRuntime.ts +16 -0
- package/src/rsc-disabled/rscDisabledServerNodeRuntime.ts +18 -0
- package/src/runtimeContextProjection.ts +105 -0
- package/src/server-config/bffRuntime.ts +136 -0
- package/src/server-config/index.ts +2 -0
- package/src/server-config/serverTelemetry.ts +337 -0
- package/src/shellStream.ts +55 -25
- package/src/workspaceEvents.ts +324 -0
- package/tests/buildIdentity.test.ts +51 -0
- package/tests/contextExtensions.test.ts +27 -0
- package/tests/headRuntime.test.tsx +229 -0
- package/tests/localisedUrls.test.ts +560 -0
- package/tests/rendererHead.test.ts +52 -121
- package/tests/request-policy/browser-policy.test.ts +108 -0
- package/tests/request-policy/client-isolation.test.ts +109 -0
- package/tests/request-policy/node-policy.test.ts +447 -0
- package/tests/request-policy/policyCore.test.ts +129 -0
- package/tests/request-policy/requestContext.test.ts +66 -0
- package/tests/request-policy/requestFactory.outbound-contract.test.ts +290 -0
- package/tests/request-policy/traceparent.test.ts +52 -0
- package/tests/request-policy/transport-retry.test.ts +367 -0
- package/tests/routeHydration.test.ts +180 -0
- package/tests/routerPrefetchPolicy.test.ts +102 -0
- package/tests/routerProvider.test.ts +29 -0
- package/tests/routerState.test.ts +77 -0
- package/tests/routerStatePlugin.test.ts +63 -0
- package/tests/runtimeContextProjection.test.ts +83 -0
- package/tests/safeFailure.test.ts +10 -28
- package/tests/shellStream.test.ts +39 -2
- package/tests/workspaceEvents.test.ts +221 -0
- package/dist/cjs/rscHtmlStream.js +0 -128
- package/dist/esm/rscHtmlStream.mjs +0 -86
- package/dist/esm-node/rscHtmlStream.mjs +0 -87
- package/dist/types/rscHtmlStream.d.ts +0 -4
- package/src/rscHtmlStream.ts +0 -142
- package/tests/rscHtmlStream.test.ts +0 -153
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { IdentityBindingViolation, OperationContext, OperationContractOptions, OperationContractViolation, TransportTarget } from './types.js';
|
|
2
|
+
export declare const TRACEPARENT_HEADER = "traceparent";
|
|
3
|
+
export declare const isSecuredRequestId: (requestId: string) => boolean;
|
|
4
|
+
export declare const isEmptyDomain: (domain?: string) => boolean;
|
|
5
|
+
export declare const firstHeaderValue: (value: unknown) => any;
|
|
6
|
+
export declare const findHeaderKey: (headers: Record<string, any>, header: string) => string | undefined;
|
|
7
|
+
export declare const readHeader: (headers: Record<string, any>, header: string) => any;
|
|
8
|
+
export declare const writeHeader: (headers: Record<string, any>, header: string, value: unknown) => void;
|
|
9
|
+
export declare const deleteHeader: (headers: Record<string, any>, header: string) => void;
|
|
10
|
+
export declare const toOrigin: (value?: string) => string | undefined;
|
|
11
|
+
export declare const parseTraceparentValue: (value: unknown) => import("./traceparent.js").TraceparentContext | undefined;
|
|
12
|
+
export declare const buildOperationContext: ({ requestId, method, path, operationContext, traceparent, }: {
|
|
13
|
+
requestId: string;
|
|
14
|
+
method: string;
|
|
15
|
+
path: string;
|
|
16
|
+
operationContext?: OperationContext | undefined;
|
|
17
|
+
traceparent?: unknown;
|
|
18
|
+
}) => {
|
|
19
|
+
requestId: string;
|
|
20
|
+
operationId: string;
|
|
21
|
+
routePath: string;
|
|
22
|
+
method: string;
|
|
23
|
+
schemaHash?: string | undefined;
|
|
24
|
+
operationVersion?: number | undefined;
|
|
25
|
+
traceparent?: string | undefined;
|
|
26
|
+
traceId?: string | undefined;
|
|
27
|
+
spanId?: string | undefined;
|
|
28
|
+
};
|
|
29
|
+
type OperationContextPayload = ReturnType<typeof buildOperationContext>;
|
|
30
|
+
export declare class ProducerClientNotInitializedError extends Error {
|
|
31
|
+
readonly code = "BFF_PRODUCER_CLIENT_NOT_INITIALIZED";
|
|
32
|
+
constructor(requestId: string);
|
|
33
|
+
}
|
|
34
|
+
export declare class ProducerDomainNotConfiguredError extends Error {
|
|
35
|
+
readonly code = "BFF_PRODUCER_DOMAIN_NOT_CONFIGURED";
|
|
36
|
+
constructor(requestId: string);
|
|
37
|
+
}
|
|
38
|
+
export declare class CrossOriginEnvelopePolicyError extends Error {
|
|
39
|
+
readonly code = "BFF_CROSS_ORIGIN_ENVELOPE_NOT_ALLOWED";
|
|
40
|
+
constructor(requestId: string, sourceOrigin?: string, targetOrigin?: string);
|
|
41
|
+
}
|
|
42
|
+
export declare class IdentityBindingViolationError extends Error {
|
|
43
|
+
readonly code = "BFF_IDENTITY_BINDING_VIOLATION";
|
|
44
|
+
readonly violation: IdentityBindingViolation;
|
|
45
|
+
constructor(violation: IdentityBindingViolation);
|
|
46
|
+
}
|
|
47
|
+
export declare class OperationContractViolationError extends Error {
|
|
48
|
+
readonly code = "BFF_OPERATION_CONTRACT_VIOLATION";
|
|
49
|
+
readonly violation: OperationContractViolation;
|
|
50
|
+
constructor(violation: OperationContractViolation);
|
|
51
|
+
}
|
|
52
|
+
export declare const validateOperationContract: ({ requestId, target, contextPayload, operationContract, }: {
|
|
53
|
+
requestId: string;
|
|
54
|
+
target: TransportTarget;
|
|
55
|
+
contextPayload: OperationContextPayload;
|
|
56
|
+
operationContract: OperationContractOptions | undefined;
|
|
57
|
+
}) => void;
|
|
58
|
+
export declare const resolveConfiguredRequest: <F>(configuredRequests: Map<string, F>, requestId: string, fallback: F) => F;
|
|
59
|
+
/**
|
|
60
|
+
* Builds the JSON value for the `x-modernjs-bff-envelope` header and throws
|
|
61
|
+
* when the cross-origin envelope policy denies the flow. Returns the
|
|
62
|
+
* serialized envelope.
|
|
63
|
+
*/
|
|
64
|
+
export declare const buildEnvelopeHeaderValue: ({ requestId, target, sourceOrigin, targetOrigin, traceContext, allowCrossOriginEnvelope, }: {
|
|
65
|
+
requestId: string;
|
|
66
|
+
target: TransportTarget;
|
|
67
|
+
sourceOrigin: string | undefined;
|
|
68
|
+
targetOrigin: string | undefined;
|
|
69
|
+
traceContext: {
|
|
70
|
+
traceId: string;
|
|
71
|
+
spanId: string;
|
|
72
|
+
} | null | undefined;
|
|
73
|
+
allowCrossOriginEnvelope: boolean | ((options: {
|
|
74
|
+
requestId: string;
|
|
75
|
+
sourceOrigin?: string;
|
|
76
|
+
targetOrigin?: string;
|
|
77
|
+
target: TransportTarget;
|
|
78
|
+
}) => boolean) | undefined;
|
|
79
|
+
}) => string;
|
|
80
|
+
/**
|
|
81
|
+
* Derives the operation context for a secured requestId, validates it against
|
|
82
|
+
* the configured operation contract and writes the `x-operation-id` and
|
|
83
|
+
* `x-modernjs-bff-operation-context` headers (without clobbering caller
|
|
84
|
+
* provided values for the id header).
|
|
85
|
+
*/
|
|
86
|
+
export declare const attachOperationContextHeaders: ({ headers, requestId, target, method, path, operationContext, operationContract, operationContextHeader, operationContextDetailHeader, }: {
|
|
87
|
+
headers: Record<string, any>;
|
|
88
|
+
requestId: string;
|
|
89
|
+
target: TransportTarget;
|
|
90
|
+
method: string;
|
|
91
|
+
path: string;
|
|
92
|
+
operationContext: OperationContext | undefined;
|
|
93
|
+
operationContract: OperationContractOptions | undefined;
|
|
94
|
+
operationContextHeader: string;
|
|
95
|
+
operationContextDetailHeader: string;
|
|
96
|
+
}) => {
|
|
97
|
+
requestId: string;
|
|
98
|
+
operationId: string;
|
|
99
|
+
routePath: string;
|
|
100
|
+
method: string;
|
|
101
|
+
schemaHash?: string | undefined;
|
|
102
|
+
operationVersion?: number | undefined;
|
|
103
|
+
traceparent?: string | undefined;
|
|
104
|
+
traceId?: string | undefined;
|
|
105
|
+
spanId?: string | undefined;
|
|
106
|
+
};
|
|
107
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { OperationContext } from './types.js';
|
|
2
|
+
export declare const BFF_LOCALE_HEADER = "accept-language";
|
|
3
|
+
export declare const BFF_TRACEPARENT_HEADER = "traceparent";
|
|
4
|
+
export type RequestContextInput = {
|
|
5
|
+
headers?: Record<string, unknown>;
|
|
6
|
+
locale?: string;
|
|
7
|
+
traceparent?: string;
|
|
8
|
+
operationContext?: OperationContext;
|
|
9
|
+
};
|
|
10
|
+
export type RequestContextSnapshot = {
|
|
11
|
+
headers: Record<string, string>;
|
|
12
|
+
locale?: string;
|
|
13
|
+
traceparent?: string;
|
|
14
|
+
traceId?: string;
|
|
15
|
+
spanId?: string;
|
|
16
|
+
operationContext?: OperationContext;
|
|
17
|
+
};
|
|
18
|
+
export declare function createRequestContextSnapshot(input?: RequestContextInput): RequestContextSnapshot;
|
|
19
|
+
export declare function createRequestContextHeaders(input?: RequestContextInput): Record<string, string>;
|
|
20
|
+
export { parseTraceparent, type TraceparentContext } from './traceparent.js';
|
|
21
|
+
export type * from './types.js';
|
|
22
|
+
export { BFF_DEFAULT_PROTECTED_IDENTITY_HEADERS, BFF_ENVELOPE_HEADER, BFF_OPERATION_CONTEXT_DETAIL_HEADER, BFF_OPERATION_CONTEXT_HEADER, } from './types.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type TraceparentContext = {
|
|
2
|
+
traceId: string;
|
|
3
|
+
spanId: string;
|
|
4
|
+
sampled: boolean;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Parse a W3C trace context `traceparent` header (version 00).
|
|
8
|
+
* All-zero trace ids and span ids are rejected per the W3C spec.
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseTraceparent(traceparent: string | undefined | null): TraceparentContext | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TransportResilienceOptions, TransportTarget } from './types.js';
|
|
2
|
+
type ExecuteWithResilienceOptions = {
|
|
3
|
+
requestId: string;
|
|
4
|
+
target: TransportTarget;
|
|
5
|
+
method: string;
|
|
6
|
+
url: string;
|
|
7
|
+
init: Record<string, any>;
|
|
8
|
+
fetcher: (...args: any[]) => Promise<any>;
|
|
9
|
+
transport?: TransportResilienceOptions;
|
|
10
|
+
};
|
|
11
|
+
export declare const executeWithResilience: ({ requestId, target, method, url, init, fetcher, transport, }: ExecuteWithResilienceOptions) => Promise<any>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type { HttpMethodDecider, IOptions as NativeOptions, RequestCreatorOptions as NativeRequestCreatorOptions, UploadCreatorOptions as NativeUploadCreatorOptions, Sender } from '@modern-js/create-request/client';
|
|
2
|
+
export type { BFFRequestPayload, HttpMethodDecider, Sender, } from '@modern-js/create-request/client';
|
|
3
|
+
export declare const BFF_ENVELOPE_HEADER = "x-modernjs-bff-envelope";
|
|
4
|
+
export declare const BFF_OPERATION_CONTEXT_HEADER = "x-operation-id";
|
|
5
|
+
export declare const BFF_OPERATION_CONTEXT_DETAIL_HEADER = "x-modernjs-bff-operation-context";
|
|
6
|
+
export declare const BFF_DEFAULT_PROTECTED_IDENTITY_HEADERS: readonly ['x-tenant-id', 'x-subject-id', 'x-user-id', "x-operation-id"];
|
|
7
|
+
export type ResolveHeadersOptions = {
|
|
8
|
+
requestId: string;
|
|
9
|
+
allowedHeaders: string[];
|
|
10
|
+
incomingHeaders: Record<string, any>;
|
|
11
|
+
};
|
|
12
|
+
export type ResolveHeaders = (options: ResolveHeadersOptions) => Record<string, any> | void;
|
|
13
|
+
export type AllowCrossOriginEnvelopeOptions = {
|
|
14
|
+
requestId: string;
|
|
15
|
+
sourceOrigin?: string;
|
|
16
|
+
targetOrigin?: string;
|
|
17
|
+
target: 'server' | 'browser';
|
|
18
|
+
};
|
|
19
|
+
export type AllowCrossOriginEnvelope = boolean | ((options: AllowCrossOriginEnvelopeOptions) => boolean);
|
|
20
|
+
export type TransportTarget = 'server' | 'browser';
|
|
21
|
+
export type RetryDecisionContext = {
|
|
22
|
+
requestId: string;
|
|
23
|
+
target: TransportTarget;
|
|
24
|
+
method: string;
|
|
25
|
+
url: string;
|
|
26
|
+
attempt: number;
|
|
27
|
+
maxAttempts: number;
|
|
28
|
+
error: unknown;
|
|
29
|
+
statusCode?: number;
|
|
30
|
+
};
|
|
31
|
+
export type RetryBackoffOptions = {
|
|
32
|
+
retries?: number;
|
|
33
|
+
baseDelayMs?: number;
|
|
34
|
+
maxDelayMs?: number;
|
|
35
|
+
jitterRatio?: number;
|
|
36
|
+
retryableStatusCodes?: number[];
|
|
37
|
+
shouldRetry?: (context: RetryDecisionContext) => boolean;
|
|
38
|
+
};
|
|
39
|
+
export type DegradedModeReason = 'timeout' | 'retry' | 'retry_exhausted';
|
|
40
|
+
export type DegradedModeEvent = {
|
|
41
|
+
requestId: string;
|
|
42
|
+
target: TransportTarget;
|
|
43
|
+
method: string;
|
|
44
|
+
url: string;
|
|
45
|
+
reason: DegradedModeReason;
|
|
46
|
+
attempt: number;
|
|
47
|
+
maxAttempts: number;
|
|
48
|
+
timeoutMs?: number;
|
|
49
|
+
backoffMs?: number;
|
|
50
|
+
statusCode?: number;
|
|
51
|
+
error?: unknown;
|
|
52
|
+
};
|
|
53
|
+
export type TransportResilienceOptions = {
|
|
54
|
+
timeoutMs?: number;
|
|
55
|
+
retry?: RetryBackoffOptions;
|
|
56
|
+
onDegraded?: (event: DegradedModeEvent) => void;
|
|
57
|
+
};
|
|
58
|
+
export type IdentityBindingViolationReason = 'client_override_blocked' | 'client_override_rejected';
|
|
59
|
+
export type IdentityBindingViolation = {
|
|
60
|
+
requestId: string;
|
|
61
|
+
target: TransportTarget;
|
|
62
|
+
header: string;
|
|
63
|
+
reason: IdentityBindingViolationReason;
|
|
64
|
+
attemptedValue?: unknown;
|
|
65
|
+
derivedValue?: unknown;
|
|
66
|
+
};
|
|
67
|
+
export type DeriveIdentityHeadersOptions = {
|
|
68
|
+
requestId: string;
|
|
69
|
+
target: TransportTarget;
|
|
70
|
+
incomingHeaders: Record<string, any>;
|
|
71
|
+
protectedHeaders: string[];
|
|
72
|
+
};
|
|
73
|
+
export type IdentityBindingOptions = {
|
|
74
|
+
enabled?: boolean;
|
|
75
|
+
strict?: boolean;
|
|
76
|
+
protectedHeaders?: string[];
|
|
77
|
+
deriveHeaders?: (options: DeriveIdentityHeadersOptions) => Record<string, any> | void;
|
|
78
|
+
onViolation?: (violation: IdentityBindingViolation) => void;
|
|
79
|
+
};
|
|
80
|
+
export type OperationContractViolationReason = 'missing_schema_hash' | 'missing_operation_version';
|
|
81
|
+
export type OperationContractViolation = {
|
|
82
|
+
requestId: string;
|
|
83
|
+
target: TransportTarget;
|
|
84
|
+
operationId: string;
|
|
85
|
+
reason: OperationContractViolationReason;
|
|
86
|
+
routePath?: string;
|
|
87
|
+
method?: string;
|
|
88
|
+
schemaHash?: string;
|
|
89
|
+
operationVersion?: number;
|
|
90
|
+
};
|
|
91
|
+
export type CrossProjectOperationContract = {
|
|
92
|
+
schemaHash?: string;
|
|
93
|
+
operationVersion?: number;
|
|
94
|
+
};
|
|
95
|
+
export type CrossProjectPolicyViolationReason = 'missing_envelope' | 'invalid_envelope' | 'missing_request_id' | 'namespace_not_allowed' | 'missing_operation_context' | 'operation_context_mismatch' | 'missing_operation_context_details' | 'invalid_operation_context_details' | 'operation_context_details_request_id_mismatch' | 'missing_operation_schema_hash' | 'missing_operation_version' | 'unknown_operation_contract' | 'operation_schema_hash_mismatch' | 'operation_version_mismatch' | 'producer_identity_mismatch';
|
|
96
|
+
export type CrossProjectPolicyViolation = {
|
|
97
|
+
code: 'BFF_CROSS_PROJECT_POLICY_DENIED';
|
|
98
|
+
reason: CrossProjectPolicyViolationReason;
|
|
99
|
+
message: string;
|
|
100
|
+
status: number;
|
|
101
|
+
};
|
|
102
|
+
export type OperationContractOptions = {
|
|
103
|
+
enabled?: boolean;
|
|
104
|
+
strict?: boolean;
|
|
105
|
+
requireSchemaHash?: boolean;
|
|
106
|
+
requireOperationVersion?: boolean;
|
|
107
|
+
onViolation?: (violation: OperationContractViolation) => void;
|
|
108
|
+
};
|
|
109
|
+
export type OperationContextSource = 'client' | 'server' | 'generated-client' | 'effect-server' | 'data-platform' | 'unknown';
|
|
110
|
+
export type OperationContext = {
|
|
111
|
+
requestId?: string;
|
|
112
|
+
operationId?: string;
|
|
113
|
+
routePath?: string;
|
|
114
|
+
method?: string;
|
|
115
|
+
schemaHash?: string;
|
|
116
|
+
operationVersion?: number;
|
|
117
|
+
locale?: string;
|
|
118
|
+
traceparent?: string;
|
|
119
|
+
traceId?: string;
|
|
120
|
+
spanId?: string;
|
|
121
|
+
source?: OperationContextSource;
|
|
122
|
+
scope?: Record<string, unknown>;
|
|
123
|
+
sessionClaims?: Record<string, unknown>;
|
|
124
|
+
attributes?: Record<string, unknown>;
|
|
125
|
+
};
|
|
126
|
+
export type RequestCreatorOptions<F = typeof fetch> = Omit<NativeRequestCreatorOptions<F>, 'hooks'> & {
|
|
127
|
+
operationContext?: OperationContext;
|
|
128
|
+
};
|
|
129
|
+
export type RequestCreator<F = typeof fetch> = {
|
|
130
|
+
(options: RequestCreatorOptions<F>): Sender;
|
|
131
|
+
(path: string, method: string, port: number, httpMethodDecider?: HttpMethodDecider, fetch?: F, requestId?: string, operationContext?: OperationContext): Sender;
|
|
132
|
+
};
|
|
133
|
+
export type UploadCreatorOptions = Omit<NativeUploadCreatorOptions, 'hooks'> & {
|
|
134
|
+
operationContext?: OperationContext;
|
|
135
|
+
};
|
|
136
|
+
export type UploadCreator = (options: UploadCreatorOptions) => Sender;
|
|
137
|
+
export type IOptions<F = typeof fetch> = NativeOptions<F> & {
|
|
138
|
+
resolveHeaders?: ResolveHeaders;
|
|
139
|
+
transport?: TransportResilienceOptions;
|
|
140
|
+
requireEnvelope?: boolean;
|
|
141
|
+
allowCrossOriginEnvelope?: AllowCrossOriginEnvelope;
|
|
142
|
+
identityBinding?: IdentityBindingOptions;
|
|
143
|
+
operationContract?: OperationContractOptions;
|
|
144
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type RouteAssetManifest = {
|
|
2
|
+
assets?: string[];
|
|
3
|
+
};
|
|
4
|
+
export type RouteManifestLike = {
|
|
5
|
+
routeAssets?: Record<string, RouteAssetManifest | undefined>;
|
|
6
|
+
};
|
|
7
|
+
export type ScriptChunkLike = {
|
|
8
|
+
filename?: string;
|
|
9
|
+
url?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function getMatchedRouteChunks<T>(routeManifest: RouteManifestLike | undefined, matchedRouteIds: readonly string[], routeAssetToChunk: (asset: string) => T): T[];
|
|
12
|
+
export declare const orderHydrationScriptChunks: <T extends ScriptChunkLike>({ asyncEntryChunks, collectedChunks, matchedRouteChunks, entryName, }: {
|
|
13
|
+
asyncEntryChunks: T[];
|
|
14
|
+
collectedChunks: T[];
|
|
15
|
+
matchedRouteChunks: T[];
|
|
16
|
+
entryName: string;
|
|
17
|
+
}) => T[];
|
|
18
|
+
export declare function injectBeforeHydrationEntryScript(template: string, scripts: string, entryName?: string): string;
|
|
19
|
+
export declare function replaceChunkJsPlaceholder(template: string, scripts: string, entryName: string | undefined, placeholder: string): string;
|
|
20
|
+
export declare function createRouteHydrationScriptTags(routeManifest: RouteManifestLike | undefined, matchedRouteIds: readonly string[], entryName: string, options?: {
|
|
21
|
+
nonce?: string;
|
|
22
|
+
template?: string;
|
|
23
|
+
}): string;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
type PrefetchBehavior = 'intent' | 'render' | 'viewport' | 'none';
|
|
2
|
+
type PrefetchState = {
|
|
3
|
+
code: boolean;
|
|
4
|
+
data: boolean;
|
|
5
|
+
};
|
|
6
|
+
/** Policy-only contract: native links supply elements, route inputs and loads. */
|
|
7
|
+
export declare function createRouterPrefetchPolicy(): {
|
|
8
|
+
canWarmup: () => boolean;
|
|
9
|
+
allowData(route: unknown): boolean;
|
|
10
|
+
observe({ element, prefetch: inputPrefetch, preload: inputPreload, notify, }: {
|
|
11
|
+
element: HTMLAnchorElement | null;
|
|
12
|
+
prefetch?: PrefetchBehavior;
|
|
13
|
+
preload?: PrefetchBehavior | false;
|
|
14
|
+
notify: (state: PrefetchState) => void;
|
|
15
|
+
}): {
|
|
16
|
+
onIntent(): void;
|
|
17
|
+
onCancel(): void;
|
|
18
|
+
dispose(): void;
|
|
19
|
+
};
|
|
20
|
+
schedule({ runtimeContext, chunkLoader, publicPath, key: operationKey, run, }: {
|
|
21
|
+
runtimeContext: object;
|
|
22
|
+
chunkLoader: object;
|
|
23
|
+
publicPath: string;
|
|
24
|
+
key: string;
|
|
25
|
+
run: () => Promise<unknown>;
|
|
26
|
+
}): () => void;
|
|
27
|
+
};
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** Structural plugin contract; the composing integration supplies native hooks. */
|
|
2
|
+
export type RouterProviderPlugin = {
|
|
3
|
+
name?: string;
|
|
4
|
+
registryHooks?: Record<string, unknown>;
|
|
5
|
+
setup?: (api: any) => unknown;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Guard for the wrapper plugin (`router/internal`): a resolved provider is
|
|
10
|
+
* only invoked through `setup`, so registry hooks outside the canonical
|
|
11
|
+
* router hook contract cannot be registered for it. Returns the offending
|
|
12
|
+
* hook names and warns once so they are surfaced instead of silently dropped.
|
|
13
|
+
*/
|
|
14
|
+
export declare function reportUnsupportedProviderRegistryHooks(providerPlugin: {
|
|
15
|
+
name?: string;
|
|
16
|
+
registryHooks?: Record<string, unknown>;
|
|
17
|
+
}, routerProviderRegistryHooks: Record<string, unknown>): string[];
|
|
18
|
+
export type RouterProviderFactory = (userConfig?: any) => RouterProviderPlugin;
|
|
19
|
+
export type RouterProviderRegistration = {
|
|
20
|
+
name: string;
|
|
21
|
+
factory: RouterProviderFactory;
|
|
22
|
+
isDefault?: boolean;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* App-owned provider catalog. Provider factories close over their module graph,
|
|
26
|
+
* so they must be resolved from the runtime wrapper that owns the app instead
|
|
27
|
+
* of from a page-global first-registration winner.
|
|
28
|
+
*/
|
|
29
|
+
export type RouterProviderRealm = Readonly<{
|
|
30
|
+
defaultProvider?: string;
|
|
31
|
+
get: (name: string) => RouterProviderFactory | undefined;
|
|
32
|
+
names: () => readonly string[];
|
|
33
|
+
}>;
|
|
34
|
+
export declare function createRouterProviderRealm(registrations: readonly RouterProviderRegistration[]): RouterProviderRealm;
|
|
35
|
+
export declare function resolveRouterProvider(framework: string | undefined, options: {
|
|
36
|
+
realm: RouterProviderRealm;
|
|
37
|
+
}): RouterProviderFactory;
|
|
38
|
+
/** Compose app-owned providers without importing the native runtime graph. */
|
|
39
|
+
export declare function createRouterPlugin<Hooks extends Record<string, unknown>>({ defaultProvider, registryHooks, localProviders, }: {
|
|
40
|
+
defaultProvider: {
|
|
41
|
+
name: string;
|
|
42
|
+
factory: RouterProviderFactory;
|
|
43
|
+
};
|
|
44
|
+
registryHooks: Hooks;
|
|
45
|
+
localProviders?: readonly Omit<RouterProviderRegistration, 'isDefault'>[];
|
|
46
|
+
}): (userConfig?: Record<string, any>) => {
|
|
47
|
+
name: string;
|
|
48
|
+
registryHooks: Hooks;
|
|
49
|
+
setup(api: {
|
|
50
|
+
getRuntimeConfig: () => {
|
|
51
|
+
router?: Record<string, unknown>;
|
|
52
|
+
};
|
|
53
|
+
[key: string]: any;
|
|
54
|
+
}): void;
|
|
55
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { InternalRouterRuntimeState, InternalRouterServerSnapshot, RouterServerPrepareResult } from './routerStateTypes.js';
|
|
2
|
+
export type { BuiltInRouterFramework, InternalRouterRuntimeState, InternalRouterServerSnapshot, RouterFramework, RouterLifecyclePhase, RouterLinkTarget, RouterNavigationCapability, RouterNavigationSnapshot, RouterRouteMatchSnapshot, RouterServerPrepareResult, } from './routerStateTypes.js';
|
|
3
|
+
export declare function getRouterRuntimeState(runtimeContext: object): InternalRouterRuntimeState | undefined;
|
|
4
|
+
export declare function getRouterServerSnapshot(runtimeContext: object): InternalRouterServerSnapshot | undefined;
|
|
5
|
+
/** Capture prepared metadata once; live router updates cannot rewrite it. */
|
|
6
|
+
export declare function createRouterServerSnapshot(snapshot: InternalRouterServerSnapshot): InternalRouterServerSnapshot;
|
|
7
|
+
/**
|
|
8
|
+
* Observe the router runtime-state slot for the given runtime context.
|
|
9
|
+
* Returns an unsubscribe function; safe to call for a context that never
|
|
10
|
+
* receives a router.
|
|
11
|
+
*/
|
|
12
|
+
export declare function subscribeRouterRuntimeState(runtimeContext: object, listener: () => void): () => void;
|
|
13
|
+
export declare function applyRouterRuntimeState<Context extends object>(runtimeContext: Context, state: InternalRouterRuntimeState): Context;
|
|
14
|
+
export declare function applyRouterServerPrepareResult<Context extends object>(runtimeContext: Context, result: RouterServerPrepareResult): Context;
|
|
15
|
+
export declare function getRouterHydrationScripts(runtimeContext: object): readonly string[];
|
|
16
|
+
export declare function getRouterMatchedRouteIds(runtimeContext: object): readonly string[] | undefined;
|
|
17
|
+
export declare function cleanupRouterRuntimeState(runtimeContext: object): Promise<void>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
type RouterLifecycleEvent = {
|
|
2
|
+
framework: string;
|
|
3
|
+
phase: string;
|
|
4
|
+
runtimeContext: object;
|
|
5
|
+
basename?: string;
|
|
6
|
+
router?: unknown;
|
|
7
|
+
};
|
|
8
|
+
/** Install fork policy through lifecycle hooks supplied by the native owner. */
|
|
9
|
+
export declare function createRouterStatePlugin<Hooks extends Record<string, unknown>>({ registryHooks, }: {
|
|
10
|
+
registryHooks: Hooks;
|
|
11
|
+
}): {
|
|
12
|
+
name: string;
|
|
13
|
+
registryHooks: Hooks;
|
|
14
|
+
setup(api: {
|
|
15
|
+
onBeforeRender: (callback: (context: object) => void) => unknown;
|
|
16
|
+
onAfterCreateRouter: (callback: (event: RouterLifecycleEvent) => void) => unknown;
|
|
17
|
+
}): void;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export type BuiltInRouterFramework = 'react-router' | 'tanstack';
|
|
3
|
+
export type RouterFramework = BuiltInRouterFramework | (string & {});
|
|
4
|
+
export interface RouterRouteMatchSnapshot {
|
|
5
|
+
routeId: string;
|
|
6
|
+
assetRouteId?: string;
|
|
7
|
+
pathname?: string;
|
|
8
|
+
params?: Record<string, string>;
|
|
9
|
+
}
|
|
10
|
+
export interface InternalRouterServerSnapshot {
|
|
11
|
+
readonly framework?: RouterFramework;
|
|
12
|
+
readonly basename?: string;
|
|
13
|
+
readonly statusCode?: number;
|
|
14
|
+
readonly errors?: Record<string, unknown>;
|
|
15
|
+
readonly routerData?: {
|
|
16
|
+
readonly loaderData?: Record<string, unknown>;
|
|
17
|
+
readonly errors?: Record<string, unknown>;
|
|
18
|
+
};
|
|
19
|
+
readonly hydrationScripts?: readonly string[];
|
|
20
|
+
readonly matchedRouteIds?: readonly string[];
|
|
21
|
+
readonly matches?: readonly RouterRouteMatchSnapshot[];
|
|
22
|
+
}
|
|
23
|
+
export interface InternalRouterRuntimeState {
|
|
24
|
+
framework: RouterFramework;
|
|
25
|
+
basename?: string;
|
|
26
|
+
instance?: unknown;
|
|
27
|
+
navigation?: RouterNavigationCapability;
|
|
28
|
+
cleanup?: () => void | Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
export interface RouterServerPrepareResult {
|
|
31
|
+
state: InternalRouterRuntimeState;
|
|
32
|
+
snapshot?: InternalRouterServerSnapshot;
|
|
33
|
+
cleanup?: () => void | Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
export type RouterLifecyclePhase = 'ssr-prepare' | 'client-create' | 'hydrate';
|
|
36
|
+
/** Provider-owned browser navigation. Consumers never inspect router internals. */
|
|
37
|
+
export interface RouterNavigationSnapshot {
|
|
38
|
+
location: {
|
|
39
|
+
pathname: string;
|
|
40
|
+
search: string;
|
|
41
|
+
hash: string;
|
|
42
|
+
};
|
|
43
|
+
params: Record<string, string>;
|
|
44
|
+
}
|
|
45
|
+
export interface RouterLinkTarget {
|
|
46
|
+
pathname: string;
|
|
47
|
+
href: string;
|
|
48
|
+
search?: Record<string, unknown>;
|
|
49
|
+
hash?: string;
|
|
50
|
+
hashScrollIntoView?: boolean | ScrollIntoViewOptions;
|
|
51
|
+
prefetch?: 'intent' | 'render' | 'viewport' | 'none';
|
|
52
|
+
preload?: unknown;
|
|
53
|
+
}
|
|
54
|
+
export interface RouterNavigationCapability {
|
|
55
|
+
getSnapshot: () => RouterNavigationSnapshot;
|
|
56
|
+
subscribe: (listener: () => void) => () => void;
|
|
57
|
+
navigate: (href: string, options?: {
|
|
58
|
+
replace?: boolean;
|
|
59
|
+
state?: unknown;
|
|
60
|
+
}) => void | Promise<void>;
|
|
61
|
+
Link: React.ComponentType<{
|
|
62
|
+
to: string;
|
|
63
|
+
children?: React.ReactNode;
|
|
64
|
+
[key: string]: unknown;
|
|
65
|
+
}>;
|
|
66
|
+
createLinkProps?: (target: RouterLinkTarget) => {
|
|
67
|
+
to: string;
|
|
68
|
+
[key: string]: unknown;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { disabledRscRuntime } from './rscDisabledRuntimeError.js';
|
|
2
|
+
export declare const createFromFetch: typeof disabledRscRuntime;
|
|
3
|
+
export declare const createFromReadableStream: typeof disabledRscRuntime;
|
|
4
|
+
export declare const createServerReference: typeof disabledRscRuntime;
|
|
5
|
+
export declare const createTemporaryReferenceSet: typeof disabledRscRuntime;
|
|
6
|
+
export declare const encodeReply: typeof disabledRscRuntime;
|
|
7
|
+
export declare const registerServerReference: typeof disabledRscRuntime;
|
|
8
|
+
export declare const setFindSourceMapURLCallback: typeof disabledRscRuntime;
|
|
9
|
+
export declare const setServerCallback: typeof disabledRscRuntime;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { disabledRscRuntime } from './rscDisabledRuntimeError.js';
|
|
2
|
+
export declare const createFromFetch: typeof disabledRscRuntime;
|
|
3
|
+
export declare const createFromReadableStream: typeof disabledRscRuntime;
|
|
4
|
+
export declare const createServerReference: typeof disabledRscRuntime;
|
|
5
|
+
export declare const createTemporaryReferenceSet: typeof disabledRscRuntime;
|
|
6
|
+
export declare const encodeReply: typeof disabledRscRuntime;
|
|
7
|
+
export declare const registerServerReference: typeof disabledRscRuntime;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { disabledRscRuntime } from './rscDisabledRuntimeError.js';
|
|
2
|
+
export declare const createFromFetch: typeof disabledRscRuntime;
|
|
3
|
+
export declare const createFromNodeStream: typeof disabledRscRuntime;
|
|
4
|
+
export declare const createFromReadableStream: typeof disabledRscRuntime;
|
|
5
|
+
export declare const createServerReference: typeof disabledRscRuntime;
|
|
6
|
+
export declare const createTemporaryReferenceSet: typeof disabledRscRuntime;
|
|
7
|
+
export declare const encodeReply: typeof disabledRscRuntime;
|
|
8
|
+
export declare const registerServerReference: typeof disabledRscRuntime;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function disabledRscRuntime(): never;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { disabledRscRuntime } from './rscDisabledRuntimeError.js';
|
|
2
|
+
export declare const createServerEntry: typeof disabledRscRuntime;
|
|
3
|
+
export declare const createTemporaryReferenceSet: typeof disabledRscRuntime;
|
|
4
|
+
export declare const decodeAction: typeof disabledRscRuntime;
|
|
5
|
+
export declare const decodeFormState: typeof disabledRscRuntime;
|
|
6
|
+
export declare const decodeReply: typeof disabledRscRuntime;
|
|
7
|
+
export declare const decodeReplyFromAsyncIterable: typeof disabledRscRuntime;
|
|
8
|
+
export declare const decryptServerActionBoundArgs: typeof disabledRscRuntime;
|
|
9
|
+
export declare const encryptServerActionBoundArgs: typeof disabledRscRuntime;
|
|
10
|
+
export declare const ensureServerActions: typeof disabledRscRuntime;
|
|
11
|
+
export declare const loadServerAction: typeof disabledRscRuntime;
|
|
12
|
+
export declare const registerClientReference: typeof disabledRscRuntime;
|
|
13
|
+
export declare const registerServerReference: typeof disabledRscRuntime;
|
|
14
|
+
export declare const renderToReadableStream: typeof disabledRscRuntime;
|
|
15
|
+
export declare const setServerActionBoundArgsEncryption: typeof disabledRscRuntime;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { disabledRscRuntime } from './rscDisabledRuntimeError.js';
|
|
2
|
+
export declare const createServerEntry: typeof disabledRscRuntime;
|
|
3
|
+
export declare const createTemporaryReferenceSet: typeof disabledRscRuntime;
|
|
4
|
+
export declare const decodeAction: typeof disabledRscRuntime;
|
|
5
|
+
export declare const decodeFormState: typeof disabledRscRuntime;
|
|
6
|
+
export declare const decodeReply: typeof disabledRscRuntime;
|
|
7
|
+
export declare const decodeReplyFromAsyncIterable: typeof disabledRscRuntime;
|
|
8
|
+
export declare const decodeReplyFromBusboy: typeof disabledRscRuntime;
|
|
9
|
+
export declare const decryptServerActionBoundArgs: typeof disabledRscRuntime;
|
|
10
|
+
export declare const encryptServerActionBoundArgs: typeof disabledRscRuntime;
|
|
11
|
+
export declare const ensureServerActions: typeof disabledRscRuntime;
|
|
12
|
+
export declare const loadServerAction: typeof disabledRscRuntime;
|
|
13
|
+
export declare const registerClientReference: typeof disabledRscRuntime;
|
|
14
|
+
export declare const registerServerReference: typeof disabledRscRuntime;
|
|
15
|
+
export declare const renderToPipeableStream: typeof disabledRscRuntime;
|
|
16
|
+
export declare const renderToReadableStream: typeof disabledRscRuntime;
|
|
17
|
+
export declare const setServerActionBoundArgsEncryption: typeof disabledRscRuntime;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
interface ProjectionContext {
|
|
2
|
+
isBrowser?: boolean;
|
|
3
|
+
ssrContext?: {
|
|
4
|
+
request: {
|
|
5
|
+
url?: unknown;
|
|
6
|
+
userAgent?: unknown;
|
|
7
|
+
cookie?: unknown;
|
|
8
|
+
pathname?: unknown;
|
|
9
|
+
query?: object;
|
|
10
|
+
params?: object;
|
|
11
|
+
headers?: object;
|
|
12
|
+
host?: unknown;
|
|
13
|
+
referer?: unknown;
|
|
14
|
+
};
|
|
15
|
+
response: {
|
|
16
|
+
locals?: unknown;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export declare function projectRuntimeContext<InternalContext extends ProjectionContext, PublicContext extends ProjectionContext>(projection: {
|
|
21
|
+
internalContext: InternalContext;
|
|
22
|
+
publicContext: PublicContext;
|
|
23
|
+
}, options: {
|
|
24
|
+
context: InternalContext;
|
|
25
|
+
isRsc: boolean;
|
|
26
|
+
}): {
|
|
27
|
+
internalContext: InternalContext;
|
|
28
|
+
publicContext: PublicContext;
|
|
29
|
+
};
|
|
30
|
+
export {};
|