@overkill-dev/resources 0.0.1 → 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.
- package/LICENSE +21 -0
- package/package.json +32 -6
- package/packages/resources/resources.entry-point.d.ts +18 -0
- package/packages/resources/resources.entry-point.d.ts.map +1 -0
- package/packages/resources/resources.entry-point.js +25 -0
- package/packages/resources/resources.entry-point.js.map +1 -0
- package/readme.md +127 -5
- package/resources/resource-definition-shape.d.ts +53 -0
- package/resources/resource-definition-shape.d.ts.map +1 -0
- package/resources/resource-graph.d.ts +23 -0
- package/resources/resource-graph.d.ts.map +1 -0
- package/resources/resource-graph.js +151 -0
- package/resources/resource-graph.js.map +1 -0
- package/resources/resource-lifecycle-error.d.ts +19 -0
- package/resources/resource-lifecycle-error.d.ts.map +1 -0
- package/resources/resource-lifecycle-error.js +32 -0
- package/resources/resource-lifecycle-error.js.map +1 -0
- package/resources/resource-session.d.ts +28 -0
- package/resources/resource-session.d.ts.map +1 -0
- package/resources/resource-session.js +182 -0
- package/resources/resource-session.js.map +1 -0
- package/resources/resources.d.ts +149 -0
- package/resources/resources.d.ts.map +1 -0
- package/resources/resources.js +99 -0
- package/resources/resources.js.map +1 -0
- package/resources/runtime-definition.d.ts +23 -0
- package/resources/runtime-definition.d.ts.map +1 -0
- package/resources/runtime-definition.js +19 -0
- package/resources/runtime-definition.js.map +1 -0
- package/resources/runtime-lifecycle.d.ts +14 -0
- package/resources/runtime-lifecycle.d.ts.map +1 -0
- package/resources/runtime-lifecycle.js +83 -0
- package/resources/runtime-lifecycle.js.map +1 -0
- package/resources/runtime-matrix-definition.d.ts +53 -0
- package/resources/runtime-matrix-definition.d.ts.map +1 -0
- package/resources/runtime-matrix-definition.js +159 -0
- package/resources/runtime-matrix-definition.js.map +1 -0
- package/sbom.cdx.json +30 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { callableResourceDefinition, createResourceGraph, resourceEntries } from "./resource-graph.js";
|
|
2
|
+
import { lifecycleFailures, resourceLifecycleError } from "./resource-lifecycle-error.js";
|
|
3
|
+
const directResourceAcquisitionContext = {
|
|
4
|
+
acquisitionFailureMessage: 'Resource acquisition failed.',
|
|
5
|
+
fallbackResourceName: 'resource'
|
|
6
|
+
};
|
|
7
|
+
function acquiredDependencyHandles(dependencies, handles) {
|
|
8
|
+
const context = {};
|
|
9
|
+
for (const [key, resource] of resourceEntries(dependencies)) {
|
|
10
|
+
context[key] = handles.get(resource);
|
|
11
|
+
}
|
|
12
|
+
return Object.freeze(context);
|
|
13
|
+
}
|
|
14
|
+
function acquireResourceHandle(resource, context) {
|
|
15
|
+
return callableResourceDefinition(resource).acquire(context);
|
|
16
|
+
}
|
|
17
|
+
function disposeResourceHandle(dispose, handle, context) {
|
|
18
|
+
return dispose(handle, context);
|
|
19
|
+
}
|
|
20
|
+
async function disposeResource(node, handles, signal) {
|
|
21
|
+
const handle = handles.get(node.descriptor);
|
|
22
|
+
const { dispose } = callableResourceDefinition(node.descriptor);
|
|
23
|
+
if (handle === undefined || dispose === null) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
await disposeResourceHandle(dispose, handle, {
|
|
28
|
+
dependencies: acquiredDependencyHandles(node.descriptor.dependencies, handles),
|
|
29
|
+
signal
|
|
30
|
+
});
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
return { cause: error, phase: 'dispose', resourceName: node.descriptor.name };
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export async function disposeResources(order, handles, signal) {
|
|
38
|
+
const failures = [];
|
|
39
|
+
for (const node of order.toReversed()) {
|
|
40
|
+
const failure = await disposeResource(node, handles, signal);
|
|
41
|
+
if (failure !== null) {
|
|
42
|
+
failures.push(failure);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return failures;
|
|
46
|
+
}
|
|
47
|
+
async function disposeResourceSession(order, handles, signal) {
|
|
48
|
+
const failures = await disposeResources(order, handles, signal);
|
|
49
|
+
if (failures.length > 0) {
|
|
50
|
+
throw resourceLifecycleError('Resource disposal failed.', failures, failures[0]?.cause);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function createResourceAcquisition(signal, acquisitionContext) {
|
|
54
|
+
const abortController = new AbortController();
|
|
55
|
+
const acquisitionSignal = AbortSignal.any([signal, abortController.signal]);
|
|
56
|
+
const acquisitions = new Map();
|
|
57
|
+
const handles = new Map();
|
|
58
|
+
const acquisition = {
|
|
59
|
+
async acquire(graph) {
|
|
60
|
+
const results = await Promise.allSettled(graph.topLevelEntries.map(async function acquireTopLevel([, resource]) {
|
|
61
|
+
return await acquisition.resource(resource);
|
|
62
|
+
}));
|
|
63
|
+
const failures = lifecycleFailures(results, acquisitionContext.fallbackResourceName);
|
|
64
|
+
if (failures.length > 0) {
|
|
65
|
+
return await acquisition.failStartup(graph, failures);
|
|
66
|
+
}
|
|
67
|
+
return { handles };
|
|
68
|
+
},
|
|
69
|
+
async dependencies(dependencies) {
|
|
70
|
+
const context = {};
|
|
71
|
+
await Promise.all(resourceEntries(dependencies).map(async function acquireDependency([key, dependency]) {
|
|
72
|
+
context[key] = await acquisition.resource(dependency);
|
|
73
|
+
}));
|
|
74
|
+
return Object.freeze(context);
|
|
75
|
+
},
|
|
76
|
+
async failStartup(graph, failures) {
|
|
77
|
+
abortController.abort(failures[0]?.cause);
|
|
78
|
+
const disposalFailures = await disposeResources(graph.order, handles, signal);
|
|
79
|
+
throw resourceLifecycleError(acquisitionContext.acquisitionFailureMessage, [
|
|
80
|
+
...failures,
|
|
81
|
+
...disposalFailures
|
|
82
|
+
], failures[0]?.cause);
|
|
83
|
+
},
|
|
84
|
+
async resource(resource) {
|
|
85
|
+
const existingAcquisition = acquisitions.get(resource);
|
|
86
|
+
if (existingAcquisition !== undefined) {
|
|
87
|
+
return await existingAcquisition;
|
|
88
|
+
}
|
|
89
|
+
const resourceAcquisition = acquisition.start(resource);
|
|
90
|
+
acquisitions.set(resource, resourceAcquisition);
|
|
91
|
+
return await resourceAcquisition;
|
|
92
|
+
},
|
|
93
|
+
async start(resource) {
|
|
94
|
+
const dependencies = await acquisition.dependencies(resource.dependencies);
|
|
95
|
+
try {
|
|
96
|
+
const handle = await acquireResourceHandle(resource, {
|
|
97
|
+
dependencies,
|
|
98
|
+
signal: acquisitionSignal
|
|
99
|
+
});
|
|
100
|
+
handles.set(resource, handle);
|
|
101
|
+
return handle;
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
abortController.abort(error);
|
|
105
|
+
throw resourceLifecycleError(`Resource "${resource.name}" acquisition failed.`, [
|
|
106
|
+
{ cause: error, phase: 'acquire', resourceName: resource.name }
|
|
107
|
+
], error);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
return acquisition;
|
|
112
|
+
}
|
|
113
|
+
function isResourceContext(context, resources) {
|
|
114
|
+
for (const key of Object.keys(resources)) {
|
|
115
|
+
if (!Object.hasOwn(context, key)) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
function resourceContext(resources, handles) {
|
|
122
|
+
const context = {};
|
|
123
|
+
for (const [key, resource] of resourceEntries(resources)) {
|
|
124
|
+
context[key] = handles.get(resource);
|
|
125
|
+
}
|
|
126
|
+
const frozenContext = Object.freeze(context);
|
|
127
|
+
if (isResourceContext(frozenContext, resources)) {
|
|
128
|
+
return frozenContext;
|
|
129
|
+
}
|
|
130
|
+
throw resourceLifecycleError('Resource context is incomplete.', [
|
|
131
|
+
{ cause: resources, phase: 'graph', resourceName: 'resource' }
|
|
132
|
+
], resources);
|
|
133
|
+
}
|
|
134
|
+
function internalDisposalSignal() {
|
|
135
|
+
const controller = new AbortController();
|
|
136
|
+
return controller.signal;
|
|
137
|
+
}
|
|
138
|
+
export function runtimeAsyncDisposeSymbol() {
|
|
139
|
+
const value = Reflect.get(Symbol, 'asyncDispose');
|
|
140
|
+
if (typeof value !== 'symbol') {
|
|
141
|
+
throw new TypeError('Runtime does not provide Symbol.asyncDispose.');
|
|
142
|
+
}
|
|
143
|
+
return value;
|
|
144
|
+
}
|
|
145
|
+
function isResourceSession(session) {
|
|
146
|
+
return Reflect.has(session, runtimeAsyncDisposeSymbol());
|
|
147
|
+
}
|
|
148
|
+
export async function acquireResourceGraph(request, context) {
|
|
149
|
+
const graph = createResourceGraph(request.resources);
|
|
150
|
+
const acquisition = await createResourceAcquisition(request.signal, context).acquire(graph);
|
|
151
|
+
return {
|
|
152
|
+
context: resourceContext(request.resources, acquisition.handles),
|
|
153
|
+
handles: acquisition.handles,
|
|
154
|
+
order: graph.order
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
export async function startResources(request) {
|
|
158
|
+
const acquisition = await acquireResourceGraph(request, directResourceAcquisitionContext);
|
|
159
|
+
let disposal = null;
|
|
160
|
+
const session = {
|
|
161
|
+
context: acquisition.context,
|
|
162
|
+
async disposeOnce(disposalContext) {
|
|
163
|
+
if (disposal === null) {
|
|
164
|
+
disposal = disposeResourceSession(acquisition.order, acquisition.handles, disposalContext.signal);
|
|
165
|
+
}
|
|
166
|
+
await disposal;
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
Object.defineProperty(session, runtimeAsyncDisposeSymbol(), {
|
|
170
|
+
value: async function disposeResourcesWithInternalSignal() {
|
|
171
|
+
await session.disposeOnce({ signal: internalDisposalSignal() });
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
const frozenSession = Object.freeze(session);
|
|
175
|
+
if (isResourceSession(frozenSession)) {
|
|
176
|
+
return frozenSession;
|
|
177
|
+
}
|
|
178
|
+
throw resourceLifecycleError('Resource session is incomplete.', [
|
|
179
|
+
{ cause: session, phase: 'graph', resourceName: 'resource' }
|
|
180
|
+
], session);
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=resource-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-session.js","sourceRoot":"","sources":["../../../../source/resources/resource-session.ts"],"names":[],"mappings":"AAQA,OAAO,EACH,0BAA0B,EAC1B,mBAAmB,EACnB,eAAe,EAIlB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACH,iBAAiB,EACjB,sBAAsB,EAEzB,MAAM,+BAA+B,CAAC;AAwBvC,MAAM,gCAAgC,GAA+B;IACjE,yBAAyB,EAAE,8BAA8B;IACzD,oBAAoB,EAAE,UAAU;CACnC,CAAC;AAgBF,SAAS,yBAAyB,CAC9B,YAAkC,EAClC,OAAoD;IAEpD,MAAM,OAAO,GAAqC,EAAE,CAAC;IAErD,KAAK,MAAM,CAAE,GAAG,EAAE,QAAQ,CAAE,IAAI,eAAe,CAAC,YAAY,CAAC,EAAE,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACzC,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC;AAED,SAAS,qBAAqB,CAC1B,QAA+B,EAC/B,OAAsD;IAEtD,OAAO,0BAA0B,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AACjE,CAAC;AAED,SAAS,qBAAqB,CAC1B,OAAgC,EAChC,MAAe,EACf,OAAsD;IAEtD,OAAO,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACpC,CAAC;AAED,KAAK,UAAU,eAAe,CAC1B,IAAkB,EAClB,OAAoD,EACpD,MAAmB;IAEnB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5C,MAAM,EAAE,OAAO,EAAE,GAAG,0BAA0B,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAEhE,IAAI,MAAM,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QAC3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AAM,CAAC,CAAC;YACtG,CAAC;YAED,MAAM,QAAQ,CAAC;QACnB,CAAC;KACJ,CAAC;IAEF,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,yBAAyB,EAAE,EAAE;QACxD,KAAK,EAAE,KAAK,UAAU,kCAAkC;YACpD,MAAM,OAAO,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,sBAAsB,EAAE,EAAE,CAAC,CAAC;QACpE,CAAC;KACJ,CAAC,CAAC;IACH,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAE7C,IAAI,iBAAiB,CAAC,aAAa,CAAC,EAAE,CAAC;QACnC,OAAO,aAAa,CAAC;IACzB,CAAC;IAED,MAAM,sBAAsB,CAAC,iCAAiC,EAAE;QAC5D,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE;KAC/D,EAAE,OAAO,CAAC,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { defineRuntime as createRuntimeDefinition, isDefinedRuntime as isRuntimeDefinition, type RuntimeDefinition as RuntimeDefinitionDescriptor, type RuntimeDefinitionInput as RuntimeDefinitionDescriptorInput, type RuntimeDimensions as RuntimeDimensionMap, type RuntimeId as RuntimeIdentity } from './runtime-definition.ts';
|
|
2
|
+
import { composeRuntimes as composeRuntimeGraphs, defineRuntimeMatrix as createRuntimeMatrixDefinition, isDefinedRuntimeMatrix as isRuntimeMatrixDefinition, type ComposedRuntimeGraph as ComposedRuntimeGraphDescriptor, type RuntimeGraph as RuntimeGraphDescriptor, type RuntimeGraphLeaf as RuntimeGraphLeafDescriptor, type RuntimeMatrixDefinition as RuntimeMatrixDescriptor, type RuntimeMatrixDefinitionInput as RuntimeMatrixDescriptorInput, type SharedRuntimeMatrixDefinitionInput as SharedRuntimeMatrixDescriptorInput, type RuntimeMatrixVariant as RuntimeMatrixVariantDescriptor } from './runtime-matrix-definition.ts';
|
|
3
|
+
import type { AnyResourceDefinition as AnyResourceDefinitionShape, Awaitable as AwaitableShape, EmptyResourceDependencies as EmptyResourceDependenciesShape, ExecutionRequirement as ExecutionRequirementShape, ResourceDependencies as ResourceDependenciesShape, ResourceProjectionPayload as ResourceProjectionPayloadShape, ResourceScope as ResourceScopeShape, RuntimeResourceMap as RuntimeResourceMapShape, ValueOf } from './resource-definition-shape.ts';
|
|
4
|
+
export type AnyResourceDefinition = AnyResourceDefinitionShape;
|
|
5
|
+
export type Awaitable<Value> = AwaitableShape<Value>;
|
|
6
|
+
export type EmptyResourceDependencies = EmptyResourceDependenciesShape;
|
|
7
|
+
export type ExecutionRequirement = ExecutionRequirementShape;
|
|
8
|
+
export type ResourceDependencies = ResourceDependenciesShape;
|
|
9
|
+
export type ResourceProjectionPayload = ResourceProjectionPayloadShape;
|
|
10
|
+
export type ResourceScope = ResourceScopeShape;
|
|
11
|
+
export type RuntimeResourceMap = RuntimeResourceMapShape;
|
|
12
|
+
export declare const defineRuntime: typeof createRuntimeDefinition;
|
|
13
|
+
export declare const isDefinedRuntime: typeof isRuntimeDefinition;
|
|
14
|
+
export declare const isDefinedRuntimeMatrix: typeof isRuntimeMatrixDefinition;
|
|
15
|
+
export declare const composeRuntimes: typeof composeRuntimeGraphs;
|
|
16
|
+
export type RuntimeDefinition<Name extends string = string, Dimensions extends RuntimeDimensionMap = RuntimeDimensionMap, Resources extends RuntimeResourceMap = RuntimeResourceMap> = RuntimeDefinitionDescriptor<Name, Dimensions, Resources>;
|
|
17
|
+
export type RuntimeDefinitionInput<Name extends string, Dimensions extends RuntimeDimensionMap, Resources extends RuntimeResourceMap> = RuntimeDefinitionDescriptorInput<Name, Dimensions, Resources>;
|
|
18
|
+
export type RuntimeDimensions = RuntimeDimensionMap;
|
|
19
|
+
export type RuntimeGraph = RuntimeGraphDescriptor;
|
|
20
|
+
export type RuntimeGraphLeaf = RuntimeGraphLeafDescriptor;
|
|
21
|
+
export type ComposedRuntimeGraph<Runtimes extends readonly RuntimeGraphLeaf[] = readonly RuntimeGraphLeaf[]> = ComposedRuntimeGraphDescriptor<Runtimes>;
|
|
22
|
+
export type RuntimeId<Name extends string = string, Dimensions extends RuntimeDimensions = RuntimeDimensions> = RuntimeIdentity<Name, Dimensions>;
|
|
23
|
+
export type RuntimeMatrixDefinition<Name extends string = string, Variants extends RuntimeMatrixVariantMap = RuntimeMatrixVariantMap> = RuntimeMatrixDescriptor<Name, Variants>;
|
|
24
|
+
export type RuntimeMatrixDefinitionInput<Name extends string, Variants extends Readonly<Record<string, RuntimeDefinition>>> = RuntimeMatrixDescriptorInput<Name, Variants>;
|
|
25
|
+
export type SharedRuntimeMatrixDefinitionInput<Name extends string, Shared, Variants extends Readonly<Record<string, RuntimeDefinition | ((shared: Shared) => RuntimeDefinition)>>> = SharedRuntimeMatrixDescriptorInput<Name, Shared, Variants>;
|
|
26
|
+
export type RuntimeMatrixVariant<VariantId extends string = string, Runtime extends RuntimeDefinition = RuntimeDefinition> = RuntimeMatrixVariantDescriptor<VariantId, Runtime>;
|
|
27
|
+
export type RuntimeMatrixVariantMap = Readonly<Record<string, RuntimeMatrixVariant>>;
|
|
28
|
+
declare const resourceDefinitionBrand: unique symbol;
|
|
29
|
+
export type ResourceProjectionContext<Dependencies extends ResourceDependencies = EmptyResourceDependencies> = {
|
|
30
|
+
readonly dependencies: ResourceContext<Dependencies>;
|
|
31
|
+
};
|
|
32
|
+
export type ResourceHandle<Resource extends AnyResourceDefinition> = Resource extends {
|
|
33
|
+
readonly deserializeHandle?: ((payload: never, context: never) => infer ConsumerHandle) | undefined;
|
|
34
|
+
} ? ConsumerHandle : Awaited<ReturnType<Resource['acquire']>>;
|
|
35
|
+
export type ResourceContext<Resources extends ResourceDependencies> = {
|
|
36
|
+
readonly [Key in keyof Resources]: ResourceHandle<Resources[Key]>;
|
|
37
|
+
};
|
|
38
|
+
export type ResourceCreationContext<Dependencies extends ResourceDependencies = EmptyResourceDependencies> = {
|
|
39
|
+
readonly dependencies: ResourceContext<Dependencies>;
|
|
40
|
+
readonly signal: AbortSignal;
|
|
41
|
+
};
|
|
42
|
+
export type ResourceDisposalContext<Dependencies extends ResourceDependencies = EmptyResourceDependencies> = {
|
|
43
|
+
readonly dependencies: ResourceContext<Dependencies>;
|
|
44
|
+
readonly signal: AbortSignal;
|
|
45
|
+
};
|
|
46
|
+
type ResourceDefinitionBaseInput<Name extends string, Handle, Scope extends ResourceScope, Dependencies extends ResourceDependencies = EmptyResourceDependencies> = {
|
|
47
|
+
readonly acquire: (context: ResourceCreationContext<Dependencies>) => Awaitable<Handle>;
|
|
48
|
+
readonly dependencies?: Dependencies;
|
|
49
|
+
readonly dispose: ((handle: Handle, context: ResourceDisposalContext<Dependencies>) => Awaitable<void>) | null;
|
|
50
|
+
readonly name: Name;
|
|
51
|
+
readonly requirements: readonly ExecutionRequirement[];
|
|
52
|
+
readonly scope: Scope;
|
|
53
|
+
};
|
|
54
|
+
type LocalOnlyResourceDefinitionInput<Name extends string, Handle, Scope extends ResourceScope, Dependencies extends ResourceDependencies = EmptyResourceDependencies> = ResourceDefinitionBaseInput<Name, Handle, Scope, Dependencies> & {
|
|
55
|
+
readonly deserializeHandle?: never;
|
|
56
|
+
readonly serializeHandle?: never;
|
|
57
|
+
};
|
|
58
|
+
type ProjectedResourceDefinitionInput<Name extends string, OwnerHandle, Projection extends ResourceProjectionPayload, ConsumerHandle, Scope extends 'per-file' | 'per-run' | 'per-suite', Dependencies extends ResourceDependencies = EmptyResourceDependencies> = ResourceDefinitionBaseInput<Name, OwnerHandle, Scope, Dependencies> & {
|
|
59
|
+
readonly deserializeHandle: (payload: Projection, context: ResourceProjectionContext<Dependencies>) => ConsumerHandle;
|
|
60
|
+
readonly serializeHandle: (handle: OwnerHandle, context: ResourceProjectionContext<Dependencies>) => Projection;
|
|
61
|
+
};
|
|
62
|
+
export type ResourceDefinitionInput<Name extends string, Handle, Dependencies extends ResourceDependencies = EmptyResourceDependencies, Projection extends ResourceProjectionPayload = ResourceProjectionPayload, ConsumerHandle = Handle> = ValueOf<ResourceDefinitionInputOptions<Name, Handle, Dependencies, Projection, ConsumerHandle>>;
|
|
63
|
+
type ResourceDefinitionInputOptions<Name extends string, Handle, Dependencies extends ResourceDependencies, Projection extends ResourceProjectionPayload, ConsumerHandle> = {
|
|
64
|
+
readonly local: LocalResourceDefinitionInput<Name, Handle, Dependencies>;
|
|
65
|
+
readonly projected: ProjectedResourceInput<Name, Handle, Projection, ConsumerHandle, Dependencies>;
|
|
66
|
+
};
|
|
67
|
+
type LocalResourceDefinitionInput<Name extends string, Handle, Dependencies extends ResourceDependencies> = LocalCaseResourceInput<Name, Handle, Dependencies> | LocalFileResourceInput<Name, Handle, Dependencies>;
|
|
68
|
+
type LocalCaseResourceInput<Name extends string, Handle, Dependencies extends ResourceDependencies> = LocalOnlyResourceDefinitionInput<Name, Handle, 'per-case' | 'shared-per-worker', Dependencies>;
|
|
69
|
+
type LocalFileResourceInput<Name extends string, Handle, Dependencies extends ResourceDependencies> = LocalOnlyResourceDefinitionInput<Name, Handle, 'per-file' | 'per-suite', Dependencies>;
|
|
70
|
+
type ProjectedResourceInput<Name extends string, Handle, Projection extends ResourceProjectionPayload, ConsumerHandle, Dependencies extends ResourceDependencies> = ValueOf<ProjectedResourceInputOptions<Name, Handle, Projection, ConsumerHandle, Dependencies>>;
|
|
71
|
+
type ProjectedResourceInputOptions<Name extends string, Handle, Projection extends ResourceProjectionPayload, ConsumerHandle, Dependencies extends ResourceDependencies> = {
|
|
72
|
+
readonly file: ProjectedFileResourceInput<Name, Handle, Projection, ConsumerHandle, Dependencies>;
|
|
73
|
+
readonly run: ProjectedRunResourceInput<Name, Handle, Projection, ConsumerHandle, Dependencies>;
|
|
74
|
+
};
|
|
75
|
+
type ProjectedFileResourceInput<Name extends string, Handle, Projection extends ResourceProjectionPayload, ConsumerHandle, Dependencies extends ResourceDependencies> = ProjectedResourceDefinitionInput<Name, Handle, Projection, ConsumerHandle, 'per-file' | 'per-suite', Dependencies>;
|
|
76
|
+
type ProjectedRunResourceInput<Name extends string, Handle, Projection extends ResourceProjectionPayload, ConsumerHandle, Dependencies extends ResourceDependencies> = ProjectedResourceDefinitionInput<Name, Handle, Projection, ConsumerHandle, 'per-run', Dependencies>;
|
|
77
|
+
export type ResourceDefinition<Name extends string = string, OwnerHandle = unknown, Dependencies extends ResourceDependencies = ResourceDependencies, ConsumerHandle = OwnerHandle> = {
|
|
78
|
+
readonly acquire: (context: ResourceCreationContext<Dependencies>) => Awaitable<OwnerHandle>;
|
|
79
|
+
readonly dependencies: Dependencies;
|
|
80
|
+
readonly deserializeHandle?: (payload: ResourceProjectionPayload, context: ResourceProjectionContext<Dependencies>) => ConsumerHandle;
|
|
81
|
+
readonly dispose: ((handle: OwnerHandle, context: ResourceDisposalContext<Dependencies>) => Awaitable<void>) | null;
|
|
82
|
+
readonly name: Name;
|
|
83
|
+
readonly requirements: readonly ExecutionRequirement[];
|
|
84
|
+
readonly scope: ResourceScope;
|
|
85
|
+
readonly serializeHandle?: (handle: OwnerHandle, context: ResourceProjectionContext<Dependencies>) => ResourceProjectionPayload;
|
|
86
|
+
readonly [resourceDefinitionBrand]: true;
|
|
87
|
+
};
|
|
88
|
+
type UnionToIntersection<Value> = (Value extends unknown ? (value: Value) => void : never) extends (value: infer Intersection) => void ? Intersection : never;
|
|
89
|
+
type RuntimeGraphName<Graph extends RuntimeGraph> = ComposedRuntimeNames<Graph> | NamedRuntimeGraphName<Graph>;
|
|
90
|
+
type ComposedRuntimeNames<Graph extends RuntimeGraph> = Graph extends ComposedRuntimeGraph<infer Runtimes> ? RuntimeGraphName<Runtimes[number]> : never;
|
|
91
|
+
type NamedRuntimeGraphName<Graph> = Graph extends {
|
|
92
|
+
readonly name: infer Name extends string;
|
|
93
|
+
} ? Name : never;
|
|
94
|
+
type RuntimeMatrixRuntime<Matrix extends RuntimeMatrixDefinition> = Matrix['variants'][keyof Matrix['variants']]['runtime'];
|
|
95
|
+
type RuntimeGraphRuntime<Graph extends RuntimeGraphLeaf> = {
|
|
96
|
+
readonly runtime: Extract<Graph, RuntimeDefinition>;
|
|
97
|
+
readonly 'runtime-matrix': RuntimeMatrixRuntime<Extract<Graph, RuntimeMatrixDefinition>>;
|
|
98
|
+
}[Graph['kind']];
|
|
99
|
+
type RuntimeGraphResources<Runtime extends RuntimeGraphLeaf> = RuntimeGraphRuntime<Runtime>['resources'];
|
|
100
|
+
export type RuntimeContext<Runtime extends RuntimeGraphLeaf> = {
|
|
101
|
+
readonly [Key in keyof RuntimeGraphResources<Runtime>]: ResourceHandle<RuntimeGraphResources<Runtime>[Key]>;
|
|
102
|
+
};
|
|
103
|
+
export type RuntimeGraphContext<Graph extends RuntimeGraph> = Graph extends ComposedRuntimeGraph ? RuntimeScopeContext<Graph> : RuntimeContext<Extract<Graph, RuntimeGraphLeaf>>;
|
|
104
|
+
export type RuntimeScopeContext<Runtime extends RuntimeGraph> = Readonly<Runtime extends ComposedRuntimeGraph<infer Runtimes> ? UnionToIntersection<RuntimeScopeContext<Runtimes[number]>> : Record<RuntimeGraphName<Runtime>, RuntimeContext<Extract<Runtime, RuntimeGraphLeaf>>>>;
|
|
105
|
+
type EmptyRuntimeScopes = Pick<Readonly<Record<string, never>>, never>;
|
|
106
|
+
type RuntimeScopeKey<Runtime extends RuntimeGraph> = RuntimeGraphName<Runtime>;
|
|
107
|
+
type RuntimeScopes<Context> = Context extends {
|
|
108
|
+
readonly runtimes: infer Runtimes extends Readonly<Record<string, unknown>>;
|
|
109
|
+
} ? Runtimes : EmptyRuntimeScopes;
|
|
110
|
+
type RuntimeScopeGuard<Context, Runtime extends RuntimeGraph> = Extract<RuntimeScopeKey<Runtime>, keyof RuntimeScopes<Context>> extends never ? unknown : never;
|
|
111
|
+
type RuntimeScopeBaseContext<Context> = {
|
|
112
|
+
readonly [Key in keyof Context as Key extends 'runtimes' ? never : Key]: Context[Key];
|
|
113
|
+
};
|
|
114
|
+
type ComposedRuntimeScopes<BaseContext, Runtime extends RuntimeGraph> = {
|
|
115
|
+
readonly runtimes: RuntimeScopeContext<Runtime> & RuntimeScopes<BaseContext>;
|
|
116
|
+
};
|
|
117
|
+
export type RuntimeContextComposition<BaseContext, Runtime extends RuntimeGraph> = Readonly<ComposedRuntimeScopes<BaseContext, Runtime> & RuntimeScopeBaseContext<BaseContext>>;
|
|
118
|
+
export type TemporaryDirectoryHandle = {
|
|
119
|
+
readonly path: string;
|
|
120
|
+
};
|
|
121
|
+
export type ResourcesModuleDependencies = {
|
|
122
|
+
readonly createTemporaryDirectory: (pathPrefix: string) => Awaitable<string>;
|
|
123
|
+
readonly removeDirectory: (path: string) => Awaitable<void>;
|
|
124
|
+
readonly temporaryDirectoryPathPrefix: string;
|
|
125
|
+
};
|
|
126
|
+
type CreateTemporaryDirectoryResource = <const Name extends string>(name: Name) => ResourceDefinition<Name, TemporaryDirectoryHandle, EmptyResourceDependencies>;
|
|
127
|
+
export type ResourcesModule = {
|
|
128
|
+
readonly composeRuntimeContext: typeof composeRuntimeContext;
|
|
129
|
+
readonly createTemporaryDirectoryResource: CreateTemporaryDirectoryResource;
|
|
130
|
+
readonly defineResource: typeof defineResource;
|
|
131
|
+
readonly defineRuntime: typeof defineRuntime;
|
|
132
|
+
readonly defineRuntimeMatrix: typeof createRuntimeMatrixDefinition;
|
|
133
|
+
readonly composeRuntimes: typeof composeRuntimeGraphs;
|
|
134
|
+
};
|
|
135
|
+
export declare function defineResource<const Name extends string, Handle, Scope extends Exclude<ResourceScope, 'per-run'>>(definition: LocalOnlyResourceDefinitionInput<Name, Handle, Scope>): ResourceDefinition<Name, Handle, EmptyResourceDependencies>;
|
|
136
|
+
export declare function defineResource<const Name extends string, OwnerHandle, Projection extends ResourceProjectionPayload, ConsumerHandle, Scope extends 'per-file' | 'per-run' | 'per-suite'>(definition: ProjectedResourceDefinitionInput<Name, OwnerHandle, Projection, ConsumerHandle, Scope>): ResourceDefinition<Name, OwnerHandle, EmptyResourceDependencies, ConsumerHandle>;
|
|
137
|
+
export declare function defineResource<const Name extends string, Handle, Scope extends Exclude<ResourceScope, 'per-run'>, const Dependencies extends ResourceDependencies>(definition: LocalOnlyResourceDefinitionInput<Name, Handle, Scope, Dependencies> & {
|
|
138
|
+
readonly dependencies: Dependencies;
|
|
139
|
+
}): ResourceDefinition<Name, Handle, Dependencies>;
|
|
140
|
+
export declare function defineResource<const Name extends string, OwnerHandle, Projection extends ResourceProjectionPayload, ConsumerHandle, Scope extends 'per-file' | 'per-run' | 'per-suite', const Dependencies extends ResourceDependencies>(definition: ProjectedResourceDefinitionInput<Name, OwnerHandle, Projection, ConsumerHandle, Scope, Dependencies> & {
|
|
141
|
+
readonly dependencies: Dependencies;
|
|
142
|
+
}): ResourceDefinition<Name, OwnerHandle, Dependencies, ConsumerHandle>;
|
|
143
|
+
declare function composeRuntimeContext<BaseContext extends Readonly<Record<string, unknown>>, Runtime extends RuntimeGraph>(context: BaseContext & RuntimeScopeGuard<BaseContext, Runtime>, runtime: Runtime, resourceHandles: RuntimeGraphContext<Runtime>): RuntimeContextComposition<BaseContext, Runtime>;
|
|
144
|
+
export declare function createResourcesModule(dependencies: ResourcesModuleDependencies): ResourcesModule;
|
|
145
|
+
export declare function isDefinedResource(resource: unknown): resource is AnyResourceDefinition;
|
|
146
|
+
export declare function isDefinedRuntimeGraph(runtime: unknown): runtime is RuntimeGraph;
|
|
147
|
+
export declare function runtimeGraphLeaves(runtime: RuntimeGraph): readonly RuntimeGraphLeaf[];
|
|
148
|
+
export {};
|
|
149
|
+
//# sourceMappingURL=resources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../../source/resources/resources.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,IAAI,uBAAuB,EACxC,gBAAgB,IAAI,mBAAmB,EACvC,KAAK,iBAAiB,IAAI,2BAA2B,EACrD,KAAK,sBAAsB,IAAI,gCAAgC,EAC/D,KAAK,iBAAiB,IAAI,m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EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,CAAC,GAAG;IAC/G,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;CACvC,GACF,kBAAkB,CAAC,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;AAmDvE,iBAAS,qBAAqB,CAC1B,WAAW,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACrD,OAAO,SAAS,YAAY,EAE5B,OAAO,EAAE,WAAW,GAAG,iBAAiB,CAAC,WAAW,EAAE,OAAO,CAAC,EAC9D,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,mBAAmB,CAAC,OAAO,CAAC,GAC9C,yBAAyB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AAgCnD,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,2BAA2B,GAAG,eAAe,CAWhG;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,qBAAqB,CAItF;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,YAAY,CAE/E;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,SAAS,gBAAgB,EAAE,CAIrF"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { defineRuntime as createRuntimeDefinition, isDefinedRuntime as isRuntimeDefinition } from "./runtime-definition.js";
|
|
2
|
+
import { composeRuntimes as composeRuntimeGraphs, defineRuntimeMatrix as createRuntimeMatrixDefinition, isComposedRuntimeGraph, isDefinedRuntimeMatrix as isRuntimeMatrixDefinition, runtimeGraphLeaves as runtimeGraphLeafDescriptors } from "./runtime-matrix-definition.js";
|
|
3
|
+
export const defineRuntime = createRuntimeDefinition;
|
|
4
|
+
export const isDefinedRuntime = isRuntimeDefinition;
|
|
5
|
+
export const isDefinedRuntimeMatrix = isRuntimeMatrixDefinition;
|
|
6
|
+
export const composeRuntimes = composeRuntimeGraphs;
|
|
7
|
+
const resourceDefinitionBrand = Symbol('overkill.resourceDefinition');
|
|
8
|
+
function assertRuntimeContextHandles(runtime, nextRuntimes) {
|
|
9
|
+
if (!isComposedRuntimeGraph(runtime)) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
for (const childRuntime of runtime.runtimes) {
|
|
13
|
+
if (!Object.hasOwn(nextRuntimes, childRuntime.name)) {
|
|
14
|
+
throw new TypeError(`Runtime scope "${childRuntime.name}" is missing.`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function runtimeContextHandles(runtime, resourceHandles) {
|
|
19
|
+
return isComposedRuntimeGraph(runtime)
|
|
20
|
+
? resourceHandles
|
|
21
|
+
: { [runtime.name]: resourceHandles };
|
|
22
|
+
}
|
|
23
|
+
export function defineResource(definition) {
|
|
24
|
+
if (definition.dependencies === undefined) {
|
|
25
|
+
const dependencies = Object.freeze({});
|
|
26
|
+
return Object.freeze({
|
|
27
|
+
...definition,
|
|
28
|
+
dependencies,
|
|
29
|
+
[resourceDefinitionBrand]: true
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return Object.freeze({
|
|
33
|
+
...definition,
|
|
34
|
+
dependencies: Object.freeze(definition.dependencies),
|
|
35
|
+
[resourceDefinitionBrand]: true
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function createTemporaryDirectoryResource(dependencies, name) {
|
|
39
|
+
return defineResource({
|
|
40
|
+
name,
|
|
41
|
+
scope: 'per-case',
|
|
42
|
+
requirements: [],
|
|
43
|
+
async acquire(context) {
|
|
44
|
+
context.signal.throwIfAborted();
|
|
45
|
+
return Object.freeze({
|
|
46
|
+
path: await dependencies.createTemporaryDirectory(dependencies.temporaryDirectoryPathPrefix)
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
async dispose(handle) {
|
|
50
|
+
await dependencies.removeDirectory(handle.path);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function composeRuntimeContext(context, runtime, resourceHandles) {
|
|
55
|
+
const runtimes = Object.hasOwn(context, 'runtimes') ? Reflect.get(context, 'runtimes') : {};
|
|
56
|
+
if (typeof runtimes !== 'object' || runtimes === null || Array.isArray(runtimes)) {
|
|
57
|
+
throw new TypeError('composeRuntimeContext() requires context.runtimes to be an object when present.');
|
|
58
|
+
}
|
|
59
|
+
const nextRuntimes = runtimeContextHandles(runtime, resourceHandles);
|
|
60
|
+
const duplicateRuntimeName = Object.keys(nextRuntimes).find(function runtimeNameExists(runtimeName) {
|
|
61
|
+
return Object.hasOwn(runtimes, runtimeName);
|
|
62
|
+
});
|
|
63
|
+
assertRuntimeContextHandles(runtime, nextRuntimes);
|
|
64
|
+
if (duplicateRuntimeName !== undefined) {
|
|
65
|
+
throw new TypeError(`Runtime scope "${duplicateRuntimeName}" already exists.`);
|
|
66
|
+
}
|
|
67
|
+
return Object.freeze({
|
|
68
|
+
...context,
|
|
69
|
+
runtimes: Object.freeze({
|
|
70
|
+
...runtimes,
|
|
71
|
+
...nextRuntimes
|
|
72
|
+
})
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
export function createResourcesModule(dependencies) {
|
|
76
|
+
return Object.freeze({
|
|
77
|
+
composeRuntimeContext,
|
|
78
|
+
createTemporaryDirectoryResource(name) {
|
|
79
|
+
return createTemporaryDirectoryResource(dependencies, name);
|
|
80
|
+
},
|
|
81
|
+
composeRuntimes,
|
|
82
|
+
defineResource,
|
|
83
|
+
defineRuntime,
|
|
84
|
+
defineRuntimeMatrix: createRuntimeMatrixDefinition
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
export function isDefinedResource(resource) {
|
|
88
|
+
return typeof resource === 'object' &&
|
|
89
|
+
resource !== null &&
|
|
90
|
+
Reflect.get(resource, resourceDefinitionBrand) === true;
|
|
91
|
+
}
|
|
92
|
+
export function isDefinedRuntimeGraph(runtime) {
|
|
93
|
+
return isDefinedRuntime(runtime) || isDefinedRuntimeMatrix(runtime) || isComposedRuntimeGraph(runtime);
|
|
94
|
+
}
|
|
95
|
+
export function runtimeGraphLeaves(runtime) {
|
|
96
|
+
const leaves = runtimeGraphLeafDescriptors(runtime);
|
|
97
|
+
return leaves;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../../../source/resources/resources.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,IAAI,uBAAuB,EACxC,gBAAgB,IAAI,mBAAmB,EAK1C,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACH,eAAe,IAAI,oBAAoB,EACvC,mBAAmB,IAAI,6BAA6B,EACpD,sBAAsB,EACtB,sBAAsB,IAAI,yBAAyB,EACnD,kBAAkB,IAAI,2BAA2B,EAQpD,MAAM,gCAAgC,CAAC;AAsBxC,MAAM,CAAC,MAAM,aAAa,GAAG,uBAAuB,CAAC;AACrD,MAAM,CAAC,MAAM,gBAAgB,GAAG,mBAAmB,CAAC;AACpD,MAAM,CAAC,MAAM,sBAAsB,GAAG,yBAAyB,CAAC;AAChE,MAAM,CAAC,MAAM,eAAe,GAAG,oBAAoB,CAAC;AAyCpD,MAAM,uBAAuB,GAAkB,MAAM,CAAC,6BAA6B,CAAC,CAAC;AA2OrF,SAAS,2BAA2B,CAChC,OAAqB,EACrB,YAA+C;IAE/C,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAAE,CAAC;QACnC,OAAO;IACX,CAAC;IAED,KAAK,MAAM,YAAY,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QAC1C,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;YAClD,MAAM,IAAI,SAAS,CAAC,kBAAkB,YAAY,CAAC,IAAI,eAAe,CAAC,CAAC;QAC5E,CAA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AmB,EAAE,6BAA6B;KACrD,CAAC,CAAC;AACP,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,QAAiB;IAC/C,OAAO,OAAO,QAAQ,KAAK,QAAQ;QAC/B,QAAQ,KAAK,IAAI;QACjB,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,uBAAuB,CAAC,KAAK,IAAI,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,OAAgB;IAClD,OAAO,gBAAgB,CAAC,OAAO,CAAC,IAAI,sBAAsB,CAAC,OAAO,CAAC,IAAI,sBAAsB,CAAC,OAAO,CAAC,CAAC;AAC3G,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,OAAqB;IACpD,MAAM,MAAM,GAAG,2BAA2B,CAAC,OAAO,CAAC,CAAC;IAEpD,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ExecutionRequirement, RuntimeResourceMap } from './resource-definition-shape.ts';
|
|
2
|
+
declare const runtimeDefinitionBrand: unique symbol;
|
|
3
|
+
export type RuntimeDimensions = Readonly<Record<string, string>>;
|
|
4
|
+
export type RuntimeId<Name extends string = string, Dimensions extends RuntimeDimensions = RuntimeDimensions> = {
|
|
5
|
+
readonly name: Name;
|
|
6
|
+
readonly dimensions: Dimensions;
|
|
7
|
+
readonly variantId: string | null;
|
|
8
|
+
};
|
|
9
|
+
export type RuntimeDefinitionInput<Name extends string, Dimensions extends RuntimeDimensions, Resources extends RuntimeResourceMap> = {
|
|
10
|
+
readonly dimensions: Dimensions;
|
|
11
|
+
readonly name: Name;
|
|
12
|
+
readonly requirements: readonly ExecutionRequirement[];
|
|
13
|
+
readonly resources: Resources;
|
|
14
|
+
};
|
|
15
|
+
export type RuntimeDefinition<Name extends string = string, Dimensions extends RuntimeDimensions = RuntimeDimensions, Resources extends RuntimeResourceMap = RuntimeResourceMap> = RuntimeDefinitionInput<Name, Dimensions, Resources> & {
|
|
16
|
+
readonly id: RuntimeId<Name, Dimensions>;
|
|
17
|
+
readonly kind: 'runtime';
|
|
18
|
+
readonly [runtimeDefinitionBrand]: true;
|
|
19
|
+
};
|
|
20
|
+
export declare function defineRuntime<const Name extends string, const Dimensions extends RuntimeDimensions, const Resources extends RuntimeResourceMap>(definition: RuntimeDefinitionInput<Name, Dimensions, Resources>): RuntimeDefinition<Name, Dimensions, Resources>;
|
|
21
|
+
export declare function isDefinedRuntime(runtime: unknown): runtime is RuntimeDefinition;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=runtime-definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-definition.d.ts","sourceRoot":"","sources":["../../../../source/resources/runtime-definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAE/F,QAAA,MAAM,sBAAsB,EAAE,OAAO,MAA6C,CAAC;AAEnF,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEjE,MAAM,MAAM,SAAS,CACjB,IAAI,SAAS,MAAM,GAAG,MAAM,EAC5B,UAAU,SAAS,iBAAiB,GAAG,iBAAiB,IACxD;IACA,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,sBAAsB,CAC9B,IAAI,SAAS,MAAM,EACnB,UAAU,SAAS,iBAAiB,EACpC,SAAS,SAAS,kBAAkB,IACpC;IACA,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,YAAY,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACvD,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,iBAAiB,CACzB,IAAI,SAAS,MAAM,GAAG,MAAM,EAC5B,UAAU,SAAS,iBAAiB,GAAG,iBAAiB,EACxD,SAAS,SAAS,kBAAkB,GAAG,kBAAkB,IACzD,sBAAsB,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC,GAAG;IACtD,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACzC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,CAAC,sBAAsB,CAAC,EAAE,IAAI,CAAC;CAC3C,CAAC;AAEF,wBAAgB,aAAa,CACzB,KAAK,CAAC,IAAI,SAAS,MAAM,EACzB,KAAK,CAAC,UAAU,SAAS,iBAAiB,EAC1C,KAAK,CAAC,SAAS,SAAS,kBAAkB,EAE1C,UAAU,EAAE,sBAAsB,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC,GAChE,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC,CAWhD;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,iBAAiB,CAI/E"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const runtimeDefinitionBrand = Symbol('overkill.runtimeDefinition');
|
|
2
|
+
export function defineRuntime(definition) {
|
|
3
|
+
return Object.freeze({
|
|
4
|
+
...definition,
|
|
5
|
+
id: Object.freeze({
|
|
6
|
+
name: definition.name,
|
|
7
|
+
dimensions: definition.dimensions,
|
|
8
|
+
variantId: null
|
|
9
|
+
}),
|
|
10
|
+
kind: 'runtime',
|
|
11
|
+
[runtimeDefinitionBrand]: true
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export function isDefinedRuntime(runtime) {
|
|
15
|
+
return typeof runtime === 'object' &&
|
|
16
|
+
runtime !== null &&
|
|
17
|
+
Reflect.get(runtime, runtimeDefinitionBrand) === true;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=runtime-definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-definition.js","sourceRoot":"","sources":["../../../../source/resources/runtime-definition.ts"],"names":[],"mappings":"AAEA,MAAM,sBAAsB,GAAkB,MAAM,CAAC,4BAA4B,CAAC,CAAC;AAkCnF,MAAM,UAAU,aAAa,CAKzB,UAA+D;IAE/D,OAAO,MAAM,CAAC,MAAM,CAAC;QACjB,GAAG,UAAU;QACb,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC;YACd,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,UAAU,EAAE,UAAU,CAAC,UAAU;YACjC,SAAS,EAAE,IAAI;SAClB,CAAC;QACF,IAAI,EAAE,SAAS;QACf,CAAC,sBAAsB,CAAC,EAAE,IAAa;KAC1C,CAAC,CAAC;AACP,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAgB;IAC7C,OAAO,OAAO,OAAO,KAAK,QAAQ;QAC9B,OAAO,KAAK,IAAI;QAChB,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,sBAAsB,CAAC,KAAK,IAAI,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type RuntimeContext, type RuntimeDefinition } from './resources.ts';
|
|
2
|
+
export type StartRuntimeRequest<Runtime extends RuntimeDefinition> = {
|
|
3
|
+
readonly runtime: Runtime;
|
|
4
|
+
readonly signal: AbortSignal;
|
|
5
|
+
};
|
|
6
|
+
export type RuntimeSessionDisposalContext = {
|
|
7
|
+
readonly signal: AbortSignal;
|
|
8
|
+
};
|
|
9
|
+
export type RuntimeSession<Runtime extends RuntimeDefinition> = AsyncDisposable & {
|
|
10
|
+
readonly context: RuntimeContext<Runtime>;
|
|
11
|
+
readonly disposeOnce: (context: RuntimeSessionDisposalContext) => Promise<void>;
|
|
12
|
+
};
|
|
13
|
+
export declare function startRuntime<Runtime extends RuntimeDefinition>(request: StartRuntimeRequest<Runtime>): Promise<RuntimeSession<Runtime>>;
|
|
14
|
+
//# sourceMappingURL=runtime-lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-lifecycle.d.ts","sourceRoot":"","sources":["../../../../source/resources/runtime-lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,KAAK,cAAc,EACnB,KAAK,iBAAiB,EAEzB,MAAM,gBAAgB,CAAC;AAoBxB,MAAM,MAAM,mBAAmB,CAAC,OAAO,SAAS,iBAAiB,IAAI;IACjE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IACxC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,cAAc,CAAC,OAAO,SAAS,iBAAiB,IAAI,eAAe,GAAG;IAC9E,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IAC1C,QAAQ,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE,6BAA6B,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACnF,CAAC;AAqGF,wBAAsB,YAAY,CAAC,OAAO,SAAS,iBAAiB,EAChE,OAAO,EAAE,mBAAmB,CAAC,OAAO,CAAC,GACtC,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CASlC"}
|