@interfere/next 0.1.0-alpha.9 → 0.2.0-alpha.4

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 (242) hide show
  1. package/README.md +70 -277
  2. package/dist/_virtual/_rolldown/runtime.mjs +13 -0
  3. package/dist/config.d.mts +11 -0
  4. package/dist/config.d.mts.map +1 -0
  5. package/dist/config.mjs +107 -0
  6. package/dist/config.mjs.map +1 -0
  7. package/dist/instrument-client.d.mts +2 -0
  8. package/dist/instrument-client.mjs +2 -0
  9. package/dist/internal/build/configure-build.d.mts +22 -0
  10. package/dist/internal/build/configure-build.d.mts.map +1 -0
  11. package/dist/internal/build/configure-build.mjs +87 -0
  12. package/dist/internal/build/configure-build.mjs.map +1 -0
  13. package/dist/internal/build/injected.d.mts +12 -0
  14. package/dist/internal/build/injected.d.mts.map +1 -0
  15. package/dist/internal/build/injected.mjs +9 -0
  16. package/dist/internal/build/injected.mjs.map +1 -0
  17. package/dist/internal/build/release/destinations/vercel.d.mts +6 -0
  18. package/dist/internal/build/release/destinations/vercel.d.mts.map +1 -0
  19. package/dist/internal/build/release/destinations/vercel.mjs +25 -0
  20. package/dist/internal/build/release/destinations/vercel.mjs.map +1 -0
  21. package/dist/internal/build/release/git.d.mts +4 -0
  22. package/dist/internal/build/release/git.d.mts.map +1 -0
  23. package/dist/internal/build/release/git.mjs +21 -0
  24. package/dist/internal/build/release/git.mjs.map +1 -0
  25. package/dist/internal/build/release/index.d.mts +7 -0
  26. package/dist/internal/build/release/index.d.mts.map +1 -0
  27. package/dist/internal/build/release/index.mjs +24 -0
  28. package/dist/internal/build/release/index.mjs.map +1 -0
  29. package/dist/internal/build/release/sources/github.d.mts +6 -0
  30. package/dist/internal/build/release/sources/github.d.mts.map +1 -0
  31. package/dist/internal/build/release/sources/github.mjs +15 -0
  32. package/dist/internal/build/release/sources/github.mjs.map +1 -0
  33. package/dist/internal/build/release/types.d.mts +11 -0
  34. package/dist/internal/build/release/types.d.mts.map +1 -0
  35. package/dist/internal/build/release/types.mjs +1 -0
  36. package/dist/internal/build/source-maps/discover.d.mts +14 -0
  37. package/dist/internal/build/source-maps/discover.d.mts.map +1 -0
  38. package/dist/internal/build/source-maps/discover.mjs +61 -0
  39. package/dist/internal/build/source-maps/discover.mjs.map +1 -0
  40. package/dist/internal/build/source-maps/index.d.mts +23 -0
  41. package/dist/internal/build/source-maps/index.d.mts.map +1 -0
  42. package/dist/internal/build/source-maps/index.mjs +33 -0
  43. package/dist/internal/build/source-maps/index.mjs.map +1 -0
  44. package/dist/internal/build/value-injection-loader.d.mts +10 -0
  45. package/dist/internal/build/value-injection-loader.d.mts.map +1 -0
  46. package/dist/internal/build/value-injection-loader.mjs +24 -0
  47. package/dist/internal/build/value-injection-loader.mjs.map +1 -0
  48. package/dist/internal/env.d.mts +16 -0
  49. package/dist/internal/env.d.mts.map +1 -0
  50. package/dist/internal/env.mjs +19 -0
  51. package/dist/internal/env.mjs.map +1 -0
  52. package/dist/internal/logger.d.mts +8 -0
  53. package/dist/internal/logger.d.mts.map +1 -0
  54. package/dist/internal/logger.mjs +44 -0
  55. package/dist/internal/logger.mjs.map +1 -0
  56. package/dist/internal/route/cors.d.mts +4 -0
  57. package/dist/internal/route/cors.d.mts.map +1 -0
  58. package/dist/internal/route/cors.mjs +15 -0
  59. package/dist/internal/route/cors.mjs.map +1 -0
  60. package/dist/internal/route/handle-get.d.mts +4 -0
  61. package/dist/internal/route/handle-get.d.mts.map +1 -0
  62. package/dist/internal/route/handle-get.mjs +15 -0
  63. package/dist/internal/route/handle-get.mjs.map +1 -0
  64. package/dist/internal/route/handle-post.d.mts +4 -0
  65. package/dist/internal/route/handle-post.d.mts.map +1 -0
  66. package/dist/internal/route/handle-post.mjs +105 -0
  67. package/dist/internal/route/handle-post.mjs.map +1 -0
  68. package/dist/internal/route/sw-script.d.mts +4 -0
  69. package/dist/internal/route/sw-script.d.mts.map +1 -0
  70. package/dist/internal/route/sw-script.mjs +32 -0
  71. package/dist/internal/route/sw-script.mjs.map +1 -0
  72. package/dist/internal/server/capture.d.mts +9 -0
  73. package/dist/internal/server/capture.d.mts.map +1 -0
  74. package/dist/internal/server/capture.mjs +46 -0
  75. package/dist/internal/server/capture.mjs.map +1 -0
  76. package/dist/internal/server/dedupe.d.mts +5 -0
  77. package/dist/internal/server/dedupe.d.mts.map +1 -0
  78. package/dist/internal/server/dedupe.mjs +11 -0
  79. package/dist/internal/server/dedupe.mjs.map +1 -0
  80. package/dist/internal/server/envelope.d.mts +14 -0
  81. package/dist/internal/server/envelope.d.mts.map +1 -0
  82. package/dist/internal/server/envelope.mjs +41 -0
  83. package/dist/internal/server/envelope.mjs.map +1 -0
  84. package/dist/internal/server/mechanisms.d.mts +7 -0
  85. package/dist/internal/server/mechanisms.d.mts.map +1 -0
  86. package/dist/internal/server/mechanisms.mjs +12 -0
  87. package/dist/internal/server/mechanisms.mjs.map +1 -0
  88. package/dist/internal/server/normalize-request.d.mts +7 -0
  89. package/dist/internal/server/normalize-request.d.mts.map +1 -0
  90. package/dist/internal/server/normalize-request.mjs +50 -0
  91. package/dist/internal/server/normalize-request.mjs.map +1 -0
  92. package/dist/internal/server/runtime.d.mts +14 -0
  93. package/dist/internal/server/runtime.d.mts.map +1 -0
  94. package/dist/internal/server/runtime.mjs +18 -0
  95. package/dist/internal/server/runtime.mjs.map +1 -0
  96. package/dist/internal/server/session.d.mts +11 -0
  97. package/dist/internal/server/session.d.mts.map +1 -0
  98. package/dist/internal/server/session.mjs +15 -0
  99. package/dist/internal/server/session.mjs.map +1 -0
  100. package/dist/internal/server/transport.d.mts +12 -0
  101. package/dist/internal/server/transport.d.mts.map +1 -0
  102. package/dist/internal/server/transport.mjs +17 -0
  103. package/dist/internal/server/transport.mjs.map +1 -0
  104. package/dist/internal/server/types.d.mts +17 -0
  105. package/dist/internal/server/types.d.mts.map +1 -0
  106. package/dist/internal/server/types.mjs +1 -0
  107. package/dist/provider.d.mts +2 -0
  108. package/dist/provider.mjs +3 -0
  109. package/dist/route-handler.d.mts +7 -0
  110. package/dist/route-handler.d.mts.map +1 -0
  111. package/dist/route-handler.mjs +18 -0
  112. package/dist/route-handler.mjs.map +1 -0
  113. package/dist/server.d.mts +8 -0
  114. package/dist/server.d.mts.map +1 -0
  115. package/dist/server.mjs +6 -0
  116. package/dist/server.mjs.map +1 -0
  117. package/package.json +60 -73
  118. package/LICENSE +0 -21
  119. package/dist/build/env-config.d.mts +0 -7
  120. package/dist/build/env-config.d.mts.map +0 -1
  121. package/dist/build/env-config.mjs +0 -17
  122. package/dist/build/env-config.mjs.map +0 -1
  123. package/dist/build/loaders/value-injection-loader.d.mts +0 -28
  124. package/dist/build/loaders/value-injection-loader.d.mts.map +0 -1
  125. package/dist/build/loaders/value-injection-loader.mjs +0 -44
  126. package/dist/build/loaders/value-injection-loader.mjs.map +0 -1
  127. package/dist/build/logger.d.mts +0 -11
  128. package/dist/build/logger.d.mts.map +0 -1
  129. package/dist/build/logger.mjs +0 -155
  130. package/dist/build/logger.mjs.map +0 -1
  131. package/dist/build/release-program.d.mts +0 -19
  132. package/dist/build/release-program.d.mts.map +0 -1
  133. package/dist/build/release-program.mjs +0 -92
  134. package/dist/build/release-program.mjs.map +0 -1
  135. package/dist/build/secret-key.d.mts +0 -10
  136. package/dist/build/secret-key.d.mts.map +0 -1
  137. package/dist/build/secret-key.mjs +0 -16
  138. package/dist/build/secret-key.mjs.map +0 -1
  139. package/dist/build/services/config.service.d.mts +0 -9
  140. package/dist/build/services/config.service.d.mts.map +0 -1
  141. package/dist/build/services/config.service.mjs +0 -8
  142. package/dist/build/services/config.service.mjs.map +0 -1
  143. package/dist/build/services/instrumentation-detection.service.d.mts +0 -22
  144. package/dist/build/services/instrumentation-detection.service.d.mts.map +0 -1
  145. package/dist/build/services/instrumentation-detection.service.mjs +0 -60
  146. package/dist/build/services/instrumentation-detection.service.mjs.map +0 -1
  147. package/dist/build/services/preflight.service.d.mts +0 -19
  148. package/dist/build/services/preflight.service.d.mts.map +0 -1
  149. package/dist/build/services/preflight.service.mjs +0 -76
  150. package/dist/build/services/preflight.service.mjs.map +0 -1
  151. package/dist/build/services/release-identity.service.d.mts +0 -22
  152. package/dist/build/services/release-identity.service.d.mts.map +0 -1
  153. package/dist/build/services/release-identity.service.mjs +0 -48
  154. package/dist/build/services/release-identity.service.mjs.map +0 -1
  155. package/dist/build/services/source-map.service.d.mts +0 -24
  156. package/dist/build/services/source-map.service.d.mts.map +0 -1
  157. package/dist/build/services/source-map.service.mjs +0 -58
  158. package/dist/build/services/source-map.service.mjs.map +0 -1
  159. package/dist/build/source-maps/api.d.mts +0 -35
  160. package/dist/build/source-maps/api.d.mts.map +0 -1
  161. package/dist/build/source-maps/api.mjs +0 -61
  162. package/dist/build/source-maps/api.mjs.map +0 -1
  163. package/dist/build/source-maps/client.d.mts +0 -73
  164. package/dist/build/source-maps/client.d.mts.map +0 -1
  165. package/dist/build/source-maps/client.mjs +0 -228
  166. package/dist/build/source-maps/client.mjs.map +0 -1
  167. package/dist/build/source-maps/errors.d.mts +0 -109
  168. package/dist/build/source-maps/errors.d.mts.map +0 -1
  169. package/dist/build/source-maps/errors.mjs +0 -22
  170. package/dist/build/source-maps/errors.mjs.map +0 -1
  171. package/dist/build/source-maps/files.d.mts +0 -35
  172. package/dist/build/source-maps/files.d.mts.map +0 -1
  173. package/dist/build/source-maps/files.mjs +0 -222
  174. package/dist/build/source-maps/files.mjs.map +0 -1
  175. package/dist/build/source-maps/providers/deployment/detector.d.mts +0 -26
  176. package/dist/build/source-maps/providers/deployment/detector.d.mts.map +0 -1
  177. package/dist/build/source-maps/providers/deployment/detector.mjs +0 -22
  178. package/dist/build/source-maps/providers/deployment/detector.mjs.map +0 -1
  179. package/dist/build/source-maps/providers/deployment/types.d.mts +0 -12
  180. package/dist/build/source-maps/providers/deployment/types.d.mts.map +0 -1
  181. package/dist/build/source-maps/providers/deployment/types.mjs +0 -3
  182. package/dist/build/source-maps/providers/deployment/vercel.d.mts +0 -6
  183. package/dist/build/source-maps/providers/deployment/vercel.d.mts.map +0 -1
  184. package/dist/build/source-maps/providers/deployment/vercel.mjs +0 -44
  185. package/dist/build/source-maps/providers/deployment/vercel.mjs.map +0 -1
  186. package/dist/build/source-maps/providers/source-control/detector.d.mts +0 -15
  187. package/dist/build/source-maps/providers/source-control/detector.d.mts.map +0 -1
  188. package/dist/build/source-maps/providers/source-control/detector.mjs +0 -22
  189. package/dist/build/source-maps/providers/source-control/detector.mjs.map +0 -1
  190. package/dist/build/source-maps/providers/source-control/git.d.mts +0 -6
  191. package/dist/build/source-maps/providers/source-control/git.d.mts.map +0 -1
  192. package/dist/build/source-maps/providers/source-control/git.mjs +0 -50
  193. package/dist/build/source-maps/providers/source-control/git.mjs.map +0 -1
  194. package/dist/build/source-maps/providers/source-control/types.d.mts +0 -12
  195. package/dist/build/source-maps/providers/source-control/types.d.mts.map +0 -1
  196. package/dist/build/source-maps/providers/source-control/types.mjs +0 -3
  197. package/dist/build/with-interfere.d.mts +0 -70
  198. package/dist/build/with-interfere.d.mts.map +0 -1
  199. package/dist/build/with-interfere.mjs +0 -154
  200. package/dist/build/with-interfere.mjs.map +0 -1
  201. package/dist/client/auto-init.d.mts +0 -92
  202. package/dist/client/auto-init.d.mts.map +0 -1
  203. package/dist/client/auto-init.mjs +0 -121
  204. package/dist/client/auto-init.mjs.map +0 -1
  205. package/dist/client/client.d.mts +0 -3
  206. package/dist/client/client.mjs +0 -5
  207. package/dist/client/provider.d.mts +0 -22
  208. package/dist/client/provider.d.mts.map +0 -1
  209. package/dist/client/provider.mjs +0 -50
  210. package/dist/client/provider.mjs.map +0 -1
  211. package/dist/lib/env.d.mts +0 -12
  212. package/dist/lib/env.d.mts.map +0 -1
  213. package/dist/lib/env.mjs +0 -17
  214. package/dist/lib/env.mjs.map +0 -1
  215. package/dist/lib/test-utils/make-next-request.d.mts +0 -6
  216. package/dist/lib/test-utils/make-next-request.d.mts.map +0 -1
  217. package/dist/lib/test-utils/make-next-request.mjs +0 -12
  218. package/dist/lib/test-utils/make-next-request.mjs.map +0 -1
  219. package/dist/lib/types.d.mts +0 -22
  220. package/dist/lib/types.d.mts.map +0 -1
  221. package/dist/lib/types.mjs +0 -7
  222. package/dist/lib/types.mjs.map +0 -1
  223. package/dist/server/middleware.d.mts +0 -11
  224. package/dist/server/middleware.d.mts.map +0 -1
  225. package/dist/server/middleware.mjs +0 -85
  226. package/dist/server/middleware.mjs.map +0 -1
  227. package/dist/server/proxy.d.mts +0 -6
  228. package/dist/server/proxy.d.mts.map +0 -1
  229. package/dist/server/proxy.mjs +0 -30
  230. package/dist/server/proxy.mjs.map +0 -1
  231. package/dist/server/route-handler.d.mts +0 -9
  232. package/dist/server/route-handler.d.mts.map +0 -1
  233. package/dist/server/route-handler.mjs +0 -172
  234. package/dist/server/route-handler.mjs.map +0 -1
  235. package/dist/server/services/config.service.d.mts +0 -21
  236. package/dist/server/services/config.service.d.mts.map +0 -1
  237. package/dist/server/services/config.service.mjs +0 -43
  238. package/dist/server/services/config.service.mjs.map +0 -1
  239. package/dist/server/services/error-tracking.service.d.mts +0 -19
  240. package/dist/server/services/error-tracking.service.d.mts.map +0 -1
  241. package/dist/server/services/error-tracking.service.mjs +0 -31
  242. package/dist/server/services/error-tracking.service.mjs.map +0 -1
