runtime-resolver 0.3.22 → 1.0.1

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.
Files changed (68) hide show
  1. package/README.md +34 -35
  2. package/bin/runtime-resolver.js +12 -31
  3. package/command.js +120 -0
  4. package/layers.js +61 -0
  5. package/output.js +55 -0
  6. package/package.json +6 -18
  7. package/report.js +24 -0
  8. package/cli/commands/resolve.js +0 -242
  9. package/cli/schemas/json-schema.js +0 -12
  10. package/cli/schemas/response.js +0 -86
  11. package/data/bun-defaults.js +0 -850
  12. package/data/deno-defaults.js +0 -1538
  13. package/data/node-defaults.js +0 -4435
  14. package/errors/AuthenticationError.js +0 -35
  15. package/errors/CacheError.js +0 -32
  16. package/errors/FreshnessError.js +0 -38
  17. package/errors/InvalidInputError.js +0 -33
  18. package/errors/NetworkError.js +0 -34
  19. package/errors/ParseError.js +0 -33
  20. package/errors/RateLimitError.js +0 -37
  21. package/errors/VersionNotFoundError.js +0 -37
  22. package/index.d.ts +0 -2574
  23. package/index.js +0 -166
  24. package/layers/AutoBunCacheLive.js +0 -47
  25. package/layers/AutoDenoCacheLive.js +0 -47
  26. package/layers/AutoNodeCacheLive.js +0 -58
  27. package/layers/BunReleaseCacheLive.js +0 -25
  28. package/layers/BunResolverLive.js +0 -85
  29. package/layers/BunVersionFetcherLive.js +0 -55
  30. package/layers/DenoReleaseCacheLive.js +0 -25
  31. package/layers/DenoResolverLive.js +0 -84
  32. package/layers/DenoVersionFetcherLive.js +0 -51
  33. package/layers/FreshBunCacheLive.js +0 -60
  34. package/layers/FreshDenoCacheLive.js +0 -60
  35. package/layers/FreshNodeCacheLive.js +0 -55
  36. package/layers/GitHubAppAuth.js +0 -58
  37. package/layers/GitHubAutoAuth.js +0 -70
  38. package/layers/GitHubClientLive.js +0 -130
  39. package/layers/GitHubTokenAuth.js +0 -50
  40. package/layers/NodeReleaseCacheLive.js +0 -77
  41. package/layers/NodeResolverLive.js +0 -107
  42. package/layers/NodeScheduleFetcherLive.js +0 -37
  43. package/layers/NodeVersionFetcherLive.js +0 -55
  44. package/layers/OfflineBunCacheLive.js +0 -40
  45. package/layers/OfflineDenoCacheLive.js +0 -40
  46. package/layers/OfflineNodeCacheLive.js +0 -39
  47. package/layers/RuntimeCacheLive.js +0 -78
  48. package/lib/retry.js +0 -27
  49. package/lib/semver.js +0 -21
  50. package/schemas/bun-release.js +0 -63
  51. package/schemas/deno-release.js +0 -63
  52. package/schemas/github.js +0 -74
  53. package/schemas/node-release.js +0 -133
  54. package/schemas/node-schedule.js +0 -110
  55. package/schemas/node.js +0 -68
  56. package/services/BunReleaseCache.js +0 -33
  57. package/services/BunResolver.js +0 -36
  58. package/services/BunVersionFetcher.js +0 -41
  59. package/services/DenoReleaseCache.js +0 -33
  60. package/services/DenoResolver.js +0 -36
  61. package/services/DenoVersionFetcher.js +0 -41
  62. package/services/GitHubClient.js +0 -40
  63. package/services/NodeReleaseCache.js +0 -41
  64. package/services/NodeResolver.js +0 -44
  65. package/services/NodeScheduleFetcher.js +0 -38
  66. package/services/NodeVersionFetcher.js +0 -39
  67. package/services/OctokitInstance.js +0 -44
  68. package/tsdoc-metadata.json +0 -11
