@overkill-dev/test 0.0.13 → 0.0.15

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.
Files changed (67) hide show
  1. package/package.json +18 -12
  2. package/packages/test/authoring-input.js +34 -0
  3. package/packages/test/authoring-input.js.map +1 -0
  4. package/packages/test/authoring-source-locations.js +19 -3
  5. package/packages/test/authoring-source-locations.js.map +1 -1
  6. package/packages/test/authoring-test-data.d.ts +58 -0
  7. package/packages/test/authoring-test-data.d.ts.map +1 -0
  8. package/packages/test/authoring-test-data.js +194 -0
  9. package/packages/test/authoring-test-data.js.map +1 -0
  10. package/packages/test/command-line-runner.js +50 -5
  11. package/packages/test/command-line-runner.js.map +1 -1
  12. package/packages/test/compatibility.entry-point.d.ts +4 -0
  13. package/packages/test/compatibility.entry-point.d.ts.map +1 -0
  14. package/packages/test/compatibility.entry-point.js +2 -0
  15. package/packages/test/compatibility.entry-point.js.map +1 -0
  16. package/packages/test/config.entry-point.d.ts +1 -1
  17. package/packages/test/config.entry-point.d.ts.map +1 -1
  18. package/packages/test/harness-authoring.d.ts +18 -0
  19. package/packages/test/harness-authoring.d.ts.map +1 -0
  20. package/packages/test/harness-authoring.js +25 -0
  21. package/packages/test/harness-authoring.js.map +1 -0
  22. package/packages/test/interaction-transcript.d.ts +39 -0
  23. package/packages/test/interaction-transcript.d.ts.map +1 -0
  24. package/packages/test/interaction-transcript.js +302 -0
  25. package/packages/test/interaction-transcript.js.map +1 -0
  26. package/packages/test/reporters.entry-point.d.ts +1 -0
  27. package/packages/test/reporters.entry-point.d.ts.map +1 -1
  28. package/packages/test/resource-wrapper-composition.js +313 -0
  29. package/packages/test/resource-wrapper-composition.js.map +1 -0
  30. package/packages/test/resource-wrapper-data.d.ts +39 -0
  31. package/packages/test/resource-wrapper-data.d.ts.map +1 -0
  32. package/packages/test/resource-wrapper-data.js +101 -0
  33. package/packages/test/resource-wrapper-data.js.map +1 -0
  34. package/packages/test/resource-wrapper-runtime-scope.js +44 -0
  35. package/packages/test/resource-wrapper-runtime-scope.js.map +1 -0
  36. package/packages/test/resource-wrapper-session.js +3 -0
  37. package/packages/test/resource-wrapper-session.js.map +1 -0
  38. package/packages/test/resources.entry-point.d.ts +20 -1
  39. package/packages/test/resources.entry-point.d.ts.map +1 -1
  40. package/packages/test/resources.entry-point.js +46 -2
  41. package/packages/test/resources.entry-point.js.map +1 -1
  42. package/packages/test/run-seed-parser.js +8 -0
  43. package/packages/test/run-seed-parser.js.map +1 -0
  44. package/packages/test/run-shard-parser.js +32 -0
  45. package/packages/test/run-shard-parser.js.map +1 -0
  46. package/packages/test/table-authoring.d.ts +19 -0
  47. package/packages/test/table-authoring.d.ts.map +1 -0
  48. package/packages/test/table-authoring.js +77 -0
  49. package/packages/test/table-authoring.js.map +1 -0
  50. package/packages/test/test-authoring.d.ts +68 -0
  51. package/packages/test/test-authoring.d.ts.map +1 -0
  52. package/packages/test/test-authoring.js +212 -0
  53. package/packages/test/test-authoring.js.map +1 -0
  54. package/packages/test/test.entry-point.d.ts +10 -57
  55. package/packages/test/test.entry-point.d.ts.map +1 -1
  56. package/packages/test/test.entry-point.js +3 -215
  57. package/packages/test/test.entry-point.js.map +1 -1
  58. package/packages/test/throwing-test-authoring.d.ts +15 -0
  59. package/packages/test/throwing-test-authoring.d.ts.map +1 -0
  60. package/packages/test/throwing-test-authoring.js +47 -0
  61. package/packages/test/throwing-test-authoring.js.map +1 -0
  62. package/readme.md +355 -16
  63. package/sbom.cdx.json +61 -44
  64. package/packages/test/authoring-metadata.d.ts +0 -32
  65. package/packages/test/authoring-metadata.d.ts.map +0 -1
  66. package/packages/test/authoring-metadata.js +0 -98
  67. package/packages/test/authoring-metadata.js.map +0 -1
