@interfere/next 0.1.0-alpha.10 → 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 +3 -3
- package/dist/_virtual/{rolldown_runtime.mjs → _rolldown/runtime.mjs} +1 -1
- 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.map +1 -1
- package/dist/build/logger.d.mts.map +1 -1
- package/dist/build/nextjs-version.d.mts.map +1 -1
- package/dist/build/nextjs-version.mjs +1 -1
- package/dist/build/release-program.d.mts +3 -3
- package/dist/build/release-program.d.mts.map +1 -1
- package/dist/build/release-program.mjs +4 -6
- 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.map +1 -1
- 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 +24 -33
- package/dist/build/services/preflight.service.mjs.map +1 -1
- 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 +23 -10
- package/dist/build/services/release-identity.service.mjs.map +1 -1
- package/dist/build/services/source-map.service.d.mts +3 -7
- package/dist/build/services/source-map.service.d.mts.map +1 -1
- 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 +22 -21
- package/dist/build/source-maps/client.d.mts.map +1 -1
- package/dist/build/source-maps/client.mjs +14 -9
- 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.map +1 -1
- package/dist/build/source-maps/providers/deployment/detector.d.mts +7 -16
- package/dist/build/source-maps/providers/deployment/detector.d.mts.map +1 -1
- package/dist/build/source-maps/providers/deployment/detector.mjs +2 -2
- 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 +7 -18
- package/dist/build/source-maps/providers/deployment/vercel.mjs.map +1 -1
- package/dist/build/source-maps/providers/source-control/detector.d.mts +5 -4
- package/dist/build/source-maps/providers/source-control/detector.d.mts.map +1 -1
- package/dist/build/source-maps/providers/source-control/detector.mjs +1 -1
- 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 +4 -7
- 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 +23 -23
- package/dist/build/with-interfere.d.mts.map +1 -1
- package/dist/build/with-interfere.mjs +47 -26
- package/dist/build/with-interfere.mjs.map +1 -1
- package/dist/client/auto-init.d.mts +3 -3
- package/dist/client/auto-init.d.mts.map +1 -1
- package/dist/client/auto-init.mjs +1 -1
- package/dist/client/auto-init.mjs.map +1 -1
- package/dist/client/provider.d.mts +2 -2
- package/dist/client/provider.d.mts.map +1 -1
- 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 +11 -10
- package/dist/server/auto-init.d.mts.map +1 -1
- package/dist/server/auto-init.mjs +3 -3
- package/dist/server/auto-init.mjs.map +1 -1
- package/dist/server/middleware.d.mts.map +1 -1
- package/dist/server/middleware.mjs +9 -10
- package/dist/server/middleware.mjs.map +1 -1
- package/dist/server/on-request-error.d.mts +7 -7
- package/dist/server/on-request-error.d.mts.map +1 -1
- package/dist/server/on-request-error.mjs +2 -2
- package/dist/server/on-request-error.mjs.map +1 -1
- 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 +72 -67
- package/dist/server/route-handler.mjs.map +1 -1
- package/dist/server/sdk.d.mts +29 -29
- package/dist/server/sdk.d.mts.map +1 -1
- package/dist/server/sdk.mjs +2 -2
- package/dist/server/sdk.mjs.map +1 -1
- 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.map +1 -1
- package/dist/server/services/error-tracking.service.mjs +1 -1
- package/dist/server/services/error-tracking.service.mjs.map +1 -1
- package/dist/server/session-context.d.mts +11 -11
- package/dist/server/session-context.d.mts.map +1 -1
- package/dist/server/session-context.mjs.map +1 -1
- package/package.json +38 -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
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ npm install @interfere/next
|
|
|
9
9
|
# or
|
|
10
10
|
yarn add @interfere/next
|
|
11
11
|
# or
|
|
12
|
-
|
|
12
|
+
bun add @interfere/next
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Quick Start
|
|
@@ -66,10 +66,10 @@ The SDK sends events through a server-side proxy route to keep your API credenti
|
|
|
66
66
|
export { GET, OPTIONS, POST } from '@interfere/next/route-handler';
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
This route proxies client-side events to Interfere's ingest API using your `
|
|
69
|
+
This route proxies client-side events to Interfere's ingest API using your `INTERFERE_API_KEY` environment variable. Add the key to your `.env.local`:
|
|
70
70
|
|
|
71
71
|
```bash
|
|
72
|
-
|
|
72
|
+
INTERFERE_API_KEY=ak_xxx
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
### 4. Add Error Boundary (App Directory)
|
|
@@ -2,6 +2,8 @@ import { NonEmptyString } from "../lib/types.mjs";
|
|
|
2
2
|
|
|
3
3
|
//#region src/build/env-config.d.ts
|
|
4
4
|
declare function resolveApiUrl(): string;
|
|
5
|
+
declare function normalizeApiKey(raw: string | undefined): NonEmptyString | null;
|
|
5
6
|
declare function normalizeSecretKey(raw: string | undefined): NonEmptyString | null;
|
|
7
|
+
declare function normalizeSurfaceSlug(raw: string | undefined): NonEmptyString | null;
|
|
6
8
|
//#endregion
|
|
7
|
-
export { normalizeSecretKey, resolveApiUrl };
|
|
9
|
+
export { normalizeApiKey, normalizeSecretKey, normalizeSurfaceSlug, resolveApiUrl };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-config.d.mts","names":[],"sources":["../../src/build/env-config.ts"],"mappings":";;;iBAGgB,aAAA,CAAA;AAAA,iBAWA,kBAAA,
|
|
1
|
+
{"version":3,"file":"env-config.d.mts","names":[],"sources":["../../src/build/env-config.ts"],"mappings":";;;iBAGgB,aAAA,CAAA;AAAA,iBAWA,eAAA,CACd,GAAA,uBACC,cAAA;AAAA,iBAWa,kBAAA,CACd,GAAA,uBACC,cAAA;AAAA,iBAWa,oBAAA,CACd,GAAA,uBACC,cAAA"}
|
|
@@ -8,10 +8,18 @@ function resolveApiUrl() {
|
|
|
8
8
|
if (trimmed.length > 0) return trimmed;
|
|
9
9
|
return API_URL;
|
|
10
10
|
}
|
|
11
|
+
function normalizeApiKey(raw) {
|
|
12
|
+
if (typeof raw !== "string") return null;
|
|
13
|
+
return toNonEmptyString(raw.trim().replace(/^['"]|['"]$/g, ""));
|
|
14
|
+
}
|
|
11
15
|
function normalizeSecretKey(raw) {
|
|
12
16
|
if (typeof raw !== "string") return null;
|
|
13
17
|
return toNonEmptyString(raw.trim().replace(/^['"]|['"]$/g, ""));
|
|
14
18
|
}
|
|
19
|
+
function normalizeSurfaceSlug(raw) {
|
|
20
|
+
if (typeof raw !== "string") return null;
|
|
21
|
+
return toNonEmptyString(raw.trim());
|
|
22
|
+
}
|
|
15
23
|
|
|
16
24
|
//#endregion
|
|
17
|
-
export { normalizeSecretKey, resolveApiUrl };
|
|
25
|
+
export { normalizeApiKey, normalizeSecretKey, normalizeSurfaceSlug, resolveApiUrl };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-config.mjs","names":[],"sources":["../../src/build/env-config.ts"],"sourcesContent":["import { API_URL } from \"@interfere/constants/api\";\nimport { type NonEmptyString, toNonEmptyString } from \"../lib/types.js\";\n\nexport function resolveApiUrl(): string {\n const raw = process.env.INTERFERE_API_URL;\n const trimmed = typeof raw === \"string\" ? raw.trim() : \"\";\n\n if (trimmed.length > 0) {\n return trimmed;\n }\n\n return API_URL;\n}\n\nexport function normalizeSecretKey(\n raw: string | undefined\n): NonEmptyString | null {\n if (typeof raw !== \"string\") {\n return null;\n }\n\n const trimmed = raw.trim();\n const cleaned = trimmed.replace(/^['\"]|['\"]$/g, \"\");\n\n return toNonEmptyString(cleaned);\n}\n\n\n"],"mappings":";;;;AAGA,SAAgB,gBAAwB;CACtC,MAAM,MAAM,QAAQ,IAAI;CACxB,MAAM,UAAU,OAAO,QAAQ,WAAW,IAAI,MAAM,GAAG;AAEvD,KAAI,QAAQ,SAAS,EACnB,QAAO;AAGT,QAAO;;AAGT,SAAgB,mBACd,KACuB;AACvB,KAAI,OAAO,QAAQ,SACjB,QAAO;AAMT,QAAO,iBAHS,IAAI,MAAM,CACF,QAAQ,gBAAgB,GAAG,CAEnB"}
|
|
1
|
+
{"version":3,"file":"env-config.mjs","names":[],"sources":["../../src/build/env-config.ts"],"sourcesContent":["import { API_URL } from \"@interfere/constants/api\";\nimport { type NonEmptyString, toNonEmptyString } from \"../lib/types.js\";\n\nexport function resolveApiUrl(): string {\n const raw = process.env.INTERFERE_API_URL;\n const trimmed = typeof raw === \"string\" ? raw.trim() : \"\";\n\n if (trimmed.length > 0) {\n return trimmed;\n }\n\n return API_URL;\n}\n\nexport function normalizeApiKey(\n raw: string | undefined\n): NonEmptyString | null {\n if (typeof raw !== \"string\") {\n return null;\n }\n\n const trimmed = raw.trim();\n const cleaned = trimmed.replace(/^['\"]|['\"]$/g, \"\");\n\n return toNonEmptyString(cleaned);\n}\n\nexport function normalizeSecretKey(\n raw: string | undefined\n): NonEmptyString | null {\n if (typeof raw !== \"string\") {\n return null;\n }\n\n const trimmed = raw.trim();\n const cleaned = trimmed.replace(/^['\"]|['\"]$/g, \"\");\n\n return toNonEmptyString(cleaned);\n}\n\nexport function normalizeSurfaceSlug(\n raw: string | undefined\n): NonEmptyString | null {\n if (typeof raw !== \"string\") {\n return null;\n }\n\n return toNonEmptyString(raw.trim());\n}\n\n"],"mappings":";;;;AAGA,SAAgB,gBAAwB;CACtC,MAAM,MAAM,QAAQ,IAAI;CACxB,MAAM,UAAU,OAAO,QAAQ,WAAW,IAAI,MAAM,GAAG;AAEvD,KAAI,QAAQ,SAAS,EACnB,QAAO;AAGT,QAAO;;AAGT,SAAgB,gBACd,KACuB;AACvB,KAAI,OAAO,QAAQ,SACjB,QAAO;AAMT,QAAO,iBAHS,IAAI,MAAM,CACF,QAAQ,gBAAgB,GAAG,CAEnB;;AAGlC,SAAgB,mBACd,KACuB;AACvB,KAAI,OAAO,QAAQ,SACjB,QAAO;AAMT,QAAO,iBAHS,IAAI,MAAM,CACF,QAAQ,gBAAgB,GAAG,CAEnB;;AAGlC,SAAgB,qBACd,KACuB;AACvB,KAAI,OAAO,QAAQ,SACjB,QAAO;AAGT,QAAO,iBAAiB,IAAI,MAAM,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/build/exchange-surface.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Build-time only: call auth exchange with API key (no surface slug) and return
|
|
4
|
+
* the surface slug from the response. Used to infer surface from key so we can
|
|
5
|
+
* bundle it and avoid runtime lookup.
|
|
6
|
+
*/
|
|
7
|
+
declare function fetchSurfaceSlugFromExchange(apiUrl: string, apiKey: string): Promise<string | null>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { fetchSurfaceSlugFromExchange };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exchange-surface.d.mts","names":[],"sources":["../../src/build/exchange-surface.ts"],"mappings":";;AAKA;;;;iBAAsB,4BAAA,CACpB,MAAA,UACA,MAAA,WACC,OAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//#region src/build/exchange-surface.ts
|
|
2
|
+
/**
|
|
3
|
+
* Build-time only: call auth exchange with API key (no surface slug) and return
|
|
4
|
+
* the surface slug from the response. Used to infer surface from key so we can
|
|
5
|
+
* bundle it and avoid runtime lookup.
|
|
6
|
+
*/
|
|
7
|
+
async function fetchSurfaceSlugFromExchange(apiUrl, apiKey) {
|
|
8
|
+
const url = `${apiUrl.replace(/\/$/, "")}/auth/exchange`;
|
|
9
|
+
const safePrefix = apiKey.length >= 5 ? `${apiKey.slice(0, 5)}...` : "(key set)";
|
|
10
|
+
if (process.env.NODE_ENV === "development" || process.env.DEBUG) console.info(`[Interfere] Sending auth/exchange with INTERFERE_API_KEY (${safePrefix}) to ${url}`);
|
|
11
|
+
const res = await fetch(url, {
|
|
12
|
+
method: "POST",
|
|
13
|
+
headers: {
|
|
14
|
+
"x-api-key": apiKey,
|
|
15
|
+
"Content-Type": "application/json"
|
|
16
|
+
},
|
|
17
|
+
body: "{}"
|
|
18
|
+
});
|
|
19
|
+
if (!res.ok) {
|
|
20
|
+
let hint = "";
|
|
21
|
+
try {
|
|
22
|
+
const body = await res.json();
|
|
23
|
+
if (body?.message) hint = ` Server: ${body.message}`;
|
|
24
|
+
else if (body?.code) hint = ` Server code: ${body.code}`;
|
|
25
|
+
} catch {}
|
|
26
|
+
const keyPrefix = apiKey.startsWith("ak_") ? "ak_..." : "key (not ak_...)";
|
|
27
|
+
const envMismatchHint = res.status === 401 ? "\n For 401: the key is being sent. If Clerk reports 'Not Found', the key was created in a different Clerk instance – use a key from the same environment as this API (sandbox key with sandbox API URL)." : "";
|
|
28
|
+
console.error(`[Interfere] auth/exchange returned ${res.status}.${hint}${envMismatchHint}\n INTERFERE_API_KEY is being sent (format: ${keyPrefix}). INTERFERE_API_URL: ${apiUrl}`);
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const slug = (await res.json())?.surfaceSlug;
|
|
32
|
+
return typeof slug === "string" && slug.length > 0 ? slug : null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
export { fetchSurfaceSlugFromExchange };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exchange-surface.mjs","names":[],"sources":["../../src/build/exchange-surface.ts"],"sourcesContent":["/**\n * Build-time only: call auth exchange with API key (no surface slug) and return\n * the surface slug from the response. Used to infer surface from key so we can\n * bundle it and avoid runtime lookup.\n */\nexport async function fetchSurfaceSlugFromExchange(\n apiUrl: string,\n apiKey: string\n): Promise<string | null> {\n const url = `${apiUrl.replace(/\\/$/, \"\")}/auth/exchange`;\n const safePrefix =\n apiKey.length >= 5 ? `${apiKey.slice(0, 5)}...` : \"(key set)\";\n if (process.env.NODE_ENV === \"development\" || process.env.DEBUG) {\n console.info(\n `[Interfere] Sending auth/exchange with INTERFERE_API_KEY (${safePrefix}) to ${url}`\n );\n }\n const res = await fetch(url, {\n method: \"POST\",\n headers: {\n \"x-api-key\": apiKey,\n \"Content-Type\": \"application/json\",\n },\n body: \"{}\",\n });\n\n if (!res.ok) {\n let hint = \"\";\n try {\n const body = (await res.json()) as { message?: string; code?: string };\n if (body?.message) {\n hint = ` Server: ${body.message}`;\n } else if (body?.code) {\n hint = ` Server code: ${body.code}`;\n }\n } catch {\n // ignore non-JSON body\n }\n const keyPrefix = apiKey.startsWith(\"ak_\") ? \"ak_...\" : \"key (not ak_...)\";\n const envMismatchHint =\n res.status === 401\n ? \"\\n For 401: the key is being sent. If Clerk reports 'Not Found', the key was created in a different Clerk instance – use a key from the same environment as this API (sandbox key with sandbox API URL).\"\n : \"\";\n console.error(\n `[Interfere] auth/exchange returned ${res.status}.${hint}${envMismatchHint}\\n` +\n ` INTERFERE_API_KEY is being sent (format: ${keyPrefix}). INTERFERE_API_URL: ${apiUrl}`\n );\n return null;\n }\n\n const data = (await res.json()) as { surfaceSlug?: string };\n const slug = data?.surfaceSlug;\n return typeof slug === \"string\" && slug.length > 0 ? slug : null;\n}\n"],"mappings":";;;;;;AAKA,eAAsB,6BACpB,QACA,QACwB;CACxB,MAAM,MAAM,GAAG,OAAO,QAAQ,OAAO,GAAG,CAAC;CACzC,MAAM,aACJ,OAAO,UAAU,IAAI,GAAG,OAAO,MAAM,GAAG,EAAE,CAAC,OAAO;AACpD,KAAI,QAAQ,IAAI,aAAa,iBAAiB,QAAQ,IAAI,MACxD,SAAQ,KACN,6DAA6D,WAAW,OAAO,MAChF;CAEH,MAAM,MAAM,MAAM,MAAM,KAAK;EAC3B,QAAQ;EACR,SAAS;GACP,aAAa;GACb,gBAAgB;GACjB;EACD,MAAM;EACP,CAAC;AAEF,KAAI,CAAC,IAAI,IAAI;EACX,IAAI,OAAO;AACX,MAAI;GACF,MAAM,OAAQ,MAAM,IAAI,MAAM;AAC9B,OAAI,MAAM,QACR,QAAO,YAAY,KAAK;YACf,MAAM,KACf,QAAO,iBAAiB,KAAK;UAEzB;EAGR,MAAM,YAAY,OAAO,WAAW,MAAM,GAAG,WAAW;EACxD,MAAM,kBACJ,IAAI,WAAW,MACX,8MACA;AACN,UAAQ,MACN,sCAAsC,IAAI,OAAO,GAAG,OAAO,gBAAgB,+CAC3B,UAAU,wBAAwB,SACnF;AACD,SAAO;;CAIT,MAAM,QADQ,MAAM,IAAI,MAAM,GACX;AACnB,QAAO,OAAO,SAAS,YAAY,KAAK,SAAS,IAAI,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"value-injection-loader.d.mts","names":[],"sources":["../../../src/build/loaders/value-injection-loader.ts"],"mappings":";;;UAEiB,2BAAA
|
|
1
|
+
{"version":3,"file":"value-injection-loader.d.mts","names":[],"sources":["../../../src/build/loaders/value-injection-loader.ts"],"mappings":";;;UAEiB,2BAAA;;EAEf,MAAA,GAAS,MAAA;EAFiC;EAI1C,gBAAA;AAAA;;;;;;AACD;;;;;iBAYuB,oBAAA,CACtB,IAAA,EAAM,aAAA,CAAc,2BAAA,GACpB,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.mts","names":[],"sources":["../../src/build/logger.ts"],"mappings":";;;cA+CM,eAAA,EAAe,MAAA,CAAA,MAAA;AAAA,iBA0HL,cAAA,
|
|
1
|
+
{"version":3,"file":"logger.d.mts","names":[],"sources":["../../src/build/logger.ts"],"mappings":";;;cA+CM,eAAA,EAAe,MAAA,CAAA,MAAA;AAAA,iBA0HL,cAAA,CAAe,KAAA,EAAO,QAAA,CAAS,OAAA,EAAS,KAAA,UAAe,KAAA,aAAe,MAAA,CAAA,MAAA;AAAA,iBAyCtE,gBAAA,CACd,KAAA,EAAO,QAAA,CAAS,OAAA,EAChB,KAAA,WAAa,MAAA,CAAA,MAAA;AAAA,iBAQC,kBAAA,CAAmB,IAAA,WAAY,MAAA,CAAA,MAAA;AAAA,cAWlC,aAAA,QAAa,MAAA,CAAA,MAAA;AAAA,iBAiBV,oBAAA,SAAA,CACd,KAAA,EAAO,QAAA,CAAS,OAAA,EAChB,KAAA,UACA,GAAA,GACE,GAAA,GAAM,IAAA,aAAiB,UAAA,QAAkB,kBAAA,MACtC,MAAA,CAAO,MAAA,CAAO,CAAA,EAAG,CAAA,EAAG,CAAA,IACxB,MAAA,CAAO,MAAA,CAAO,CAAA,EAAG,CAAA,EAAG,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nextjs-version.d.mts","names":[],"sources":["../../src/build/nextjs-version.ts"],"mappings":";;AAGA
|
|
1
|
+
{"version":3,"file":"nextjs-version.d.mts","names":[],"sources":["../../src/build/nextjs-version.ts"],"mappings":";;AAGA;;KAAY,YAAA;EACV,KAAA;EACA,KAAA;EACA,KAAA;EACA,UAAA;AAAA;;;AASF;;;;iBAAgB,WAAA,CAAY,OAAA,WAAkB,YAAA;AAoC9C;;;;;AAoDA;;;;;;;;;AApDA,iBAAgB,2BAAA,CAA4B,OAAA;;;;;;iBAoD5B,mBAAA,CAAA"}
|
|
@@ -2,8 +2,8 @@ import { PreflightConfig } from "../lib/types.mjs";
|
|
|
2
2
|
import { FileDeleteError, FileGlobError, MissingBuildIdError, MissingReleaseIdError } from "./source-maps/errors.mjs";
|
|
3
3
|
import { ConfigService } from "./services/config.service.mjs";
|
|
4
4
|
import { ReleaseIdentityService } from "./services/release-identity.service.mjs";
|
|
5
|
-
import { SourceMapService } from "./services/source-map.service.mjs";
|
|
6
5
|
import { ReleaseApiService } from "./services/release-api.service.mjs";
|
|
6
|
+
import { SourceMapService } from "./services/source-map.service.mjs";
|
|
7
7
|
import { SourceMapFailureCleanupService } from "./services/source-map-failure-cleanup.service.mjs";
|
|
8
8
|
import { Effect, Layer } from "effect";
|
|
9
9
|
|
|
@@ -12,10 +12,10 @@ import { Effect, Layer } from "effect";
|
|
|
12
12
|
* The main release upload program.
|
|
13
13
|
* This is a single Effect that orchestrates the entire release process.
|
|
14
14
|
*/
|
|
15
|
-
declare const releaseProgram: Effect.Effect<void, MissingBuildIdError | MissingReleaseIdError | FileGlobError | FileDeleteError, ReleaseApiService | ReleaseIdentityService | SourceMapFailureCleanupService |
|
|
15
|
+
declare const releaseProgram: Effect.Effect<void, MissingBuildIdError | MissingReleaseIdError | FileGlobError | FileDeleteError, ConfigService | ReleaseApiService | ReleaseIdentityService | SourceMapFailureCleanupService | SourceMapService>;
|
|
16
16
|
/**
|
|
17
17
|
* Create the layer stack for the release program
|
|
18
18
|
*/
|
|
19
|
-
declare const createReleaseLayers: (config: PreflightConfig) => Layer.Layer<ReleaseApiService | ReleaseIdentityService | SourceMapFailureCleanupService |
|
|
19
|
+
declare const createReleaseLayers: (config: PreflightConfig) => Layer.Layer<ConfigService | ReleaseApiService | ReleaseIdentityService | SourceMapFailureCleanupService | SourceMapService, never, never>;
|
|
20
20
|
//#endregion
|
|
21
21
|
export { createReleaseLayers, releaseProgram };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release-program.d.mts","names":[],"sources":["../../src/build/release-program.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"release-program.d.mts","names":[],"sources":["../../src/build/release-program.ts"],"mappings":";;;;;;;;;;;;;AA6BA;cAAa,cAAA,EAAc,MAAA,CAAA,MAAA,OAsI1B,mBAAA,GAtI0B,qBAAA,GAAA,aAAA,GAAA,eAAA,EAAA,aAAA,GAAA,iBAAA,GAAA,sBAAA,GAAA,8BAAA,GAAA,gBAAA;;;;cA2Id,mBAAA,GAAuB,MAAA,EAAQ,eAAA,KAAe,KAAA,CAAA,KAAA,CAAA,aAAA,GAAA,iBAAA,GAAA,sBAAA,GAAA,8BAAA,GAAA,gBAAA"}
|
|
@@ -23,8 +23,8 @@ const releaseProgram = Effect.gen(function* () {
|
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
25
|
const sourceMapService = yield* SourceMapService;
|
|
26
|
-
if (!config.
|
|
27
|
-
yield* logBuildResult("Warning", "Skipping Release", ["Missing
|
|
26
|
+
if (!config.apiKey) {
|
|
27
|
+
yield* logBuildResult("Warning", "Skipping Release", ["Missing API key. Please set the `INTERFERE_API_KEY` environment variable."]);
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
30
|
yield* Effect.logDebug("Getting release identity");
|
|
@@ -52,10 +52,8 @@ const releaseProgram = Effect.gen(function* () {
|
|
|
52
52
|
const releaseResponse = yield* (yield* ReleaseApiService).createRelease(config, {
|
|
53
53
|
environment: config.environment,
|
|
54
54
|
sourceId: identity.buildId,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
destinationType: identity.deployment.type,
|
|
58
|
-
destinationMetadata: identity.deployment.metadata
|
|
55
|
+
sourceMetadata: identity.sourceControl?.metadata,
|
|
56
|
+
destinationMetadata: identity.deployment?.metadata
|
|
59
57
|
});
|
|
60
58
|
yield* Effect.logDebug(`Release created in ${Date.now() - createStart}ms`);
|
|
61
59
|
yield* Effect.logDebug("Reading source maps");
|
|
@@ -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 {\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.
|
|
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"],"mappings":";;;;
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation-detection.service.d.mts","names":[],"sources":["../../../src/build/services/instrumentation-detection.service.ts"],"mappings":";UAGiB,oBAAA;EAAA,
|
|
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"}
|
|
@@ -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"],"mappings":";;;;;
|
|
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,7 +1,8 @@
|
|
|
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
|
|
@@ -9,34 +10,24 @@ var PreflightService = class extends Context.Tag("PreflightService")() {};
|
|
|
9
10
|
const validateEnvironment = Effect.fn("validateEnvironment")(function* () {
|
|
10
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." });
|
|
11
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." });
|
|
12
|
-
if (typeof process.env.
|
|
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* new InvalidSecretKeyError({ message: "Invalid secret key. Set the INTERFERE_SECRET_KEY environment variable" });
|
|
18
|
-
return result;
|
|
19
|
-
});
|
|
20
|
-
const extractSurfaceSlug = Effect.fn("extractSurfaceSlug")(function* (secretKey) {
|
|
21
|
-
const parsed = parseSurfaceSlugFromSecretKey(secretKey);
|
|
22
|
-
const result = parsed ? toNonEmptyString(parsed) : void 0;
|
|
23
|
-
if (!result) return yield* 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
|
-
extractSurfaceSlug,
|
|
22
|
+
validateApiKey,
|
|
30
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"}
|
|
@@ -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"],"mappings":";;;;;
|
|
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"}
|
|
@@ -11,30 +11,43 @@ const makeReleaseIdentity = Effect.fn("makeReleaseIdentity")(function* () {
|
|
|
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
35
|
if (!buildId && !releaseId) return yield* new MissingBuildIdError({ message: "Couldn't determine build ID (no deployment provider, git, or env vars found)" });
|
|
36
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
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,
|
|
@@ -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"}
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import { FileDeleteError, FileGlobError, FileHashError, FileReadError, InvalidApiUrlError, UploadError } from "../source-maps/errors.mjs";
|
|
2
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 };
|