@interfere/next 0.0.15-alpha.8 → 0.1.0-alpha.11

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 (146) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +36 -8
  3. package/dist/_virtual/_rolldown/runtime.mjs +7 -0
  4. package/dist/build/env-config.d.mts +3 -1
  5. package/dist/build/env-config.d.mts.map +1 -1
  6. package/dist/build/env-config.mjs +9 -1
  7. package/dist/build/env-config.mjs.map +1 -1
  8. package/dist/build/exchange-surface.d.mts +9 -0
  9. package/dist/build/exchange-surface.d.mts.map +1 -0
  10. package/dist/build/exchange-surface.mjs +36 -0
  11. package/dist/build/exchange-surface.mjs.map +1 -0
  12. package/dist/build/loaders/value-injection-loader.d.mts +22 -0
  13. package/dist/build/loaders/value-injection-loader.d.mts.map +1 -0
  14. package/dist/build/loaders/value-injection-loader.mjs +35 -0
  15. package/dist/build/loaders/value-injection-loader.mjs.map +1 -0
  16. package/dist/build/logger.d.mts +2 -2
  17. package/dist/build/logger.d.mts.map +1 -1
  18. package/dist/build/logger.mjs +10 -12
  19. package/dist/build/logger.mjs.map +1 -1
  20. package/dist/build/nextjs-version.d.mts +40 -0
  21. package/dist/build/nextjs-version.d.mts.map +1 -0
  22. package/dist/build/nextjs-version.mjs +66 -0
  23. package/dist/build/nextjs-version.mjs.map +1 -0
  24. package/dist/build/release-program.d.mts +5 -3
  25. package/dist/build/release-program.d.mts.map +1 -1
  26. package/dist/build/release-program.mjs +11 -12
  27. package/dist/build/release-program.mjs.map +1 -1
  28. package/dist/build/services/config.service.d.mts.map +1 -1
  29. package/dist/build/services/config.service.mjs.map +1 -1
  30. package/dist/build/services/instrumentation-detection.service.d.mts +19 -0
  31. package/dist/build/services/instrumentation-detection.service.d.mts.map +1 -0
  32. package/dist/build/services/instrumentation-detection.service.mjs +77 -0
  33. package/dist/build/services/instrumentation-detection.service.mjs.map +1 -0
  34. package/dist/build/services/preflight.service.d.mts +2 -3
  35. package/dist/build/services/preflight.service.d.mts.map +1 -1
  36. package/dist/build/services/preflight.service.mjs +28 -37
  37. package/dist/build/services/preflight.service.mjs.map +1 -1
  38. package/dist/build/services/release-api.service.d.mts +11 -0
  39. package/dist/build/services/release-api.service.d.mts.map +1 -0
  40. package/dist/build/services/release-api.service.mjs +9 -0
  41. package/dist/build/services/release-api.service.mjs.map +1 -0
  42. package/dist/build/services/release-identity.service.d.mts +4 -3
  43. package/dist/build/services/release-identity.service.d.mts.map +1 -1
  44. package/dist/build/services/release-identity.service.mjs +28 -15
  45. package/dist/build/services/release-identity.service.mjs.map +1 -1
  46. package/dist/build/services/source-map-failure-cleanup.service.d.mts +11 -0
  47. package/dist/build/services/source-map-failure-cleanup.service.d.mts.map +1 -0
  48. package/dist/build/services/source-map-failure-cleanup.service.mjs +9 -0
  49. package/dist/build/services/source-map-failure-cleanup.service.mjs.map +1 -0
  50. package/dist/build/services/source-map.service.d.mts +4 -8
  51. package/dist/build/services/source-map.service.d.mts.map +1 -1
  52. package/dist/build/services/source-map.service.mjs +2 -4
  53. package/dist/build/services/source-map.service.mjs.map +1 -1
  54. package/dist/build/source-maps/api.d.mts +25 -16
  55. package/dist/build/source-maps/api.d.mts.map +1 -1
  56. package/dist/build/source-maps/api.mjs +11 -8
  57. package/dist/build/source-maps/api.mjs.map +1 -1
  58. package/dist/build/source-maps/client.d.mts +11 -2
  59. package/dist/build/source-maps/client.d.mts.map +1 -1
  60. package/dist/build/source-maps/client.mjs +25 -14
  61. package/dist/build/source-maps/client.mjs.map +1 -1
  62. package/dist/build/source-maps/errors.d.mts +118 -106
  63. package/dist/build/source-maps/errors.d.mts.map +1 -1
  64. package/dist/build/source-maps/errors.mjs +42 -18
  65. package/dist/build/source-maps/errors.mjs.map +1 -1
  66. package/dist/build/source-maps/files.d.mts +1 -1
  67. package/dist/build/source-maps/files.d.mts.map +1 -1
  68. package/dist/build/source-maps/files.mjs +13 -15
  69. package/dist/build/source-maps/files.mjs.map +1 -1
  70. package/dist/build/source-maps/providers/deployment/detector.d.mts +8 -17
  71. package/dist/build/source-maps/providers/deployment/detector.d.mts.map +1 -1
  72. package/dist/build/source-maps/providers/deployment/detector.mjs +11 -13
  73. package/dist/build/source-maps/providers/deployment/detector.mjs.map +1 -1
  74. package/dist/build/source-maps/providers/deployment/types.d.mts +2 -2
  75. package/dist/build/source-maps/providers/deployment/types.d.mts.map +1 -1
  76. package/dist/build/source-maps/providers/deployment/vercel.d.mts.map +1 -1
  77. package/dist/build/source-maps/providers/deployment/vercel.mjs +8 -19
  78. package/dist/build/source-maps/providers/deployment/vercel.mjs.map +1 -1
  79. package/dist/build/source-maps/providers/source-control/detector.d.mts +6 -5
  80. package/dist/build/source-maps/providers/source-control/detector.d.mts.map +1 -1
  81. package/dist/build/source-maps/providers/source-control/detector.mjs +11 -13
  82. package/dist/build/source-maps/providers/source-control/detector.mjs.map +1 -1
  83. package/dist/build/source-maps/providers/source-control/git.d.mts.map +1 -1
  84. package/dist/build/source-maps/providers/source-control/git.mjs +5 -8
  85. package/dist/build/source-maps/providers/source-control/git.mjs.map +1 -1
  86. package/dist/build/source-maps/providers/source-control/types.d.mts +5 -3
  87. package/dist/build/source-maps/providers/source-control/types.d.mts.map +1 -1
  88. package/dist/build/with-interfere.d.mts +25 -3
  89. package/dist/build/with-interfere.d.mts.map +1 -1
  90. package/dist/build/with-interfere.mjs +131 -24
  91. package/dist/build/with-interfere.mjs.map +1 -1
  92. package/dist/client/auto-init.d.mts +91 -0
  93. package/dist/client/auto-init.d.mts.map +1 -0
  94. package/dist/client/auto-init.mjs +121 -0
  95. package/dist/client/auto-init.mjs.map +1 -0
  96. package/dist/client/provider.d.mts +3 -3
  97. package/dist/client/provider.d.mts.map +1 -1
  98. package/dist/client/provider.mjs +21 -8
  99. package/dist/client/provider.mjs.map +1 -1
  100. package/dist/lib/env.d.mts.map +1 -1
  101. package/dist/lib/types.d.mts +6 -6
  102. package/dist/lib/types.d.mts.map +1 -1
  103. package/dist/lib/types.mjs.map +1 -1
  104. package/dist/server/auto-init.d.mts +88 -0
  105. package/dist/server/auto-init.d.mts.map +1 -0
  106. package/dist/server/auto-init.mjs +101 -0
  107. package/dist/server/auto-init.mjs.map +1 -0
  108. package/dist/server/middleware.d.mts.map +1 -1
  109. package/dist/server/middleware.mjs +20 -13
  110. package/dist/server/middleware.mjs.map +1 -1
  111. package/dist/server/on-request-error.d.mts +27 -0
  112. package/dist/server/on-request-error.d.mts.map +1 -0
  113. package/dist/server/on-request-error.mjs +74 -0
  114. package/dist/server/on-request-error.mjs.map +1 -0
  115. package/dist/server/proxy.d.mts.map +1 -1
  116. package/dist/server/proxy.mjs +4 -5
  117. package/dist/server/proxy.mjs.map +1 -1
  118. package/dist/server/route-handler.d.mts +31 -1
  119. package/dist/server/route-handler.d.mts.map +1 -1
  120. package/dist/server/route-handler.mjs +78 -79
  121. package/dist/server/route-handler.mjs.map +1 -1
  122. package/dist/server/sdk.d.mts +96 -0
  123. package/dist/server/sdk.d.mts.map +1 -0
  124. package/dist/server/sdk.mjs +152 -0
  125. package/dist/server/sdk.mjs.map +1 -0
  126. package/dist/server/services/config.service.d.mts +33 -6
  127. package/dist/server/services/config.service.d.mts.map +1 -1
  128. package/dist/server/services/config.service.mjs +54 -30
  129. package/dist/server/services/config.service.mjs.map +1 -1
  130. package/dist/server/services/error-tracking.service.d.mts +3 -3
  131. package/dist/server/services/error-tracking.service.d.mts.map +1 -1
  132. package/dist/server/services/error-tracking.service.mjs +5 -3
  133. package/dist/server/services/error-tracking.service.mjs.map +1 -1
  134. package/dist/server/session-context.d.mts +60 -0
  135. package/dist/server/session-context.d.mts.map +1 -0
  136. package/dist/server/session-context.mjs +62 -0
  137. package/dist/server/session-context.mjs.map +1 -0
  138. package/package.json +58 -34
  139. package/dist/build/secret-key.d.mts +0 -10
  140. package/dist/build/secret-key.d.mts.map +0 -1
  141. package/dist/build/secret-key.mjs +0 -16
  142. package/dist/build/secret-key.mjs.map +0 -1
  143. package/dist/lib/test-utils/make-next-request.d.mts +0 -6
  144. package/dist/lib/test-utils/make-next-request.d.mts.map +0 -1
  145. package/dist/lib/test-utils/make-next-request.mjs +0 -12
  146. package/dist/lib/test-utils/make-next-request.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"release-program.mjs","names":[],"sources":["../../src/build/release-program.ts"],"sourcesContent":["import { Effect, Layer } from \"effect\";\nimport type { PreflightConfig } from \"../lib/types.js\";\nimport { resolveApiUrl } from \"./env-config.js\";\nimport {\n logBuildResult,\n withBufferedBuildLog,\n} from \"./logger.js\";\nimport {\n ConfigService,\n ConfigServiceLive,\n} from \"./services/config.service.js\";\nimport {\n ReleaseIdentityService,\n ReleaseIdentityServiceLive,\n} from \"./services/release-identity.service.js\";\nimport { SourceMapService, SourceMapServiceLive } from \"./services/source-map.service.js\";\nimport { createRelease } from \"./source-maps/api.js\";\nimport { maybeCleanupAfterFailure } from \"./source-maps/files.js\";\n\n/**\n * The main release upload program.\n * This is a single Effect that orchestrates the entire release process.\n */\nexport const releaseProgram = Effect.gen(function* () {\n const config = yield* ConfigService;\n\n // Early exits\n if (process.env.NODE_ENV === \"development\") {\n yield* logBuildResult(\"Info\", \"Skipping Release\", [\"Development build detected\"]);\n return;\n }\n\n if (!config.enabled) {\n yield* logBuildResult(\n \"Warning\",\n \"Skipping Release\",\n [\"Interfere is disabled. (`interfere.enabled` is `false` in your `next.config.(js|ts)`)\"]\n );\n return;\n }\n\n const sourceMapService = yield* SourceMapService;\n\n if (!config.secretKey) {\n yield* logBuildResult(\n \"Warning\",\n \"Skipping Release\",\n [\"Missing secret key. Please set the `INTERFERE_SECRET_KEY` environment variable.\"]\n );\n return;\n }\n\n // Get release identity (will fail if can't determine)\n yield* Effect.logDebug(\"Getting release identity\");\n const identityStart = Date.now();\n const identityEffect = yield* ReleaseIdentityService;\n const identity = yield* identityEffect;\n yield* Effect.logDebug(`Release identity resolved in ${Date.now() - identityStart}ms`);\n\n // Check for required metadata\n if (!identity.sourceControl) {\n yield* logBuildResult(\n \"Warning\",\n \"Skipping Release\",\n [\n \"Could not determine source control metadata (no supported VCS provider detected).\",\n \"Ensure your CI checks out the git repository and that a supported provider is configured.\",\n ]\n );\n return;\n }\n\n if (!identity.deployment) {\n yield* logBuildResult(\n \"Warning\",\n \"Skipping Release\",\n [\n \"Could not determine deployment metadata (no supported deployment provider detected).\",\n \"If this is a local build you can ignore this. Otherwise, expose your platform's system env vars (e.g. VERCEL_*).\",\n ]\n );\n return;\n }\n\n // Find source maps\n yield* Effect.logDebug(\"Finding source maps\");\n const findStart = Date.now();\n const sourceMapFiles = yield* sourceMapService.find;\n yield* Effect.logDebug(`Found ${sourceMapFiles.length} source maps in ${Date.now() - findStart}ms`);\n\n if (sourceMapFiles.length === 0) {\n yield* logBuildResult(\n \"Warning\",\n \"Skipping Release\",\n [\"No source maps found. Is `productionBrowserSourceMaps` set to `false` in your `next.config.js`?\"]\n );\n return;\n }\n\n // Create release\n yield* Effect.logDebug(\"Creating release\");\n const createStart = Date.now();\n const releaseResponse = yield* createRelease(config, {\n environment: config.environment,\n sourceId: identity.buildId,\n sourceType: identity.sourceControl.type,\n sourceMetadata: identity.sourceControl.metadata,\n destinationType: identity.deployment.type,\n destinationMetadata: identity.deployment.metadata,\n });\n yield* Effect.logDebug(`Release created in ${Date.now() - createStart}ms`);\n\n // Read and upload source maps\n yield* Effect.logDebug(\"Reading source maps\");\n const readStart = Date.now();\n const sourceMaps = yield* sourceMapService.read(sourceMapFiles);\n yield* Effect.logDebug(`Read ${sourceMaps.length} source maps in ${Date.now() - readStart}ms`);\n \n yield* Effect.logDebug(\"Uploading source maps\");\n const uploadStart = Date.now();\n yield* sourceMapService.upload(sourceMaps, {\n ...releaseResponse,\n apiUrl: resolveApiUrl(),\n });\n yield* Effect.logDebug(`Source maps uploaded in ${Date.now() - uploadStart}ms`);\n\n // Cleanup\n yield* Effect.logDebug(\"Cleaning up source maps\");\n const cleanupStart = Date.now();\n yield* sourceMapService.cleanup(sourceMapFiles, !!config.debug);\n yield* Effect.logDebug(`Cleanup completed in ${Date.now() - cleanupStart}ms`);\n}).pipe(\n Effect.catchIf(\n // Only catch upload-related errors, let identity errors propagate\n (error) =>\n error._tag !== \"MissingBuildIdError\" &&\n error._tag !== \"MissingReleaseIdError\",\n (error) =>\n withBufferedBuildLog(\"Error\", \"Failed to upload source maps\", (log) =>\n Effect.gen(function* () {\n const config = yield* ConfigService;\n\n // Queue up build log lines so they appear in a single structured block\n yield* log(String(error));\n\n // Cleanup on failure\n if (\n config.environment === \"production\" &&\n config.cleanupSourceMaps !== false\n ) {\n yield* maybeCleanupAfterFailure(!!config.debug);\n }\n\n // Swallow the error so we don't surface a noisy FiberFailure stack trace\n return;\n })\n )\n ),\n Effect.withSpan(\"interfere.release\")\n);\n\n/**\n * Create the layer stack for the release program\n */\nexport const createReleaseLayers = (config: PreflightConfig) => {\n const configLayer = ConfigServiceLive(config);\n\n const identityLayer = ReleaseIdentityServiceLive;\n \n const sourceMapLayer = SourceMapServiceLive.pipe(\n Layer.provide(configLayer)\n );\n \n return Layer.mergeAll(\n configLayer,\n identityLayer,\n sourceMapLayer\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AAuBA,MAAa,iBAAiB,OAAO,IAAI,aAAa;CACpD,MAAM,SAAS,OAAO;AAGtB,KAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,SAAO,eAAe,QAAQ,oBAAoB,CAAC,6BAA6B,CAAC;AACjF;;AAGF,KAAI,CAAC,OAAO,SAAS;AACnB,SAAO,eACL,WACA,oBACA,CAAC,wFAAwF,CAC1F;AACD;;CAGF,MAAM,mBAAmB,OAAO;AAEhC,KAAI,CAAC,OAAO,WAAW;AACrB,SAAO,eACL,WACA,oBACA,CAAC,kFAAkF,CACpF;AACD;;AAIF,QAAO,OAAO,SAAS,2BAA2B;CAClD,MAAM,gBAAgB,KAAK,KAAK;CAEhC,MAAM,WAAW,OADM,OAAO;AAE9B,QAAO,OAAO,SAAS,gCAAgC,K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AAe,KAAK,KAAK;AAC/B,QAAO,iBAAiB,QAAQ,gBAAgB,CAAC,CAAC,OAAO,MAAM;AAC/D,QAAO,OAAO,SAAS,wBAAwB,KAAK,KAAK,GAAG,aAAa,IAAI;EAC7E,CAAC,KACD,OAAO,SAEJ,UACC,MAAM,SAAS,yBACf,MAAM,SAAS,0BAChB,UACC,qBAAqB,SAAS,iCAAiC,QAC7D,OAAO,IAAI,aAAa;CACtB,MAAM,SAAS,OAAO;AAGtB,QAAO,IAAI,OAAO,MAAM,CAAC;AAGzB,KACE,OAAO,gBAAgB,gBACvB,OAAO,sBAAsB,MAE7B,QAAO,yBAAyB,CAAC,CAAC,OAAO,MAAM;EAKjD,CACH,CACJ,EACD,OAAO,SAAS,oBAAoB,CACrC;;;;AAKD,MAAa,uBAAuB,WAA4B;CAC9D,MAAM,cAAc,kBAAkB,OAAO;CAE7C,MAAM,gBAAgB;CAEtB,MAAM,iBAAiB,qBAAqB,KAC1C,MAAM,QAAQ,YAAY,CAC3B;AAED,QAAO,MAAM,SACX,aACA,eACA,eACD"}
