@overkill-dev/resources 0.0.9 → 0.0.11
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/attachments/attachment-context.d.ts +8 -0
- package/attachments/attachment-context.d.ts.map +1 -0
- package/attachments/attachment-context.js +31 -0
- package/attachments/attachment-context.js.map +1 -0
- package/engine/identity.d.ts +24 -0
- package/engine/identity.d.ts.map +1 -0
- package/engine/run-artifact.d.ts +30 -0
- package/engine/run-artifact.d.ts.map +1 -0
- package/engine/runtime-attachment.d.ts +78 -0
- package/engine/runtime-attachment.d.ts.map +1 -0
- package/package.json +10 -3
- package/packages/resources/attachment-context.entry-point.d.ts +3 -0
- package/packages/resources/attachment-context.entry-point.d.ts.map +1 -0
- package/packages/resources/attachment-context.entry-point.js +2 -0
- package/packages/resources/attachment-context.entry-point.js.map +1 -0
- package/packages/resources/resources.entry-point.d.ts +3 -1
- package/packages/resources/resources.entry-point.d.ts.map +1 -1
- package/packages/resources/resources.entry-point.js.map +1 -1
- package/readme.md +63 -8
- package/resources/local-http-service-resource.d.ts +22 -2
- package/resources/local-http-service-resource.d.ts.map +1 -1
- package/resources/local-http-service-resource.js +47 -11
- package/resources/local-http-service-resource.js.map +1 -1
- package/resources/local-http-transcript-observer.js +393 -0
- package/resources/local-http-transcript-observer.js.map +1 -0
- package/resources/local-service-resource.d.ts +3 -0
- package/resources/local-service-resource.d.ts.map +1 -1
- package/resources/local-service-resource.js +2 -0
- package/resources/local-service-resource.js.map +1 -1
- package/resources/resource-definition-brand.d.ts.map +1 -1
- package/resources/resource-definition-brand.js +1 -1
- package/resources/resource-definition-brand.js.map +1 -1
- package/resources/resource-definition-types.d.ts +5 -0
- package/resources/resource-definition-types.d.ts.map +1 -1
- package/resources/resource-scenario-binding.d.ts.map +1 -1
- package/resources/resource-scenario-binding.js +2 -0
- package/resources/resource-scenario-binding.js.map +1 -1
- package/resources/resource-session.d.ts.map +1 -1
- package/resources/resource-session.js +3 -0
- package/resources/resource-session.js.map +1 -1
- package/resources/resources.d.ts +2 -0
- package/resources/resources.d.ts.map +1 -1
- package/resources/resources.js +6 -7
- package/resources/resources.js.map +1 -1
- package/resources/runtime-definition.d.ts.map +1 -1
- package/resources/runtime-definition.js +1 -1
- package/resources/runtime-definition.js.map +1 -1
- package/resources/runtime-matrix-definition.d.ts.map +1 -1
- package/resources/runtime-matrix-definition.js +2 -2
- package/resources/runtime-matrix-definition.js.map +1 -1
- package/resources/simulated-http-server-resource.d.ts +4 -0
- package/resources/simulated-http-server-resource.d.ts.map +1 -1
- package/resources/simulated-http-server-resource.js +20 -2
- package/resources/simulated-http-server-resource.js.map +1 -1
- package/sbom.cdx.json +14 -14
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AttachmentProducer, RuntimeAttachments } from '../engine/runtime-attachment.ts';
|
|
2
|
+
export type AttachmentContext = {
|
|
3
|
+
readonly forProducer: (producer: AttachmentProducer) => RuntimeAttachments;
|
|
4
|
+
};
|
|
5
|
+
export declare function attachmentsForProducer(producer: AttachmentProducer): RuntimeAttachments;
|
|
6
|
+
export declare function resourceAttachments(name: string): RuntimeAttachments;
|
|
7
|
+
export declare function runWithAttachmentContext<Value>(context: AttachmentContext, run: () => Promise<Value>): Promise<Value>;
|
|
8
|
+
//# sourceMappingURL=attachment-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment-context.d.ts","sourceRoot":"","sources":["../../../../source/attachments/attachment-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAE9F,MAAM,MAAM,iBAAiB,GAAG;IAC5B,QAAQ,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,kBAAkB,CAAC;CAC9E,CAAC;AA2BF,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,kBAAkB,CAEvF;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAEpE;AAED,wBAAsB,wBAAwB,CAAC,KAAK,EAChD,OAAO,EAAE,iBAAiB,EAC1B,GAAG,EAAE,MAAM,OAAO,CAAC,KAAK,CAAC,GAC1B,OAAO,CAAC,KAAK,CAAC,CAEhB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
+
const attachmentContextKey = Symbol.for('@overkill-dev/runtime-attachment-context/v1');
|
|
3
|
+
function isAttachmentContextStorage(value) {
|
|
4
|
+
return value instanceof AsyncLocalStorage;
|
|
5
|
+
}
|
|
6
|
+
function sharedAttachmentContext() {
|
|
7
|
+
const existing = Reflect.get(globalThis, attachmentContextKey);
|
|
8
|
+
if (isAttachmentContextStorage(existing)) {
|
|
9
|
+
return existing;
|
|
10
|
+
}
|
|
11
|
+
const created = new AsyncLocalStorage();
|
|
12
|
+
Object.defineProperty(globalThis, attachmentContextKey, { value: created });
|
|
13
|
+
return created;
|
|
14
|
+
}
|
|
15
|
+
const attachmentContext = sharedAttachmentContext();
|
|
16
|
+
function unavailableAttachments() {
|
|
17
|
+
const unavailable = async function rejectUnmanagedAttachment() {
|
|
18
|
+
throw new TypeError('Runtime attachments require runner-managed integration execution.');
|
|
19
|
+
};
|
|
20
|
+
return Object.freeze({ open: unavailable, json: unavailable, file: unavailable });
|
|
21
|
+
}
|
|
22
|
+
export function attachmentsForProducer(producer) {
|
|
23
|
+
return attachmentContext.getStore()?.forProducer(producer) ?? unavailableAttachments();
|
|
24
|
+
}
|
|
25
|
+
export function resourceAttachments(name) {
|
|
26
|
+
return attachmentsForProducer({ kind: 'resource', name });
|
|
27
|
+
}
|
|
28
|
+
export async function runWithAttachmentContext(context, run) {
|
|
29
|
+
return await attachmentContext.run(context, run);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=attachment-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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EAAE,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC1C,OAA0B,EAC1B,GAAyB;IAEzB,OAAO,MAAM,iBAAiB,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type TestId = {
|
|
2
|
+
readonly file: string | null;
|
|
3
|
+
readonly suite: readonly string[];
|
|
4
|
+
readonly title: string;
|
|
5
|
+
};
|
|
6
|
+
export type CaseId = TestId & {
|
|
7
|
+
readonly params: string | null;
|
|
8
|
+
};
|
|
9
|
+
export type RuntimeDimensions = Readonly<Record<string, string>>;
|
|
10
|
+
export type RuntimeScenarioBindings = Readonly<Record<string, string>>;
|
|
11
|
+
export type RuntimeId = {
|
|
12
|
+
readonly dimensions: RuntimeDimensions;
|
|
13
|
+
readonly name: string;
|
|
14
|
+
readonly scenarios: RuntimeScenarioBindings;
|
|
15
|
+
readonly variantId: string | null;
|
|
16
|
+
};
|
|
17
|
+
export type WorkloadId = {
|
|
18
|
+
readonly name: string;
|
|
19
|
+
readonly params: Readonly<Record<string, string>>;
|
|
20
|
+
};
|
|
21
|
+
export type AttemptId = {
|
|
22
|
+
readonly index: number;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../../source/engine/identity.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG;IACjB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AACjE,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEvE,MAAM,MAAM,SAAS,GAAG;IACpB,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAC;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,uBAAuB,CAAC;IAC5C,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACrD,CAAC;AAEF,MAAM,MA4FM,SAAS,GAAG;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CAC1B,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { AttemptId, CaseId, RuntimeId, WorkloadId } from './identity.ts';
|
|
2
|
+
export type RunArtifactScope = {
|
|
3
|
+
readonly activeCases: readonly CaseId[];
|
|
4
|
+
readonly case: CaseId;
|
|
5
|
+
readonly confidence: 'active-case' | 'concurrent-active';
|
|
6
|
+
readonly kind: 'case';
|
|
7
|
+
} | {
|
|
8
|
+
readonly kind: 'run';
|
|
9
|
+
};
|
|
10
|
+
type RunArtifactBaseId = {
|
|
11
|
+
readonly runtimes: readonly RuntimeId[];
|
|
12
|
+
readonly sequence: number;
|
|
13
|
+
readonly subtype: 'attachment' | 'coverage' | 'hedged-conflict' | 'log-capture';
|
|
14
|
+
readonly workload: WorkloadId | null;
|
|
15
|
+
};
|
|
16
|
+
type CaseArtifactId = RunArtifactBaseId & {
|
|
17
|
+
readonly attempt: AttemptId;
|
|
18
|
+
readonly scope: Extract<RunArtifactScope, {
|
|
19
|
+
readonly kind: 'case';
|
|
20
|
+
}>;
|
|
21
|
+
};
|
|
22
|
+
type RunScopedArtifactId = RunArtifactBaseId & {
|
|
23
|
+
readonly attempt: null;
|
|
24
|
+
readonly scope: {
|
|
25
|
+
readonly kind: 'run';
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export type RunArtifactId = CaseArtifactId | RunScopedArtifactId;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=run-artifact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-artifact.d.ts","sourceRoot":"","sources":["../../../../source/engine/run-artifact.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE9E,MAAM,MAAM,gBAAgB,GAAG;IAC3B,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,aAAa,GAAG,mBAAmB,CAAC;IACzD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACzB,GAAG;IACA,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;CACxB,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACrB,QAAQ,CAAC,QAAQ,EAAE,SAAS,SAAS,EAAE,CAAC;IACxC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,YAAY,GAAG,UAAU,GAAG,iBAAiB,GAAG,aAAa,CAAC;IAChF,QAAQ,CAAC,QAAQ,EAAE,UAAU,GAAG,IAAI,CAAC;CACxC,CAAC;AAEF,KAAK,cAAc,GAAG,iBAAiB,GAAG;IACtC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,gBAAgB,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;KAAE,CAAC,CAAC;CACzE,CAAC;AAEF,KAAK,mBAAmB,GAAG,iBAAiB,GAAG;IAC3C,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;KAAE,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG,mBAAmB,CAAC;AAEjE,MAAM,CAAsC,EAO3C,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { JsonValue, ReadonlyDeep } from 'type-fest';
|
|
2
|
+
import type { RunArtifactId } from './run-artifact.ts';
|
|
3
|
+
export type AttachmentMetadata = {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly mediaType: string;
|
|
6
|
+
};
|
|
7
|
+
export type AttachmentCompletion = {
|
|
8
|
+
readonly kind: 'complete';
|
|
9
|
+
} | {
|
|
10
|
+
readonly kind: 'incomplete';
|
|
11
|
+
readonly reason: 'byte-limit' | 'interrupted' | 'unclosed' | 'write-error';
|
|
12
|
+
} | {
|
|
13
|
+
readonly kind: 'truncated';
|
|
14
|
+
readonly reason: 'byte-limit';
|
|
15
|
+
};
|
|
16
|
+
export type AttachmentContent = {
|
|
17
|
+
readonly kind: 'file';
|
|
18
|
+
readonly path: string;
|
|
19
|
+
readonly byteLength: number;
|
|
20
|
+
readonly completion: Exclude<AttachmentCompletion, {
|
|
21
|
+
readonly kind: 'truncated';
|
|
22
|
+
}>;
|
|
23
|
+
} | {
|
|
24
|
+
readonly kind: 'json';
|
|
25
|
+
readonly value: ReadonlyDeep<JsonValue>;
|
|
26
|
+
readonly byteLength: number;
|
|
27
|
+
} | {
|
|
28
|
+
readonly kind: 'omitted';
|
|
29
|
+
readonly reason: 'byte-limit' | 'count-limit';
|
|
30
|
+
readonly limit: number;
|
|
31
|
+
} | {
|
|
32
|
+
readonly kind: 'text';
|
|
33
|
+
readonly text: string;
|
|
34
|
+
readonly byteLength: number;
|
|
35
|
+
readonly completion: AttachmentCompletion;
|
|
36
|
+
};
|
|
37
|
+
export type AttachmentProducer = {
|
|
38
|
+
readonly kind: 'case';
|
|
39
|
+
} | {
|
|
40
|
+
readonly kind: 'resource';
|
|
41
|
+
readonly name: string;
|
|
42
|
+
};
|
|
43
|
+
export type RuntimeAttachmentArtifact = {
|
|
44
|
+
readonly id: RunArtifactId & {
|
|
45
|
+
readonly subtype: 'attachment';
|
|
46
|
+
};
|
|
47
|
+
readonly source: 'instrumented';
|
|
48
|
+
readonly payload: AttachmentMetadata & {
|
|
49
|
+
readonly kind: 'runtime-attachment';
|
|
50
|
+
readonly capture: 'opt-in';
|
|
51
|
+
readonly capturedAtMicroseconds: number;
|
|
52
|
+
readonly producer: AttachmentProducer;
|
|
53
|
+
readonly content: AttachmentContent;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
export type AttachmentWriter<Chunk> = {
|
|
57
|
+
readonly write: (chunk: Chunk) => Promise<void>;
|
|
58
|
+
readonly close: () => Promise<RuntimeAttachmentArtifact>;
|
|
59
|
+
};
|
|
60
|
+
export type RuntimeAttachments = {
|
|
61
|
+
readonly open: {
|
|
62
|
+
(metadata: AttachmentMetadata & {
|
|
63
|
+
readonly kind: 'text';
|
|
64
|
+
}): Promise<AttachmentWriter<Uint8Array | string>>;
|
|
65
|
+
(metadata: AttachmentMetadata & {
|
|
66
|
+
readonly kind: 'binary';
|
|
67
|
+
}): Promise<AttachmentWriter<Uint8Array>>;
|
|
68
|
+
};
|
|
69
|
+
readonly json: (metadata: AttachmentMetadata, value: unknown) => Promise<RuntimeAttachmentArtifact>;
|
|
70
|
+
readonly file: (metadata: AttachmentMetadata, path: string) => Promise<RuntimeAttachmentArtifact>;
|
|
71
|
+
};
|
|
72
|
+
export type AttachmentLimits = {
|
|
73
|
+
readonly maxInlineBytes: number;
|
|
74
|
+
readonly maxArtifactBytes: number;
|
|
75
|
+
readonly maxScopeBytes: number;
|
|
76
|
+
readonly maxScopeAttachments: number;
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=runtime-attachment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-attachment.d.ts","sourceRoot":"","sources":["../../../../source/engine/runtime-attachment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,MAAM,MAAM,kBAAkB,GAAG;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAAE,GAAG;IAChE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,aAAa,GAAG,UAAU,GAAG,aAAa,CAAC;CAC9E,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;CAAE,CAAC;AAEnE,MAAM,MAAM,iBAAiB,GAAG;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,oBAAoB,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;KAAE,CAAC,CAAC;CACvF,GAAG;IACA,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACt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CAAC,IAAI,CAAC,CAAC;IAChD,QAAQ,CAAC,KAAK,EAAE,MAAM,OAAO,CAAC,yBAAyB,CAAC,CAAC;CAC5D,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC7B,QAAQ,CAAC,IAAI,EAAE;QACX,CAAC,QAAQ,EAAE,kBAAkB,GAAG;YAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;SAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC;QAC5G,CAAC,QAAQ,EAAE,kBAAkB,GAAG;YAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;SAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAC;KACxG,CAAC;IACF,QAAQ,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,kBAAkB,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACpG,QAAQ,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,yBAAyB,CAAC,CAAC;CACrG,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC3B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;CACxC,CAAC"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"url": "https://github.com/enormora/overkill/issues"
|
|
5
5
|
},
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"type-fest": "5.
|
|
7
|
+
"type-fest": "5.10.0"
|
|
8
8
|
},
|
|
9
9
|
"description": "Typed Overkill resource and runtime descriptors.",
|
|
10
10
|
"engines": {
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
".": {
|
|
15
15
|
"import": "./packages/resources/resources.entry-point.js",
|
|
16
16
|
"types": "./packages/resources/resources.entry-point.d.ts"
|
|
17
|
+
},
|
|
18
|
+
"./attachment-context": {
|
|
19
|
+
"import": "./packages/resources/attachment-context.entry-point.js",
|
|
20
|
+
"types": "./packages/resources/attachment-context.entry-point.d.ts"
|
|
17
21
|
}
|
|
18
22
|
},
|
|
19
23
|
"homepage": "https://github.com/enormora/overkill#readme",
|
|
@@ -25,15 +29,18 @@
|
|
|
25
29
|
"license": "MIT",
|
|
26
30
|
"name": "@overkill-dev/resources",
|
|
27
31
|
"peerDependencies": {
|
|
28
|
-
"@overkill-dev/simulation": "0.0.
|
|
32
|
+
"@overkill-dev/simulation": "0.0.4"
|
|
29
33
|
},
|
|
30
34
|
"repository": {
|
|
31
35
|
"type": "git",
|
|
32
36
|
"url": "git+https://github.com/enormora/overkill.git"
|
|
33
37
|
},
|
|
34
38
|
"sideEffects": [
|
|
39
|
+
"./attachments/attachment-context.js",
|
|
35
40
|
"./packages/resources/resources.entry-point.js",
|
|
41
|
+
"./resources/local-http-transcript-observer.js",
|
|
36
42
|
"./resources/local-service-resource.js",
|
|
43
|
+
"./resources/resource-definition-brand.js",
|
|
37
44
|
"./resources/resource-definition.js",
|
|
38
45
|
"./resources/resource-lifecycle-error.js",
|
|
39
46
|
"./resources/resource-scenario-binding.js",
|
|
@@ -42,5 +49,5 @@
|
|
|
42
49
|
"./resources/runtime-matrix-definition.js"
|
|
43
50
|
],
|
|
44
51
|
"type": "module",
|
|
45
|
-
"version": "0.0.
|
|
52
|
+
"version": "0.0.11"
|
|
46
53
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment-context.entry-point.d.ts","sourceRoot":"","sources":["../../../../../source/packages/resources/attachment-context.entry-point.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,EAC3B,MAAM,yCAAyC,CAAC;AACjD,YAAY,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment-context.entry-point.js","sourceRoot":"","sources":["../../../../../source/packages/resources/attachment-context.entry-point.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,EAC3B,MAAM,yCAAyC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ResourcesModule } from '../../resources/resources.ts';
|
|
2
|
+
export type { AttachmentMetadata, AttachmentWriter, AttachmentLimits, RuntimeAttachments, RuntimeAttachmentArtifact } from '../../engine/runtime-attachment.ts';
|
|
2
3
|
export { defineLocalServiceResource } from '../../resources/local-service-resource.ts';
|
|
3
4
|
export { createLocalHttpServiceResource } from '../../resources/local-http-service-resource.ts';
|
|
4
5
|
export { createLocalProcessServiceResource } from '../../resources/local-process-service-resource.ts';
|
|
@@ -18,9 +19,10 @@ export type { AnyResourceDefinition, ComposedRuntimeGraph, ExecutionRequirement,
|
|
|
18
19
|
export type { ResourceHandleExposureContext } from '../../resources/resource-definition-types.ts';
|
|
19
20
|
export type { ResourceScenarioBindingsForTiming } from '../../resources/resource-scenario.ts';
|
|
20
21
|
export type { LocalServiceAddress, LocalServiceAddressRequest, LocalServiceCreationContext, LocalServiceDisposalContext, LocalServiceHostAddressRequest, LocalServiceLoopbackAddressRequest, LocalServiceResourceDefinitionInput, LocalOnlyLocalServiceResourceDefinitionInput, ProjectedLocalServiceResourceDefinitionInput } from '../../resources/local-service-resource.ts';
|
|
21
|
-
export type { LocalHttpServiceHandle, LocalHttpServiceResourceInput } from '../../resources/local-http-service-resource.ts';
|
|
22
|
+
export type { LocalHttpResourceHandle, LocalHttpServiceHandle, LocalHttpServiceResourceInput, LocalHttpTranscriptPolicy } from '../../resources/local-http-service-resource.ts';
|
|
22
23
|
export type { LocalProcessCommand, LocalProcessOutput, LocalProcessOutputBuffer, LocalProcessOwner, LocalProcessServiceResourceInput, LocalProcessShutdown, LocalProcessSignal } from '../../resources/local-process-service-resource.ts';
|
|
23
24
|
export type { SimulatedHttpServerResource, SimulatedHttpServerResourceHandle, SimulatedHttpServerResourceOptions } from '../../resources/simulated-http-server-resource.ts';
|
|
25
|
+
export type { HttpHeadersSnapshot, HttpInteraction, HttpInteractionOutcome, HttpRequestSnapshot, HttpResponseSnapshot, HttpTranscript, HttpTranscriptEntry, RecordedHttpBody, RecordedHttpError, TranscriptEntry, TranscriptView, TranscriptCaptureErrorEntry } from '@overkill-dev/simulation/transcript';
|
|
24
26
|
export type { RuntimeDefinition as Runtime, RuntimeResourceMap as ResourceMap } from '../../resources/resources.ts';
|
|
25
27
|
export type { ResourceLifecycleFailure, ResourceLifecyclePhase } from '../../resources/resource-lifecycle-error.ts';
|
|
26
28
|
export type { ResourceSession, ResourceSessionDisposalContext, StartResourcesRequest } from '../../resources/resource-session.ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.entry-point.d.ts","sourceRoot":"","sources":["../../../../../source/packages/resources/resources.entry-point.ts"],"names":[],"mappings":"AAGA,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE3F,OAAO,EACH,0BAA0B,EAC7B,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACH,8BAA8B,EACjC,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACH,iCAAiC,EACpC,MAAM,mDAAmD,CAAC;AAY3D,eAAO,MAAM,qBAAqB,EAAE,eAAe,CAAC,uBAAuB,CAAyC,CAAC;AACrH,eAAO,MAAM,eAAe,EAAE,eAAe,CAAC,iBAAiB,CAAmC,CAAC;AACnG,eAAO,MAAM,gCAAgC,EAAE,eAAe,CAAC,kCAAkC,CAC7C,CAAC;AACrD,eAAO,MAAM,cAAc,EAAE,eAAe,CAAC,gBAAgB,CAAkC,CAAC;AAChG,eAAO,MAAM,aAAa,EAAE,eAAe,CAAC,eA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B,2BAA2B,EAC3B,8BAA8B,EAC9B,kCAAkC,EAClC,mCAAmC,EACnC,4CAA4C,EAC5C,4CAA4C,EAC/C,MAAM,2CAA2C,CAAC;AACnD,YAAY,EACR,sBAAsB,EACtB,6BAA6B,
|
|
1
|
+
{"version":3,"file":"resources.entry-point.d.ts","sourceRoot":"","sources":["../../../../../source/packages/resources/resources.entry-point.ts"],"names":[],"mappings":"AAGA,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE3F,YAAY,EACR,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,yBAAyB,EAC5B,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EACH,0BAA0B,EAC7B,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACH,8BAA8B,EACjC,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACH,iCAAiC,EACpC,MAAM,mDAAmD,CAAC;AAY3D,eAAO,MAAM,qBAAqB,EAAE,eAAe,CAAC,uBAAuB,CAAyC,CAAC;AACrH,eAAO,MAAM,eAAe,EAAE,eAAe,CAAC,iBAAiB,CAAmC,CAAC;AACnG,eAAO,MAAM,gCAAgC,EAAE,eAAe,CAAC,kCAAkC,CAC7C,CAAC;AACrD,eAAO,MAAM,cAAc,EAAE,eAAe,CAAC,gBAAgB,CAAkC,CAAC;AAChG,eAAO,MAAM,aAAa,EAAE,eAAe,CAAC,eAAe,CAAiC,CAAC;AAC7F,eAAO,MAAM,mBAAmB,EAAE,eAAe,CAAC,qBAAqB,CAAuC,CAAC;AAE/G,OAAO,EACH,iCAAiC,EACpC,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EACH,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,6BAA6B,EAC7B,kBAAkB,EACrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACH,0BAA0B,EAC1B,8BAA8B,EACjC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,E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AAC;AAC3D,YAAY,EACR,2BAA2B,EAC3B,iCAAiC,EACjC,kCAAkC,EACrC,MAAM,mDAAmD,CAAC;AAC3D,YAAY,EACR,mBAAmB,EACnB,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,2BAA2B,EAC9B,MAAM,qCAAyC,CAAC;AACjD,YAAY,EACR,iBAAiB,IAAI,OAAO,EAC5B,kBAAkB,IAAI,WAAW,EACpC,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACR,wBAAwB,EACxB,sBAAsB,EACzB,MAAM,6CAA6C,CAAC;AACrD,YAAY,EACR,eAAe,EACf,8BAA8B,EAC9B,qBAAqB,EACxB,MAAM,qCAAqC,CAAC;AAC7C,YAAY,EACR,cAAc,EACd,6BAA6B,EAC7B,mBAAmB,EACtB,MAAM,sCAAsC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.entry-point.js","sourceRoot":"","sources":["../../../../../source/packages/resources/resources.entry-point.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAwB,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"resources.entry-point.js","sourceRoot":"","sources":["../../../../../source/packages/resources/resources.entry-point.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAwB,MAAM,8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AAO,EACH,sBAAsB,EACzB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACH,YAAY,EACf,MAAM,sCAAsC,CAAC"}
|
package/readme.md
CHANGED
|
@@ -119,8 +119,9 @@ Omitting `dependencies` is accepted for compatibility and produces
|
|
|
119
119
|
`dependencies: {}` on the returned descriptor.
|
|
120
120
|
|
|
121
121
|
`createTemporaryDirectoryResource(name)` returns a per-case resource descriptor
|
|
122
|
-
whose handle
|
|
123
|
-
directory with an Overkill prefix. Disposal removes that directory
|
|
122
|
+
whose handle exposes `path` and an empty `transcript`. Each acquisition creates
|
|
123
|
+
a unique directory with an Overkill prefix. Disposal removes that directory
|
|
124
|
+
recursively.
|
|
124
125
|
|
|
125
126
|
`defineLocalServiceResource(...)` models owned local services with explicit
|
|
126
127
|
`start`, `ready`, and `dispose` phases. Callers declare scope, requirements,
|
|
@@ -133,11 +134,64 @@ ordinary resources.
|
|
|
133
134
|
|
|
134
135
|
`createLocalHttpServiceResource(...)` owns HTTP `listen` and `close`, exposes
|
|
135
136
|
the actual loopback endpoint and `baseUrl`, and lets callers map that into a
|
|
136
|
-
typed object handle.
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
typed object handle. Its handle also exposes a read-only `transcript`. Recording
|
|
138
|
+
is enabled by default and stores one normalized `http` entry per completed
|
|
139
|
+
exchange. Request and response bodies are captured up to 16 KiB independently.
|
|
140
|
+
External clients still produce request metadata and a response whose body is
|
|
141
|
+
marked unavailable. Pass `{ kind: 'disabled' }` as the second argument to turn
|
|
142
|
+
recording off, or `{ kind: 'custom', transcript(server) { ... } }` to supply a
|
|
143
|
+
protocol-specific transcript.
|
|
144
|
+
|
|
145
|
+
Runner-managed handles show transcript entries from the active test case.
|
|
146
|
+
Handles returned by `startResources(...)` and `startRuntime(...)` show the full
|
|
147
|
+
resource lifetime.
|
|
148
|
+
|
|
149
|
+
`createLocalProcessServiceResource(...)` starts a child process, drains bounded
|
|
150
|
+
stdout/stderr lifecycle buffers, waits for explicit readiness, and terminates
|
|
151
|
+
then force-kills during disposal according to the declared shutdown contract.
|
|
152
|
+
Output buffers are lifecycle diagnostics. Attach them explicitly when a run
|
|
153
|
+
should retain them as artifacts.
|
|
154
|
+
|
|
155
|
+
Runner-managed acquisition, disposal, handle projection, and scenario exposure
|
|
156
|
+
contexts include `attachments`. Resource and runtime test wrappers also expose
|
|
157
|
+
`scope.attachments`:
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
const log = await scope.attachments.open({
|
|
161
|
+
kind: 'text',
|
|
162
|
+
name: 'service-log',
|
|
163
|
+
mediaType: 'text/plain'
|
|
164
|
+
});
|
|
165
|
+
await log.write('Service ready\n');
|
|
166
|
+
await log.close();
|
|
167
|
+
await scope.attachments.json(
|
|
168
|
+
{ name: 'accessibility', mediaType: 'application/json' },
|
|
169
|
+
{ violations: [] }
|
|
170
|
+
);
|
|
171
|
+
await scope.attachments.file(
|
|
172
|
+
{ name: 'screenshot', mediaType: 'image/png' },
|
|
173
|
+
screenshotPath
|
|
174
|
+
);
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Await each write and close every writer. Binary writers accept `Uint8Array`.
|
|
178
|
+
Text byte chunks must contain valid UTF-8.
|
|
179
|
+
`file(...)` copies a file before resolving, so resource teardown may remove the
|
|
180
|
+
original. Text and JSON remain inline; binary data lives in runner-owned files.
|
|
181
|
+
JSON preserves the supplied schema and rejects values that JSON serialization
|
|
182
|
+
would silently change, including cycles, accessors, and non-finite numbers.
|
|
183
|
+
|
|
184
|
+
Opening a writer fixes its case and attempt owner. Calls outside an active case
|
|
185
|
+
produce run artifacts. Setup and teardown outside a case therefore remain run scoped. A call from an expired attempt fails with `attribution-drift`.
|
|
186
|
+
Unclosed writers and binary overflow retain their available prefix and fail the
|
|
187
|
+
run. Text truncates; oversized JSON produces an omission record.
|
|
188
|
+
|
|
189
|
+
Attachments require runner-managed integration execution. Standalone
|
|
190
|
+
`startResources(...)` and `startRuntime(...)` sessions reject attachment calls.
|
|
191
|
+
|
|
192
|
+
`@overkill-dev/resources/attachment-context` exposes the shared context bridge
|
|
193
|
+
for runner and authoring integrations. Test authors should use `scope.attachments`.
|
|
194
|
+
Service transcripts and logs are retained only when explicitly attached.
|
|
141
195
|
|
|
142
196
|
Resources may declare finite scenario slots with a default, timing, and allowed
|
|
143
197
|
values. `defineRuntime(...)` lifts slots from its complete dependency graph.
|
|
@@ -159,7 +213,8 @@ resource still acquires separately when those views differ.
|
|
|
159
213
|
HTTP server from `@overkill-dev/simulation` as a per-case resource. Its
|
|
160
214
|
request-routed scenario slot uses the simulation name. A runtime binding makes
|
|
161
215
|
`baseUrl` select that scenario, while `scenarioUrl(...)` remains available for
|
|
162
|
-
explicit URL selection.
|
|
216
|
+
explicit URL selection. Its transcript records the selected scenario and omits
|
|
217
|
+
the internal scenario query parameter from the request URL.
|
|
163
218
|
|
|
164
219
|
`startRuntime(...)` acquires dependencies before dependents, shares one handle
|
|
165
220
|
per descriptor inside the session, and disposes acquired resources once in
|
|
@@ -1,9 +1,29 @@
|
|
|
1
|
+
import { type HttpTranscript } from '@overkill-dev/simulation/transcript';
|
|
1
2
|
import type { Awaitable, ExecutionRequirement, ResourceDefinition, ResourceDependencies, ResourceProjectionPayload, ResourceScope } from './resources.ts';
|
|
2
3
|
import { type LocalServiceAddressRequest, type LocalServiceConsumerHandle, type LocalServiceCreationContext, type LocalServiceDisposalContext, type LocalServiceHandleProjection, type LocalServiceAddress, type ProjectedLocalServiceScope } from './local-service-resource.ts';
|
|
3
4
|
export type LocalHttpServiceHandle = {
|
|
4
5
|
readonly baseUrl: string;
|
|
5
6
|
readonly endpoint: LocalServiceAddress;
|
|
7
|
+
readonly transcript: HttpTranscript<unknown>;
|
|
6
8
|
};
|
|
9
|
+
type CustomLocalHttpTranscriptPolicy<Context> = {
|
|
10
|
+
readonly kind: 'custom';
|
|
11
|
+
readonly transcript: (server: LocalHttpServer) => HttpTranscript<Context>;
|
|
12
|
+
};
|
|
13
|
+
type DisabledLocalHttpTranscriptPolicy = {
|
|
14
|
+
readonly kind: 'disabled';
|
|
15
|
+
};
|
|
16
|
+
type LocalHttpTranscriptPolicies<Context> = {
|
|
17
|
+
readonly custom: CustomLocalHttpTranscriptPolicy<Context>;
|
|
18
|
+
readonly disabled: DisabledLocalHttpTranscriptPolicy;
|
|
19
|
+
};
|
|
20
|
+
export type LocalHttpTranscriptPolicy<Context = unknown> = LocalHttpTranscriptPolicies<Context>[keyof LocalHttpTranscriptPolicies<Context>];
|
|
21
|
+
export type LocalHttpResourceHandle<Handle extends LocalServiceConsumerHandle, Context = null> = Handle & {
|
|
22
|
+
readonly transcript: HttpTranscript<Context>;
|
|
23
|
+
};
|
|
24
|
+
type TranscriptPolicyInput = readonly [] | readonly [LocalHttpTranscriptPolicy];
|
|
25
|
+
type PolicyContext<Policy> = Policy extends CustomLocalHttpTranscriptPolicy<infer Value> ? Value : null;
|
|
26
|
+
type TranscriptContext<Input extends TranscriptPolicyInput> = PolicyContext<Input[0]>;
|
|
7
27
|
type LocalHttpServerAddress = {
|
|
8
28
|
readonly port: number;
|
|
9
29
|
};
|
|
@@ -43,7 +63,7 @@ type ProjectedHttpServiceInput<Name extends string, ConsumerHandle extends Local
|
|
|
43
63
|
readonly scope: ProjectedLocalServiceScope;
|
|
44
64
|
readonly serializeHandle: LocalServiceHandleProjection<ConsumerHandle, Projection, ProjectedConsumerHandle, Dependencies>['serializeHandle'];
|
|
45
65
|
};
|
|
46
|
-
export declare function createLocalHttpServiceResource<const Name extends string, ConsumerHandle extends LocalServiceConsumerHandle, Scope extends Exclude<ResourceScope, 'per-run'>, const Dependencies extends ResourceDependencies>(input: LocalHttpServiceResourceInput<Name, ConsumerHandle, Scope, Dependencies
|
|
47
|
-
export declare function createLocalHttpServiceResource<const Name extends string, ConsumerHandle extends LocalServiceConsumerHandle, Projection extends ResourceProjectionPayload, ProjectedConsumerHandle, const Dependencies extends ResourceDependencies>(input: ProjectedHttpServiceInput<Name, ConsumerHandle, Projection, ProjectedConsumerHandle, Dependencies
|
|
66
|
+
export declare function createLocalHttpServiceResource<const Name extends string, ConsumerHandle extends LocalServiceConsumerHandle, Scope extends Exclude<ResourceScope, 'per-run'>, const Dependencies extends ResourceDependencies, const PolicyInput extends readonly [] | readonly [LocalHttpTranscriptPolicy]>(input: LocalHttpServiceResourceInput<Name, ConsumerHandle, Scope, Dependencies>, ...policyInput: PolicyInput): ResourceDefinition<Name, LocalHttpResourceHandle<ConsumerHandle, TranscriptContext<PolicyInput>>, Dependencies>;
|
|
67
|
+
export declare function createLocalHttpServiceResource<const Name extends string, ConsumerHandle extends LocalServiceConsumerHandle, Projection extends ResourceProjectionPayload, ProjectedConsumerHandle extends LocalServiceConsumerHandle, const Dependencies extends ResourceDependencies, const PolicyInput extends readonly [] | readonly [LocalHttpTranscriptPolicy]>(input: ProjectedHttpServiceInput<Name, ConsumerHandle, Projection, ProjectedConsumerHandle, Dependencies>, ...policyInput: PolicyInput): ResourceDefinition<Name, LocalHttpResourceHandle<ConsumerHandle, TranscriptContext<PolicyInput>>, Dependencies, LocalHttpResourceHandle<ProjectedConsumerHandle, TranscriptContext<PolicyInput>>>;
|
|
48
68
|
export {};
|
|
49
69
|
//# sourceMappingURL=local-http-service-resource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-http-service-resource.d.ts","sourceRoot":"","sources":["../../../../source/resources/local-http-service-resource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,SAAS,EACT,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,yBAAyB,EACzB,aAAa,EAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAGH,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EACjC,KAAK,mBAAmB,EAExB,KAAK,0BAA0B,EAClC,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"local-http-service-resource.d.ts","sourceRoot":"","sources":["../../../../source/resources/local-http-service-resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,KAAK,cAAc,EACtB,MAAM,qCAAkD,CAAC;AAC1D,OAAO,KAAK,EACR,SAAS,EACT,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,yBAAyB,EACzB,aAAa,EAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAGH,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EACjC,KAAK,mBAAmB,EAExB,KAAK,0BAA0B,EAClC,MAAM,6BAA6B,CAAC;AAGrC,MAAM,MAAM,sBAAsB,GAAG;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;IACvC,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;CAChD,CAAC;AAEF,KAAK,+BAA+B,CAAC,OAAO,IAAI;IAC5C,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,cAAc,CAAC,OAAO,CAAC,CAAC;CAC7E,CAAC;AACF,KAAK,iCAAiC,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAAE,CAAC;AACxE,KAAK,2BAA2B,CAAC,OAAO,IAAI;IACxC,QAAQ,CAAC,MAAM,EAAE,+BAA+B,CAAC,OAAO,CAAC,CAAC;IAC1D,QAAQ,CAAC,QAAQ,EAAE,iCAAiC,CAAC;CACxD,CAAC;AAEF,MAAM,MAAM,yBAAyB,CAAC,OAAO,GAAG,OAAO,IAAI,2BAA2B,CAAC,OAAO,CAAC,CAC3F,MAAM,2BAA2B,CAAC,OAAO,CAAC,CAC7C,CAAC;AAEF,MAAM,MAAM,uB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C5C,uBAAuB,SAAS,0BAA0B,EAC1D,KAAK,CAAC,YAAY,SAAS,oBAAoB,EAC/C,KAAK,CAAC,WAAW,SAAS,SAAS,EAAE,GAAG,SAAS,CAAC,yBAAyB,CAAC,EAE5E,KAAK,EAAE,yBAAyB,CAC5B,IAAI,EACJ,cAAc,EACd,UAAU,EACV,uBAAuB,EACvB,YAAY,CACf,EACD,GAAG,WAAW,EAAE,WAAW,GAC5B,kBAAkB,CACjB,IAAI,EACJ,uBAAuB,CAAC,cAAc,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC,EACvE,YAAY,EACZ,uBAAuB,CAAC,uBAAuB,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC,CACnF,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { captureErrorHttpTranscript, emptyTranscriptView } from "@overkill-dev/simulation/transcript";
|
|
1
2
|
import { defineLocalServiceResource, isProjectedLocalServiceScope } from "./local-service-resource.js";
|
|
3
|
+
import { observeLocalHttpServer } from "./local-http-transcript-observer.js";
|
|
2
4
|
function serverEndpoint(server, host) {
|
|
3
5
|
const address = server.address();
|
|
4
6
|
if (typeof address !== 'object' || address === null) {
|
|
@@ -41,13 +43,29 @@ async function closeServer(server) {
|
|
|
41
43
|
});
|
|
42
44
|
});
|
|
43
45
|
}
|
|
44
|
-
function localHttpServiceHandle(endpoint) {
|
|
46
|
+
function localHttpServiceHandle(endpoint, transcript) {
|
|
45
47
|
return Object.freeze({
|
|
46
48
|
endpoint,
|
|
47
|
-
baseUrl: `http://${endpoint.host}:${endpoint.port}
|
|
49
|
+
baseUrl: `http://${endpoint.host}:${endpoint.port}`,
|
|
50
|
+
transcript
|
|
48
51
|
});
|
|
49
52
|
}
|
|
50
|
-
function
|
|
53
|
+
function withTranscript(handle, transcript) {
|
|
54
|
+
return Object.freeze({ ...handle, transcript });
|
|
55
|
+
}
|
|
56
|
+
function customTranscript(policy, server) {
|
|
57
|
+
if (policy.kind === 'disabled') {
|
|
58
|
+
return emptyTranscriptView();
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
return policy.transcript(server);
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
return captureErrorHttpTranscript(error);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function localHttpDefinition(input, policy) {
|
|
68
|
+
const observers = new WeakMap();
|
|
51
69
|
return {
|
|
52
70
|
name: input.name,
|
|
53
71
|
scope: input.scope,
|
|
@@ -59,19 +77,36 @@ function localHttpDefinition(input) {
|
|
|
59
77
|
},
|
|
60
78
|
async ready(server, context) {
|
|
61
79
|
await listen(server, context.address);
|
|
62
|
-
|
|
80
|
+
const endpoint = serverEndpoint(server, context.address.host);
|
|
81
|
+
const baseUrl = `http://${endpoint.host}:${endpoint.port}`;
|
|
82
|
+
const transcript = policy === null
|
|
83
|
+
? observeLocalHttpServer(server, baseUrl)
|
|
84
|
+
: null;
|
|
85
|
+
if (transcript !== null) {
|
|
86
|
+
observers.set(server, transcript);
|
|
87
|
+
}
|
|
88
|
+
const view = transcript?.transcript ?? customTranscript(policy ?? { kind: 'disabled' }, server);
|
|
89
|
+
return withTranscript(input.handle(localHttpServiceHandle(endpoint, view), server, context), view);
|
|
63
90
|
},
|
|
64
91
|
async dispose(server, context) {
|
|
65
|
-
|
|
92
|
+
try {
|
|
93
|
+
await closeServer(server);
|
|
94
|
+
}
|
|
95
|
+
finally {
|
|
96
|
+
observers.get(server)?.dispose();
|
|
97
|
+
observers.delete(server);
|
|
98
|
+
}
|
|
66
99
|
await input.dispose(server, context);
|
|
67
100
|
}
|
|
68
101
|
};
|
|
69
102
|
}
|
|
70
|
-
function projectedHttpDefinition(input) {
|
|
103
|
+
function projectedHttpDefinition(input, policy) {
|
|
71
104
|
return {
|
|
72
|
-
...localHttpDefinition(input),
|
|
105
|
+
...localHttpDefinition(input, policy),
|
|
73
106
|
serializeHandle: input.serializeHandle,
|
|
74
|
-
deserializeHandle
|
|
107
|
+
deserializeHandle(payload, context) {
|
|
108
|
+
return withTranscript(input.deserializeHandle(payload, context), emptyTranscriptView());
|
|
109
|
+
}
|
|
75
110
|
};
|
|
76
111
|
}
|
|
77
112
|
function assertProjectedHttpService(input) {
|
|
@@ -79,13 +114,14 @@ function assertProjectedHttpService(input) {
|
|
|
79
114
|
throw new TypeError('Projected local HTTP services require handle projection callbacks.');
|
|
80
115
|
}
|
|
81
116
|
}
|
|
82
|
-
export function createLocalHttpServiceResource(input) {
|
|
117
|
+
export function createLocalHttpServiceResource(input, ...policyInput) {
|
|
118
|
+
const policy = policyInput[0] ?? null;
|
|
83
119
|
if (isProjectedLocalServiceScope(input.scope)) {
|
|
84
120
|
assertProjectedHttpService(input);
|
|
85
|
-
return defineLocalServiceResource(projectedHttpDefinition(input));
|
|
121
|
+
return defineLocalServiceResource(projectedHttpDefinition(input, policy));
|
|
86
122
|
}
|
|
87
123
|
return defineLocalServiceResource({
|
|
88
|
-
...localHttpDefinition(input),
|
|
124
|
+
...localHttpDefinition(input, policy),
|
|
89
125
|
scope: input.scope
|
|
90
126
|
});
|
|
91
127
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-http-service-resource.js","sourceRoot":"","sources":["../../../../source/resources/local-http-service-resource.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"local-http-service-resource.js","sourceRoot":"","sources":["../../../../source/resources/local-http-service-resource.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,0BAA0B,EAC1B,mBAAmB,EAEtB,MAAM,qCAAkD,CAAC;AAS1D,OAAO,EACH,0BAA0B,EAC1B,4BAA4B,EAS/B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,sBAAsB,EAAoC,MAAM,qCAAqC,CAAC;AA8K/G,SAAS,cAAc,CAAC,MAAwC,EAAE,IAAY;IAC1E,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;IAEjC,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OA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