@overkill-dev/eslint-test 0.0.0-stage → 0.0.2

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 (95) hide show
  1. package/LICENSE +21 -0
  2. package/authoring/test-node-authoring.js +119 -0
  3. package/authoring/test-node-authoring.js.map +1 -0
  4. package/eslint-test/config-assertions.js +25 -0
  5. package/eslint-test/config-assertions.js.map +1 -0
  6. package/eslint-test/config-checks.js +40 -0
  7. package/eslint-test/config-checks.js.map +1 -0
  8. package/eslint-test/config-contracts.js +61 -0
  9. package/eslint-test/config-contracts.js.map +1 -0
  10. package/eslint-test/config-definition.d.ts +171 -0
  11. package/eslint-test/config-definition.d.ts.map +1 -0
  12. package/eslint-test/config-errors.js +41 -0
  13. package/eslint-test/config-errors.js.map +1 -0
  14. package/eslint-test/config-execution.js +80 -0
  15. package/eslint-test/config-execution.js.map +1 -0
  16. package/eslint-test/config-expectations.js +94 -0
  17. package/eslint-test/config-expectations.js.map +1 -0
  18. package/eslint-test/config-fixtures.js +38 -0
  19. package/eslint-test/config-fixtures.js.map +1 -0
  20. package/eslint-test/config-generation.js +37 -0
  21. package/eslint-test/config-generation.js.map +1 -0
  22. package/eslint-test/config-inventory.js +58 -0
  23. package/eslint-test/config-inventory.js.map +1 -0
  24. package/eslint-test/config-project.js +99 -0
  25. package/eslint-test/config-project.js.map +1 -0
  26. package/eslint-test/config-properties.js +63 -0
  27. package/eslint-test/config-properties.js.map +1 -0
  28. package/eslint-test/config-seeds.js +20 -0
  29. package/eslint-test/config-seeds.js.map +1 -0
  30. package/eslint-test/config-tests.d.ts +3 -0
  31. package/eslint-test/config-tests.d.ts.map +1 -0
  32. package/eslint-test/config-tests.js +88 -0
  33. package/eslint-test/config-tests.js.map +1 -0
  34. package/eslint-test/config-validation.js +99 -0
  35. package/eslint-test/config-validation.js.map +1 -0
  36. package/eslint-test/configuration-selection.js +71 -0
  37. package/eslint-test/configuration-selection.js.map +1 -0
  38. package/eslint-test/diagnostic-expectations.js +87 -0
  39. package/eslint-test/diagnostic-expectations.js.map +1 -0
  40. package/eslint-test/example-execution.js +76 -0
  41. package/eslint-test/example-execution.js.map +1 -0
  42. package/eslint-test/option-schemas.js +58 -0
  43. package/eslint-test/option-schemas.js.map +1 -0
  44. package/eslint-test/rule-definition.d.ts +56 -0
  45. package/eslint-test/rule-definition.d.ts.map +1 -0
  46. package/eslint-test/rule-examples.js +100 -0
  47. package/eslint-test/rule-examples.js.map +1 -0
  48. package/eslint-test/rule-fixes.js +34 -0
  49. package/eslint-test/rule-fixes.js.map +1 -0
  50. package/eslint-test/rule-implementation.d.ts +8 -0
  51. package/eslint-test/rule-implementation.d.ts.map +1 -0
  52. package/eslint-test/rule-implementation.js +41 -0
  53. package/eslint-test/rule-implementation.js.map +1 -0
  54. package/eslint-test/rule-inputs.js +16 -0
  55. package/eslint-test/rule-inputs.js.map +1 -0
  56. package/eslint-test/rule-observation.js +37 -0
  57. package/eslint-test/rule-observation.js.map +1 -0
  58. package/eslint-test/rule-properties.js +143 -0
  59. package/eslint-test/rule-properties.js.map +1 -0
  60. package/eslint-test/rule-tests.d.ts +3 -0
  61. package/eslint-test/rule-tests.d.ts.map +1 -0
  62. package/eslint-test/rule-tests.js +71 -0
  63. package/eslint-test/rule-tests.js.map +1 -0
  64. package/eslint-test/schema-collections.js +74 -0
  65. package/eslint-test/schema-collections.js.map +1 -0
  66. package/eslint-test/schema-generator.js +167 -0
  67. package/eslint-test/schema-generator.js.map +1 -0
  68. package/eslint-test/schema-input.js +23 -0
  69. package/eslint-test/schema-input.js.map +1 -0
  70. package/eslint-test/source-inputs.js +112 -0
  71. package/eslint-test/source-inputs.js.map +1 -0
  72. package/package.json +55 -4
  73. package/packages/eslint-test/eslint-test.entry-point.d.ts +6 -0
  74. package/packages/eslint-test/eslint-test.entry-point.d.ts.map +1 -0
  75. package/packages/eslint-test/eslint-test.entry-point.js +3 -0
  76. package/packages/eslint-test/eslint-test.entry-point.js.map +1 -0
  77. package/packages/test/authoring-input.js +27 -0
  78. package/packages/test/authoring-input.js.map +1 -0
  79. package/packages/test/authoring-source-locations.js +87 -0
  80. package/packages/test/authoring-source-locations.js.map +1 -0
  81. package/packages/test/authoring-test-data.js +133 -0
  82. package/packages/test/authoring-test-data.js.map +1 -0
  83. package/packages/test/resource-wrapper-composition.js +319 -0
  84. package/packages/test/resource-wrapper-composition.js.map +1 -0
  85. package/packages/test/resource-wrapper-data.js +80 -0
  86. package/packages/test/resource-wrapper-data.js.map +1 -0
  87. package/packages/test/resource-wrapper-runtime-scope.js +44 -0
  88. package/packages/test/resource-wrapper-runtime-scope.js.map +1 -0
  89. package/packages/test/resource-wrapper-session.js +50 -0
  90. package/packages/test/resource-wrapper-session.js.map +1 -0
  91. package/packages/test/table-authoring.js +7 -0
  92. package/packages/test/table-authoring.js.map +1 -0
  93. package/readme.md +223 -0
  94. package/software-bill-of-materials.cyclonedx.json +203 -0
  95. package/README.md +0 -3
