@mannyc1/ts-release 0.0.1 → 0.0.3
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/ARCHITECTURE.md +93 -0
- package/README.md +282 -49
- package/SPEC.md +46 -9
- package/dist/config/schema.d.ts +4 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +13 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/domain/evidence.d.ts +4 -0
- package/dist/domain/evidence.d.ts.map +1 -1
- package/dist/domain/evidence.js +4 -0
- package/dist/domain/evidence.js.map +1 -1
- package/dist/domain/operation.d.ts +1 -0
- package/dist/domain/operation.d.ts.map +1 -1
- package/dist/domain/operation.js +147 -1
- package/dist/domain/operation.js.map +1 -1
- package/dist/domain/release.d.ts +1 -0
- package/dist/domain/release.d.ts.map +1 -1
- package/dist/domain/release.js +1 -0
- package/dist/domain/release.js.map +1 -1
- package/dist/domain/remote-state.d.ts +90 -0
- package/dist/domain/remote-state.d.ts.map +1 -0
- package/dist/domain/remote-state.js +85 -0
- package/dist/domain/remote-state.js.map +1 -0
- package/dist/domain/status.d.ts +43 -0
- package/dist/domain/status.d.ts.map +1 -0
- package/dist/domain/status.js +50 -0
- package/dist/domain/status.js.map +1 -0
- package/dist/domain/target.d.ts +32 -2
- package/dist/domain/target.d.ts.map +1 -1
- package/dist/domain/target.js +35 -2
- package/dist/domain/target.js.map +1 -1
- package/dist/host/host.d.ts +7 -23
- package/dist/host/host.d.ts.map +1 -1
- package/dist/host/host.js +3 -22
- package/dist/host/host.js.map +1 -1
- package/dist/host/http-live.d.ts +1 -2
- package/dist/host/http-live.d.ts.map +1 -1
- package/dist/host/http-live.js +18 -9
- package/dist/host/http-live.js.map +1 -1
- package/dist/host/http.d.ts +3 -1
- package/dist/host/http.d.ts.map +1 -1
- package/dist/host/http.js +3 -1
- package/dist/host/http.js.map +1 -1
- package/dist/host/platform.d.ts +10 -0
- package/dist/host/platform.d.ts.map +1 -0
- package/dist/host/platform.js +121 -0
- package/dist/host/platform.js.map +1 -0
- package/dist/host/test.d.ts +7 -3
- package/dist/host/test.d.ts.map +1 -1
- package/dist/host/test.js +128 -25
- package/dist/host/test.js.map +1 -1
- package/dist/internal/workspace-path.d.ts +16 -0
- package/dist/internal/workspace-path.d.ts.map +1 -0
- package/dist/internal/workspace-path.js +33 -0
- package/dist/internal/workspace-path.js.map +1 -0
- package/dist/planner/artifact-inventory.d.ts +9 -0
- package/dist/planner/artifact-inventory.d.ts.map +1 -0
- package/dist/planner/artifact-inventory.js +85 -0
- package/dist/planner/artifact-inventory.js.map +1 -0
- package/dist/planner/create-release-plan.d.ts +1 -1
- package/dist/planner/create-release-plan.d.ts.map +1 -1
- package/dist/planner/errors.d.ts +37 -1
- package/dist/planner/errors.d.ts.map +1 -1
- package/dist/planner/errors.js +30 -0
- package/dist/planner/errors.js.map +1 -1
- package/dist/planner/evidence-recorder.d.ts +13 -8
- package/dist/planner/evidence-recorder.d.ts.map +1 -1
- package/dist/planner/evidence-recorder.js +116 -18
- package/dist/planner/evidence-recorder.js.map +1 -1
- package/dist/planner/executor.d.ts +31 -19
- package/dist/planner/executor.d.ts.map +1 -1
- package/dist/planner/executor.js +52 -7
- package/dist/planner/executor.js.map +1 -1
- package/dist/planner/normalize-release.d.ts +2 -2
- package/dist/planner/normalize-release.d.ts.map +1 -1
- package/dist/planner/normalize-release.js +50 -52
- package/dist/planner/normalize-release.js.map +1 -1
- package/dist/planner/reconcile.d.ts +17 -0
- package/dist/planner/reconcile.d.ts.map +1 -0
- package/dist/planner/reconcile.js +337 -0
- package/dist/planner/reconcile.js.map +1 -0
- package/dist/planner/release-eligibility.d.ts +34 -0
- package/dist/planner/release-eligibility.d.ts.map +1 -0
- package/dist/planner/release-eligibility.js +179 -0
- package/dist/planner/release-eligibility.js.map +1 -0
- package/dist/planner/render-plan.d.ts +10 -0
- package/dist/planner/render-plan.d.ts.map +1 -1
- package/dist/planner/render-plan.js +179 -0
- package/dist/planner/render-plan.js.map +1 -1
- package/dist/planner/status.d.ts +40 -0
- package/dist/planner/status.d.ts.map +1 -0
- package/dist/planner/status.js +342 -0
- package/dist/planner/status.js.map +1 -0
- package/dist/targets/github.d.ts.map +1 -1
- package/dist/targets/github.js +28 -13
- package/dist/targets/github.js.map +1 -1
- package/dist/targets/npm.d.ts +2 -2
- package/dist/targets/npm.d.ts.map +1 -1
- package/dist/targets/npm.js +74 -14
- package/dist/targets/npm.js.map +1 -1
- package/dist/workflows/config.d.ts +153 -0
- package/dist/workflows/config.d.ts.map +1 -0
- package/dist/workflows/config.js +301 -0
- package/dist/workflows/config.js.map +1 -0
- package/dist/workflows/diagnostics.d.ts +62 -0
- package/dist/workflows/diagnostics.d.ts.map +1 -0
- package/dist/workflows/diagnostics.js +474 -0
- package/dist/workflows/diagnostics.js.map +1 -0
- package/dist/workflows/evidence.d.ts +21 -0
- package/dist/workflows/evidence.d.ts.map +1 -0
- package/dist/workflows/evidence.js +45 -0
- package/dist/workflows/evidence.js.map +1 -0
- package/dist/workflows/index.d.ts +7 -0
- package/dist/workflows/index.d.ts.map +1 -0
- package/dist/workflows/index.js +6 -0
- package/dist/workflows/index.js.map +1 -0
- package/dist/workflows/init.d.ts +71 -0
- package/dist/workflows/init.d.ts.map +1 -0
- package/dist/workflows/init.js +384 -0
- package/dist/workflows/init.js.map +1 -0
- package/dist/workflows/live.d.ts +9 -0
- package/dist/workflows/live.d.ts.map +1 -0
- package/dist/workflows/live.js +7 -0
- package/dist/workflows/live.js.map +1 -0
- package/dist/workflows/options.d.ts +30 -0
- package/dist/workflows/options.d.ts.map +1 -0
- package/dist/workflows/options.js +16 -0
- package/dist/workflows/options.js.map +1 -0
- package/examples/README.md +16 -9
- package/examples/github-release/release.config.json +1 -0
- package/examples/homebrew-tap/release.config.json +1 -0
- package/examples/multi-target/release.config.json +10 -1
- package/examples/non-strict-skips/release.config.json +1 -0
- package/examples/npm-first-publish/release.config.json +33 -0
- package/examples/npm-only/release.config.json +10 -1
- package/examples/pypi-registry/release.config.json +1 -0
- package/examples/scoop-bucket/release.config.json +1 -0
- package/package.json +56 -27
- package/templates/README.md +54 -0
- package/templates/github-actions/plan-and-approved-execute.yml +53 -0
- package/templates/github-actions/plan-only.yml +30 -0
- package/templates/github-actions/trusted-publishing.yml +59 -0
- package/templates/multi-target-homebrew/release.config.json +70 -0
- package/templates/multi-target-scoop/release.config.json +72 -0
- package/templates/npm-github/release.config.json +50 -0
- package/templates/npm-only/release.config.json +39 -0
- package/dist/cli/command.d.ts +0 -4
- package/dist/cli/command.d.ts.map +0 -1
- package/dist/cli/command.js +0 -125
- package/dist/cli/command.js.map +0 -1
- package/dist/cli/main.d.ts +0 -3
- package/dist/cli/main.d.ts.map +0 -1
- package/dist/cli/main.js +0 -15
- package/dist/cli/main.js.map +0 -1
- package/dist/cli/programmatic.d.ts +0 -25
- package/dist/cli/programmatic.d.ts.map +0 -1
- package/dist/cli/programmatic.js +0 -53
- package/dist/cli/programmatic.js.map +0 -1
- package/dist/host/bun.d.ts +0 -9
- package/dist/host/bun.d.ts.map +0 -1
- package/dist/host/bun.js +0 -156
- package/dist/host/bun.js.map +0 -1
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
import { TargetId } from "./target.js";
|
|
3
|
+
export const NpmRemoteState = Schema.Literals(["missing", "published"]);
|
|
4
|
+
export const GitHubReleaseAvailability = Schema.Literals(["missing", "draft", "published"]);
|
|
5
|
+
export const ReleaseEligibilityStatus = Schema.Literals(["ready", "complete", "partial"]);
|
|
6
|
+
export class ReleaseEligibilityInput extends Schema.Class("ReleaseEligibilityInput")({
|
|
7
|
+
packageName: Schema.String,
|
|
8
|
+
packageVersion: Schema.String,
|
|
9
|
+
expectedGithubDraft: Schema.Boolean,
|
|
10
|
+
npm: NpmRemoteState,
|
|
11
|
+
github: GitHubReleaseAvailability
|
|
12
|
+
}) {
|
|
13
|
+
}
|
|
14
|
+
export class ReleaseEligibilityDecision extends Schema.Class("ReleaseEligibilityDecision")({
|
|
15
|
+
shouldRelease: Schema.Boolean,
|
|
16
|
+
status: ReleaseEligibilityStatus,
|
|
17
|
+
reason: Schema.String
|
|
18
|
+
}) {
|
|
19
|
+
}
|
|
20
|
+
export class GitHubReleaseMissing extends Schema.TaggedClass()("GitHubReleaseMissing", {
|
|
21
|
+
targetId: TargetId,
|
|
22
|
+
repository: Schema.String,
|
|
23
|
+
tag: Schema.String
|
|
24
|
+
}) {
|
|
25
|
+
}
|
|
26
|
+
export class GitHubReleaseDraft extends Schema.TaggedClass()("GitHubReleaseDraft", {
|
|
27
|
+
targetId: TargetId,
|
|
28
|
+
repository: Schema.String,
|
|
29
|
+
tag: Schema.String,
|
|
30
|
+
title: Schema.String,
|
|
31
|
+
draft: Schema.Literal(true),
|
|
32
|
+
prerelease: Schema.Boolean,
|
|
33
|
+
assetNames: Schema.Array(Schema.String)
|
|
34
|
+
}) {
|
|
35
|
+
}
|
|
36
|
+
export class GitHubReleasePublished extends Schema.TaggedClass()("GitHubReleasePublished", {
|
|
37
|
+
targetId: TargetId,
|
|
38
|
+
repository: Schema.String,
|
|
39
|
+
tag: Schema.String,
|
|
40
|
+
title: Schema.String,
|
|
41
|
+
draft: Schema.Literal(false),
|
|
42
|
+
prerelease: Schema.Boolean,
|
|
43
|
+
assetNames: Schema.Array(Schema.String)
|
|
44
|
+
}) {
|
|
45
|
+
}
|
|
46
|
+
export class GitHubReleaseMismatch extends Schema.TaggedClass()("GitHubReleaseMismatch", {
|
|
47
|
+
targetId: TargetId,
|
|
48
|
+
repository: Schema.String,
|
|
49
|
+
tag: Schema.String,
|
|
50
|
+
reasons: Schema.Array(Schema.String)
|
|
51
|
+
}) {
|
|
52
|
+
}
|
|
53
|
+
export const GitHubReleaseRemoteState = Schema.Union([
|
|
54
|
+
GitHubReleaseMissing,
|
|
55
|
+
GitHubReleaseDraft,
|
|
56
|
+
GitHubReleasePublished,
|
|
57
|
+
GitHubReleaseMismatch
|
|
58
|
+
]);
|
|
59
|
+
export class GitHubReconcileSkip extends Schema.TaggedClass()("GitHubReconcileSkip", {
|
|
60
|
+
targetId: TargetId,
|
|
61
|
+
reason: Schema.String
|
|
62
|
+
}) {
|
|
63
|
+
}
|
|
64
|
+
export class GitHubReconcileCreateRelease extends Schema.TaggedClass()("GitHubReconcileCreateRelease", {
|
|
65
|
+
targetId: TargetId,
|
|
66
|
+
reason: Schema.String
|
|
67
|
+
}) {
|
|
68
|
+
}
|
|
69
|
+
export class GitHubReconcilePublishDraft extends Schema.TaggedClass()("GitHubReconcilePublishDraft", {
|
|
70
|
+
targetId: TargetId,
|
|
71
|
+
reason: Schema.String
|
|
72
|
+
}) {
|
|
73
|
+
}
|
|
74
|
+
export class GitHubReconcileBlock extends Schema.TaggedClass()("GitHubReconcileBlock", {
|
|
75
|
+
targetId: TargetId,
|
|
76
|
+
reasons: Schema.Array(Schema.String)
|
|
77
|
+
}) {
|
|
78
|
+
}
|
|
79
|
+
export const GitHubReleaseReconciliationDecision = Schema.Union([
|
|
80
|
+
GitHubReconcileSkip,
|
|
81
|
+
GitHubReconcileCreateRelease,
|
|
82
|
+
GitHubReconcilePublishDraft,
|
|
83
|
+
GitHubReconcileBlock
|
|
84
|
+
]);
|
|
85
|
+
//# sourceMappingURL=remote-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-state.js","sourceRoot":"","sources":["../../src/domain/remote-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAItC,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,CAAA;AAGvE,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC,CAAA;AAG3F,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Q,MAAM,CAAC,WAAW,EAAwB,CAAC,sBAAsB,EAAE;IAC3G,QAAQ,EAAE,QAAQ;IAClB,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;CACrC,CAAC;CAAG;AAEL,MAAM,CAAC,MAAM,mCAAmC,GAAG,MAAM,CAAC,KAAK,CAAC;IAC9D,mBAAmB;IACnB,4BAA4B;IAC5B,2BAA2B;IAC3B,oBAAoB;CACrB,CAAC,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
export type * from "../types/effect-internal.js";
|
|
3
|
+
export declare const ReleaseWorkflowPhase: Schema.Literals<readonly ["render", "validation", "execution", "verification"]>;
|
|
4
|
+
export type ReleaseWorkflowPhase = typeof ReleaseWorkflowPhase.Type;
|
|
5
|
+
export declare const ReleaseOperationStatus: Schema.Literals<readonly ["pending", "passed", "warning", "skipped", "failed", "blocked"]>;
|
|
6
|
+
export type ReleaseOperationStatus = typeof ReleaseOperationStatus.Type;
|
|
7
|
+
export declare const ReleaseOverallStatus: Schema.Literals<readonly ["not-started", "in-progress", "failed", "blocked", "complete"]>;
|
|
8
|
+
export type ReleaseOverallStatus = typeof ReleaseOverallStatus.Type;
|
|
9
|
+
export declare const ReleaseResumeAction: Schema.Literals<readonly ["skip", "run", "retry-read-only", "block"]>;
|
|
10
|
+
export type ReleaseResumeAction = typeof ReleaseResumeAction.Type;
|
|
11
|
+
declare const ReleaseOperationStatusRecord_base: Schema.Class<ReleaseOperationStatusRecord, Schema.Struct<{
|
|
12
|
+
readonly operationId: Schema.String;
|
|
13
|
+
readonly targetId: Schema.optionalKey<Schema.String>;
|
|
14
|
+
readonly phase: Schema.Literals<readonly ["render", "validation", "execution", "verification"]>;
|
|
15
|
+
readonly risk: Schema.Literals<readonly ["read-only", "writes-local", "externally-visible", "irreversible"]>;
|
|
16
|
+
readonly status: Schema.Literals<readonly ["pending", "passed", "warning", "skipped", "failed", "blocked"]>;
|
|
17
|
+
readonly resumeAction: Schema.Literals<readonly ["skip", "run", "retry-read-only", "block"]>;
|
|
18
|
+
readonly evidenceId: Schema.optionalKey<Schema.String>;
|
|
19
|
+
readonly reason: Schema.optionalKey<Schema.String>;
|
|
20
|
+
}>, {}>;
|
|
21
|
+
export declare class ReleaseOperationStatusRecord extends ReleaseOperationStatusRecord_base {
|
|
22
|
+
}
|
|
23
|
+
declare const ReleasePhaseStatusRecord_base: Schema.Class<ReleasePhaseStatusRecord, Schema.Struct<{
|
|
24
|
+
readonly phase: Schema.Literals<readonly ["render", "validation", "execution", "verification"]>;
|
|
25
|
+
readonly status: Schema.Literals<readonly ["pending", "passed", "warning", "skipped", "failed", "blocked"]>;
|
|
26
|
+
readonly completed: Schema.Number;
|
|
27
|
+
readonly total: Schema.Number;
|
|
28
|
+
}>, {}>;
|
|
29
|
+
export declare class ReleasePhaseStatusRecord extends ReleasePhaseStatusRecord_base {
|
|
30
|
+
}
|
|
31
|
+
declare const ReleaseStatusReport_base: Schema.Class<ReleaseStatusReport, Schema.Struct<{
|
|
32
|
+
readonly schemaVersion: Schema.Literal<"release-status/v1">;
|
|
33
|
+
readonly releaseName: Schema.String;
|
|
34
|
+
readonly releaseVersion: Schema.String;
|
|
35
|
+
readonly overallStatus: Schema.Literals<readonly ["not-started", "in-progress", "failed", "blocked", "complete"]>;
|
|
36
|
+
readonly canResume: Schema.Boolean;
|
|
37
|
+
readonly evidenceDirectory: Schema.String;
|
|
38
|
+
readonly phases: Schema.$Array<typeof ReleasePhaseStatusRecord>;
|
|
39
|
+
readonly operations: Schema.$Array<typeof ReleaseOperationStatusRecord>;
|
|
40
|
+
}>, {}>;
|
|
41
|
+
export declare class ReleaseStatusReport extends ReleaseStatusReport_base {
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/domain/status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAIvC,mBAAmB,6BAA6B,CAAA;AAEhD,eAAO,MAAM,oBAAoB,iFAAyE,CAAA;AAC1G,MAAM,MAAM,oBAAoB,GAAG,OAAO,oBAAoB,CAAC,IAAI,CAAA;AAEnE,eAAO,MAAM,sBAAsB,4FAOjC,CAAA;AACF,MAAM,MAAM,sBAAsB,GAAG,OAAO,sBAAsB,CAAC,IAAI,CAAA;AAEvE,eAAO,MAAM,oBAAoB,2FAM/B,CAAA;AACF,MAAM,MAAM,oBAAoB,GAAG,OAAO,oBAAoB,CAAC,IAAI,CAAA;AAEnE,eAAO,MAAM,mBAAmB,uEAA+D,CAAA;AAC/F,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAC,IAAI,CAAA;;;;;;;;;;;AAEjE,qBAAa,4BAA6B,SAAQ,iCAWhD;CAAG;;;;;;;AAEL,qBAAa,wBAAyB,SAAQ,6BAK5C;CAAG;;;;;;;;;;;AAEL,qBAAa,mBAAoB,SAAQ,wBASvC;CAAG"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
import { OperationId, OperationRisk } from "./operation.js";
|
|
3
|
+
import { TargetId } from "./target.js";
|
|
4
|
+
export const ReleaseWorkflowPhase = Schema.Literals(["render", "validation", "execution", "verification"]);
|
|
5
|
+
export const ReleaseOperationStatus = Schema.Literals([
|
|
6
|
+
"pending",
|
|
7
|
+
"passed",
|
|
8
|
+
"warning",
|
|
9
|
+
"skipped",
|
|
10
|
+
"failed",
|
|
11
|
+
"blocked"
|
|
12
|
+
]);
|
|
13
|
+
export const ReleaseOverallStatus = Schema.Literals([
|
|
14
|
+
"not-started",
|
|
15
|
+
"in-progress",
|
|
16
|
+
"failed",
|
|
17
|
+
"blocked",
|
|
18
|
+
"complete"
|
|
19
|
+
]);
|
|
20
|
+
export const ReleaseResumeAction = Schema.Literals(["skip", "run", "retry-read-only", "block"]);
|
|
21
|
+
export class ReleaseOperationStatusRecord extends Schema.Class("ReleaseOperationStatusRecord")({
|
|
22
|
+
operationId: OperationId,
|
|
23
|
+
targetId: Schema.optionalKey(TargetId),
|
|
24
|
+
phase: ReleaseWorkflowPhase,
|
|
25
|
+
risk: OperationRisk,
|
|
26
|
+
status: ReleaseOperationStatus,
|
|
27
|
+
resumeAction: ReleaseResumeAction,
|
|
28
|
+
evidenceId: Schema.optionalKey(Schema.String),
|
|
29
|
+
reason: Schema.optionalKey(Schema.String)
|
|
30
|
+
}) {
|
|
31
|
+
}
|
|
32
|
+
export class ReleasePhaseStatusRecord extends Schema.Class("ReleasePhaseStatusRecord")({
|
|
33
|
+
phase: ReleaseWorkflowPhase,
|
|
34
|
+
status: ReleaseOperationStatus,
|
|
35
|
+
completed: Schema.Number,
|
|
36
|
+
total: Schema.Number
|
|
37
|
+
}) {
|
|
38
|
+
}
|
|
39
|
+
export class ReleaseStatusReport extends Schema.Class("ReleaseStatusReport")({
|
|
40
|
+
schemaVersion: Schema.Literal("release-status/v1"),
|
|
41
|
+
releaseName: Schema.String,
|
|
42
|
+
releaseVersion: Schema.String,
|
|
43
|
+
overallStatus: ReleaseOverallStatus,
|
|
44
|
+
canResume: Schema.Boolean,
|
|
45
|
+
evidenceDirectory: Schema.String,
|
|
46
|
+
phases: Schema.Array(ReleasePhaseStatusRecord),
|
|
47
|
+
operations: Schema.Array(ReleaseOperationStatusRecord)
|
|
48
|
+
}) {
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/domain/status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAItC,MAAM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KAAK,CAAsB,qBAAqB,CAAC,CAAC;IAChG,aAAa,EAAE,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC;IAClD,WAAW,EAAE,MAAM,CAAC,MAAM;IAC1B,cAAc,EAAE,MAAM,CAAC,MAAM;IAC7B,aAAa,EAAE,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC,OAAO;IACzB,iBAAiB,EAAE,MAAM,CAAC,MAAM;IAChC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,wBAAwB,CAAC;IAC9C,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,4BAA4B,CAAC;CACvD,CAAC;CAAG"}
|
package/dist/domain/target.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as Schema from "effect/Schema";
|
|
|
2
2
|
export type * from "../types/effect-internal.js";
|
|
3
3
|
export declare const TargetId: Schema.String;
|
|
4
4
|
export type TargetId = typeof TargetId.Type;
|
|
5
|
-
export declare const TargetAuthRequirement: Schema.Literals<readonly ["none", "env-token", "cli-auth"]>;
|
|
5
|
+
export declare const TargetAuthRequirement: Schema.Literals<readonly ["none", "env-token", "cli-auth", "trusted-publishing"]>;
|
|
6
6
|
export type TargetAuthRequirement = typeof TargetAuthRequirement.Type;
|
|
7
7
|
export declare const TargetDryRunSupport: Schema.Literals<readonly ["none", "native", "simulated"]>;
|
|
8
8
|
export type TargetDryRunSupport = typeof TargetDryRunSupport.Type;
|
|
@@ -14,11 +14,23 @@ export declare const TargetValidationStrategy: Schema.Literals<readonly ["native
|
|
|
14
14
|
export type TargetValidationStrategy = typeof TargetValidationStrategy.Type;
|
|
15
15
|
export declare const NpmAccess: Schema.Literals<readonly ["public", "restricted"]>;
|
|
16
16
|
export type NpmAccess = typeof NpmAccess.Type;
|
|
17
|
+
export declare const NpmTrustedPublishingProvider: Schema.Literals<readonly ["github-actions"]>;
|
|
18
|
+
export type NpmTrustedPublishingProvider = typeof NpmTrustedPublishingProvider.Type;
|
|
19
|
+
declare const NpmTrustedPublishingConfig_base: Schema.Class<NpmTrustedPublishingConfig, Schema.Struct<{
|
|
20
|
+
readonly provider: Schema.Literals<readonly ["github-actions"]>;
|
|
21
|
+
readonly workflow: Schema.String;
|
|
22
|
+
readonly packageExists: Schema.Literal<true>;
|
|
23
|
+
readonly verifyPackageExists: Schema.optionalKey<Schema.Boolean>;
|
|
24
|
+
}>, {}>;
|
|
25
|
+
export declare class NpmTrustedPublishingConfig extends NpmTrustedPublishingConfig_base {
|
|
26
|
+
}
|
|
17
27
|
declare const NpmRegistryTarget_base: Schema.Class<NpmRegistryTarget, Schema.TaggedStruct<"NpmRegistryTarget", {
|
|
18
28
|
readonly id: Schema.String;
|
|
19
29
|
readonly registry: Schema.String;
|
|
30
|
+
readonly packageName: Schema.String;
|
|
20
31
|
readonly packagePath: Schema.String;
|
|
21
32
|
readonly tokenEnv: Schema.optionalKey<Schema.String>;
|
|
33
|
+
readonly trustedPublishing: Schema.optionalKey<typeof NpmTrustedPublishingConfig>;
|
|
22
34
|
readonly access: Schema.optionalKey<Schema.Literals<readonly ["public", "restricted"]>>;
|
|
23
35
|
readonly provenance: Schema.optionalKey<Schema.Boolean>;
|
|
24
36
|
readonly dryRunSupport: Schema.Literals<readonly ["none", "native", "simulated"]>;
|
|
@@ -88,14 +100,32 @@ export declare class ScoopBucketTarget extends ScoopBucketTarget_base {
|
|
|
88
100
|
}
|
|
89
101
|
export declare const TargetConfig: Schema.Union<readonly [typeof NpmRegistryTarget, typeof GitHubReleaseTarget, typeof HomebrewTapTarget, typeof PyPiRegistryTarget, typeof ScoopBucketTarget]>;
|
|
90
102
|
export type TargetConfig = typeof TargetConfig.Type;
|
|
103
|
+
export declare const TargetRunsIn: Schema.Literals<readonly ["ci"]>;
|
|
104
|
+
export type TargetRunsIn = typeof TargetRunsIn.Type;
|
|
105
|
+
declare const TargetRequiredPermission_base: Schema.Class<TargetRequiredPermission, Schema.Struct<{
|
|
106
|
+
readonly name: Schema.String;
|
|
107
|
+
readonly value: Schema.String;
|
|
108
|
+
}>, {}>;
|
|
109
|
+
export declare class TargetRequiredPermission extends TargetRequiredPermission_base {
|
|
110
|
+
}
|
|
111
|
+
declare const TargetAuthSetup_base: Schema.Class<TargetAuthSetup, Schema.Struct<{
|
|
112
|
+
readonly runsIn: Schema.Literals<readonly ["ci"]>;
|
|
113
|
+
readonly provider: Schema.Literals<readonly ["github-actions"]>;
|
|
114
|
+
readonly workflow: Schema.String;
|
|
115
|
+
readonly requiredPermissions: Schema.$Array<typeof TargetRequiredPermission>;
|
|
116
|
+
readonly prerequisites: Schema.$Array<Schema.String>;
|
|
117
|
+
}>, {}>;
|
|
118
|
+
export declare class TargetAuthSetup extends TargetAuthSetup_base {
|
|
119
|
+
}
|
|
91
120
|
declare const TargetCapabilities_base: Schema.Class<TargetCapabilities, Schema.Struct<{
|
|
92
121
|
readonly targetId: Schema.String;
|
|
93
122
|
readonly targetTag: Schema.String;
|
|
94
|
-
readonly authRequirement: Schema.Literals<readonly ["none", "env-token", "cli-auth"]>;
|
|
123
|
+
readonly authRequirement: Schema.Literals<readonly ["none", "env-token", "cli-auth", "trusted-publishing"]>;
|
|
95
124
|
readonly dryRunSupport: Schema.Literals<readonly ["none", "native", "simulated"]>;
|
|
96
125
|
readonly mutability: Schema.Literals<readonly ["immutable", "mutable-release", "mutable-index"]>;
|
|
97
126
|
readonly recovery: Schema.Literals<readonly ["publish-new-version", "delete-and-recreate", "manual"]>;
|
|
98
127
|
readonly validationStrategy: Schema.Literals<readonly ["native-command", "simulated-plan", "skipped"]>;
|
|
128
|
+
readonly authSetup: Schema.optionalKey<typeof TargetAuthSetup>;
|
|
99
129
|
}>, {}>;
|
|
100
130
|
export declare class TargetCapabilities extends TargetCapabilities_base {
|
|
101
131
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../../src/domain/target.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,mBAAmB,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rC;CAAG;;;;;;;;;;;AAEL,qBAAa,mBAAoB,SAAQ,wBASvC;CAAG;;;;;;;;;;;;;;;;AAEL,qBAAa,iBAAkB,SAAQ,sBAcrC;CAAG;;;;;;;;;;AAEL,qBAAa,kBAAmB,SAAQ,uBAQtC;CAAG;;;;;;;;;;;;;;;;;;AAEL,qBAAa,iBAAkB,SAAQ,sBAgBrC;CAAG;AAEL,eAAO,MAAM,YAAY,8JAMvB,CAAA;AACF,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,IAAI,CAAA;AAEnD,eAAO,MAAM,YAAY,kCAA0B,CAAA;AACnD,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,IAAI,CAAA;;;;;AAEnD,qBAAa,wBAAyB,SAAQ,6BAG5C;CAAG;;;;;;;;AAEL,qBAAa,eAAgB,SAAQ,oBAMnC;CAAG;;;;;;;;;;;AAEL,qBAAa,kBAAmB,SAAQ,uBAStC;CAAG;AAEL,eAAO,MAAM,WAAW,GAAI,MAAM,YAAY,EAAE,OAAO,YAAY,KAAG,MACrC,CAAA;AAEjC,eAAO,MAAM,uBAAuB,GAAI,MAAM,kBAAkB,EAAE,OAAO,kBAAkB,KAAG,MACjD,CAAA;AAE7C,eAAO,MAAM,qBAAqB,GAAI,QAAQ,YAAY,KAAG,qBAW5D,CAAA"}
|
package/dist/domain/target.js
CHANGED
|
@@ -1,16 +1,31 @@
|
|
|
1
1
|
import * as Schema from "effect/Schema";
|
|
2
2
|
export const TargetId = Schema.String;
|
|
3
|
-
export const TargetAuthRequirement = Schema.Literals([
|
|
3
|
+
export const TargetAuthRequirement = Schema.Literals([
|
|
4
|
+
"none",
|
|
5
|
+
"env-token",
|
|
6
|
+
"cli-auth",
|
|
7
|
+
"trusted-publishing"
|
|
8
|
+
]);
|
|
4
9
|
export const TargetDryRunSupport = Schema.Literals(["none", "native", "simulated"]);
|
|
5
10
|
export const TargetMutability = Schema.Literals(["immutable", "mutable-release", "mutable-index"]);
|
|
6
11
|
export const TargetRecovery = Schema.Literals(["publish-new-version", "delete-and-recreate", "manual"]);
|
|
7
12
|
export const TargetValidationStrategy = Schema.Literals(["native-command", "simulated-plan", "skipped"]);
|
|
8
13
|
export const NpmAccess = Schema.Literals(["public", "restricted"]);
|
|
14
|
+
export const NpmTrustedPublishingProvider = Schema.Literals(["github-actions"]);
|
|
15
|
+
export class NpmTrustedPublishingConfig extends Schema.Class("NpmTrustedPublishingConfig")({
|
|
16
|
+
provider: NpmTrustedPublishingProvider,
|
|
17
|
+
workflow: Schema.String,
|
|
18
|
+
packageExists: Schema.Literal(true),
|
|
19
|
+
verifyPackageExists: Schema.optionalKey(Schema.Boolean)
|
|
20
|
+
}) {
|
|
21
|
+
}
|
|
9
22
|
export class NpmRegistryTarget extends Schema.TaggedClass()("NpmRegistryTarget", {
|
|
10
23
|
id: TargetId,
|
|
11
24
|
registry: Schema.String,
|
|
25
|
+
packageName: Schema.String,
|
|
12
26
|
packagePath: Schema.String,
|
|
13
27
|
tokenEnv: Schema.optionalKey(Schema.String),
|
|
28
|
+
trustedPublishing: Schema.optionalKey(NpmTrustedPublishingConfig),
|
|
14
29
|
access: Schema.optionalKey(NpmAccess),
|
|
15
30
|
provenance: Schema.optionalKey(Schema.Boolean),
|
|
16
31
|
dryRunSupport: TargetDryRunSupport,
|
|
@@ -80,6 +95,20 @@ export const TargetConfig = Schema.Union([
|
|
|
80
95
|
PyPiRegistryTarget,
|
|
81
96
|
ScoopBucketTarget
|
|
82
97
|
]);
|
|
98
|
+
export const TargetRunsIn = Schema.Literals(["ci"]);
|
|
99
|
+
export class TargetRequiredPermission extends Schema.Class("TargetRequiredPermission")({
|
|
100
|
+
name: Schema.String,
|
|
101
|
+
value: Schema.String
|
|
102
|
+
}) {
|
|
103
|
+
}
|
|
104
|
+
export class TargetAuthSetup extends Schema.Class("TargetAuthSetup")({
|
|
105
|
+
runsIn: TargetRunsIn,
|
|
106
|
+
provider: NpmTrustedPublishingProvider,
|
|
107
|
+
workflow: Schema.String,
|
|
108
|
+
requiredPermissions: Schema.Array(TargetRequiredPermission),
|
|
109
|
+
prerequisites: Schema.Array(Schema.String)
|
|
110
|
+
}) {
|
|
111
|
+
}
|
|
83
112
|
export class TargetCapabilities extends Schema.Class("TargetCapabilities")({
|
|
84
113
|
targetId: TargetId,
|
|
85
114
|
targetTag: Schema.String,
|
|
@@ -87,12 +116,16 @@ export class TargetCapabilities extends Schema.Class("TargetCapabilities")({
|
|
|
87
116
|
dryRunSupport: TargetDryRunSupport,
|
|
88
117
|
mutability: TargetMutability,
|
|
89
118
|
recovery: TargetRecovery,
|
|
90
|
-
validationStrategy: TargetValidationStrategy
|
|
119
|
+
validationStrategy: TargetValidationStrategy,
|
|
120
|
+
authSetup: Schema.optionalKey(TargetAuthSetup)
|
|
91
121
|
}) {
|
|
92
122
|
}
|
|
93
123
|
export const targetOrder = (left, right) => left.id.localeCompare(right.id);
|
|
94
124
|
export const targetCapabilitiesOrder = (left, right) => left.targetId.localeCompare(right.targetId);
|
|
95
125
|
export const targetAuthRequirement = (target) => {
|
|
126
|
+
if (target._tag === "NpmRegistryTarget" && target.trustedPublishing !== undefined) {
|
|
127
|
+
return "trusted-publishing";
|
|
128
|
+
}
|
|
96
129
|
if (target._tag === "PyPiRegistryTarget") {
|
|
97
130
|
return target.usernameEnv === undefined && target.passwordEnv === undefined ? "cli-auth" : "env-token";
|
|
98
131
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"target.js","sourceRoot":"","sources":["../../src/domain/target.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAIvC,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAA;AAGrC,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"target.js","sourceRoot":"","sources":["../../src/domain/target.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM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/Context";
|
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
3
|
import * as Layer from "effect/Layer";
|
|
4
4
|
import * as Schema from "effect/Schema";
|
|
5
|
-
import { ChecksumAlgorithm } from "../domain/artifact.js";
|
|
6
5
|
import { CommandSpec } from "../domain/operation.js";
|
|
7
6
|
export type * from "../types/effect-internal.js";
|
|
8
|
-
declare const
|
|
7
|
+
declare const CommandRunnerError_base: Schema.Class<CommandRunnerError, Schema.TaggedStruct<"CommandRunnerError", {
|
|
9
8
|
readonly operation: Schema.String;
|
|
10
|
-
readonly path: Schema.optionalKey<Schema.String>;
|
|
11
9
|
readonly reason: Schema.String;
|
|
12
10
|
}>, import("effect/Cause").YieldableError>;
|
|
13
|
-
export declare class
|
|
14
|
-
}
|
|
15
|
-
declare const FileInfo_base: Schema.Class<FileInfo, Schema.Struct<{
|
|
16
|
-
readonly path: Schema.String;
|
|
17
|
-
readonly sizeBytes: Schema.Number;
|
|
18
|
-
readonly kind: Schema.Literals<readonly ["file", "directory", "other"]>;
|
|
19
|
-
}>, {}>;
|
|
20
|
-
export declare class FileInfo extends FileInfo_base {
|
|
11
|
+
export declare class CommandRunnerError extends CommandRunnerError_base {
|
|
21
12
|
}
|
|
22
13
|
declare const CommandResult_base: Schema.Class<CommandResult, Schema.Struct<{
|
|
23
14
|
readonly command: typeof CommandSpec;
|
|
@@ -30,18 +21,11 @@ declare const CommandResult_base: Schema.Class<CommandResult, Schema.Struct<{
|
|
|
30
21
|
}>, {}>;
|
|
31
22
|
export declare class CommandResult extends CommandResult_base {
|
|
32
23
|
}
|
|
33
|
-
export interface
|
|
34
|
-
readonly
|
|
35
|
-
readonly writeFileString: (path: string, contents: string) => Effect.Effect<void, HostError>;
|
|
36
|
-
readonly stat: (path: string) => Effect.Effect<FileInfo, HostError>;
|
|
37
|
-
readonly hashFile: (path: string, algorithm: ChecksumAlgorithm) => Effect.Effect<string, HostError>;
|
|
38
|
-
readonly readEnv: (name: string) => Effect.Effect<string | undefined, never>;
|
|
39
|
-
readonly runCommand: (command: CommandSpec) => Effect.Effect<CommandResult, HostError>;
|
|
40
|
-
readonly now: Effect.Effect<string, never>;
|
|
24
|
+
export interface ReleaseCommandRunnerShape {
|
|
25
|
+
readonly runCommand: (command: CommandSpec) => Effect.Effect<CommandResult, CommandRunnerError>;
|
|
41
26
|
}
|
|
42
|
-
declare const
|
|
43
|
-
export declare class
|
|
27
|
+
declare const ReleaseCommandRunner_base: Context.ServiceClass<ReleaseCommandRunner, "ReleaseCommandRunner", ReleaseCommandRunnerShape>;
|
|
28
|
+
export declare class ReleaseCommandRunner extends ReleaseCommandRunner_base {
|
|
44
29
|
}
|
|
45
|
-
export declare const
|
|
46
|
-
export declare const missingEnvNames: (command: CommandSpec) => Effect.Effect<string[], never, ReleaseHost>;
|
|
30
|
+
export declare const ReleaseCommandRunnerTestLayer: (commandRunner: ReleaseCommandRunnerShape) => Layer.Layer<ReleaseCommandRunner>;
|
|
47
31
|
//# sourceMappingURL=host.d.ts.map
|
package/dist/host/host.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../src/host/host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../src/host/host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAEpD,mBAAmB,6BAA6B,CAAA;;;;;AAEhD,qBAAa,kBAAmB,SAAQ,uBAGtC;CAAG;;;;;;;;;;AAEL,qBAAa,aAAc,SAAQ,kBAQjC;CAAG;AAEL,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAA;CAChG;;AAED,qBAAa,oBAAqB,SAAQ,yBAGf;CAAG;AAE9B,eAAO,MAAM,6BAA6B,GACxC,eAAe,yBAAyB,KACvC,KAAK,CAAC,KAAK,CAAC,oBAAoB,CACiB,CAAA"}
|
package/dist/host/host.js
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
import * as Context from "effect/Context";
|
|
2
|
-
import * as Effect from "effect/Effect";
|
|
3
2
|
import * as Layer from "effect/Layer";
|
|
4
3
|
import * as Schema from "effect/Schema";
|
|
5
4
|
import { CommandSpec } from "../domain/operation.js";
|
|
6
|
-
export class
|
|
5
|
+
export class CommandRunnerError extends Schema.TaggedErrorClass()("CommandRunnerError", {
|
|
7
6
|
operation: Schema.String,
|
|
8
|
-
path: Schema.optionalKey(Schema.String),
|
|
9
7
|
reason: Schema.String
|
|
10
8
|
}) {
|
|
11
9
|
}
|
|
12
|
-
export class FileInfo extends Schema.Class("FileInfo")({
|
|
13
|
-
path: Schema.String,
|
|
14
|
-
sizeBytes: Schema.Number,
|
|
15
|
-
kind: Schema.Literals(["file", "directory", "other"])
|
|
16
|
-
}) {
|
|
17
|
-
}
|
|
18
10
|
export class CommandResult extends Schema.Class("CommandResult")({
|
|
19
11
|
command: CommandSpec,
|
|
20
12
|
exitCode: Schema.Number,
|
|
@@ -25,18 +17,7 @@ export class CommandResult extends Schema.Class("CommandResult")({
|
|
|
25
17
|
durationMillis: Schema.Number
|
|
26
18
|
}) {
|
|
27
19
|
}
|
|
28
|
-
export class
|
|
20
|
+
export class ReleaseCommandRunner extends Context.Service()("ReleaseCommandRunner") {
|
|
29
21
|
}
|
|
30
|
-
export const
|
|
31
|
-
export const missingEnvNames = Effect.fn("missingEnvNames")(function* (command) {
|
|
32
|
-
const host = yield* ReleaseHost;
|
|
33
|
-
const missing = [];
|
|
34
|
-
for (const name of command.requiredEnv) {
|
|
35
|
-
const value = yield* host.readEnv(name);
|
|
36
|
-
if (value === undefined) {
|
|
37
|
-
missing.push(name);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return missing;
|
|
41
|
-
});
|
|
22
|
+
export const ReleaseCommandRunnerTestLayer = (commandRunner) => Layer.succeed(ReleaseCommandRunner)(commandRunner);
|
|
42
23
|
//# sourceMappingURL=host.js.map
|
package/dist/host/host.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.js","sourceRoot":"","sources":["../../src/host/host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"host.js","sourceRoot":"","sources":["../../src/host/host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AAEzC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAIpD,MAAM,OAAO,kBAAmB,SAAQ,MAAM,CAAC,gBAAgB,EAAsB,CAAC,oBAAoB,EAAE;IAC1G,SAAS,EAAE,MAAM,CAAC,MAAM;IACxB,MAAM,EAAE,MAAM,CAAC,MAAM;CACtB,CAAC;CAAG;AAEL,MAAM,OAAO,aAAc,SAAQ,MAAM,CAAC,KAAK,CAAgB,eAAe,CAAC,CAAC;IAC9E,OAAO,EAAE,WAAW;IACpB,QAAQ,EAAE,MAAM,CAAC,MAAM;IACvB,MAAM,EAAE,MAAM,CAAC,MAAM;IACrB,MAAM,EAAE,MAAM,CAAC,MAAM;IACrB,SAAS,EAAE,MAAM,CAAC,MAAM;IACxB,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,cAAc,EAAE,MAAM,CAAC,MAAM;CAC9B,CAAC;CAAG;AAML,MAAM,OAAO,oBAAqB,SAAQ,OAAO,CAAC,OAAO,EAGtD,CAAC,sBAAsB,CAAC;CAAG;AAE9B,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,aAAwC,EACL,EAAE,CACrC,KAAK,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,aAAa,CAAC,CAAA"}
|
package/dist/host/http-live.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as Layer from "effect/Layer";
|
|
2
2
|
import * as HttpClient from "effect/unstable/http/HttpClient";
|
|
3
|
-
import { ReleaseHost } from "./host.js";
|
|
4
3
|
import { ReleaseHttp } from "./http.js";
|
|
5
4
|
export type * from "../types/effect-internal.js";
|
|
6
|
-
export declare const LiveReleaseHttpLayer: Layer.Layer<ReleaseHttp, never,
|
|
5
|
+
export declare const LiveReleaseHttpLayer: Layer.Layer<ReleaseHttp, never, HttpClient.HttpClient>;
|
|
7
6
|
//# sourceMappingURL=http-live.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-live.d.ts","sourceRoot":"","sources":["../../src/host/http-live.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http-live.d.ts","sourceRoot":"","sources":["../../src/host/http-live.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,KAAK,UAAU,MAAM,iCAAiC,CAAA;AAG7D,OAAO,EAAyB,WAAW,EAAE,MAAM,WAAW,CAAA;AAE9D,mBAAmB,6BAA6B,CAAA;AAyDhD,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CA6CrF,CAAA"}
|
package/dist/host/http-live.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
import * as Config from "effect/Config";
|
|
1
2
|
import * as Effect from "effect/Effect";
|
|
2
3
|
import * as Layer from "effect/Layer";
|
|
4
|
+
import * as Option from "effect/Option";
|
|
3
5
|
import * as HttpClient from "effect/unstable/http/HttpClient";
|
|
4
6
|
import * as HttpClientRequest from "effect/unstable/http/HttpClientRequest";
|
|
5
|
-
import {
|
|
7
|
+
import { HttpHeader } from "../domain/operation.js";
|
|
6
8
|
import { HttpError, HttpResult, ReleaseHttp } from "./http.js";
|
|
7
9
|
const formatUnknown = (cause) => cause instanceof Error ? cause.message : String(cause);
|
|
8
|
-
const
|
|
10
|
+
const nowIso = Effect.fn("http.nowIso")(function* () {
|
|
11
|
+
const millis = yield* Effect.clockWith((clock) => clock.currentTimeMillis);
|
|
12
|
+
return new Date(millis).toISOString();
|
|
13
|
+
});
|
|
14
|
+
const readOptionalEnv = (name) => Config.string(name).pipe(Effect.option, Effect.map(Option.getOrUndefined));
|
|
15
|
+
const resolveHeaders = Effect.fn("resolveHeaders")(function* (request) {
|
|
9
16
|
const envNames = new Set([
|
|
10
17
|
...request.requiredEnv,
|
|
11
18
|
...request.envHeaders.map((header) => header.valueEnv)
|
|
@@ -13,7 +20,7 @@ const resolveHeaders = Effect.fn("resolveHeaders")(function* (host, request) {
|
|
|
13
20
|
const env = new Map();
|
|
14
21
|
const missing = [];
|
|
15
22
|
for (const name of envNames) {
|
|
16
|
-
const value = yield*
|
|
23
|
+
const value = yield* readOptionalEnv(name);
|
|
17
24
|
if (value === undefined) {
|
|
18
25
|
missing.push(name);
|
|
19
26
|
}
|
|
@@ -40,14 +47,14 @@ const resolveHeaders = Effect.fn("resolveHeaders")(function* (host, request) {
|
|
|
40
47
|
}
|
|
41
48
|
return headers;
|
|
42
49
|
});
|
|
50
|
+
const responseHeaders = (headers) => Object.entries(headers).map(([name, value]) => HttpHeader.make({ name, value }));
|
|
43
51
|
export const LiveReleaseHttpLayer = Layer.effect(ReleaseHttp)(Effect.gen(function* () {
|
|
44
|
-
const host = yield* ReleaseHost;
|
|
45
52
|
const client = yield* HttpClient.HttpClient;
|
|
46
53
|
return {
|
|
47
54
|
runJson: (request) => Effect.gen(function* () {
|
|
48
|
-
const headers = yield* resolveHeaders(
|
|
49
|
-
const startedAt =
|
|
50
|
-
const started =
|
|
55
|
+
const headers = yield* resolveHeaders(request);
|
|
56
|
+
const startedAt = yield* nowIso();
|
|
57
|
+
const started = yield* Effect.clockWith((clock) => clock.currentTimeMillis);
|
|
51
58
|
const httpRequest = HttpClientRequest.make(request.method)(request.url, { headers });
|
|
52
59
|
const response = yield* client.execute(httpRequest).pipe(Effect.mapError((error) => HttpError.make({
|
|
53
60
|
operation: "execute",
|
|
@@ -61,14 +68,16 @@ export const LiveReleaseHttpLayer = Layer.effect(ReleaseHttp)(Effect.gen(functio
|
|
|
61
68
|
url: request.url,
|
|
62
69
|
reason: formatUnknown(error)
|
|
63
70
|
})));
|
|
64
|
-
const endedAt =
|
|
71
|
+
const endedAt = yield* nowIso();
|
|
72
|
+
const ended = yield* Effect.clockWith((clock) => clock.currentTimeMillis);
|
|
65
73
|
return HttpResult.make({
|
|
66
74
|
request,
|
|
67
75
|
status: response.status,
|
|
68
76
|
json,
|
|
77
|
+
responseHeaders: responseHeaders(response.headers),
|
|
69
78
|
startedAt,
|
|
70
79
|
endedAt,
|
|
71
|
-
durationMillis: Math.
|
|
80
|
+
durationMillis: Math.max(0, ended - started)
|
|
72
81
|
});
|
|
73
82
|
})
|
|
74
83
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-live.js","sourceRoot":"","sources":["../../src/host/http-live.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,UAAU,MAAM,iCAAiC,CAAA;AAC7D,OAAO,KAAK,iBAAiB,MAAM,wC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,CAAC,CAAC,KAAK,EAAE,EAAE,CACxB,SAAS,CAAC,IAAI,CAAC;gBACb,SAAS,EAAE,SAAS;gBACpB,GAAG,EAAE,OAAO,CAAC,GAAG;gBAChB,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC;aAC7B,CAAC,CACH,CACF,CAAA;YACD,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,KAAK,MAAM;gBACpC,CAAC,CAAC,IAAI;gBACN,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CACzB,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CACxB,SAAS,CAAC,IAAI,CAAC;oBACb,SAAS,EAAE,MAAM;oBACjB,GAAG,EAAE,OAAO,CAAC,GAAG;oBAChB,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC;iBAC7B,CAAC,CACH,CACF,CAAA;YACH,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,CAAA;YAC/B,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAA;YACzE,OAAO,UAAU,CAAC,IAAI,CAAC;gBACrB,OAAO;gBACP,MAAM,EAAE,QAAQ,CAAC,MAAM;gBACvB,IAAI;gBACJ,eAAe,EAAE,eAAe,CAAC,QAAQ,CAAC,OAAO,CAAC;gBAClD,SAAS;gBACT,OAAO;gBACP,cAAc,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;aAC7C,CAAC,CAAA;QACJ,CAAC,CAAC;KACL,CAAA;AACH,CAAC,CAAC,CACH,CAAA"}
|
package/dist/host/http.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as Context from "effect/Context";
|
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
3
|
import * as Layer from "effect/Layer";
|
|
4
4
|
import * as Schema from "effect/Schema";
|
|
5
|
-
import { HttpRequestSpec } from "../domain/operation.js";
|
|
5
|
+
import { HttpHeader, HttpRequestSpec } from "../domain/operation.js";
|
|
6
6
|
export type * from "../types/effect-internal.js";
|
|
7
7
|
declare const HttpError_base: Schema.Class<HttpError, Schema.TaggedStruct<"HttpError", {
|
|
8
8
|
readonly operation: Schema.String;
|
|
@@ -15,6 +15,7 @@ declare const HttpResult_base: Schema.Class<HttpResult, Schema.Struct<{
|
|
|
15
15
|
readonly request: typeof HttpRequestSpec;
|
|
16
16
|
readonly status: Schema.Number;
|
|
17
17
|
readonly json: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
18
|
+
readonly responseHeaders: Schema.$Array<typeof HttpHeader>;
|
|
18
19
|
readonly startedAt: Schema.String;
|
|
19
20
|
readonly endedAt: Schema.String;
|
|
20
21
|
readonly durationMillis: Schema.Number;
|
|
@@ -30,6 +31,7 @@ export declare class ReleaseHttp extends ReleaseHttp_base {
|
|
|
30
31
|
export interface TestHttpResponse {
|
|
31
32
|
readonly status: number;
|
|
32
33
|
readonly json: Schema.Json;
|
|
34
|
+
readonly responseHeaders?: ReadonlyArray<HttpHeader> | undefined;
|
|
33
35
|
}
|
|
34
36
|
export interface TestReleaseHttpOptions {
|
|
35
37
|
readonly responses?: ReadonlyMap<string, TestHttpResponse> | undefined;
|
package/dist/host/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/host/http.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":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