@@ -1,35 +0,0 @@
1
- import { PreflightConfig } from "../../lib/types.mjs";
2
- import { InvalidApiUrlError, InvalidSecretKeyError, NotificationError, TokenRequestError, UploadError } from "./errors.mjs";
3
- import { UploadMeta } from "../services/source-map.service.mjs";
4
- import { Effect } from "effect";
5
- import { ReleaseDestinationMetadata, ReleaseDestinationType, ReleaseSourceMetadata, ReleaseSourceType } from "@interfere/types/releases/definition";
6
- import { UploadedSourceMap } from "@interfere/types/data/source-maps";
7
-
8
- //#region src/build/source-maps/api.d.ts
9
- type ReleaseInfo = {
10
- environment: string;
11
- sourceId: string;
12
- sourceType: ReleaseSourceType;
13
- sourceMetadata: ReleaseSourceMetadata;
14
- destinationType: ReleaseDestinationType;
15
- destinationMetadata: ReleaseDestinationMetadata;
16
- };
17
- declare function createRelease(config: PreflightConfig, releaseInfo: ReleaseInfo): Effect.Effect<{
18
- orgId: string;
19
- surfaceId: number;
20
- surfaceSlug: string;
21
- sourceId: string;
22
- environment: string;
23
- releaseId: number;
24
- releaseSlug: string;
25
- }, InvalidSecretKeyError | UploadError | InvalidApiUrlError, never>;
26
- /**
27
- * Upload source maps using the new v2 client
28
- * @param sourceMapToGenerated - Mapping from source map filename to generated JS file path
29
- */
30
- declare function uploadSourceMaps(sourceMaps: UploadedSourceMap[], sourceMapToGenerated: Record<string, string>, config: PreflightConfig, meta: UploadMeta): Effect.Effect<{
31
- uploaded: number;
32
- processed: any;
33
- }, UploadError | TokenRequestError | NotificationError, never>;
34
- //#endregion
35
- export { createRelease, uploadSourceMaps };
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.d.mts","names":[],"sources":["../../../src/build/source-maps/api.ts"],"sourcesContent":[],"mappings":";;;;;;;;KAyBK,WAAA;;EAAA,QAAA,EAAA,MAAW;EAGF,UAAA,EAAA,iBAAA;EACI,cAAA,EAAA,qBAAA;EACC,eAAA,EAAA,sBAAA;EACI,mBAAA,EAAA,0BAAA;CAA0B;AA4FjC,iBAAA,aAAA,CAAa,MAAA,EACnB,eADmB,EAAA,WAAA,EAEd,WAFc,CAAA,EAEH,MAAA,CAAA,MAFG,CAAA;EACnB,KAAA,EAAA,MAAA;EACK,SAAA,EAAA,MAAA;;;;EAAW,SAAA,EAAA,MAAA;EAAA,WAAA,EAAA,MAAA;AAmB1B,CAAA,uBAAgC,cAAA,qBAAA,EAAA,KAAA,CAAA;;;;;iBAAhB,gBAAA,aACF,2CACU,gCACd,uBACF,aAAU,MAAA,CAAA;;;CAAA,aAAA,wCAAA,EAAA,KAAA,CAAA"}
@@ -1,61 +0,0 @@
1
- import { resolveApiUrl } from "../env-config.mjs";
2
- import { InvalidApiUrlError, InvalidSecretKeyError, UploadError } from "./errors.mjs";
3
- import { SourceMapClient } from "./client.mjs";
4
- import { Duration, Effect, pipe } from "effect";
5
- import { createReleaseResponseSchema } from "@interfere/types/releases/definition";
6
-
7
- //#region src/build/source-maps/api.ts
8
- const API_TIMEOUT = Duration.seconds(30);
9
- const validateConfig = (config) => config.enabled ? Effect.succeed(config) : Effect.fail(new InvalidSecretKeyError({ message: "Interfere is disabled - secret key or surface id missing" }));
10
- const createReleaseEffect = (config, body) => pipe(Effect.tryPromise({
11
- try: () => fetch(`${resolveApiUrl()}/releases`, {
12
- method: "PUT",
13
- body: JSON.stringify(body),
14
- headers: {
15
- Authorization: `Bearer ${config.secretKey}`,
16
- "Content-Type": "application/json"
17
- }
18
- }).then((response) => ({
19
- config,
20
- response
21
- })),
22
- catch: (error) => new InvalidApiUrlError({ message: `Failed to reach Interfere API: ${String(error)}` })
23
- }), Effect.timeoutFail({
24
- duration: API_TIMEOUT,
25
- onTimeout: () => new InvalidApiUrlError({ message: "Timed out while connecting to the Interfere API. Check INTERFERE_API_URL." })
26
- }));
27
- const handleResponse = ({ config, response }) => {
28
- if (response.status === 401) return Effect.fail(new InvalidSecretKeyError({ message: `INTERFERE_SECRET_KEY ending in '${config.secretKey.slice(-4)}' is invalid. Check the environment variable in your build environment.` }));
29
- if (!response.ok) return pipe(Effect.promise(() => response.text().catch(() => "Unknown error")), Effect.flatMap((errorText) => Effect.fail(new UploadError({ message: `Failed to create release: ${response.status} ${errorText}` }))));
30
- return Effect.succeed(response);
31
- };
32
- const parseReleaseResponse = (response) => pipe(Effect.promise(() => response.json()), Effect.flatMap((json) => {
33
- const parseResult = createReleaseResponseSchema.safeParse(json);
34
- return parseResult.success ? Effect.succeed(parseResult.data) : Effect.fail(new UploadError({ message: `Invalid release response: ${parseResult.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`).join(", ")}` }));
35
- }));
36
- function createRelease(config, releaseInfo) {
37
- return pipe(validateConfig(config), Effect.flatMap((validConfig) => pipe(createReleaseEffect(validConfig, releaseInfo), Effect.flatMap(handleResponse), Effect.flatMap(parseReleaseResponse))));
38
- }
39
- /**
40
- * Upload source maps using the new v2 client
41
- * @param sourceMapToGenerated - Mapping from source map filename to generated JS file path
42
- */
43
- function uploadSourceMaps(sourceMaps, sourceMapToGenerated, config, meta) {
44
- if (!config.enabled || sourceMaps.length === 0) return Effect.succeed({
45
- uploaded: 0,
46
- processed: 0
47
- });
48
- const sourceMapFiles = sourceMaps.map((sm) => ({
49
- relativePath: sm.relativePath,
50
- content: sm.content,
51
- hash: sm.hash,
52
- size: Buffer.byteLength(sm.content, "utf8")
53
- }));
54
- return new SourceMapClient(config, meta.apiUrl, {
55
- concurrency: 8,
56
- uploadTimeoutMs: Duration.toMillis(API_TIMEOUT)
57
- }).uploadSourceMaps(meta.releaseSlug, sourceMapFiles, sourceMapToGenerated);
58
- }
59
-
60
- //#endregion
61
- export { createRelease, uploadSourceMaps };
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.mjs","names":[],"sources":["../../../src/build/source-maps/api.ts"],"sourcesContent":["import type {\n UploadedJsFile,\n UploadedSourceMap,\n} from \"@interfere/types/data/source-maps\";\nimport {\n type CreateRelease,\n createReleaseResponseSchema,\n type ReleaseDestinationMetadata,\n type ReleaseDestinationType,\n type ReleaseSourceMetadata,\n type ReleaseSourceType,\n} from \"@interfere/types/releases/definition\";\nimport { Duration, Effect, pipe } from \"effect\";\nimport type { PreflightConfig, PreflightEnabled } from \"../../lib/types.js\";\nimport { resolveApiUrl } from \"../env-config.js\";\nimport type { UploadMeta } from \"../services/source-map.service.js\";\nimport { SourceMapClient } from \"./client.js\";\nimport {\n InvalidApiUrlError,\n InvalidSecretKeyError,\n UploadError,\n} from \"./errors.js\";\n\nconst API_TIMEOUT = Duration.seconds(30);\n\ntype ReleaseInfo = {\n environment: string;\n sourceId: string;\n sourceType: ReleaseSourceType;\n sourceMetadata: ReleaseSourceMetadata;\n destinationType: ReleaseDestinationType;\n destinationMetadata: ReleaseDestinationMetadata;\n};\n\nconst validateConfig = (\n config: PreflightConfig\n): Effect.Effect<PreflightEnabled, InvalidSecretKeyError> =>\n config.enabled\n ? Effect.succeed(config as PreflightEnabled)\n : Effect.fail(\n new InvalidSecretKeyError({\n message: \"Interfere is disabled - secret key or surface id missing\"\n })\n );\n\nconst createReleaseEffect = (config: PreflightEnabled, body: CreateRelease) =>\n pipe(\n Effect.tryPromise({\n try: () =>\n fetch(`${resolveApiUrl()}/releases`, {\n method: \"PUT\",\n body: JSON.stringify(body),\n headers: {\n Authorization: `Bearer ${config.secretKey}`,\n \"Content-Type\": \"application/json\",\n },\n }).then((response) => ({\n config,\n response,\n })),\n catch: (error) =>\n new InvalidApiUrlError({\n message: `Failed to reach Interfere API: ${String(error)}`\n }),\n }),\n Effect.timeoutFail({\n duration: API_TIMEOUT,\n onTimeout: () =>\n new InvalidApiUrlError({\n message: \"Timed out while connecting to the Interfere API. Check INTERFERE_API_URL.\"\n }),\n })\n );\n\nconst handleResponse = (\n {config, response}: {config: PreflightEnabled, response: Response}\n): Effect.Effect<Response, InvalidSecretKeyError | UploadError> => {\n // Handle 401 specifically - invalid secret key\n if (response.status === 401) {\n return Effect.fail(\n new InvalidSecretKeyError({\n message: \n `INTERFERE_SECRET_KEY ending in '${config.secretKey.slice(-4)}' is invalid. Check the environment variable in your build environment.`,\n })\n );\n }\n \n // Handle other non-ok responses\n if (!response.ok) {\n return pipe(\n Effect.promise(() => response.text().catch(() => \"Unknown error\")),\n Effect.flatMap((errorText) =>\n Effect.fail(\n new UploadError({\n message: `Failed to create release: ${response.status} ${errorText}`,\n })\n )\n )\n );\n }\n \n // Success\n return Effect.succeed(response);\n};\n\nconst parseReleaseResponse = (response: Response) =>\n pipe(\n Effect.promise(() => response.json()),\n Effect.flatMap((json) => {\n const parseResult = createReleaseResponseSchema.safeParse(json);\n \n return parseResult.success\n ? Effect.succeed(parseResult.data)\n : Effect.fail(\n new UploadError({\n message: `Invalid release response: ${parseResult.error.issues\n .map((i) => `${i.path.join(\".\")}: ${i.message}`)\n .join(\", \")}`\n })\n );\n })\n );\n\nexport function createRelease(\n config: PreflightConfig,\n releaseInfo: ReleaseInfo\n ) {\n return pipe(\n validateConfig(config),\n Effect.flatMap((validConfig) =>\n pipe(\n createReleaseEffect(validConfig, releaseInfo),\n Effect.flatMap(handleResponse),\n Effect.flatMap(parseReleaseResponse)\n )\n )\n );\n}\n\n\n/**\n * Upload source maps using the new v2 client\n * @param sourceMapToGenerated - Mapping from source map filename to generated JS file path\n */\nexport function uploadSourceMaps(\n sourceMaps: UploadedSourceMap[],\n sourceMapToGenerated: Record<string, string>,\n config: PreflightConfig,\n meta: UploadMeta\n) {\n // Early return for disabled or no source maps\n if (!config.enabled || sourceMaps.length === 0) {\n return Effect.succeed({ uploaded: 0, processed: 0 });\n }\n\n // Convert source maps to client format\n const sourceMapFiles = sourceMaps.map((sm) => ({\n relativePath: sm.relativePath,\n content: sm.content,\n hash: sm.hash,\n size: Buffer.byteLength(sm.content, \"utf8\"),\n }));\n\n // Create client and upload with higher concurrency for faster uploads\n const client = new SourceMapClient(config, meta.apiUrl, {\n concurrency: 8,\n uploadTimeoutMs: Duration.toMillis(API_TIMEOUT),\n });\n\n return client.uploadSourceMaps(\n meta.releaseSlug,\n sourceMapFiles,\n sourceMapToGenerated\n );\n}"],"mappings":";;;;;;;AAuBA,MAAM,cAAc,SAAS,QAAQ,GAAG;AAWxC,MAAM,kBACJ,WAEA,OAAO,UACH,OAAO,QAAQ,OAA2B,GAC1C,OAAO,KACL,IAAI,sBAAsB,EACxB,SAAS,4DACV,CAAC,CACH;AAEP,MAAM,uBAAuB,QAA0B,SACrD,KACE,OAAO,WAAW;CAChB,WACE,MAAM,GAAG,eAAe,CAAC,YAAY;EACnC,QAAQ;EACR,MAAM,KAAK,UAAU,KAAK;EAC1B,SAAS;GACP,eAAe,UAAU,OAAO;GAChC,gBAAgB;GACjB;EACF,CAAC,CAAC,MAAM,cAAc;EACrB;EACA;EACD,EAAE;CACL,QAAQ,UACN,IAAI,mBAAmB,EACrB,SAA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M,iBAAiB,WAAW,KAAK,QAAQ;EAC7C,cAAc,GAAG;EACjB,SAAS,GAAG;EACZ,MAAM,GAAG;EACT,MAAM,OAAO,WAAW,GAAG,SAAS,OAAO;EAC5C,EAAE;AAQH,QALe,IAAI,gBAAgB,QAAQ,KAAK,QAAQ;EACtD,aAAa;EACb,iBAAiB,SAAS,SAAS,YAAY;EAChD,CAAC,CAEY,iBACZ,KAAK,aACL,gBACA,qBACD"}
@@ -1,73 +0,0 @@
1
- import { PreflightConfig } from "../../lib/types.mjs";
2
- import { NotificationError, TokenRequestError, UploadError } from "./errors.mjs";
3
- import { Effect } from "effect";
4
- import { BatchUploadPaths, SourceMapConfig, SourceMapFile, UploadedBlob } from "@interfere/types/data/source-maps";
5
-
6
- //#region src/build/source-maps/client.d.ts
7
- type SourceMapFileWithContent = SourceMapFile & {
8
- content: string;
9
- };
10
- declare class SourceMapClient {
11
- private readonly config;
12
- private readonly apiUrl;
13
- private readonly secretKey;
14
- constructor(preflightConfig: PreflightConfig, apiUrl: string, options?: Partial<SourceMapConfig>);
15
- /**
16
- * Request upload paths for source maps (paths only, no tokens).
17
- * Tokens are generated per-file via the /upload endpoint.
18
- */
19
- requestUploadPaths(releaseSlug: string, request: {
20
- files: SourceMapFile[];
21
- folderPrefix?: string;
22
- }): Effect.Effect<{
23
- uploadPaths: Record<string, {
24
- uploadPath: string;
25
- contentType: string;
26
- }>;
27
- expiresAt: string;
28
- }, TokenRequestError, never>;
29
- /**
30
- * Upload a source map file using Vercel Blob's secure client upload.
31
- * The server validates auth and issues a path-scoped token via /upload endpoint.
32
- */
33
- uploadFile(releaseSlug: string, file: SourceMapFileWithContent, uploadInfo: {
34
- uploadPath: string;
35
- contentType: string;
36
- }): Effect.Effect<{
37
- relativePath: string;
38
- hash: string;
39
- blobUrl: string;
40
- }, UploadError, never>;
41
- /**
42
- * Upload multiple source maps in parallel using secure client uploads.
43
- * Each upload gets a path-scoped token from the server.
44
- */
45
- uploadBatch(releaseSlug: string, files: SourceMapFileWithContent[], batchPaths: BatchUploadPaths): Effect.Effect<{
46
- relativePath: string;
47
- hash: string;
48
- blobUrl: string;
49
- }[], UploadError, never>;
50
- /**
51
- * Notify the server that uploads are complete
52
- */
53
- notifyCompletion(releaseSlug: string, notification: {
54
- uploadedFiles: UploadedBlob[];
55
- sourceMapToGenerated?: Record<string, string>;
56
- }): Effect.Effect<any, NotificationError, never>;
57
- /**
58
- * Complete workflow: request paths, upload files with secure tokens, notify completion
59
- *
60
- * Flow:
61
- * 1. Request upload paths from API (paths only, no tokens)
62
- * 2. Upload files using secure client uploads (server issues path-scoped tokens)
63
- * 3. Notify API that uploads are complete for processing
64
- *
65
- * @param sourceMapToGenerated - Mapping from source map filename to generated JS file path
66
- */
67
- uploadSourceMaps(releaseSlug: string, sourceMapFiles: SourceMapFileWithContent[], sourceMapToGenerated: Record<string, string>): Effect.Effect<{
68
- uploaded: number;
69
- processed: any;
70
- }, UploadError | TokenRequestError | NotificationError, never>;
71
- }
72
- //#endregion
73
- export { SourceMapClient };
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.d.mts","names":[],"sources":["../../../src/build/source-maps/client.ts"],"sourcesContent":[],"mappings":";;;;;;KAaK,wBAAA,GAA2B;;AAFgD,CAAA;AAMnE,cAAA,eAAA,CAAe;EAMP,iBAAA,MAAA;EAEC,iBAAA,MAAA;EAAR,iBAAA,SAAA;EAqBQ,WAAA,CAAA,eAAA,EAvBD,eAuBC,EAAA,MAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EArBR,OAqBQ,CArBA,eAqBA,CAAA;;;;;;IA+DqC,KAAA,EA/DrC,aA+DqC,EAAA;IAyDhD,YAAA,CAAA,EAAA,MAAA;EACK,CAAA,CAAA,EAzH8C,MAAA,CAAA,MAyH9C,CAAA;;MAAgB,UAAA,EAAA,MAAA;MAwCX,WAAA,EAAA,MAAA;IACQ,CAAA,CAAA;IACxB,SAAA,EAAA,MAAA;EAAA,CAAA,mBAAA,EAAA,KAAA,CAAA;EAiGe;;;;wCAtMV;IAuMsC,UAAA,EAAA,MAAA;IAAA,WAAA,EAAA,MAAA;MAtMW,MAAA,CAAA;;;;;;;;;0CAyDhD,wCACK,mBAAgB,MAAA,CAAA;;;;;;;;;mBAwCX;2BACQ;MACxB,MAAA,CAAA,YAAA;;;;;;;;;;;wDAiGe,kDACM,yBAAsB,MAAA,CAAA"}
@@ -1,228 +0,0 @@
1
- import { NotificationError, TokenRequestError, UploadError } from "./errors.mjs";
2
- import { Effect, pipe } from "effect";
3
- import { batchUploadPathsSchema, sourceMapConfigSchema } from "@interfere/types/data/source-maps";
4
-
5
- //#region src/build/source-maps/client.ts
6
- var SourceMapClient = class {
7
- config;
8
- apiUrl;
9
- secretKey;
10
- constructor(preflightConfig, apiUrl, options) {
11
- if (!preflightConfig.enabled) throw new Error("Source maps are disabled");
12
- this.config = sourceMapConfigSchema.parse({
13
- ...options,
14
- ...preflightConfig
15
- });
16
- this.apiUrl = apiUrl;
17
- this.secretKey = preflightConfig.secretKey;
18
- }
19
- /**
20
- * Request upload paths for source maps (paths only, no tokens).
21
- * Tokens are generated per-file via the /upload endpoint.
22
- */
23
- requestUploadPaths(releaseSlug, request) {
24
- const { apiUrl, secretKey, config } = this;
25
- return Effect.gen(function* () {
26
- const url = `${apiUrl}/releases/${releaseSlug}/source-maps/tokens`;
27
- yield* Effect.logDebug("Requesting upload paths", {
28
- releaseSlug,
29
- fileCount: request.files.length
30
- });
31
- const response = yield* Effect.tryPromise({
32
- try: async () => {
33
- const res = await fetch(url, {
34
- method: "POST",
35
- headers: {
36
- Authorization: `Bearer ${secretKey}`,
37
- "Content-Type": "application/json"
38
- },
39
- body: JSON.stringify(request),
40
- signal: AbortSignal.timeout(config.uploadTimeoutMs)
41
- });
42
- if (!res.ok) {
43
- const error = await res.text().catch((e) => e);
44
- throw new TokenRequestError({ message: `POST ${url} failed: ${res.status} ${res.statusText} - ${error.slice(0, 100)}...` });
45
- }
46
- const data = await res.json();
47
- return batchUploadPathsSchema.parse(data);
48
- },
49
- catch: (error) => {
50
- if (error instanceof TokenRequestError) return error;
51
- return new TokenRequestError({ message: String(error) });
52
- }
53
- });
54
- yield* Effect.logDebug("Received upload paths", { pathCount: Object.keys(response.uploadPaths).length });
55
- return response;
56
- });
57
- }
58
- /**
59
- * Upload a source map file using Vercel Blob's secure client upload.
60
- * The server validates auth and issues a path-scoped token via /upload endpoint.
61
- */
62
- uploadFile(releaseSlug, file, uploadInfo) {
63
- const { apiUrl, secretKey } = this;
64
- return Effect.gen(function* () {
65
- yield* Effect.logDebug("Uploading source map", {
66
- path: file.relativePath,
67
- size: file.size
68
- });
69
- const blobUrl = yield* Effect.tryPromise({
70
- try: async () => {
71
- if (!file.content) throw new Error("File content is required for upload");
72
- const { upload } = await import("@vercel/blob/client");
73
- return (await upload(uploadInfo.uploadPath, file.content, {
74
- access: "public",
75
- handleUploadUrl: `${apiUrl}/releases/${releaseSlug}/source-maps/upload`,
76
- clientPayload: JSON.stringify({ secretKey }),
77
- contentType: uploadInfo.contentType
78
- })).url;
79
- },
80
- catch: (cause) => {
81
- return new UploadError({
82
- message: `Upload failed: ${String(cause)}`,
83
- file: file.relativePath,
84
- cause: String(cause)
85
- });
86
- }
87
- });
88
- yield* Effect.logDebug("Upload complete", {
89
- path: file.relativePath,
90
- url: blobUrl
91
- });
92
- return {
93
- relativePath: file.relativePath,
94
- hash: file.hash,
95
- blobUrl
96
- };
97
- });
98
- }
99
- /**
100
- * Upload multiple source maps in parallel using secure client uploads.
101
- * Each upload gets a path-scoped token from the server.
102
- */
103
- uploadBatch(releaseSlug, files, batchPaths) {
104
- const { config } = this;
105
- const uploadFile = this.uploadFile.bind(this);
106
- return Effect.gen(function* () {
107
- const results = yield* Effect.forEach(files, (file) => {
108
- const uploadInfo = batchPaths.uploadPaths[file.relativePath];
109
- if (!uploadInfo) return Effect.fail(new UploadError({
110
- file: file.relativePath,
111
- message: "No upload path found for file"
112
- }));
113
- return uploadFile(releaseSlug, file, uploadInfo);
114
- }, { concurrency: config.concurrency });
115
- yield* Effect.logDebug("Batch upload complete", {
116
- uploaded: results.length,
117
- total: files.length
118
- });
119
- return results;
120
- });
121
- }
122
- /**
123
- * Notify the server that uploads are complete
124
- */
125
- notifyCompletion(releaseSlug, notification) {
126
- const { apiUrl, secretKey, config } = this;
127
- return Effect.gen(function* () {
128
- const url = `${apiUrl}/releases/${releaseSlug}/source-maps/process`;
129
- yield* Effect.logDebug("Notifying upload completion", {
130
- releaseSlug,
131
- fileCount: notification.uploadedFiles.length
132
- });
133
- const notifyStart = Date.now();
134
- const response = yield* Effect.tryPromise({
135
- try: async () => {
136
- const processingTimeout = Math.max(config.uploadTimeoutMs * 2, 6e4);
137
- const requestStart = Date.now();
138
- const res = await fetch(url, {
139
- method: "POST",
140
- headers: {
141
- Authorization: `Bearer ${secretKey}`,
142
- "Content-Type": "application/json"
143
- },
144
- body: JSON.stringify(notification),
145
- signal: AbortSignal.timeout(processingTimeout)
146
- });
147
- const requestTime = Date.now() - requestStart;
148
- if (!res.ok) {
149
- const error = await res.text().catch(() => "Unknown error");
150
- throw new NotificationError({
151
- status: res.status,
152
- message: error
153
- });
154
- }
155
- const parseStart = Date.now();
156
- const json = await res.json();
157
- const parseTime = Date.now() - parseStart;
158
- if (typeof json !== "object" || json === null) throw new NotificationError({
159
- status: res.status,
160
- message: "Invalid response format"
161
- });
162
- return {
163
- json,
164
- requestTime,
165
- parseTime,
166
- status: res.status
167
- };
168
- },
169
- catch: (error) => {
170
- if (error instanceof NotificationError) return error;
171
- if (error instanceof Error && error.name === "AbortError") return new NotificationError({ message: `Request timed out after ${config.uploadTimeoutMs * 2}ms` });
172
- return new NotificationError({ message: String(error) });
173
- }
174
- });
175
- yield* Effect.logDebug(`Notification request completed in ${response.requestTime}ms`, { status: response.status });
176
- yield* Effect.logDebug(`Response parsed in ${response.parseTime}ms`);
177
- const notifyTime = Date.now() - notifyStart;
178
- yield* Effect.logDebug(`Server notified of upload completion in ${notifyTime}ms`, {
179
- fileCount: notification.uploadedFiles.length,
180
- processed: response.json.processed ?? "unknown"
181
- });
182
- return response.json;
183
- });
184
- }
185
- /**
186
- * Complete workflow: request paths, upload files with secure tokens, notify completion
187
- *
188
- * Flow:
189
- * 1. Request upload paths from API (paths only, no tokens)
190
- * 2. Upload files using secure client uploads (server issues path-scoped tokens)
191
- * 3. Notify API that uploads are complete for processing
192
- *
193
- * @param sourceMapToGenerated - Mapping from source map filename to generated JS file path
194
- */
195
- uploadSourceMaps(releaseSlug, sourceMapFiles, sourceMapToGenerated) {
196
- const requestUploadPaths = this.requestUploadPaths.bind(this);
197
- const uploadBatch = this.uploadBatch.bind(this);
198
- const notifyCompletion = this.notifyCompletion.bind(this);
199
- return pipe(Effect.gen(function* () {
200
- if (sourceMapFiles.length === 0) {
201
- yield* Effect.logInfo("No source maps to upload");
202
- return {
203
- uploaded: 0,
204
- processed: 0
205
- };
206
- }
207
- const uploadedSourceMaps = yield* uploadBatch(releaseSlug, sourceMapFiles, yield* requestUploadPaths(releaseSlug, {
208
- files: sourceMapFiles.map(({ content, ...file }) => file),
209
- folderPrefix: "source-maps"
210
- }));
211
- const result = yield* notifyCompletion(releaseSlug, {
212
- uploadedFiles: uploadedSourceMaps,
213
- sourceMapToGenerated
214
- });
215
- return {
216
- uploaded: uploadedSourceMaps.length,
217
- processed: result.processed
218
- };
219
- }), Effect.withSpan("source-maps.upload", { attributes: {
220
- releaseSlug,
221
- sourceMapCount: sourceMapFiles.length,
222
- mappingCount: Object.keys(sourceMapToGenerated).length
223
- } }), Effect.tap((result) => Effect.logDebug("Source map upload succeeded", result)));
224
- }
225
- };
226
-
227
- //#endregion
228
- export { SourceMapClient };
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.mjs","names":[],"sources":["../../../src/build/source-maps/client.ts"],"sourcesContent":["import {\n type BatchUploadPaths,\n batchUploadPathsSchema,\n type SourceMapConfig,\n type SourceMapFile,\n sourceMapConfigSchema,\n type UploadedBlob,\n} from \"@interfere/types/data/source-maps\";\n\nimport { Effect, pipe } from \"effect\";\nimport type { PreflightConfig } from \"../../lib/types.js\";\nimport { NotificationError, TokenRequestError, UploadError } from \"./errors.js\";\n\ntype SourceMapFileWithContent = SourceMapFile & {\n content: string;\n};\n\nexport class SourceMapClient {\n private readonly config: SourceMapConfig;\n private readonly apiUrl: string;\n private readonly secretKey: string;\n\n constructor(\n preflightConfig: PreflightConfig,\n apiUrl: string,\n options?: Partial<SourceMapConfig>\n ) {\n if (!preflightConfig.enabled) {\n throw new Error(\"Source maps are disabled\");\n }\n\n this.config = sourceMapConfigSchema.parse({\n ...options,\n ...preflightConfig,\n });\n\n this.apiUrl = apiUrl;\n this.secretKey = preflightConfig.secretKey;\n }\n\n /**\n * Request upload paths for source maps (paths only, no tokens).\n * Tokens are generated per-file via the /upload endpoint.\n */\n requestUploadPaths(\n releaseSlug: string,\n request: { files: SourceMapFile[]; folderPrefix?: string }\n ) {\n const { apiUrl, secretKey, config } = this;\n\n return Effect.gen(function* () {\n const url = `${apiUrl}/releases/${releaseSlug}/source-maps/tokens`;\n\n yield* Effect.logDebug(\"Requesting upload paths\", {\n releaseSlug,\n fileCount: request.files.length,\n });\n\n const response = yield* Effect.tryPromise({\n try: async () => {\n const res = await fetch(url, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${secretKey}`,\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(request),\n signal: AbortSignal.timeout(config.uploadTimeoutMs),\n });\n\n if (!res.ok) {\n const error = await res.text().catch((e) => e);\n\n throw new TokenRequestError({\n message: `POST ${url} failed: ${res.status} ${res.statusText} - ${error.slice(0, 100)}...`,\n });\n }\n\n const data = await res.json();\n const parsed = batchUploadPathsSchema.parse(data);\n\n return parsed;\n },\n catch: (error) => {\n if (error instanceof TokenRequestError) {\n return error;\n }\n\n return new TokenRequestError({\n message: String(error),\n });\n },\n });\n\n yield* Effect.logDebug(\"Received upload paths\", {\n pathCount: Object.keys(response.uploadPaths).length,\n });\n\n return response;\n });\n }\n\n /**\n * Upload a source map file using Vercel Blob's secure client upload.\n * The server validates auth and issues a path-scoped token via /upload endpoint.\n */\n uploadFile(\n releaseSlug: string,\n file: SourceMapFileWithContent,\n uploadInfo: { uploadPath: string; contentType: string }\n ) {\n const { apiUrl, secretKey } = this;\n\n return Effect.gen(function* () {\n yield* Effect.logDebug(\"Uploading source map\", {\n path: file.relativePath,\n size: file.size,\n });\n\n const blobUrl = yield* Effect.tryPromise({\n try: async () => {\n if (!file.content) {\n throw new Error(\"File content is required for upload\");\n }\n\n // Use Vercel Blob client SDK for secure uploads\n // The server validates auth and returns a path-scoped token\n const { upload } = await import(\"@vercel/blob/client\");\n \n const result = await upload(uploadInfo.uploadPath, file.content, {\n access: \"public\",\n handleUploadUrl: `${apiUrl}/releases/${releaseSlug}/source-maps/upload`,\n clientPayload: JSON.stringify({ secretKey }),\n contentType: uploadInfo.contentType,\n });\n\n return result.url;\n },\n catch: (cause) => {\n return new UploadError({\n message: `Upload failed: ${String(cause)}`,\n file: file.relativePath,\n cause: String(cause),\n });\n },\n });\n\n yield* Effect.logDebug(\"Upload complete\", {\n path: file.relativePath,\n url: blobUrl,\n });\n\n return {\n relativePath: file.relativePath,\n hash: file.hash,\n blobUrl,\n };\n });\n }\n\n /**\n * Upload multiple source maps in parallel using secure client uploads.\n * Each upload gets a path-scoped token from the server.\n */\n uploadBatch(\n releaseSlug: string,\n files: SourceMapFileWithContent[],\n batchPaths: BatchUploadPaths\n ) {\n const { config } = this;\n const uploadFile = this.uploadFile.bind(this);\n\n return Effect.gen(function* () {\n // Upload files in parallel with concurrency limit\n const results = yield* Effect.forEach(\n files,\n (file) => {\n const uploadInfo = batchPaths.uploadPaths[file.relativePath];\n if (!uploadInfo) {\n return Effect.fail(\n new UploadError({\n file: file.relativePath,\n message: \"No upload path found for file\",\n })\n );\n }\n return uploadFile(releaseSlug, file, uploadInfo);\n },\n { concurrency: config.concurrency }\n );\n\n // Internal debug – the user‑visible status comes from the build logger\n yield* Effect.logDebug(\"Batch upload complete\", {\n uploaded: results.length,\n total: files.length,\n });\n\n return results;\n });\n }\n\n /**\n * Notify the server that uploads are complete\n */\n notifyCompletion(\n releaseSlug: string,\n notification: {\n uploadedFiles: UploadedBlob[];\n sourceMapToGenerated?: Record<string, string>;\n }\n ) {\n const { apiUrl, secretKey, config } = this;\n\n return Effect.gen(function* () {\n const url = `${apiUrl}/releases/${releaseSlug}/source-maps/process`;\n\n yield* Effect.logDebug(\"Notifying upload completion\", {\n releaseSlug,\n fileCount: notification.uploadedFiles.length,\n });\n\n const notifyStart = Date.now();\n const response = yield* Effect.tryPromise({\n try: async () => {\n // Use a longer timeout for processing notification since it can take time\n const processingTimeout = Math.max(config.uploadTimeoutMs * 2, 60_000);\n \n const requestStart = Date.now();\n const res = await fetch(url, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${secretKey}`,\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(notification),\n signal: AbortSignal.timeout(processingTimeout),\n });\n const requestTime = Date.now() - requestStart;\n\n if (!res.ok) {\n const error = await res.text().catch(() => \"Unknown error\");\n throw new NotificationError({\n status: res.status,\n message: error,\n });\n }\n\n const parseStart = Date.now();\n const json = await res.json();\n const parseTime = Date.now() - parseStart;\n \n // Validate response has expected shape\n if (typeof json !== \"object\" || json === null) {\n throw new NotificationError({\n status: res.status,\n message: \"Invalid response format\",\n });\n }\n\n return { json, requestTime, parseTime, status: res.status };\n },\n catch: (error) => {\n if (error instanceof NotificationError) {\n return error;\n }\n \n // Handle timeout/abort errors\n if (error instanceof Error && error.name === \"AbortError\") {\n return new NotificationError({\n message: `Request timed out after ${config.uploadTimeoutMs * 2}ms`,\n });\n }\n \n return new NotificationError({\n message: String(error),\n });\n },\n });\n\n yield* Effect.logDebug(`Notification request completed in ${response.requestTime}ms`, {\n status: response.status,\n });\n yield* Effect.logDebug(`Response parsed in ${response.parseTime}ms`);\n\n const notifyTime = Date.now() - notifyStart;\n yield* Effect.logDebug(`Server notified of upload completion in ${notifyTime}ms`, {\n fileCount: notification.uploadedFiles.length,\n processed: response.json.processed ?? \"unknown\",\n });\n\n return response.json;\n });\n }\n\n /**\n * Complete workflow: request paths, upload files with secure tokens, notify completion\n *\n * Flow:\n * 1. Request upload paths from API (paths only, no tokens)\n * 2. Upload files using secure client uploads (server issues path-scoped tokens)\n * 3. Notify API that uploads are complete for processing\n * \n * @param sourceMapToGenerated - Mapping from source map filename to generated JS file path\n */\n uploadSourceMaps(\n releaseSlug: string,\n sourceMapFiles: SourceMapFileWithContent[],\n sourceMapToGenerated: Record<string, string>\n ) {\n const requestUploadPaths = this.requestUploadPaths.bind(this);\n const uploadBatch = this.uploadBatch.bind(this);\n const notifyCompletion = this.notifyCompletion.bind(this);\n\n return pipe(\n Effect.gen(function* () {\n if (sourceMapFiles.length === 0) {\n yield* Effect.logInfo(\"No source maps to upload\");\n return { uploaded: 0, processed: 0 };\n }\n\n // Step 1: Request upload paths for source maps (only send metadata, not content)\n const sourceMapPaths = yield* requestUploadPaths(releaseSlug, {\n files: sourceMapFiles.map(({ content, ...file }) => file),\n folderPrefix: \"source-maps\",\n });\n\n // Step 2: Upload source maps in parallel with secure client uploads\n // Each upload gets a path-scoped token from the /upload endpoint\n const uploadedSourceMaps = yield* uploadBatch(\n releaseSlug,\n sourceMapFiles,\n sourceMapPaths\n );\n\n // Step 3: Notify completion with source map to generated file mapping\n // (JS files are not uploaded, but we send the mapping for processing)\n const result = yield* notifyCompletion(releaseSlug, {\n uploadedFiles: uploadedSourceMaps,\n sourceMapToGenerated,\n });\n\n return {\n uploaded: uploadedSourceMaps.length,\n processed: result.processed,\n };\n }),\n Effect.withSpan(\"source-maps.upload\", {\n attributes: {\n releaseSlug,\n sourceMapCount: sourceMapFiles.length,\n mappingCount: Object.keys(sourceMapToGenerated).length,\n },\n }),\n // Let the outer releaseProgram own failure logging so we don't\n // print a separate top-level error line before the buffered\n // \"Failed to upload source maps\" block.\n Effect.tap((result) =>\n Effect.logDebug(\"Source map upload succeeded\", result)\n )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0 @@
1
- import * as effect_Types0 from "effect/Types";
2
- import * as effect_Cause0 from "effect/Cause";
3
-
4
- //#region src/build/source-maps/errors.d.ts
5
- declare const InvalidApiUrlError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }) => effect_Cause0.YieldableError & {
6
- readonly _tag: "InvalidApiUrlError";
7
- } & Readonly<A>;
8
- declare class InvalidApiUrlError extends InvalidApiUrlError_base<{
9
- readonly message: string;
10
- }> {}
11
- declare const InvalidSecretKeyError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }) => effect_Cause0.YieldableError & {
12
- readonly _tag: "InvalidSecretKeyError";
13
- } & Readonly<A>;
14
- declare class InvalidSecretKeyError extends InvalidSecretKeyError_base<{
15
- readonly message: string;
16
- }> {}
17
- declare const UploadError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }) => effect_Cause0.YieldableError & {
18
- readonly _tag: "UploadError";
19
- } & Readonly<A>;
20
- declare class UploadError extends UploadError_base<{
21
- readonly file?: string;
22
- readonly message: string;
23
- readonly cause?: unknown;
24
- }> {}
25
- declare const TokenRequestError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }) => effect_Cause0.YieldableError & {
26
- readonly _tag: "TokenRequestError";
27
- } & Readonly<A>;
28
- declare class TokenRequestError extends TokenRequestError_base<{
29
- readonly message: string;
30
- }> {}
31
- declare const NotificationError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }) => effect_Cause0.YieldableError & {
32
- readonly _tag: "NotificationError";
33
- } & Readonly<A>;
34
- declare class NotificationError extends NotificationError_base<{
35
- readonly status?: number;
36
- readonly message: string;
37
- }> {}
38
- declare const PayloadTooLargeError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }) => effect_Cause0.YieldableError & {
39
- readonly _tag: "PayloadTooLargeError";
40
- } & Readonly<A>;
41
- declare class PayloadTooLargeError extends PayloadTooLargeError_base<{
42
- readonly message: string;
43
- }> {}
44
- declare const NoDeploymentError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }) => effect_Cause0.YieldableError & {
45
- readonly _tag: "NoDeploymentError";
46
- } & Readonly<A>;
47
- declare class NoDeploymentError extends NoDeploymentError_base<{
48
- readonly message: string;
49
- }> {}
50
- declare const NoBuildIdError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }) => effect_Cause0.YieldableError & {
51
- readonly _tag: "NoBuildIdError";
52
- } & Readonly<A>;
53
- declare class NoBuildIdError extends NoBuildIdError_base<{
54
- readonly message: string;
55
- }> {}
56
- declare const WithInterfereUsageError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }) => effect_Cause0.YieldableError & {
57
- readonly _tag: "WithInterfereUsageError";
58
- } & Readonly<A>;
59
- declare class WithInterfereUsageError extends WithInterfereUsageError_base<{
60
- readonly message: string;
61
- }> {}
62
- declare const MissingBuildIdError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }) => effect_Cause0.YieldableError & {
63
- readonly _tag: "MissingBuildIdError";
64
- } & Readonly<A>;
65
- declare class MissingBuildIdError extends MissingBuildIdError_base<{
66
- readonly message: string;
67
- }> {}
68
- declare const MissingReleaseIdError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }) => effect_Cause0.YieldableError & {
69
- readonly _tag: "MissingReleaseIdError";
70
- } & Readonly<A>;
71
- declare class MissingReleaseIdError extends MissingReleaseIdError_base<{
72
- readonly message: string;
73
- }> {}
74
- declare const FileReadError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }) => effect_Cause0.YieldableError & {
75
- readonly _tag: "FileReadError";
76
- } & Readonly<A>;
77
- declare class FileReadError extends FileReadError_base<{
78
- readonly message: string;
79
- readonly path: string;
80
- }> {}
81
- declare const FileGlobError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }) => effect_Cause0.YieldableError & {
82
- readonly _tag: "FileGlobError";
83
- } & Readonly<A>;
84
- declare class FileGlobError extends FileGlobError_base<{
85
- readonly message: string;
86
- readonly pattern: string;
87
- }> {}
88
- declare const FileDeleteError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }) => effect_Cause0.YieldableError & {
89
- readonly _tag: "FileDeleteError";
90
- } & Readonly<A>;
91
- declare class FileDeleteError extends FileDeleteError_base<{
92
- readonly message: string;
93
- readonly path: string;
94
- }> {}
95
- declare const FileHashError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }) => effect_Cause0.YieldableError & {
96
- readonly _tag: "FileHashError";
97
- } & Readonly<A>;
98
- declare class FileHashError extends FileHashError_base<{
99
- readonly message: string;
100
- readonly path: string;
101
- }> {}
102
- declare const SourceControlDetectionError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }) => effect_Cause0.YieldableError & {
103
- readonly _tag: "SourceControlDetectionError";
104
- } & Readonly<A>;
105
- declare class SourceControlDetectionError extends SourceControlDetectionError_base<{
106
- readonly message: string;
107
- }> {}
108
- //#endregion
109
- export { FileDeleteError, FileGlobError, FileHashError, FileReadError, InvalidApiUrlError, InvalidSecretKeyError, MissingBuildIdError, MissingReleaseIdError, NoBuildIdError, NoDeploymentError, NotificationError, PayloadTooLargeError, SourceControlDetectionError, TokenRequestError, UploadError, WithInterfereUsageError };
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.d.mts","names":[],"sources":["../../../src/build/source-maps/errors.ts"],"sourcesContent":[],"mappings":";;;;;;;cAGa,kBAAA,SAA2B;;;cAEnC;;;cAEQ,qBAAA,SAA8B;;;cAEtC;;;AANQ,cAQA,WAAA,SAAoB,gBARO,CAAA;EAEnC,SAAA,IAAA,CAAA,EAAA,MAAA;;;;cAUA;;;cAEQ,iBAAA,SAA0B;;;cAGtC;EAbY,SAAA,IAAA,EAAA,mBAAsB;AAE9B,CAAA,WAAA,EAAA,CAAA;cAaQ,iBAAA,SAA0B;;;;cAItC;;;cAEY,oBAAA,SAA6B;;;AAjB1C,cAmBK,sBAnB4B,EAAA,IAAA,CAAA,gBAAA,CAAA,MAAA,EAAA,GAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,IAAA,sBAAA,EAAA,EAAA,CAAA,CAAA,CAAA,SAAA,IAAA,GAAA,IAAA,GAAA,iBAAA,OAAA,KAAA,SAAA,MAAA,GAAA,KAAA,IAAA,IAAA,EAAA,CAAA,EAAA,EAAA,kCAAA;EAI5B,SAAA,IAAA,EAAA,mBAAA;;cAkBQ,iBAAA,SAA0B;;;cAElC;;;cAEQ,cAAA,SAAuB;;;AApBpC,cAsBK,4BAtBkC,EAAA,IAAA,CAAA,gBAAA,CAAA,MAAA,EAAA,GAAA,CAAA,GAAA,CAAA,CAA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InvalidApiUrlError") {};
5
- var InvalidSecretKeyError = class extends Data.TaggedError("InvalidSecretKeyError") {};
6
- var UploadError = class extends Data.TaggedError("UploadError") {};
7
- var TokenRequestError = class extends Data.TaggedError("TokenRequestError") {};
8
- var NotificationError = class extends Data.TaggedError("NotificationError") {};
9
- var PayloadTooLargeError = class extends Data.TaggedError("PayloadTooLargeError") {};
10
- var NoDeploymentError = class extends Data.TaggedError("NoDeploymentError") {};
11
- var NoBuildIdError = class extends Data.TaggedError("NoBuildIdError") {};
12
- var WithInterfereUsageError = class extends Data.TaggedError("WithInterfereUsageError") {};
13
- var MissingBuildIdError = class extends Data.TaggedError("MissingBuildIdError") {};
14
- var MissingReleaseIdError = class extends Data.TaggedError("MissingReleaseIdError") {};
15
- var FileReadError = class extends Data.TaggedError("FileReadError") {};
16
- var FileGlobError = class extends Data.TaggedError("FileGlobError") {};
17
- var FileDeleteError = class extends Data.TaggedError("FileDeleteError") {};
18
- var FileHashError = class extends Data.TaggedError("FileHashError") {};
19
- var SourceControlDetectionError = class extends Data.TaggedError("SourceControlDetectionError") {};
20
-
21
- //#endregion
22
- export { FileDeleteError, FileGlobError, FileHashError, FileReadError, InvalidApiUrlError, InvalidSecretKeyError, MissingBuildIdError, MissingReleaseIdError, NoBuildIdError, NoDeploymentError, NotificationError, PayloadTooLargeError, SourceControlDetectionError, TokenRequestError, UploadError, WithInterfereUsageError };
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.mjs","names":[],"sources":["../../../src/build/source-maps/errors.ts"],"sourcesContent":["import { Data } from \"effect\";\n\n// API-related errors\nexport class InvalidApiUrlError extends Data.TaggedError(\"InvalidApiUrlError\")<{\n readonly message: string;\n}> {}\n\nexport class InvalidSecretKeyError extends Data.TaggedError(\"InvalidSecretKeyError\")<{\n readonly message: string;\n}> {}\n\nexport class UploadError extends Data.TaggedError(\"UploadError\")<{\n readonly file?: string;\n readonly message: string;\n readonly cause?: unknown;\n}> {}\n\nexport class TokenRequestError extends Data.TaggedError(\"TokenRequestError\")<{\n readonly message: string;\n}> {\n}\n\nexport class NotificationError extends Data.TaggedError(\"NotificationError\")<{\n readonly status?: number;\n readonly message: string;\n}> {\n}\n\nexport class PayloadTooLargeError extends Data.TaggedError(\"PayloadTooLargeError\")<{\n readonly message: string;\n}> {}\n\n// Deployment and build errors\nexport class NoDeploymentError extends Data.TaggedError(\"NoDeploymentError\")<{\n readonly message: string;\n}> {}\n\nexport class NoBuildIdError extends Data.TaggedError(\"NoBuildIdError\")<{\n readonly message: string;\n}> {}\n\n// Configuration errors\nexport class WithInterfereUsageError extends Data.TaggedError(\"WithInterfereUsageError\")<{\n readonly message: string;\n}> {}\n\nexport class MissingBuildIdError extends Data.TaggedError(\"MissingBuildIdError\")<{\n readonly message: string;\n}> {}\n\nexport class MissingReleaseIdError extends Data.TaggedError(\"MissingReleaseIdError\")<{\n readonly message: string;\n}> {}\n\n// File system operation errors\nexport class FileReadError extends Data.TaggedError(\"FileReadError\")<{\n readonly message: string;\n readonly path: string;\n}> {}\n\nexport class FileGlobError extends Data.TaggedError(\"FileGlobError\")<{\n readonly message: string;\n readonly pattern: string;\n}> {}\n\nexport class FileDeleteError extends Data.TaggedError(\"FileDeleteError\")<{\n readonly message: string;\n readonly path: string;\n}> {}\n\nexport class FileHashError extends Data.TaggedError(\"FileHashError\")<{\n readonly message: string;\n readonly path: string;\n}> {}\n\nexport class SourceControlDetectionError extends Data.TaggedError(\"SourceControlDetectionError\")<{\n readonly message: string;\n}> {}\n"],"mappings":";;;AAGA,IAAa,qBAAb,cAAwC,KAAK,YAAY,qBAAqB,CAE3E;AAEH,IAAa,wBAAb,cAA2C,KAAK,YAAY,wBAAwB,CAEjF;AAEH,IAAa,cAAb,cAAiC,KAAK,YAAY,cAAc,CAI7D;AAEH,IAAa,oBAAb,cAAuC,KAAK,YAAY,oBAAoB,CAEzE;AAGH,IAAa,oBAAb,cAAuC,KAAK,YAAY,oBAAoB,CAGzE;AAGH,IAAa,uBAAb,cAA0C,KAAK,YAAY,uBAAuB,CAE/E;AAGH,IAAa,oBAAb,cAAuC,KAAK,YAAY,oBAAoB,CAEzE;AAEH,IAAa,iBAAb,cAAoC,KAAK,YAAY,iBAAiB,CAEnE;AAGH,IAAa,0BAAb,cAA6C,KAAK,YAAY,0BAA0B,CAErF;AAEH,IAAa,sBAAb,cAAyC,KAAK,YAAY,sBAAsB,CAE7E;AAEH,IAAa,wBAAb,cAA2C,KAAK,YAAY,wBAAwB,CAEjF;AAGH,IAAa,gBAAb,cAAmC,KAAK,YAAY,gBAAgB,CAGjE;AAEH,IAAa,gBAAb,cAAmC,KAAK,YAAY,gBAAgB,CAGjE;AAEH,IAAa,kBAAb,cAAqC,KAAK,YAAY,kBAAkB,CAGrE;AAEH,IAAa,gBAAb,cAAmC,KAAK,YAAY,gBAAgB,CAGjE;AAEH,IAAa,8BAAb,cAAiD,KAAK,YAAY,8BAA8B,CAE7F"}
@@ -1,35 +0,0 @@
1
- import { FileDeleteError, FileGlobError, FileHashError, FileReadError } from "./errors.mjs";
2
- import { Effect } from "effect";
3
-
4
- //#region src/build/source-maps/files.d.ts
5
- declare function findSourceMapFiles(): Effect.Effect<string[], FileGlobError, never>;
6
- declare function readSourceMapsFromFiles(paths: string[]): Effect.Effect<{
7
- relativePath: string;
8
- content: string;
9
- hash: string;
10
- }[], FileReadError | FileHashError, never>;
11
- declare function cleanupSourceMaps(paths: string[], debug: boolean): Effect.Effect<void, never, never> | Effect.Effect<undefined, FileDeleteError, never>;
12
- declare function maybeCleanupAfterFailure(debug: boolean): Effect.Effect<void, FileGlobError | FileDeleteError, never>;
13
- /**
14
- * Find all generated JavaScript files (excluding source maps)
15
- */
16
- declare function findGeneratedJsFiles(): Effect.Effect<string[], FileGlobError, never>;
17
- /**
18
- * Read generated JS files and extract sourceMappingURL to build a mapping.
19
- * Returns a map: sourceMapFilename -> generatedJsFilePath
20
- *
21
- * Both keys and values are in public URL format (_next/...) to match
22
- * what appears in error stack traces, making the backend framework-agnostic.
23
- */
24
- declare function buildSourceMapToGeneratedMapping(paths: string[]): Effect.Effect<Record<string, string>, FileReadError, never>;
25
- /**
26
- * Read generated JS files from disk
27
- * @deprecated Use buildSourceMapToGeneratedMapping instead - we no longer upload JS files
28
- */
29
- declare function readGeneratedJsFiles(paths: string[]): Effect.Effect<{
30
- relativePath: string;
31
- content: string;
32
- hash: string;
33
- }[], FileReadError | FileHashError, never>;
34
- //#endregion
35
- export { buildSourceMapToGeneratedMapping, cleanupSourceMaps, findGeneratedJsFiles, findSourceMapFiles, maybeCleanupAfterFailure, readGeneratedJsFiles, readSourceMapsFromFiles };