@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.
- package/LICENSE +1 -1
- package/README.md +36 -8
- package/dist/_virtual/_rolldown/runtime.mjs +7 -0
- package/dist/build/env-config.d.mts +3 -1
- package/dist/build/env-config.d.mts.map +1 -1
- package/dist/build/env-config.mjs +9 -1
- package/dist/build/env-config.mjs.map +1 -1
- package/dist/build/exchange-surface.d.mts +9 -0
- package/dist/build/exchange-surface.d.mts.map +1 -0
- package/dist/build/exchange-surface.mjs +36 -0
- package/dist/build/exchange-surface.mjs.map +1 -0
- package/dist/build/loaders/value-injection-loader.d.mts +22 -0
- package/dist/build/loaders/value-injection-loader.d.mts.map +1 -0
- package/dist/build/loaders/value-injection-loader.mjs +35 -0
- package/dist/build/loaders/value-injection-loader.mjs.map +1 -0
- package/dist/build/logger.d.mts +2 -2
- package/dist/build/logger.d.mts.map +1 -1
- package/dist/build/logger.mjs +10 -12
- package/dist/build/logger.mjs.map +1 -1
- package/dist/build/nextjs-version.d.mts +40 -0
- package/dist/build/nextjs-version.d.mts.map +1 -0
- package/dist/build/nextjs-version.mjs +66 -0
- package/dist/build/nextjs-version.mjs.map +1 -0
- package/dist/build/release-program.d.mts +5 -3
- package/dist/build/release-program.d.mts.map +1 -1
- package/dist/build/release-program.mjs +11 -12
- package/dist/build/release-program.mjs.map +1 -1
- package/dist/build/services/config.service.d.mts.map +1 -1
- package/dist/build/services/config.service.mjs.map +1 -1
- package/dist/build/services/instrumentation-detection.service.d.mts +19 -0
- package/dist/build/services/instrumentation-detection.service.d.mts.map +1 -0
- package/dist/build/services/instrumentation-detection.service.mjs +77 -0
- package/dist/build/services/instrumentation-detection.service.mjs.map +1 -0
- package/dist/build/services/preflight.service.d.mts +2 -3
- package/dist/build/services/preflight.service.d.mts.map +1 -1
- package/dist/build/services/preflight.service.mjs +28 -37
- package/dist/build/services/preflight.service.mjs.map +1 -1
- package/dist/build/services/release-api.service.d.mts +11 -0
- package/dist/build/services/release-api.service.d.mts.map +1 -0
- package/dist/build/services/release-api.service.mjs +9 -0
- package/dist/build/services/release-api.service.mjs.map +1 -0
- package/dist/build/services/release-identity.service.d.mts +4 -3
- package/dist/build/services/release-identity.service.d.mts.map +1 -1
- package/dist/build/services/release-identity.service.mjs +28 -15
- package/dist/build/services/release-identity.service.mjs.map +1 -1
- package/dist/build/services/source-map-failure-cleanup.service.d.mts +11 -0
- package/dist/build/services/source-map-failure-cleanup.service.d.mts.map +1 -0
- package/dist/build/services/source-map-failure-cleanup.service.mjs +9 -0
- package/dist/build/services/source-map-failure-cleanup.service.mjs.map +1 -0
- package/dist/build/services/source-map.service.d.mts +4 -8
- package/dist/build/services/source-map.service.d.mts.map +1 -1
- package/dist/build/services/source-map.service.mjs +2 -4
- package/dist/build/services/source-map.service.mjs.map +1 -1
- package/dist/build/source-maps/api.d.mts +25 -16
- package/dist/build/source-maps/api.d.mts.map +1 -1
- package/dist/build/source-maps/api.mjs +11 -8
- package/dist/build/source-maps/api.mjs.map +1 -1
- package/dist/build/source-maps/client.d.mts +11 -2
- package/dist/build/source-maps/client.d.mts.map +1 -1
- package/dist/build/source-maps/client.mjs +25 -14
- package/dist/build/source-maps/client.mjs.map +1 -1
- package/dist/build/source-maps/errors.d.mts +118 -106
- package/dist/build/source-maps/errors.d.mts.map +1 -1
- package/dist/build/source-maps/errors.mjs +42 -18
- package/dist/build/source-maps/errors.mjs.map +1 -1
- package/dist/build/source-maps/files.d.mts +1 -1
- package/dist/build/source-maps/files.d.mts.map +1 -1
- package/dist/build/source-maps/files.mjs +13 -15
- package/dist/build/source-maps/files.mjs.map +1 -1
- package/dist/build/source-maps/providers/deployment/detector.d.mts +8 -17
- package/dist/build/source-maps/providers/deployment/detector.d.mts.map +1 -1
- package/dist/build/source-maps/providers/deployment/detector.mjs +11 -13
- package/dist/build/source-maps/providers/deployment/detector.mjs.map +1 -1
- package/dist/build/source-maps/providers/deployment/types.d.mts +2 -2
- package/dist/build/source-maps/providers/deployment/types.d.mts.map +1 -1
- package/dist/build/source-maps/providers/deployment/vercel.d.mts.map +1 -1
- package/dist/build/source-maps/providers/deployment/vercel.mjs +8 -19
- package/dist/build/source-maps/providers/deployment/vercel.mjs.map +1 -1
- package/dist/build/source-maps/providers/source-control/detector.d.mts +6 -5
- package/dist/build/source-maps/providers/source-control/detector.d.mts.map +1 -1
- package/dist/build/source-maps/providers/source-control/detector.mjs +11 -13
- package/dist/build/source-maps/providers/source-control/detector.mjs.map +1 -1
- package/dist/build/source-maps/providers/source-control/git.d.mts.map +1 -1
- package/dist/build/source-maps/providers/source-control/git.mjs +5 -8
- package/dist/build/source-maps/providers/source-control/git.mjs.map +1 -1
- package/dist/build/source-maps/providers/source-control/types.d.mts +5 -3
- package/dist/build/source-maps/providers/source-control/types.d.mts.map +1 -1
- package/dist/build/with-interfere.d.mts +25 -3
- package/dist/build/with-interfere.d.mts.map +1 -1
- package/dist/build/with-interfere.mjs +131 -24
- package/dist/build/with-interfere.mjs.map +1 -1
- package/dist/client/auto-init.d.mts +91 -0
- package/dist/client/auto-init.d.mts.map +1 -0
- package/dist/client/auto-init.mjs +121 -0
- package/dist/client/auto-init.mjs.map +1 -0
- package/dist/client/provider.d.mts +3 -3
- package/dist/client/provider.d.mts.map +1 -1
- package/dist/client/provider.mjs +21 -8
- package/dist/client/provider.mjs.map +1 -1
- package/dist/lib/env.d.mts.map +1 -1
- package/dist/lib/types.d.mts +6 -6
- package/dist/lib/types.d.mts.map +1 -1
- package/dist/lib/types.mjs.map +1 -1
- package/dist/server/auto-init.d.mts +88 -0
- package/dist/server/auto-init.d.mts.map +1 -0
- package/dist/server/auto-init.mjs +101 -0
- package/dist/server/auto-init.mjs.map +1 -0
- package/dist/server/middleware.d.mts.map +1 -1
- package/dist/server/middleware.mjs +20 -13
- package/dist/server/middleware.mjs.map +1 -1
- package/dist/server/on-request-error.d.mts +27 -0
- package/dist/server/on-request-error.d.mts.map +1 -0
- package/dist/server/on-request-error.mjs +74 -0
- package/dist/server/on-request-error.mjs.map +1 -0
- package/dist/server/proxy.d.mts.map +1 -1
- package/dist/server/proxy.mjs +4 -5
- package/dist/server/proxy.mjs.map +1 -1
- package/dist/server/route-handler.d.mts +31 -1
- package/dist/server/route-handler.d.mts.map +1 -1
- package/dist/server/route-handler.mjs +78 -79
- package/dist/server/route-handler.mjs.map +1 -1
- package/dist/server/sdk.d.mts +96 -0
- package/dist/server/sdk.d.mts.map +1 -0
- package/dist/server/sdk.mjs +152 -0
- package/dist/server/sdk.mjs.map +1 -0
- package/dist/server/services/config.service.d.mts +33 -6
- package/dist/server/services/config.service.d.mts.map +1 -1
- package/dist/server/services/config.service.mjs +54 -30
- package/dist/server/services/config.service.mjs.map +1 -1
- package/dist/server/services/error-tracking.service.d.mts +3 -3
- package/dist/server/services/error-tracking.service.d.mts.map +1 -1
- package/dist/server/services/error-tracking.service.mjs +5 -3
- package/dist/server/services/error-tracking.service.mjs.map +1 -1
- package/dist/server/session-context.d.mts +60 -0
- package/dist/server/session-context.d.mts.map +1 -0
- package/dist/server/session-context.mjs +62 -0
- package/dist/server/session-context.mjs.map +1 -0
- package/package.json +58 -34
- package/dist/build/secret-key.d.mts +0 -10
- package/dist/build/secret-key.d.mts.map +0 -1
- package/dist/build/secret-key.mjs +0 -16
- package/dist/build/secret-key.mjs.map +0 -1
- package/dist/lib/test-utils/make-next-request.d.mts +0 -6
- package/dist/lib/test-utils/make-next-request.d.mts.map +0 -1
- package/dist/lib/test-utils/make-next-request.mjs +0 -12
- 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 {
|
|
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,QAAQ;EAC9D,aAAa,OAAO;EACpB,UAAU,SAAS;EACnB,gBAAgB,SAAS,eAAe;EACxC,qBAAqB,SAAS,YAAY;EAC3C,CAAC;AACF,QAAO,OAAO,SAAS,sBAAsB,KAAK,KAAK,GAAG,YAAY,IAAI;AAG1E,QAAO,OAAO,SAAS,sBAAsB;CAC7C,MAAM,YAAY,KAAK,KAAK;CAC5B,MAAM,aAAa,OAAO,iBAAiB,KAAK,eAAe;AAC/D,QAAO,OAAO,SAAS,QAAQ,WAAW,OAAO,kBAAkB,KAAK,KAAK,GAAG,UAAU,IAAI;AAE9F,QAAO,OAAO,SAAS,wBAAwB;CAC/C,MAAM,cAAc,KAAK,KAAK;AAC9B,QAAO,iBAAiB,OAAO,YAAY;EACzC,GAAG;EACH,QAAQ,eAAe;EACxB,CAAC;AACF,QAAO,OAAO,SAAS,2BAA2B,KAAK,KAAK,GAAG,YAAY,IAAI;AAG/E,QAAO,OAAO,SAAS,0BAA0B;CACjD,MAAM,eAAe,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,gCAAgC,OAAO,GAAG,oBAAoB,CAAC,WAAW,KAAK;CACzG,MAAM,SAAS,OAAO;CACtB,MAAM,iBAAiB,OAAO;AAG9B,QAAO,IAAI,OAAO,MAAM,CAAC;AAGzB,KACE,OAAO,gBAAgB,gBACvB,OAAO,sBAAsB,MAE7B,QAAO,eAAe,yBAAyB,CAAC,CAAC,OAAO,MAAM;EAKlE,CAAC,CACN,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,gBACA,uBACA,mCACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.service.d.mts","names":[],"sources":["../../../src/build/services/config.service.ts"],"
|
|
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 {
|
|
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 {
|
|
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
|
|
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"],"
|
|
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 {
|
|
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 =
|
|
10
|
-
if (typeof window !== "undefined") return yield*
|
|
11
|
-
if (typeof process === "undefined" || !process.versions?.node) return yield*
|
|
12
|
-
if (typeof process.env.
|
|
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
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
buildConfig: (options) => Effect.gen(function* () {
|
|
22
|
+
validateApiKey,
|
|
23
|
+
buildConfig: Effect.fn("buildConfig")(function* (options) {
|
|
31
24
|
yield* validateEnvironment();
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
|
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
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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:
|
|
67
|
-
|
|
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 {
|
|
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 { 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,GAAG,sBAAsB,CAAC,aAAa;AACxE,KAAI,OAAO,WAAW,YACpB,QAAO,OAAO,IAAI,wBAAwB,EACxC,SACE,qIACH,CAAC;AAGJ,KAAI,OAAO,YAAY,eAAe,CAAC,QAAQ,UAAU,KACvD,QAAO,OAAO,IAAI,wBAAwB,EACxC,SACE,yHACH,CAAC;AAGJ,KACE,OAAO,QAAQ,IAAI,sBAAsB,YACzC,QAAQ,IAAI,kBAAkB,WAAW,eAAe,CAExD,QAAO,OAAO,IAAI,wBAAwB,EACxC,SACE,0HACH,CAAC;EAEJ;AAEF,MAAM,iBAAiB,OAAO,GAAG,iBAAiB,CAAC,WACjD,MACA;CACA,MAAM,SAAS,gBAAgB,QAAQ,IAAI,kBAAkB;AAE7D,KAAI,CAAC,OACH,QAAO,OAAO,IAAI,mBAAmB,EACnC,SAAS,+DACV,CAAC;AAGJ,QAAO;EACP;AAEF,MAAa,uBAAuB,MAAM,QAAQ,kBAAkB;CAClE;CACA;CACA,aAAa,OAAO,GAAG,cAAc,CAAC,WAAW,SAI9C;AACD,SAAO,qBAAqB;EAE5B,MAAM,eAAe,OAAO,eAAe,KAAK,CAAC,KAC/C,OAAO,OACR;AAED,MAAI,aAAa,SAAS,QAAQ;AAChC,UAAO,eACL,WACA,wCACA;IACE,aAAa,KAAK;IAClB;IACA;IACD,CACF;AAED,UAAO;IACL,SAAS;IACT,aAAa,QAAQ,eAAe,QAAQ,IAAI;IAChD,OAAO,QAAQ,SAAS;IACxB,mBAAmB,QAAQ,qBAAqB;IACjD;;EAGH,MAAM,gBAAgB,OAAO,OAAO,WAAW;GAC7C,WACE,6BACE,eAAe,EACf,aAAa,MACd;GACH,QAAQ,UACN,IAAI,oBAAoB;IAAE,SAAS;IAAmB;IAAO,CAAC;GACjE,CAAC,CAAC,KACD,OAAO,KAAK,MAAO,KAAK,EAAE,MAAM,GAAG,iBAAiB,EAAE,MAAM,CAAC,GAAG,KAAM,EACtE,OAAO,OACR;AAED,MAAI,cAAc,SAAS,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,
|
|
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
|
-
|
|
10
|
+
name: "github";
|
|
11
11
|
metadata: ReleaseSourceMetadata;
|
|
12
|
+
gitCommitSha: string;
|
|
12
13
|
};
|
|
13
14
|
deployment?: {
|
|
14
|
-
|
|
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"],"
|
|
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.
|
|
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
|
|
15
|
-
const
|
|
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 &&
|
|
19
|
-
const deploymentId =
|
|
18
|
+
if (!buildId && deploymentResult) {
|
|
19
|
+
const deploymentId = deploymentResult.metadata.deploymentId ?? void 0;
|
|
20
20
|
if (deploymentId) buildId = deploymentId;
|
|
21
21
|
}
|
|
22
|
-
if (!buildId &&
|
|
23
|
-
const sha =
|
|
22
|
+
if (!buildId && sourceControlResult) {
|
|
23
|
+
const sha = sourceControlResult.metadata.gitCommitSha;
|
|
24
24
|
if (sha) buildId = sha;
|
|
25
25
|
}
|
|
26
|
-
if (!releaseId &&
|
|
27
|
-
const sha =
|
|
26
|
+
if (!releaseId && sourceControlResult) {
|
|
27
|
+
const sha = sourceControlResult.metadata.gitCommitSha;
|
|
28
28
|
if (sha) releaseId = sha;
|
|
29
29
|
}
|
|
30
|
-
if (!releaseId &&
|
|
31
|
-
const deploymentId =
|
|
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*
|
|
36
|
-
if (!buildId) return yield*
|
|
37
|
-
if (!releaseId) return yield*
|
|
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 {
|
|
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,mBAAmB,OAAO,qBAAqB,CAAC,KAAK,OAAO,OAAO;CAEzE,MAAM,mBAAmB,OAAO,eAAe,cAAc;CAC7D,MAAM,sBAAsB,OAAO,eAAe,iBAAiB;CAEnE,IAAI,UAAU,cAAc;CAC5B,IAAI,YAAY,gBAAgB;AAEhC,KAAI,CAAC,WAAW,kBAAkB;EAChC,MAAM,eAAe,iBAAiB,SAAS,gBAAgB;AAC/D,MAAI,aACF,WAAU;;AAId,KAAI,CAAC,WAAW,qBAAqB;EACnC,MAAM,MAAM,oBAAoB,SAAS;AACzC,MAAI,IACF,WAAU;;AAId,KAAI,CAAC,aAAa,qBAAqB;EACrC,MAAM,MAAM,oBAAoB,SAAS;AACzC,MAAI,IACF,aAAY;;AAIhB,KAAI,CAAC,aAAa,kBAAkB;EAClC,MAAM,eAAe,iBAAiB,SAAS,gBAAgB;AAC/D,MAAI,aACF,aAAY;;AAIhB,KAAI,CAAC,aAAa,QAChB,aAAY;AAGd,KAAI,CAAC,WAAW,CAAC,UACf,QAAO,OAAO,IAAI,oBAAoB,EACpC,SACE,gFACH,CAAC;AAGJ,KAAI,CAAC,QACH,QAAO,OAAO,IAAI,oBAAoB,EACpC,SACE,mHACH,CAAC;AAGJ,KAAI,CAAC,UACH,QAAO,OAAO,IAAI,sBAAsB,EACtC,SACE,wGACH,CAAC;CAGJ,MAAM,gBAAgB,sBAClB;EACE,MAAM;EACN,UAAU;GACR,UAAU;GACV,eAAe,oBAAoB,SAAS;GAC5C,QAAQ,oBAAoB,SAAS;GACtC;EACD,cAAc,oBAAoB,SAAS;EAC5C,GACD;CAEJ,MAAM,aAAa,mBACf;EACE,MAAM;EACN,UAAU,iBAAiB;EAC5B,GACD;AASJ,QAPgC;EAC9B;EACA;EACA;EACA;EACD;EAGD;AAEF,MAAa,6BAA6B,MAAM,QAC9C,wBACA,qBAAqB,CACtB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
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.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
|
|
20
|
+
export { SourceMapService, SourceMapServiceLive };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-map.service.d.mts","names":[],"sources":["../../../src/build/services/source-map.service.ts"],"
|
|
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.
|
|
14
|
-
return yield* findSourceMapFiles();
|
|
15
|
-
}),
|
|
13
|
+
find: Effect.suspend(findSourceMapFiles),
|
|
16
14
|
read: (files) => readSourceMapsFromFiles(files),
|
|
17
|
-
upload:
|
|
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}`,
|