runtime-resolver 0.3.12 → 0.3.14
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/bin/runtime-resolver.d.ts +1 -0
- package/bin/runtime-resolver.js +29 -261
- package/cli/commands/resolve.js +239 -0
- package/cli/schemas/json-schema.js +12 -0
- package/cli/schemas/response.js +86 -0
- package/data/bun-defaults.js +850 -0
- package/data/deno-defaults.js +1526 -0
- package/data/node-defaults.js +4400 -0
- package/errors/AuthenticationError.js +35 -0
- package/errors/CacheError.js +32 -0
- package/errors/FreshnessError.js +38 -0
- package/errors/InvalidInputError.js +33 -0
- package/errors/NetworkError.js +34 -0
- package/errors/ParseError.js +33 -0
- package/errors/RateLimitError.js +39 -0
- package/errors/VersionNotFoundError.js +37 -0
- package/index.d.ts +2577 -2608
- package/index.js +158 -132
- package/layers/AutoBunCacheLive.js +47 -0
- package/layers/AutoDenoCacheLive.js +47 -0
- package/layers/AutoNodeCacheLive.js +58 -0
- package/layers/BunReleaseCacheLive.js +25 -0
- package/layers/BunResolverLive.js +85 -0
- package/layers/BunVersionFetcherLive.js +55 -0
- package/layers/DenoReleaseCacheLive.js +25 -0
- package/layers/DenoResolverLive.js +84 -0
- package/layers/DenoVersionFetcherLive.js +51 -0
- package/layers/FreshBunCacheLive.js +60 -0
- package/layers/FreshDenoCacheLive.js +60 -0
- package/layers/FreshNodeCacheLive.js +55 -0
- package/layers/GitHubAppAuth.js +58 -0
- package/layers/GitHubAutoAuth.js +70 -0
- package/layers/GitHubClientLive.js +130 -0
- package/layers/GitHubTokenAuth.js +50 -0
- package/layers/NodeReleaseCacheLive.js +77 -0
- package/layers/NodeResolverLive.js +107 -0
- package/layers/NodeScheduleFetcherLive.js +37 -0
- package/layers/NodeVersionFetcherLive.js +55 -0
- package/layers/OfflineBunCacheLive.js +40 -0
- package/layers/OfflineDenoCacheLive.js +40 -0
- package/layers/OfflineNodeCacheLive.js +39 -0
- package/layers/RuntimeCacheLive.js +78 -0
- package/lib/retry.js +27 -0
- package/lib/semver.js +21 -0
- package/package.json +57 -68
- package/schemas/bun-release.js +61 -0
- package/schemas/deno-release.js +61 -0
- package/schemas/github.js +74 -0
- package/schemas/node-release.js +130 -0
- package/schemas/node-schedule.js +110 -0
- package/schemas/node.js +68 -0
- package/services/BunReleaseCache.js +33 -0
- package/services/BunResolver.js +36 -0
- package/services/BunVersionFetcher.js +41 -0
- package/services/DenoReleaseCache.js +33 -0
- package/services/DenoResolver.js +36 -0
- package/services/DenoVersionFetcher.js +41 -0
- package/services/GitHubClient.js +40 -0
- package/services/NodeReleaseCache.js +41 -0
- package/services/NodeResolver.js +44 -0
- package/services/NodeScheduleFetcher.js +38 -0
- package/services/NodeVersionFetcher.js +39 -0
- package/services/OctokitInstance.js +44 -0
- package/tsdoc-metadata.json +11 -11
- package/612.js +0 -23
- package/711.js +0 -7554
- package/json-schema.js +0 -95
|
@@ -0,0 +1,41 @@
|
|
|
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 };
|
|
@@ -0,0 +1,40 @@
|
|
|
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 };
|
|
@@ -0,0 +1,41 @@
|
|
|
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 };
|
|
@@ -0,0 +1,44 @@
|
|
|
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} 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}
|
|
38
|
+
*
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
var NodeResolver = class extends Context.Tag("runtime-resolver/NodeResolver")() {};
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
export { NodeResolver };
|
|
@@ -0,0 +1,38 @@
|
|
|
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 };
|
|
@@ -0,0 +1,39 @@
|
|
|
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} 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 };
|
|
@@ -0,0 +1,44 @@
|
|
|
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
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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
|
-
}
|
|
10
|
-
]
|
|
11
|
-
}
|
|
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
|
+
}
|
package/612.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
var __webpack_require__ = {};
|
|
2
|
-
(()=>{
|
|
3
|
-
__webpack_require__.d = (exports, definition)=>{
|
|
4
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
5
|
-
enumerable: true,
|
|
6
|
-
get: definition[key]
|
|
7
|
-
});
|
|
8
|
-
};
|
|
9
|
-
})();
|
|
10
|
-
(()=>{
|
|
11
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
12
|
-
})();
|
|
13
|
-
(()=>{
|
|
14
|
-
__webpack_require__.r = (exports)=>{
|
|
15
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports, Symbol.toStringTag, {
|
|
16
|
-
value: 'Module'
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, '__esModule', {
|
|
19
|
-
value: true
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
})();
|
|
23
|
-
export { __webpack_require__ };
|