runtime-resolver 0.3.12 → 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.
Files changed (128) hide show
  1. package/bin/runtime-resolver.d.ts +1 -0
  2. package/bin/runtime-resolver.js +30 -261
  3. package/bin/runtime-resolver.js.map +1 -0
  4. package/cli/commands/resolve.js +240 -0
  5. package/cli/commands/resolve.js.map +1 -0
  6. package/cli/schemas/json-schema.js +13 -0
  7. package/cli/schemas/json-schema.js.map +1 -0
  8. package/cli/schemas/response.js +87 -0
  9. package/cli/schemas/response.js.map +1 -0
  10. package/data/bun-defaults.js +851 -0
  11. package/data/bun-defaults.js.map +1 -0
  12. package/data/deno-defaults.js +1523 -0
  13. package/data/deno-defaults.js.map +1 -0
  14. package/data/node-defaults.js +4401 -0
  15. package/data/node-defaults.js.map +1 -0
  16. package/errors/AuthenticationError.js +36 -0
  17. package/errors/AuthenticationError.js.map +1 -0
  18. package/errors/CacheError.js +33 -0
  19. package/errors/CacheError.js.map +1 -0
  20. package/errors/FreshnessError.js +39 -0
  21. package/errors/FreshnessError.js.map +1 -0
  22. package/errors/InvalidInputError.js +34 -0
  23. package/errors/InvalidInputError.js.map +1 -0
  24. package/errors/NetworkError.js +35 -0
  25. package/errors/NetworkError.js.map +1 -0
  26. package/errors/ParseError.js +34 -0
  27. package/errors/ParseError.js.map +1 -0
  28. package/errors/RateLimitError.js +40 -0
  29. package/errors/RateLimitError.js.map +1 -0
  30. package/errors/VersionNotFoundError.js +38 -0
  31. package/errors/VersionNotFoundError.js.map +1 -0
  32. package/index.d.ts +2577 -2608
  33. package/index.d.ts.map +1 -0
  34. package/index.js +159 -132
  35. package/index.js.map +1 -0
  36. package/layers/AutoBunCacheLive.js +48 -0
  37. package/layers/AutoBunCacheLive.js.map +1 -0
  38. package/layers/AutoDenoCacheLive.js +48 -0
  39. package/layers/AutoDenoCacheLive.js.map +1 -0
  40. package/layers/AutoNodeCacheLive.js +59 -0
  41. package/layers/AutoNodeCacheLive.js.map +1 -0
  42. package/layers/BunReleaseCacheLive.js +26 -0
  43. package/layers/BunReleaseCacheLive.js.map +1 -0
  44. package/layers/BunResolverLive.js +86 -0
  45. package/layers/BunResolverLive.js.map +1 -0
  46. package/layers/BunVersionFetcherLive.js +56 -0
  47. package/layers/BunVersionFetcherLive.js.map +1 -0
  48. package/layers/DenoReleaseCacheLive.js +26 -0
  49. package/layers/DenoReleaseCacheLive.js.map +1 -0
  50. package/layers/DenoResolverLive.js +85 -0
  51. package/layers/DenoResolverLive.js.map +1 -0
  52. package/layers/DenoVersionFetcherLive.js +52 -0
  53. package/layers/DenoVersionFetcherLive.js.map +1 -0
  54. package/layers/FreshBunCacheLive.js +61 -0
  55. package/layers/FreshBunCacheLive.js.map +1 -0
  56. package/layers/FreshDenoCacheLive.js +61 -0
  57. package/layers/FreshDenoCacheLive.js.map +1 -0
  58. package/layers/FreshNodeCacheLive.js +56 -0
  59. package/layers/FreshNodeCacheLive.js.map +1 -0
  60. package/layers/GitHubAppAuth.js +59 -0
  61. package/layers/GitHubAppAuth.js.map +1 -0
  62. package/layers/GitHubAutoAuth.js +71 -0
  63. package/layers/GitHubAutoAuth.js.map +1 -0
  64. package/layers/GitHubClientLive.js +131 -0
  65. package/layers/GitHubClientLive.js.map +1 -0
  66. package/layers/GitHubTokenAuth.js +51 -0
  67. package/layers/GitHubTokenAuth.js.map +1 -0
  68. package/layers/NodeReleaseCacheLive.js +78 -0
  69. package/layers/NodeReleaseCacheLive.js.map +1 -0
  70. package/layers/NodeResolverLive.js +108 -0
  71. package/layers/NodeResolverLive.js.map +1 -0
  72. package/layers/NodeScheduleFetcherLive.js +38 -0
  73. package/layers/NodeScheduleFetcherLive.js.map +1 -0
  74. package/layers/NodeVersionFetcherLive.js +56 -0
  75. package/layers/NodeVersionFetcherLive.js.map +1 -0
  76. package/layers/OfflineBunCacheLive.js +41 -0
  77. package/layers/OfflineBunCacheLive.js.map +1 -0
  78. package/layers/OfflineDenoCacheLive.js +41 -0
  79. package/layers/OfflineDenoCacheLive.js.map +1 -0
  80. package/layers/OfflineNodeCacheLive.js +40 -0
  81. package/layers/OfflineNodeCacheLive.js.map +1 -0
  82. package/layers/RuntimeCacheLive.js +79 -0
  83. package/layers/RuntimeCacheLive.js.map +1 -0
  84. package/lib/retry.js +28 -0
  85. package/lib/retry.js.map +1 -0
  86. package/lib/semver.js +22 -0
  87. package/lib/semver.js.map +1 -0
  88. package/package.json +57 -68
  89. package/schemas/bun-release.js +62 -0
  90. package/schemas/bun-release.js.map +1 -0
  91. package/schemas/deno-release.js +62 -0
  92. package/schemas/deno-release.js.map +1 -0
  93. package/schemas/github.js +75 -0
  94. package/schemas/github.js.map +1 -0
  95. package/schemas/node-release.js +131 -0
  96. package/schemas/node-release.js.map +1 -0
  97. package/schemas/node-schedule.js +111 -0
  98. package/schemas/node-schedule.js.map +1 -0
  99. package/schemas/node.js +69 -0
  100. package/schemas/node.js.map +1 -0
  101. package/services/BunReleaseCache.js +34 -0
  102. package/services/BunReleaseCache.js.map +1 -0
  103. package/services/BunResolver.js +37 -0
  104. package/services/BunResolver.js.map +1 -0
  105. package/services/BunVersionFetcher.js +42 -0
  106. package/services/BunVersionFetcher.js.map +1 -0
  107. package/services/DenoReleaseCache.js +34 -0
  108. package/services/DenoReleaseCache.js.map +1 -0
  109. package/services/DenoResolver.js +37 -0
  110. package/services/DenoResolver.js.map +1 -0
  111. package/services/DenoVersionFetcher.js +42 -0
  112. package/services/DenoVersionFetcher.js.map +1 -0
  113. package/services/GitHubClient.js +41 -0
  114. package/services/GitHubClient.js.map +1 -0
  115. package/services/NodeReleaseCache.js +42 -0
  116. package/services/NodeReleaseCache.js.map +1 -0
  117. package/services/NodeResolver.js +45 -0
  118. package/services/NodeResolver.js.map +1 -0
  119. package/services/NodeScheduleFetcher.js +39 -0
  120. package/services/NodeScheduleFetcher.js.map +1 -0
  121. package/services/NodeVersionFetcher.js +40 -0
  122. package/services/NodeVersionFetcher.js.map +1 -0
  123. package/services/OctokitInstance.js +45 -0
  124. package/services/OctokitInstance.js.map +1 -0
  125. package/tsdoc-metadata.json +11 -11
  126. package/612.js +0 -23
  127. package/711.js +0 -7554
  128. package/json-schema.js +0 -95