@@ -0,0 +1,313 @@
1
+ import { attachTestBodyResourceAttachments, hasTestBodyResourceAttachments } from "@overkill-dev/engine";
2
+ import { resourceContextForStep, resourceWrapperLifecycleError, runtimeContextForStep } from "@overkill-dev/run/resource-lifecycle";
3
+ import { directResourceEntries, ensureResourceDescriptor, lifecycleMessages, resourceWrapperSteps, stepRuntimeGraphs } from "./resource-wrapper-data.js";
4
+ import { composeRuntimeScope } from "./resource-wrapper-runtime-scope.js";
5
+ const composedResourceBodyBrand = Symbol.for('@overkill-dev/test/ComposedResourceBody');
6
+ function isComposedResourceBody(value) {
7
+ return typeof value === 'function' && Object.hasOwn(value, composedResourceBodyBrand);
8
+ }
9
+ function ensureBody(body, wrapperName) {
10
+ if (typeof body !== 'function') {
11
+ throw new TypeError(`${wrapperName}() requires a body function.`);
12
+ }
13
+ if (hasTestBodyResourceAttachments(body) && !isComposedResourceBody(body)) {
14
+ throw new TypeError(`${wrapperName}() requires first-party resource wrapper metadata for wrapped bodies.`);
15
+ }
16
+ }
17
+ function ensureResource(resource, wrapperName) {
18
+ return ensureResourceDescriptor(resource, `${wrapperName}() requires resource descriptors.`);
19
+ }
20
+ function entries(record) {
21
+ return Object.entries(record);
22
+ }
23
+ function requirementSummary(requirement) {
24
+ return { ...requirement };
25
+ }
26
+ function resourceSummary(resource) {
27
+ return {
28
+ dependencies: Object.values(resource.dependencies).map(function dependencyName(dependency) {
29
+ return dependency.name;
30
+ }),
31
+ name: resource.name,
32
+ requirements: resource.requirements.map(requirementSummary),
33
+ scope: resource.scope
34
+ };
35
+ }
36
+ function assertUniqueResourceName(descriptorsByName, descriptor) {
37
+ const descriptorForName = descriptorsByName.get(descriptor.name);
38
+ if (descriptorForName !== undefined && descriptorForName !== descriptor) {
39
+ throw new TypeError(`Resource name "${descriptor.name}" is used by multiple descriptors.`);
40
+ }
41
+ }
42
+ function assertResourceAcyclic(traversal, descriptor, path) {
43
+ if (traversal.has(descriptor)) {
44
+ throw new TypeError(`Resource dependency cycle detected: ${path.join(' -> ')}.`);
45
+ }
46
+ }
47
+ function assertResourceCanBeRecorded(descriptorsByName, traversal, descriptor, path) {
48
+ assertUniqueResourceName(descriptorsByName, descriptor);
49
+ assertResourceAcyclic(traversal, descriptor, path);
50
+ }
51
+ function visitDependencies(collector, descriptor, path) {
52
+ for (const [, dependency] of entries(descriptor.dependencies)) {
53
+ collector.visit(dependency, [...path, dependency.name]);
54
+ }
55
+ }
56
+ function createResourceGraphCollector() {
57
+ const descriptorsByName = new Map();
58
+ const resourceGraph = [];
59
+ const recorded = new Set();
60
+ const traversal = new Set();
61
+ const collector = {
62
+ resourceGraph() {
63
+ return resourceGraph;
64
+ },
65
+ visit(resource, path) {
66
+ const descriptor = ensureResource(resource, 'resource attachment');
67
+ assertResourceCanBeRecorded(descriptorsByName, traversal, descriptor, path);
68
+ descriptorsByName.set(descriptor.name, descriptor);
69
+ if (recorded.has(descriptor)) {
70
+ return;
71
+ }
72
+ traversal.add(descriptor);
73
+ visitDependencies(collector, descriptor, path);
74
+ traversal.delete(descriptor);
75
+ recorded.add(descriptor);
76
+ resourceGraph.push(resourceSummary(descriptor));
77
+ }
78
+ };
79
+ return collector;
80
+ }
81
+ function resourceAttachmentSummary(entry) {
82
+ return {
83
+ key: entry.key,
84
+ resourceName: entry.resource.name
85
+ };
86
+ }
87
+ function runtimeVariantEntries(runtimeGraph) {
88
+ return runtimeGraph.kind === 'runtime-matrix'
89
+ ? Object.values(runtimeGraph.variants)
90
+ : [{ id: runtimeGraph.name, runtime: runtimeGraph }];
91
+ }
92
+ function leafRuntimeSummary(runtimeGraph) {
93
+ return {
94
+ dimensions: runtimeGraph.dimensions,
95
+ kind: 'runtime',
96
+ name: runtimeGraph.name,
97
+ requirements: runtimeGraph.requirements.map(requirementSummary),
98
+ resources: entries(runtimeGraph.resources).map(function runtimeResourceSummary([key, resource]) {
99
+ return {
100
+ key,
101
+ resourceName: resource.name
102
+ };
103
+ })
104
+ };
105
+ }
106
+ function runtimeSummary(runtimeGraph) {
107
+ if (runtimeGraph.kind === 'composed-runtimes') {
108
+ throw new TypeError('Composed runtime graphs must be flattened before summary creation.');
109
+ }
110
+ if (runtimeGraph.kind === 'runtime-matrix') {
111
+ const [firstVariant] = Object.values(runtimeGraph.variants);
112
+ if (firstVariant === undefined) {
113
+ throw new TypeError(`Runtime matrix "${runtimeGraph.name}" requires at least one variant.`);
114
+ }
115
+ return {
116
+ kind: 'runtime-matrix',
117
+ name: runtimeGraph.name,
118
+ resources: leafRuntimeSummary(firstVariant.runtime).resources,
119
+ variants: Object.values(runtimeGraph.variants).map(function variantSummary(variant) {
120
+ return {
121
+ id: variant.id,
122
+ runtime: leafRuntimeSummary(variant.runtime)
123
+ };
124
+ })
125
+ };
126
+ }
127
+ return leafRuntimeSummary(runtimeGraph);
128
+ }
129
+ function buildAttachments(directResources, runtimeGraphEntries) {
130
+ const graphCollector = createResourceGraphCollector();
131
+ for (const entry of directResources) {
132
+ graphCollector.visit(entry.resource, [entry.resource.name]);
133
+ }
134
+ for (const runtimeGraph of runtimeGraphEntries) {
135
+ if (runtimeGraph.kind === 'composed-runtimes') {
136
+ throw new TypeError('Composed runtime graphs must be flattened before resource graph collection.');
137
+ }
138
+ for (const variant of runtimeVariantEntries(runtimeGraph)) {
139
+ for (const [, resource] of entries(variant.runtime.resources)) {
140
+ graphCollector.visit(resource, [resource.name]);
141
+ }
142
+ }
143
+ }
144
+ return {
145
+ directResources: directResources.map(resourceAttachmentSummary),
146
+ resourceGraph: graphCollector.resourceGraph(),
147
+ runtimeGraphs: runtimeGraphEntries.map(runtimeSummary)
148
+ };
149
+ }
150
+ function bodyComposition(body) {
151
+ if (isComposedResourceBody(body)) {
152
+ return body[composedResourceBodyBrand];
153
+ }
154
+ return {
155
+ actions: [],
156
+ body
157
+ };
158
+ }
159
+ function isPromise(value) {
160
+ return value instanceof Promise;
161
+ }
162
+ function isAssertionNode(value) {
163
+ return typeof value === 'object' &&
164
+ value !== null &&
165
+ typeof Reflect.get(value, 'check') === 'string';
166
+ }
167
+ function isAssertionResult(value) {
168
+ return isAssertionNode(value) ||
169
+ Array.isArray(value) && value.length > 0 && value.every(isAssertionNode);
170
+ }
171
+ function isTestBodyResult(value) {
172
+ return isPromise(value) || isAssertionResult(value);
173
+ }
174
+ function invokeTestBody(body, scope) {
175
+ const result = Reflect.apply(body, undefined, [scope]);
176
+ if (isTestBodyResult(result)) {
177
+ return result;
178
+ }
179
+ throw new TypeError('Resource wrapper body returned an invalid assertion result.');
180
+ }
181
+ function buildStepAttachments(actions) {
182
+ return buildAttachments(directResourceEntries(actions), stepRuntimeGraphs(actions));
183
+ }
184
+ function isResourceScopeInput(value) {
185
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
186
+ }
187
+ function isScopeMapResult(value) {
188
+ return isResourceScopeInput(value) && typeof Reflect.get(value, 'then') !== 'function';
189
+ }
190
+ function isResourceTestScope(value, handles) {
191
+ if (!isResourceScopeInput(value)) {
192
+ return false;
193
+ }
194
+ const resources = Object.hasOwn(value, 'resources') ? Reflect.get(value, 'resources') : {};
195
+ return isResourceScopeInput(resources) &&
196
+ Object.keys(handles).every(function hasResourceHandle(key) {
197
+ return Reflect.get(resources, key) !== undefined;
198
+ });
199
+ }
200
+ function composeResourceContext(scope, handles) {
201
+ const resources = Object.hasOwn(scope, 'resources') ? Reflect.get(scope, 'resources') : {};
202
+ if (!isResourceScopeInput(resources)) {
203
+ throw resourceWrapperLifecycleError('Resource scope composition failed.', resources);
204
+ }
205
+ for (const key of Object.keys(handles)) {
206
+ if (Object.hasOwn(resources, key)) {
207
+ throw resourceWrapperLifecycleError(`Resource scope "${key}" already exists.`, handles);
208
+ }
209
+ }
210
+ const composed = Object.freeze({
211
+ ...scope,
212
+ resources: Object.freeze({
213
+ ...resources,
214
+ ...handles
215
+ })
216
+ });
217
+ if (isResourceTestScope(composed, handles)) {
218
+ return composed;
219
+ }
220
+ throw resourceWrapperLifecycleError('Resource scope composition failed.', handles);
221
+ }
222
+ function composeMappedScope(scope, step) {
223
+ const mappedScope = step.mapScope(scope);
224
+ if (!isScopeMapResult(mappedScope)) {
225
+ throw new TypeError(`${step.name} must return an object.`);
226
+ }
227
+ return step.collision === 'replace-existing'
228
+ ? Object.freeze({
229
+ ...scope,
230
+ ...mappedScope
231
+ })
232
+ : Object.freeze({
233
+ ...mappedScope,
234
+ ...scope
235
+ });
236
+ }
237
+ function composeActionScope(scope, action, session) {
238
+ if (action.kind === 'resources') {
239
+ return composeResourceContext(scope, resourceContextForStep(action.resources, session.directResources));
240
+ }
241
+ if (action.kind === 'runtime') {
242
+ return composeRuntimeScope(scope, action.runtime, runtimeContextForStep(action.runtime, session));
243
+ }
244
+ return composeMappedScope(scope, action);
245
+ }
246
+ function composeActionScopes(scope, actions, session) {
247
+ return actions.reduce(function composeScope(composedScope, action) {
248
+ return composeActionScope(composedScope, action, session);
249
+ }, scope);
250
+ }
251
+ function composeMappedOnlyScopes(scope, actions) {
252
+ return actions.reduce(function composeScope(composedScope, action) {
253
+ if (action.kind !== 'scope') {
254
+ throw resourceWrapperLifecycleError('Resource scope composition failed.', action);
255
+ }
256
+ return composeMappedScope(composedScope, action);
257
+ }, scope);
258
+ }
259
+ async function importResourceWrapperSession() {
260
+ return await import("./resource-wrapper-session.js");
261
+ }
262
+ async function acquireCompositionSession(steps, signal, messages) {
263
+ const sessionModule = await importResourceWrapperSession();
264
+ return await sessionModule.acquireComposedResources(steps, signal, messages);
265
+ }
266
+ async function disposeCompositionSession(session, messages) {
267
+ const sessionModule = await importResourceWrapperSession();
268
+ await sessionModule.disposeComposedResources(session, messages);
269
+ }
270
+ function defineComposedBodyBrand(body, composition) {
271
+ Object.defineProperty(body, composedResourceBodyBrand, {
272
+ value: Object.freeze(composition)
273
+ });
274
+ }
275
+ function attachResourceMetadata(body, actions) {
276
+ return attachTestBodyResourceAttachments(body, buildStepAttachments(actions));
277
+ }
278
+ function isResourceAttachedBody(body) {
279
+ return typeof body === 'function' && hasTestBodyResourceAttachments(body);
280
+ }
281
+ export function attachComposedResourceActions(actions, body, wrapperName) {
282
+ ensureBody(body, wrapperName);
283
+ const composition = bodyComposition(body);
284
+ const composedActions = Object.freeze([...actions, ...composition.actions]);
285
+ const steps = resourceWrapperSteps(composedActions);
286
+ const messages = lifecycleMessages(composedActions);
287
+ const wrappedBody = async function runWithComposedResources(scope) {
288
+ if (steps.length === 0) {
289
+ return await invokeTestBody(composition.body, composeMappedOnlyScopes(scope, composedActions));
290
+ }
291
+ const session = await acquireCompositionSession(steps, scope.signal, messages);
292
+ scope.cleanup(async function cleanupComposedResources() {
293
+ await disposeCompositionSession(session, messages);
294
+ });
295
+ return await invokeTestBody(composition.body, composeActionScopes(scope, composedActions, session));
296
+ };
297
+ const composedBody = steps.length > 0
298
+ ? attachResourceMetadata(wrappedBody, composedActions)
299
+ : wrappedBody;
300
+ defineComposedBodyBrand(composedBody, {
301
+ actions: composedActions,
302
+ body: composition.body
303
+ });
304
+ return composedBody;
305
+ }
306
+ export function attachComposedResourceBody(step, body, wrapperName) {
307
+ const bodyWithResources = attachComposedResourceActions([step], body, wrapperName);
308
+ if (isResourceAttachedBody(bodyWithResources)) {
309
+ return bodyWithResources;
310
+ }
311
+ throw new TypeError(`${wrapperName}() requires resource wrapper metadata.`);
312
+ }
313
+ //# sourceMappingURL=resource-wrapper-composition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-wrapper-composition.js","sourceRoot":"","sources":["../../../../../source/packages/test/resource-wrapper-composition.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,iCAAiC,EACjC,8BAA8B,EAWjC,MAAM,sBAAiC,CAAC;AAUzC,OAAO,EACH,sBAAsB,EACtB,6BAA6B,EAC7B,qBAAqB,EAGxB,MAAM,sCAA0C,CAAC;AAClD,OAAO,EACH,qBAAqB,EACrB,wBAAwB,EACxB,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EAKpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAqB1E,MAAM,yBAAyB,GAAG,MAAM,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;AAcxF,SAAS,sBAAsB,CAAC,KAAc;IAC1C,OAAO,OAAO,KAAK,KAAK,UAAU,IAAI,MAAM,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AAC,CAAC,CAAC;IACxG,CAAC,CAAC;IACF,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC;QACjC,CAAC,CAAC,sBAAsB,CAAC,WAAW,EAAE,eAAe,CAAC;QACtD,CAAC,CAAC,WAAW,CAAC;IAElB,uBAAuB,CAAC,YAAY,EAAE;QAClC,OAAO,EAAE,eAAe;QACxB,IAAI,EAAE,WAAW,CAAC,IAAI;KACzB,CAAC,CAAC;IAEH,OAAO,YAAY,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,0BAA0B,CACtC,IAAyB,EACzB,IAAsB,EACtB,WAAmB;IAEnB,MAAM,iBAAiB,GAAG,6BAA6B,CACnD,CAAE,IAAI,CAAE,EACR,IAAI,EACJ,WAAW,CACd,CAAC;IAEF,IAAI,sBAAsB,CAAC,iBAAiB,CAAC,EAAE,CAAC;QAC5C,OAAO,iBAAiB,CAAC;IAC7B,CAAC;IAED,MAAM,IAAI,SAAS,CAAC,GAAG,WAAW,wCAAwC,CAAC,CAAC;AAChF,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { type AnyResourceDefinition, type ResourceMap, type RuntimeGraph } from '@overkill-dev/resources';
2
+ import type { TestScope } from '@overkill-dev/engine';
3
+ type LifecycleMessages = {
4
+ readonly acquisitionFailure: string;
5
+ readonly disposalFailure: string;
6
+ };
7
+ export type ResourceEntry = {
8
+ readonly key: string;
9
+ readonly resource: AnyResourceDefinition;
10
+ };
11
+ export type ResourceWrapperResourcesStep = {
12
+ readonly kind: 'resources';
13
+ readonly resources: ResourceMap;
14
+ };
15
+ export type ResourceWrapperRuntimeStep = {
16
+ readonly kind: 'runtime';
17
+ readonly runtime: RuntimeGraph;
18
+ };
19
+ export type ResourceWrapperScopeStep = {
20
+ readonly collision: 'preserve-existing' | 'replace-existing';
21
+ readonly kind: 'scope';
22
+ readonly mapScope: (scope: TestScope) => Readonly<Record<string, unknown>>;
23
+ readonly name: string;
24
+ };
25
+ export type ResourceWrapperStep = ResourceWrapperResourcesStep | ResourceWrapperRuntimeStep;
26
+ export type ResourceWrapperAction = ResourceWrapperScopeStep | ResourceWrapperStep;
27
+ export declare function ensureResourceDescriptor(resource: unknown, message: string): AnyResourceDefinition;
28
+ export declare function ensureRuntimeGraph(runtime: unknown, message: string): RuntimeGraph;
29
+ export declare function readResourceMap(resources: unknown, message: string): ResourceMap;
30
+ export declare function directResourceEntries(actions: readonly ResourceWrapperAction[]): readonly ResourceEntry[];
31
+ export declare function resourceWrapperSteps(actions: readonly ResourceWrapperAction[]): readonly ResourceWrapperStep[];
32
+ export declare function stepRuntimeGraphs(actions: readonly ResourceWrapperAction[]): readonly RuntimeGraph[];
33
+ export declare function lifecycleMessages(actions: readonly ResourceWrapperAction[]): LifecycleMessages;
34
+ export declare function resourceWrapperStep(resource: AnyResourceDefinition): ResourceWrapperStep;
35
+ export declare function resourcesWrapperStep(resources: ResourceMap): ResourceWrapperStep;
36
+ export declare function runtimeWrapperStep(runtime: RuntimeGraph): ResourceWrapperStep;
37
+ export declare function scopeWrapperStep(name: string, mapScope: (scope: TestScope) => Readonly<Record<string, unknown>>, collision?: ResourceWrapperScopeStep['collision']): ResourceWrapperScopeStep;
38
+ export {};
39
+ //# sourceMappingURL=resource-wrapper-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-wrapper-data.d.ts","sourceRoot":"","sources":["../../../../../source/packages/test/resource-wrapper-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EAChB,KAAK,YAAY,EACpB,MAAM,yBAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAiC,CAAC;AAMjE,KAAK,iBAAiB,GAAG;IACrB,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IACxB,QAAQ,CAAC,GAAG,EA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CAI9G;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,qBAAqB,EAAE,GAAG,SAAS,YAAY,EAAE,CAIpG;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,qBAAqB,EAAE,GAAG,iBAAiB,CAc9F;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,qBAAqB,GAAG,mBAAmB,CAKxF;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,WAAW,GAAG,mBAAmB,CAEhF;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,mBAAmB,CAE7E;AAED,wBAAgB,gBAAgB,CAC5B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACjE,SAAS,GAAE,wBAAwB,CAAC,WAAW,CAAuB,GACvE,wBAAwB,CAE1B"}
@@ -0,0 +1,101 @@
1
+ import { isDefinedRuntimeGraph, runtimeGraphLeaves } from "@overkill-dev/resources";
2
+ function isRecord(value) {
3
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
4
+ }
5
+ function hasResourceIdentity(value) {
6
+ return typeof value.name === 'string' && value.name.trim().length > 0;
7
+ }
8
+ function hasResourceGraphData(value) {
9
+ return isRecord(value.dependencies) &&
10
+ Array.isArray(value.requirements) &&
11
+ typeof value.scope === 'string';
12
+ }
13
+ function hasResourceLifecycle(value) {
14
+ return typeof value.acquire === 'function' &&
15
+ (typeof value.dispose === 'function' || value.dispose === null);
16
+ }
17
+ function isResourceDescriptor(value) {
18
+ return isRecord(value) &&
19
+ hasResourceIdentity(value) &&
20
+ hasResourceGraphData(value) &&
21
+ hasResourceLifecycle(value);
22
+ }
23
+ const isRuntimeGraph = isDefinedRuntimeGraph;
24
+ function entries(record) {
25
+ return Object.entries(record);
26
+ }
27
+ export function ensureResourceDescriptor(resource, message) {
28
+ if (isResourceDescriptor(resource)) {
29
+ return resource;
30
+ }
31
+ throw new TypeError(message);
32
+ }
33
+ export function ensureRuntimeGraph(runtime, message) {
34
+ if (isRuntimeGraph(runtime)) {
35
+ return runtime;
36
+ }
37
+ throw new TypeError(message);
38
+ }
39
+ export function readResourceMap(resources, message) {
40
+ if (!isRecord(resources)) {
41
+ throw new TypeError(message);
42
+ }
43
+ const resourceEntries = Object.entries(resources);
44
+ if (resourceEntries.length === 0) {
45
+ throw new TypeError(message);
46
+ }
47
+ const resourceMap = {};
48
+ for (const [key, resource] of resourceEntries) {
49
+ resourceMap[key] = ensureResourceDescriptor(resource, message);
50
+ }
51
+ return Object.freeze(resourceMap);
52
+ }
53
+ export function directResourceEntries(actions) {
54
+ return actions.flatMap(function actionResourceEntries(action) {
55
+ return action.kind === 'resources'
56
+ ? entries(action.resources).map(function resourceEntry([key, resource]) {
57
+ return { key, resource };
58
+ })
59
+ : [];
60
+ });
61
+ }
62
+ export function resourceWrapperSteps(actions) {
63
+ return actions.flatMap(function actionResourceStep(action) {
64
+ return action.kind === 'resources' || action.kind === 'runtime' ? [action] : [];
65
+ });
66
+ }
67
+ export function stepRuntimeGraphs(actions) {
68
+ return actions.flatMap(function actionRuntimeGraph(action) {
69
+ return action.kind === 'runtime' ? runtimeGraphLeaves(action.runtime) : [];
70
+ });
71
+ }
72
+ export function lifecycleMessages(actions) {
73
+ const hasDirectResources = actions.some(function actionHasDirectResources(action) {
74
+ return action.kind === 'resources';
75
+ });
76
+ return hasDirectResources
77
+ ? {
78
+ acquisitionFailure: 'Resource acquisition failed.',
79
+ disposalFailure: 'Resource disposal failed.'
80
+ }
81
+ : {
82
+ acquisitionFailure: 'Runtime resource acquisition failed.',
83
+ disposalFailure: 'Runtime resource disposal failed.'
84
+ };
85
+ }
86
+ export function resourceWrapperStep(resource) {
87
+ return {
88
+ kind: 'resources',
89
+ resources: Object.freeze({ [resource.name]: resource })
90
+ };
91
+ }
92
+ export function resourcesWrapperStep(resources) {
93
+ return { kind: 'resources', resources };
94
+ }
95
+ export function runtimeWrapperStep(runtime) {
96
+ return { kind: 'runtime', runtime };
97
+ }
98
+ export function scopeWrapperStep(name, mapScope, collision = 'preserve-existing') {
99
+ return { collision, kind: 'scope', mapScope, name };
100
+ }
101
+ //# sourceMappingURL=resource-wrapper-data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-wrapper-data.js","sourceRoot":"","sources":["../../../../../source/packages/test/resource-wrapper-data.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,qBAAqB,EACrB,kBAAkB,EAIrB,MAAM,yBAAuC,CAAC;AAqC/C,SAAS,QAAQ,CAAC,KAAc;IAC5B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAwC;IACjE,OAAO,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;AAC1E,CAAC;AAED,SAAS,oBAAoB,CAAC,KAAwC;IAClE,OAAO,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC;QAC/B,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC;QACjC,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,CAAC;AACxC,CAAC;AAED,SAAS,oBAAoB,CAAC,KAAwC;IAClE,OAAO,OAAO,KAAK,CAAC,OAAO,KAAK,UAAU;QACtC,CAAC,OAAO,KAAK,CAAC,OAAO,KAAK,UAAU,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC;AACxE,CAAC;AAED,SAAS,oBAAoB,CAAC,KAAc;IACxC,OAAO,QAAQ,CAAC,KAAK,CAAC;QAClB,mBAAmB,CAAC,KAAK,CAAC;QAC1B,oBAAoB,CAAC,KAAK,CAAC;QAC3B,oB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sC;YAC1D,eAAe,EAAE,mCAAmC;SACvD,CAAC;AACV,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,QAA+B;IAC/D,OAAO;QACH,IAAI,EAAE,WAAW;QACjB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC;KAC1D,CAAC;AACN,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,SAAsB;IACvD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,OAAqB;IACpD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC5B,IAAY,EACZ,QAAiE,EACjE,YAAmD,mBAAmB;IAEtE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACxD,CAAC"}
@@ -0,0 +1,44 @@
1
+ import { resourceWrapperLifecycleError } from "@overkill-dev/run/resource-lifecycle";
2
+ function isResourceScopeInput(value) {
3
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
4
+ }
5
+ function isRuntimeTestScope(value, runtimeGraph) {
6
+ if (!isResourceScopeInput(value)) {
7
+ return false;
8
+ }
9
+ const runtimes = Object.hasOwn(value, 'runtimes') ? Reflect.get(value, 'runtimes') : {};
10
+ return isResourceScopeInput(runtimes) && (runtimeGraph.kind === 'composed-runtimes'
11
+ ? runtimeGraph.runtimes.every(function hasComposedRuntimeScope(runtime) {
12
+ return Reflect.get(runtimes, runtime.name) !== undefined;
13
+ })
14
+ : Reflect.get(runtimes, runtimeGraph.name) !== undefined);
15
+ }
16
+ function failRuntimeScopeComposition(handles) {
17
+ throw resourceWrapperLifecycleError('Runtime scope composition failed.', handles);
18
+ }
19
+ export function composeRuntimeScope(scope, runtimeGraph, handles) {
20
+ const runtimes = Object.hasOwn(scope, 'runtimes') ? Reflect.get(scope, 'runtimes') : {};
21
+ if (!isResourceScopeInput(runtimes)) {
22
+ throw resourceWrapperLifecycleError('Runtime scope composition failed.', runtimes);
23
+ }
24
+ const newRuntimeScopes = runtimeGraph.kind === 'composed-runtimes'
25
+ ? handles
26
+ : { [runtimeGraph.name]: handles };
27
+ const duplicateRuntimeName = Object.keys(newRuntimeScopes).find(function runtimeNameExists(runtimeName) {
28
+ return Object.hasOwn(runtimes, runtimeName);
29
+ });
30
+ if (duplicateRuntimeName !== undefined) {
31
+ throw resourceWrapperLifecycleError(`Runtime scope "${duplicateRuntimeName}" already exists.`, handles);
32
+ }
33
+ const composed = Object.freeze({
34
+ ...scope,
35
+ runtimes: Object.freeze({
36
+ ...runtimes,
37
+ ...newRuntimeScopes
38
+ })
39
+ });
40
+ return isRuntimeTestScope(composed, runtimeGraph)
41
+ ? composed
42
+ : failRuntimeScopeComposition(handles);
43
+ }
44
+ //# sourceMappingURL=resource-wrapper-runtime-scope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-wrapper-runtime-scope.js","sourceRoot":"","sources":["../../../../../source/packages/test/resource-wrapper-runtime-scope.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,6BAA6B,EAAE,MAAM,sCAA0C,CAAC;AASzF,SAAS,oBAAoB,CAAC,KAAc;IACxC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,kBAAkB,CAGzB,KAAc,EAAE,YAAmB;IACjC,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,QAAQ,GAAY,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG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AQ,EAAE,WAAW,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,IAAI,oBAAoB,KAAK,SAAS,EAAE,CAAC;QACrC,MAAM,6BAA6B,CAAC,kBAAkB,oBAAoB,mBAAmB,EAAE,OAAO,CAAC,CAAC;IAC5G,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC;QAC3B,GAAG,KAAK;QACR,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC;YACpB,GAAG,QAAQ;YACX,GAAG,gBAAgB;SACtB,CAAC;KACL,CAAC,CAAC;IAEH,OAAO,kBAAkB,CAAe,QAAQ,EAAE,YAAY,CAAC;QAC3D,CAAC,CAAC,QAAQ;QACV,CAAC,CAAC,2BAA2B,CAAC,OAAO,CAAC,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,3 @@
1
+ import "@overkill-dev/resources";
2
+ import "@overkill-dev/run/resource-lifecycle";
3
+ //# sourceMappingURL=resource-wrapper-session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-wrapper-session.js","sourceRoot":"","sources":["../../../../../source/packages/test/resource-wrapper-session.ts"],"names":[],"mappings":"AAAA,OAMO,yBAAuC,CAAC;AAC/C,OAYO,sCAA0C,CAAC"}
@@ -1,2 +1,21 @@
1
- export declare const unavailable: import("./reserved-standard-subpath.ts").UnavailableStandardSubpathApi;
1
+ import type { ResourceAttachedTestBody, TestBody, TestScope } from '@overkill-dev/engine';
2
+ import { type AnyResourceDefinition, type ResourceContext, type ResourceMap, type RuntimeGraph, type RuntimeScopeContext } from '@overkill-dev/resources';
3
+ export { composeRuntimeContext, composeRuntimes, createTemporaryDirectoryResource, defineResource, defineRuntime, defineRuntimeMatrix, ResourceLifecycleError, startRuntime } from '@overkill-dev/resources';
4
+ export type { AnyResourceDefinition, ComposedRuntimeGraph, ExecutionRequirement, ResourceContext, ResourceCreationContext, ResourceDependencies, ResourceDefinition, ResourceDefinitionInput, ResourceDisposalContext, ResourceHandle, ResourceProjectionContext, ResourceProjectionPayload, ResourceLifecycleFailure, ResourceLifecyclePhase, ResourceMap, ResourceScope, RuntimeContext, RuntimeContextComposition, RuntimeDefinition, RuntimeDefinitionInput, RuntimeDimensions, RuntimeGraphContext, RuntimeGraph, RuntimeGraphLeaf, RuntimeId, RuntimeMatrixDefinition, RuntimeMatrixDefinitionInput, RuntimeMatrixVariant, RuntimeMatrixVariantMap, RuntimeResourceMap, RuntimeScopeContext, SharedRuntimeMatrixDefinitionInput, RuntimeSession, RuntimeSessionDisposalContext, StartRuntimeRequest, TemporaryDirectoryHandle } from '@overkill-dev/resources';
5
+ export type { TestBodyDirectResourceAttachmentSummary, TestBodyExecutionRequirementSummary, TestBodyResourceAttachments, TestBodyResourceSummary, TestBodyRuntimeSummary } from '@overkill-dev/engine';
6
+ type TestBodyWithScope<Scope extends TestScope> = (scope: Scope) => ReturnType<TestBody>;
7
+ export type RuntimeTestScope<Graph extends RuntimeGraph, Scope extends TestScope = TestScope> = Scope & {
8
+ readonly runtimes: RuntimeScopeContext<Graph>;
9
+ };
10
+ export type RuntimeTestBody<Graph extends RuntimeGraph, Scope extends TestScope = TestScope> = (scope: RuntimeTestScope<Graph, Scope>) => ReturnType<TestBody>;
11
+ export type ResourceScopeContext<Resources extends ResourceMap> = ResourceContext<Resources>;
12
+ export type ResourceTestScope<Resources extends ResourceMap, Scope extends TestScope = TestScope> = Scope & {
13
+ readonly resources: ResourceScopeContext<Resources>;
14
+ };
15
+ export type ResourceTestBody<Resources extends ResourceMap, Scope extends TestScope = TestScope> = (scope: ResourceTestScope<Resources, Scope>) => ReturnType<TestBody>;
16
+ export type RuntimeWrappedTestBody<Graph extends RuntimeGraph = RuntimeGraph, Scope extends TestScope = TestScope> = Readonly<Record<never, Graph>> & ResourceAttachedTestBody<TestBodyWithScope<Scope>>;
17
+ export type ResourceWrappedTestBody<Resources extends ResourceMap = ResourceMap, Scope extends TestScope = TestScope> = Readonly<Record<never, Resources>> & ResourceAttachedTestBody<TestBodyWithScope<Scope>>;
18
+ export declare function withRuntime<Graph extends RuntimeGraph, Scope extends TestScope = TestScope>(runtimeGraph: Graph, body: RuntimeTestBody<Graph, Scope>): RuntimeWrappedTestBody<Graph, Scope>;
19
+ export declare function withResource<const Resource extends AnyResourceDefinition, Scope extends TestScope = TestScope>(resource: Resource, body: ResourceTestBody<Record<Resource['name'], Resource>, Scope>): ResourceWrappedTestBody<Record<Resource['name'], Resource>, Scope>;
20
+ export declare function withResources<const Resources extends ResourceMap, Scope extends TestScope = TestScope>(resources: Resources, body: ResourceTestBody<Resources, Scope>): ResourceWrappedTestBody<Resources, Scope>;
2
21
  //# sourceMappingURL=resources.entry-point.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resources.entry-point.d.ts","sourceRoot":"","sources":["../../../../../source/packages/test/resources.entry-point.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,wEAAmD,CAAC"}
