@interfere/constants 8.1.2 → 9.0.1

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/README.md CHANGED
@@ -2,15 +2,15 @@
2
2
  <a href="https://interfere.com">
3
3
  <picture>
4
4
  <source media="(prefers-color-scheme: dark)" srcset="https://qyzkf4cgb8ydxtq1.public.blob.vercel-storage.com/v2/header/logo-dark.png">
5
- <img src="https://qyzkf4cgb8ydxtq1.public.blob.vercel-storage.com/v2/header/logo-light.png" height="64">
5
+ <img src="https://qyzkf4cgb8ydxtq1.public.blob.vercel-storage.com/v2/header/logo-light.png" height="64" alt="Interfere">
6
6
  </picture>
7
7
  </a>
8
8
  <h1 align="center">@interfere/constants</h1>
9
9
  </p>
10
10
 
11
11
  <p align="center">
12
- <a href="https://www.npmjs.com/package/@interfere/constants"><img src="https://img.shields.io/npm/v/@interfere/constants.svg" /></a>
13
- <a href="https://github.com/interfere-inc/interfere/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/@interfere/constants.svg" /></a>
12
+ <a href="https://www.npmjs.com/package/@interfere/constants"><img src="https://img.shields.io/npm/v/@interfere/constants.svg" alt="npm version" /></a>
13
+ <a href="https://github.com/interfere-inc/interfere/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/@interfere/constants.svg" alt="License" /></a>
14
14
  </p>
15
15
 
16
16
  <p align="center">
package/dist/api.d.mts CHANGED
@@ -1,9 +1,9 @@
1
1
  //#region src/api.d.ts
2
2
  declare const API_URL = "https://in.interfere.com";
3
3
  declare const API_PATHS: {
4
- readonly CONFIG: "/v1/config";
5
- readonly INGEST: "/v1/ingest";
6
- readonly SESSION: "/v1/session";
4
+ readonly CONFIG: "/v2/config";
5
+ readonly SESSION: "/v2/session";
6
+ readonly SINK: "/v2/sink";
7
7
  };
8
8
  //#endregion
9
9
  export { API_PATHS, API_URL };
package/dist/api.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  //#region src/api.ts
2
2
  const API_URL = "https://in.interfere.com";
3
3
  const API_PATHS = {
4
- CONFIG: "/v1/config",
5
- INGEST: "/v1/ingest",
6
- SESSION: "/v1/session"
4
+ CONFIG: "/v2/config",
5
+ SESSION: "/v2/session",
6
+ SINK: "/v2/sink"
7
7
  };
8
8
  //#endregion
9
9
  export { API_PATHS, API_URL };