1
+ {"version":3,"file":"release-program.mjs","names":[],"sources":["../../src/build/release-program.ts"],"sourcesContent":["import { Effect, Layer } from \"effect\";\nimport type { PreflightConfig } from \"../lib/types.js\";\nimport { resolveApiUrl } from \"./env-config.js\";\nimport {\n logBuildResult,\n withBufferedBuildLog,\n} from \"./logger.js\";\nimport {\n ConfigService,\n ConfigServiceLive,\n} from \"./services/config.service.js\";\nimport {\n ReleaseIdentityService,\n ReleaseIdentityServiceLive,\n} from \"./services/release-identity.service.js\";\nimport {\n ReleaseApiService,\n ReleaseApiServiceLive,\n} from \"./services/release-api.service.js\";\nimport { SourceMapService, SourceMapServiceLive } from \"./services/source-map.service.js\";\nimport {\n SourceMapFailureCleanupService,\n SourceMapFailureCleanupServiceLive,\n} from \"./services/source-map-failure-cleanup.service.js\";\n\n/**\n * The main release upload program.\n * This is a single Effect that orchestrates the entire release process.\n */\nexport const releaseProgram = Effect.gen(function* () {\n const config = yield* ConfigService;\n\n // Early exits\n if (process.env.NODE_ENV === \"development\") {\n yield* logBuildResult(\"Info\", \"Skipping Release\", [\"Development build detected\"]);\n return;\n }\n\n if (!config.enabled) {\n yield* logBuildResult(\n \"Warning\",\n \"Skipping Release\",\n [\"Interfere is disabled. (`interfere.enabled` is `false` in your `next.config.(js|ts)`)\"]\n );\n return;\n }\n\n const sourceMapService = yield* SourceMapService;\n\n if (!config.apiKey) {\n yield* logBuildResult(\n \"Warning\",\n \"Skipping Release\",\n [\"Missing API key. Please set the `INTERFERE_API_KEY` environment variable.\"]\n );\n return;\n }\n\n // Get release identity (will fail if can't determine)\n yield* Effect.logDebug(\"Getting release identity\");\n const identityStart = Date.now();\n const identityEffect = yield* ReleaseIdentityService;\n const identity = yield* identityEffect;\n yield* Effect.logDebug(`Release identity resolved in ${Date.now() - identityStart}ms`);\n\n // Check for required metadata\n if (!identity.sourceControl) {\n yield* logBuildResult(\n \"Warning\",\n \"Skipping Release\",\n [\n \"Could not determine source control metadata (no supported VCS provider detected).\",\n \"Ensure your CI checks out the git repository and that a supported provider is configured.\",\n ]\n );\n return;\n }\n\n if (!identity.deployment) {\n yield* logBuildResult(\n \"Warning\",\n \"Skipping Release\",\n [\n \"Could not determine deployment metadata (no supported deployment provider detected).\",\n \"If this is a local build you can ignore this. Otherwise, expose your platform's system env vars (e.g. VERCEL_*).\",\n ]\n );\n return;\n }\n\n // Find source maps\n yield* Effect.logDebug(\"Finding source maps\");\n const findStart = Date.now();\n const sourceMapFiles = yield* sourceMapService.find;\n yield* Effect.logDebug(`Found ${sourceMapFiles.length} source maps in ${Date.now() - findStart}ms`);\n\n if (sourceMapFiles.length === 0) {\n yield* logBuildResult(\n \"Warning\",\n \"Skipping Release\",\n [\"No source maps found. Is `productionBrowserSourceMaps` set to `false` in your `next.config.js`?\"]\n );\n return;\n }\n\n // Create release\n yield* Effect.logDebug(\"Creating release\");\n const createStart = Date.now();\n const releaseApi = yield* ReleaseApiService;\n const releaseResponse = yield* releaseApi.createRelease(config, {\n environment: config.environment,\n sourceId: identity.buildId,\n sourceMetadata: identity.sourceControl?.metadata,\n destinationMetadata: identity.deployment?.metadata,\n });\n yield* Effect.logDebug(`Release created in ${Date.now() - createStart}ms`);\n\n // Read and upload source maps\n yield* Effect.logDebug(\"Reading source maps\");\n const readStart = Date.now();\n const sourceMaps = yield* sourceMapService.read(sourceMapFiles);\n yield* Effect.logDebug(`Read ${sourceMaps.length} source maps in ${Date.now() - readStart}ms`);\n \n yield* Effect.logDebug(\"Uploading source maps\");\n const uploadStart = Date.now();\n yield* sourceMapService.upload(sourceMaps, {\n ...releaseResponse,\n apiUrl: resolveApiUrl(),\n });\n yield* Effect.logDebug(`Source maps uploaded in ${Date.now() - uploadStart}ms`);\n\n // Cleanup\n yield* Effect.logDebug(\"Cleaning up source maps\");\n const cleanupStart = Date.now();\n yield* sourceMapService.cleanup(sourceMapFiles, !!config.debug);\n yield* Effect.logDebug(`Cleanup completed in ${Date.now() - cleanupStart}ms`);\n}).pipe(\n Effect.catchIf(\n // Only catch upload-related errors, let identity errors propagate\n (error) =>\n error._tag !== \"MissingBuildIdError\" &&\n error._tag !== \"MissingReleaseIdError\",\n (error) =>\n withBufferedBuildLog(\"Error\", \"Failed to upload source maps\", Effect.fn(\"handleUploadError\")(function* (log) {\n const config = yield* ConfigService;\n const failureCleanup = yield* SourceMapFailureCleanupService;\n\n // Queue up build log lines so they appear in a single structured block\n yield* log(String(error));\n\n // Cleanup on failure\n if (\n config.environment === \"production\" &&\n config.cleanupSourceMaps !== false\n ) {\n yield* failureCleanup.maybeCleanupAfterFailure(!!config.debug);\n }\n\n // Swallow the error so we don't surface a noisy FiberFailure stack trace\n return;\n }))\n ),\n Effect.withSpan(\"interfere.release\")\n);\n\n/**\n * Create the layer stack for the release program\n */\nexport const createReleaseLayers = (config: PreflightConfig) => {\n const configLayer = ConfigServiceLive(config);\n\n const identityLayer = ReleaseIdentityServiceLive;\n \n const sourceMapLayer = SourceMapServiceLive.pipe(\n Layer.provide(configLayer)\n );\n \n return Layer.mergeAll(\n configLayer,\n identityLayer,\n sourceMapLayer,\n ReleaseApiServiceLive,\n SourceMapFailureCleanupServiceLive\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AA6BA,MAAa,iBAAiB,OAAO,IAAI,aAAa;CACpD,MAAM,SAAS,OAAO;AAGtB,KAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,SAAO,eAAe,QAAQ,oBAAoB,CAAC,6BAA6B,CAAC;AACjF;;AAGF,KAAI,CAAC,OAAO,SAAS;AACnB,SAAO,eACL,WACA,oBACA,CAAC,wFAAwF,CAC1F;AACD;;CAGF,MAAM,mBAAmB,OAAO;AAEhC,KAAI,CAAC,OAAO,QAAQ;AAClB,SAAO,eACL,WACA,oBACA,CAAC,4EAA4E,CAC9E;AACD;;AAIF,QAAO,OAAO,SAAS,2BAA2B;CAClD,MAAM,gBAAgB,KAAK,KAAK;CAEhC,MAAM,WAAW,OADM,OAAO;AAE9B,QAAO,OAAO,SAAS,gCAAgC,KAAK,KAAK,GAAG,cAAc,IAAI;AAGtF,KAAI,CAAC,SAAS,eAAe;AAC3B,SAAO,eACL,WACA,oBACA,CACE,qFACA,4FACD,CACF;AACD;;AAGF,KAAI,CAAC,SAAS,YAAY;AACxB,SAAO,eACL,WACA,oBACA,CACE,wFACA,mHACD,CACF;AACD;;AAIF,QAAO,OAAO,SAAS,sBAAsB;CAC7C,MAAM,YAAY,KAAK,KAAK;CAC5B,MAAM,iBAAiB,OAAO,iBAAiB;AAC/C,QAAO,OAAO,SAAS,SAAS,eAAe,OAAO,kBAAkB,KAAK,KAAK,GAAG,UAAU,IAAI;AAEnG,KAAI,eAAe,WAAW,GAAG;AAC/B,SAAO,eACL,WACA,oBACA,CAAC,kGAAkG,CACpG;AACD;;AAIF,QAAO,OAAO,SAAS,mBAAmB;CAC1C,MAAM,cAAc,KAAK,KAAK;CAE9B,MAAM,kBAAkB,QADL,OAAO,mBACgB,cAAc,Q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iBAAiB,qBAAqB,KAC1C,MAAM,QAAQ,YAAY,CAC3B;AAED,QAAO,MAAM,SACX,aACA,eACA,gBACA,uBACA,mCACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"config.service.d.mts","names":[],"sources":["../../../src/build/services/config.service.ts"],"sourcesContent":[],"mappings":";;;;cAC0E;cAE7D,aAAA,SAAsB,kBAAA;cAKtB,4BAA6B,oBAAe,KAAA,CAAA,MAAA"}
1
+ {"version":3,"file":"config.service.d.mts","names":[],"sources":["../../../src/build/services/config.service.ts"],"mappings":";;;;cAC0D,kBAAA;cAE7C,aAAA,SAAsB,kBAAA;AAAA,cAKtB,iBAAA,GAAqB,MAAA,EAAQ,eAAA,KAAe,KAAA,CAAA,KAAA,CAAA,aAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"config.service.mjs","names":[],"sources":["../../../src/build/services/config.service.ts"],"sourcesContent":["import { Context, Layer } from \"effect\";\nimport type { NonEmptyString, PreflightConfig } from \"../../lib/types.js\";\n\nexport class ConfigService extends Context.Tag(\"ConfigService\")<\n ConfigService,\n PreflightConfig\n>() {}\n\nexport const ConfigServiceLive = (config: PreflightConfig) =>\n Layer.succeed(ConfigService, config);\n"],"mappings":";;;AAGA,IAAa,gBAAb,cAAmC,QAAQ,IAAI,gBAAgB,EAG5D,CAAC;AAEJ,MAAa,qBAAqB,WAChC,MAAM,QAAQ,eAAe,OAAO"}
1
+ {"version":3,"file":"config.service.mjs","names":[],"sources":["../../../src/build/services/config.service.ts"],"sourcesContent":["import { Context, Layer } from \"effect\";\nimport type { PreflightConfig } from \"../../lib/types.js\";\n\nexport class ConfigService extends Context.Tag(\"ConfigService\")<\n ConfigService,\n PreflightConfig\n>() {}\n\nexport const ConfigServiceLive = (config: PreflightConfig) =>\n Layer.succeed(ConfigService, config);\n"],"mappings":";;;AAGA,IAAa,gBAAb,cAAmC,QAAQ,IAAI,gBAAgB,EAG5D,CAAC;AAEJ,MAAa,qBAAqB,WAChC,MAAM,QAAQ,eAAe,OAAO"}
@@ -0,0 +1,19 @@
1
+ //#region src/build/services/instrumentation-detection.service.d.ts
2
+ interface InstrumentationFiles {
3
+ readonly server: string | null;
4
+ readonly client: string | null;
5
+ }
6
+ interface InstrumentationValidation {
7
+ readonly hasFile: boolean;
8
+ readonly hasRegisterFunction: boolean;
9
+ readonly hasOnRequestError: boolean;
10
+ readonly filePath: string | null;
11
+ }
12
+ declare function detectInstrumentationFilesSync(projectDir?: string): InstrumentationFiles;
13
+ declare function validateInstrumentationContent(filePath: string | null): InstrumentationValidation;
14
+ declare function detectAndValidateInstrumentationSync(projectDir?: string): {
15
+ files: InstrumentationFiles;
16
+ serverValidation: InstrumentationValidation;
17
+ };
18
+ //#endregion
19
+ export { InstrumentationFiles, InstrumentationValidation, detectAndValidateInstrumentationSync, detectInstrumentationFilesSync, validateInstrumentationContent };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instrumentation-detection.service.d.mts","names":[],"sources":["../../../src/build/services/instrumentation-detection.service.ts"],"mappings":";UAGiB,oBAAA;EAAA,SACN,MAAA;EAAA,SACA,MAAA;AAAA;AAAA,UAGM,yBAAA;EAAA,SACN,OAAA;EAAA,SACA,mBAAA;EAAA,SACA,iBAAA;EAAA,SACA,QAAA;AAAA;AAAA,iBA6CK,8BAAA,CACd,UAAA,YACC,oBAAA;AAAA,iBAca,8BAAA,CACd,QAAA,kBACC,yBAAA;AAAA,iBAsCa,oCAAA,CAAqC,UAAA;EACnD,KAAA,EAAO,oBAAA;EACP,gBAAA,EAAkB,yBAAA;AAAA"}
@@ -0,0 +1,77 @@
1
+ import * as path$1 from "node:path";
2
+ import * as fs from "node:fs";
3
+
4
+ //#region src/build/services/instrumentation-detection.service.ts
5
+ const INSTRUMENTATION_SERVER_FILES = [
6
+ "instrumentation.ts",
7
+ "instrumentation.js",
8
+ "instrumentation.mts",
9
+ "instrumentation.mjs"
10
+ ];
11
+ const INSTRUMENTATION_CLIENT_FILES = [
12
+ "instrumentation-client.ts",
13
+ "instrumentation-client.js",
14
+ "instrumentation-client.mts",
15
+ "instrumentation-client.mjs"
16
+ ];
17
+ const SEARCH_DIRECTORIES = ["", "src"];
18
+ const REGISTER_EXPORT_PATTERNS = [
19
+ /export\s+(async\s+)?function\s+register\s*\(/,
20
+ /export\s+const\s+register\s*=\s*(async\s*)?\(/,
21
+ /export\s+const\s+register\s*=\s*(async\s+)?function/
22
+ ];
23
+ const ON_REQUEST_ERROR_EXPORT_PATTERNS = [/export\s+(async\s+)?function\s+onRequestError\s*\(/, /export\s+const\s+onRequestError\s*[=:]/];
24
+ function findInstrumentationFile(projectDir, fileNames) {
25
+ for (const dir of SEARCH_DIRECTORIES) for (const fileName of fileNames) {
26
+ const filePath = path$1.join(projectDir, dir, fileName);
27
+ if (fs.existsSync(filePath)) return path$1.resolve(filePath);
28
+ }
29
+ return null;
30
+ }
31
+ function detectInstrumentationFilesSync(projectDir) {
32
+ const dir = projectDir ?? process.cwd();
33
+ const resolvedDir = path$1.resolve(dir);
34
+ if (!fs.existsSync(resolvedDir)) return {
35
+ server: null,
36
+ client: null
37
+ };
38
+ return {
39
+ server: findInstrumentationFile(resolvedDir, INSTRUMENTATION_SERVER_FILES),
40
+ client: findInstrumentationFile(resolvedDir, INSTRUMENTATION_CLIENT_FILES)
41
+ };
42
+ }
43
+ function validateInstrumentationContent(filePath) {
44
+ if (!filePath || !fs.existsSync(filePath)) return {
45
+ hasFile: false,
46
+ hasRegisterFunction: false,
47
+ hasOnRequestError: false,
48
+ filePath: null
49
+ };
50
+ let content;
51
+ try {
52
+ content = fs.readFileSync(filePath, "utf-8");
53
+ } catch {
54
+ return {
55
+ hasFile: true,
56
+ hasRegisterFunction: false,
57
+ hasOnRequestError: false,
58
+ filePath
59
+ };
60
+ }
61
+ return {
62
+ hasFile: true,
63
+ hasRegisterFunction: REGISTER_EXPORT_PATTERNS.some((pattern) => pattern.test(content)),
64
+ hasOnRequestError: ON_REQUEST_ERROR_EXPORT_PATTERNS.some((pattern) => pattern.test(content)),
65
+ filePath
66
+ };
67
+ }
68
+ function detectAndValidateInstrumentationSync(projectDir) {
69
+ const files = detectInstrumentationFilesSync(projectDir);
70
+ return {
71
+ files,
72
+ serverValidation: validateInstrumentationContent(files.server)
73
+ };
74
+ }
75
+
76
+ //#endregion
77
+ export { detectAndValidateInstrumentationSync, detectInstrumentationFilesSync, validateInstrumentationContent };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instrumentation-detection.service.mjs","names":["path"],"sources":["../../../src/build/services/instrumentation-detection.service.ts"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n\nexport interface InstrumentationFiles {\n readonly server: string | null;\n readonly client: string | null;\n}\n\nexport interface InstrumentationValidation {\n readonly hasFile: boolean;\n readonly hasRegisterFunction: boolean;\n readonly hasOnRequestError: boolean;\n readonly filePath: string | null;\n}\n\nconst INSTRUMENTATION_SERVER_FILES = [\n \"instrumentation.ts\",\n \"instrumentation.js\",\n \"instrumentation.mts\",\n \"instrumentation.mjs\",\n] as const;\n\nconst INSTRUMENTATION_CLIENT_FILES = [\n \"instrumentation-client.ts\",\n \"instrumentation-client.js\",\n \"instrumentation-client.mts\",\n \"instrumentation-client.mjs\",\n] as const;\n\nconst SEARCH_DIRECTORIES = [\"\", \"src\"] as const;\n\nconst REGISTER_EXPORT_PATTERNS = [\n /export\\s+(async\\s+)?function\\s+register\\s*\\(/,\n /export\\s+const\\s+register\\s*=\\s*(async\\s*)?\\(/,\n /export\\s+const\\s+register\\s*=\\s*(async\\s+)?function/,\n];\n\nconst ON_REQUEST_ERROR_EXPORT_PATTERNS = [\n /export\\s+(async\\s+)?function\\s+onRequestError\\s*\\(/,\n /export\\s+const\\s+onRequestError\\s*[=:]/,\n];\n\nfunction findInstrumentationFile(\n projectDir: string,\n fileNames: readonly string[]\n): string | null {\n for (const dir of SEARCH_DIRECTORIES) {\n for (const fileName of fileNames) {\n const filePath = path.join(projectDir, dir, fileName);\n if (fs.existsSync(filePath)) {\n return path.resolve(filePath);\n }\n }\n }\n return null;\n}\n\nexport function detectInstrumentationFilesSync(\n projectDir?: string\n): InstrumentationFiles {\n const dir = projectDir ?? process.cwd();\n const resolvedDir = path.resolve(dir);\n\n if (!fs.existsSync(resolvedDir)) {\n return { server: null, client: null };\n }\n\n return {\n server: findInstrumentationFile(resolvedDir, INSTRUMENTATION_SERVER_FILES),\n client: findInstrumentationFile(resolvedDir, INSTRUMENTATION_CLIENT_FILES),\n };\n}\n\nexport function validateInstrumentationContent(\n filePath: string | null\n): InstrumentationValidation {\n if (!filePath || !fs.existsSync(filePath)) {\n return {\n hasFile: false,\n hasRegisterFunction: false,\n hasOnRequestError: false,\n filePath: null,\n };\n }\n\n let content: string;\n try {\n content = fs.readFileSync(filePath, \"utf-8\");\n } catch {\n return {\n hasFile: true,\n hasRegisterFunction: false,\n hasOnRequestError: false,\n filePath,\n };\n }\n\n const hasRegisterFunction = REGISTER_EXPORT_PATTERNS.some((pattern) =>\n pattern.test(content)\n );\n\n const hasOnRequestError = ON_REQUEST_ERROR_EXPORT_PATTERNS.some((pattern) =>\n pattern.test(content)\n );\n\n return {\n hasFile: true,\n hasRegisterFunction,\n hasOnRequestError,\n filePath,\n };\n}\n\nexport function detectAndValidateInstrumentationSync(projectDir?: string): {\n files: InstrumentationFiles;\n serverValidation: InstrumentationValidation;\n} {\n const files = detectInstrumentationFilesSync(projectDir);\n const serverValidation = validateInstrumentationContent(files.server);\n\n return { files, serverValidation };\n}\n"],"mappings":";;;;AAeA,MAAM,+BAA+B;CACnC;CACA;CACA;CACA;CACD;AAED,MAAM,+BAA+B;CACnC;CACA;CACA;CACA;CACD;AAED,MAAM,qBAAqB,CAAC,IAAI,MAAM;AAEtC,MAAM,2BAA2B;CAC/B;CACA;CACA;CACD;AAED,MAAM,mCAAmC,CACvC,sDACA,yCACD;AAED,SAAS,wBACP,YACA,WACe;AACf,MAAK,MAAM,OAAO,mBAChB,MAAK,MAAM,YAAY,WAAW;EAChC,MAAM,WAAWA,OAAK,KAAK,YAAY,KAAK,SAAS;AACrD,MAAI,GAAG,WAAW,SAAS,CACzB,QAAOA,OAAK,QAAQ,SAAS;;AAInC,QAAO;;AAGT,SAAgB,+BACd,YACsB;CACtB,MAAM,MAAM,cAAc,QAAQ,KAAK;CACvC,MAAM,cAAcA,OAAK,QAAQ,IAAI;AAErC,KAAI,CAAC,GAAG,WAAW,YAAY,CAC7B,QAAO;EAAE,QAAQ;EAAM,QAAQ;EAAM;AAGvC,QAAO;EACL,QAAQ,wBAAwB,aAAa,6BAA6B;EAC1E,QAAQ,wBAAwB,aAAa,6BAA6B;EAC3E;;AAGH,SAAgB,+BACd,UAC2B;AAC3B,KAAI,CAAC,YAAY,CAAC,GAAG,WAAW,SAAS,CACvC,QAAO;EACL,SAAS;EACT,qBAAqB;EACrB,mBAAmB;EACnB,UAAU;EACX;CAGH,IAAI;AACJ,KAAI;AACF,YAAU,GAAG,aAAa,UAAU,QAAQ;SACtC;AACN,SAAO;GACL,SAAS;GACT,qBAAqB;GACrB,mBAAmB;GACnB;GACD;;AAWH,QAAO;EACL,SAAS;EACT,qBAV0B,yBAAyB,MAAM,YACzD,QAAQ,KAAK,QAAQ,CACtB;EASC,mBAPwB,iCAAiC,MAAM,YAC/D,QAAQ,KAAK,QAAQ,CACtB;EAMC;EACD;;AAGH,SAAgB,qCAAqC,YAGnD;CACA,MAAM,QAAQ,+BAA+B,WAAW;AAGxD,QAAO;EAAE;EAAO,kBAFS,+BAA+B,MAAM,OAAO;EAEnC"}
@@ -1,12 +1,11 @@
1
1
  import { NonEmptyString, PreflightConfig } from "../../lib/types.mjs";
2
- import { InvalidSecretKeyError, WithInterfereUsageError } from "../source-maps/errors.mjs";
2
+ import { MissingApiKeyError, WithInterfereUsageError } from "../source-maps/errors.mjs";
3
3
  import { Context, Effect, Layer } from "effect";
4
4
 
5
5
  //#region src/build/services/preflight.service.d.ts
6
6
  declare const PreflightService_base: Context.TagClass<PreflightService, "PreflightService", {
7
7
  readonly validateEnvironment: () => Effect.Effect<void, WithInterfereUsageError>;
8
- readonly validateSecretKey: (key: string | null) => Effect.Effect<NonEmptyString, InvalidSecretKeyError>;
9
- readonly extractSurfaceSlug: (key: NonEmptyString) => Effect.Effect<NonEmptyString, InvalidSecretKeyError>;
8
+ readonly validateApiKey: (key: string | null) => Effect.Effect<NonEmptyString, MissingApiKeyError>;
10
9
  readonly buildConfig: (options: {
11
10
  environment?: string;
12
11
  debug?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"preflight.service.d.mts","names":[],"sources":["../../../src/build/services/preflight.service.ts"],"sourcesContent":[],"mappings":";;;;;cAWkC;sCAKM,MAAA,CAAO,aAAa;EAL1B,SAAA,iBAAA,EAAA,CAAA,GAAA,EAAA,MAAA,GAAA,IAAA,EAAA,GAMsB,MAAA,CAAO,MAN7B,CAMoC,cANpC,EAMoD,qBANpD,CAAA;qCAOK,mBAAmB,MAAA,CAAO,OAAO,gBAAgB;EAF5B,SAAA,WAAA,EAAA,CAAA,OAAA,EAAA;IAAb,WAAA,CAAA,EAAA,MAAA;IACuB,KAAA,CAAA,EAAA,OAAA;IAAgB,iBAAA,CAAA,EAAA,OAAA;EAA9B,CAAA,EAAA,GAM9C,MAAA,CAAO,MAN8C,CAMvC,eANuC,EAMtB,uBANsB,CAAA;CACxB,CAAA;AAAiC,cAL3D,gBAAA,SAAyB,qBAAA,CAKkC;AAAd,cAgF7C,oBAhFoD,EAgFhC,KAAA,CAAA,KAhFgC,CAgFhC,gBAhFgC,EAAA,KAAA,EAAA,KAAA,CAAA"}
1
+ {"version":3,"file":"preflight.service.d.mts","names":[],"sources":["../../../src/build/services/preflight.service.ts"],"mappings":";;;;;cAakC,qBAAA;sCAKM,MAAA,CAAO,MAAA,OAAa,uBAAA;EAAA,0BAC9B,GAAA,oBAAuB,MAAA,CAAO,MAAA,CAAO,cAAA,EAAgB,kBAAA;EAAA,uBACxD,OAAA;IACrB,WAAA;IACA,KAAA;IACA,iBAAA;EAAA,MACI,MAAA,CAAO,MAAA,CAAO,eAAA,EAAiB,uBAAA;AAAA;AAAA,cAT5B,gBAAA,SAAyB,qBAAA;AAAA,cAqDzB,oBAAA,EAAoB,KAAA,CAAA,KAAA,CAAA,gBAAA"}
@@ -1,42 +1,33 @@
1
1
  import { toNonEmptyString } from "../../lib/types.mjs";
2
+ import { normalizeApiKey, resolveApiUrl } from "../env-config.mjs";
3
+ import { fetchSurfaceSlugFromExchange } from "../exchange-surface.mjs";
2
4
  import { logBuildResult } from "../logger.mjs";
3
- import { InvalidSecretKeyError, WithInterfereUsageError } from "../source-maps/errors.mjs";
4
- import { parseSurfaceSlugFromSecretKey } from "../secret-key.mjs";
5
+ import { ExchangeFailedError, MissingApiKeyError, WithInterfereUsageError } from "../source-maps/errors.mjs";
5
6
  import { Context, Effect, Layer } from "effect";
6
7
 
7
8
  //#region src/build/services/preflight.service.ts
8
9
  var PreflightService = class extends Context.Tag("PreflightService")() {};
9
- const validateEnvironment = () => Effect.gen(function* () {
10
- if (typeof window !== "undefined") return yield* Effect.fail(new WithInterfereUsageError({ message: "Security Error: withInterfere must only be used in next.config.js (server-side). It should never be imported in client-side code." }));
11
- if (typeof process === "undefined" || !process.versions?.node) return yield* Effect.fail(new WithInterfereUsageError({ message: "Security Error: withInterfere requires Node.js environment. It should only run during build time, not in the browser." }));
12
- if (typeof process.env.INTERFERE_SECRET_KEY === "string" && process.env.INTERFERE_SECRET_KEY.startsWith("NEXT_PUBLIC_")) return yield* Effect.fail(new WithInterfereUsageError({ message: "Security Error: Secret key should NOT use NEXT_PUBLIC_ prefix. Use INTERFERE_SECRET_KEY instead to keep it server-side only." }));
10
+ const validateEnvironment = Effect.fn("validateEnvironment")(function* () {
11
+ if (typeof window !== "undefined") return yield* new WithInterfereUsageError({ message: "Security Error: withInterfere must only be used in next.config.js (server-side). It should never be imported in client-side code." });
12
+ if (typeof process === "undefined" || !process.versions?.node) return yield* new WithInterfereUsageError({ message: "Security Error: withInterfere requires Node.js environment. It should only run during build time, not in the browser." });
13
+ if (typeof process.env.INTERFERE_API_KEY === "string" && process.env.INTERFERE_API_KEY.startsWith("NEXT_PUBLIC_")) return yield* new WithInterfereUsageError({ message: "Security Error: API key should NOT use NEXT_PUBLIC_ prefix. Use INTERFERE_API_KEY instead to keep it server-side only." });
13
14
  });
14
- const validateSecretKey = (raw) => Effect.gen(function* () {
15
- if (typeof raw !== "string") return yield* Effect.fail(new InvalidSecretKeyError({ message: "Missing secret key. Set the INTERFERE_SECRET_KEY environment variable" }));
16
- const result = toNonEmptyString(raw.trim().replace(/^['"]|['"]$/g, ""));
17
- if (!result) return yield* Effect.fail(new InvalidSecretKeyError({ message: "Invalid secret key. Set the INTERFERE_SECRET_KEY environment variable" }));
18
- return result;
19
- });
20
- const extractSurfaceSlug = (secretKey) => Effect.gen(function* () {
21
- const parsed = parseSurfaceSlugFromSecretKey(secretKey);
22
- const result = parsed ? toNonEmptyString(parsed) : void 0;
23
- if (!result) return yield* Effect.fail(new InvalidSecretKeyError({ message: "Invalid secret key format. Please use the secret key provided in your Interfere dashboard." }));
15
+ const validateApiKey = Effect.fn("validateApiKey")(function* (_raw) {
16
+ const result = normalizeApiKey(process.env.INTERFERE_API_KEY);
17
+ if (!result) return yield* new MissingApiKeyError({ message: "Missing API key. Set INTERFERE_API_KEY in your environment." });
24
18
  return result;
25
19
  });
26
20
  const PreflightServiceLive = Layer.succeed(PreflightService, {
27
21
  validateEnvironment,
28
- validateSecretKey,
29
- extractSurfaceSlug,
30
- buildConfig: (options) => Effect.gen(function* () {
22
+ validateApiKey,
23
+ buildConfig: Effect.fn("buildConfig")(function* (options) {
31
24
  yield* validateEnvironment();
32
- const secretKeyRaw = process.env.INTERFERE_SECRET_KEY;
33
- const secretKeyResult = yield* validateSecretKey(secretKeyRaw ?? null).pipe(Effect.either);
34
- if (secretKeyResult._tag === "Left") {
35
- const message = secretKeyResult.left.message;
36
- yield* logBuildResult("Warning", "Interfere disabled (invalid secret key)", [
37
- message,
25
+ const apiKeyResult = yield* validateApiKey(null).pipe(Effect.either);
26
+ if (apiKeyResult._tag === "Left") {
27
+ yield* logBuildResult("Warning", "Interfere disabled (missing API key)", [
28
+ apiKeyResult.left.message,
38
29
  "Source maps will not be uploaded for this build.",
39
- "Set a valid INTERFERE_SECRET_KEY in your environment to enable Interfere."
30
+ "Set INTERFERE_API_KEY in your environment to enable Interfere. Ensure you are using the correct key."
40
31
  ]);
41
32
  return {
42
33
  enabled: false,
@@ -45,15 +36,15 @@ const PreflightServiceLive = Layer.succeed(PreflightService, {
45
36
  cleanupSourceMaps: options.cleanupSourceMaps ?? true
46
37
  };
47
38
  }
48
- const secretKey = secretKeyResult.right;
49
- const surfaceSlugResult = yield* extractSurfaceSlug(secretKey).pipe(Effect.either);
50
- if (surfaceSlugResult._tag === "Left") {
51
- const message = surfaceSlugResult.left.message;
52
- yield* logBuildResult("Warning", "Interfere disabled (invalid secret key format)", [
53
- message,
54
- "Source maps will not be uploaded for this build.",
55
- "Please use the secret key provided in your Interfere dashboard."
56
- ]);
39
+ const surfaceResult = yield* Effect.tryPromise({
40
+ try: () => fetchSurfaceSlugFromExchange(resolveApiUrl(), apiKeyResult.right),
41
+ catch: (cause) => new ExchangeFailedError({
42
+ message: "exchange failed",
43
+ cause
44
+ })
45
+ }).pipe(Effect.map((s) => s && s.trim() ? toNonEmptyString(s.trim()) : null), Effect.either);
46
+ if (surfaceResult._tag === "Left" || !surfaceResult.right) {
47
+ yield* logBuildResult("Warning", "Interfere disabled (exchange unreachable)", ["Could not reach the API.", "Source maps will not be uploaded for this build."]);
57
48
  return {
58
49
  enabled: false,
59
50
  environment: options.environment || process.env.NODE_ENV,
@@ -63,8 +54,8 @@ const PreflightServiceLive = Layer.succeed(PreflightService, {
63
54
  }
64
55
  return {
65
56
  enabled: true,
66
- surface: surfaceSlugResult.right,
67
- secretKey,
57
+ surface: surfaceResult.right,
58
+ apiKey: apiKeyResult.right,
68
59
  environment: options.environment || process.env.NODE_ENV,
69
60
  debug: options.debug ?? false,
70
61
  cleanupSourceMaps: options.cleanupSourceMaps ?? true
@@ -1 +1 @@
1
- {"version":3,"file":"preflight.service.mjs","names":[],"sources":["../../../src/build/services/preflight.service.ts"],"sourcesContent":["import { Context, Effect, Layer } from \"effect\";\nimport {\n type NonEmptyString,\n type PreflightConfig,\n toNonEmptyString,\n} from \"../../lib/types.js\";\nimport { logBuildResult } from \"../logger.js\";\nimport { parseSurfaceSlugFromSecretKey } from \"../secret-key.js\";\nimport {\n InvalidSecretKeyError,\n WithInterfereUsageError,\n} from \"../source-maps/errors.js\";\n\nexport class PreflightService extends Context.Tag(\"PreflightService\")<\n PreflightService,\n {\n readonly validateEnvironment: () => Effect.Effect<void, WithInterfereUsageError>;\n readonly validateSecretKey: (key: string | null) => Effect.Effect<NonEmptyString, InvalidSecretKeyError>;\n readonly extractSurfaceSlug: (key: NonEmptyString) => Effect.Effect<NonEmptyString, InvalidSecretKeyError>;\n readonly buildConfig: (options: {\n environment?: string;\n debug?: boolean;\n cleanupSourceMaps?: boolean;\n }) => Effect.Effect<PreflightConfig, WithInterfereUsageError>;\n }\n>() {}\n\nconst validateEnvironment = () =>\n Effect.gen(function* () {\n if (typeof window !== \"undefined\") {\n return yield* Effect.fail(\n new WithInterfereUsageError({\n message: \"Security Error: withInterfere must only be used in next.config.js (server-side). It should never be imported in client-side code.\"\n })\n );\n }\n\n if (typeof process === \"undefined\" || !process.versions?.node) {\n return yield* Effect.fail(\n new WithInterfereUsageError({\n message: \"Security Error: withInterfere requires Node.js environment. It should only run during build time, not in the browser.\"\n })\n );\n }\n\n if (\n typeof process.env.INTERFERE_SECRET_KEY === \"string\" &&\n process.env.INTERFERE_SECRET_KEY.startsWith(\"NEXT_PUBLIC_\")\n ) {\n return yield* Effect.fail(\n new WithInterfereUsageError({\n message: \"Security Error: Secret key should NOT use NEXT_PUBLIC_ prefix. Use INTERFERE_SECRET_KEY instead to keep it server-side only.\"\n })\n );\n }\n });\n\nconst validateSecretKey = (raw: string | null) =>\n Effect.gen(function* () {\n if (typeof raw !== \"string\") {\n return yield* Effect.fail(\n new InvalidSecretKeyError(\n { message: \"Missing secret key. Set the INTERFERE_SECRET_KEY environment variable\" }\n )\n );\n }\n\n const trimmed = raw.trim();\n const cleaned = trimmed.replace(/^['\"]|['\"]$/g, \"\");\n const result = toNonEmptyString(cleaned);\n\n if (!result) {\n return yield* Effect.fail(\n new InvalidSecretKeyError(\n { message: \"Invalid secret key. Set the INTERFERE_SECRET_KEY environment variable\" }\n )\n );\n }\n\n return result;\n });\n\nconst extractSurfaceSlug = (secretKey: NonEmptyString) =>\n Effect.gen(function* () {\n const parsed = parseSurfaceSlugFromSecretKey(secretKey);\n const result = parsed ? (toNonEmptyString(parsed) as NonEmptyString) : undefined;\n\n if (!result) {\n return yield* Effect.fail(\n new InvalidSecretKeyError(\n { message: \"Invalid secret key format. Please use the secret key provided in your Interfere dashboard.\" }\n )\n );\n }\n\n return result;\n });\n\nexport const PreflightServiceLive = Layer.succeed(\n PreflightService,\n {\n validateEnvironment,\n validateSecretKey,\n extractSurfaceSlug,\n buildConfig: (options) =>\n Effect.gen(function* () {\n yield* validateEnvironment();\n \n const secretKeyRaw = process.env.INTERFERE_SECRET_KEY;\n \n // Try to get secret key and surface slug\n const secretKeyResult = yield* validateSecretKey(\n secretKeyRaw ?? null\n ).pipe(Effect.either);\n\n if (secretKeyResult._tag === \"Left\") {\n const message = secretKeyResult.left.message;\n\n yield* logBuildResult(\n \"Warning\",\n \"Interfere disabled (invalid secret key)\",\n [\n message,\n \"Source maps will not be uploaded for this build.\",\n \"Set a valid INTERFERE_SECRET_KEY in your environment to enable Interfere.\",\n ]\n );\n\n // Return disabled config if no valid secret key\n return {\n enabled: false as const,\n environment: options.environment || process.env.NODE_ENV,\n debug: options.debug ?? false,\n cleanupSourceMaps: options.cleanupSourceMaps ?? true,\n };\n }\n \n const secretKey = secretKeyResult.right;\n const surfaceSlugResult = yield* extractSurfaceSlug(secretKey).pipe(\n Effect.either\n );\n\n if (surfaceSlugResult._tag === \"Left\") {\n const message = surfaceSlugResult.left.message;\n\n yield* logBuildResult(\n \"Warning\",\n \"Interfere disabled (invalid secret key format)\",\n [\n message,\n \"Source maps will not be uploaded for this build.\",\n \"Please use the secret key provided in your Interfere dashboard.\",\n ]\n );\n\n // Return disabled config if no valid surface slug\n return {\n enabled: false as const,\n environment: options.environment || process.env.NODE_ENV,\n debug: options.debug ?? false,\n cleanupSourceMaps: options.cleanupSourceMaps ?? true,\n };\n }\n\n return {\n enabled: true as const,\n surface: surfaceSlugResult.right,\n secretKey,\n environment: options.environment || process.env.NODE_ENV,\n debug: options.debug ?? false,\n cleanupSourceMaps: options.cleanupSourceMaps ?? true,\n };\n }),\n }\n);\n"],"mappings":";;;;;;;AAaA,IAAa,mBAAb,cAAsC,QAAQ,IAAI,mBAAmB,EAYlE,CAAC;AAEJ,MAAM,4BACJ,OAAO,IAAI,aAAa;AACtB,KAAI,OAAO,WAAW,YACpB,QAAO,OAAO,OAAO,KACnB,IAAI,wBAAwB,EAC1B,SAAS,qIACV,CAAC,CACH;AAGH,KAAI,OAAO,YAAY,eAAe,CAAC,QAAQ,UAAU,KACvD,QAAO,OAAO,OAAO,KACnB,IAAI,wBAAwB,EAC1B,SAAS,yHACV,CAAC,CACH;AAGH,KACE,OAAO,QAAQ,IAAI,yBAAyB,YAC5C,QAAQ,IAAI,qBAAqB,WAAW,eAAe,CAE3D,QAAO,OAAO,OAAO,KACnB,IAAI,wBAAwB,EAC1B,SAAS,gIACV,CAAC,CACH;EAEH;AAEJ,MAAM,qBAAqB,QACzB,OAAO,IAAI,aAAa;AACtB,KAAI,OAAO,QAAQ,SACjB,QAAO,OAAO,OAAO,KACnB,IAAI,sBACF,EAAE,SAAS,yEAAyE,CACrF,CACF;CAKH,MAAM,SAAS,iBAFC,IAAI,MAAM,CACF,QAAQ,gBAAgB,GAAG,CACX;AAExC,KAAI,CAAC,OACH,QAAO,OAAO,OAAO,KACnB,IAAI,sBACF,EAAE,SAAS,yEAAyE,CACrF,CACF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js","names":[],"sources":["../../../src/build/services/preflight.service.ts"],"sourcesContent":["import { Context, Effect, Layer } from \"effect\";\nimport {\n type NonEmptyString,\n type PreflightConfig,\n toNonEmptyString,\n} from \"../../lib/types.js\";\nimport { fetchSurfaceSlugFromExchange } from \"../exchange-surface.js\";\nimport { logBuildResult } from \"../logger.js\";\nimport { normalizeApiKey, resolveApiUrl } from \"../env-config.js\";\nimport {\n ExchangeFailedError,\n MissingApiKeyError,\n WithInterfereUsageError,\n} from \"../source-maps/errors.js\";\n\nexport class PreflightService extends Context.Tag(\"PreflightService\")<\n PreflightService,\n {\n readonly validateEnvironment: () => Effect.Effect<void, WithInterfereUsageError>;\n readonly validateApiKey: (key: string | null) => Effect.Effect<NonEmptyString, MissingApiKeyError>;\n readonly buildConfig: (options: {\n environment?: string;\n debug?: boolean;\n cleanupSourceMaps?: boolean;\n }) => Effect.Effect<PreflightConfig, WithInterfereUsageError>;\n }\n>() {}\n\nconst validateEnvironment = Effect.fn(\"validateEnvironment\")(function* () {\n if (typeof window !== \"undefined\") {\n return yield* new WithInterfereUsageError({\n message:\n \"Security Error: withInterfere must only be used in next.config.js (server-side). It should never be imported in client-side code.\",\n });\n }\n\n if (typeof process === \"undefined\" || !process.versions?.node) {\n return yield* new WithInterfereUsageError({\n message:\n \"Security Error: withInterfere requires Node.js environment. It should only run during build time, not in the browser.\",\n });\n }\n\n if (\n typeof process.env.INTERFERE_API_KEY === \"string\" &&\n process.env.INTERFERE_API_KEY.startsWith(\"NEXT_PUBLIC_\")\n ) {\n return yield* new WithInterfereUsageError({\n message:\n \"Security Error: API key should NOT use NEXT_PUBLIC_ prefix. Use INTERFERE_API_KEY instead to keep it server-side only.\",\n });\n }\n});\n\nconst validateApiKey = Effect.fn(\"validateApiKey\")(function* (\n _raw: string | null\n) {\n const result = normalizeApiKey(process.env.INTERFERE_API_KEY);\n\n if (!result) {\n return yield* new MissingApiKeyError({\n message: \"Missing API key. Set INTERFERE_API_KEY in your environment.\",\n });\n }\n\n return result;\n});\n\nexport const PreflightServiceLive = Layer.succeed(PreflightService, {\n validateEnvironment,\n validateApiKey,\n buildConfig: Effect.fn(\"buildConfig\")(function* (options: {\n environment?: string;\n debug?: boolean;\n cleanupSourceMaps?: boolean;\n }) {\n yield* validateEnvironment();\n\n const apiKeyResult = yield* validateApiKey(null).pipe(\n Effect.either\n );\n\n if (apiKeyResult._tag === \"Left\") {\n yield* logBuildResult(\n \"Warning\",\n \"Interfere disabled (missing API key)\",\n [\n apiKeyResult.left.message,\n \"Source maps will not be uploaded for this build.\",\n \"Set INTERFERE_API_KEY in your environment to enable Interfere. Ensure you are using the correct key.\",\n ]\n );\n\n return {\n enabled: false as const,\n environment: options.environment || process.env.NODE_ENV,\n debug: options.debug ?? false,\n cleanupSourceMaps: options.cleanupSourceMaps ?? true,\n };\n }\n\n const surfaceResult = yield* Effect.tryPromise({\n try: () =>\n fetchSurfaceSlugFromExchange(\n resolveApiUrl(),\n apiKeyResult.right\n ),\n catch: (cause) =>\n new ExchangeFailedError({ message: \"exchange failed\", cause }),\n }).pipe(\n Effect.map((s) => (s && s.trim() ? toNonEmptyString(s.trim()) : null)),\n Effect.either\n );\n\n if (surfaceResult._tag === \"Left\" || !surfaceResult.right) {\n yield* logBuildResult(\n \"Warning\",\n \"Interfere disabled (exchange unreachable)\",\n [\n \"Could not reach the API.\",\n \"Source maps will not be uploaded for this build.\",\n ]\n );\n\n return {\n enabled: false as const,\n environment: options.environment || process.env.NODE_ENV,\n debug: options.debug ?? false,\n cleanupSourceMaps: options.cleanupSourceMaps ?? true,\n };\n }\n\n return {\n enabled: true as const,\n surface: surfaceResult.right,\n apiKey: apiKeyResult.right,\n environment: options.environment || process.env.NODE_ENV,\n debug: options.debug ?? false,\n cleanupSourceMaps: options.cleanupSourceMaps ?? true,\n };\n }),\n});\n"],"mappings":";;;;;;;;AAeA,IAAa,mBAAb,cAAsC,QAAQ,IAAI,mBAAmB,EAWlE,CAAC;AAEJ,MAAM,sBAAsB,OAAO,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,UAAU,CAAC,cAAc,OAAO;AACzD,UAAO,eACL,WACA,6CACA,CACE,4BACA,mDACD,CACF;AAED,UAAO;IACL,SAAS;IACT,aAAa,QAAQ,eAAe,QAAQ,IAAI;IAChD,OAAO,QAAQ,SAAS;IACxB,mBAAmB,QAAQ,qBAAqB;IACjD;;AAGH,SAAO;GACL,SAAS;GACT,SAAS,cAAc;GACvB,QAAQ,aAAa;GACrB,aAAa,QAAQ,eAAe,QAAQ,IAAI;GAChD,OAAO,QAAQ,SAAS;GACxB,mBAAmB,QAAQ,qBAAqB;GACjD;GACD;CACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { createRelease } from "../source-maps/api.mjs";
2
+ import { Context, Layer } from "effect";
3
+
4
+ //#region src/build/services/release-api.service.d.ts
5
+ declare const ReleaseApiService_base: Context.TagClass<ReleaseApiService, "ReleaseApiService", {
6
+ readonly createRelease: typeof createRelease;
7
+ }>;
8
+ declare class ReleaseApiService extends ReleaseApiService_base {}
9
+ declare const ReleaseApiServiceLive: Layer.Layer<ReleaseApiService, never, never>;
10
+ //#endregion
11
+ export { ReleaseApiService, ReleaseApiServiceLive };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"release-api.service.d.mts","names":[],"sources":["../../../src/build/services/release-api.service.ts"],"mappings":";;;;cAEsD,sBAAA;iCAKnB,aAAA;AAAA;AAAA,cAHtB,iBAAA,SAA0B,sBAAA;AAAA,cAO1B,qBAAA,EAAqB,KAAA,CAAA,KAAA,CAAA,iBAAA"}
@@ -0,0 +1,9 @@
1
+ import { createRelease } from "../source-maps/api.mjs";
2
+ import { Context, Layer } from "effect";
3
+
4
+ //#region src/build/services/release-api.service.ts
5
+ var ReleaseApiService = class extends Context.Tag("ReleaseApiService")() {};
6
+ const ReleaseApiServiceLive = Layer.succeed(ReleaseApiService, { createRelease });
7
+
8
+ //#endregion
9
+ export { ReleaseApiService, ReleaseApiServiceLive };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"release-api.service.mjs","names":[],"sources":["../../../src/build/services/release-api.service.ts"],"sourcesContent":["import { Context, Layer } from \"effect\";\n\nimport { createRelease } from \"../source-maps/api.js\";\n\nexport class ReleaseApiService extends Context.Tag(\"ReleaseApiService\")<\n ReleaseApiService,\n {\n readonly createRelease: typeof createRelease;\n }\n>() {}\n\nexport const ReleaseApiServiceLive = Layer.succeed(ReleaseApiService, {\n createRelease,\n});\n\n"],"mappings":";;;;AAIA,IAAa,oBAAb,cAAuC,QAAQ,IAAI,oBAAoB,EAKpE,CAAC;AAEJ,MAAa,wBAAwB,MAAM,QAAQ,mBAAmB,EACpE,eACD,CAAC"}
@@ -1,17 +1,18 @@
1
1
  import { MissingBuildIdError, MissingReleaseIdError } from "../source-maps/errors.mjs";
2
2
  import { Context, Effect, Layer } from "effect";
3
- import { ReleaseDestinationMetadata, ReleaseDestinationType, ReleaseSourceMetadata, ReleaseSourceType } from "@interfere/types/releases/definition";
3
+ import { ReleaseDestinationMetadata, ReleaseSourceMetadata } from "@interfere/types/integrations";
4
4
 
5
5
  //#region src/build/services/release-identity.service.d.ts
6
6
  type ReleaseIdentity = {
7
7
  buildId: string;
8
8
  releaseId: string;
9
9
  sourceControl?: {
10
- type: ReleaseSourceType;
10
+ name: "github";
11
11
  metadata: ReleaseSourceMetadata;
12
+ gitCommitSha: string;
12
13
  };
13
14
  deployment?: {
14
- type: ReleaseDestinationType;
15
+ name: "vercel";
15
16
  metadata: ReleaseDestinationMetadata;
16
17
  };
17
18
  };
@@ -1 +1 @@
1
- {"version":3,"file":"release-identity.service.d.mts","names":[],"sources":["../../../src/build/services/release-identity.service.ts"],"sourcesContent":[],"mappings":";;;;;KAUY,eAAA;;EAAA,SAAA,EAAA,MAAA;EAIF,aAAA,CAAA,EAAA;IACI,IAAA,EADJ,iBACI;IAGJ,QAAA,EAHI,qBAGJ;EACI,CAAA;EAA0B,UAAA,CAAA,EAAA;IAEtC,IAAA,EAHQ,sBAGR;cAFY;;;cAEZ;cAEW,sBAAA,SAA+B,2BAAA;cAoG/B,4BAA0B,KAAA,CAAA,MAAA"}
1
+ {"version":3,"file":"release-identity.service.d.mts","names":[],"sources":["../../../src/build/services/release-identity.service.ts"],"mappings":";;;;;KAaY,eAAA;EACV,OAAA;EACA,SAAA;EACA,aAAA;IACE,IAAA;IACA,QAAA,EAAU,qBAAA;IACV,YAAA;EAAA;EAEF,UAAA;IACE,IAAA;IACA,QAAA,EAAU,0BAAA;EAAA;AAAA;AAAA,cAEZ,2BAAA;cAEW,sBAAA,SAA+B,2BAAA;AAAA,cAsG/B,0BAAA,EAA0B,KAAA,CAAA,KAAA,CAAA,sBAAA"}
@@ -6,35 +6,48 @@ import { Context, Effect, Layer, Option } from "effect";
6
6
 
7
7
  //#region src/build/services/release-identity.service.ts
8
8
  var ReleaseIdentityService = class extends Context.Tag("ReleaseIdentityService")() {};
9
- const makeReleaseIdentity = Effect.gen(function* () {
9
+ const makeReleaseIdentity = Effect.fn("makeReleaseIdentity")(function* () {
10
10
  const envBuildId = getEnvBuildId();
11
11
  const envReleaseId = getEnvReleaseId();
12
12
  const deploymentOpt = yield* detectDeployment().pipe(Effect.option);
13
13
  const sourceControlOpt = yield* detectSourceControl().pipe(Effect.option);
14
- const deployment = Option.getOrUndefined(deploymentOpt);
15
- const sourceControl = Option.getOrUndefined(sourceControlOpt);
14
+ const deploymentResult = Option.getOrUndefined(deploymentOpt);
15
+ const sourceControlResult = Option.getOrUndefined(sourceControlOpt);
16
16
  let buildId = envBuildId ?? void 0;
17
17
  let releaseId = envReleaseId ?? void 0;
18
- if (!buildId && deployment && "deployment" in deployment.metadata) {
19
- const deploymentId = deployment.metadata.deployment?.id ?? void 0;
18
+ if (!buildId && deploymentResult) {
19
+ const deploymentId = deploymentResult.metadata.deploymentId ?? void 0;
20
20
  if (deploymentId) buildId = deploymentId;
21
21
  }
22
- if (!buildId && sourceControl && "gitCommitSha" in sourceControl.metadata) {
23
- const sha = sourceControl.metadata.gitCommitSha;
22
+ if (!buildId && sourceControlResult) {
23
+ const sha = sourceControlResult.metadata.gitCommitSha;
24
24
  if (sha) buildId = sha;
25
25
  }
26
- if (!releaseId && sourceControl && "gitCommitSha" in sourceControl.metadata) {
27
- const sha = sourceControl.metadata.gitCommitSha;
26
+ if (!releaseId && sourceControlResult) {
27
+ const sha = sourceControlResult.metadata.gitCommitSha;
28
28
  if (sha) releaseId = sha;
29
29
  }
30
- if (!releaseId && deployment && "deployment" in deployment.metadata) {
31
- const deploymentId = deployment.metadata.deployment?.id ?? void 0;
30
+ if (!releaseId && deploymentResult) {
31
+ const deploymentId = deploymentResult.metadata.deploymentId ?? void 0;
32
32
  if (deploymentId) releaseId = deploymentId;
33
33
  }
34
34
  if (!releaseId && buildId) releaseId = buildId;
35
- if (!buildId && !releaseId) return yield* Effect.fail(new MissingBuildIdError({ message: "Couldn't determine build ID (no deployment provider, git, or env vars found)" }));
36
- if (!buildId) return yield* Effect.fail(new MissingBuildIdError({ message: "Couldn't determine build ID (tried NEXT_PUBLIC_INTERFERE_BUILD_ID, NEXT_BUILD_ID, deployment metadata, and git)" }));
37
- if (!releaseId) return yield* Effect.fail(new MissingReleaseIdError({ message: "Couldn't determine release ID (tried NEXT_PUBLIC_INTERFERE_RELEASE_ID, deployment metadata, and git)" }));
35
+ if (!buildId && !releaseId) return yield* new MissingBuildIdError({ message: "Couldn't determine build ID (no deployment provider, git, or env vars found)" });
36
+ if (!buildId) return yield* new MissingBuildIdError({ message: "Couldn't determine build ID (tried NEXT_PUBLIC_INTERFERE_BUILD_ID, NEXT_BUILD_ID, deployment metadata, and git)" });
37
+ if (!releaseId) return yield* new MissingReleaseIdError({ message: "Couldn't determine release ID (tried NEXT_PUBLIC_INTERFERE_RELEASE_ID, deployment metadata, and git)" });
38
+ const sourceControl = sourceControlResult ? {
39
+ name: "github",
40
+ metadata: {
41
+ provider: "github",
42
+ commitMessage: sourceControlResult.metadata.commitMessage,
43
+ branch: sourceControlResult.metadata.branch
44
+ },
45
+ gitCommitSha: sourceControlResult.metadata.gitCommitSha
46
+ } : void 0;
47
+ const deployment = deploymentResult ? {
48
+ name: "vercel",
49
+ metadata: deploymentResult.metadata
50
+ } : void 0;
38
51
  return {
39
52
  buildId,
40
53
  releaseId,
@@ -42,7 +55,7 @@ const makeReleaseIdentity = Effect.gen(function* () {
42
55
  deployment
43
56
  };
44
57
  });
45
- const ReleaseIdentityServiceLive = Layer.succeed(ReleaseIdentityService, makeReleaseIdentity);
58
+ const ReleaseIdentityServiceLive = Layer.succeed(ReleaseIdentityService, makeReleaseIdentity());
46
59
 
47
60
  //#endregion
48
61
  export { ReleaseIdentityService, ReleaseIdentityServiceLive };
@@ -1 +1 @@
1
- {"version":3,"file":"release-identity.service.mjs","names":[],"sources":["../../../src/build/services/release-identity.service.ts"],"sourcesContent":["import type { ReleaseDestinationMetadata, ReleaseDestinationType, ReleaseSourceMetadata, ReleaseSourceType } from \"@interfere/types/releases/definition\";\nimport { Context, Effect, Layer, Option } from \"effect\";\nimport { getEnvBuildId, getEnvReleaseId } from \"../../lib/env.js\";\nimport {\n MissingBuildIdError,\n MissingReleaseIdError,\n} from \"../source-maps/errors.js\";\nimport { detectDeployment } from \"../source-maps/providers/deployment/detector.js\";\nimport { detectSourceControl } from \"../source-maps/providers/source-control/detector.js\";\n\nexport type ReleaseIdentity = {\n buildId: string;\n releaseId: string;\n sourceControl?: {\n type: ReleaseSourceType;\n metadata: ReleaseSourceMetadata;\n };\n deployment?: {\n type: ReleaseDestinationType;\n metadata: ReleaseDestinationMetadata;\n };\n};\n\nexport class ReleaseIdentityService extends Context.Tag(\"ReleaseIdentityService\")<\n ReleaseIdentityService,\n Effect.Effect<ReleaseIdentity, MissingBuildIdError | MissingReleaseIdError>\n>() {}\n\nconst makeReleaseIdentity = Effect.gen(function* () {\n // Read explicitly configured IDs if present\n const envBuildId = getEnvBuildId();\n const envReleaseId = getEnvReleaseId();\n\n // Detect deployment and source control once and reuse\n const deploymentOpt = yield* detectDeployment().pipe(Effect.option);\n const sourceControlOpt = yield* detectSourceControl().pipe(Effect.option);\n\n const deployment = Option.getOrUndefined(deploymentOpt);\n const sourceControl = Option.getOrUndefined(sourceControlOpt);\n\n // Start with env-provided IDs (if any), then fill gaps from metadata\n let buildId = envBuildId ?? undefined;\n let releaseId = envReleaseId ?? undefined;\n\n // Try to get IDs from deployment metadata (Vercel, etc.)\n if (!buildId && deployment && \"deployment\" in deployment.metadata) {\n const deploymentId = deployment.metadata.deployment?.id ?? undefined;\n\n if (deploymentId) {\n buildId = deploymentId;\n }\n }\n\n // Try to get IDs from source control metadata (git)\n if (!buildId && sourceControl && \"gitCommitSha\" in sourceControl.metadata) {\n const sha = sourceControl.metadata.gitCommitSha;\n\n if (sha) {\n buildId = sha;\n }\n }\n\n // Prefer git SHA for releaseId if available\n if (!releaseId && sourceControl && \"gitCommitSha\" in sourceControl.metadata) {\n const sha = sourceControl.metadata.gitCommitSha;\n\n if (sha) {\n releaseId = sha;\n }\n }\n\n // Otherwise fall back to deployment id\n if (!releaseId && deployment && \"deployment\" in deployment.metadata) {\n const deploymentId = deployment.metadata.deployment?.id ?? undefined;\n\n if (deploymentId) {\n releaseId = deploymentId;\n }\n }\n\n // Fall back to buildId for releaseId if we still don't have one\n if (!releaseId && buildId) {\n releaseId = buildId;\n }\n\n // Error if we couldn't determine both IDs\n if (!buildId && !releaseId) {\n return yield* Effect.fail(\n new MissingBuildIdError({\n message:\n \"Couldn't determine build ID (no deployment provider, git, or env vars found)\",\n })\n );\n }\n\n if (!buildId) {\n return yield* Effect.fail(\n new MissingBuildIdError({\n message:\n \"Couldn't determine build ID (tried NEXT_PUBLIC_INTERFERE_BUILD_ID, NEXT_BUILD_ID, deployment metadata, and git)\",\n })\n );\n }\n\n if (!releaseId) {\n return yield* Effect.fail(\n new MissingReleaseIdError({\n message:\n \"Couldn't determine release ID (tried NEXT_PUBLIC_INTERFERE_RELEASE_ID, deployment metadata, and git)\",\n })\n );\n }\n\n const result: ReleaseIdentity = {\n buildId,\n releaseId,\n sourceControl,\n deployment,\n };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AAI,sBAAsB,EACxB,SACE,wGACH,CAAC,CACH;AAUH,QAPgC;EAC9B;EACA;EACA;EACA;EACD;EAGD;AAEF,MAAa,6BAA6B,MAAM,QAC9C,wBACA,oBACD"}
1
+ {"version":3,"file":"release-identity.service.mjs","names":[],"sources":["../../../src/build/services/release-identity.service.ts"],"sourcesContent":["import type {\n ReleaseDestinationMetadata,\n ReleaseSourceMetadata,\n} from \"@interfere/types/integrations\";\nimport { Context, Effect, Layer, Option } from \"effect\";\nimport { getEnvBuildId, getEnvReleaseId } from \"../../lib/env.js\";\nimport {\n MissingBuildIdError,\n MissingReleaseIdError,\n} from \"../source-maps/errors.js\";\nimport { detectDeployment } from \"../source-maps/providers/deployment/detector.js\";\nimport { detectSourceControl } from \"../source-maps/providers/source-control/detector.js\";\n\nexport type ReleaseIdentity = {\n buildId: string;\n releaseId: string;\n sourceControl?: {\n name: \"github\";\n metadata: ReleaseSourceMetadata;\n gitCommitSha: string;\n };\n deployment?: {\n name: \"vercel\";\n metadata: ReleaseDestinationMetadata;\n };\n};\n\nexport class ReleaseIdentityService extends Context.Tag(\n \"ReleaseIdentityService\"\n)<\n ReleaseIdentityService,\n Effect.Effect<ReleaseIdentity, MissingBuildIdError | MissingReleaseIdError>\n>() {}\n\nconst makeReleaseIdentity = Effect.fn(\"makeReleaseIdentity\")(function* () {\n const envBuildId = getEnvBuildId();\n const envReleaseId = getEnvReleaseId();\n\n const deploymentOpt = yield* detectDeployment().pipe(Effect.option);\n const sourceControlOpt = yield* detectSourceControl().pipe(Effect.option);\n\n const deploymentResult = Option.getOrUndefined(deploymentOpt);\n const sourceControlResult = Option.getOrUndefined(sourceControlOpt);\n\n let buildId = envBuildId ?? undefined;\n let releaseId = envReleaseId ?? undefined;\n\n if (!buildId && deploymentResult) {\n const deploymentId = deploymentResult.metadata.deploymentId ?? undefined;\n if (deploymentId) {\n buildId = deploymentId;\n }\n }\n\n if (!buildId && sourceControlResult) {\n const sha = sourceControlResult.metadata.gitCommitSha;\n if (sha) {\n buildId = sha;\n }\n }\n\n if (!releaseId && sourceControlResult) {\n const sha = sourceControlResult.metadata.gitCommitSha;\n if (sha) {\n releaseId = sha;\n }\n }\n\n if (!releaseId && deploymentResult) {\n const deploymentId = deploymentResult.metadata.deploymentId ?? undefined;\n if (deploymentId) {\n releaseId = deploymentId;\n }\n }\n\n if (!releaseId && buildId) {\n releaseId = buildId;\n }\n\n if (!buildId && !releaseId) {\n return yield* new MissingBuildIdError({\n message:\n \"Couldn't determine build ID (no deployment provider, git, or env vars found)\",\n });\n }\n\n if (!buildId) {\n return yield* new MissingBuildIdError({\n message:\n \"Couldn't determine build ID (tried NEXT_PUBLIC_INTERFERE_BUILD_ID, NEXT_BUILD_ID, deployment metadata, and git)\",\n });\n }\n\n if (!releaseId) {\n return yield* new MissingReleaseIdError({\n message:\n \"Couldn't determine release ID (tried NEXT_PUBLIC_INTERFERE_RELEASE_ID, deployment metadata, and git)\",\n });\n }\n\n const sourceControl = sourceControlResult\n ? {\n name: \"github\" as const,\n metadata: {\n provider: \"github\" as const,\n commitMessage: sourceControlResult.metadata.commitMessage,\n branch: sourceControlResult.metadata.branch,\n },\n gitCommitSha: sourceControlResult.metadata.gitCommitSha,\n }\n : undefined;\n\n const deployment = deploymentResult\n ? {\n name: \"vercel\" as const,\n metadata: deploymentResult.metadata,\n }\n : undefined;\n\n const result: ReleaseIdentity = {\n buildId,\n releaseId,\n sourceControl,\n deployment,\n };\n\n return result;\n});\n\nexport const ReleaseIdentityServiceLive = Layer.succeed(\n ReleaseIdentityService,\n makeReleaseIdentity()\n);\n"],"mappings":";;;;;;;AA2BA,IAAa,yBAAb,cAA4C,QAAQ,IAClD,yBACD,EAGE,CAAC;AAEJ,MAAM,sBAAsB,OAAO,GAAG,sBAAsB,CAAC,aAAa;CACxE,MAAM,aAAa,eAAe;CAClC,MAAM,eAAe,iBAAiB;CAEtC,MAAM,gBAAgB,OAAO,kBAAkB,CAAC,KAAK,OAAO,OAAO;CACnE,MAAM,m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effect";
3
+
4
+ //#region src/build/services/source-map-failure-cleanup.service.d.ts
5
+ declare const SourceMapFailureCleanupService_base: Context.TagClass<SourceMapFailureCleanupService, "SourceMapFailureCleanupService", {
6
+ readonly maybeCleanupAfterFailure: typeof maybeCleanupAfterFailure;
7
+ }>;
8
+ declare class SourceMapFailureCleanupService extends SourceMapFailureCleanupService_base {}
9
+ declare const SourceMapFailureCleanupServiceLive: Layer.Layer<SourceMapFailureCleanupService, never, never>;
10
+ //#endregion
11
+ export { SourceMapFailureCleanupService, SourceMapFailureCleanupServiceLive };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-map-failure-cleanup.service.d.mts","names":[],"sources":["../../../src/build/services/source-map-failure-cleanup.service.ts"],"mappings":";;;;cAEmE,mCAAA;4CAIW,wBAAA;AAAA;AAAA,cAFjE,8BAAA,SAAuC,mCAAA;AAAA,cAIvC,kCAAA,EAAkC,KAAA,CAAA,KAAA,CAAA,8BAAA"}
@@ -0,0 +1,9 @@
1
+ import { maybeCleanupAfterFailure } from "../source-maps/files.mjs";
2
+ import { Context, Layer } from "effect";
3
+
4
+ //#region src/build/services/source-map-failure-cleanup.service.ts
5
+ var SourceMapFailureCleanupService = class extends Context.Tag("SourceMapFailureCleanupService")() {};
6
+ const SourceMapFailureCleanupServiceLive = Layer.succeed(SourceMapFailureCleanupService, { maybeCleanupAfterFailure });
7
+
8
+ //#endregion
9
+ export { SourceMapFailureCleanupService, SourceMapFailureCleanupServiceLive };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-map-failure-cleanup.service.mjs","names":[],"sources":["../../../src/build/services/source-map-failure-cleanup.service.ts"],"sourcesContent":["import { Context, Layer } from \"effect\";\n\nimport { maybeCleanupAfterFailure } from \"../source-maps/files.js\";\n\nexport class SourceMapFailureCleanupService extends Context.Tag(\n \"SourceMapFailureCleanupService\"\n)<SourceMapFailureCleanupService, { readonly maybeCleanupAfterFailure: typeof maybeCleanupAfterFailure }>() {}\n\nexport const SourceMapFailureCleanupServiceLive = Layer.succeed(\n SourceMapFailureCleanupService,\n {\n maybeCleanupAfterFailure,\n }\n);\n\n"],"mappings":";;;;AAIA,IAAa,iCAAb,cAAoD,QAAQ,IAC1D,iCACD,EAA0G,CAAC;AAE5G,MAAa,qCAAqC,MAAM,QACtD,gCACA,EACE,0BACD,CACF"}
@@ -1,16 +1,12 @@
1
- import { ConfigService } from "./config.service.mjs";
2
1
  import { FileDeleteError, FileGlobError, FileHashError, FileReadError, InvalidApiUrlError, UploadError } from "../source-maps/errors.mjs";
2
+ import { ConfigService } from "./config.service.mjs";
3
3
  import { Context, Effect, Layer } from "effect";
4
+ import { CreateReleaseResponse } from "@interfere/types/releases/definition";
4
5
  import { UploadedSourceMap } from "@interfere/types/data/source-maps";
5
6
 
6
7
  //#region src/build/services/source-map.service.d.ts
7
- type UploadMeta = {
8
+ type UploadMeta = CreateReleaseResponse & {
8
9
  apiUrl: string;
9
- orgId: string;
10
- sourceId: string;
11
- surfaceId: number;
12
- environment: string;
13
- releaseSlug: string;
14
10
  };
15
11
  declare const SourceMapService_base: Context.TagClass<SourceMapService, "SourceMapService", {
16
12
  readonly find: Effect.Effect<string[], FileGlobError>;
@@ -21,4 +17,4 @@ declare const SourceMapService_base: Context.TagClass<SourceMapService, "SourceM
21
17
  declare class SourceMapService extends SourceMapService_base {}
22
18
  declare const SourceMapServiceLive: Layer.Layer<SourceMapService, never, ConfigService>;
23
19
  //#endregion
24
- export { SourceMapService, SourceMapServiceLive, UploadMeta };
20
+ export { SourceMapService, SourceMapServiceLive };
@@ -1 +1 @@
1
- {"version":3,"file":"source-map.service.d.mts","names":[],"sources":["../../../src/build/services/source-map.service.ts"],"sourcesContent":[],"mappings":";;;;;;KAuBY,UAAA;;EAAA,KAAA,EAAA,MAAU;EAOpB,QAAA,EAAA,MAAA;;EAMyC,WAAA,EAAA,MAAA;EAAxB,WAAO,EAAA,MAAA;CAIH;cAVrB,qBAU0C,kBAAA,iBAAA,EAAA,kBAAA,EAAA;EAAgB,SAAA,IAAA,EAJzC,MAAA,CAAO,MAIkC,CAAA,MAAA,EAAA,EAJjB,aAIiB,CAAA;EAAnD,SAAO,IAAA,EAAA,CAAA,KAAA,EAAA,MAAA,EAAA,EAAA,GAAP,MAAA,CAAO,MAAA,CAAO,iBAAP,EAAA,EAA4B,aAA5B,GAA4C,aAA5C,CAAA;EAGE,SAAA,MAAA,EAAA,CAAA,UAAA,EAAA,iBAAA,EAAA,EAAA,IAAA,EACN,UADM,EAAA,GAET,MAAA,CAAO,MAFE,CAAA,IAAA,EAEW,WAFX,GAEyB,kBAFzB,CAAA;EACN,SAAA,OAAA,EAAA,CAAA,KAAA,EAAA,MAAA,EAAA,EAAA,KAAA,EAAA,OAAA,EAAA,GAMH,MAAA,CAAO,MANJ,CAAA,IAAA,EAMiB,eANjB,CAAA;CACiB,CAAA;AAAc,cAZ9B,gBAAA,SAAyB,qBAAA,CAYK;AAKd,cAIhB,oBAJgB,EAII,KAAA,CAAA,KAJJ,CAII,gBAJJ,EAAA,KAAA,EAII,aAJJ,CAAA"}
1
+ {"version":3,"file":"source-map.service.d.mts","names":[],"sources":["../../../src/build/services/source-map.service.ts"],"mappings":";;;;;;;KAwBK,UAAA,GAAa,qBAAA;EAChB,MAAA;AAAA;AAAA,cAAM,qBAAA;iBAMW,MAAA,CAAO,MAAA,WAAiB,aAAA;EAAA,gBAGrC,KAAA,eACG,MAAA,CAAO,MAAA,CAAO,iBAAA,IAAqB,aAAA,GAAgB,aAAA;EAAA,kBAGtD,UAAA,EAAY,iBAAA,IACZ,IAAA,EAAM,UAAA,KACH,MAAA,CAAO,MAAA,OAAa,WAAA,GAAc,kBAAA;EAAA,mBAGrC,KAAA,YACA,KAAA,cACG,MAAA,CAAO,MAAA,OAAa,eAAA;AAAA;AAAA,cAjBhB,gBAAA,SAAyB,qBAAA;AAAA,cAqBzB,oBAAA,EAAoB,KAAA,CAAA,KAAA,CAAA,gBAAA,SAAA,aAAA"}
@@ -10,11 +10,9 @@ var SourceMapService = class extends Context.Tag("SourceMapService")() {};
10
10
  const SourceMapServiceLive = Layer.effect(SourceMapService, Effect.gen(function* () {
11
11
  const config = yield* ConfigService;
12
12
  return {
13
- find: Effect.gen(function* () {
14
- return yield* findSourceMapFiles();
15
- }),
13
+ find: Effect.suspend(findSourceMapFiles),
16
14
  read: (files) => readSourceMapsFromFiles(files),
17
- upload: (sourceMaps, meta) => Effect.gen(function* () {
15
+ upload: Effect.fn("upload")(function* (sourceMaps, meta) {
18
16
  const sourceMapToGenerated = yield* buildSourceMapToGeneratedMapping(yield* findGeneratedJsFiles().pipe(Effect.mapError((error) => {
19
17
  return new UploadError({
20
18
  message: `Failed to find generated JS files: ${error.message}`,