1
+ {"version":3,"file":"resources.entry-point.d.ts","sourceRoot":"","sources":["../../../../../source/packages/test/resources.entry-point.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,wBAAwB,EACxB,QAAQ,EACR,SAAS,EACZ,MAAM,sBAAiC,CAAC;AACzC,OAAO,EAGH,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EAC3B,MAAM,yBAAuC,CAAC;AAU/C,OAAO,EACH,qBAAqB,EACrB,eAAe,EACf,gCAAgC,EAChC,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,sBAAsB,EACtB,YAAY,EACf,MAAM,yBAAuC,CAAC;AAC/C,YAAY,EACR,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,EACvB,uBAAuB,EACvB,cAAc,EACd,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,EACtB,W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,EAAE,SAAS,EACpB,IAAI,EAAE,gBAAgB,CAAC,SAAS,EAAE,KAAK,CAAC,GACzC,uBAAuB,CAAC,SAAS,EAAE,KAAK,CAAC,CAI3C"}
@@ -1,3 +1,47 @@
1
- import { createUnavailableStandardSubpathApi } from "./reserved-standard-subpath.js";
2
- export const unavailable = createUnavailableStandardSubpathApi('resources');
1
+ import { isDefinedResource, isDefinedRuntimeGraph } from "@overkill-dev/resources";
2
+ import { attachComposedResourceBody } from "./resource-wrapper-composition.js";
3
+ import { resourcesWrapperStep, resourceWrapperStep, runtimeWrapperStep } from "./resource-wrapper-data.js";
4
+ export { composeRuntimeContext, composeRuntimes, createTemporaryDirectoryResource, defineResource, defineRuntime, defineRuntimeMatrix, ResourceLifecycleError, startRuntime } from "@overkill-dev/resources";
5
+ function ensureResource(resource, wrapperName) {
6
+ if (!isDefinedResource(resource)) {
7
+ throw new TypeError(`${wrapperName}() requires resource descriptors.`);
8
+ }
9
+ return resource;
10
+ }
11
+ function ensureRuntimeGraph(runtimeGraph) {
12
+ if (!isDefinedRuntimeGraph(runtimeGraph)) {
13
+ throw new TypeError('withRuntime() requires a runtime descriptor.');
14
+ }
15
+ return runtimeGraph;
16
+ }
17
+ function isResourceMapInput(value) {
18
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
19
+ }
20
+ function readResources(resources) {
21
+ if (!isResourceMapInput(resources)) {
22
+ throw new TypeError('withResources() requires a resource descriptor map.');
23
+ }
24
+ const resourceEntries = Object.entries(resources);
25
+ if (resourceEntries.length === 0) {
26
+ throw new TypeError('withResources() requires at least one resource descriptor.');
27
+ }
28
+ return resourceEntries.map(function readResource([key, resource]) {
29
+ return {
30
+ key,
31
+ resource: ensureResource(resource, 'withResources')
32
+ };
33
+ });
34
+ }
35
+ export function withRuntime(runtimeGraph, body) {
36
+ const runtime = ensureRuntimeGraph(runtimeGraph);
37
+ return attachComposedResourceBody(runtimeWrapperStep(runtime), body, 'withRuntime');
38
+ }
39
+ export function withResource(resource, body) {
40
+ const descriptor = ensureResource(resource, 'withResource');
41
+ return attachComposedResourceBody(resourceWrapperStep(descriptor), body, 'withResource');
42
+ }
43
+ export function withResources(resources, body) {
44
+ readResources(resources);
45
+ return attachComposedResourceBody(resourcesWrapperStep(resources), body, 'withResources');
46
+ }
3
47
  //# sourceMappingURL=resources.entry-point.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resources.entry-point.js","sourceRoot":"","sources":["../../../../../source/packages/test/resources.entry-point.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mCAAmC,EAAE,MAAM,gCAAgC,CAAC;AAErF,MAAM,CAAC,MAAM,WAAW,GAAG,mCAAmC,CAAC,WAAW,CAAC,CAAC"}
1
+ {"version":3,"file":"resources.entry-point.js","sourceRoot":"","sources":["../../../../../source/packages/test/resources.entry-point.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,iBAAiB,EACjB,qBAAqB,EAMxB,MAAM,yBAAuC,CAAC;AAC/C,OAAO,EACH,0BAA0B,EAC7B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACH,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EACrB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACH,qBAAqB,EACrB,eAAe,EACf,gCAAgC,EAChC,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,sBAAsB,EACtB,YAAY,EACf,MAAM,yBAAuC,CAAC;AA0F/C,SAAS,cAAc,CAAC,QAAiB,EAAE,WAAmB;IAC1D,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,SAAS,CAAC,GAAG,WAAW,mCAAmC,CAAC,CAAC;IAC3E,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,SAAS,kBAAkB,CAAC,YAAqB;IAC7C,IAAI,CAAC,qBAAqB,CAAC,YAAY,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,SAAS,CAAC,8CAA8C,CAAC,CAAC;IACxE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