package/dist/api.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.mjs","names":[],"sources":["../src/api.ts"],"sourcesContent":["export const API_URL = \"https://in.interfere.com\";\n\nexport const API_PATHS = {\n CONFIG: \"/v1/config\",\n INGEST: \"/v1/ingest\",\n SESSION: \"/v1/session\",\n} as const;\n"],"mappings":";AAAA,MAAa,UAAU;AAEvB,MAAa,YAAY;CACvB,QAAQ;CACR,QAAQ;CACR,SAAS;CACV"}
1
+ {"version":3,"file":"api.mjs","names":[],"sources":["../src/api.ts"],"sourcesContent":["export const API_URL = \"https://in.interfere.com\";\n\nexport const API_PATHS = {\n CONFIG: \"/v2/config\",\n SESSION: \"/v2/session\",\n SINK: \"/v2/sink\",\n} as const;\n"],"mappings":";AAAA,MAAa,UAAU;AAEvB,MAAa,YAAY;CACvB,QAAQ;CACR,SAAS;CACT,MAAM;CACP"}
@@ -0,0 +1,15 @@
1
+ //#region src/route-prefix.d.ts
2
+ declare const DEFAULT_ROUTE_PREFIX = "/api/interfere";
3
+ /**
4
+ * Resolves the route prefix used by the Interfere proxy route handler and the
5
+ * client-side SDK. Consumers can override `/api/interfere` by setting
6
+ * `NEXT_PUBLIC_INTERFERE_ROUTE_PREFIX` in their environment, or by injecting
7
+ * `globalThis.__INTERFERE_ROUTE_PREFIX__` (used by bundler plugins).
8
+ *
9
+ * The returned prefix is normalized: it always starts with `/` and never has a
10
+ * trailing slash (except when the prefix is exactly `/`).
11
+ */
12
+ declare function resolveRoutePrefix(): string;
13
+ declare function normalizeRoutePrefix(prefix: string): string;
14
+ //#endregion
15
+ export { DEFAULT_ROUTE_PREFIX, normalizeRoutePrefix, resolveRoutePrefix };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-prefix.d.mts","names":[],"sources":["../src/route-prefix.ts"],"mappings":";cAAa,oBAAA;AAAb;;;;;AAcA;;;;AAdA,iBAcgB,kBAAA,CAAA;AAAA,iBAkBA,oBAAA,CAAqB,MAAA"}
@@ -0,0 +1,30 @@
1
+ //#region src/route-prefix.ts
2
+ const DEFAULT_ROUTE_PREFIX = "/api/interfere";
3
+ const ENV_VAR_NAME = "NEXT_PUBLIC_INTERFERE_ROUTE_PREFIX";
4
+ const GLOBAL_OVERRIDE_KEY = "__INTERFERE_ROUTE_PREFIX__";
5
+ /**
6
+ * Resolves the route prefix used by the Interfere proxy route handler and the
7
+ * client-side SDK. Consumers can override `/api/interfere` by setting
8
+ * `NEXT_PUBLIC_INTERFERE_ROUTE_PREFIX` in their environment, or by injecting
9
+ * `globalThis.__INTERFERE_ROUTE_PREFIX__` (used by bundler plugins).
10
+ *
11
+ * The returned prefix is normalized: it always starts with `/` and never has a
12
+ * trailing slash (except when the prefix is exactly `/`).
13
+ */
14
+ function resolveRoutePrefix() {
15
+ const fromGlobal = globalThis[GLOBAL_OVERRIDE_KEY];
16
+ if (typeof fromGlobal === "string" && fromGlobal.length > 0) return normalizeRoutePrefix(fromGlobal);
17
+ if (typeof process !== "undefined") {
18
+ const fromEnv = process.env[ENV_VAR_NAME];
19
+ if (typeof fromEnv === "string" && fromEnv.length > 0) return normalizeRoutePrefix(fromEnv);
20
+ }
21
+ return DEFAULT_ROUTE_PREFIX;
22
+ }
23
+ function normalizeRoutePrefix(prefix) {
24
+ const trimmed = prefix.trim();
25
+ if (trimmed === "" || trimmed === "/") return DEFAULT_ROUTE_PREFIX;
26
+ const withLeading = trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
27
+ return withLeading.endsWith("/") ? withLeading.slice(0, -1) : withLeading;
28
+ }
29
+ //#endregion
30
+ export { DEFAULT_ROUTE_PREFIX, normalizeRoutePrefix, resolveRoutePrefix };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-prefix.mjs","names":[],"sources":["../src/route-prefix.ts"],"sourcesContent":["export const DEFAULT_ROUTE_PREFIX = \"/api/interfere\";\n\nconst ENV_VAR_NAME = \"NEXT_PUBLIC_INTERFERE_ROUTE_PREFIX\";\nconst GLOBAL_OVERRIDE_KEY = \"__INTERFERE_ROUTE_PREFIX__\";\n\n/**\n * Resolves the route prefix used by the Interfere proxy route handler and the\n * client-side SDK. Consumers can override `/api/interfere` by setting\n * `NEXT_PUBLIC_INTERFERE_ROUTE_PREFIX` in their environment, or by injecting\n * `globalThis.__INTERFERE_ROUTE_PREFIX__` (used by bundler plugins).\n *\n * The returned prefix is normalized: it always starts with `/` and never has a\n * trailing slash (except when the prefix is exactly `/`).\n */\nexport function resolveRoutePrefix(): string {\n const fromGlobal = (globalThis as Record<string, unknown>)[\n GLOBAL_OVERRIDE_KEY\n ];\n if (typeof fromGlobal === \"string\" && fromGlobal.length > 0) {\n return normalizeRoutePrefix(fromGlobal);\n }\n\n if (typeof process !== \"undefined\") {\n const fromEnv = process.env[ENV_VAR_NAME];\n if (typeof fromEnv === \"string\" && fromEnv.length > 0) {\n return normalizeRoutePrefix(fromEnv);\n }\n }\n\n return DEFAULT_ROUTE_PREFIX;\n}\n\nexport function normalizeRoutePrefix(prefix: string): string {\n const trimmed = prefix.trim();\n if (trimmed === \"\" || trimmed === \"/\") {\n return DEFAULT_ROUTE_PREFIX;\n }\n const withLeading = trimmed.startsWith(\"/\") ? trimmed : `/${trimmed}`;\n return withLeading.endsWith(\"/\") ? withLeading.slice(0, -1) : withLeading;\n}\n"],"mappings":";AAAA,MAAa,uBAAuB;AAEpC,MAAM,eAAe;AACrB,MAAM,sBAAsB;;;;;;;;;;AAW5B,SAAgB,qBAA6B;CAC3C,MAAM,aAAc,WAClB;CAEF,IAAI,OAAO,eAAe,YAAY,WAAW,SAAS,GACxD,OAAO,qBAAqB,WAAW;CAGzC,IAAI,OAAO,YAAY,aAAa;EAClC,MAAM,UAAU,QAAQ,IAAI;EAC5B,IAAI,OAAO,YAAY,YAAY,QAAQ,SAAS,GAClD,OAAO,qBAAqB,QAAQ;;CAIxC,OAAO;;AAGT,SAAgB,qBAAqB,QAAwB;CAC3D,MAAM,UAAU,OAAO,MAAM;CAC7B,IAAI,YAAY,MAAM,YAAY,KAChC,OAAO;CAET,MAAM,cAAc,QAAQ,WAAW,IAAI,GAAG,UAAU,IAAI;CAC5D,OAAO,YAAY,SAAS,IAAI,GAAG,YAAY,MAAM,GAAG,GAAG,GAAG"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@interfere/constants",
3
- "version": "8.1.2",
3
+ "version": "9.0.1",
4
4
  "license": "MIT",