@@ -0,0 +1,319 @@
1
+ import { attachmentsForProducer } from "@overkill-dev/resources/attachment-context";
2
+ import { forwardTestBodyFamily, attachTestBodyResourceAttachments, attachTestBodyWorkloadResolver, hasTestBodyResourceAttachments } from "@overkill-dev/engine";
3
+ import { resolvedRuntimeScenarioOwners } from "@overkill-dev/resources";
4
+ import { resourceContextForStep, resourceWrapperLifecycleError, runtimeContextForStep } from "@overkill-dev/run/resource-lifecycle";
5
+ import { directResourceEntries, bindResourceWrapperActions, ensureResourceDescriptor, lifecycleMessages, resourceWrapperSteps, stepRuntimeGraphs } from "./resource-wrapper-data.js";
6
+ import { composeRuntimeScope } from "./resource-wrapper-runtime-scope.js";
7
+ const composedResourceBodyBrand = Symbol.for('@overkill-dev/test/ComposedResourceBody');
8
+ function isComposedResourceBody(value) {
9
+ return typeof value === 'function' && Object.hasOwn(value, composedResourceBodyBrand);
10
+ }
11
+ function ensureBody(body, wrapperName) {
12
+ if (typeof body !== 'function') {
13
+ throw new TypeError(`${wrapperName}() requires a body function.`);
14
+ }
15
+ if (hasTestBodyResourceAttachments(body) && !isComposedResourceBody(body)) {
16
+ throw new TypeError(`${wrapperName}() requires first-party resource wrapper metadata for wrapped bodies.`);
17
+ }
18
+ }
19
+ function resourceHandleTransport(resource) {
20
+ if (typeof resource.serializeHandle === 'function' && typeof resource.deserializeHandle === 'function') {
21
+ return 'projected';
22
+ }
23
+ return 'local';
24
+ }
25
+ function resourceSummary(resource) {
26
+ return {
27
+ dependencies: Object.values(resource.dependencies).map(function dependencyName(dependency) {
28
+ return dependency.name;
29
+ }),
30
+ handleTransport: resourceHandleTransport(resource),
31
+ name: resource.name,
32
+ requirements: resource.requirements.map(function (requirement) {
33
+ return { ...requirement };
34
+ }),
35
+ scenarios: Object.entries(resource.scenarios).map(function scenarioSummary([name, scenario]) {
36
+ return {
37
+ default: scenario.default,
38
+ name,
39
+ timing: scenario.timing,
40
+ values: scenario.values
41
+ };
42
+ }),
43
+ scope: resource.scope,
44
+ workload: resource.workload === null ? 'independent' : 'required'
45
+ };
46
+ }
47
+ function assertUniqueResourceName(descriptorsByName, descriptor) {
48
+ const descriptorForName = descriptorsByName.get(descriptor.name);
49
+ if (descriptorForName !== undefined && descriptorForName !== descriptor) {
50
+ throw new TypeError(`Resource name "${descriptor.name}" is used by multiple descriptors.`);
51
+ }
52
+ }
53
+ function assertResourceAcyclic(traversal, descriptor, path) {
54
+ if (traversal.has(descriptor)) {
55
+ throw new TypeError(`Resource dependency cycle detected: ${path.join(' -> ')}.`);
56
+ }
57
+ }
58
+ function assertResourceCanBeRecorded(descriptorsByName, traversal, descriptor, path) {
59
+ assertUniqueResourceName(descriptorsByName, descriptor);
60
+ assertResourceAcyclic(traversal, descriptor, path);
61
+ }
62
+ function visitDependencies(collector, descriptor, path) {
63
+ for (const dependency of Object.values(descriptor.dependencies)) {
64
+ collector.visit(dependency, [...path, dependency.name]);
65
+ }
66
+ }
67
+ function createResourceGraphCollector() {
68
+ const descriptorsByName = new Map();
69
+ const resourceGraph = [];
70
+ const recorded = new Set();
71
+ const traversal = new Set();
72
+ const collector = {
73
+ resourceGraph() {
74
+ return resourceGraph;
75
+ },
76
+ visit(resource, path) {
77
+ const descriptor = ensureResourceDescriptor(resource, 'resource attachment() requires resource descriptors.');
78
+ assertResourceCanBeRecorded(descriptorsByName, traversal, descriptor, path);
79
+ descriptorsByName.set(descriptor.name, descriptor);
80
+ if (recorded.has(descriptor)) {
81
+ return;
82
+ }
83
+ traversal.add(descriptor);
84
+ visitDependencies(collector, descriptor, path);
85
+ traversal.delete(descriptor);
86
+ recorded.add(descriptor);
87
+ resourceGraph.push(resourceSummary(descriptor));
88
+ }
89
+ };
90
+ return collector;
91
+ }
92
+ function resourceAttachmentSummary(entry) {
93
+ return {
94
+ key: entry.key,
95
+ resourceName: entry.resource.name
96
+ };
97
+ }
98
+ function runtimeVariantEntries(runtimeGraph) {
99
+ return runtimeGraph.kind === 'runtime-matrix'
100
+ ? Object.values(runtimeGraph.variants)
101
+ : [{ id: runtimeGraph.name, runtime: runtimeGraph }];
102
+ }
103
+ function leafRuntimeSummary(runtimeGraph) {
104
+ return {
105
+ dimensions: runtimeGraph.dimensions,
106
+ kind: 'runtime',
107
+ name: runtimeGraph.name,
108
+ requirements: runtimeGraph.requirements.map(function (requirement) {
109
+ return { ...requirement };
110
+ }),
111
+ resources: Object.entries(runtimeGraph.resources).map(function runtimeResourceSummary([key, resource]) {
112
+ return {
113
+ key,
114
+ resourceName: resource.name
115
+ };
116
+ }),
117
+ scenarioBindings: Array.from(resolvedRuntimeScenarioOwners(runtimeGraph), function scenarioBinding([name, owner]) {
118
+ return {
119
+ default: owner.slot.default,
120
+ name,
121
+ owner: {
122
+ path: owner.path,
123
+ resourceName: owner.resource.name
124
+ },
125
+ timing: owner.slot.timing,
126
+ value: owner.value,
127
+ values: owner.slot.values
128
+ };
129
+ })
130
+ };
131
+ }
132
+ function runtimeSummary(runtimeGraph) {
133
+ if (runtimeGraph.kind === 'composed-runtimes') {
134
+ throw new TypeError('Composed runtime graphs must be flattened before summary creation.');
135
+ }
136
+ if (runtimeGraph.kind === 'runtime-matrix') {
137
+ const [firstVariant] = Object.values(runtimeGraph.variants);
138
+ if (firstVariant === undefined) {
139
+ throw new TypeError(`Runtime matrix "${runtimeGraph.name}" requires at least one variant.`);
140
+ }
141
+ return {
142
+ kind: 'runtime-matrix',
143
+ name: runtimeGraph.name,
144
+ resources: leafRuntimeSummary(firstVariant.runtime).resources,
145
+ variants: Object.values(runtimeGraph.variants).map(function variantSummary(variant) {
146
+ return {
147
+ id: variant.id,
148
+ runtime: leafRuntimeSummary(variant.runtime)
149
+ };
150
+ })
151
+ };
152
+ }
153
+ return leafRuntimeSummary(runtimeGraph);
154
+ }
155
+ function buildAttachments(directResources, runtimeGraphEntries) {
156
+ const graphCollector = createResourceGraphCollector();
157
+ for (const entry of directResources) {
158
+ graphCollector.visit(entry.resource, [entry.resource.name]);
159
+ }
160
+ for (const runtimeGraph of runtimeGraphEntries) {
161
+ if (runtimeGraph.kind === 'composed-runtimes') {
162
+ throw new TypeError('Composed runtime graphs must be flattened before resource graph collection.');
163
+ }
164
+ for (const variant of runtimeVariantEntries(runtimeGraph)) {
165
+ for (const resource of Object.values(variant.runtime.resources)) {
166
+ graphCollector.visit(resource, [resource.name]);
167
+ }
168
+ }
169
+ }
170
+ return {
171
+ directResources: directResources.map(resourceAttachmentSummary),
172
+ resourceGraph: graphCollector.resourceGraph(),
173
+ runtimeGraphs: runtimeGraphEntries.map(runtimeSummary)
174
+ };
175
+ }
176
+ function bodyComposition(body) {
177
+ if (isComposedResourceBody(body)) {
178
+ return body[composedResourceBodyBrand];
179
+ }
180
+ return {
181
+ actions: [],
182
+ body
183
+ };
184
+ }
185
+ function invokeTestBody(body, scope) {
186
+ const result = Reflect.apply(body, undefined, [scope]);
187
+ return result;
188
+ }
189
+ function buildStepAttachments(actions) {
190
+ return buildAttachments(directResourceEntries(actions), stepRuntimeGraphs(actions));
191
+ }
192
+ function isResourceScopeInput(value) {
193
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
194
+ }
195
+ function isScopeMapResult(value) {
196
+ return isResourceScopeInput(value) && typeof Reflect.get(value, 'then') !== 'function';
197
+ }
198
+ function isResourceTestScope(value, handles) {
199
+ if (!isResourceScopeInput(value)) {
200
+ return false;
201
+ }
202
+ const resources = Object.hasOwn(value, 'resources') ? Reflect.get(value, 'resources') : {};
203
+ return isResourceScopeInput(resources) &&
204
+ Object.keys(handles).every(function hasResourceHandle(key) {
205
+ return Reflect.get(resources, key) !== undefined;
206
+ });
207
+ }
208
+ function composeResourceContext(scope, handles) {
209
+ const resources = Object.hasOwn(scope, 'resources') ? Reflect.get(scope, 'resources') : {};
210
+ if (!isResourceScopeInput(resources)) {
211
+ throw resourceWrapperLifecycleError('Resource scope composition failed.', resources);
212
+ }
213
+ for (const key of Object.keys(handles)) {
214
+ if (Object.hasOwn(resources, key)) {
215
+ throw resourceWrapperLifecycleError(`Resource scope "${key}" already exists.`, handles);
216
+ }
217
+ }
218
+ const composed = Object.freeze({
219
+ ...scope,
220
+ resources: Object.freeze({
221
+ ...resources,
222
+ ...handles
223
+ })
224
+ });
225
+ if (isResourceTestScope(composed, handles)) {
226
+ return composed;
227
+ }
228
+ throw resourceWrapperLifecycleError('Resource scope composition failed.', handles);
229
+ }
230
+ function composeMappedScope(scope, step) {
231
+ const mappedScope = Reflect.apply(step.mapScope, undefined, [scope]);
232
+ if (!isScopeMapResult(mappedScope)) {
233
+ throw new TypeError(`${step.name} must return an object.`);
234
+ }
235
+ return step.collision === 'replace-existing'
236
+ ? Object.freeze({
237
+ ...scope,
238
+ ...mappedScope
239
+ })
240
+ : Object.freeze({
241
+ ...mappedScope,
242
+ ...scope
243
+ });
244
+ }
245
+ function composeActionScope(scope, action, session) {
246
+ if (action.kind === 'resources') {
247
+ return composeResourceContext(scope, resourceContextForStep(action.resources, session.directResources));
248
+ }
249
+ if (action.kind === 'runtime') {
250
+ return composeRuntimeScope(scope, action.runtime, runtimeContextForStep(action.runtime, session));
251
+ }
252
+ return composeMappedScope(scope, action);
253
+ }
254
+ function composeActionScopes(scope, actions, session) {
255
+ return actions.reduce(function composeScope(composedScope, action) {
256
+ return composeActionScope(composedScope, action, session);
257
+ }, scope);
258
+ }
259
+ function composeMappedOnlyScopes(scope, actions) {
260
+ return actions.reduce(function composeScope(composedScope, action) {
261
+ if (action.kind !== 'scope') {
262
+ throw resourceWrapperLifecycleError('Resource scope composition failed.', action);
263
+ }
264
+ return composeMappedScope(composedScope, action);
265
+ }, scope);
266
+ }
267
+ async function acquireCompositionSession(steps, signal, messages) {
268
+ const sessionModule = await import("./resource-wrapper-session.js");
269
+ return await sessionModule.acquireComposedResources(steps, signal, messages);
270
+ }
271
+ async function disposeCompositionSession(session, messages) {
272
+ const sessionModule = await import("./resource-wrapper-session.js");
273
+ await sessionModule.disposeComposedResources(session, messages);
274
+ }
275
+ function defineComposedBodyBrand(body, composition) {
276
+ Object.defineProperty(body, composedResourceBodyBrand, {
277
+ value: Object.freeze(composition)
278
+ });
279
+ }
280
+ function attachResourceMetadata(body, actions) {
281
+ return attachTestBodyResourceAttachments(body, buildStepAttachments(actions));
282
+ }
283
+
284
+ export function attachComposedResourceActions(actions, body, wrapperName) {
285
+ ensureBody(body, wrapperName);
286
+ const composition = bodyComposition(body);
287
+ const composedActions = Object.freeze([...actions, ...composition.actions]);
288
+ const lifecycle = { steps: resourceWrapperSteps(composedActions), messages: lifecycleMessages(composedActions) };
289
+ const wrappedBody = async function runWithComposedResources(scope) {
290
+ if (lifecycle.steps.length === 0) {
291
+ return await invokeTestBody(composition.body, composeMappedOnlyScopes(scope, composedActions));
292
+ }
293
+ const session = await acquireCompositionSession(lifecycle.steps, scope.signal, lifecycle.messages);
294
+ const attachmentScope = Object.freeze({
295
+ ...scope,
296
+ attachments: attachmentsForProducer({ kind: 'case' })
297
+ });
298
+ scope.cleanup(async function cleanupComposedResources() {
299
+ await disposeCompositionSession(session, lifecycle.messages);
300
+ });
301
+ return await invokeTestBody(composition.body, composeActionScopes(attachmentScope, composedActions, session));
302
+ };
303
+ const composedBody = lifecycle.steps.length > 0
304
+ ? attachResourceMetadata(wrappedBody, composedActions)
305
+ : wrappedBody;
306
+ if (lifecycle.steps.length > 0) {
307
+ attachTestBodyWorkloadResolver(composedBody, function resolveWorkload(workload) {
308
+ const boundActions = bindResourceWrapperActions(composedActions, workload);
309
+ return forwardTestBodyFamily(composedBody, attachComposedResourceActions(boundActions, composition.body, wrapperName));
310
+ });
311
+ }
312
+ defineComposedBodyBrand(composedBody, {
313
+ actions: composedActions,
314
+ body: composition.body
315
+ });
316
+ return forwardTestBodyFamily(body, composedBody);
317
+ }
318
+
319
+ //# 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,EAAE,sBAAsB,EAAE,MAAM,4CAAgD,CAAC;AACxF,OAAO,EAEH,qBAAqB,EACrB,iCAEiC,EACjC,8BAA8B,EAC9B,8BAA8B,EAUjC,MAAM,sBAAiC,CAAC;AACzC,OAAO,EACH,6BAA6B,EAOhC,MAAM,yBAAuC,CAAC;AAC/C,OAAO,EACH,sBAAsB,EACtB,6BAA6B,EAC7B,qBAAqB,EAGxB,MAAM,sCAA0C,CAAC;AAClD,OAAO,EACH,qBAAqB,EACrB,0BAA0B,EAC1B,wBAAwB,EACxB,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EAQpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAU1E,MAAM,yBAAyB,GAAG,MAAM,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;AAcxF,SAAS,sBAAsB,CAAC,KAAc;IAC1C,OAAO,OAAO,KAAK,KAAK,UAAU,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,yBAAyB,CAAC,CAAC;A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AAC;QAEH,KAAK,CAAC,OAAO,CAAC,KAAK,UAAU,wBAAwB;YACjD,MAAM,yBAAyB,CAAC,OAAO,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,cAAc,CAAC,WAAW,CAAC,IAAI,EAAE,mBAAmB,CAAC,eAAe,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;IAClH,CAAC,CAAC;IACF,MAAM,YAAY,GAAG,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC;QAC3C,CAAC,CAAC,sBAAsB,CAAC,WAAW,EAAE,eAAe,CAAC;QACtD,CAAC,CAAC,WAAW,CAAC;IAElB,IAAI,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7B,8BAA8B,CAAC,YAAY,EAAE,SAAS,eAAe,CAAC,QAAQ;YAC1E,MAAM,YAAY,GAAG,0BAA0B,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;YAC3E,OAAO,qBAAqB,CACxB,YAAY,EACZ,6BAA6B,CACzB,YAAY,EACZ,WAAW,CAAC,IAAI,EAChB,WAAW,CACd,CACJ,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC;IAED,uBAAuB,CAAC,YAAY,EAAE;QAClC,OAAO,EAAE,eAAe;QACxB,IAAI,EAAE,WAAW,CAAC,IAAI;KACzB,CAAC,CAAC;IAEH,OAAO,qBAAqB,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;AACrD,CAAC"}
@@ -0,0 +1,80 @@
1
+ import { createWorkloadResourceBinding, bindRuntimeWorkload, 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
+
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
+
34
+ export function directResourceEntries(actions) {
35
+ return actions.flatMap(function actionResourceEntries(action) {
36
+ return action.kind === 'resources'
37
+ ? entries(action.resources).map(function resourceEntry([key, resource]) {
38
+ return { key, resource };
39
+ })
40
+ : [];
41
+ });
42
+ }
43
+ export function resourceWrapperSteps(actions) {
44
+ return actions.flatMap(function actionResourceStep(action) {
45
+ return action.kind === 'resources' || action.kind === 'runtime' ? [action] : [];
46
+ });
47
+ }
48
+ export function stepRuntimeGraphs(actions) {
49
+ return actions.flatMap(function actionRuntimeGraph(action) {
50
+ return action.kind === 'runtime' ? runtimeGraphLeaves(action.runtime) : [];
51
+ });
52
+ }
53
+ export function lifecycleMessages(actions) {
54
+ const hasDirectResources = actions.some(function actionHasDirectResources(action) {
55
+ return action.kind === 'resources';
56
+ });
57
+ return hasDirectResources
58
+ ? {
59
+ acquisitionFailure: 'Resource acquisition failed.',
60
+ disposalFailure: 'Resource disposal failed.'
61
+ }
62
+ : {
63
+ acquisitionFailure: 'Runtime resource acquisition failed.',
64
+ disposalFailure: 'Runtime resource disposal failed.'
65
+ };
66
+ }
67
+
68
+ export function bindResourceWrapperActions(actions, workload) {
69
+ const binding = createWorkloadResourceBinding(workload);
70
+ return actions.map(function bindAction(action) {
71
+ if (action.kind === 'resources') {
72
+ return { ...action, resources: binding.resources(action.resources) };
73
+ }
74
+ if (action.kind === 'runtime') {
75
+ return { ...action, runtime: bindRuntimeWorkload(action.runtime, binding) };
76
+ }
77
+ return action;
78
+ });
79
+ }
80
+ //# 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":"AACA,OAAO,EACH,6BAA6B,EAC7B,mBAAmB,oBAED,EAIrB,MAAM,yBAAuC,CAAC;AA2C/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,oBAAoB,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC;AAE4C;AAE7C,SAAS,OAA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,MAAM,UAAU,iBAAiB,CAAC,OAAyC;IACvE,MAAM,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,wBAAwB,CAAC,MAAM;QAC5E,OAAO,MAAM,CAAC,IAAI,KAAK,WAAW,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,OAAO,kBAAkB;QACrB,CAAC,CAAC;YACE,kBAAkB,EAAE,8BAA8B;YAClD,eAAe,EAAE,2BAA2B;SAC/C;QACD,CAAC,CAAC;YACE,kBAAkB,EAAE,sCAAsC;YAC1D,eAAe,EAAE,mCAAmC;SACvD,CAAC;AACV,CAAC;;MASK,UAgBU,0BAA0B,CACtC,OAAyC,EACzC,QAA8B;IAE9B,MAAM,OAAO,GAAG,6BAA6B,CAAC,QAAQ,CAAC,CAAC;IACxD,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,UAAU,CAAC,MAAM;QACzC,IAAI,MAAM,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;YAC9B,OAAO,EAAE,GAAG,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;QACzE,CAAC;QACD,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC5B,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,mBAAmB,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;QAChF,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC,CAAC,CAAC;AACP,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;AAYzF,SAAS,oBAAoB,CAAC,KAAc;IACxC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,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AED,MAAM,gBAAgB,GAAG,YAAY,CAAC,IAAI,KAAK,mBAAmB;QAC9D,CAAC,CAAC,OAAO;QACT,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACvC,MAAM,oBAAoB,GAAG,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS,iBAAiB,CAAC,WAAW;QAClG,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,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,50 @@
1
+ import { assertPerCaseResourceGraph, startResources } from "@overkill-dev/resources";
2
+ import { activeManagedLifecycle, combinedResourceEntries, composedResourceSession, directResourceEntries, resourceMapFromEntries, resourceWrapperErrorFromUnknown, resourceWrapperLifecycleError, stepRuntimeGraphs } from "@overkill-dev/run/resource-lifecycle";
3
+ async function acquireUnmanagedComposedResources(steps, signal) {
4
+ const directResources = resourceMapFromEntries(directResourceEntries(steps));
5
+ const runtimes = stepRuntimeGraphs(steps);
6
+ const combinedResources = combinedResourceEntries(steps, null);
7
+ assertPerCaseResourceGraph(combinedResources);
8
+ const session = await startResources({
9
+ resources: combinedResources,
10
+ signal
11
+ });
12
+ return composedResourceSession(directResources, runtimes, session, null);
13
+ }
14
+ export async function acquireComposedResources(steps, signal, messages) {
15
+ const managedLifecycle = activeManagedLifecycle();
16
+ if (managedLifecycle !== null) {
17
+ return await managedLifecycle.acquireComposedResources(steps, signal, messages);
18
+ }
19
+ try {
20
+ return await acquireUnmanagedComposedResources(steps, signal);
21
+ }
22
+ catch (error) {
23
+ throw resourceWrapperErrorFromUnknown(messages.acquisitionFailure, error);
24
+ }
25
+ }
26
+ function freshDisposalSignal() {
27
+ const controller = new AbortController();
28
+ return controller.signal;
29
+ }
30
+ export async function disposeComposedResources(session, messages) {
31
+ try {
32
+ await session.disposeOnce({ signal: freshDisposalSignal() });
33
+ }
34
+ catch (error) {
35
+ throw resourceWrapperLifecycleError(messages.disposalFailure, error);
36
+ }
37
+ }
38
+ export function resourceWrapperStep(resource) {
39
+ return {
40
+ kind: 'resources',
41
+ resources: Object.freeze({ [resource.name]: resource })
42
+ };
43
+ }
44
+ export function resourcesWrapperStep(resources) {
45
+ return { kind: 'resources', resources };
46
+ }
47
+ export function runtimeWrapperStep(runtime) {
48
+ return { kind: 'runtime', runtime };
49
+ }
50
+ //# 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,OAAO,EACH,0BAA0B,EAC1B,cAAc,EAIjB,MAAM,yBAAuC,CAAC;AAC/C,OAAO,EACH,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,EACtB,+BAA+B,EAC/B,6BAA6B,EAC7B,iBAAiB,EAIpB,MAAM,sCAA0C,CAAC;AAElD,KAAK,UAAU,iCAAiC,CAC5C,KAAqC,EACrC,MAAmB;IAEnB,MAAM,eAAe,GAAG,sBAAsB,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7E,MAAM,QAA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AC,CAAC;IACzE,CAAC;AACL,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"}
@@ -0,0 +1,7 @@
1
+ import "@overkill-dev/engine";
2
+ import "./authoring-test-data.js";
3
+ import "./authoring-source-locations.js";
4
+ import "./authoring-input.js";
5
+ import "./resource-wrapper-composition.js";
6
+ import "./resource-wrapper-data.js";
7
+ //# sourceMappingURL=table-authoring.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-authoring.js","sourceRoot":"","sources":["../../../../../source/packages/test/table-authoring.ts"],"names":[],"mappings":"AAAA,OAUO,sBAAiC,CAAC;AACzC,OAOO,0BAA0B,CAAC;AAClC,OAIO,iCAAiC,CAAC;AACzC,OAAgF,sBAAsB,CAAC;AACvG,OAA8C,mCAAmC,CAAC;AAClF,OAGO,4BAA4B,CAAC"}