@@ -1,35 +0,0 @@
1
- import { Data } from "effect";
2
-
3
- //#region src/errors/AuthenticationError.ts
4
- /**
5
- * Raised when a GitHub authentication attempt fails.
6
- *
7
- * This error is produced by the {@link GitHubTokenAuth} and
8
- * {@link GitHubAppAuth} layers when the supplied credentials are rejected by
9
- * the GitHub API or when required configuration values (e.g. a token or app
10
- * private key) are missing from the environment.
11
- *
12
- * @see {@link GitHubTokenAuth}
13
- * @see {@link GitHubAppAuth}
14
- *
15
- * @example
16
- * ```typescript
17
- * import { Effect } from "effect";
18
- * import type { AuthenticationError } from "./AuthenticationError.js";
19
- * import { resolveNode } from "../resolvers/node.js";
20
- *
21
- * const program = resolveNode(">=20").pipe(
22
- * Effect.catchTag("AuthenticationError", (err: AuthenticationError) =>
23
- * Effect.logError(
24
- * `Auth failed via ${err.method}: ${err.message}`
25
- * ).pipe(Effect.andThen(Effect.fail(err)))
26
- * )
27
- * );
28
- * ```
29
- *
30
- * @public
31
- */
32
- var AuthenticationError = class extends Data.TaggedError("AuthenticationError") {};
33
-
34
- //#endregion
35
- export { AuthenticationError };
@@ -1,32 +0,0 @@
1
- import { Data } from "effect";
2
-
3
- //#region src/errors/CacheError.ts
4
- /**
5
- * Raised when a cache read or write operation fails.
6
- *
7
- * This error surfaces when the local on-disk version cache cannot be accessed
8
- * or updated. The `operation` field distinguishes between failures that occur
9
- * while loading cached data (`"read"`) and failures that occur while
10
- * persisting new data (`"write"`).
11
- *
12
- * @example
13
- * ```typescript
14
- * import { Effect } from "effect";
15
- * import type { CacheError } from "./CacheError.js";
16
- * import { resolveNode } from "../resolvers/node.js";
17
- *
18
- * const program = resolveNode(">=20").pipe(
19
- * Effect.catchTag("CacheError", (err: CacheError) =>
20
- * Effect.logWarning(
21
- * `Cache ${err.operation} failed: ${err.message}`
22
- * ).pipe(Effect.andThen(Effect.fail(err)))
23
- * )
24
- * );
25
- * ```
26
- *
27
- * @public
28
- */
29
- var CacheError = class extends Data.TaggedError("CacheError") {};
30
-
31
- //#endregion
32
- export { CacheError };
@@ -1,38 +0,0 @@
1
- import { Data } from "effect";
2
-
3
- //#region src/errors/FreshnessError.ts
4
- /**
5
- * Raised when a cache freshness check cannot be completed.
6
- *
7
- * Each runtime cache layer ({@link FreshBunCacheLive}, {@link FreshDenoCacheLive},
8
- * {@link FreshNodeCacheLive}) validates whether locally stored version data is
9
- * still current before returning it. This error is produced when that
10
- * validation fails — for example, when the upstream API is unreachable during
11
- * an `"api"` freshness check, or when the cached timestamp is corrupt during
12
- * an `"auto"` or `"cache"` check.
13
- *
14
- * @see {@link FreshBunCacheLive}
15
- * @see {@link FreshDenoCacheLive}
16
- * @see {@link FreshNodeCacheLive}
17
- *
18
- * @example
19
- * ```typescript
20
- * import { Effect } from "effect";
21
- * import type { FreshnessError } from "./FreshnessError.js";
22
- * import { resolveNode } from "../resolvers/node.js";
23
- *
24
- * const program = resolveNode(">=20").pipe(
25
- * Effect.catchTag("FreshnessError", (err: FreshnessError) =>
26
- * Effect.logWarning(
27
- * `Freshness check (${err.strategy}) failed: ${err.message}`
28
- * ).pipe(Effect.andThen(Effect.fail(err)))
29
- * )
30
- * );
31
- * ```
32
- *
33
- * @public
34
- */
35
- var FreshnessError = class extends Data.TaggedError("FreshnessError") {};
36
-
37
- //#endregion
38
- export { FreshnessError };
@@ -1,33 +0,0 @@
1
- import { Data } from "effect";
2
-
3
- //#region src/errors/InvalidInputError.ts
4
- /**
5
- * Raised when a caller-supplied value fails validation.
6
- *
7
- * This error is produced at the boundary where user-provided inputs (such as
8
- * version constraint strings or runtime identifiers) are decoded against their
9
- * expected schemas. The `field` identifies which input was invalid, `value`
10
- * carries the raw string that was rejected, and `message` explains the
11
- * specific violation.
12
- *
13
- * @example
14
- * ```typescript
15
- * import { Effect } from "effect";
16
- * import type { InvalidInputError } from "./InvalidInputError.js";
17
- * import { resolveNode } from "../resolvers/node.js";
18
- *
19
- * const program = resolveNode("not-a-semver-range").pipe(
20
- * Effect.catchTag("InvalidInputError", (err: InvalidInputError) =>
21
- * Effect.logError(
22
- * `Invalid value for "${err.field}": ${err.value} — ${err.message}`
23
- * ).pipe(Effect.andThen(Effect.fail(err)))
24
- * )
25
- * );
26
- * ```
27
- *
28
- * @public
29
- */
30
- var InvalidInputError = class extends Data.TaggedError("InvalidInputError") {};
31
-
32
- //#endregion
33
- export { InvalidInputError };
@@ -1,34 +0,0 @@
1
- import { Data } from "effect";
2
-
3
- //#region src/errors/NetworkError.ts
4
- /**
5
- * Raised when an HTTP request to an upstream API fails.
6
- *
7
- * This error is produced when a fetch to a runtime release API (e.g. the
8
- * Node.js release index, the Deno release feed, or the Bun GitHub releases
9
- * endpoint) either does not receive a response or receives a non-successful
10
- * HTTP status code. When a status code is available it is included in the
11
- * `status` field; for connection-level failures (timeouts, DNS errors) that
12
- * field is absent.
13
- *
14
- * @example
15
- * ```typescript
16
- * import { Effect } from "effect";
17
- * import type { NetworkError } from "./NetworkError.js";
18
- * import { resolveNode } from "../resolvers/node.js";
19
- *
20
- * const program = resolveNode(">=20").pipe(
21
- * Effect.catchTag("NetworkError", (err: NetworkError) =>
22
- * Effect.logError(
23
- * `Request to ${err.url} failed${err.status != null ? ` with status ${err.status}` : ""}: ${err.message}`
24
- * ).pipe(Effect.andThen(Effect.fail(err)))
25
- * )
26
- * );
27
- * ```
28
- *
29
- * @public
30
- */
31
- var NetworkError = class extends Data.TaggedError("NetworkError") {};
32
-
33
- //#endregion
34
- export { NetworkError };
@@ -1,33 +0,0 @@
1
- import { Data } from "effect";
2
-
3
- //#region src/errors/ParseError.ts
4
- /**
5
- * Raised when the body of an upstream API response cannot be decoded.
6
- *
7
- * This error is produced after a successful HTTP response is received but
8
- * its payload does not match the expected shape — for example, when a release
9
- * index returns malformed JSON or when a required field is missing from the
10
- * response structure. The `source` field identifies the URL or data source
11
- * that produced the unparseable content.
12
- *
13
- * @example
14
- * ```typescript
15
- * import { Effect } from "effect";
16
- * import type { ParseError } from "./ParseError.js";
17
- * import { resolveNode } from "../resolvers/node.js";
18
- *
19
- * const program = resolveNode(">=20").pipe(
20
- * Effect.catchTag("ParseError", (err: ParseError) =>
21
- * Effect.logError(
22
- * `Failed to parse response from ${err.source}: ${err.message}`
23
- * ).pipe(Effect.andThen(Effect.fail(err)))
24
- * )
25
- * );
26
- * ```
27
- *
28
- * @public
29
- */
30
- var ParseError = class extends Data.TaggedError("ParseError") {};
31
-
32
- //#endregion
33
- export { ParseError };
@@ -1,37 +0,0 @@
1
- import { Data } from "effect";
2
-
3
- //#region src/errors/RateLimitError.ts
4
- /**
5
- * Raised when a GitHub API rate limit is exceeded.
6
- *
7
- * The `limit` and `remaining` fields reflect the values returned in the
8
- * `X-RateLimit-Limit` and `X-RateLimit-Remaining` response headers. When the
9
- * API indicates how long to wait before the quota resets, that duration (in
10
- * seconds) is available via `retryAfter`.
11
- *
12
- * Use `retryOnRateLimit` to automatically retry an effect with
13
- * exponential backoff whenever this error is encountered.
14
- *
15
- * @example
16
- * ```typescript
17
- * import { Effect } from "effect";
18
- * import type { RateLimitError } from "./RateLimitError.js";
19
- * import { resolveNode } from "../resolvers/node.js";
20
- *
21
- * const program = resolveNode(">=20").pipe(
22
- * Effect.catchTag("RateLimitError", (err: RateLimitError) =>
23
- * Effect.logWarning(
24
- * `Rate limit hit (${err.remaining}/${err.limit} remaining)` +
25
- * (err.retryAfter != null ? `, retry after ${err.retryAfter}s` : "") +
26
- * `: ${err.message}`
27
- * ).pipe(Effect.andThen(Effect.fail(err)))
28
- * )
29
- * );
30
- * ```
31
- *
32
- * @public
33
- */
34
- var RateLimitError = class extends Data.TaggedError("RateLimitError") {};
35
-
36
- //#endregion
37
- export { RateLimitError };
@@ -1,37 +0,0 @@
1
- import { Data } from "effect";
2
-
3
- //#region src/errors/VersionNotFoundError.ts
4
- /**
5
- * Raised when no published version satisfies the requested constraint.
6
- *
7
- * This error is produced by {@link NodeResolver}, {@link BunResolver}, and
8
- * {@link DenoResolver} after the full list of available versions has been
9
- * fetched and filtered but no entry matches the caller-supplied semver
10
- * constraint. The `runtime` field identifies which runtime was queried and
11
- * `constraint` echoes the range string that was provided.
12
- *
13
- * @see {@link NodeResolver}
14
- * @see {@link BunResolver}
15
- * @see {@link DenoResolver}
16
- *
17
- * @example
18
- * ```typescript
19
- * import { Effect } from "effect";
20
- * import type { VersionNotFoundError } from "./VersionNotFoundError.js";
21
- * import { resolveNode } from "../resolvers/node.js";
22
- *
23
- * const program = resolveNode(">=999").pipe(
24
- * Effect.catchTag("VersionNotFoundError", (err: VersionNotFoundError) =>
25
- * Effect.logError(
26
- * `No ${err.runtime} version matched "${err.constraint}": ${err.message}`
27
- * ).pipe(Effect.andThen(Effect.fail(err)))
28
- * )
29
- * );
30
- * ```
31
- *
32
- * @public
33
- */
34
- var VersionNotFoundError = class extends Data.TaggedError("VersionNotFoundError") {};
35
-
36
- //#endregion
37
- export { VersionNotFoundError };