@@ -0,0 +1,41 @@
1
+ import { bunDefaultInputs } from "../data/bun-defaults.js";
2
+ import { BunRelease } from "../schemas/bun-release.js";
3
+ import { BunReleaseCache } from "../services/BunReleaseCache.js";
4
+ import { BunReleaseCacheLive } from "./BunReleaseCacheLive.js";
5
+ import { Effect, Layer } from "effect";
6
+ import { SemVerParserLive, VersionCacheLive } from "semver-effect";
7
+
8
+ //#region src/layers/OfflineBunCacheLive.ts
9
+ const offlineSetup = Effect.gen(function* () {
10
+ const cache = yield* BunReleaseCache;
11
+ const releases = yield* Effect.all(bunDefaultInputs.map((input) => BunRelease.fromInput(input)), { concurrency: "unbounded" }).pipe(Effect.orElseSucceed(() => []));
12
+ yield* cache.load(releases);
13
+ });
14
+ const SemVerLayer = VersionCacheLive.pipe(Layer.provide(SemVerParserLive));
15
+ const BaseCacheLayer = BunReleaseCacheLive.pipe(Layer.provide(SemVerLayer));
16
+ /**
17
+ * Provides the {@link BunReleaseCache} service using the "Offline" cache strategy.
18
+ *
19
+ * Uses only the bundled default Bun release data that was baked in at build time.
20
+ * Makes no network requests and has no runtime dependencies. This layer always
21
+ * succeeds immediately.
22
+ *
23
+ * Use this strategy in environments where network access is unavailable or
24
+ * undesirable (e.g., air-gapped systems, hermetic test environments, or any
25
+ * context where version data from the bundle is sufficient).
26
+ *
27
+ * The three Bun cache strategy layers are:
28
+ * - {@link AutoBunCacheLive} — tries API first, falls back to bundled defaults on any error
29
+ * - {@link FreshBunCacheLive} — requires live API data, fails with `FreshnessError` if unavailable
30
+ * - `OfflineBunCacheLive` — uses only bundled defaults, no network I/O
31
+ *
32
+ * @see {@link BunReleaseCache}
33
+ * @see {@link AutoBunCacheLive}
34
+ * @see {@link FreshBunCacheLive}
35
+ * @public
36
+ */
37
+ const OfflineBunCacheLive = BaseCacheLayer.pipe(Layer.tap((ctx) => offlineSetup.pipe(Effect.provide(ctx))));
38
+
39
+ //#endregion
40
+ export { OfflineBunCacheLive };
41
+ //# sourceMappingURL=OfflineBunCacheLive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OfflineBunCacheLive.js","names":["SemVerVersionCacheLive"],"sources":["../../../../src/layers/OfflineBunCacheLive.ts"],"sourcesContent":["import { Effect, Layer } from \"effect\";\nimport { SemVerParserLive, VersionCacheLive as SemVerVersionCacheLive } from \"semver-effect\";\nimport { bunDefaultInputs } from \"../data/bun-defaults.js\";\nimport { BunRelease } from \"../schemas/bun-release.js\";\nimport { BunReleaseCache } from \"../services/BunReleaseCache.js\";\nimport { BunReleaseCacheLive } from \"./BunReleaseCacheLive.js\";\n\nconst offlineSetup = Effect.gen(function* () {\n\tconst cache = yield* BunReleaseCache;\n\tconst releases = yield* Effect.all(\n\t\tbunDefaultInputs.map((input) => BunRelease.fromInput(input)),\n\t\t{ concurrency: \"unbounded\" },\n\t).pipe(Effect.orElseSucceed(() => [] as BunRelease[]));\n\tyield* cache.load(releases);\n});\n\nconst SemVerLayer = SemVerVersionCacheLive.pipe(Layer.provide(SemVerParserLive));\nconst BaseCacheLayer = BunReleaseCacheLive.pipe(Layer.provide(SemVerLayer));\n\n/**\n * Provides the {@link BunReleaseCache} service using the \"Offline\" cache strategy.\n *\n * Uses only the bundled default Bun release data that was baked in at build time.\n * Makes no network requests and has no runtime dependencies. This layer always\n * succeeds immediately.\n *\n * Use this strategy in environments where network access is unavailable or\n * undesirable (e.g., air-gapped systems, hermetic test environments, or any\n * context where version data from the bundle is sufficient).\n *\n * The three Bun cache strategy layers are:\n * - {@link AutoBunCacheLive} — tries API first, falls back to bundled defaults on any error\n * - {@link FreshBunCacheLive} — requires live API data, fails with `FreshnessError` if unavailable\n * - `OfflineBunCacheLive` — uses only bundled defaults, no network I/O\n *\n * @see {@link BunReleaseCache}\n * @see {@link AutoBunCacheLive}\n * @see {@link FreshBunCacheLive}\n * @public\n */\nexport const OfflineBunCacheLive: Layer.Layer<BunReleaseCache> = BaseCacheLayer.pipe(\n\tLayer.tap((ctx) => offlineSetup.pipe(Effect.provide(ctx))),\n);\n"],"mappings":";;;;;;;;AAOA,MAAM,eAAe,OAAO,IAAI,aAAa;CAC5C,MAAM,QAAQ,OAAO;CACrB,MAAM,WAAW,OAAO,OAAO,IAC9B,iBAAiB,KAAK,UAAU,WAAW,UAAU,KAAK,CAAC,GAC3D,EAAE,aAAa,YAAY,CAC5B,CAAC,CAAC,KAAK,OAAO,oBAAoB,CAAC,CAAiB,CAAC;CACrD,OAAO,MAAM,KAAK,QAAQ;AAC3B,CAAC;AAED,MAAM,cAAcA,iBAAuB,KAAK,MAAM,QAAQ,gBAAgB,CAAC;AAC/E,MAAM,iBAAiB,oBAAoB,KAAK,MAAM,QAAQ,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;AAuB1E,MAAa,sBAAoD,eAAe,KAC/E,MAAM,KAAK,QAAQ,aAAa,KAAK,OAAO,QAAQ,GAAG,CAAC,CAAC,CAC1D"}
@@ -0,0 +1,41 @@
1
+ import { denoDefaultInputs } from "../data/deno-defaults.js";
2
+ import { DenoRelease } from "../schemas/deno-release.js";
3
+ import { DenoReleaseCache } from "../services/DenoReleaseCache.js";
4
+ import { DenoReleaseCacheLive } from "./DenoReleaseCacheLive.js";
5
+ import { Effect, Layer } from "effect";
6
+ import { SemVerParserLive, VersionCacheLive } from "semver-effect";
7
+
8
+ //#region src/layers/OfflineDenoCacheLive.ts
9
+ const offlineSetup = Effect.gen(function* () {
10
+ const cache = yield* DenoReleaseCache;
11
+ const releases = yield* Effect.all(denoDefaultInputs.map((input) => DenoRelease.fromInput(input)), { concurrency: "unbounded" }).pipe(Effect.orElseSucceed(() => []));
12
+ yield* cache.load(releases);
13
+ });
14
+ const SemVerLayer = VersionCacheLive.pipe(Layer.provide(SemVerParserLive));
15
+ const BaseCacheLayer = DenoReleaseCacheLive.pipe(Layer.provide(SemVerLayer));
16
+ /**
17
+ * Provides the {@link DenoReleaseCache} service using the "Offline" cache strategy.
18
+ *
19
+ * Uses only the bundled default Deno release data that was baked in at build time.
20
+ * Makes no network requests and has no runtime dependencies. This layer always
21
+ * succeeds immediately.
22
+ *
23
+ * Use this strategy in environments where network access is unavailable or
24
+ * undesirable (e.g., air-gapped systems, hermetic test environments, or any
25
+ * context where version data from the bundle is sufficient).
26
+ *
27
+ * The three Deno cache strategy layers are:
28
+ * - {@link AutoDenoCacheLive} — tries API first, falls back to bundled defaults on any error
29
+ * - {@link FreshDenoCacheLive} — requires live API data, fails with `FreshnessError` if unavailable
30
+ * - `OfflineDenoCacheLive` — uses only bundled defaults, no network I/O
31
+ *
32
+ * @see {@link DenoReleaseCache}
33
+ * @see {@link AutoDenoCacheLive}
34
+ * @see {@link FreshDenoCacheLive}
35
+ * @public
36
+ */
37
+ const OfflineDenoCacheLive = BaseCacheLayer.pipe(Layer.tap((ctx) => offlineSetup.pipe(Effect.provide(ctx))));
38
+
39
+ //#endregion
40
+ export { OfflineDenoCacheLive };
41
+ //# sourceMappingURL=OfflineDenoCacheLive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OfflineDenoCacheLive.js","names":["SemVerVersionCacheLive"],"sources":["../../../../src/layers/OfflineDenoCacheLive.ts"],"sourcesContent":["import { Effect, Layer } from \"effect\";\nimport { SemVerParserLive, VersionCacheLive as SemVerVersionCacheLive } from \"semver-effect\";\nimport { denoDefaultInputs } from \"../data/deno-defaults.js\";\nimport { DenoRelease } from \"../schemas/deno-release.js\";\nimport { DenoReleaseCache } from \"../services/DenoReleaseCache.js\";\nimport { DenoReleaseCacheLive } from \"./DenoReleaseCacheLive.js\";\n\nconst offlineSetup = Effect.gen(function* () {\n\tconst cache = yield* DenoReleaseCache;\n\tconst releases = yield* Effect.all(\n\t\tdenoDefaultInputs.map((input) => DenoRelease.fromInput(input)),\n\t\t{ concurrency: \"unbounded\" },\n\t).pipe(Effect.orElseSucceed(() => [] as DenoRelease[]));\n\tyield* cache.load(releases);\n});\n\nconst SemVerLayer = SemVerVersionCacheLive.pipe(Layer.provide(SemVerParserLive));\nconst BaseCacheLayer = DenoReleaseCacheLive.pipe(Layer.provide(SemVerLayer));\n\n/**\n * Provides the {@link DenoReleaseCache} service using the \"Offline\" cache strategy.\n *\n * Uses only the bundled default Deno release data that was baked in at build time.\n * Makes no network requests and has no runtime dependencies. This layer always\n * succeeds immediately.\n *\n * Use this strategy in environments where network access is unavailable or\n * undesirable (e.g., air-gapped systems, hermetic test environments, or any\n * context where version data from the bundle is sufficient).\n *\n * The three Deno cache strategy layers are:\n * - {@link AutoDenoCacheLive} — tries API first, falls back to bundled defaults on any error\n * - {@link FreshDenoCacheLive} — requires live API data, fails with `FreshnessError` if unavailable\n * - `OfflineDenoCacheLive` — uses only bundled defaults, no network I/O\n *\n * @see {@link DenoReleaseCache}\n * @see {@link AutoDenoCacheLive}\n * @see {@link FreshDenoCacheLive}\n * @public\n */\nexport const OfflineDenoCacheLive: Layer.Layer<DenoReleaseCache> = BaseCacheLayer.pipe(\n\tLayer.tap((ctx) => offlineSetup.pipe(Effect.provide(ctx))),\n);\n"],"mappings":";;;;;;;;AAOA,MAAM,eAAe,OAAO,IAAI,aAAa;CAC5C,MAAM,QAAQ,OAAO;CACrB,MAAM,WAAW,OAAO,OAAO,IAC9B,kBAAkB,KAAK,UAAU,YAAY,UAAU,KAAK,CAAC,GAC7D,EAAE,aAAa,YAAY,CAC5B,CAAC,CAAC,KAAK,OAAO,oBAAoB,CAAC,CAAkB,CAAC;CACtD,OAAO,MAAM,KAAK,QAAQ;AAC3B,CAAC;AAED,MAAM,cAAcA,iBAAuB,KAAK,MAAM,QAAQ,gBAAgB,CAAC;AAC/E,MAAM,iBAAiB,qBAAqB,KAAK,MAAM,QAAQ,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;AAuB3E,MAAa,uBAAsD,eAAe,KACjF,MAAM,KAAK,QAAQ,aAAa,KAAK,OAAO,QAAQ,GAAG,CAAC,CAAC,CAC1D"}
@@ -0,0 +1,40 @@
1
+ import { nodeDefaultInputs, nodeDefaultScheduleData } from "../data/node-defaults.js";
2
+ import { NodeReleaseCache } from "../services/NodeReleaseCache.js";
3
+ import { NodeReleaseCacheLive } from "./NodeReleaseCacheLive.js";
4
+ import { Effect, Layer } from "effect";
5
+ import { SemVerParserLive, VersionCacheLive } from "semver-effect";
6
+
7
+ //#region src/layers/OfflineNodeCacheLive.ts
8
+ const offlineSetup = Effect.gen(function* () {
9
+ const cache = yield* NodeReleaseCache;
10
+ yield* cache.updateSchedule(nodeDefaultScheduleData);
11
+ yield* cache.loadFromInputs(nodeDefaultInputs);
12
+ });
13
+ const SemVerLayer = VersionCacheLive.pipe(Layer.provide(SemVerParserLive));
14
+ const BaseCacheLayer = NodeReleaseCacheLive.pipe(Layer.provide(SemVerLayer));
15
+ /**
16
+ * Provides the {@link NodeReleaseCache} service using the "Offline" cache strategy.
17
+ *
18
+ * Uses only the bundled default Node.js release data and schedule data that were
19
+ * baked in at build time. Makes no network requests and has no runtime
20
+ * dependencies. This layer always succeeds immediately.
21
+ *
22
+ * Use this strategy in environments where network access is unavailable or
23
+ * undesirable (e.g., air-gapped systems, hermetic test environments, or any
24
+ * context where version data from the bundle is sufficient).
25
+ *
26
+ * The three Node cache strategy layers are:
27
+ * - {@link AutoNodeCacheLive} — tries API first, falls back to bundled defaults on any error
28
+ * - {@link FreshNodeCacheLive} — requires live API data, fails with `FreshnessError` if unavailable
29
+ * - `OfflineNodeCacheLive` — uses only bundled defaults, no network I/O
30
+ *
31
+ * @see {@link NodeReleaseCache}
32
+ * @see {@link AutoNodeCacheLive}
33
+ * @see {@link FreshNodeCacheLive}
34
+ * @public
35
+ */
36
+ const OfflineNodeCacheLive = BaseCacheLayer.pipe(Layer.tap((ctx) => offlineSetup.pipe(Effect.provide(ctx))));
37
+
38
+ //#endregion
39
+ export { OfflineNodeCacheLive };
40
+ //# sourceMappingURL=OfflineNodeCacheLive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OfflineNodeCacheLive.js","names":["SemVerVersionCacheLive"],"sources":["../../../../src/layers/OfflineNodeCacheLive.ts"],"sourcesContent":["import { Effect, Layer } from \"effect\";\nimport { SemVerParserLive, VersionCacheLive as SemVerVersionCacheLive } from \"semver-effect\";\nimport { nodeDefaultInputs, nodeDefaultScheduleData } from \"../data/node-defaults.js\";\nimport { NodeReleaseCache } from \"../services/NodeReleaseCache.js\";\nimport { NodeReleaseCacheLive } from \"./NodeReleaseCacheLive.js\";\n\nconst offlineSetup = Effect.gen(function* () {\n\tconst cache = yield* NodeReleaseCache;\n\tyield* cache.updateSchedule(nodeDefaultScheduleData);\n\tyield* cache.loadFromInputs(nodeDefaultInputs);\n});\n\nconst SemVerLayer = SemVerVersionCacheLive.pipe(Layer.provide(SemVerParserLive));\nconst BaseCacheLayer = NodeReleaseCacheLive.pipe(Layer.provide(SemVerLayer));\n\n/**\n * Provides the {@link NodeReleaseCache} service using the \"Offline\" cache strategy.\n *\n * Uses only the bundled default Node.js release data and schedule data that were\n * baked in at build time. Makes no network requests and has no runtime\n * dependencies. This layer always succeeds immediately.\n *\n * Use this strategy in environments where network access is unavailable or\n * undesirable (e.g., air-gapped systems, hermetic test environments, or any\n * context where version data from the bundle is sufficient).\n *\n * The three Node cache strategy layers are:\n * - {@link AutoNodeCacheLive} — tries API first, falls back to bundled defaults on any error\n * - {@link FreshNodeCacheLive} — requires live API data, fails with `FreshnessError` if unavailable\n * - `OfflineNodeCacheLive` — uses only bundled defaults, no network I/O\n *\n * @see {@link NodeReleaseCache}\n * @see {@link AutoNodeCacheLive}\n * @see {@link FreshNodeCacheLive}\n * @public\n */\nexport const OfflineNodeCacheLive: Layer.Layer<NodeReleaseCache> = BaseCacheLayer.pipe(\n\tLayer.tap((ctx) => offlineSetup.pipe(Effect.provide(ctx))),\n);\n"],"mappings":";;;;;;;AAMA,MAAM,eAAe,OAAO,IAAI,aAAa;CAC5C,MAAM,QAAQ,OAAO;CACrB,OAAO,MAAM,eAAe,uBAAuB;CACnD,OAAO,MAAM,eAAe,iBAAiB;AAC9C,CAAC;AAED,MAAM,cAAcA,iBAAuB,KAAK,MAAM,QAAQ,gBAAgB,CAAC;AAC/E,MAAM,iBAAiB,qBAAqB,KAAK,MAAM,QAAQ,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;AAuB3E,MAAa,uBAAsD,eAAe,KACjF,MAAM,KAAK,QAAQ,aAAa,KAAK,OAAO,QAAQ,GAAG,CAAC,CAAC,CAC1D"}
@@ -0,0 +1,79 @@
1
+ import { Effect } from "effect";
2
+ import { Range, VersionCache } from "semver-effect";
3
+
4
+ //#region src/layers/RuntimeCacheLive.ts
5
+ /**
6
+ * Factory that creates a {@link RuntimeCache} implementation backed by
7
+ * `semver-effect`'s `VersionCache`.
8
+ *
9
+ * The returned `Effect` must be executed within an Effect context that provides
10
+ * a `SemVerVersionCache` service (i.e., it requires `SemVerVersionCache` in its
11
+ * environment). The cache maintains an internal lookup map from version string
12
+ * to the full release object so that resolved semver versions can be
13
+ * round-tripped back to their typed release records.
14
+ *
15
+ * This factory is used internally by {@link BunReleaseCacheLive},
16
+ * {@link DenoReleaseCacheLive}, and {@link NodeReleaseCacheLive} to build their
17
+ * respective cache service implementations. Prefer those higher-level layers
18
+ * over calling this factory directly.
19
+ *
20
+ * Note: `load` is not concurrency-safe. Callers must not invoke it concurrently.
21
+ * In practice this constraint is upheld because `load` is only called from layer
22
+ * setup and `NodeReleaseCacheLive.loadFromInputs`, both of which are serialized
23
+ * by the Effect runtime.
24
+ *
25
+ * @typeParam R - The runtime release type stored in the cache. Must extend
26
+ * {@link RuntimeRelease}.
27
+ *
28
+ * @see {@link RuntimeCache}
29
+ * @see {@link BunReleaseCacheLive}
30
+ * @see {@link DenoReleaseCacheLive}
31
+ * @see {@link NodeReleaseCacheLive}
32
+ * @public
33
+ */
34
+ const createRuntimeCache = () => Effect.gen(function* () {
35
+ const innerCache = yield* VersionCache;
36
+ const lookupMap = /* @__PURE__ */ new Map();
37
+ return {
38
+ load: (releases) => Effect.gen(function* () {
39
+ lookupMap.clear();
40
+ const versions = [];
41
+ for (const r of releases) {
42
+ const key = r.version.toString();
43
+ lookupMap.set(key, r);
44
+ versions.push(r.version);
45
+ }
46
+ yield* innerCache.load(versions);
47
+ }),
48
+ resolve: (range) => Effect.gen(function* () {
49
+ const parsed = yield* Range.parse(range);
50
+ const resolved = yield* innerCache.resolve(parsed);
51
+ const release = lookupMap.get(resolved.toString());
52
+ if (!release) return yield* Effect.die(/* @__PURE__ */ new Error(`Cache inconsistency: ${resolved.toString()} not in lookup map`));
53
+ return release;
54
+ }),
55
+ releases: () => Effect.gen(function* () {
56
+ return (yield* innerCache.versions.pipe(Effect.catchTag("EmptyCacheError", () => Effect.succeed([])))).map((v) => lookupMap.get(v.toString())).filter((r) => r !== void 0);
57
+ }),
58
+ filter: (range) => Effect.gen(function* () {
59
+ const parsed = yield* Range.parse(range);
60
+ return (yield* innerCache.filter(parsed).pipe(Effect.catchTag("EmptyCacheError", () => Effect.succeed([])))).map((v) => lookupMap.get(v.toString())).filter((r) => r !== void 0);
61
+ }),
62
+ latest: () => Effect.gen(function* () {
63
+ const version = yield* innerCache.latest();
64
+ const release = lookupMap.get(version.toString());
65
+ if (!release) return yield* Effect.die(/* @__PURE__ */ new Error(`Cache inconsistency: ${version.toString()} not in lookup map`));
66
+ return release;
67
+ }),
68
+ latestByMajor: () => Effect.gen(function* () {
69
+ return (yield* innerCache.latestByMajor().pipe(Effect.catchTag("EmptyCacheError", () => Effect.succeed([])))).map((v) => lookupMap.get(v.toString())).filter((r) => r !== void 0);
70
+ }),
71
+ latestByMinor: () => Effect.gen(function* () {
72
+ return (yield* innerCache.latestByMinor().pipe(Effect.catchTag("EmptyCacheError", () => Effect.succeed([])))).map((v) => lookupMap.get(v.toString())).filter((r) => r !== void 0);
73
+ })
74
+ };
75
+ });
76
+
77
+ //#endregion
78
+ export { createRuntimeCache };
79
+ //# sourceMappingURL=RuntimeCacheLive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RuntimeCacheLive.js","names":["SemVerVersionCache"],"sources":["../../../../src/layers/RuntimeCacheLive.ts"],"sourcesContent":["import { Effect } from \"effect\";\nimport type { SemVer } from \"semver-effect\";\nimport { Range, VersionCache as SemVerVersionCache } from \"semver-effect\";\nimport type { RuntimeRelease } from \"../schemas/runtime-release.js\";\nimport type { RuntimeCache } from \"../services/RuntimeCache.js\";\n\n/**\n * Factory that creates a {@link RuntimeCache} implementation backed by\n * `semver-effect`'s `VersionCache`.\n *\n * The returned `Effect` must be executed within an Effect context that provides\n * a `SemVerVersionCache` service (i.e., it requires `SemVerVersionCache` in its\n * environment). The cache maintains an internal lookup map from version string\n * to the full release object so that resolved semver versions can be\n * round-tripped back to their typed release records.\n *\n * This factory is used internally by {@link BunReleaseCacheLive},\n * {@link DenoReleaseCacheLive}, and {@link NodeReleaseCacheLive} to build their\n * respective cache service implementations. Prefer those higher-level layers\n * over calling this factory directly.\n *\n * Note: `load` is not concurrency-safe. Callers must not invoke it concurrently.\n * In practice this constraint is upheld because `load` is only called from layer\n * setup and `NodeReleaseCacheLive.loadFromInputs`, both of which are serialized\n * by the Effect runtime.\n *\n * @typeParam R - The runtime release type stored in the cache. Must extend\n * {@link RuntimeRelease}.\n *\n * @see {@link RuntimeCache}\n * @see {@link BunReleaseCacheLive}\n * @see {@link DenoReleaseCacheLive}\n * @see {@link NodeReleaseCacheLive}\n * @public\n */\nexport const createRuntimeCache = <R extends RuntimeRelease>(): Effect.Effect<\n\tRuntimeCache<R>,\n\tnever,\n\tSemVerVersionCache\n> =>\n\tEffect.gen(function* () {\n\t\tconst innerCache = yield* SemVerVersionCache;\n\t\tconst lookupMap = new Map<string, R>();\n\n\t\treturn {\n\t\t\t// NOTE: `load` is not concurrency-safe; callers must not invoke it\n\t\t\t// concurrently. In practice this is only called from layer setup and\n\t\t\t// NodeReleaseCacheLive.loadFromInputs, which are serialized by Effect.\n\t\t\tload: (releases: ReadonlyArray<R>) =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tlookupMap.clear();\n\t\t\t\t\tconst versions: SemVer[] = [];\n\t\t\t\t\tfor (const r of releases) {\n\t\t\t\t\t\tconst key = r.version.toString();\n\t\t\t\t\t\tlookupMap.set(key, r);\n\t\t\t\t\t\tversions.push(r.version);\n\t\t\t\t\t}\n\t\t\t\t\tyield* innerCache.load(versions);\n\t\t\t\t}),\n\n\t\t\tresolve: (range: string) =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst parsed = yield* Range.parse(range);\n\t\t\t\t\tconst resolved = yield* innerCache.resolve(parsed);\n\t\t\t\t\tconst release = lookupMap.get(resolved.toString());\n\t\t\t\t\tif (!release) {\n\t\t\t\t\t\treturn yield* Effect.die(new Error(`Cache inconsistency: ${resolved.toString()} not in lookup map`));\n\t\t\t\t\t}\n\t\t\t\t\treturn release;\n\t\t\t\t}),\n\n\t\t\treleases: () =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst versions = yield* innerCache.versions.pipe(\n\t\t\t\t\t\tEffect.catchTag(\"EmptyCacheError\", () => Effect.succeed([] as ReadonlyArray<SemVer>)),\n\t\t\t\t\t);\n\t\t\t\t\treturn versions.map((v) => lookupMap.get(v.toString())).filter((r): r is R => r !== undefined);\n\t\t\t\t}),\n\n\t\t\tfilter: (range: string) =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst parsed = yield* Range.parse(range);\n\t\t\t\t\tconst filtered = yield* innerCache\n\t\t\t\t\t\t.filter(parsed)\n\t\t\t\t\t\t.pipe(Effect.catchTag(\"EmptyCacheError\", () => Effect.succeed([] as ReadonlyArray<SemVer>)));\n\t\t\t\t\treturn filtered.map((v) => lookupMap.get(v.toString())).filter((r): r is R => r !== undefined);\n\t\t\t\t}),\n\n\t\t\tlatest: () =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst version = yield* innerCache.latest();\n\t\t\t\t\tconst release = lookupMap.get(version.toString());\n\t\t\t\t\tif (!release) {\n\t\t\t\t\t\treturn yield* Effect.die(new Error(`Cache inconsistency: ${version.toString()} not in lookup map`));\n\t\t\t\t\t}\n\t\t\t\t\treturn release;\n\t\t\t\t}),\n\n\t\t\tlatestByMajor: () =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst versions = yield* innerCache\n\t\t\t\t\t\t.latestByMajor()\n\t\t\t\t\t\t.pipe(Effect.catchTag(\"EmptyCacheError\", () => Effect.succeed([] as ReadonlyArray<SemVer>)));\n\t\t\t\t\treturn versions.map((v) => lookupMap.get(v.toString())).filter((r): r is R => r !== undefined);\n\t\t\t\t}),\n\n\t\t\tlatestByMinor: () =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst versions = yield* innerCache\n\t\t\t\t\t\t.latestByMinor()\n\t\t\t\t\t\t.pipe(Effect.catchTag(\"EmptyCacheError\", () => Effect.succeed([] as ReadonlyArray<SemVer>)));\n\t\t\t\t\treturn versions.map((v) => lookupMap.get(v.toString())).filter((r): r is R => r !== undefined);\n\t\t\t\t}),\n\t\t};\n\t});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,2BAKZ,OAAO,IAAI,aAAa;CACvB,MAAM,aAAa,OAAOA;CAC1B,MAAM,4BAAY,IAAI,IAAe;CAErC,OAAO;EAIN,OAAO,aACN,OAAO,IAAI,aAAa;GACvB,UAAU,MAAM;GAChB,MAAM,WAAqB,CAAC;GAC5B,KAAK,MAAM,KAAK,UAAU;IACzB,MAAM,MAAM,EAAE,QAAQ,SAAS;IAC/B,UAAU,IAAI,KAAK,CAAC;IACpB,SAAS,KAAK,EAAE,OAAO;GACxB;GACA,OAAO,WAAW,KAAK,QAAQ;EAChC,CAAC;EAEF,UAAU,UACT,OAAO,IAAI,aAAa;GACvB,MAAM,SAAS,OAAO,MAAM,MAAM,KAAK;GACvC,MAAM,WAAW,OAAO,WAAW,QAAQ,MAAM;GACjD,MAAM,UAAU,UAAU,IAAI,SAAS,SAAS,CAAC;GACjD,IAAI,CAAC,SACJ,OAAO,OAAO,OAAO,oBAAI,IAAI,MAAM,wBAAwB,SAAS,SAAS,EAAE,mBAAmB,CAAC;GAEpG,OAAO;EACR,CAAC;EAEF,gBACC,OAAO,IAAI,aAAa;GAIvB,QAAO,OAHiB,WAAW,SAAS,KAC3C,OAAO,SAAS,yBAAyB,OAAO,QAAQ,CAAC,CAA0B,CAAC,CACrF,EACe,CAAC,KAAK,MAAM,UAAU,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,MAAc,MAAM,MAAS;EAC9F,CAAC;EAEF,SAAS,UACR,OAAO,IAAI,aAAa;GACvB,MAAM,SAAS,OAAO,MAAM,MAAM,KAAK;GAIvC,QAAO,OAHiB,WACtB,OAAO,MAAM,CAAC,CACd,KAAK,OAAO,SAAS,yBAAyB,OAAO,QAAQ,CAAC,CAA0B,CAAC,CAAC,EAC7E,CAAC,KAAK,MAAM,UAAU,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,MAAc,MAAM,MAAS;EAC9F,CAAC;EAEF,cACC,OAAO,IAAI,aAAa;GACvB,MAAM,UAAU,OAAO,WAAW,OAAO;GACzC,MAAM,UAAU,UAAU,IAAI,QAAQ,SAAS,CAAC;GAChD,IAAI,CAAC,SACJ,OAAO,OAAO,OAAO,oBAAI,IAAI,MAAM,wBAAwB,QAAQ,SAAS,EAAE,mBAAmB,CAAC;GAEnG,OAAO;EACR,CAAC;EAEF,qBACC,OAAO,IAAI,aAAa;GAIvB,QAAO,OAHiB,WACtB,cAAc,CAAC,CACf,KAAK,OAAO,SAAS,yBAAyB,OAAO,QAAQ,CAAC,CAA0B,CAAC,CAAC,EAC7E,CAAC,KAAK,MAAM,UAAU,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,MAAc,MAAM,MAAS;EAC9F,CAAC;EAEF,qBACC,OAAO,IAAI,aAAa;GAIvB,QAAO,OAHiB,WACtB,cAAc,CAAC,CACf,KAAK,OAAO,SAAS,yBAAyB,OAAO,QAAQ,CAAC,CAA0B,CAAC,CAAC,EAC7E,CAAC,KAAK,MAAM,UAAU,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,MAAc,MAAM,MAAS;EAC9F,CAAC;CACH;AACD,CAAC"}
package/lib/retry.js ADDED
@@ -0,0 +1,28 @@
1
+ import { Effect, Predicate, Schedule } from "effect";
2
+
3
+ //#region src/lib/retry.ts
4
+ /**
5
+ * Wraps an effect with automatic retry logic for {@link RateLimitError}.
6
+ *
7
+ * When the wrapped effect fails with a `RateLimitError` the retry schedule
8
+ * applies exponential backoff starting at a 1-second base delay, doubling on
9
+ * each attempt, for a maximum of 3 retries. Errors with any other tag are
10
+ * re-raised immediately without retrying.
11
+ *
12
+ * The predicate used for the `while` condition is
13
+ * `Predicate.isTagged("RateLimitError")`, so only errors whose `_tag` field
14
+ * equals `"RateLimitError"` trigger a retry; all other error types propagate
15
+ * unchanged.
16
+ *
17
+ * @see {@link RateLimitError}
18
+ *
19
+ * @internal
20
+ */
21
+ const retryOnRateLimit = (effect) => effect.pipe(Effect.retry({
22
+ schedule: Schedule.exponential("1 second").pipe(Schedule.compose(Schedule.recurs(3))),
23
+ while: Predicate.isTagged("RateLimitError")
24
+ }));
25
+
26
+ //#endregion
27
+ export { retryOnRateLimit };
28
+ //# sourceMappingURL=retry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry.js","names":[],"sources":["../../../../src/lib/retry.ts"],"sourcesContent":["import { Effect, Predicate, Schedule } from \"effect\";\n\n/**\n * Wraps an effect with automatic retry logic for {@link RateLimitError}.\n *\n * When the wrapped effect fails with a `RateLimitError` the retry schedule\n * applies exponential backoff starting at a 1-second base delay, doubling on\n * each attempt, for a maximum of 3 retries. Errors with any other tag are\n * re-raised immediately without retrying.\n *\n * The predicate used for the `while` condition is\n * `Predicate.isTagged(\"RateLimitError\")`, so only errors whose `_tag` field\n * equals `\"RateLimitError\"` trigger a retry; all other error types propagate\n * unchanged.\n *\n * @see {@link RateLimitError}\n *\n * @internal\n */\nexport const retryOnRateLimit = <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> =>\n\teffect.pipe(\n\t\tEffect.retry({\n\t\t\tschedule: Schedule.exponential(\"1 second\").pipe(Schedule.compose(Schedule.recurs(3))),\n\t\t\twhile: Predicate.isTagged(\"RateLimitError\"),\n\t\t}),\n\t);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAmBA,MAAa,oBAA6B,WACzC,OAAO,KACN,OAAO,MAAM;CACZ,UAAU,SAAS,YAAY,UAAU,CAAC,CAAC,KAAK,SAAS,QAAQ,SAAS,OAAO,CAAC,CAAC,CAAC;CACpF,OAAO,UAAU,SAAS,gBAAgB;AAC3C,CAAC,CACF"}
package/lib/semver.js ADDED
@@ -0,0 +1,22 @@
1
+ import { Effect, Option } from "effect";
2
+ import { SemVer } from "semver-effect";
3
+
4
+ //#region src/lib/semver.ts
5
+ /**
6
+ * Attempts to parse a raw version string into a {@link SemVer}, returning
7
+ * `Option.none()` when the string is not a valid semver value.
8
+ *
9
+ * Unlike `SemVer.parse` — which fails the effect on an unparseable input —
10
+ * this helper absorbs parse failures and promotes them into the `Option` channel
11
+ * so that callers can handle invalid versions without short-circuiting the
12
+ * surrounding effect pipeline.
13
+ *
14
+ * @see {@link SemVer.parse}
15
+ *
16
+ * @internal
17
+ */
18
+ const tryParseSemVer = (raw) => SemVer.parse(raw).pipe(Effect.map(Option.some), Effect.catchAll(() => Effect.succeed(Option.none())));
19
+
20
+ //#endregion
21
+ export { tryParseSemVer };
22
+ //# sourceMappingURL=semver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"semver.js","names":[],"sources":["../../../../src/lib/semver.ts"],"sourcesContent":["import { Effect, Option } from \"effect\";\nimport { SemVer } from \"semver-effect\";\n\n/**\n * Attempts to parse a raw version string into a {@link SemVer}, returning\n * `Option.none()` when the string is not a valid semver value.\n *\n * Unlike `SemVer.parse` — which fails the effect on an unparseable input —\n * this helper absorbs parse failures and promotes them into the `Option` channel\n * so that callers can handle invalid versions without short-circuiting the\n * surrounding effect pipeline.\n *\n * @see {@link SemVer.parse}\n *\n * @internal\n */\nexport const tryParseSemVer = (raw: string): Effect.Effect<Option.Option<SemVer>> =>\n\tSemVer.parse(raw).pipe(\n\t\tEffect.map(Option.some),\n\t\tEffect.catchAll(() => Effect.succeed(Option.none())),\n\t);\n"],"mappings":";;;;;;;;;;;;;;;;;AAgBA,MAAa,kBAAkB,QAC9B,OAAO,MAAM,GAAG,CAAC,CAAC,KACjB,OAAO,IAAI,OAAO,IAAI,GACtB,OAAO,eAAe,OAAO,QAAQ,OAAO,KAAK,CAAC,CAAC,CACpD"}
package/package.json CHANGED
@@ -1,70 +1,59 @@
1
1
  {
2
- "name": "runtime-resolver",
3
- "version": "0.3.12",
4
- "private": false,
5
- "description": "Resolve semver-compatible versions of Node.js, Bun, and Deno runtimes with Effect-based architecture and offline fallback.",
6
- "keywords": [
7
- "node",
8
- "bun",
9
- "deno",
10
- "runtime",
11
- "version",
12
- "semver",
13
- "resolver",
14
- "ci",
15
- "github-actions",
16
- "effect",
17
- "cli"
18
- ],
19
- "homepage": "https://github.com/spencerbeggs/runtime-resolver#readme",
20
- "bugs": {
21
- "url": "https://github.com/spencerbeggs/runtime-resolver/issues"
22
- },
23
- "repository": {
24
- "type": "git",
25
- "url": "git+https://github.com/spencerbeggs/runtime-resolver.git"
26
- },
27
- "license": "MIT",
28
- "author": {
29
- "name": "C. Spencer Beggs",
30
- "email": "spencer@beggs.codes",
31
- "url": "https://spencerbeg.gs"
32
- },
33
- "sideEffects": false,
34
- "type": "module",
35
- "exports": {
36
- ".": {
37
- "types": "./index.d.ts",
38
- "import": "./index.js"
39
- }
40
- },
41
- "bin": {
42
- "runtime-resolver": "bin/runtime-resolver.js"
43
- },
44
- "dependencies": {
45
- "@octokit/auth-app": "^8.2.0",
46
- "octokit": "^5.0.5",
47
- "semver-effect": "^0.2.1"
48
- },
49
- "peerDependencies": {
50
- "@effect/cli": ">=0.75.1",
51
- "@effect/platform": ">=0.96.0",
52
- "@effect/platform-node": ">=0.106.0",
53
- "effect": ">=3.21.0"
54
- },
55
- "files": [
56
- "!runtime-resolver.api.json",
57
- "!tsconfig.json",
58
- "!tsdoc.json",
59
- "612.js",
60
- "711.js",
61
- "LICENSE",
62
- "README.md",
63
- "bin/runtime-resolver.js",
64
- "index.d.ts",
65
- "index.js",
66
- "json-schema.js",
67
- "package.json",
68
- "tsdoc-metadata.json"
69
- ]
2
+ "name": "runtime-resolver",
3
+ "version": "0.3.13",
4
+ "private": false,
5
+ "description": "Resolve semver-compatible versions of Node.js, Bun, and Deno runtimes with Effect-based architecture and offline fallback.",
6
+ "keywords": [
7
+ "node",
8
+ "bun",
9
+ "deno",
10
+ "runtime",
11
+ "version",
12
+ "semver",
13
+ "resolver",
14
+ "ci",
15
+ "github-actions",
16
+ "effect",
17
+ "cli"
18
+ ],
19
+ "homepage": "https://github.com/spencerbeggs/runtime-resolver#readme",
20
+ "bugs": {
21
+ "url": "https://github.com/spencerbeggs/runtime-resolver/issues"
22
+ },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/spencerbeggs/runtime-resolver.git"
26
+ },
27
+ "license": "MIT",
28
+ "author": {
29
+ "name": "C. Spencer Beggs",
30
+ "email": "spencer@beggs.codes",
31
+ "url": "https://spencerbeg.gs"
32
+ },
33
+ "sideEffects": false,
34
+ "type": "module",
35
+ "exports": {
36
+ ".": {
37
+ "types": "./index.d.ts",
38
+ "import": "./index.js"
39
+ },
40
+ "./package.json": "./package.json"
41
+ },
42
+ "bin": {
43
+ "runtime-resolver": "bin/runtime-resolver.js"
44
+ },
45
+ "dependencies": {
46
+ "@octokit/auth-app": "^8.2.0",
47
+ "octokit": "^5.0.5",
48
+ "semver-effect": "^0.2.1"
49
+ },
50
+ "peerDependencies": {
51
+ "@effect/cli": "catalog:silkPeers",
52
+ "@effect/platform": "catalog:silkPeers",
53
+ "@effect/platform-node": "catalog:silkPeers",
54
+ "effect": "catalog:silkPeers"
55
+ },
56
+ "engines": {
57
+ "node": ">=24.11.0"
58
+ }
70
59
  }
