@ankhorage/runtime 5.0.7 → 5.1.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/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/ManifestContext.d.ts +7 -3
- package/dist/ManifestContext.d.ts.map +1 -1
- package/dist/ManifestContext.js +9 -2
- package/dist/ManifestContext.js.map +1 -1
- package/dist/RuntimeRenderer.d.ts.map +1 -1
- package/dist/RuntimeRenderer.js +36 -26
- package/dist/RuntimeRenderer.js.map +1 -1
- package/dist/RuntimeScreen.d.ts.map +1 -1
- package/dist/RuntimeScreen.js +6 -3
- package/dist/RuntimeScreen.js.map +1 -1
- package/dist/capabilities/index.d.ts +47 -0
- package/dist/capabilities/index.d.ts.map +1 -1
- package/dist/capabilities/index.js +34 -0
- package/dist/capabilities/index.js.map +1 -1
- package/dist/runtimeCapabilityExecutor.d.ts +3 -1
- package/dist/runtimeCapabilityExecutor.d.ts.map +1 -1
- package/dist/runtimeCapabilityExecutor.js +91 -2
- package/dist/runtimeCapabilityExecutor.js.map +1 -1
- package/dist/runtimeStateAdapter.d.ts.map +1 -1
- package/dist/runtimeStateAdapter.js +25 -13
- package/dist/runtimeStateAdapter.js.map +1 -1
- package/dist/useRuntimeStateBindings.d.ts +9 -0
- package/dist/useRuntimeStateBindings.d.ts.map +1 -0
- package/dist/useRuntimeStateBindings.js +50 -0
- package/dist/useRuntimeStateBindings.js.map +1 -0
- package/package.json +69 -2
- package/paradox/badges/npm.svg +3 -3
- package/paradox/components.md +8 -5
- package/paradox/diagrams/architecture-overview.mmd +13 -0
- package/paradox/diagrams/export-graph.mmd +2 -0
- package/paradox/diagrams/module-relationships.mmd +11 -0
- package/paradox/diagrams/sequences/runtime-screen.mmd +5 -0
- package/paradox/exports.json +25 -18
- package/paradox/exports.md +23 -14
- package/paradox/index.html +259 -92
- package/paradox/paradox.json +534 -99
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ankhorage/runtime
|
|
2
2
|
|
|
3
|
+
## 5.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f89a595: Update dependencies: `@ankhorage/contracts`.
|
|
8
|
+
|
|
9
|
+
## 5.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 37c56b0: Add the canonical `state.set` binding capability with shared in-memory state ownership and reactive state-backed presentation bindings.
|
|
14
|
+
|
|
3
15
|
## 5.0.7
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
# @ankhorage/runtime
|
|
5
5
|
|
|
6
|
-
         
