@primafuture/contrib-kit-react 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +15 -0
- package/README.md +294 -0
- package/dist/contribution-component.d.ts +82 -0
- package/dist/contribution-component.d.ts.map +1 -0
- package/dist/contribution-component.js +12 -0
- package/dist/contribution-component.js.map +1 -0
- package/dist/extension-outlet.d.ts +155 -0
- package/dist/extension-outlet.d.ts.map +1 -0
- package/dist/extension-outlet.js +229 -0
- package/dist/extension-outlet.js.map +1 -0
- package/dist/extension-registry-provider.d.ts +26 -0
- package/dist/extension-registry-provider.d.ts.map +1 -0
- package/dist/extension-registry-provider.js +82 -0
- package/dist/extension-registry-provider.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/adapter-configuration.d.ts +54 -0
- package/dist/internal/adapter-configuration.d.ts.map +1 -0
- package/dist/internal/adapter-configuration.js +89 -0
- package/dist/internal/adapter-configuration.js.map +1 -0
- package/dist/internal/adapter-context.d.ts +24 -0
- package/dist/internal/adapter-context.d.ts.map +1 -0
- package/dist/internal/adapter-context.js +23 -0
- package/dist/internal/adapter-context.js.map +1 -0
- package/dist/internal/adapter-registry-bridge.d.ts +58 -0
- package/dist/internal/adapter-registry-bridge.d.ts.map +1 -0
- package/dist/internal/adapter-registry-bridge.js +494 -0
- package/dist/internal/adapter-registry-bridge.js.map +1 -0
- package/dist/internal/adapter-registry-protocol.d.ts +53 -0
- package/dist/internal/adapter-registry-protocol.d.ts.map +1 -0
- package/dist/internal/adapter-registry-protocol.js +182 -0
- package/dist/internal/adapter-registry-protocol.js.map +1 -0
- package/dist/internal/adapter-scope.d.ts +87 -0
- package/dist/internal/adapter-scope.d.ts.map +1 -0
- package/dist/internal/adapter-scope.js +346 -0
- package/dist/internal/adapter-scope.js.map +1 -0
- package/dist/internal/implementation-classifier.d.ts +21 -0
- package/dist/internal/implementation-classifier.d.ts.map +1 -0
- package/dist/internal/implementation-classifier.js +39 -0
- package/dist/internal/implementation-classifier.js.map +1 -0
- package/dist/internal/managed-lazy-generation.d.ts +100 -0
- package/dist/internal/managed-lazy-generation.d.ts.map +1 -0
- package/dist/internal/managed-lazy-generation.js +419 -0
- package/dist/internal/managed-lazy-generation.js.map +1 -0
- package/dist/internal/outlet-commit-lease.d.ts +46 -0
- package/dist/internal/outlet-commit-lease.d.ts.map +1 -0
- package/dist/internal/outlet-commit-lease.js +137 -0
- package/dist/internal/outlet-commit-lease.js.map +1 -0
- package/dist/internal/outlet-error-pipeline.d.ts +122 -0
- package/dist/internal/outlet-error-pipeline.d.ts.map +1 -0
- package/dist/internal/outlet-error-pipeline.js +214 -0
- package/dist/internal/outlet-error-pipeline.js.map +1 -0
- package/dist/internal/outlet-input.d.ts +42 -0
- package/dist/internal/outlet-input.d.ts.map +1 -0
- package/dist/internal/outlet-input.js +86 -0
- package/dist/internal/outlet-input.js.map +1 -0
- package/dist/internal/outlet-membership-boundary.d.ts +93 -0
- package/dist/internal/outlet-membership-boundary.d.ts.map +1 -0
- package/dist/internal/outlet-membership-boundary.js +710 -0
- package/dist/internal/outlet-membership-boundary.js.map +1 -0
- package/dist/internal/outlet-membership.d.ts +31 -0
- package/dist/internal/outlet-membership.d.ts.map +1 -0
- package/dist/internal/outlet-membership.js +65 -0
- package/dist/internal/outlet-membership.js.map +1 -0
- package/dist/internal/outlet-projection.d.ts +102 -0
- package/dist/internal/outlet-projection.d.ts.map +1 -0
- package/dist/internal/outlet-projection.js +228 -0
- package/dist/internal/outlet-projection.js.map +1 -0
- package/dist/internal/outlet-reporter-boundary.d.ts +42 -0
- package/dist/internal/outlet-reporter-boundary.d.ts.map +1 -0
- package/dist/internal/outlet-reporter-boundary.js +57 -0
- package/dist/internal/outlet-reporter-boundary.js.map +1 -0
- package/dist/internal/public-input-capture.d.ts +13 -0
- package/dist/internal/public-input-capture.d.ts.map +1 -0
- package/dist/internal/public-input-capture.js +34 -0
- package/dist/internal/public-input-capture.js.map +1 -0
- package/dist/internal/resolved-contributions-query.d.ts +42 -0
- package/dist/internal/resolved-contributions-query.d.ts.map +1 -0
- package/dist/internal/resolved-contributions-query.js +203 -0
- package/dist/internal/resolved-contributions-query.js.map +1 -0
- package/dist/react-adapter-diagnostics.d.ts +199 -0
- package/dist/react-adapter-diagnostics.d.ts.map +1 -0
- package/dist/react-adapter-diagnostics.js +257 -0
- package/dist/react-adapter-diagnostics.js.map +1 -0
- package/dist/react-adapter-error.d.ts +35 -0
- package/dist/react-adapter-error.d.ts.map +1 -0
- package/dist/react-adapter-error.js +37 -0
- package/dist/react-adapter-error.js.map +1 -0
- package/dist/react-extension-point.d.ts +26 -0
- package/dist/react-extension-point.d.ts.map +1 -0
- package/dist/react-extension-point.js +100 -0
- package/dist/react-extension-point.js.map +1 -0
- package/dist/react-lazy-contribution.d.ts +40 -0
- package/dist/react-lazy-contribution.d.ts.map +1 -0
- package/dist/react-lazy-contribution.js +18 -0
- package/dist/react-lazy-contribution.js.map +1 -0
- package/dist/resolved-contributions.d.ts +90 -0
- package/dist/resolved-contributions.d.ts.map +1 -0
- package/dist/resolved-contributions.js +455 -0
- package/dist/resolved-contributions.js.map +1 -0
- package/package.json +47 -0
- package/src/contribution-component.ts +118 -0
- package/src/extension-outlet.ts +590 -0
- package/src/extension-registry-provider.ts +179 -0
- package/src/index.ts +72 -0
- package/src/internal/adapter-configuration.ts +181 -0
- package/src/internal/adapter-context.ts +43 -0
- package/src/internal/adapter-registry-bridge.ts +723 -0
- package/src/internal/adapter-registry-protocol.ts +365 -0
- package/src/internal/adapter-scope.ts +500 -0
- package/src/internal/implementation-classifier.ts +59 -0
- package/src/internal/managed-lazy-generation.ts +540 -0
- package/src/internal/outlet-commit-lease.ts +216 -0
- package/src/internal/outlet-error-pipeline.ts +447 -0
- package/src/internal/outlet-input.ts +264 -0
- package/src/internal/outlet-membership-boundary.ts +1048 -0
- package/src/internal/outlet-membership.ts +125 -0
- package/src/internal/outlet-projection.ts +511 -0
- package/src/internal/outlet-reporter-boundary.ts +105 -0
- package/src/internal/public-input-capture.ts +55 -0
- package/src/internal/resolved-contributions-query.ts +318 -0
- package/src/react-adapter-diagnostics.ts +457 -0
- package/src/react-adapter-error.ts +88 -0
- package/src/react-extension-point.ts +181 -0
- package/src/react-lazy-contribution.ts +66 -0
- package/src/resolved-contributions.ts +895 -0
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
import type * as contribKitCore from "@primafuture/contrib-kit-core";
|
|
2
|
+
|
|
3
|
+
import * as reactAdapterError from "../react-adapter-error.js";
|
|
4
|
+
|
|
5
|
+
/** Lifecycle checkpoint spuštěný po každé user-observable registry operaci. */
|
|
6
|
+
export type AdapterRegistryProtocolCheckpoint = () => void;
|
|
7
|
+
|
|
8
|
+
/** Fáze, ve které validní, ale neaktivní registry odmítne novou práci. */
|
|
9
|
+
export type AdapterRegistryAvailabilityPhase = "resolve" | "lifecycle";
|
|
10
|
+
|
|
11
|
+
/** Cache-safe pre-subscribe token odvozený pouze z public snapshot stavu. */
|
|
12
|
+
export type AdapterRegistrySnapshotToken = `${contribKitCore.ExtensionRegistryState}:${number}`;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Read-once structural registry snapshot používaný budoucím React bridgem.
|
|
16
|
+
*/
|
|
17
|
+
export interface AdapterRegistryProtocolSnapshot {
|
|
18
|
+
/** Přesný raw receiver bez proxy unwrappingu nebo Core brand kontroly. */
|
|
19
|
+
readonly rawRegistry: object;
|
|
20
|
+
/** Neprázdná registry identita zachycená při vzniku snapshotu. */
|
|
21
|
+
readonly registryId: string;
|
|
22
|
+
/** Aktivní registry stav ověřený až po úplné shape validaci. */
|
|
23
|
+
readonly initialState: "active";
|
|
24
|
+
/** Stabilní reference public Core subscriber metody. */
|
|
25
|
+
readonly subscribe: contribKitCore.ExtensionRegistry["subscribe"];
|
|
26
|
+
/** Stabilní reference public Core snapshot selectoru. */
|
|
27
|
+
readonly createSnapshot: contribKitCore.ExtensionRegistry["createSnapshot"];
|
|
28
|
+
/** Stabilní reference public Core katalogového readu. */
|
|
29
|
+
readonly listContributions: contribKitCore.ExtensionRegistry["listContributions"];
|
|
30
|
+
/** Stabilní reference public Core resolved-view readu. */
|
|
31
|
+
readonly resolveContributions: contribKitCore.ExtensionRegistry["resolveContributions"];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Sdílený checkpoint pro capture bez existující lifecycle autority. */
|
|
35
|
+
export function skipAdapterRegistryProtocolCheckpoint(): void {
|
|
36
|
+
// Samotná strukturální inspekce nemá adapter scope, který by mohla zneplatnit.
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Vytvoří bezpečnou registry chybu bez vložení raw vstupu do detailů.
|
|
41
|
+
*/
|
|
42
|
+
function createRegistryProtocolError(
|
|
43
|
+
code: "REACT_REGISTRY_INVALID" | "REACT_REGISTRY_UNAVAILABLE",
|
|
44
|
+
phase: "configuration" | AdapterRegistryAvailabilityPhase,
|
|
45
|
+
message: string,
|
|
46
|
+
field: string,
|
|
47
|
+
cause?: unknown,
|
|
48
|
+
preserveCause = false,
|
|
49
|
+
): reactAdapterError.ReactAdapterError {
|
|
50
|
+
return new reactAdapterError.ReactAdapterError(
|
|
51
|
+
code,
|
|
52
|
+
message,
|
|
53
|
+
preserveCause
|
|
54
|
+
? { cause, details: { field, phase } }
|
|
55
|
+
: { details: { field, phase } },
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Ověří raw registry eligibility bez přijetí callable objektu jako registry.
|
|
61
|
+
*/
|
|
62
|
+
function requireRegistryObject(value: unknown): object {
|
|
63
|
+
if (typeof value !== "object" || value === null) {
|
|
64
|
+
throw createRegistryProtocolError(
|
|
65
|
+
"REACT_REGISTRY_INVALID",
|
|
66
|
+
"configuration",
|
|
67
|
+
"Registry must be a non-null object.",
|
|
68
|
+
"registry",
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return value;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Načte jedno registry protocol pole právě jednou a následně ověří autoritu.
|
|
77
|
+
*/
|
|
78
|
+
function readRegistryProperty(
|
|
79
|
+
registry: object,
|
|
80
|
+
property:
|
|
81
|
+
| "registryId"
|
|
82
|
+
| "state"
|
|
83
|
+
| "subscribe"
|
|
84
|
+
| "createSnapshot"
|
|
85
|
+
| "listContributions"
|
|
86
|
+
| "resolveContributions",
|
|
87
|
+
checkpoint: AdapterRegistryProtocolCheckpoint,
|
|
88
|
+
): unknown {
|
|
89
|
+
let value: unknown;
|
|
90
|
+
try {
|
|
91
|
+
value = Reflect.get(registry, property, registry);
|
|
92
|
+
} catch (cause: unknown) {
|
|
93
|
+
throw createRegistryProtocolError(
|
|
94
|
+
"REACT_REGISTRY_INVALID",
|
|
95
|
+
"configuration",
|
|
96
|
+
`Unable to read registry.${property}.`,
|
|
97
|
+
`registry.${property}`,
|
|
98
|
+
cause,
|
|
99
|
+
true,
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
checkpoint();
|
|
104
|
+
return value;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Ověří neprázdnou primitive registry identitu.
|
|
109
|
+
*/
|
|
110
|
+
function requireRegistryId(value: unknown, field: string): string {
|
|
111
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
112
|
+
throw createRegistryProtocolError(
|
|
113
|
+
"REACT_REGISTRY_INVALID",
|
|
114
|
+
"configuration",
|
|
115
|
+
"Registry ID must be a non-empty string.",
|
|
116
|
+
field,
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return value;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Ověří exact public registry state union bez rozhodnutí o dostupnosti.
|
|
125
|
+
*/
|
|
126
|
+
function requireRegistryState(value: unknown, field: string): contribKitCore.ExtensionRegistryState {
|
|
127
|
+
if (value !== "active" && value !== "disposing" && value !== "disposed") {
|
|
128
|
+
throw createRegistryProtocolError(
|
|
129
|
+
"REACT_REGISTRY_INVALID",
|
|
130
|
+
"configuration",
|
|
131
|
+
"Registry state is invalid.",
|
|
132
|
+
field,
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return value;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Oddělí validní protocol shape od lifecycle dostupnosti nové práce.
|
|
141
|
+
*/
|
|
142
|
+
function requireRegistryAvailability(
|
|
143
|
+
state: contribKitCore.ExtensionRegistryState,
|
|
144
|
+
phase: AdapterRegistryAvailabilityPhase,
|
|
145
|
+
): "active" {
|
|
146
|
+
if (state !== "active") {
|
|
147
|
+
throw createRegistryProtocolError(
|
|
148
|
+
"REACT_REGISTRY_UNAVAILABLE",
|
|
149
|
+
phase,
|
|
150
|
+
"Registry is not active.",
|
|
151
|
+
"registry.state",
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return state;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Ověří callability jedné již read-once zachycené public Core metody.
|
|
160
|
+
*/
|
|
161
|
+
function requireRegistryMethod(value: unknown, field: string): (...args: readonly unknown[]) => unknown {
|
|
162
|
+
if (typeof value !== "function") {
|
|
163
|
+
throw createRegistryProtocolError(
|
|
164
|
+
"REACT_REGISTRY_INVALID",
|
|
165
|
+
"configuration",
|
|
166
|
+
`${field} must be callable.`,
|
|
167
|
+
field,
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return value as (...args: readonly unknown[]) => unknown;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Zachytí úplný šestipolový registry protocol v normativním pořadí.
|
|
176
|
+
*/
|
|
177
|
+
export function captureAdapterRegistryProtocol(
|
|
178
|
+
value: unknown,
|
|
179
|
+
checkpoint: AdapterRegistryProtocolCheckpoint = skipAdapterRegistryProtocolCheckpoint,
|
|
180
|
+
): AdapterRegistryProtocolSnapshot {
|
|
181
|
+
const rawRegistry = requireRegistryObject(value);
|
|
182
|
+
const registryId = readRegistryProperty(rawRegistry, "registryId", checkpoint);
|
|
183
|
+
const state = readRegistryProperty(rawRegistry, "state", checkpoint);
|
|
184
|
+
const subscribe = readRegistryProperty(rawRegistry, "subscribe", checkpoint);
|
|
185
|
+
const createSnapshot = readRegistryProperty(rawRegistry, "createSnapshot", checkpoint);
|
|
186
|
+
const listContributions = readRegistryProperty(rawRegistry, "listContributions", checkpoint);
|
|
187
|
+
const resolveContributions = readRegistryProperty(rawRegistry, "resolveContributions", checkpoint);
|
|
188
|
+
|
|
189
|
+
const validatedRegistryId = requireRegistryId(registryId, "registry.registryId");
|
|
190
|
+
const validatedState = requireRegistryState(state, "registry.state");
|
|
191
|
+
const validatedSubscribe = requireRegistryMethod(subscribe, "registry.subscribe");
|
|
192
|
+
const validatedCreateSnapshot = requireRegistryMethod(createSnapshot, "registry.createSnapshot");
|
|
193
|
+
const validatedListContributions = requireRegistryMethod(
|
|
194
|
+
listContributions,
|
|
195
|
+
"registry.listContributions",
|
|
196
|
+
);
|
|
197
|
+
const validatedResolveContributions = requireRegistryMethod(
|
|
198
|
+
resolveContributions,
|
|
199
|
+
"registry.resolveContributions",
|
|
200
|
+
);
|
|
201
|
+
const activeState = requireRegistryAvailability(validatedState, "resolve");
|
|
202
|
+
|
|
203
|
+
return Object.freeze({
|
|
204
|
+
rawRegistry,
|
|
205
|
+
registryId: validatedRegistryId,
|
|
206
|
+
initialState: activeState,
|
|
207
|
+
subscribe: validatedSubscribe as contribKitCore.ExtensionRegistry["subscribe"],
|
|
208
|
+
createSnapshot: validatedCreateSnapshot as contribKitCore.ExtensionRegistry["createSnapshot"],
|
|
209
|
+
listContributions: validatedListContributions as contribKitCore.ExtensionRegistry["listContributions"],
|
|
210
|
+
resolveContributions: validatedResolveContributions as contribKitCore.ExtensionRegistry["resolveContributions"],
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Ověří jediný live state read existujícího protocol snapshotu.
|
|
216
|
+
*/
|
|
217
|
+
export function requireAdapterRegistryAvailable(
|
|
218
|
+
protocol: AdapterRegistryProtocolSnapshot,
|
|
219
|
+
phase: AdapterRegistryAvailabilityPhase,
|
|
220
|
+
checkpoint: AdapterRegistryProtocolCheckpoint = skipAdapterRegistryProtocolCheckpoint,
|
|
221
|
+
): "active" {
|
|
222
|
+
const state = readRegistryProperty(protocol.rawRegistry, "state", checkpoint);
|
|
223
|
+
return requireRegistryAvailability(requireRegistryState(state, "registry.state"), phase);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Načte jedno pole public Core snapshotu právě jednou se zachovaným receiverem.
|
|
228
|
+
*/
|
|
229
|
+
function readSnapshotProperty(
|
|
230
|
+
snapshot: object,
|
|
231
|
+
property: "registryId" | "state" | "revision",
|
|
232
|
+
checkpoint: AdapterRegistryProtocolCheckpoint,
|
|
233
|
+
): unknown {
|
|
234
|
+
let value: unknown;
|
|
235
|
+
try {
|
|
236
|
+
value = Reflect.get(snapshot, property, snapshot);
|
|
237
|
+
} catch (cause: unknown) {
|
|
238
|
+
throw createRegistryProtocolError(
|
|
239
|
+
"REACT_REGISTRY_INVALID",
|
|
240
|
+
"configuration",
|
|
241
|
+
`Unable to read registry snapshot ${property}.`,
|
|
242
|
+
`registry.createSnapshot().${property}`,
|
|
243
|
+
cause,
|
|
244
|
+
true,
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
checkpoint();
|
|
249
|
+
return value;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Ověří public Core snapshot objekt bez čtení dalších nebo neznámých polí.
|
|
254
|
+
*/
|
|
255
|
+
function requireSnapshotObject(value: unknown): object {
|
|
256
|
+
if (typeof value !== "object" || value === null) {
|
|
257
|
+
throw createRegistryProtocolError(
|
|
258
|
+
"REACT_REGISTRY_INVALID",
|
|
259
|
+
"configuration",
|
|
260
|
+
"Registry snapshot must be a non-null object.",
|
|
261
|
+
"registry.createSnapshot()",
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return value;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Ověří revision použitelnou jako stabilní external-store version.
|
|
270
|
+
*/
|
|
271
|
+
function requireSnapshotRevision(value: unknown): number {
|
|
272
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) {
|
|
273
|
+
throw createRegistryProtocolError(
|
|
274
|
+
"REACT_REGISTRY_INVALID",
|
|
275
|
+
"configuration",
|
|
276
|
+
"Registry snapshot revision must be a non-negative safe integer.",
|
|
277
|
+
"registry.createSnapshot().revision",
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return value;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Vytvoří cache-safe primitive pre-subscribe token z public Core snapshotu.
|
|
286
|
+
*/
|
|
287
|
+
export function createAdapterRegistrySnapshotToken(
|
|
288
|
+
protocol: AdapterRegistryProtocolSnapshot,
|
|
289
|
+
checkpoint: AdapterRegistryProtocolCheckpoint = skipAdapterRegistryProtocolCheckpoint,
|
|
290
|
+
): AdapterRegistrySnapshotToken {
|
|
291
|
+
let candidate: unknown;
|
|
292
|
+
try {
|
|
293
|
+
candidate = Reflect.apply(protocol.createSnapshot, protocol.rawRegistry, []);
|
|
294
|
+
} catch (cause: unknown) {
|
|
295
|
+
throw createRegistryProtocolError(
|
|
296
|
+
"REACT_REGISTRY_INVALID",
|
|
297
|
+
"configuration",
|
|
298
|
+
"Registry snapshot creation failed.",
|
|
299
|
+
"registry.createSnapshot",
|
|
300
|
+
cause,
|
|
301
|
+
true,
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
checkpoint();
|
|
305
|
+
|
|
306
|
+
const snapshot = requireSnapshotObject(candidate);
|
|
307
|
+
const registryId = readSnapshotProperty(snapshot, "registryId", checkpoint);
|
|
308
|
+
const state = readSnapshotProperty(snapshot, "state", checkpoint);
|
|
309
|
+
const revision = readSnapshotProperty(snapshot, "revision", checkpoint);
|
|
310
|
+
const validatedRegistryId = requireRegistryId(
|
|
311
|
+
registryId,
|
|
312
|
+
"registry.createSnapshot().registryId",
|
|
313
|
+
);
|
|
314
|
+
const validatedState = requireRegistryState(
|
|
315
|
+
state,
|
|
316
|
+
"registry.createSnapshot().state",
|
|
317
|
+
);
|
|
318
|
+
const validatedRevision = requireSnapshotRevision(revision);
|
|
319
|
+
|
|
320
|
+
if (validatedRegistryId !== protocol.registryId) {
|
|
321
|
+
throw createRegistryProtocolError(
|
|
322
|
+
"REACT_REGISTRY_INVALID",
|
|
323
|
+
"configuration",
|
|
324
|
+
"Registry snapshot ID does not match the captured registry.",
|
|
325
|
+
"registry.createSnapshot().registryId",
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
return `${validatedState}:${validatedRevision}`;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Zavolá zachycenou subscriber metodu s původní raw registry jako receiverem.
|
|
334
|
+
*/
|
|
335
|
+
export function subscribeAdapterRegistry(
|
|
336
|
+
protocol: AdapterRegistryProtocolSnapshot,
|
|
337
|
+
listener: contribKitCore.RegistrySubscriber,
|
|
338
|
+
): unknown {
|
|
339
|
+
return Reflect.apply(protocol.subscribe, protocol.rawRegistry, [listener]);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Zavolá zachycený katalogový read s původní raw registry jako receiverem.
|
|
344
|
+
*/
|
|
345
|
+
export function listAdapterRegistryContributions<
|
|
346
|
+
Point extends contribKitCore.AnyExtensionPoint,
|
|
347
|
+
>(
|
|
348
|
+
protocol: AdapterRegistryProtocolSnapshot,
|
|
349
|
+
point: Point,
|
|
350
|
+
): unknown {
|
|
351
|
+
return Reflect.apply(protocol.listContributions, protocol.rawRegistry, [point]);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Zavolá zachycený resolved-view read s původní raw registry jako receiverem.
|
|
356
|
+
*/
|
|
357
|
+
export function resolveAdapterRegistryContributions<
|
|
358
|
+
Point extends contribKitCore.AnyExtensionPoint,
|
|
359
|
+
>(
|
|
360
|
+
protocol: AdapterRegistryProtocolSnapshot,
|
|
361
|
+
point: Point,
|
|
362
|
+
context: contribKitCore.ExtensionPointContext<Point>,
|
|
363
|
+
): unknown {
|
|
364
|
+
return Reflect.apply(protocol.resolveContributions, protocol.rawRegistry, [point, context]);
|
|
365
|
+
}
|