@@ -0,0 +1,62 @@
1
+ import { Data, DateTime, Effect } from "effect";
2
+ import { SemVer } from "semver-effect";
3
+
4
+ //#region src/schemas/bun-release.ts
5
+ /**
6
+ * A Bun release entry with a parsed {@link SemVer} version and an
7
+ * Effect {@link DateTime.DateTime} publication date.
8
+ *
9
+ * `BunRelease` extends `Data.TaggedClass` so instances support structural
10
+ * equality comparison and can be used safely inside Effect data structures.
11
+ * Construct instances via the {@link BunRelease.fromInput} factory rather than
12
+ * calling `new BunRelease(...)` directly, as the factory validates the version
13
+ * string through `SemVer.parse`.
14
+ *
15
+ * @see {@link BunReleaseCache}
16
+ * @see {@link BunResolver}
17
+ * @see {@link RuntimeReleaseInput}
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * import { Effect } from "effect";
22
+ * import type { BunRelease } from "./bun-release.js";
23
+ * import { BunRelease as BunReleaseClass } from "./bun-release.js";
24
+ *
25
+ * const program = BunReleaseClass.fromInput({ version: "1.1.0", date: "2024-03-01" }).pipe(
26
+ * Effect.map((release: BunRelease) => {
27
+ * console.log(release.version.major); // 1
28
+ * console.log(release.version.minor); // 1
29
+ * console.log(release._tag); // "BunRelease"
30
+ * }),
31
+ * );
32
+ *
33
+ * Effect.runPromise(program);
34
+ * ```
35
+ *
36
+ * @public
37
+ */
38
+ var BunRelease = class BunRelease extends Data.TaggedClass("BunRelease") {
39
+ /**
40
+ * Create a {@link BunRelease} from lean string inputs.
41
+ *
42
+ * Parses `input.version` via `SemVer.parse` and constructs the
43
+ * publication date with `DateTime.unsafeMake`. Falls back to the current
44
+ * timestamp when `input.date` is an empty string (rare in production data).
45
+ *
46
+ * @param input - A {@link RuntimeReleaseInput} object with raw string fields.
47
+ * @returns An `Effect` that succeeds with a `BunRelease` or fails with an
48
+ * `InvalidVersionError` when the version string cannot be parsed.
49
+ */
50
+ static fromInput(input) {
51
+ return Effect.gen(function* () {
52
+ return new BunRelease({
53
+ version: yield* SemVer.parse(input.version),
54
+ date: input.date ? DateTime.unsafeMake(input.date) : DateTime.unsafeMake(/* @__PURE__ */ new Date())
55
+ });
56
+ });
57
+ }
58
+ };
59
+
60
+ //#endregion
61
+ export { BunRelease };
62
+ //# sourceMappingURL=bun-release.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bun-release.js","names":[],"sources":["../../../../src/schemas/bun-release.ts"],"sourcesContent":["import { Data, DateTime, Effect } from \"effect\";\nimport type { InvalidVersionError } from \"semver-effect\";\nimport { SemVer } from \"semver-effect\";\nimport type { RuntimeReleaseInput } from \"./runtime-release.js\";\n\n/**\n * A Bun release entry with a parsed {@link SemVer} version and an\n * Effect {@link DateTime.DateTime} publication date.\n *\n * `BunRelease` extends `Data.TaggedClass` so instances support structural\n * equality comparison and can be used safely inside Effect data structures.\n * Construct instances via the {@link BunRelease.fromInput} factory rather than\n * calling `new BunRelease(...)` directly, as the factory validates the version\n * string through `SemVer.parse`.\n *\n * @see {@link BunReleaseCache}\n * @see {@link BunResolver}\n * @see {@link RuntimeReleaseInput}\n *\n * @example\n * ```typescript\n * import { Effect } from \"effect\";\n * import type { BunRelease } from \"./bun-release.js\";\n * import { BunRelease as BunReleaseClass } from \"./bun-release.js\";\n *\n * const program = BunReleaseClass.fromInput({ version: \"1.1.0\", date: \"2024-03-01\" }).pipe(\n * Effect.map((release: BunRelease) => {\n * console.log(release.version.major); // 1\n * console.log(release.version.minor); // 1\n * console.log(release._tag); // \"BunRelease\"\n * }),\n * );\n *\n * Effect.runPromise(program);\n * ```\n *\n * @public\n */\nexport class BunRelease extends Data.TaggedClass(\"BunRelease\")<{\n\treadonly version: SemVer;\n\treadonly date: DateTime.DateTime;\n}> {\n\t/**\n\t * Create a {@link BunRelease} from lean string inputs.\n\t *\n\t * Parses `input.version` via `SemVer.parse` and constructs the\n\t * publication date with `DateTime.unsafeMake`. Falls back to the current\n\t * timestamp when `input.date` is an empty string (rare in production data).\n\t *\n\t * @param input - A {@link RuntimeReleaseInput} object with raw string fields.\n\t * @returns An `Effect` that succeeds with a `BunRelease` or fails with an\n\t * `InvalidVersionError` when the version string cannot be parsed.\n\t */\n\tstatic fromInput(input: RuntimeReleaseInput): Effect.Effect<BunRelease, InvalidVersionError> {\n\t\treturn Effect.gen(function* () {\n\t\t\tconst version = yield* SemVer.parse(input.version);\n\t\t\t// Fall back to current time if published_at is null (rare).\n\t\t\tconst date = input.date ? DateTime.unsafeMake(input.date) : DateTime.unsafeMake(new Date());\n\t\t\treturn new BunRelease({ version, date });\n\t\t});\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,IAAa,aAAb,MAAa,mBAAmB,KAAK,YAAY,YAAY,CAAC,CAG3D;;;;;;;;;;;;CAYF,OAAO,UAAU,OAA4E;EAC5F,OAAO,OAAO,IAAI,aAAa;GAI9B,OAAO,IAAI,WAAW;IAAE,gBAHD,OAAO,MAAM,MAAM,OAAO;IAGhB,MADpB,MAAM,OAAO,SAAS,WAAW,MAAM,IAAI,IAAI,SAAS,2BAAW,IAAI,KAAK,CAAC;GACpD,CAAC;EACxC,CAAC;CACF;AACD"}
@@ -0,0 +1,62 @@
1
+ import { Data, DateTime, Effect } from "effect";
2
+ import { SemVer } from "semver-effect";
3
+
4
+ //#region src/schemas/deno-release.ts
5
+ /**
6
+ * A Deno release entry with a parsed {@link SemVer} version and an
7
+ * Effect {@link DateTime.DateTime} publication date.
8
+ *
9
+ * `DenoRelease` extends `Data.TaggedClass` so instances support structural
10
+ * equality comparison and can be used safely inside Effect data structures.
11
+ * Construct instances via the {@link DenoRelease.fromInput} factory rather than
12
+ * calling `new DenoRelease(...)` directly, as the factory validates the version
13
+ * string through `SemVer.parse`.
14
+ *
15
+ * @see {@link DenoReleaseCache}
16
+ * @see {@link DenoResolver}
17
+ * @see {@link RuntimeReleaseInput}
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * import { Effect } from "effect";
22
+ * import type { DenoRelease } from "./deno-release.js";
23
+ * import { DenoRelease as DenoReleaseClass } from "./deno-release.js";
24
+ *
25
+ * const program = DenoReleaseClass.fromInput({ version: "1.44.0", date: "2024-05-23" }).pipe(
26
+ * Effect.map((release: DenoRelease) => {
27
+ * console.log(release.version.major); // 1
28
+ * console.log(release.version.minor); // 44
29
+ * console.log(release._tag); // "DenoRelease"
30
+ * }),
31
+ * );
32
+ *
33
+ * Effect.runPromise(program);
34
+ * ```
35
+ *
36
+ * @public
37
+ */
38
+ var DenoRelease = class DenoRelease extends Data.TaggedClass("DenoRelease") {
39
+ /**
40
+ * Create a {@link DenoRelease} from lean string inputs.
41
+ *
42
+ * Parses `input.version` via `SemVer.parse` and constructs the
43
+ * publication date with `DateTime.unsafeMake`. Falls back to the current
44
+ * timestamp when `input.date` is an empty string (rare in production data).
45
+ *
46
+ * @param input - A {@link RuntimeReleaseInput} object with raw string fields.
47
+ * @returns An `Effect` that succeeds with a `DenoRelease` or fails with an
48
+ * `InvalidVersionError` when the version string cannot be parsed.
49
+ */
50
+ static fromInput(input) {
51
+ return Effect.gen(function* () {
52
+ return new DenoRelease({
53
+ version: yield* SemVer.parse(input.version),
54
+ date: input.date ? DateTime.unsafeMake(input.date) : DateTime.unsafeMake(/* @__PURE__ */ new Date())
55
+ });
56
+ });
57
+ }
58
+ };
59
+
60
+ //#endregion
61
+ export { DenoRelease };
62
+ //# sourceMappingURL=deno-release.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deno-release.js","names":[],"sources":["../../../../src/schemas/deno-release.ts"],"sourcesContent":["import { Data, DateTime, Effect } from \"effect\";\nimport type { InvalidVersionError } from \"semver-effect\";\nimport { SemVer } from \"semver-effect\";\nimport type { RuntimeReleaseInput } from \"./runtime-release.js\";\n\n/**\n * A Deno release entry with a parsed {@link SemVer} version and an\n * Effect {@link DateTime.DateTime} publication date.\n *\n * `DenoRelease` extends `Data.TaggedClass` so instances support structural\n * equality comparison and can be used safely inside Effect data structures.\n * Construct instances via the {@link DenoRelease.fromInput} factory rather than\n * calling `new DenoRelease(...)` directly, as the factory validates the version\n * string through `SemVer.parse`.\n *\n * @see {@link DenoReleaseCache}\n * @see {@link DenoResolver}\n * @see {@link RuntimeReleaseInput}\n *\n * @example\n * ```typescript\n * import { Effect } from \"effect\";\n * import type { DenoRelease } from \"./deno-release.js\";\n * import { DenoRelease as DenoReleaseClass } from \"./deno-release.js\";\n *\n * const program = DenoReleaseClass.fromInput({ version: \"1.44.0\", date: \"2024-05-23\" }).pipe(\n * Effect.map((release: DenoRelease) => {\n * console.log(release.version.major); // 1\n * console.log(release.version.minor); // 44\n * console.log(release._tag); // \"DenoRelease\"\n * }),\n * );\n *\n * Effect.runPromise(program);\n * ```\n *\n * @public\n */\nexport class DenoRelease extends Data.TaggedClass(\"DenoRelease\")<{\n\treadonly version: SemVer;\n\treadonly date: DateTime.DateTime;\n}> {\n\t/**\n\t * Create a {@link DenoRelease} from lean string inputs.\n\t *\n\t * Parses `input.version` via `SemVer.parse` and constructs the\n\t * publication date with `DateTime.unsafeMake`. Falls back to the current\n\t * timestamp when `input.date` is an empty string (rare in production data).\n\t *\n\t * @param input - A {@link RuntimeReleaseInput} object with raw string fields.\n\t * @returns An `Effect` that succeeds with a `DenoRelease` or fails with an\n\t * `InvalidVersionError` when the version string cannot be parsed.\n\t */\n\tstatic fromInput(input: RuntimeReleaseInput): Effect.Effect<DenoRelease, InvalidVersionError> {\n\t\treturn Effect.gen(function* () {\n\t\t\tconst version = yield* SemVer.parse(input.version);\n\t\t\t// Fall back to current time if published_at is null (rare).\n\t\t\tconst date = input.date ? DateTime.unsafeMake(input.date) : DateTime.unsafeMake(new Date());\n\t\t\treturn new DenoRelease({ version, date });\n\t\t});\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,IAAa,cAAb,MAAa,oBAAoB,KAAK,YAAY,aAAa,CAAC,CAG7D;;;;;;;;;;;;CAYF,OAAO,UAAU,OAA6E;EAC7F,OAAO,OAAO,IAAI,aAAa;GAI9B,OAAO,IAAI,YAAY;IAAE,gBAHF,OAAO,MAAM,MAAM,OAAO;IAGf,MADrB,MAAM,OAAO,SAAS,WAAW,MAAM,IAAI,IAAI,SAAS,2BAAW,IAAI,KAAK,CAAC;GACnD,CAAC;EACzC,CAAC;CACF;AACD"}