|
|
7
7
|
|
|
8
8
|
Platform-neutral runtime renderer, contracts, and helpers for Ankhorage generated apps.
|
|
9
9
|
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
import type { AppManifest } from '@ankhorage/contracts';
|
|
1
|
+
import type { AppManifest, StateAdapter } from '@ankhorage/contracts';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
interface ManifestContextValue {
|
|
3
|
+
export interface ManifestContextValue {
|
|
4
4
|
manifest: AppManifest;
|
|
5
5
|
activeScreenId?: string;
|
|
6
6
|
onScreenChange?: (screenId: string) => void;
|
|
7
|
+
stateAdapter?: StateAdapter;
|
|
7
8
|
}
|
|
8
9
|
export declare const ManifestContext: React.Context<ManifestContextValue | null>;
|
|
10
|
+
/*** Owns one configured state adapter for every Runtime screen in an application tree. */
|
|
9
11
|
export declare function ManifestProvider(props: ManifestContextValue & {
|
|
10
12
|
children: React.ReactNode;
|
|
11
13
|
}): React.JSX.Element;
|
|
14
|
+
/*** Returns the active application manifest from the owning Runtime provider. */
|
|
12
15
|
export declare function useManifest(): AppManifest;
|
|
16
|
+
/*** Returns the active manifest scope, including its application-lifetime state adapter. */
|
|
13
17
|
export declare function useManifestContext(): ManifestContextValue;
|
|
18
|
+
/*** Reads an enclosing manifest scope without requiring hosts to provide one. */
|
|
14
19
|
export declare function useOptionalManifestContext(): ManifestContextValue | null;
|
|
15
|
-
export {};
|
|
16
20
|
//# sourceMappingURL=ManifestContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManifestContext.d.ts","sourceRoot":"","sources":["../src/ManifestContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"ManifestContext.d.ts","sourceRoot":"","sources":["../src/ManifestContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAA6B,MAAM,OAAO,CAAC;AAIlD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,WAAW,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED,eAAO,MAAM,eAAe,4CAAmD,CAAC;AAEhF,0FAA0F;AAC1F,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,oBAAoB,GAAG;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,qBAmB3F;AAED,iFAAiF;AACjF,wBAAgB,WAAW,gBAM1B;AAED,4FAA4F;AAC5F,wBAAgB,kBAAkB,yBAMjC;AAED,iFAAiF;AACjF,wBAAgB,0BAA0B,gCAEzC"}
|
package/dist/ManifestContext.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import React, { createContext, use } from 'react';
|
|
2
|
+
import { createRuntimeMemoryStateAdapter } from './runtimeStateAdapter';
|
|
2
3
|
export const ManifestContext = createContext(null);
|
|
4
|
+
/*** Owns one configured state adapter for every Runtime screen in an application tree. */
|
|
3
5
|
export function ManifestProvider(props) {
|
|
4
|
-
const { manifest, activeScreenId, onScreenChange, children } = props;
|
|
5
|
-
|
|
6
|
+
const { manifest, activeScreenId, onScreenChange, stateAdapter: injectedStateAdapter, children, } = props;
|
|
7
|
+
const fallbackStateAdapter = React.useMemo(() => (manifest.state?.provider === 'legend' ? createRuntimeMemoryStateAdapter() : undefined), [manifest.state?.provider]);
|
|
8
|
+
const stateAdapter = injectedStateAdapter ?? fallbackStateAdapter;
|
|
9
|
+
return (<ManifestContext value={{ manifest, activeScreenId, onScreenChange, stateAdapter }}>
|
|
6
10
|
{children}
|
|
7
11
|
</ManifestContext>);
|
|
8
12
|
}
|
|
13
|
+
/*** Returns the active application manifest from the owning Runtime provider. */
|
|
9
14
|
export function useManifest() {
|
|
10
15
|
const context = use(ManifestContext);
|
|
11
16
|
if (!context) {
|
|
@@ -13,6 +18,7 @@ export function useManifest() {
|
|
|
13
18
|
}
|
|
14
19
|
return context.manifest;
|
|
15
20
|
}
|
|
21
|
+
/*** Returns the active manifest scope, including its application-lifetime state adapter. */
|
|
16
22
|
export function useManifestContext() {
|
|
17
23
|
const context = use(ManifestContext);
|
|
18
24
|
if (!context) {
|
|
@@ -20,6 +26,7 @@ export function useManifestContext() {
|
|
|
20
26
|
}
|
|
21
27
|
return context;
|
|
22
28
|
}
|
|
29
|
+
/*** Reads an enclosing manifest scope without requiring hosts to provide one. */
|
|
23
30
|
export function useOptionalManifestContext() {
|
|
24
31
|
return use(ManifestContext);
|
|
25
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManifestContext.js","sourceRoot":"","sources":["../src/ManifestContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ManifestContext.js","sourceRoot":"","sources":["../src/ManifestContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,aAAa,EAA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/E,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,0BAA0B;IACxC,OAAO,GAAG,CAAC,eAAe,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["import type { AppManifest, StateAdapter } from '@ankhorage/contracts';\nimport React, { createContext, use } from 'react';\n\nimport { createRuntimeMemoryStateAdapter } from './runtimeStateAdapter';\n\nexport interface ManifestContextValue {\n manifest: AppManifest;\n activeScreenId?: string;\n onScreenChange?: (screenId: string) => void;\n stateAdapter?: StateAdapter;\n}\n\nexport const ManifestContext = createContext<ManifestContextValue | null>(null);\n\n/*** Owns one configured state adapter for every Runtime screen in an application tree. */\nexport function ManifestProvider(props: ManifestContextValue & { children: React.ReactNode }) {\n const {\n manifest,\n activeScreenId,\n onScreenChange,\n stateAdapter: injectedStateAdapter,\n children,\n } = props;\n const fallbackStateAdapter = React.useMemo(\n () => (manifest.state?.provider === 'legend' ? createRuntimeMemoryStateAdapter() : undefined),\n [manifest.state?.provider],\n );\n const stateAdapter = injectedStateAdapter ?? fallbackStateAdapter;\n\n return (\n <ManifestContext value={{ manifest, activeScreenId, onScreenChange, stateAdapter }}>\n {children}\n </ManifestContext>\n );\n}\n\n/*** Returns the active application manifest from the owning Runtime provider. */\nexport function useManifest() {\n const context = use(ManifestContext);\n if (!context) {\n throw new Error('useManifest must be used within a ManifestProvider');\n }\n return context.manifest;\n}\n\n/*** Returns the active manifest scope, including its application-lifetime state adapter. */\nexport function useManifestContext() {\n const context = use(ManifestContext);\n if (!context) {\n throw new Error('useManifestContext must be used within a ManifestProvider');\n }\n return context;\n}\n\n/*** Reads an enclosing manifest scope without requiring hosts to provide one. */\nexport function useOptionalManifestContext() {\n return use(ManifestContext);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuntimeRenderer.d.ts","sourceRoot":"","sources":["../src/RuntimeRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,4BAA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AAE,CAAC,IAAI,EAAE,uBAAuB,KAAK,KAAK,CAAC,SAAS,CAAC;IAC9D,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,YAAY,CAAC,EAAE,4BAA4B,CAAC;IAC5C,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,iBAAiB,CAAC,EAAE,yBAAyB,CAAC;IAC9C,WAAW,CAAC,EAAE,yBAAyB,CAAC;IACxC,iBAAiB,CAAC,EAAE,yBAAyB,CAAC;IAC9C,sBAAsB,CAAC,EAAE,8BAA8B,CAAC;IACxD,aAAa,CAAC,EAAE,CAAC,WAAW,EAAE,SAAS,oBAAoB,EAAE,KAAK,IAAI,CAAC;CACxE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,qBA6V1D"}
|
package/dist/RuntimeRenderer.js
CHANGED
|
@@ -11,6 +11,7 @@ import { createRuntimeRepeatBindingContext, resolveRuntimeRepeatItemKey, resolve
|
|
|
11
11
|
import { createRepeatDiagnosticsKey } from './runtimeRepeatDiagnostics';
|
|
12
12
|
import { shouldRenderRuntimeRepeatEmptyState } from './runtimeRepeatEmptyState';
|
|
13
13
|
import { useRuntimeMediaProps } from './useRuntimeMediaProps';
|
|
14
|
+
import { useRuntimeStateBindings } from './useRuntimeStateBindings';
|
|
14
15
|
export function RuntimeRenderer(props) {
|
|
15
16
|
const { node, isRoot = false, registry, disableActions = false, wrapNode, dbAdapter, dbRealtimeAdapter, stateAdapter, bindingContext, dataBindings, mediaAssets, resolveMediaAsset, resultSlots, executeCapability, resolveEventCapability, onDiagnostics, } = props;
|
|
16
17
|
const inheritedConfig = useRuntimeRendererConfig();
|
|
@@ -20,9 +21,9 @@ export function RuntimeRenderer(props) {
|
|
|
20
21
|
? rootEventOperationState
|
|
21
22
|
: inheritedConfig.eventOperationState;
|
|
22
23
|
const rootBindingContext = React.useMemo(() => mergeRuntimeRendererConfig({ bindingContext }, { bindingContext: inheritedConfig.bindingContext }).bindingContext, [bindingContext, inheritedConfig.bindingContext]);
|
|
23
|
-
const effectiveBindingContext = isRoot && eventOperationState !== undefined
|
|
24
|
+
const effectiveBindingContext = React.useMemo(() => isRoot && eventOperationState !== undefined
|
|
24
25
|
? createRuntimeEventOperationBindingContext(rootBindingContext, eventOperationState)
|
|
25
|
-
: bindingContext;
|
|
26
|
+
: bindingContext, [bindingContext, eventOperationState, isRoot, rootBindingContext]);
|
|
26
27
|
const mediaResolutionCache = useRuntimeMediaResolutionCache();
|
|
27
28
|
const inheritedResultSlots = inheritedConfig.resultSlots;
|
|
28
29
|
const [localResultSlots, setLocalResultSlots] = React.useState({});
|
|
@@ -80,6 +81,12 @@ export function RuntimeRenderer(props) {
|
|
|
80
81
|
rootEventOperationLifecycle,
|
|
81
82
|
]);
|
|
82
83
|
const effectiveConfig = React.useMemo(() => mergeRuntimeRendererConfig(explicitConfig, inheritedConfig), [explicitConfig, inheritedConfig]);
|
|
84
|
+
useRuntimeStateBindings({
|
|
85
|
+
dataBindings: effectiveConfig.dataBindings,
|
|
86
|
+
nodeId: node.id,
|
|
87
|
+
repeatSource: node.repeat?.source,
|
|
88
|
+
stateAdapter: effectiveConfig.stateAdapter,
|
|
89
|
+
});
|
|
83
90
|
const dispatchRuntimeEvent = React.useCallback(async (eventArgs) => {
|
|
84
91
|
await dispatchRuntimeComponentEventWithReporting({
|
|
85
92
|
...eventArgs,
|
|
@@ -96,7 +103,7 @@ export function RuntimeRenderer(props) {
|
|
|
96
103
|
configRegistry: effectiveConfig.registry,
|
|
97
104
|
}), [effectiveConfig.registry, registry]);
|
|
98
105
|
const Component = effectiveRegistry[node.type];
|
|
99
|
-
const repeatSyncResult =
|
|
106
|
+
const repeatSyncResult = (() => {
|
|
100
107
|
const { repeat } = node;
|
|
101
108
|
if (!repeat) {
|
|
102
109
|
return null;
|
|
@@ -110,35 +117,47 @@ export function RuntimeRenderer(props) {
|
|
|
110
117
|
stateAdapter: effectiveConfig.stateAdapter,
|
|
111
118
|
writeResultSlot: effectiveConfig.writeResultSlot,
|
|
112
119
|
});
|
|
113
|
-
}
|
|
120
|
+
})();
|
|
121
|
+
const repeatRequest = React.useMemo(() => node.repeat && repeatSyncResult?.status === 'pending'
|
|
122
|
+
? {
|
|
123
|
+
context: effectiveConfig.bindingContext,
|
|
124
|
+
dataBindings: effectiveConfig.dataBindings,
|
|
125
|
+
executeCapability: effectiveConfig.executeCapability,
|
|
126
|
+
node,
|
|
127
|
+
repeat: node.repeat,
|
|
128
|
+
resultSlots: effectiveConfig.resultSlots,
|
|
129
|
+
stateAdapter: effectiveConfig.stateAdapter,
|
|
130
|
+
writeResultSlot: effectiveConfig.writeResultSlot,
|
|
131
|
+
}
|
|
132
|
+
: null, [
|
|
133
|
+
node,
|
|
134
|
+
repeatSyncResult?.status,
|
|
114
135
|
effectiveConfig.bindingContext,
|
|
115
136
|
effectiveConfig.dataBindings,
|
|
116
137
|
effectiveConfig.executeCapability,
|
|
117
138
|
effectiveConfig.resultSlots,
|
|
118
139
|
effectiveConfig.stateAdapter,
|
|
119
140
|
effectiveConfig.writeResultSlot,
|
|
120
|
-
node,
|
|
121
141
|
]);
|
|
122
|
-
const repeatRequestToken = React.useMemo(() => (
|
|
142
|
+
const repeatRequestToken = React.useMemo(() => (repeatRequest ? {} : null), [repeatRequest]);
|
|
123
143
|
const [asyncRepeatResult, setAsyncRepeatResult] = React.useState(null);
|
|
124
144
|
const repeatRequestIdRef = React.useRef(0);
|
|
125
145
|
const lastRepeatDiagnosticsKeyRef = React.useRef(null);
|
|
126
146
|
React.useEffect(() => {
|
|
127
147
|
repeatRequestIdRef.current += 1;
|
|
128
148
|
const requestId = repeatRequestIdRef.current;
|
|
129
|
-
|
|
130
|
-
if (!repeat || repeatRequestToken === null) {
|
|
149
|
+
if (repeatRequest === null || repeatRequestToken === null) {
|
|
131
150
|
return undefined;
|
|
132
151
|
}
|
|
133
152
|
void (async () => {
|
|
134
|
-
const result = await resolveRuntimeRepeatItemsAsync(repeat, {
|
|
135
|
-
context:
|
|
136
|
-
dataBindings:
|
|
137
|
-
executeCapability:
|
|
138
|
-
node,
|
|
139
|
-
resultSlots:
|
|
140
|
-
stateAdapter:
|
|
141
|
-
writeResultSlot:
|
|
153
|
+
const result = await resolveRuntimeRepeatItemsAsync(repeatRequest.repeat, {
|
|
154
|
+
context: repeatRequest.context,
|
|
155
|
+
dataBindings: repeatRequest.dataBindings,
|
|
156
|
+
executeCapability: repeatRequest.executeCapability,
|
|
157
|
+
node: repeatRequest.node,
|
|
158
|
+
resultSlots: repeatRequest.resultSlots,
|
|
159
|
+
stateAdapter: repeatRequest.stateAdapter,
|
|
160
|
+
writeResultSlot: repeatRequest.writeResultSlot,
|
|
142
161
|
});
|
|
143
162
|
if (repeatRequestIdRef.current !== requestId) {
|
|
144
163
|
return;
|
|
@@ -148,16 +167,7 @@ export function RuntimeRenderer(props) {
|
|
|
148
167
|
return () => {
|
|
149
168
|
repeatRequestIdRef.current += 1;
|
|
150
169
|
};
|
|
151
|
-
}, [
|
|
152
|
-
effectiveConfig.bindingContext,
|
|
153
|
-
effectiveConfig.dataBindings,
|
|
154
|
-
effectiveConfig.executeCapability,
|
|
155
|
-
effectiveConfig.resultSlots,
|
|
156
|
-
effectiveConfig.stateAdapter,
|
|
157
|
-
effectiveConfig.writeResultSlot,
|
|
158
|
-
node,
|
|
159
|
-
repeatRequestToken,
|
|
160
|
-
]);
|
|
170
|
+
}, [repeatRequest, repeatRequestToken]);
|
|
161
171
|
const currentAsyncRepeatResult = asyncRepeatResult?.requestToken === repeatRequestToken ? asyncRepeatResult : null;
|
|
162
172
|
const repeatDiagnostics = repeatSyncResult?.status === 'ready'
|
|
163
173
|
? repeatSyncResult.diagnostics
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuntimeRender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,iBAAiB,CAAC,EAAE,SAAS,CAAC,CAAC;IAC/F,IAAI,eAAe,CAAC,QAAQ,EAAE,CAAC;QAC7B,OAAO,GAAG,eAAe,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,OAAO,CACL,CAAC,mCAAmC,CAAC,KAAK,CAAC,CAAC,oBAAoB,CAAC,CAC/D;MAAA,CAAC,6BAA6B,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,CACnD;QAAA,CAAC,OAAO,CACV;MAAA,EAAE,6BAA6B,CACjC;IAAA,EAAE,mCAAmC,CAAC,CACvC,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,QAAQ,EAAE;QACR,WAAW,EAAE,SAAS;QACtB,YAAY,EAAE,CAAC;QACf,WAAW,EAAE,CAAC;QACd,MAAM,EAAE,CAAC;QACT,OAAO,EAAE,CAAC;KACX;IACD,UAAU,EAAE;QACV,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,YAAY,EAAE,CAAC;KAChB;IACD,SAAS,EAAE;QACT,KAAK,EAAE,SAAS;QAChB,UAAU,EAAE,KAAK;KAClB;IACD,SAAS,EAAE;QACT,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,CAAC;KACb;CACF,CAAC,CAAC","sourcesContent":["import type {\n BindingValue,\n ComponentDataBindingRegistry,\n DataSourceDiagnostic,\n DbAdapter,\n DbRealtimeAdapter,\n MediaAssetRegistry,\n StateAdapter,\n UiNode,\n} from '@ankhorage/contracts';\nimport React from 'react';\nimport { StyleSheet, Text, View } from 'react-native';\n\nimport type { ComponentRegistry } from './registry';\nimport {\n getUnknownComponentDiagnostic,\n resolveRenderedChildren,\n resolveRuntimeRegistry,\n} from './rendering';\nimport {\n type RuntimeComponentEventDispatchArgs,\n type RuntimeEventCapabilityResolver,\n wrapRuntimeEventProps,\n} from './runtimeActionRegistry';\nimport type { RuntimeBindingResultCache, RuntimeCapabilityExecutor } from './runtimeBindings';\nimport { dispatchRuntimeComponentEventWithReporting } from './runtimeEventExecution';\nimport {\n createRuntimeEventOperationBindingContext,\n createRuntimeEventOperationLifecycle,\n IDLE_RUNTIME_EVENT_OPERATION_STATE,\n} from './runtimeEventOperationLifecycle';\nimport type { RuntimeMediaAssetResolver } from './runtimeMedia';\nimport {\n RuntimeMediaResolutionCacheProvider,\n useRuntimeMediaResolutionCache,\n} from './runtimeMediaCache';\nimport { resolveRuntimeNodeProps } from './runtimeNodeProps';\nimport {\n mergeRuntimeRendererConfig,\n RuntimeRendererConfigProvider,\n type RuntimeRendererWrapArgs,\n useRuntimeRendererConfig,\n} from './RuntimeRendererConfig';\nimport {\n createRuntimeRepeatBindingContext,\n resolveRuntimeRepeatItemKey,\n resolveRuntimeRepeatItemsAsync,\n resolveRuntimeRepeatItemsSync,\n} from './runtimeRepeat';\nimport { createRepeatDiagnosticsKey } from './runtimeRepeatDiagnostics';\nimport { shouldRenderRuntimeRepeatEmptyState } from './runtimeRepeatEmptyState';\nimport { useRuntimeMediaProps } from './useRuntimeMediaProps';\n\nexport interface RuntimeRendererProps {\n node: UiNode;\n isRoot?: boolean;\n registry?: ComponentRegistry;\n disableActions?: boolean;\n wrapNode?: (args: RuntimeRendererWrapArgs) => React.ReactNode;\n dbAdapter?: DbAdapter;\n dbRealtimeAdapter?: DbRealtimeAdapter;\n stateAdapter?: StateAdapter;\n bindingContext?: Record<string, unknown>;\n dataBindings?: ComponentDataBindingRegistry;\n mediaAssets?: MediaAssetRegistry;\n resolveMediaAsset?: RuntimeMediaAssetResolver;\n resultSlots?: RuntimeBindingResultCache;\n executeCapability?: RuntimeCapabilityExecutor;\n resolveEventCapability?: RuntimeEventCapabilityResolver;\n onDiagnostics?: (diagnostics: readonly DataSourceDiagnostic[]) => void;\n}\n\nexport function RuntimeRenderer(props: RuntimeRendererProps) {\n const {\n node,\n isRoot = false,\n registry,\n disableActions = false,\n wrapNode,\n dbAdapter,\n dbRealtimeAdapter,\n stateAdapter,\n bindingContext,\n dataBindings,\n mediaAssets,\n resolveMediaAsset,\n resultSlots,\n executeCapability,\n resolveEventCapability,\n onDiagnostics,\n } = props;\n const inheritedConfig = useRuntimeRendererConfig();\n const [rootEventOperationState, setRootEventOperationState] = React.useState(\n IDLE_RUNTIME_EVENT_OPERATION_STATE,\n );\n const rootEventOperationLifecycle = React.useMemo(\n () => createRuntimeEventOperationLifecycle(setRootEventOperationState),\n [],\n );\n const eventOperationState = isRoot\n ? rootEventOperationState\n : inheritedConfig.eventOperationState;\n const rootBindingContext = React.useMemo(\n () =>\n mergeRuntimeRendererConfig(\n { bindingContext },\n { bindingContext: inheritedConfig.bindingContext },\n ).bindingContext,\n [bindingContext, inheritedConfig.bindingContext],\n );\n const effectiveBindingContext =\n isRoot && eventOperationState !== undefined\n ? createRuntimeEventOperationBindingContext(rootBindingContext, eventOperationState)\n : bindingContext;\n const mediaResolutionCache = useRuntimeMediaResolutionCache();\n const inheritedResultSlots = inheritedConfig.resultSlots;\n const [localResultSlots, setLocalResultSlots] = React.useState<RuntimeBindingResultCache>({});\n const writeLocalResultSlot = React.useCallback((key: string, value: BindingValue) => {\n setLocalResultSlots((currentResults) => ({\n ...currentResults,\n [key]: value,\n }));\n }, []);\n const effectiveResultSlots = React.useMemo(\n () => ({\n ...(inheritedResultSlots ?? {}),\n ...(resultSlots ?? {}),\n ...localResultSlots,\n }),\n [inheritedResultSlots, localResultSlots, resultSlots],\n );\n const explicitConfig = React.useMemo(\n () => ({\n bindingContext: effectiveBindingContext,\n dataBindings,\n dbAdapter,\n dbRealtimeAdapter,\n disableActions,\n executeCapability,\n resolveEventCapability,\n mediaAssets,\n resultSlots: effectiveResultSlots,\n onDiagnostics,\n registry,\n resolveMediaAsset,\n stateAdapter,\n wrapNode,\n writeResultSlot: inheritedConfig.writeResultSlot ?? writeLocalResultSlot,\n eventOperationLifecycle: isRoot\n ? rootEventOperationLifecycle\n : inheritedConfig.eventOperationLifecycle,\n eventOperationState,\n }),\n [\n effectiveBindingContext,\n dataBindings,\n dbAdapter,\n dbRealtimeAdapter,\n disableActions,\n executeCapability,\n resolveEventCapability,\n effectiveResultSlots,\n inheritedConfig.writeResultSlot,\n inheritedConfig.eventOperationLifecycle,\n isRoot,\n mediaAssets,\n onDiagnostics,\n registry,\n resolveMediaAsset,\n stateAdapter,\n wrapNode,\n writeLocalResultSlot,\n eventOperationState,\n rootEventOperationLifecycle,\n ],\n );\n const effectiveConfig = React.useMemo(\n () => mergeRuntimeRendererConfig(explicitConfig, inheritedConfig),\n [explicitConfig, inheritedConfig],\n );\n const dispatchRuntimeEvent = React.useCallback(\n async (eventArgs: RuntimeComponentEventDispatchArgs) => {\n await dispatchRuntimeComponentEventWithReporting({\n ...eventArgs,\n dataBindings: eventArgs.dataBindings ?? effectiveConfig.dataBindings,\n executeCapability: eventArgs.executeCapability ?? effectiveConfig.executeCapability,\n onDiagnostics: effectiveConfig.onDiagnostics,\n resultSlots: eventArgs.resultSlots ?? effectiveConfig.resultSlots,\n writeResultSlot: eventArgs.writeResultSlot ?? effectiveConfig.writeResultSlot,\n eventOperationLifecycle:\n eventArgs.eventOperationLifecycle ?? effectiveConfig.eventOperationLifecycle,\n });\n },\n [effectiveConfig],\n );\n const effectiveRegistry = React.useMemo(\n () =>\n resolveRuntimeRegistry({\n propRegistry: registry,\n configRegistry: effectiveConfig.registry,\n }),\n [effectiveConfig.registry, registry],\n );\n const Component = effectiveRegistry[node.type];\n\n const repeatSyncResult = React.useMemo(() => {\n const { repeat } = node;\n if (!repeat) {\n return null;\n }\n\n return resolveRuntimeRepeatItemsSync(repeat, {\n context: effectiveConfig.bindingContext,\n dataBindings: effectiveConfig.dataBindings,\n executeCapability: effectiveConfig.executeCapability,\n node,\n resultSlots: effectiveConfig.resultSlots,\n stateAdapter: effectiveConfig.stateAdapter,\n writeResultSlot: effectiveConfig.writeResultSlot,\n });\n }, [\n effectiveConfig.bindingContext,\n effectiveConfig.dataBindings,\n effectiveConfig.executeCapability,\n effectiveConfig.resultSlots,\n effectiveConfig.stateAdapter,\n effectiveConfig.writeResultSlot,\n node,\n ]);\n const repeatRequestToken = React.useMemo(\n () => (node.repeat && repeatSyncResult?.status === 'pending' ? {} : null),\n [node.repeat, repeatSyncResult],\n );\n const [asyncRepeatResult, setAsyncRepeatResult] = React.useState<{\n readonly requestToken: object;\n readonly items: readonly BindingValue[];\n readonly diagnostics: readonly DataSourceDiagnostic[];\n } | null>(null);\n const repeatRequestIdRef = React.useRef(0);\n const lastRepeatDiagnosticsKeyRef = React.useRef<string | null>(null);\n\n React.useEffect(() => {\n repeatRequestIdRef.current += 1;\n const requestId = repeatRequestIdRef.current;\n const { repeat } = node;\n\n if (!repeat || repeatRequestToken === null) {\n return undefined;\n }\n\n void (async () => {\n const result = await resolveRuntimeRepeatItemsAsync(repeat, {\n context: effectiveConfig.bindingContext,\n dataBindings: effectiveConfig.dataBindings,\n executeCapability: effectiveConfig.executeCapability,\n node,\n resultSlots: effectiveConfig.resultSlots,\n stateAdapter: effectiveConfig.stateAdapter,\n writeResultSlot: effectiveConfig.writeResultSlot,\n });\n\n if (repeatRequestIdRef.current !== requestId) {\n return;\n }\n\n setAsyncRepeatResult({ ...result, requestToken: repeatRequestToken });\n })();\n\n return () => {\n repeatRequestIdRef.current += 1;\n };\n }, [\n effectiveConfig.bindingContext,\n effectiveConfig.dataBindings,\n effectiveConfig.executeCapability,\n effectiveConfig.resultSlots,\n effectiveConfig.stateAdapter,\n effectiveConfig.writeResultSlot,\n node,\n repeatRequestToken,\n ]);\n const currentAsyncRepeatResult =\n asyncRepeatResult?.requestToken === repeatRequestToken ? asyncRepeatResult : null;\n const repeatDiagnostics =\n repeatSyncResult?.status === 'ready'\n ? repeatSyncResult.diagnostics\n : currentAsyncRepeatResult?.diagnostics;\n\n React.useEffect(() => {\n if (!node.repeat || repeatDiagnostics === undefined) {\n return;\n }\n\n const diagnosticsKey = createRepeatDiagnosticsKey(node.id, repeatDiagnostics);\n if (lastRepeatDiagnosticsKeyRef.current === diagnosticsKey) {\n return;\n }\n\n lastRepeatDiagnosticsKeyRef.current = diagnosticsKey;\n effectiveConfig.onDiagnostics?.(repeatDiagnostics);\n }, [effectiveConfig, node, repeatDiagnostics]);\n\n const bindingResolvedProps = resolveRuntimeNodeProps({\n bindingContext: effectiveConfig.bindingContext,\n dataBindings: effectiveConfig.dataBindings,\n dbAdapter: effectiveConfig.dbAdapter,\n dbRealtimeAdapter: effectiveConfig.dbRealtimeAdapter,\n node,\n resultSlots: effectiveConfig.resultSlots,\n stateAdapter: effectiveConfig.stateAdapter,\n });\n const mediaResolvedProps = useRuntimeMediaProps({\n cache: mediaResolutionCache,\n mediaAssets: effectiveConfig.mediaAssets,\n props: bindingResolvedProps,\n resolveMediaAsset: effectiveConfig.resolveMediaAsset,\n });\n const resolvedProps = effectiveConfig.resolveNodeProps\n ? effectiveConfig.resolveNodeProps({ node, props: mediaResolvedProps })\n : mediaResolvedProps;\n\n if (!Component) {\n const diagnostic = getUnknownComponentDiagnostic(node.type, effectiveRegistry);\n return (\n <View style={styles.errorBox}>\n <Text style={styles.errorTitle}>{diagnostic.title}</Text>\n <Text style={styles.errorText}>{diagnostic.suggestion}</Text>\n <Text style={styles.errorMeta}>{diagnostic.detail}</Text>\n </View>\n );\n }\n\n const repeatItems =\n repeatSyncResult?.status === 'ready' ? repeatSyncResult.items : currentAsyncRepeatResult?.items;\n const shouldRenderRepeatEmptyState = shouldRenderRuntimeRepeatEmptyState({\n diagnostics: repeatDiagnostics,\n items: repeatItems,\n status:\n repeatSyncResult?.status === 'ready'\n ? 'ready'\n : repeatSyncResult?.status === 'pending'\n ? 'pending'\n : currentAsyncRepeatResult\n ? 'ready'\n : undefined,\n });\n const renderedChildren = node.repeat\n ? repeatItems && repeatItems.length > 0\n ? repeatItems.flatMap((item, itemIndex) =>\n (node.children ?? []).map((child) => {\n const itemAlias = node.repeat?.itemAlias ?? 'item';\n const repeatKey = resolveRuntimeRepeatItemKey({\n item,\n itemAlias,\n index: itemIndex,\n keyPath: node.repeat?.keyPath,\n });\n\n return (\n <RuntimeRenderer\n key={`${child.id}:${String(repeatKey)}`}\n node={child}\n registry={effectiveRegistry}\n bindingContext={createRuntimeRepeatBindingContext({\n baseContext: effectiveConfig.bindingContext,\n item,\n itemAlias,\n })}\n />\n );\n }),\n )\n : shouldRenderRepeatEmptyState\n ? node.repeat.empty?.map((child) => (\n <RuntimeRenderer key={child.id} node={child} registry={effectiveRegistry} />\n ))\n : undefined\n : node.children?.map((child) => (\n <RuntimeRenderer key={child.id} node={child} registry={effectiveRegistry} />\n ));\n\n const propsWithEvents = wrapRuntimeEventProps({\n context: effectiveConfig.bindingContext,\n dataBindings: effectiveConfig.dataBindings,\n props: resolvedProps,\n disableActions: effectiveConfig.disableActions === true,\n dispatchComponentEvent: dispatchRuntimeEvent,\n node,\n resultSlots: effectiveConfig.resultSlots,\n resolveEventCapability: effectiveConfig.resolveEventCapability,\n });\n\n const componentChildren = resolveRenderedChildren({\n propChildren: propsWithEvents.children as React.ReactNode,\n renderedChildren,\n });\n\n let content: React.ReactNode = <Component {...propsWithEvents}>{componentChildren}</Component>;\n if (effectiveConfig.wrapNode) {\n content = effectiveConfig.wrapNode({ node, rendered: content, isRoot });\n }\n\n return (\n <RuntimeMediaResolutionCacheProvider value={mediaResolutionCache}>\n <RuntimeRendererConfigProvider value={explicitConfig}>\n {content}\n </RuntimeRendererConfigProvider>\n </RuntimeMediaResolutionCacheProvider>\n );\n}\n\nconst styles = StyleSheet.create({\n errorBox: {\n borderColor: '#ef4444',\n borderRadius: 8,\n borderWidth: 1,\n margin: 8,\n padding: 8,\n },\n errorTitle: {\n color: '#991b1b',\n fontSize: 13,\n fontWeight: '700',\n marginBottom: 4,\n },\n errorText: {\n color: '#ef4444',\n fontWeight: '600',\n },\n errorMeta: {\n color: '#7f1d1d',\n fontSize: 12,\n marginTop: 4,\n },\n});\n"]}
|
|
1
|
+
{"version":3,"file":"RuntimeRenderer.js","sourceRoot":"","sources":["../src/RuntimeRenderer.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGtD,OAAO,EACL,6BAA6B,EAC7B,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAGL,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,0CAA0C,EAAE,MAAM,yBAAyB,CAAC;AACrF,OAAO,EACL,yCAAyC,EACzC,oCAAoC,EACpC,kCAAkC,GACnC,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACL,mCAAmC,EACnC,8BAA8B,GAC/B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,EAE7B,wBAAwB,GACzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,iCAAiC,EACjC,2BAA2B,EAC3B,8BAA8B,EAC9B,6BAA6B,GAC9B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,mCAAmC,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAqBpE,MAAM,UAAU,eAAe,CAAC,KAA2B;IACzD,MAAM,EACJ,IAAI,EACJ,MAAM,GAAG,KAAK,EACd,QAAQ,EACR,cAAc,GAAG,KAAK,EACtB,QAAQ,EACR,SAAS,EACT,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,YAAY,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AAC;QACf,WAAW,EAAE,CAAC;QACd,MAAM,EAAE,CAAC;QACT,OAAO,EAAE,CAAC;KACX;IACD,UAAU,EAAE;QACV,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,YAAY,EAAE,CAAC;KAChB;IACD,SAAS,EAAE;QACT,KAAK,EAAE,SAAS;QAChB,UAAU,EAAE,KAAK;KAClB;IACD,SAAS,EAAE;QACT,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,CAAC;KACb;CACF,CAAC,CAAC","sourcesContent":["import type {\n BindingValue,\n ComponentDataBindingRegistry,\n DataSourceDiagnostic,\n DbAdapter,\n DbRealtimeAdapter,\n MediaAssetRegistry,\n StateAdapter,\n UiNode,\n} from '@ankhorage/contracts';\nimport React from 'react';\nimport { StyleSheet, Text, View } from 'react-native';\n\nimport type { ComponentRegistry } from './registry';\nimport {\n getUnknownComponentDiagnostic,\n resolveRenderedChildren,\n resolveRuntimeRegistry,\n} from './rendering';\nimport {\n type RuntimeComponentEventDispatchArgs,\n type RuntimeEventCapabilityResolver,\n wrapRuntimeEventProps,\n} from './runtimeActionRegistry';\nimport type { RuntimeBindingResultCache, RuntimeCapabilityExecutor } from './runtimeBindings';\nimport { dispatchRuntimeComponentEventWithReporting } from './runtimeEventExecution';\nimport {\n createRuntimeEventOperationBindingContext,\n createRuntimeEventOperationLifecycle,\n IDLE_RUNTIME_EVENT_OPERATION_STATE,\n} from './runtimeEventOperationLifecycle';\nimport type { RuntimeMediaAssetResolver } from './runtimeMedia';\nimport {\n RuntimeMediaResolutionCacheProvider,\n useRuntimeMediaResolutionCache,\n} from './runtimeMediaCache';\nimport { resolveRuntimeNodeProps } from './runtimeNodeProps';\nimport {\n mergeRuntimeRendererConfig,\n RuntimeRendererConfigProvider,\n type RuntimeRendererWrapArgs,\n useRuntimeRendererConfig,\n} from './RuntimeRendererConfig';\nimport {\n createRuntimeRepeatBindingContext,\n resolveRuntimeRepeatItemKey,\n resolveRuntimeRepeatItemsAsync,\n resolveRuntimeRepeatItemsSync,\n} from './runtimeRepeat';\nimport { createRepeatDiagnosticsKey } from './runtimeRepeatDiagnostics';\nimport { shouldRenderRuntimeRepeatEmptyState } from './runtimeRepeatEmptyState';\nimport { useRuntimeMediaProps } from './useRuntimeMediaProps';\nimport { useRuntimeStateBindings } from './useRuntimeStateBindings';\n\nexport interface RuntimeRendererProps {\n node: UiNode;\n isRoot?: boolean;\n registry?: ComponentRegistry;\n disableActions?: boolean;\n wrapNode?: (args: RuntimeRendererWrapArgs) => React.ReactNode;\n dbAdapter?: DbAdapter;\n dbRealtimeAdapter?: DbRealtimeAdapter;\n stateAdapter?: StateAdapter;\n bindingContext?: Record<string, unknown>;\n dataBindings?: ComponentDataBindingRegistry;\n mediaAssets?: MediaAssetRegistry;\n resolveMediaAsset?: RuntimeMediaAssetResolver;\n resultSlots?: RuntimeBindingResultCache;\n executeCapability?: RuntimeCapabilityExecutor;\n resolveEventCapability?: RuntimeEventCapabilityResolver;\n onDiagnostics?: (diagnostics: readonly DataSourceDiagnostic[]) => void;\n}\n\nexport function RuntimeRenderer(props: RuntimeRendererProps) {\n const {\n node,\n isRoot = false,\n registry,\n disableActions = false,\n wrapNode,\n dbAdapter,\n dbRealtimeAdapter,\n stateAdapter,\n bindingContext,\n dataBindings,\n mediaAssets,\n resolveMediaAsset,\n resultSlots,\n executeCapability,\n resolveEventCapability,\n onDiagnostics,\n } = props;\n const inheritedConfig = useRuntimeRendererConfig();\n const [rootEventOperationState, setRootEventOperationState] = React.useState(\n IDLE_RUNTIME_EVENT_OPERATION_STATE,\n );\n const rootEventOperationLifecycle = React.useMemo(\n () => createRuntimeEventOperationLifecycle(setRootEventOperationState),\n [],\n );\n const eventOperationState = isRoot\n ? rootEventOperationState\n : inheritedConfig.eventOperationState;\n const rootBindingContext = React.useMemo(\n () =>\n mergeRuntimeRendererConfig(\n { bindingContext },\n { bindingContext: inheritedConfig.bindingContext },\n ).bindingContext,\n [bindingContext, inheritedConfig.bindingContext],\n );\n const effectiveBindingContext = React.useMemo(\n () =>\n isRoot && eventOperationState !== undefined\n ? createRuntimeEventOperationBindingContext(rootBindingContext, eventOperationState)\n : bindingContext,\n [bindingContext, eventOperationState, isRoot, rootBindingContext],\n );\n const mediaResolutionCache = useRuntimeMediaResolutionCache();\n const inheritedResultSlots = inheritedConfig.resultSlots;\n const [localResultSlots, setLocalResultSlots] = React.useState<RuntimeBindingResultCache>({});\n const writeLocalResultSlot = React.useCallback((key: string, value: BindingValue) => {\n setLocalResultSlots((currentResults) => ({\n ...currentResults,\n [key]: value,\n }));\n }, []);\n const effectiveResultSlots = React.useMemo(\n () => ({\n ...(inheritedResultSlots ?? {}),\n ...(resultSlots ?? {}),\n ...localResultSlots,\n }),\n [inheritedResultSlots, localResultSlots, resultSlots],\n );\n const explicitConfig = React.useMemo(\n () => ({\n bindingContext: effectiveBindingContext,\n dataBindings,\n dbAdapter,\n dbRealtimeAdapter,\n disableActions,\n executeCapability,\n resolveEventCapability,\n mediaAssets,\n resultSlots: effectiveResultSlots,\n onDiagnostics,\n registry,\n resolveMediaAsset,\n stateAdapter,\n wrapNode,\n writeResultSlot: inheritedConfig.writeResultSlot ?? writeLocalResultSlot,\n eventOperationLifecycle: isRoot\n ? rootEventOperationLifecycle\n : inheritedConfig.eventOperationLifecycle,\n eventOperationState,\n }),\n [\n effectiveBindingContext,\n dataBindings,\n dbAdapter,\n dbRealtimeAdapter,\n disableActions,\n executeCapability,\n resolveEventCapability,\n effectiveResultSlots,\n inheritedConfig.writeResultSlot,\n inheritedConfig.eventOperationLifecycle,\n isRoot,\n mediaAssets,\n onDiagnostics,\n registry,\n resolveMediaAsset,\n stateAdapter,\n wrapNode,\n writeLocalResultSlot,\n eventOperationState,\n rootEventOperationLifecycle,\n ],\n );\n const effectiveConfig = React.useMemo(\n () => mergeRuntimeRendererConfig(explicitConfig, inheritedConfig),\n [explicitConfig, inheritedConfig],\n );\n useRuntimeStateBindings({\n dataBindings: effectiveConfig.dataBindings,\n nodeId: node.id,\n repeatSource: node.repeat?.source,\n stateAdapter: effectiveConfig.stateAdapter,\n });\n const dispatchRuntimeEvent = React.useCallback(\n async (eventArgs: RuntimeComponentEventDispatchArgs) => {\n await dispatchRuntimeComponentEventWithReporting({\n ...eventArgs,\n dataBindings: eventArgs.dataBindings ?? effectiveConfig.dataBindings,\n executeCapability: eventArgs.executeCapability ?? effectiveConfig.executeCapability,\n onDiagnostics: effectiveConfig.onDiagnostics,\n resultSlots: eventArgs.resultSlots ?? effectiveConfig.resultSlots,\n writeResultSlot: eventArgs.writeResultSlot ?? effectiveConfig.writeResultSlot,\n eventOperationLifecycle:\n eventArgs.eventOperationLifecycle ?? effectiveConfig.eventOperationLifecycle,\n });\n },\n [effectiveConfig],\n );\n const effectiveRegistry = React.useMemo(\n () =>\n resolveRuntimeRegistry({\n propRegistry: registry,\n configRegistry: effectiveConfig.registry,\n }),\n [effectiveConfig.registry, registry],\n );\n const Component = effectiveRegistry[node.type];\n\n const repeatSyncResult = (() => {\n const { repeat } = node;\n if (!repeat) {\n return null;\n }\n\n return resolveRuntimeRepeatItemsSync(repeat, {\n context: effectiveConfig.bindingContext,\n dataBindings: effectiveConfig.dataBindings,\n executeCapability: effectiveConfig.executeCapability,\n node,\n resultSlots: effectiveConfig.resultSlots,\n stateAdapter: effectiveConfig.stateAdapter,\n writeResultSlot: effectiveConfig.writeResultSlot,\n });\n })();\n const repeatRequest = React.useMemo(\n () =>\n node.repeat && repeatSyncResult?.status === 'pending'\n ? {\n context: effectiveConfig.bindingContext,\n dataBindings: effectiveConfig.dataBindings,\n executeCapability: effectiveConfig.executeCapability,\n node,\n repeat: node.repeat,\n resultSlots: effectiveConfig.resultSlots,\n stateAdapter: effectiveConfig.stateAdapter,\n writeResultSlot: effectiveConfig.writeResultSlot,\n }\n : null,\n [\n node,\n repeatSyncResult?.status,\n effectiveConfig.bindingContext,\n effectiveConfig.dataBindings,\n effectiveConfig.executeCapability,\n effectiveConfig.resultSlots,\n effectiveConfig.stateAdapter,\n effectiveConfig.writeResultSlot,\n ],\n );\n const repeatRequestToken = React.useMemo(() => (repeatRequest ? {} : null), [repeatRequest]);\n const [asyncRepeatResult, setAsyncRepeatResult] = React.useState<{\n readonly requestToken: object;\n readonly items: readonly BindingValue[];\n readonly diagnostics: readonly DataSourceDiagnostic[];\n } | null>(null);\n const repeatRequestIdRef = React.useRef(0);\n const lastRepeatDiagnosticsKeyRef = React.useRef<string | null>(null);\n\n React.useEffect(() => {\n repeatRequestIdRef.current += 1;\n const requestId = repeatRequestIdRef.current;\n if (repeatRequest === null || repeatRequestToken === null) {\n return undefined;\n }\n\n void (async () => {\n const result = await resolveRuntimeRepeatItemsAsync(repeatRequest.repeat, {\n context: repeatRequest.context,\n dataBindings: repeatRequest.dataBindings,\n executeCapability: repeatRequest.executeCapability,\n node: repeatRequest.node,\n resultSlots: repeatRequest.resultSlots,\n stateAdapter: repeatRequest.stateAdapter,\n writeResultSlot: repeatRequest.writeResultSlot,\n });\n\n if (repeatRequestIdRef.current !== requestId) {\n return;\n }\n\n setAsyncRepeatResult({ ...result, requestToken: repeatRequestToken });\n })();\n\n return () => {\n repeatRequestIdRef.current += 1;\n };\n }, [repeatRequest, repeatRequestToken]);\n const currentAsyncRepeatResult =\n asyncRepeatResult?.requestToken === repeatRequestToken ? asyncRepeatResult : null;\n const repeatDiagnostics =\n repeatSyncResult?.status === 'ready'\n ? repeatSyncResult.diagnostics\n : currentAsyncRepeatResult?.diagnostics;\n\n React.useEffect(() => {\n if (!node.repeat || repeatDiagnostics === undefined) {\n return;\n }\n\n const diagnosticsKey = createRepeatDiagnosticsKey(node.id, repeatDiagnostics);\n if (lastRepeatDiagnosticsKeyRef.current === diagnosticsKey) {\n return;\n }\n\n lastRepeatDiagnosticsKeyRef.current = diagnosticsKey;\n effectiveConfig.onDiagnostics?.(repeatDiagnostics);\n }, [effectiveConfig, node, repeatDiagnostics]);\n\n const bindingResolvedProps = resolveRuntimeNodeProps({\n bindingContext: effectiveConfig.bindingContext,\n dataBindings: effectiveConfig.dataBindings,\n dbAdapter: effectiveConfig.dbAdapter,\n dbRealtimeAdapter: effectiveConfig.dbRealtimeAdapter,\n node,\n resultSlots: effectiveConfig.resultSlots,\n stateAdapter: effectiveConfig.stateAdapter,\n });\n const mediaResolvedProps = useRuntimeMediaProps({\n cache: mediaResolutionCache,\n mediaAssets: effectiveConfig.mediaAssets,\n props: bindingResolvedProps,\n resolveMediaAsset: effectiveConfig.resolveMediaAsset,\n });\n const resolvedProps = effectiveConfig.resolveNodeProps\n ? effectiveConfig.resolveNodeProps({ node, props: mediaResolvedProps })\n : mediaResolvedProps;\n\n if (!Component) {\n const diagnostic = getUnknownComponentDiagnostic(node.type, effectiveRegistry);\n return (\n <View style={styles.errorBox}>\n <Text style={styles.errorTitle}>{diagnostic.title}</Text>\n <Text style={styles.errorText}>{diagnostic.suggestion}</Text>\n <Text style={styles.errorMeta}>{diagnostic.detail}</Text>\n </View>\n );\n }\n\n const repeatItems =\n repeatSyncResult?.status === 'ready' ? repeatSyncResult.items : currentAsyncRepeatResult?.items;\n const shouldRenderRepeatEmptyState = shouldRenderRuntimeRepeatEmptyState({\n diagnostics: repeatDiagnostics,\n items: repeatItems,\n status:\n repeatSyncResult?.status === 'ready'\n ? 'ready'\n : repeatSyncResult?.status === 'pending'\n ? 'pending'\n : currentAsyncRepeatResult\n ? 'ready'\n : undefined,\n });\n const renderedChildren = node.repeat\n ? repeatItems && repeatItems.length > 0\n ? repeatItems.flatMap((item, itemIndex) =>\n (node.children ?? []).map((child) => {\n const itemAlias = node.repeat?.itemAlias ?? 'item';\n const repeatKey = resolveRuntimeRepeatItemKey({\n item,\n itemAlias,\n index: itemIndex,\n keyPath: node.repeat?.keyPath,\n });\n\n return (\n <RuntimeRenderer\n key={`${child.id}:${String(repeatKey)}`}\n node={child}\n registry={effectiveRegistry}\n bindingContext={createRuntimeRepeatBindingContext({\n baseContext: effectiveConfig.bindingContext,\n item,\n itemAlias,\n })}\n />\n );\n }),\n )\n : shouldRenderRepeatEmptyState\n ? node.repeat.empty?.map((child) => (\n <RuntimeRenderer key={child.id} node={child} registry={effectiveRegistry} />\n ))\n : undefined\n : node.children?.map((child) => (\n <RuntimeRenderer key={child.id} node={child} registry={effectiveRegistry} />\n ));\n\n const propsWithEvents = wrapRuntimeEventProps({\n context: effectiveConfig.bindingContext,\n dataBindings: effectiveConfig.dataBindings,\n props: resolvedProps,\n disableActions: effectiveConfig.disableActions === true,\n dispatchComponentEvent: dispatchRuntimeEvent,\n node,\n resultSlots: effectiveConfig.resultSlots,\n resolveEventCapability: effectiveConfig.resolveEventCapability,\n });\n\n const componentChildren = resolveRenderedChildren({\n propChildren: propsWithEvents.children as React.ReactNode,\n renderedChildren,\n });\n\n let content: React.ReactNode = <Component {...propsWithEvents}>{componentChildren}</Component>;\n if (effectiveConfig.wrapNode) {\n content = effectiveConfig.wrapNode({ node, rendered: content, isRoot });\n }\n\n return (\n <RuntimeMediaResolutionCacheProvider value={mediaResolutionCache}>\n <RuntimeRendererConfigProvider value={explicitConfig}>\n {content}\n </RuntimeRendererConfigProvider>\n </RuntimeMediaResolutionCacheProvider>\n );\n}\n\nconst styles = StyleSheet.create({\n errorBox: {\n borderColor: '#ef4444',\n borderRadius: 8,\n borderWidth: 1,\n margin: 8,\n padding: 8,\n },\n errorTitle: {\n color: '#991b1b',\n fontSize: 13,\n fontWeight: '700',\n marginBottom: 4,\n },\n errorText: {\n color: '#ef4444',\n fontWeight: '600',\n },\n errorMeta: {\n color: '#7f1d1d',\n fontSize: 12,\n marginTop: 4,\n },\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuntimeScreen.d.ts","sourceRoot":"","sources":["../src/RuntimeScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"RuntimeScreen.d.ts","sourceRoot":"","sources":["../src/RuntimeScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAQpD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IACtC,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;CACtC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,qBA4CtD"}
|
package/dist/RuntimeScreen.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useOptionalManifestContext } from './ManifestContext';
|
|
2
3
|
import { createRuntimeApiCapabilityExecutor } from './runtimeApiCapabilities';
|
|
3
4
|
import { composeRuntimeCapabilityExecutor } from './runtimeCapabilityExecutor';
|
|
4
5
|
import { RuntimeRenderer } from './RuntimeRenderer';
|
|
@@ -8,13 +9,15 @@ import { createRuntimeMemoryStateAdapter } from './runtimeStateAdapter';
|
|
|
8
9
|
export function RuntimeScreen(props) {
|
|
9
10
|
const { manifest, screen, registry, stateAdapter: injectedStateAdapter } = props;
|
|
10
11
|
const runtimeConfig = useRuntimeRendererConfig();
|
|
12
|
+
const manifestContext = useOptionalManifestContext();
|
|
13
|
+
const fallbackStateAdapter = React.useMemo(() => (manifest.state?.provider === 'legend' ? createRuntimeMemoryStateAdapter() : undefined), [manifest.state?.provider]);
|
|
14
|
+
const stateAdapter = injectedStateAdapter ?? manifestContext?.stateAdapter ?? fallbackStateAdapter;
|
|
11
15
|
const apiCapabilityExecutor = React.useMemo(() => createRuntimeApiCapabilityExecutor({ apis: manifest.infra.apis ?? {} }), [manifest.infra.apis]);
|
|
12
16
|
const executeCapability = React.useMemo(() => composeRuntimeCapabilityExecutor({
|
|
13
17
|
apiCapabilityExecutor,
|
|
14
18
|
capabilityExecutor: runtimeConfig.executeCapability,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const stateAdapter = injectedStateAdapter ?? fallbackStateAdapter;
|
|
19
|
+
stateAdapter,
|
|
20
|
+
}), [apiCapabilityExecutor, runtimeConfig.executeCapability, stateAdapter]);
|
|
18
21
|
const screenOperationLoaders = useRuntimeScreenOperationLoaders({
|
|
19
22
|
bindingContext: runtimeConfig.bindingContext,
|
|
20
23
|
executeCapability,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuntimeScreen.js","sourceRoot":"","sources":["../src/RuntimeScreen.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"RuntimeScreen.js","sourceRoot":"","sources":["../src/RuntimeScreen.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,EAAE,kCAAkC,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,gCAAgC,EAAE,MAAM,6BAA6B,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AASxE,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,oB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,MAAM,CAAC,IAAI,CAAC,CAClB,MAAM,CACN,QAAQ,CAAC,CAAC,QAAQ,CAAC,CACnB,YAAY,CAAC,CAAC,YAAY,CAAC,CAC3B,YAAY,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CACpC,WAAW,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CACpC,WAAW,CAAC,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAChD,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,EACrC,CACH,CAAC;AACJ,CAAC","sourcesContent":["import type { AppManifest, ScreenSpec, StateAdapter } from '@ankhorage/contracts';\nimport React from 'react';\n\nimport { useOptionalManifestContext } from './ManifestContext';\nimport type { ComponentRegistry } from './registry';\nimport { createRuntimeApiCapabilityExecutor } from './runtimeApiCapabilities';\nimport { composeRuntimeCapabilityExecutor } from './runtimeCapabilityExecutor';\nimport { RuntimeRenderer } from './RuntimeRenderer';\nimport { useRuntimeRendererConfig } from './RuntimeRendererConfig';\nimport { useRuntimeScreenOperationLoaders } from './runtimeScreenLoaders';\nimport { createRuntimeMemoryStateAdapter } from './runtimeStateAdapter';\n\nexport interface RuntimeScreenProps {\n readonly manifest: AppManifest;\n readonly screen: ScreenSpec;\n readonly registry?: ComponentRegistry;\n readonly stateAdapter?: StateAdapter;\n}\n\nexport function RuntimeScreen(props: RuntimeScreenProps) {\n const { manifest, screen, registry, stateAdapter: injectedStateAdapter } = props;\n const runtimeConfig = useRuntimeRendererConfig();\n const manifestContext = useOptionalManifestContext();\n const fallbackStateAdapter = React.useMemo(\n () => (manifest.state?.provider === 'legend' ? createRuntimeMemoryStateAdapter() : undefined),\n [manifest.state?.provider],\n );\n const stateAdapter =\n injectedStateAdapter ?? manifestContext?.stateAdapter ?? fallbackStateAdapter;\n const apiCapabilityExecutor = React.useMemo(\n () => createRuntimeApiCapabilityExecutor({ apis: manifest.infra.apis ?? {} }),\n [manifest.infra.apis],\n );\n const executeCapability = React.useMemo(\n () =>\n composeRuntimeCapabilityExecutor({\n apiCapabilityExecutor,\n capabilityExecutor: runtimeConfig.executeCapability,\n stateAdapter,\n }),\n [apiCapabilityExecutor, runtimeConfig.executeCapability, stateAdapter],\n );\n const screenOperationLoaders = useRuntimeScreenOperationLoaders({\n bindingContext: runtimeConfig.bindingContext,\n executeCapability,\n resultSlots: runtimeConfig.resultSlots,\n onDiagnostics: runtimeConfig.onDiagnostics,\n screen,\n });\n\n return (\n <RuntimeRenderer\n key={`${screen.id}:${screenOperationLoaders.renderVersion}`}\n node={screen.root}\n isRoot\n registry={registry}\n stateAdapter={stateAdapter}\n dataBindings={manifest.dataBindings}\n mediaAssets={manifest.media?.assets}\n resultSlots={screenOperationLoaders.resultSlots}\n executeCapability={executeCapability}\n />\n );\n}\n"]}
|
|
@@ -25,6 +25,53 @@ export declare const CAPABILITIES: readonly [{
|
|
|
25
25
|
readonly bindableAs: readonly ["source", "target"];
|
|
26
26
|
};
|
|
27
27
|
readonly label: "Runtime bindings";
|
|
28
|
+
}, {
|
|
29
|
+
readonly id: "state.set";
|
|
30
|
+
readonly owner: "@ankhorage/runtime";
|
|
31
|
+
readonly access: readonly ["invoke", "write"];
|
|
32
|
+
readonly binding: {
|
|
33
|
+
readonly kind: "state";
|
|
34
|
+
readonly bindableAs: readonly ["target"];
|
|
35
|
+
};
|
|
36
|
+
readonly label: "Set runtime state";
|
|
37
|
+
readonly input: {
|
|
38
|
+
readonly schema: {
|
|
39
|
+
readonly type: "object";
|
|
40
|
+
readonly required: readonly ["path", "value"];
|
|
41
|
+
readonly properties: {
|
|
42
|
+
readonly path: {
|
|
43
|
+
readonly anyOf: readonly [{
|
|
44
|
+
readonly type: "string";
|
|
45
|
+
}, {
|
|
46
|
+
readonly type: "array";
|
|
47
|
+
readonly items: {
|
|
48
|
+
readonly type: "string";
|
|
49
|
+
};
|
|
50
|
+
}];
|
|
51
|
+
};
|
|
52
|
+
readonly value: {};
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
readonly output: {
|
|
57
|
+
readonly schema: {
|
|
58
|
+
readonly type: "object";
|
|
59
|
+
readonly required: readonly ["path", "value"];
|
|
60
|
+
readonly properties: {
|
|
61
|
+
readonly path: {
|
|
62
|
+
readonly anyOf: readonly [{
|
|
63
|
+
readonly type: "string";
|
|
64
|
+
}, {
|
|
65
|
+
readonly type: "array";
|
|
66
|
+
readonly items: {
|
|
67
|
+
readonly type: "string";
|
|
68
|
+
};
|
|
69
|
+
}];
|
|
70
|
+
};
|
|
71
|
+
readonly value: {};
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
};
|
|
28
75
|
}, {
|
|
29
76
|
readonly id: "runtime.eventOperation";
|
|
30
77
|
readonly owner: "@ankhorage/runtime";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/capabilities/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/capabilities/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0GiB,CAAC"}
|
|
@@ -29,6 +29,40 @@ export const CAPABILITIES = [
|
|
|
29
29
|
},
|
|
30
30
|
label: 'Runtime bindings',
|
|
31
31
|
},
|
|
32
|
+
{
|
|
33
|
+
id: 'state.set',
|
|
34
|
+
owner: '@ankhorage/runtime',
|
|
35
|
+
access: ['invoke', 'write'],
|
|
36
|
+
binding: {
|
|
37
|
+
kind: 'state',
|
|
38
|
+
bindableAs: ['target'],
|
|
39
|
+
},
|
|
40
|
+
label: 'Set runtime state',
|
|
41
|
+
input: {
|
|
42
|
+
schema: {
|
|
43
|
+
type: 'object',
|
|
44
|
+
required: ['path', 'value'],
|
|
45
|
+
properties: {
|
|
46
|
+
path: {
|
|
47
|
+
anyOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],
|
|
48
|
+
},
|
|
49
|
+
value: {},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
output: {
|
|
54
|
+
schema: {
|
|
55
|
+
type: 'object',
|
|
56
|
+
required: ['path', 'value'],
|
|
57
|
+
properties: {
|
|
58
|
+
path: {
|
|
59
|
+
anyOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],
|
|
60
|
+
},
|
|
61
|
+
value: {},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
32
66
|
{
|
|
33
67
|
id: 'runtime.eventOperation',
|
|
34
68
|
owner: '@ankhorage/runtime',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/capabilities/index.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B;QACE,EAAE,EAAE,gBAAgB;QACpB,KAAK,EAAE,oBAAoB;QAC3B,MAAM,EAAE,CAAC,QAAQ,CAAC;QAClB,OAAO,EAAE;YACP,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,CAAC,QAAQ,CAAC;SACvB;QACD,KAAK,EAAE,gBAAgB;KACxB;IACD;QACE,EAAE,EAAE,iBAAiB;QACrB,KAAK,EAAE,oBAAoB;QAC3B,MAAM,EAAE,CAAC,QAAQ,CAAC;QAClB,OAAO,EAAE;YACP,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,CAAC,QAAQ,CAAC;SACvB;QACD,KAAK,EAAE,yBAAyB;KACjC;IACD;QACE,EAAE,EAAE,kBAAkB;QACtB,KAAK,EAAE,oBAAoB;QAC3B,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;QACzB,OAAO,EAAE;YACP,IAAI,EAAE,OAAO;Y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C,CAAC","sourcesContent":["import type { Capability } from '@ankhorage/contracts/capability';\n\nexport const CAPABILITIES = [\n {\n id: 'runtime.render',\n owner: '@ankhorage/runtime',\n access: ['invoke'],\n binding: {\n kind: 'action',\n bindableAs: ['target'],\n },\n label: 'Render runtime',\n },\n {\n id: 'runtime.actions',\n owner: '@ankhorage/runtime',\n access: ['invoke'],\n binding: {\n kind: 'action',\n bindableAs: ['target'],\n },\n label: 'Execute runtime actions',\n },\n {\n id: 'runtime.bindings',\n owner: '@ankhorage/runtime',\n access: ['read', 'write'],\n binding: {\n kind: 'state',\n bindableAs: ['source', 'target'],\n },\n label: 'Runtime bindings',\n },\n {\n id: 'runtime.eventOperation',\n owner: '@ankhorage/runtime',\n access: ['read', 'subscribe'],\n binding: {\n kind: 'context',\n bindableAs: ['source'],\n },\n label: 'Runtime event operation',\n output: {\n schema: {\n type: 'object',\n required: ['status', 'loading', 'errorMessage'],\n properties: {\n status: { type: 'string', enum: ['idle', 'loading', 'success', 'error'] },\n loading: { type: 'boolean' },\n errorMessage: { type: 'string' },\n nodeId: { type: 'string' },\n operation: {\n type: 'object',\n required: ['apiId', 'operationId'],\n properties: {\n apiId: { type: 'string' },\n endpointId: { type: 'string' },\n operationId: { type: 'string' },\n },\n },\n },\n },\n },\n },\n {\n id: 'runtime.repeat.item',\n owner: '@ankhorage/runtime',\n access: ['read'],\n binding: {\n kind: 'context',\n bindableAs: ['source'],\n },\n label: 'Runtime repeat item',\n },\n] as const satisfies readonly Capability[];\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/capabilities/index.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B;QACE,EAAE,EAAE,gBAAgB;QACpB,KAAK,EAAE,oBAAoB;QAC3B,MAAM,EAAE,CAAC,QAAQ,CAAC;QAClB,OAAO,EAAE;YACP,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,CAAC,QAAQ,CAAC;SACvB;QACD,K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C,QAAQ,CAAC;SACvB;QACD,KAAK,EAAE,qBAAqB;KAC7B;CACuC,CAAC","sourcesContent":["import type { Capability } from '@ankhorage/contracts/capability';\n\nexport const CAPABILITIES = [\n {\n id: 'runtime.render',\n owner: '@ankhorage/runtime',\n access: ['invoke'],\n binding: {\n kind: 'action',\n bindableAs: ['target'],\n },\n label: 'Render runtime',\n },\n {\n id: 'runtime.actions',\n owner: '@ankhorage/runtime',\n access: ['invoke'],\n binding: {\n kind: 'action',\n bindableAs: ['target'],\n },\n label: 'Execute runtime actions',\n },\n {\n id: 'runtime.bindings',\n owner: '@ankhorage/runtime',\n access: ['read', 'write'],\n binding: {\n kind: 'state',\n bindableAs: ['source', 'target'],\n },\n label: 'Runtime bindings',\n },\n {\n id: 'state.set',\n owner: '@ankhorage/runtime',\n access: ['invoke', 'write'],\n binding: {\n kind: 'state',\n bindableAs: ['target'],\n },\n label: 'Set runtime state',\n input: {\n schema: {\n type: 'object',\n required: ['path', 'value'],\n properties: {\n path: {\n anyOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],\n },\n value: {},\n },\n },\n },\n output: {\n schema: {\n type: 'object',\n required: ['path', 'value'],\n properties: {\n path: {\n anyOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }],\n },\n value: {},\n },\n },\n },\n },\n {\n id: 'runtime.eventOperation',\n owner: '@ankhorage/runtime',\n access: ['read', 'subscribe'],\n binding: {\n kind: 'context',\n bindableAs: ['source'],\n },\n label: 'Runtime event operation',\n output: {\n schema: {\n type: 'object',\n required: ['status', 'loading', 'errorMessage'],\n properties: {\n status: { type: 'string', enum: ['idle', 'loading', 'success', 'error'] },\n loading: { type: 'boolean' },\n errorMessage: { type: 'string' },\n nodeId: { type: 'string' },\n operation: {\n type: 'object',\n required: ['apiId', 'operationId'],\n properties: {\n apiId: { type: 'string' },\n endpointId: { type: 'string' },\n operationId: { type: 'string' },\n },\n },\n },\n },\n },\n },\n {\n id: 'runtime.repeat.item',\n owner: '@ankhorage/runtime',\n access: ['read'],\n binding: {\n kind: 'context',\n bindableAs: ['source'],\n },\n label: 'Runtime repeat item',\n },\n] as const satisfies readonly Capability[];\n"]}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type { StateAdapter } from '@ankhorage/contracts';
|
|
1
2
|
import type { RuntimeCapabilityExecutor } from './runtimeBindings';
|
|
2
3
|
export interface RuntimeCapabilityExecutorComposition {
|
|
3
4
|
readonly apiCapabilityExecutor: RuntimeCapabilityExecutor;
|
|
4
5
|
readonly capabilityExecutor?: RuntimeCapabilityExecutor;
|
|
6
|
+
readonly stateAdapter?: StateAdapter;
|
|
5
7
|
}
|
|
6
|
-
/*** Routes
|
|
8
|
+
/*** Routes API and state capabilities before delegating application-owned capabilities. */
|
|
7
9
|
export declare function composeRuntimeCapabilityExecutor(composition: RuntimeCapabilityExecutorComposition): RuntimeCapabilityExecutor;
|
|
8
10
|
//# sourceMappingURL=runtimeCapabilityExecutor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtimeCapabilityExecutor.d.ts","sourceRoot":"","sources":["../src/runtimeCapabilityExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,yBAAyB,EAC1B,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,oCAAoC;IACnD,QAAQ,CAAC,qBAAqB,EAAE,yBAAyB,CAAC;IAC1D,QAAQ,CAAC,kBAAkB,CAAC,EAAE,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"runtimeCapabilityExecutor.d.ts","sourceRoot":"","sources":["../src/runtimeCapabilityExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAyB,MAAM,sBAAsB,CAAC;AAGhF,OAAO,KAAK,EAGV,yBAAyB,EAC1B,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,oCAAoC;IACnD,QAAQ,CAAC,qBAAqB,EAAE,yBAAyB,CAAC;IAC1D,QAAQ,CAAC,kBAAkB,CAAC,EAAE,yBAAyB,CAAC;IACxD,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;CACtC;AAED,2FAA2F;AAC3F,wBAAgB,gCAAgC,CAC9C,WAAW,EAAE,oCAAoC,GAChD,yBAAyB,CAO3B"}
|