runtime-resolver 0.3.11 → 0.3.13
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 +30 -261
- package/bin/runtime-resolver.js.map +1 -0
- package/cli/commands/resolve.js +240 -0
- package/cli/commands/resolve.js.map +1 -0
- package/cli/schemas/json-schema.js +13 -0
- package/cli/schemas/json-schema.js.map +1 -0
- package/cli/schemas/response.js +87 -0
- package/cli/schemas/response.js.map +1 -0
- package/data/bun-defaults.js +851 -0
- package/data/bun-defaults.js.map +1 -0
- package/data/deno-defaults.js +1523 -0
- package/data/deno-defaults.js.map +1 -0
- package/data/node-defaults.js +4401 -0
- package/data/node-defaults.js.map +1 -0
- package/errors/AuthenticationError.js +36 -0
- package/errors/AuthenticationError.js.map +1 -0
- package/errors/CacheError.js +33 -0
- package/errors/CacheError.js.map +1 -0
- package/errors/FreshnessError.js +39 -0
- package/errors/FreshnessError.js.map +1 -0
- package/errors/InvalidInputError.js +34 -0
- package/errors/InvalidInputError.js.map +1 -0
- package/errors/NetworkError.js +35 -0
- package/errors/NetworkError.js.map +1 -0
- package/errors/ParseError.js +34 -0
- package/errors/ParseError.js.map +1 -0
- package/errors/RateLimitError.js +40 -0
- package/errors/RateLimitError.js.map +1 -0
- package/errors/VersionNotFoundError.js +38 -0
- package/errors/VersionNotFoundError.js.map +1 -0
- package/index.d.ts +2577 -2608
- package/index.d.ts.map +1 -0
- package/index.js +159 -132
- package/index.js.map +1 -0
- package/layers/AutoBunCacheLive.js +48 -0
- package/layers/AutoBunCacheLive.js.map +1 -0
- package/layers/AutoDenoCacheLive.js +48 -0
- package/layers/AutoDenoCacheLive.js.map +1 -0
- package/layers/AutoNodeCacheLive.js +59 -0
- package/layers/AutoNodeCacheLive.js.map +1 -0
- package/layers/BunReleaseCacheLive.js +26 -0
- package/layers/BunReleaseCacheLive.js.map +1 -0
- package/layers/BunResolverLive.js +86 -0
- package/layers/BunResolverLive.js.map +1 -0
- package/layers/BunVersionFetcherLive.js +56 -0
- package/layers/BunVersionFetcherLive.js.map +1 -0
- package/layers/DenoReleaseCacheLive.js +26 -0
- package/layers/DenoReleaseCacheLive.js.map +1 -0
- package/layers/DenoResolverLive.js +85 -0
- package/layers/DenoResolverLive.js.map +1 -0
- package/layers/DenoVersionFetcherLive.js +52 -0
- package/layers/DenoVersionFetcherLive.js.map +1 -0
- package/layers/FreshBunCacheLive.js +61 -0
- package/layers/FreshBunCacheLive.js.map +1 -0
- package/layers/FreshDenoCacheLive.js +61 -0
- package/layers/FreshDenoCacheLive.js.map +1 -0
- package/layers/FreshNodeCacheLive.js +56 -0
- package/layers/FreshNodeCacheLive.js.map +1 -0
- package/layers/GitHubAppAuth.js +59 -0
- package/layers/GitHubAppAuth.js.map +1 -0
- package/layers/GitHubAutoAuth.js +71 -0
- package/layers/GitHubAutoAuth.js.map +1 -0
- package/layers/GitHubClientLive.js +131 -0
- package/layers/GitHubClientLive.js.map +1 -0
- package/layers/GitHubTokenAuth.js +51 -0
- package/layers/GitHubTokenAuth.js.map +1 -0
- package/layers/NodeReleaseCacheLive.js +78 -0
- package/layers/NodeReleaseCacheLive.js.map +1 -0
- package/layers/NodeResolverLive.js +108 -0
- package/layers/NodeResolverLive.js.map +1 -0
- package/layers/NodeScheduleFetcherLive.js +38 -0
- package/layers/NodeScheduleFetcherLive.js.map +1 -0
- package/layers/NodeVersionFetcherLive.js +56 -0
- package/layers/NodeVersionFetcherLive.js.map +1 -0
- package/layers/OfflineBunCacheLive.js +41 -0
- package/layers/OfflineBunCacheLive.js.map +1 -0
- package/layers/OfflineDenoCacheLive.js +41 -0
- package/layers/OfflineDenoCacheLive.js.map +1 -0
- package/layers/OfflineNodeCacheLive.js +40 -0
- package/layers/OfflineNodeCacheLive.js.map +1 -0
- package/layers/RuntimeCacheLive.js +79 -0
- package/layers/RuntimeCacheLive.js.map +1 -0
- package/lib/retry.js +28 -0
- package/lib/retry.js.map +1 -0
- package/lib/semver.js +22 -0
- package/lib/semver.js.map +1 -0
- package/package.json +57 -68
- package/schemas/bun-release.js +62 -0
- package/schemas/bun-release.js.map +1 -0
- package/schemas/deno-release.js +62 -0
- package/schemas/deno-release.js.map +1 -0
- package/schemas/github.js +75 -0
- package/schemas/github.js.map +1 -0
- package/schemas/node-release.js +131 -0
- package/schemas/node-release.js.map +1 -0
- package/schemas/node-schedule.js +111 -0
- package/schemas/node-schedule.js.map +1 -0
- package/schemas/node.js +69 -0
- package/schemas/node.js.map +1 -0
- package/services/BunReleaseCache.js +34 -0
- package/services/BunReleaseCache.js.map +1 -0
- package/services/BunResolver.js +37 -0
- package/services/BunResolver.js.map +1 -0
- package/services/BunVersionFetcher.js +42 -0
- package/services/BunVersionFetcher.js.map +1 -0
- package/services/DenoReleaseCache.js +34 -0
- package/services/DenoReleaseCache.js.map +1 -0
- package/services/DenoResolver.js +37 -0
- package/services/DenoResolver.js.map +1 -0
- package/services/DenoVersionFetcher.js +42 -0
- package/services/DenoVersionFetcher.js.map +1 -0
- package/services/GitHubClient.js +41 -0
- package/services/GitHubClient.js.map +1 -0
- package/services/NodeReleaseCache.js +42 -0
- package/services/NodeReleaseCache.js.map +1 -0
- package/services/NodeResolver.js +45 -0
- package/services/NodeResolver.js.map +1 -0
- package/services/NodeScheduleFetcher.js +39 -0
- package/services/NodeScheduleFetcher.js.map +1 -0
- package/services/NodeVersionFetcher.js +40 -0
- package/services/NodeVersionFetcher.js.map +1 -0
- package/services/OctokitInstance.js +45 -0
- package/services/OctokitInstance.js.map +1 -0
- package/tsdoc-metadata.json +11 -11
- package/612.js +0 -23
- package/711.js +0 -7543
- package/json-schema.js +0 -95
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DenoResolver.js","names":[],"sources":["../../../../src/services/DenoResolver.ts"],"sourcesContent":["import type { Effect } from \"effect\";\nimport { Context } from \"effect\";\nimport type { VersionNotFoundError } from \"../errors/VersionNotFoundError.js\";\nimport type { Increments, ResolvedVersions } from \"../schemas/common.js\";\n\n/**\n * Options accepted by {@link DenoResolver.resolve}.\n *\n * All fields are optional; omitting them causes the resolver to fall back to\n * its built-in defaults (latest stable release, `\"latest\"` increment\n * granularity).\n *\n * @see {@link DenoResolver}\n * @see {@link Increments}\n * @see {@link ResolvedVersions}\n *\n * @public\n */\nexport interface DenoResolverOptions {\n\t/**\n\t * A semver range string used to constrain which Deno releases are\n\t * considered (e.g. `\"^2.0.0\"` or `\">=1.40.0 <2.0.0\"`).\n\t *\n\t * When omitted all cached releases are eligible.\n\t */\n\treadonly semverRange?: string;\n\n\t/**\n\t * A fallback version string returned when no release satisfies\n\t * `semverRange`. Must be a valid semver version (e.g. `\"2.0.0\"`).\n\t *\n\t * When omitted and no match is found the effect fails with\n\t * {@link VersionNotFoundError}.\n\t */\n\treadonly defaultVersion?: string;\n\n\t/**\n\t * Controls the granularity of the version list included in\n\t * {@link ResolvedVersions.versions}.\n\t *\n\t * - `\"latest\"` — only the single highest matching version.\n\t * - `\"minor\"` — the latest patch for every minor line.\n\t * - `\"patch\"` — every individual patch release.\n\t *\n\t * Defaults to `\"latest\"` when omitted.\n\t *\n\t * @see {@link Increments}\n\t */\n\treadonly increments?: Increments;\n}\n\n/**\n * Union of all typed errors that {@link DenoResolver.resolve} can fail with.\n *\n * @see {@link VersionNotFoundError}\n *\n * @public\n */\nexport type DenoResolverError = VersionNotFoundError;\n\n/**\n * Service for resolving Deno runtime versions against the cached\n * release index.\n *\n * For a one-shot Promise-based API see {@link resolveDeno}.\n *\n * @example\n * ```typescript\n * import type { ResolvedVersions } from \"runtime-resolver\";\n * import { DenoResolver, DenoResolverLive } from \"runtime-resolver\";\n * import { Effect } from \"effect\";\n *\n * const program = Effect.gen(function* () {\n * \tconst resolver = yield* DenoResolver;\n * \tconst result = yield* resolver.resolve({ semverRange: \"^2.0.0\", increments: \"minor\" });\n * \tconsole.log(result.latest);\n * \tconsole.log(result.versions);\n * });\n *\n * Effect.runPromise(program.pipe(Effect.provide(DenoResolverLive)));\n * ```\n *\n * @see {@link DenoResolverLive}\n * @see {@link resolveDeno}\n * @see {@link DenoResolverOptions}\n * @see {@link ResolvedVersions}\n *\n * @public\n */\nexport class DenoResolver extends Context.Tag(\"runtime-resolver/DenoResolver\")<\n\tDenoResolver,\n\t{\n\t\t/**\n\t\t * Resolves Deno versions according to `options` and returns a\n\t\t * {@link ResolvedVersions} object containing the matching version list,\n\t\t * the latest version string, and the data source indicator.\n\t\t *\n\t\t * Fails with {@link DenoResolverError} when no version can be resolved and\n\t\t * no `defaultVersion` was provided.\n\t\t *\n\t\t * @param options - Optional resolution constraints.\n\t\t *\n\t\t * @see {@link DenoResolverOptions}\n\t\t */\n\t\treadonly resolve: (options?: DenoResolverOptions) => Effect.Effect<ResolvedVersions, DenoResolverError>;\n\t}\n>() {}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyFA,IAAa,eAAb,cAAkC,QAAQ,IAAI,+BAA+B,CAAC,CAiB5E,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
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 };
|
|
42
|
+
//# sourceMappingURL=DenoVersionFetcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DenoVersionFetcher.js","names":[],"sources":["../../../../src/services/DenoVersionFetcher.ts"],"sourcesContent":["import type { Effect } from \"effect\";\nimport { Context } from \"effect\";\nimport type { SemVer } from \"semver-effect\";\nimport type { AuthenticationError } from \"../errors/AuthenticationError.js\";\nimport type { NetworkError } from \"../errors/NetworkError.js\";\nimport type { ParseError } from \"../errors/ParseError.js\";\nimport type { RateLimitError } from \"../errors/RateLimitError.js\";\nimport type { RuntimeReleaseInput } from \"../schemas/runtime-release.js\";\n\n/**\n * Service for fetching Deno release data from the GitHub API.\n *\n * Retrieves both the parsed semver version list and the raw release input\n * records needed to populate a {@link DenoReleaseCache}. The live\n * implementation queries the `denoland/deno` GitHub repository via\n * {@link GitHubClient}.\n *\n * @example\n * ```typescript\n * import type { RuntimeReleaseInput } from \"runtime-resolver\";\n * import { DenoVersionFetcher, DenoVersionFetcherLive, GitHubAutoAuth } from \"runtime-resolver\";\n * import { Effect } from \"effect\";\n *\n * const program = Effect.gen(function* () {\n * \tconst fetcher = yield* DenoVersionFetcher;\n * \tconst { versions, inputs } = yield* fetcher.fetch();\n * \tconsole.log(`Fetched ${versions.length} Deno releases`);\n * });\n *\n * Effect.runPromise(\n * \tprogram.pipe(Effect.provide(DenoVersionFetcherLive), Effect.provide(GitHubAutoAuth)),\n * );\n * ```\n *\n * @see {@link DenoVersionFetcherLive}\n * @see {@link DenoReleaseCache}\n * @see {@link AuthenticationError}\n * @see {@link NetworkError}\n * @see {@link ParseError}\n * @see {@link RateLimitError}\n *\n * @public\n */\nexport class DenoVersionFetcher extends Context.Tag(\"runtime-resolver/DenoVersionFetcher\")<\n\tDenoVersionFetcher,\n\t{\n\t\t/**\n\t\t * Fetches all available Deno releases from the GitHub API and returns both\n\t\t * the parsed semver version objects and the raw release input records.\n\t\t *\n\t\t * Fails with:\n\t\t * - {@link AuthenticationError} — missing or invalid GitHub credentials.\n\t\t * - {@link NetworkError} — the upstream request could not be completed.\n\t\t * - {@link ParseError} — the response payload could not be decoded.\n\t\t * - {@link RateLimitError} — the GitHub API rate limit was exceeded.\n\t\t */\n\t\treadonly fetch: () => Effect.Effect<\n\t\t\t{\n\t\t\t\treadonly versions: ReadonlyArray<SemVer>;\n\t\t\t\treadonly inputs: ReadonlyArray<RuntimeReleaseInput>;\n\t\t\t},\n\t\t\tAuthenticationError | NetworkError | ParseError | RateLimitError\n\t\t>;\n\t}\n>() {}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,IAAa,qBAAb,cAAwC,QAAQ,IAAI,qCAAqC,CAAC,CAqBxF,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
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 };
|
|
41
|
+
//# sourceMappingURL=GitHubClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitHubClient.js","names":[],"sources":["../../../../src/services/GitHubClient.ts"],"sourcesContent":["import type { Effect } from \"effect\";\nimport { Context } from \"effect\";\nimport type { AuthenticationError } from \"../errors/AuthenticationError.js\";\nimport type { NetworkError } from \"../errors/NetworkError.js\";\nimport type { ParseError } from \"../errors/ParseError.js\";\nimport type { RateLimitError } from \"../errors/RateLimitError.js\";\nimport type { GitHubRelease, GitHubTag } from \"../schemas/github.js\";\n\n/**\n * Pagination options shared by all list operations on {@link GitHubClient}.\n *\n * @see {@link GitHubClient}\n *\n * @public\n */\nexport interface ListOptions {\n\t/**\n\t * Number of items to request per page. Defaults to the GitHub API maximum\n\t * of `100` when omitted.\n\t */\n\treadonly perPage?: number;\n\n\t/**\n\t * Maximum number of pages to fetch. When omitted all pages are fetched\n\t * until the API returns an empty result set.\n\t */\n\treadonly pages?: number;\n}\n\n/**\n * Service for GitHub REST API operations used by the version\n * fetcher services.\n *\n * Abstracts over pagination and authentication so that higher-level services\n * such as {@link BunVersionFetcher}, {@link DenoVersionFetcher}, and\n * {@link NodeScheduleFetcher} remain independent of the underlying HTTP\n * transport. The live implementation is provided by {@link GitHubClientLive}\n * and requires an {@link OctokitInstance} in its dependency graph.\n *\n * @example\n * ```typescript\n * import type { GitHubTag } from \"runtime-resolver\";\n * import { GitHubClient, GitHubClientLive, GitHubAutoAuth } from \"runtime-resolver\";\n * import { Effect } from \"effect\";\n *\n * const program = Effect.gen(function* () {\n * \tconst client = yield* GitHubClient;\n * \tconst tags = yield* client.listTags(\"oven-sh\", \"bun\", { perPage: 100 });\n * \tconsole.log(`Found ${tags.length} tags`);\n * });\n *\n * Effect.runPromise(\n * \tprogram.pipe(Effect.provide(GitHubClientLive), Effect.provide(GitHubAutoAuth)),\n * );\n * ```\n *\n * @see {@link GitHubClientLive}\n * @see {@link OctokitInstance}\n * @see {@link ListOptions}\n *\n * @public\n */\nexport class GitHubClient extends Context.Tag(\"runtime-resolver/GitHubClient\")<\n\tGitHubClient,\n\t{\n\t\t/**\n\t\t * Lists all git tags for the given repository, automatically paginating\n\t\t * through results according to `options`.\n\t\t *\n\t\t * Fails with:\n\t\t * - {@link AuthenticationError} — missing or invalid GitHub credentials.\n\t\t * - {@link NetworkError} — the upstream request could not be completed.\n\t\t * - {@link RateLimitError} — the GitHub API rate limit was exceeded.\n\t\t * - {@link ParseError} — a response page could not be decoded.\n\t\t *\n\t\t * @param owner - GitHub organisation or user name (e.g. `\"oven-sh\"`).\n\t\t * @param repo - Repository name (e.g. `\"bun\"`).\n\t\t * @param options - Optional pagination controls.\n\t\t */\n\t\treadonly listTags: (\n\t\t\towner: string,\n\t\t\trepo: string,\n\t\t\toptions?: ListOptions,\n\t\t) => Effect.Effect<ReadonlyArray<GitHubTag>, AuthenticationError | NetworkError | RateLimitError | ParseError>;\n\n\t\t/**\n\t\t * Lists all GitHub Releases for the given repository, automatically\n\t\t * paginating through results according to `options`.\n\t\t *\n\t\t * Fails with:\n\t\t * - {@link AuthenticationError} — missing or invalid GitHub credentials.\n\t\t * - {@link NetworkError} — the upstream request could not be completed.\n\t\t * - {@link RateLimitError} — the GitHub API rate limit was exceeded.\n\t\t * - {@link ParseError} — a response page could not be decoded.\n\t\t *\n\t\t * @param owner - GitHub organisation or user name (e.g. `\"denoland\"`).\n\t\t * @param repo - Repository name (e.g. `\"deno\"`).\n\t\t * @param options - Optional pagination controls.\n\t\t */\n\t\treadonly listReleases: (\n\t\t\towner: string,\n\t\t\trepo: string,\n\t\t\toptions?: ListOptions,\n\t\t) => Effect.Effect<ReadonlyArray<GitHubRelease>, AuthenticationError | NetworkError | RateLimitError | ParseError>;\n\n\t\t/**\n\t\t * Fetches arbitrary JSON from `url` and decodes it with the provided\n\t\t * schema, returning the typed result.\n\t\t *\n\t\t * Useful for endpoints outside the standard Octokit REST methods (e.g.\n\t\t * raw GitHub content URLs).\n\t\t *\n\t\t * Fails with:\n\t\t * - {@link NetworkError} — the upstream request could not be completed.\n\t\t * - {@link ParseError} — the response body could not be decoded by `schema`.\n\t\t *\n\t\t * @typeParam A - The decoded output type produced by `schema`.\n\t\t * @param url - Fully qualified URL to fetch.\n\t\t * @param schema - An object with a `decode` method compatible with\n\t\t * Effect Schema's `decodeUnknown`.\n\t\t */\n\t\treadonly getJson: <A>(\n\t\t\turl: string,\n\t\t\tschema: {\n\t\t\t\treadonly decode: (input: unknown) => Effect.Effect<A, ParseError>;\n\t\t\t},\n\t\t) => Effect.Effect<A, NetworkError | ParseError>;\n\t}\n>() {}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,IAAa,eAAb,cAAkC,QAAQ,IAAI,+BAA+B,CAAC,CAkE5E,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
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 };
|
|
42
|
+
//# sourceMappingURL=NodeReleaseCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeReleaseCache.js","names":[],"sources":["../../../../src/services/NodeReleaseCache.ts"],"sourcesContent":["import type { DateTime, Effect } from \"effect\";\nimport { Context } from \"effect\";\nimport type { NodeRelease, NodeReleaseInput } from \"../schemas/node-release.js\";\nimport type { NodeScheduleData } from \"../schemas/node-schedule.js\";\nimport type { RuntimeCache } from \"./RuntimeCache.js\";\n\n/**\n * Node.js-specific cache service that extends {@link RuntimeCache} with\n * additional operations for lifecycle schedule data and LTS / current\n * release filtering.\n *\n * Unlike the Bun and Deno equivalents this service is not a plain type alias\n * — it adds four Node-specific methods on top of the generic cache contract.\n *\n * @example\n * ```typescript\n * import type { NodeRelease } from \"runtime-resolver\";\n * import { NodeReleaseCache, OfflineNodeCacheLive } from \"runtime-resolver\";\n * import { Effect } from \"effect\";\n *\n * const program = Effect.gen(function* () {\n * \tconst cache = yield* NodeReleaseCache;\n * \tconst lts = yield* cache.ltsReleases();\n * \tfor (const release of lts) {\n * \t\tconsole.log(release.version.toString(), release.phase);\n * \t}\n * });\n *\n * Effect.runPromise(program.pipe(Effect.provide(OfflineNodeCacheLive)));\n * ```\n *\n * @see {@link NodeRelease}\n * @see {@link NodeScheduleData}\n * @see {@link RuntimeCache}\n * @see {@link AutoNodeCacheLive}\n * @see {@link FreshNodeCacheLive}\n * @see {@link OfflineNodeCacheLive}\n *\n * @public\n */\nexport class NodeReleaseCache extends Context.Tag(\"runtime-resolver/NodeReleaseCache\")<\n\tNodeReleaseCache,\n\tRuntimeCache<NodeRelease> & {\n\t\t/**\n\t\t * Merges Node.js release-schedule data into the cache, updating lifecycle\n\t\t * phase information (LTS dates, end-of-life dates, etc.) for every major\n\t\t * release line.\n\t\t *\n\t\t * @param data - Parsed schedule payload, typically fetched via\n\t\t * {@link NodeScheduleFetcher}.\n\t\t *\n\t\t * @see {@link NodeScheduleData}\n\t\t */\n\t\treadonly updateSchedule: (data: NodeScheduleData) => Effect.Effect<void>;\n\n\t\t/**\n\t\t * Populates the cache from raw {@link NodeReleaseInput} records (as\n\t\t * returned by the Node.js release index JSON) rather than from already-\n\t\t * decoded {@link NodeRelease} objects.\n\t\t *\n\t\t * Prefer this over `load` when consuming data directly from the Node.js\n\t\t * distribution server.\n\t\t *\n\t\t * @param inputs - An array of un-decoded release index entries.\n\t\t *\n\t\t * @see {@link NodeReleaseInput}\n\t\t */\n\t\treadonly loadFromInputs: (inputs: ReadonlyArray<NodeReleaseInput>) => Effect.Effect<void>;\n\n\t\t/**\n\t\t * Returns all cached releases whose lifecycle phase is `\"active-lts\"` or\n\t\t * `\"maintenance-lts\"` as of the given point in time.\n\t\t *\n\t\t * When `now` is omitted the current wall-clock time is used.\n\t\t *\n\t\t * @param now - Optional reference timestamp for phase evaluation.\n\t\t *\n\t\t * @see {@link NodeRelease}\n\t\t */\n\t\treadonly ltsReleases: (now?: DateTime.DateTime) => Effect.Effect<ReadonlyArray<NodeRelease>>;\n\n\t\t/**\n\t\t * Returns all cached releases whose lifecycle phase is `\"current\"` as of\n\t\t * the given point in time.\n\t\t *\n\t\t * When `now` is omitted the current wall-clock time is used.\n\t\t *\n\t\t * @param now - Optional reference timestamp for phase evaluation.\n\t\t *\n\t\t * @see {@link NodeRelease}\n\t\t */\n\t\treadonly currentReleases: (now?: DateTime.DateTime) => Effect.Effect<ReadonlyArray<NodeRelease>>;\n\t}\n>() {}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,IAAa,mBAAb,cAAsC,QAAQ,IAAI,mCAAmC,CAAC,CAqDpF,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
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 };
|
|
45
|
+
//# sourceMappingURL=NodeResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeResolver.js","names":[],"sources":["../../../../src/services/NodeResolver.ts"],"sourcesContent":["import type { Effect } from \"effect\";\nimport { Context } from \"effect\";\nimport type { VersionNotFoundError } from \"../errors/VersionNotFoundError.js\";\nimport type { Increments, NodePhase, ResolvedVersions } from \"../schemas/common.js\";\n\n/**\n * Options accepted by {@link NodeResolver.resolve}.\n *\n * All fields are optional; omitting them causes the resolver to fall back to\n * its built-in defaults (all lifecycle phases, latest stable release,\n * `\"latest\"` increment granularity, current wall-clock date).\n *\n * @see {@link NodeResolver}\n * @see {@link NodePhase}\n * @see {@link Increments}\n * @see {@link ResolvedVersions}\n *\n * @public\n */\nexport interface NodeResolverOptions {\n\t/**\n\t * A semver range string used to constrain which Node.js releases are\n\t * considered (e.g. `\"^20.0.0\"` or `\">=18.0.0 <22.0.0\"`).\n\t *\n\t * When omitted all cached releases are eligible.\n\t */\n\treadonly semverRange?: string;\n\n\t/**\n\t * A fallback version string returned when no release satisfies\n\t * `semverRange`. Must be a valid semver version (e.g. `\"20.0.0\"`).\n\t *\n\t * When omitted and no match is found the effect fails with\n\t * {@link VersionNotFoundError}.\n\t */\n\treadonly defaultVersion?: string;\n\n\t/**\n\t * Restricts resolution to releases whose lifecycle phase is included in\n\t * this list. For example, passing `[\"active-lts\"]` excludes `\"current\"`\n\t * and `\"maintenance-lts\"` releases from consideration.\n\t *\n\t * When omitted all phases are eligible.\n\t *\n\t * @see {@link NodePhase}\n\t */\n\treadonly phases?: ReadonlyArray<NodePhase>;\n\n\t/**\n\t * Controls the granularity of the version list included in\n\t * {@link ResolvedVersions.versions}.\n\t *\n\t * - `\"latest\"` — only the single highest matching version.\n\t * - `\"minor\"` — the latest patch for every minor line.\n\t * - `\"patch\"` — every individual patch release.\n\t *\n\t * Defaults to `\"latest\"` when omitted.\n\t *\n\t * @see {@link Increments}\n\t */\n\treadonly increments?: Increments;\n\n\t/**\n\t * Reference date used when evaluating Node.js lifecycle phases. Releases\n\t * whose LTS or end-of-life boundaries fall relative to this date are\n\t * classified accordingly.\n\t *\n\t * When omitted the current wall-clock date is used.\n\t */\n\treadonly date?: Date;\n}\n\n/**\n * Union of all typed errors that {@link NodeResolver.resolve} can fail with.\n *\n * @see {@link VersionNotFoundError}\n *\n * @public\n */\nexport type NodeResolverError = VersionNotFoundError;\n\n/**\n * Service for resolving Node.js runtime versions against the cached\n * release index.\n *\n * Unlike {@link BunResolver} and {@link DenoResolver}, this service is\n * lifecycle-aware: results can be filtered by {@link NodePhase} and evaluated\n * against a specific reference date.\n *\n * For a one-shot Promise-based API see {@link resolveNode}.\n *\n * @example\n * ```typescript\n * import type { ResolvedVersions } from \"runtime-resolver\";\n * import { NodeResolver, NodeResolverLive } from \"runtime-resolver\";\n * import { Effect } from \"effect\";\n *\n * const program = Effect.gen(function* () {\n * \tconst resolver = yield* NodeResolver;\n * \tconst result = yield* resolver.resolve({\n * \t\tsemverRange: \"^20.0.0\",\n * \t\tphases: [\"active-lts\"],\n * \t\tincrements: \"minor\",\n * \t});\n * \tconsole.log(result.latest);\n * \tconsole.log(result.lts);\n * });\n *\n * Effect.runPromise(program.pipe(Effect.provide(NodeResolverLive)));\n * ```\n *\n * @see {@link NodeResolverLive}\n * @see {@link resolveNode}\n * @see {@link NodeResolverOptions}\n * @see {@link ResolvedVersions}\n *\n * @public\n */\nexport class NodeResolver extends Context.Tag(\"runtime-resolver/NodeResolver\")<\n\tNodeResolver,\n\t{\n\t\t/**\n\t\t * Resolves Node.js versions according to `options` and returns a\n\t\t * {@link ResolvedVersions} object containing the matching version list,\n\t\t * the latest version string, optional LTS version string, and the data\n\t\t * source indicator.\n\t\t *\n\t\t * Fails with {@link NodeResolverError} when no version can be resolved and\n\t\t * no `defaultVersion` was provided.\n\t\t *\n\t\t * @param options - Optional resolution constraints.\n\t\t *\n\t\t * @see {@link NodeResolverOptions}\n\t\t */\n\t\treadonly resolve: (options?: NodeResolverOptions) => Effect.Effect<ResolvedVersions, NodeResolverError>;\n\t}\n>() {}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsHA,IAAa,eAAb,cAAkC,QAAQ,IAAI,+BAA+B,CAAC,CAkB5E,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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 };
|
|
39
|
+
//# sourceMappingURL=NodeScheduleFetcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeScheduleFetcher.js","names":[],"sources":["../../../../src/services/NodeScheduleFetcher.ts"],"sourcesContent":["import type { Effect } from \"effect\";\nimport { Context } from \"effect\";\nimport type { NetworkError } from \"../errors/NetworkError.js\";\nimport type { ParseError } from \"../errors/ParseError.js\";\nimport type { NodeScheduleData } from \"../schemas/node-schedule.js\";\n\n/**\n * Service for fetching the official Node.js release schedule.\n *\n * The schedule maps each major release line to its LTS start date and\n * end-of-life date, and is used by {@link NodeReleaseCache} to assign\n * lifecycle phases to individual releases. The live implementation fetches\n * from the `nodejs/Release` GitHub repository via a plain HTTP request.\n *\n * @example\n * ```typescript\n * import type { NodeScheduleData } from \"runtime-resolver\";\n * import { NodeScheduleFetcher, NodeScheduleFetcherLive } from \"runtime-resolver\";\n * import { Effect } from \"effect\";\n *\n * const program = Effect.gen(function* () {\n * \tconst fetcher = yield* NodeScheduleFetcher;\n * \tconst schedule = yield* fetcher.fetch();\n * \tconsole.log(Object.keys(schedule).length, \"major release lines\");\n * });\n *\n * Effect.runPromise(program.pipe(Effect.provide(NodeScheduleFetcherLive)));\n * ```\n *\n * @see {@link NodeScheduleFetcherLive}\n * @see {@link NodeReleaseCache}\n * @see {@link NodeScheduleData}\n * @see {@link NetworkError}\n * @see {@link ParseError}\n *\n * @public\n */\nexport class NodeScheduleFetcher extends Context.Tag(\"runtime-resolver/NodeScheduleFetcher\")<\n\tNodeScheduleFetcher,\n\t{\n\t\t/**\n\t\t * Fetches and decodes the Node.js release schedule JSON, returning a\n\t\t * typed {@link NodeScheduleData} map keyed by major release line.\n\t\t *\n\t\t * Fails with:\n\t\t * - {@link NetworkError} — the upstream request could not be completed.\n\t\t * - {@link ParseError} — the response payload could not be decoded.\n\t\t */\n\t\treadonly fetch: () => Effect.Effect<NodeScheduleData, NetworkError | ParseError>;\n\t}\n>() {}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,IAAa,sBAAb,cAAyC,QAAQ,IAAI,sCAAsC,CAAC,CAa1F,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
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 };
|
|
40
|
+
//# sourceMappingURL=NodeVersionFetcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeVersionFetcher.js","names":[],"sources":["../../../../src/services/NodeVersionFetcher.ts"],"sourcesContent":["import type { Effect } from \"effect\";\nimport { Context } from \"effect\";\nimport type { SemVer } from \"semver-effect\";\nimport type { NetworkError } from \"../errors/NetworkError.js\";\nimport type { ParseError } from \"../errors/ParseError.js\";\nimport type { NodeReleaseInput } from \"../schemas/node-release.js\";\n\n/**\n * Service for fetching Node.js release data from the official\n * Node.js distribution index.\n *\n * Retrieves both the parsed semver version list and the raw\n * {@link NodeReleaseInput} records needed to populate a\n * {@link NodeReleaseCache}. The live implementation fetches from\n * `https://nodejs.org/dist/index.json` via a plain HTTP request — no GitHub\n * credentials are required.\n *\n * @example\n * ```typescript\n * import type { NodeReleaseInput } from \"runtime-resolver\";\n * import { NodeVersionFetcher, NodeVersionFetcherLive } from \"runtime-resolver\";\n * import { Effect } from \"effect\";\n *\n * const program = Effect.gen(function* () {\n * \tconst fetcher = yield* NodeVersionFetcher;\n * \tconst { versions, inputs } = yield* fetcher.fetch();\n * \tconsole.log(`Fetched ${versions.length} Node.js releases`);\n * });\n *\n * Effect.runPromise(program.pipe(Effect.provide(NodeVersionFetcherLive)));\n * ```\n *\n * @see {@link NodeVersionFetcherLive}\n * @see {@link NodeReleaseCache}\n * @see {@link NetworkError}\n * @see {@link ParseError}\n *\n * @public\n */\nexport class NodeVersionFetcher extends Context.Tag(\"runtime-resolver/NodeVersionFetcher\")<\n\tNodeVersionFetcher,\n\t{\n\t\t/**\n\t\t * Fetches all available Node.js releases from the distribution index and\n\t\t * returns both the parsed semver version objects and the raw release input\n\t\t * records.\n\t\t *\n\t\t * Fails with:\n\t\t * - {@link NetworkError} — the upstream request could not be completed.\n\t\t * - {@link ParseError} — the response payload could not be decoded.\n\t\t */\n\t\treadonly fetch: () => Effect.Effect<\n\t\t\t{\n\t\t\t\treadonly versions: ReadonlyArray<SemVer>;\n\t\t\t\treadonly inputs: ReadonlyArray<NodeReleaseInput>;\n\t\t\t},\n\t\t\tNetworkError | ParseError\n\t\t>;\n\t}\n>() {}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,IAAa,qBAAb,cAAwC,QAAQ,IAAI,qCAAqC,CAAC,CAoBxF,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
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 };
|
|
45
|
+
//# sourceMappingURL=OctokitInstance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OctokitInstance.js","names":[],"sources":["../../../../src/services/OctokitInstance.ts"],"sourcesContent":["import { Context } from \"effect\";\n\n/**\n * Thin wrapper around the subset of Octokit's REST client used by\n * {@link GitHubClient}.\n *\n * Exposing only the repository methods actually consumed by this library\n * keeps the surface area narrow and makes the interface straightforward to\n * stub in tests without pulling in the full Octokit type.\n *\n * An `OctokitInstance` is provided to the dependency graph by one of the\n * three authentication layers: {@link GitHubTokenAuth}, {@link GitHubAppAuth},\n * or {@link GitHubAutoAuth}.\n *\n * @example\n * ```typescript\n * import { OctokitInstance, GitHubClientLive, GitHubAutoAuth } from \"runtime-resolver\";\n * import { Effect } from \"effect\";\n *\n * const program = Effect.gen(function* () {\n * \tconst octokit = yield* OctokitInstance;\n * \tconst response = await octokit.rest.repos.listTags({\n * \t\towner: \"oven-sh\",\n * \t\trepo: \"bun\",\n * \t\tper_page: 10,\n * \t});\n * \tconsole.log(response.data.length);\n * });\n *\n * Effect.runPromise(program.pipe(Effect.provide(GitHubAutoAuth)));\n * ```\n *\n * @see {@link GitHubClientLive}\n * @see {@link GitHubTokenAuth}\n * @see {@link GitHubAppAuth}\n * @see {@link GitHubAutoAuth}\n *\n * @public\n */\nexport class OctokitInstance extends Context.Tag(\"runtime-resolver/OctokitInstance\")<\n\tOctokitInstance,\n\t{\n\t\treadonly rest: {\n\t\t\treadonly repos: {\n\t\t\t\t/**\n\t\t\t\t * Lists git tags for a repository, corresponding to\n\t\t\t\t * `GET /repos/{owner}/{repo}/tags`.\n\t\t\t\t *\n\t\t\t\t * @param params - Owner, repo, and optional pagination parameters.\n\t\t\t\t */\n\t\t\t\treadonly listTags: (params: {\n\t\t\t\t\towner: string;\n\t\t\t\t\trepo: string;\n\t\t\t\t\tper_page?: number;\n\t\t\t\t\tpage?: number;\n\t\t\t\t}) => Promise<{ data: Array<unknown> }>;\n\n\t\t\t\t/**\n\t\t\t\t * Lists GitHub Releases for a repository, corresponding to\n\t\t\t\t * `GET /repos/{owner}/{repo}/releases`.\n\t\t\t\t *\n\t\t\t\t * @param params - Owner, repo, and optional pagination parameters.\n\t\t\t\t */\n\t\t\t\treadonly listReleases: (params: {\n\t\t\t\t\towner: string;\n\t\t\t\t\trepo: string;\n\t\t\t\t\tper_page?: number;\n\t\t\t\t\tpage?: number;\n\t\t\t\t}) => Promise<{ data: Array<unknown> }>;\n\t\t\t};\n\t\t};\n\t}\n>() {}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,IAAa,kBAAb,cAAqC,QAAQ,IAAI,kCAAkC,CAAC,CAiClF,CAAC,CAAC,CAAC"}
|
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.8"
|
|
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__ };
|