runtime-resolver 0.3.22 → 1.0.0
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/README.md +34 -35
- package/bin/runtime-resolver.js +12 -31
- package/command.js +120 -0
- package/layers.js +61 -0
- package/output.js +55 -0
- package/package.json +6 -18
- package/report.js +24 -0
- package/cli/commands/resolve.js +0 -242
- package/cli/schemas/json-schema.js +0 -12
- package/cli/schemas/response.js +0 -86
- package/data/bun-defaults.js +0 -850
- package/data/deno-defaults.js +0 -1538
- package/data/node-defaults.js +0 -4435
- package/errors/AuthenticationError.js +0 -35
- package/errors/CacheError.js +0 -32
- package/errors/FreshnessError.js +0 -38
- package/errors/InvalidInputError.js +0 -33
- package/errors/NetworkError.js +0 -34
- package/errors/ParseError.js +0 -33
- package/errors/RateLimitError.js +0 -37
- package/errors/VersionNotFoundError.js +0 -37
- package/index.d.ts +0 -2574
- package/index.js +0 -166
- package/layers/AutoBunCacheLive.js +0 -47
- package/layers/AutoDenoCacheLive.js +0 -47
- package/layers/AutoNodeCacheLive.js +0 -58
- package/layers/BunReleaseCacheLive.js +0 -25
- package/layers/BunResolverLive.js +0 -85
- package/layers/BunVersionFetcherLive.js +0 -55
- package/layers/DenoReleaseCacheLive.js +0 -25
- package/layers/DenoResolverLive.js +0 -84
- package/layers/DenoVersionFetcherLive.js +0 -51
- package/layers/FreshBunCacheLive.js +0 -60
- package/layers/FreshDenoCacheLive.js +0 -60
- package/layers/FreshNodeCacheLive.js +0 -55
- package/layers/GitHubAppAuth.js +0 -58
- package/layers/GitHubAutoAuth.js +0 -70
- package/layers/GitHubClientLive.js +0 -130
- package/layers/GitHubTokenAuth.js +0 -50
- package/layers/NodeReleaseCacheLive.js +0 -77
- package/layers/NodeResolverLive.js +0 -107
- package/layers/NodeScheduleFetcherLive.js +0 -37
- package/layers/NodeVersionFetcherLive.js +0 -55
- package/layers/OfflineBunCacheLive.js +0 -40
- package/layers/OfflineDenoCacheLive.js +0 -40
- package/layers/OfflineNodeCacheLive.js +0 -39
- package/layers/RuntimeCacheLive.js +0 -78
- package/lib/retry.js +0 -27
- package/lib/semver.js +0 -21
- package/schemas/bun-release.js +0 -63
- package/schemas/deno-release.js +0 -63
- package/schemas/github.js +0 -74
- package/schemas/node-release.js +0 -133
- package/schemas/node-schedule.js +0 -110
- package/schemas/node.js +0 -68
- package/services/BunReleaseCache.js +0 -33
- package/services/BunResolver.js +0 -36
- package/services/BunVersionFetcher.js +0 -41
- package/services/DenoReleaseCache.js +0 -33
- package/services/DenoResolver.js +0 -36
- package/services/DenoVersionFetcher.js +0 -41
- package/services/GitHubClient.js +0 -40
- package/services/NodeReleaseCache.js +0 -41
- package/services/NodeResolver.js +0 -44
- package/services/NodeScheduleFetcher.js +0 -38
- package/services/NodeVersionFetcher.js +0 -39
- package/services/OctokitInstance.js +0 -44
- package/tsdoc-metadata.json +0 -11
package/schemas/node-schedule.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { Data, DateTime, Effect, Option } from "effect";
|
|
2
|
-
|
|
3
|
-
//#region src/schemas/node-schedule.ts
|
|
4
|
-
/**
|
|
5
|
-
* Immutable snapshot of the Node.js release schedule.
|
|
6
|
-
*
|
|
7
|
-
* Holds a `ReadonlyArray<NodeScheduleEntry>` parsed from the raw
|
|
8
|
-
* {@link NodeScheduleData} fetched by {@link NodeScheduleFetcher}. A single
|
|
9
|
-
* `NodeSchedule` instance lives inside a `Ref<NodeSchedule>` that is shared
|
|
10
|
-
* across all {@link NodeRelease} instances so that schedule updates propagate
|
|
11
|
-
* without rebuilding the release cache.
|
|
12
|
-
*
|
|
13
|
-
* `NodeSchedule` extends `Data.TaggedClass` and therefore supports structural
|
|
14
|
-
* equality — two schedules built from identical data compare as equal.
|
|
15
|
-
*
|
|
16
|
-
* @see {@link NodeRelease}
|
|
17
|
-
* @see {@link NodeScheduleFetcher}
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```typescript
|
|
21
|
-
* import { Effect } from "effect";
|
|
22
|
-
* import type { NodePhase } from "./common.js";
|
|
23
|
-
* import type { NodeScheduleData } from "./node-schedule.js";
|
|
24
|
-
* import { NodeSchedule } from "./node-schedule.js";
|
|
25
|
-
*
|
|
26
|
-
* const data: NodeScheduleData = {
|
|
27
|
-
* v20: {
|
|
28
|
-
* start: "2023-04-18",
|
|
29
|
-
* lts: "2023-10-24",
|
|
30
|
-
* maintenance: "2024-10-22",
|
|
31
|
-
* end: "2026-04-30",
|
|
32
|
-
* codename: "Iron",
|
|
33
|
-
* },
|
|
34
|
-
* };
|
|
35
|
-
*
|
|
36
|
-
* const schedule = NodeSchedule.fromData(data);
|
|
37
|
-
*
|
|
38
|
-
* const program = schedule.phaseFor(20, new Date("2024-01-01") as any).pipe(
|
|
39
|
-
* Effect.map((phase: NodePhase | null) => {
|
|
40
|
-
* console.log(phase); // "active-lts"
|
|
41
|
-
* }),
|
|
42
|
-
* );
|
|
43
|
-
*
|
|
44
|
-
* Effect.runPromise(program);
|
|
45
|
-
* ```
|
|
46
|
-
*
|
|
47
|
-
* @public
|
|
48
|
-
*/
|
|
49
|
-
var NodeSchedule = class NodeSchedule extends Data.TaggedClass("NodeSchedule") {
|
|
50
|
-
/**
|
|
51
|
-
* Parse raw {@link NodeScheduleData} into a `NodeSchedule` instance.
|
|
52
|
-
*
|
|
53
|
-
* Iterates over every key of the form `"vNN"`, converts ISO date strings
|
|
54
|
-
* to `DateTime.DateTime`, and normalises missing codenames to `""`.
|
|
55
|
-
*
|
|
56
|
-
* @param data - The raw JSON object fetched from the Node.js release repo.
|
|
57
|
-
* @returns A fully constructed, immutable `NodeSchedule`.
|
|
58
|
-
*/
|
|
59
|
-
static fromData(data) {
|
|
60
|
-
const entries = [];
|
|
61
|
-
for (const [key, value] of Object.entries(data)) {
|
|
62
|
-
const major = Number.parseInt(key.replace("v", ""), 10);
|
|
63
|
-
if (Number.isNaN(major)) continue;
|
|
64
|
-
entries.push({
|
|
65
|
-
major,
|
|
66
|
-
start: DateTime.unsafeMake(value.start),
|
|
67
|
-
lts: value.lts ? DateTime.unsafeMake(value.lts) : null,
|
|
68
|
-
maintenance: value.maintenance ? DateTime.unsafeMake(value.maintenance) : null,
|
|
69
|
-
end: DateTime.unsafeMake(value.end),
|
|
70
|
-
codename: value.codename ?? ""
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
return new NodeSchedule({ entries });
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Determine the current {@link (NodePhase:type)} for a given major version number
|
|
77
|
-
* at the specified point in time.
|
|
78
|
-
*
|
|
79
|
-
* Returns `null` when the major is not present in the schedule or when
|
|
80
|
-
* `now` is before the release's start date.
|
|
81
|
-
*
|
|
82
|
-
* @param major - The Node.js major version number (e.g. `20`).
|
|
83
|
-
* @param now - The reference `DateTime` against which phases are evaluated.
|
|
84
|
-
*/
|
|
85
|
-
phaseFor(major, now) {
|
|
86
|
-
return Effect.sync(() => {
|
|
87
|
-
const entry = this.entries.find((e) => e.major === major);
|
|
88
|
-
if (!entry) return null;
|
|
89
|
-
if (DateTime.lessThan(now, entry.start)) return null;
|
|
90
|
-
if (DateTime.greaterThanOrEqualTo(now, entry.end)) return "end-of-life";
|
|
91
|
-
if (entry.maintenance && DateTime.greaterThanOrEqualTo(now, entry.maintenance)) return "maintenance-lts";
|
|
92
|
-
if (entry.lts && DateTime.greaterThanOrEqualTo(now, entry.lts)) return "active-lts";
|
|
93
|
-
return "current";
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Look up the {@link NodeScheduleEntry} for a given major version number.
|
|
98
|
-
*
|
|
99
|
-
* Returns `Option.none()` when the major is not present in the schedule.
|
|
100
|
-
*
|
|
101
|
-
* @param major - The Node.js major version number (e.g. `20`).
|
|
102
|
-
*/
|
|
103
|
-
entryFor(major) {
|
|
104
|
-
const entry = this.entries.find((e) => e.major === major);
|
|
105
|
-
return entry ? Option.some(entry) : Option.none();
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
//#endregion
|
|
110
|
-
export { NodeSchedule };
|
package/schemas/node.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { Schema } from "effect";
|
|
2
|
-
|
|
3
|
-
//#region src/schemas/node.ts
|
|
4
|
-
/**
|
|
5
|
-
* A single entry in the Node.js distribution index
|
|
6
|
-
* (`https://nodejs.org/dist/index.json`).
|
|
7
|
-
*
|
|
8
|
-
* Decoded by {@link NodeVersionFetcherLive} when fetching the full list of
|
|
9
|
-
* available Node.js releases from the official distribution server.
|
|
10
|
-
*
|
|
11
|
-
* @internal
|
|
12
|
-
*/
|
|
13
|
-
const NodeDistVersion = Schema.Struct({
|
|
14
|
-
version: Schema.String,
|
|
15
|
-
date: Schema.String,
|
|
16
|
-
files: Schema.Array(Schema.String),
|
|
17
|
-
npm: Schema.optional(Schema.String),
|
|
18
|
-
v8: Schema.optional(Schema.String),
|
|
19
|
-
uv: Schema.optional(Schema.String),
|
|
20
|
-
zlib: Schema.optional(Schema.String),
|
|
21
|
-
openssl: Schema.optional(Schema.String),
|
|
22
|
-
modules: Schema.optional(Schema.String),
|
|
23
|
-
lts: Schema.Union(Schema.Literal(false), Schema.String),
|
|
24
|
-
security: Schema.Boolean
|
|
25
|
-
});
|
|
26
|
-
/**
|
|
27
|
-
* The full decoded body of `https://nodejs.org/dist/index.json`.
|
|
28
|
-
*
|
|
29
|
-
* Decoded by {@link NodeVersionFetcherLive} before being mapped into
|
|
30
|
-
* {@link NodeRelease} instances.
|
|
31
|
-
*
|
|
32
|
-
* @internal
|
|
33
|
-
*/
|
|
34
|
-
const NodeDistIndex = Schema.Array(NodeDistVersion);
|
|
35
|
-
/**
|
|
36
|
-
* A single entry in the Node.js release schedule JSON fetched by
|
|
37
|
-
* {@link NodeScheduleFetcherLive}.
|
|
38
|
-
*
|
|
39
|
-
* All date-like fields are optional because odd-numbered major lines
|
|
40
|
-
* (e.g. v21) never enter LTS.
|
|
41
|
-
*
|
|
42
|
-
* @internal
|
|
43
|
-
*/
|
|
44
|
-
const ReleaseScheduleEntry = Schema.Struct({
|
|
45
|
-
start: Schema.String,
|
|
46
|
-
lts: Schema.optional(Schema.String),
|
|
47
|
-
maintenance: Schema.optional(Schema.String),
|
|
48
|
-
end: Schema.String,
|
|
49
|
-
codename: Schema.optional(Schema.String)
|
|
50
|
-
});
|
|
51
|
-
/**
|
|
52
|
-
* The full decoded body of the Node.js release schedule JSON fetched by
|
|
53
|
-
* {@link NodeScheduleFetcherLive}.
|
|
54
|
-
*
|
|
55
|
-
* Keyed by major version string (e.g. `"v20"`); values are
|
|
56
|
-
* {@link ReleaseScheduleEntry} objects. After decoding, this record is handed
|
|
57
|
-
* to {@link NodeSchedule.fromData} to produce an immutable
|
|
58
|
-
* {@link NodeSchedule}.
|
|
59
|
-
*
|
|
60
|
-
* @internal
|
|
61
|
-
*/
|
|
62
|
-
const NodeReleaseSchedule = Schema.Record({
|
|
63
|
-
key: Schema.String,
|
|
64
|
-
value: ReleaseScheduleEntry
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
//#endregion
|
|
68
|
-
export { NodeDistIndex, NodeDistVersion, NodeReleaseSchedule, ReleaseScheduleEntry };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Context } from "effect";
|
|
2
|
-
|
|
3
|
-
//#region src/services/BunReleaseCache.ts
|
|
4
|
-
/**
|
|
5
|
-
* Specialisation of {@link RuntimeCache} for Bun release objects.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import type { BunRelease } from "runtime-resolver";
|
|
10
|
-
* import { BunReleaseCache, OfflineBunCacheLive } from "runtime-resolver";
|
|
11
|
-
* import { Effect } from "effect";
|
|
12
|
-
*
|
|
13
|
-
* const program = Effect.gen(function* () {
|
|
14
|
-
* const cache = yield* BunReleaseCache;
|
|
15
|
-
* const releases = yield* cache.releases();
|
|
16
|
-
* console.log(releases.length);
|
|
17
|
-
* });
|
|
18
|
-
*
|
|
19
|
-
* Effect.runPromise(program.pipe(Effect.provide(OfflineBunCacheLive)));
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* @see {@link BunRelease}
|
|
23
|
-
* @see {@link RuntimeCache}
|
|
24
|
-
* @see {@link AutoBunCacheLive}
|
|
25
|
-
* @see {@link FreshBunCacheLive}
|
|
26
|
-
* @see {@link OfflineBunCacheLive}
|
|
27
|
-
*
|
|
28
|
-
* @public
|
|
29
|
-
*/
|
|
30
|
-
var BunReleaseCache = class extends Context.Tag("runtime-resolver/BunReleaseCache")() {};
|
|
31
|
-
|
|
32
|
-
//#endregion
|
|
33
|
-
export { BunReleaseCache };
|
package/services/BunResolver.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Context } from "effect";
|
|
2
|
-
|
|
3
|
-
//#region src/services/BunResolver.ts
|
|
4
|
-
/**
|
|
5
|
-
* Service for resolving Bun runtime versions against the cached
|
|
6
|
-
* release index.
|
|
7
|
-
*
|
|
8
|
-
* For a one-shot Promise-based API see {@link resolveBun}.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* import type { ResolvedVersions } from "runtime-resolver";
|
|
13
|
-
* import { BunResolver, BunResolverLive } from "runtime-resolver";
|
|
14
|
-
* import { Effect } from "effect";
|
|
15
|
-
*
|
|
16
|
-
* const program = Effect.gen(function* () {
|
|
17
|
-
* const resolver = yield* BunResolver;
|
|
18
|
-
* const result = yield* resolver.resolve({ semverRange: "^1.0.0", increments: "minor" });
|
|
19
|
-
* console.log(result.latest);
|
|
20
|
-
* console.log(result.versions);
|
|
21
|
-
* });
|
|
22
|
-
*
|
|
23
|
-
* Effect.runPromise(program.pipe(Effect.provide(BunResolverLive)));
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* @see {@link BunResolverLive}
|
|
27
|
-
* @see {@link resolveBun}
|
|
28
|
-
* @see {@link BunResolverOptions}
|
|
29
|
-
* @see {@link (ResolvedVersions:type)}
|
|
30
|
-
*
|
|
31
|
-
* @public
|
|
32
|
-
*/
|
|
33
|
-
var BunResolver = class extends Context.Tag("runtime-resolver/BunResolver")() {};
|
|
34
|
-
|
|
35
|
-
//#endregion
|
|
36
|
-
export { BunResolver };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Context } from "effect";
|
|
2
|
-
|
|
3
|
-
//#region src/services/BunVersionFetcher.ts
|
|
4
|
-
/**
|
|
5
|
-
* Service for fetching Bun release data from the GitHub API.
|
|
6
|
-
*
|
|
7
|
-
* Retrieves both the parsed semver version list and the raw release input
|
|
8
|
-
* records needed to populate a {@link BunReleaseCache}. The live
|
|
9
|
-
* implementation queries the `oven-sh/bun` GitHub repository via
|
|
10
|
-
* {@link GitHubClient}.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* import type { RuntimeReleaseInput } from "runtime-resolver";
|
|
15
|
-
* import { BunVersionFetcher, BunVersionFetcherLive, GitHubAutoAuth } from "runtime-resolver";
|
|
16
|
-
* import { Effect } from "effect";
|
|
17
|
-
*
|
|
18
|
-
* const program = Effect.gen(function* () {
|
|
19
|
-
* const fetcher = yield* BunVersionFetcher;
|
|
20
|
-
* const { versions, inputs } = yield* fetcher.fetch();
|
|
21
|
-
* console.log(`Fetched ${versions.length} Bun releases`);
|
|
22
|
-
* });
|
|
23
|
-
*
|
|
24
|
-
* Effect.runPromise(
|
|
25
|
-
* program.pipe(Effect.provide(BunVersionFetcherLive), Effect.provide(GitHubAutoAuth)),
|
|
26
|
-
* );
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @see {@link BunVersionFetcherLive}
|
|
30
|
-
* @see {@link BunReleaseCache}
|
|
31
|
-
* @see {@link AuthenticationError}
|
|
32
|
-
* @see {@link NetworkError}
|
|
33
|
-
* @see {@link ParseError}
|
|
34
|
-
* @see {@link RateLimitError}
|
|
35
|
-
*
|
|
36
|
-
* @public
|
|
37
|
-
*/
|
|
38
|
-
var BunVersionFetcher = class extends Context.Tag("runtime-resolver/BunVersionFetcher")() {};
|
|
39
|
-
|
|
40
|
-
//#endregion
|
|
41
|
-
export { BunVersionFetcher };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Context } from "effect";
|
|
2
|
-
|
|
3
|
-
//#region src/services/DenoReleaseCache.ts
|
|
4
|
-
/**
|
|
5
|
-
* Specialisation of {@link RuntimeCache} for Deno release objects.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import type { DenoRelease } from "runtime-resolver";
|
|
10
|
-
* import { DenoReleaseCache, OfflineDenoCacheLive } from "runtime-resolver";
|
|
11
|
-
* import { Effect } from "effect";
|
|
12
|
-
*
|
|
13
|
-
* const program = Effect.gen(function* () {
|
|
14
|
-
* const cache = yield* DenoReleaseCache;
|
|
15
|
-
* const latest = yield* cache.latest();
|
|
16
|
-
* console.log(latest.version.toString());
|
|
17
|
-
* });
|
|
18
|
-
*
|
|
19
|
-
* Effect.runPromise(program.pipe(Effect.provide(OfflineDenoCacheLive)));
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* @see {@link DenoRelease}
|
|
23
|
-
* @see {@link RuntimeCache}
|
|
24
|
-
* @see {@link AutoDenoCacheLive}
|
|
25
|
-
* @see {@link FreshDenoCacheLive}
|
|
26
|
-
* @see {@link OfflineDenoCacheLive}
|
|
27
|
-
*
|
|
28
|
-
* @public
|
|
29
|
-
*/
|
|
30
|
-
var DenoReleaseCache = class extends Context.Tag("runtime-resolver/DenoReleaseCache")() {};
|
|
31
|
-
|
|
32
|
-
//#endregion
|
|
33
|
-
export { DenoReleaseCache };
|
package/services/DenoResolver.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Context } from "effect";
|
|
2
|
-
|
|
3
|
-
//#region src/services/DenoResolver.ts
|
|
4
|
-
/**
|
|
5
|
-
* Service for resolving Deno runtime versions against the cached
|
|
6
|
-
* release index.
|
|
7
|
-
*
|
|
8
|
-
* For a one-shot Promise-based API see {@link resolveDeno}.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* import type { ResolvedVersions } from "runtime-resolver";
|
|
13
|
-
* import { DenoResolver, DenoResolverLive } from "runtime-resolver";
|
|
14
|
-
* import { Effect } from "effect";
|
|
15
|
-
*
|
|
16
|
-
* const program = Effect.gen(function* () {
|
|
17
|
-
* const resolver = yield* DenoResolver;
|
|
18
|
-
* const result = yield* resolver.resolve({ semverRange: "^2.0.0", increments: "minor" });
|
|
19
|
-
* console.log(result.latest);
|
|
20
|
-
* console.log(result.versions);
|
|
21
|
-
* });
|
|
22
|
-
*
|
|
23
|
-
* Effect.runPromise(program.pipe(Effect.provide(DenoResolverLive)));
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* @see {@link DenoResolverLive}
|
|
27
|
-
* @see {@link resolveDeno}
|
|
28
|
-
* @see {@link DenoResolverOptions}
|
|
29
|
-
* @see {@link (ResolvedVersions:type)}
|
|
30
|
-
*
|
|
31
|
-
* @public
|
|
32
|
-
*/
|
|
33
|
-
var DenoResolver = class extends Context.Tag("runtime-resolver/DenoResolver")() {};
|
|
34
|
-
|
|
35
|
-
//#endregion
|
|
36
|
-
export { DenoResolver };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Context } from "effect";
|
|
2
|
-
|
|
3
|
-
//#region src/services/DenoVersionFetcher.ts
|
|
4
|
-
/**
|
|
5
|
-
* Service for fetching Deno release data from the GitHub API.
|
|
6
|
-
*
|
|
7
|
-
* Retrieves both the parsed semver version list and the raw release input
|
|
8
|
-
* records needed to populate a {@link DenoReleaseCache}. The live
|
|
9
|
-
* implementation queries the `denoland/deno` GitHub repository via
|
|
10
|
-
* {@link GitHubClient}.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* import type { RuntimeReleaseInput } from "runtime-resolver";
|
|
15
|
-
* import { DenoVersionFetcher, DenoVersionFetcherLive, GitHubAutoAuth } from "runtime-resolver";
|
|
16
|
-
* import { Effect } from "effect";
|
|
17
|
-
*
|
|
18
|
-
* const program = Effect.gen(function* () {
|
|
19
|
-
* const fetcher = yield* DenoVersionFetcher;
|
|
20
|
-
* const { versions, inputs } = yield* fetcher.fetch();
|
|
21
|
-
* console.log(`Fetched ${versions.length} Deno releases`);
|
|
22
|
-
* });
|
|
23
|
-
*
|
|
24
|
-
* Effect.runPromise(
|
|
25
|
-
* program.pipe(Effect.provide(DenoVersionFetcherLive), Effect.provide(GitHubAutoAuth)),
|
|
26
|
-
* );
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @see {@link DenoVersionFetcherLive}
|
|
30
|
-
* @see {@link DenoReleaseCache}
|
|
31
|
-
* @see {@link AuthenticationError}
|
|
32
|
-
* @see {@link NetworkError}
|
|
33
|
-
* @see {@link ParseError}
|
|
34
|
-
* @see {@link RateLimitError}
|
|
35
|
-
*
|
|
36
|
-
* @public
|
|
37
|
-
*/
|
|
38
|
-
var DenoVersionFetcher = class extends Context.Tag("runtime-resolver/DenoVersionFetcher")() {};
|
|
39
|
-
|
|
40
|
-
//#endregion
|
|
41
|
-
export { DenoVersionFetcher };
|
package/services/GitHubClient.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Context } from "effect";
|
|
2
|
-
|
|
3
|
-
//#region src/services/GitHubClient.ts
|
|
4
|
-
/**
|
|
5
|
-
* Service for GitHub REST API operations used by the version
|
|
6
|
-
* fetcher services.
|
|
7
|
-
*
|
|
8
|
-
* Abstracts over pagination and authentication so that higher-level services
|
|
9
|
-
* such as {@link BunVersionFetcher}, {@link DenoVersionFetcher}, and
|
|
10
|
-
* {@link NodeScheduleFetcher} remain independent of the underlying HTTP
|
|
11
|
-
* transport. The live implementation is provided by {@link GitHubClientLive}
|
|
12
|
-
* and requires an {@link OctokitInstance} in its dependency graph.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* import type { GitHubTag } from "runtime-resolver";
|
|
17
|
-
* import { GitHubClient, GitHubClientLive, GitHubAutoAuth } from "runtime-resolver";
|
|
18
|
-
* import { Effect } from "effect";
|
|
19
|
-
*
|
|
20
|
-
* const program = Effect.gen(function* () {
|
|
21
|
-
* const client = yield* GitHubClient;
|
|
22
|
-
* const tags = yield* client.listTags("oven-sh", "bun", { perPage: 100 });
|
|
23
|
-
* console.log(`Found ${tags.length} tags`);
|
|
24
|
-
* });
|
|
25
|
-
*
|
|
26
|
-
* Effect.runPromise(
|
|
27
|
-
* program.pipe(Effect.provide(GitHubClientLive), Effect.provide(GitHubAutoAuth)),
|
|
28
|
-
* );
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
* @see {@link GitHubClientLive}
|
|
32
|
-
* @see {@link OctokitInstance}
|
|
33
|
-
* @see {@link ListOptions}
|
|
34
|
-
*
|
|
35
|
-
* @public
|
|
36
|
-
*/
|
|
37
|
-
var GitHubClient = class extends Context.Tag("runtime-resolver/GitHubClient")() {};
|
|
38
|
-
|
|
39
|
-
//#endregion
|
|
40
|
-
export { GitHubClient };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Context } from "effect";
|
|
2
|
-
|
|
3
|
-
//#region src/services/NodeReleaseCache.ts
|
|
4
|
-
/**
|
|
5
|
-
* Node.js-specific cache service that extends {@link RuntimeCache} with
|
|
6
|
-
* additional operations for lifecycle schedule data and LTS / current
|
|
7
|
-
* release filtering.
|
|
8
|
-
*
|
|
9
|
-
* Unlike the Bun and Deno equivalents this service is not a plain type alias
|
|
10
|
-
* — it adds four Node-specific methods on top of the generic cache contract.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* import type { NodeRelease } from "runtime-resolver";
|
|
15
|
-
* import { NodeReleaseCache, OfflineNodeCacheLive } from "runtime-resolver";
|
|
16
|
-
* import { Effect } from "effect";
|
|
17
|
-
*
|
|
18
|
-
* const program = Effect.gen(function* () {
|
|
19
|
-
* const cache = yield* NodeReleaseCache;
|
|
20
|
-
* const lts = yield* cache.ltsReleases();
|
|
21
|
-
* for (const release of lts) {
|
|
22
|
-
* console.log(release.version.toString(), release.phase);
|
|
23
|
-
* }
|
|
24
|
-
* });
|
|
25
|
-
*
|
|
26
|
-
* Effect.runPromise(program.pipe(Effect.provide(OfflineNodeCacheLive)));
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @see {@link NodeRelease}
|
|
30
|
-
* @see {@link NodeScheduleData}
|
|
31
|
-
* @see {@link RuntimeCache}
|
|
32
|
-
* @see {@link AutoNodeCacheLive}
|
|
33
|
-
* @see {@link FreshNodeCacheLive}
|
|
34
|
-
* @see {@link OfflineNodeCacheLive}
|
|
35
|
-
*
|
|
36
|
-
* @public
|
|
37
|
-
*/
|
|
38
|
-
var NodeReleaseCache = class extends Context.Tag("runtime-resolver/NodeReleaseCache")() {};
|
|
39
|
-
|
|
40
|
-
//#endregion
|
|
41
|
-
export { NodeReleaseCache };
|
package/services/NodeResolver.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Context } from "effect";
|
|
2
|
-
|
|
3
|
-
//#region src/services/NodeResolver.ts
|
|
4
|
-
/**
|
|
5
|
-
* Service for resolving Node.js runtime versions against the cached
|
|
6
|
-
* release index.
|
|
7
|
-
*
|
|
8
|
-
* Unlike {@link BunResolver} and {@link DenoResolver}, this service is
|
|
9
|
-
* lifecycle-aware: results can be filtered by {@link (NodePhase:type)} and evaluated
|
|
10
|
-
* against a specific reference date.
|
|
11
|
-
*
|
|
12
|
-
* For a one-shot Promise-based API see {@link resolveNode}.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* import type { ResolvedVersions } from "runtime-resolver";
|
|
17
|
-
* import { NodeResolver, NodeResolverLive } from "runtime-resolver";
|
|
18
|
-
* import { Effect } from "effect";
|
|
19
|
-
*
|
|
20
|
-
* const program = Effect.gen(function* () {
|
|
21
|
-
* const resolver = yield* NodeResolver;
|
|
22
|
-
* const result = yield* resolver.resolve({
|
|
23
|
-
* semverRange: "^20.0.0",
|
|
24
|
-
* phases: ["active-lts"],
|
|
25
|
-
* increments: "minor",
|
|
26
|
-
* });
|
|
27
|
-
* console.log(result.latest);
|
|
28
|
-
* console.log(result.lts);
|
|
29
|
-
* });
|
|
30
|
-
*
|
|
31
|
-
* Effect.runPromise(program.pipe(Effect.provide(NodeResolverLive)));
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* @see {@link NodeResolverLive}
|
|
35
|
-
* @see {@link resolveNode}
|
|
36
|
-
* @see {@link NodeResolverOptions}
|
|
37
|
-
* @see {@link (ResolvedVersions:type)}
|
|
38
|
-
*
|
|
39
|
-
* @public
|
|
40
|
-
*/
|
|
41
|
-
var NodeResolver = class extends Context.Tag("runtime-resolver/NodeResolver")() {};
|
|
42
|
-
|
|
43
|
-
//#endregion
|
|
44
|
-
export { NodeResolver };
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Context } from "effect";
|
|
2
|
-
|
|
3
|
-
//#region src/services/NodeScheduleFetcher.ts
|
|
4
|
-
/**
|
|
5
|
-
* Service for fetching the official Node.js release schedule.
|
|
6
|
-
*
|
|
7
|
-
* The schedule maps each major release line to its LTS start date and
|
|
8
|
-
* end-of-life date, and is used by {@link NodeReleaseCache} to assign
|
|
9
|
-
* lifecycle phases to individual releases. The live implementation fetches
|
|
10
|
-
* from the `nodejs/Release` GitHub repository via a plain HTTP request.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* import type { NodeScheduleData } from "runtime-resolver";
|
|
15
|
-
* import { NodeScheduleFetcher, NodeScheduleFetcherLive } from "runtime-resolver";
|
|
16
|
-
* import { Effect } from "effect";
|
|
17
|
-
*
|
|
18
|
-
* const program = Effect.gen(function* () {
|
|
19
|
-
* const fetcher = yield* NodeScheduleFetcher;
|
|
20
|
-
* const schedule = yield* fetcher.fetch();
|
|
21
|
-
* console.log(Object.keys(schedule).length, "major release lines");
|
|
22
|
-
* });
|
|
23
|
-
*
|
|
24
|
-
* Effect.runPromise(program.pipe(Effect.provide(NodeScheduleFetcherLive)));
|
|
25
|
-
* ```
|
|
26
|
-
*
|
|
27
|
-
* @see {@link NodeScheduleFetcherLive}
|
|
28
|
-
* @see {@link NodeReleaseCache}
|
|
29
|
-
* @see {@link NodeScheduleData}
|
|
30
|
-
* @see {@link NetworkError}
|
|
31
|
-
* @see {@link ParseError}
|
|
32
|
-
*
|
|
33
|
-
* @public
|
|
34
|
-
*/
|
|
35
|
-
var NodeScheduleFetcher = class extends Context.Tag("runtime-resolver/NodeScheduleFetcher")() {};
|
|
36
|
-
|
|
37
|
-
//#endregion
|
|
38
|
-
export { NodeScheduleFetcher };
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Context } from "effect";
|
|
2
|
-
|
|
3
|
-
//#region src/services/NodeVersionFetcher.ts
|
|
4
|
-
/**
|
|
5
|
-
* Service for fetching Node.js release data from the official
|
|
6
|
-
* Node.js distribution index.
|
|
7
|
-
*
|
|
8
|
-
* Retrieves both the parsed semver version list and the raw
|
|
9
|
-
* {@link (NodeReleaseInput:type)} records needed to populate a
|
|
10
|
-
* {@link NodeReleaseCache}. The live implementation fetches from
|
|
11
|
-
* `https://nodejs.org/dist/index.json` via a plain HTTP request — no GitHub
|
|
12
|
-
* credentials are required.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* import type { NodeReleaseInput } from "runtime-resolver";
|
|
17
|
-
* import { NodeVersionFetcher, NodeVersionFetcherLive } from "runtime-resolver";
|
|
18
|
-
* import { Effect } from "effect";
|
|
19
|
-
*
|
|
20
|
-
* const program = Effect.gen(function* () {
|
|
21
|
-
* const fetcher = yield* NodeVersionFetcher;
|
|
22
|
-
* const { versions, inputs } = yield* fetcher.fetch();
|
|
23
|
-
* console.log(`Fetched ${versions.length} Node.js releases`);
|
|
24
|
-
* });
|
|
25
|
-
*
|
|
26
|
-
* Effect.runPromise(program.pipe(Effect.provide(NodeVersionFetcherLive)));
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @see {@link NodeVersionFetcherLive}
|
|
30
|
-
* @see {@link NodeReleaseCache}
|
|
31
|
-
* @see {@link NetworkError}
|
|
32
|
-
* @see {@link ParseError}
|
|
33
|
-
*
|
|
34
|
-
* @public
|
|
35
|
-
*/
|
|
36
|
-
var NodeVersionFetcher = class extends Context.Tag("runtime-resolver/NodeVersionFetcher")() {};
|
|
37
|
-
|
|
38
|
-
//#endregion
|
|
39
|
-
export { NodeVersionFetcher };
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Context } from "effect";
|
|
2
|
-
|
|
3
|
-
//#region src/services/OctokitInstance.ts
|
|
4
|
-
/**
|
|
5
|
-
* Thin wrapper around the subset of Octokit's REST client used by
|
|
6
|
-
* {@link GitHubClient}.
|
|
7
|
-
*
|
|
8
|
-
* Exposing only the repository methods actually consumed by this library
|
|
9
|
-
* keeps the surface area narrow and makes the interface straightforward to
|
|
10
|
-
* stub in tests without pulling in the full Octokit type.
|
|
11
|
-
*
|
|
12
|
-
* An `OctokitInstance` is provided to the dependency graph by one of the
|
|
13
|
-
* three authentication layers: {@link GitHubTokenAuth}, {@link GitHubAppAuth},
|
|
14
|
-
* or {@link GitHubAutoAuth}.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* import { OctokitInstance, GitHubClientLive, GitHubAutoAuth } from "runtime-resolver";
|
|
19
|
-
* import { Effect } from "effect";
|
|
20
|
-
*
|
|
21
|
-
* const program = Effect.gen(function* () {
|
|
22
|
-
* const octokit = yield* OctokitInstance;
|
|
23
|
-
* const response = await octokit.rest.repos.listTags({
|
|
24
|
-
* owner: "oven-sh",
|
|
25
|
-
* repo: "bun",
|
|
26
|
-
* per_page: 10,
|
|
27
|
-
* });
|
|
28
|
-
* console.log(response.data.length);
|
|
29
|
-
* });
|
|
30
|
-
*
|
|
31
|
-
* Effect.runPromise(program.pipe(Effect.provide(GitHubAutoAuth)));
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* @see {@link GitHubClientLive}
|
|
35
|
-
* @see {@link GitHubTokenAuth}
|
|
36
|
-
* @see {@link GitHubAppAuth}
|
|
37
|
-
* @see {@link GitHubAutoAuth}
|
|
38
|
-
*
|
|
39
|
-
* @public
|
|
40
|
-
*/
|
|
41
|
-
var OctokitInstance = class extends Context.Tag("runtime-resolver/OctokitInstance")() {};
|
|
42
|
-
|
|
43
|
-
//#endregion
|
|
44
|
-
export { OctokitInstance };
|
package/tsdoc-metadata.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
-
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
-
{
|
|
4
|
-
"tsdocVersion": "0.12",
|
|
5
|
-
"toolPackages": [
|
|
6
|
-
{
|
|
7
|
-
"packageName": "@microsoft/api-extractor",
|
|
8
|
-
"packageVersion": "7.58.9"
|
|
9
|
-
}
|
|
10
|
-
]
|
|
11
|
-
}
|