5
5
  "description": "Build apps that never break.",
6
6
  "keywords": [
7
7
  "observability",
8
- "typescript",
8
+ "@typescript/native-preview",
9
9
  "react",
10
10
  "logging",
11
11
  "error-tracking",
@@ -28,34 +28,35 @@
28
28
  "exports": {
29
29
  "./api": {
30
30
  "@source": "./src/api.ts",
31
+ "types": "./dist/api.d.mts",
31
32
  "default": "./dist/api.mjs"
32
33
  },
33
34
  "./http": {
34
35
  "@source": "./src/http.ts",
36
+ "types": "./dist/http.d.mts",
35
37
  "default": "./dist/http.mjs"
36
38
  },
39
+ "./route-prefix": {
40
+ "@source": "./src/route-prefix.ts",
41
+ "types": "./dist/route-prefix.d.mts",
42
+ "default": "./dist/route-prefix.mjs"
43
+ },
37
44
  "./package.json": "./package.json"
38
45
  },
39
46
  "publishConfig": {
40
- "access": "public",
41
- "exports": {
42
- "./api": "./dist/api.mjs",
43
- "./http": "./dist/http.mjs",
44
- "./package.json": "./package.json"
45
- }
47
+ "access": "public"
46
48
  },
47
49
  "scripts": {
48
50
  "build": "tsdown",
49
- "dev": "tsdown --watch",
50
- "typecheck": "tsc --noEmit --incremental"
51
+ "typecheck": "tsgo --noEmit --incremental"
51
52
  },
52
53
  "dependencies": {
53
- "better-status-codes": "^2.1.5"
54
+ "better-status-codes": "^2.2.0"
54
55
  },
55
56
  "devDependencies": {
56
- "@interfere/typescript-config": "^8.1.1",
57
+ "@interfere/typescript-config": "^9.0.0",
57
58
  "@types/node": "^24.12.0",
58
- "tsdown": "^0.21.7",
59
- "typescript": "6.0.2"
59
+ "@typescript/native-preview": "7.0.0-dev.20260512.1",
60
+ "tsdown": "^0.22.0"
60
61
  }
61
62
  }