@interfere/constants 9.0.1 → 9.0.2-canary.0
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/dist/api.cjs +1 -0
- package/dist/api.d.cts +10 -0
- package/dist/api.d.mts +2 -1
- package/dist/api.mjs +2 -9
- package/dist/http.cjs +1 -0
- package/dist/http.d.cts +2 -0
- package/dist/http.mjs +1 -2
- package/dist/route-prefix.cjs +1 -0
- package/dist/route-prefix.d.cts +16 -0
- package/dist/route-prefix.d.mts +2 -1
- package/dist/route-prefix.mjs +2 -30
- package/package.json +38 -13
- package/dist/api.d.mts.map +0 -1
- package/dist/api.mjs.map +0 -1
- package/dist/route-prefix.d.mts.map +0 -1
- package/dist/route-prefix.mjs.map +0 -1
package/dist/api.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const API_PATHS={CONFIG:`/v2/config`,SESSION:`/v2/session`,SINK:`/v2/sink`};exports.API_PATHS=API_PATHS,exports.API_URL=`https://in.interfere.com`;
|
package/dist/api.d.cts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/api.d.ts
|
|
2
|
+
declare const API_URL = "https://in.interfere.com";
|
|
3
|
+
declare const API_PATHS: {
|
|
4
|
+
readonly CONFIG: "/v2/config";
|
|
5
|
+
readonly SESSION: "/v2/session";
|
|
6
|
+
readonly SINK: "/v2/sink";
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { API_PATHS, API_URL };
|
|
10
|
+
//# sourceMappingURL=api.d.cts.map
|
package/dist/api.d.mts
CHANGED
package/dist/api.mjs
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const API_PATHS = {
|
|
4
|
-
CONFIG: "/v2/config",
|
|
5
|
-
SESSION: "/v2/session",
|
|
6
|
-
SINK: "/v2/sink"
|
|
7
|
-
};
|
|
8
|
-
//#endregion
|
|
9
|
-
export { API_PATHS, API_URL };
|
|
1
|
+
const API_URL=`https://in.interfere.com`,API_PATHS={CONFIG:`/v2/config`,SESSION:`/v2/session`,SINK:`/v2/sink`};export{API_PATHS,API_URL};
|
|
2
|
+
//# sourceMappingURL=api.mjs.map
|
package/dist/http.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let better_status_codes=require("better-status-codes");Object.defineProperty(exports,"Status",{enumerable:!0,get:function(){return better_status_codes.Status}}),Object.defineProperty(exports,"StatusText",{enumerable:!0,get:function(){return better_status_codes.StatusText}});
|
package/dist/http.d.cts
ADDED
package/dist/http.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { Status, StatusText };
|
|
1
|
+
import{Status,StatusText}from"better-status-codes";export{Status,StatusText};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const DEFAULT_ROUTE_PREFIX=`/api/interfere`;function resolveRoutePrefix(){let fromGlobal=globalThis.__INTERFERE_ROUTE_PREFIX__;if(typeof fromGlobal==`string`&&fromGlobal.length>0)return normalizeRoutePrefix(fromGlobal);if(typeof process<`u`){let fromEnv=process.env.NEXT_PUBLIC_INTERFERE_ROUTE_PREFIX;if(typeof fromEnv==`string`&&fromEnv.length>0)return normalizeRoutePrefix(fromEnv)}return DEFAULT_ROUTE_PREFIX}function normalizeRoutePrefix(prefix){let trimmed=prefix.trim();if(trimmed===``||trimmed===`/`)return DEFAULT_ROUTE_PREFIX;let withLeading=trimmed.startsWith(`/`)?trimmed:`/${trimmed}`;return withLeading.endsWith(`/`)?withLeading.slice(0,-1):withLeading}exports.DEFAULT_ROUTE_PREFIX=DEFAULT_ROUTE_PREFIX,exports.normalizeRoutePrefix=normalizeRoutePrefix,exports.resolveRoutePrefix=resolveRoutePrefix;
|
|
@@ -0,0 +1,16 @@
|
|
|
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 };
|
|
16
|
+
//# sourceMappingURL=route-prefix.d.cts.map
|
package/dist/route-prefix.d.mts
CHANGED
|
@@ -12,4 +12,5 @@ declare const DEFAULT_ROUTE_PREFIX = "/api/interfere";
|
|
|
12
12
|
declare function resolveRoutePrefix(): string;
|
|
13
13
|
declare function normalizeRoutePrefix(prefix: string): string;
|
|
14
14
|
//#endregion
|
|
15
|
-
export { DEFAULT_ROUTE_PREFIX, normalizeRoutePrefix, resolveRoutePrefix };
|
|
15
|
+
export { DEFAULT_ROUTE_PREFIX, normalizeRoutePrefix, resolveRoutePrefix };
|
|
16
|
+
//# sourceMappingURL=route-prefix.d.mts.map
|
package/dist/route-prefix.mjs
CHANGED
|
@@ -1,30 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 };
|
|
1
|
+
const DEFAULT_ROUTE_PREFIX=`/api/interfere`;function resolveRoutePrefix(){let fromGlobal=globalThis.__INTERFERE_ROUTE_PREFIX__;if(typeof fromGlobal==`string`&&fromGlobal.length>0)return normalizeRoutePrefix(fromGlobal);if(typeof process<`u`){let fromEnv=process.env.NEXT_PUBLIC_INTERFERE_ROUTE_PREFIX;if(typeof fromEnv==`string`&&fromEnv.length>0)return normalizeRoutePrefix(fromEnv)}return DEFAULT_ROUTE_PREFIX}function normalizeRoutePrefix(prefix){let trimmed=prefix.trim();if(trimmed===``||trimmed===`/`)return DEFAULT_ROUTE_PREFIX;let withLeading=trimmed.startsWith(`/`)?trimmed:`/${trimmed}`;return withLeading.endsWith(`/`)?withLeading.slice(0,-1):withLeading}export{DEFAULT_ROUTE_PREFIX,normalizeRoutePrefix,resolveRoutePrefix};
|
|
2
|
+
//# sourceMappingURL=route-prefix.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interfere/constants",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.2-canary.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Build apps that never break.",
|
|
6
6
|
"keywords": [
|
|
@@ -22,24 +22,46 @@
|
|
|
22
22
|
"directory": "src/packages/public/constants"
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
|
-
"dist"
|
|
25
|
+
"dist/**/*.cjs",
|
|
26
|
+
"dist/**/*.mjs",
|
|
27
|
+
"dist/**/*.d.cts",
|
|
28
|
+
"dist/**/*.d.mts",
|
|
29
|
+
"README.md"
|
|
26
30
|
],
|
|
27
31
|
"type": "module",
|
|
28
32
|
"exports": {
|
|
29
33
|
"./api": {
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
|
|
34
|
+
"monorepo": "./src/api.ts",
|
|
35
|
+
"import": {
|
|
36
|
+
"types": "./dist/api.d.mts",
|
|
37
|
+
"default": "./dist/api.mjs"
|
|
38
|
+
},
|
|
39
|
+
"require": {
|
|
40
|
+
"types": "./dist/api.d.cts",
|
|
41
|
+
"default": "./dist/api.cjs"
|
|
42
|
+
}
|
|
33
43
|
},
|
|
34
44
|
"./http": {
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
|
|
45
|
+
"monorepo": "./src/http.ts",
|
|
46
|
+
"import": {
|
|
47
|
+
"types": "./dist/http.d.mts",
|
|
48
|
+
"default": "./dist/http.mjs"
|
|
49
|
+
},
|
|
50
|
+
"require": {
|
|
51
|
+
"types": "./dist/http.d.cts",
|
|
52
|
+
"default": "./dist/http.cjs"
|
|
53
|
+
}
|
|
38
54
|
},
|
|
39
55
|
"./route-prefix": {
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
|
|
56
|
+
"monorepo": "./src/route-prefix.ts",
|
|
57
|
+
"import": {
|
|
58
|
+
"types": "./dist/route-prefix.d.mts",
|
|
59
|
+
"default": "./dist/route-prefix.mjs"
|
|
60
|
+
},
|
|
61
|
+
"require": {
|
|
62
|
+
"types": "./dist/route-prefix.d.cts",
|
|
63
|
+
"default": "./dist/route-prefix.cjs"
|
|
64
|
+
}
|
|
43
65
|
},
|
|
44
66
|
"./package.json": "./package.json"
|
|
45
67
|
},
|
|
@@ -48,15 +70,18 @@
|
|
|
48
70
|
},
|
|
49
71
|
"scripts": {
|
|
50
72
|
"build": "tsdown",
|
|
73
|
+
"test": "vitest run --passWithNoTests",
|
|
51
74
|
"typecheck": "tsgo --noEmit --incremental"
|
|
52
75
|
},
|
|
53
76
|
"dependencies": {
|
|
54
77
|
"better-status-codes": "^2.2.0"
|
|
55
78
|
},
|
|
56
79
|
"devDependencies": {
|
|
80
|
+
"@interfere/test-utils": "^9.0.0",
|
|
57
81
|
"@interfere/typescript-config": "^9.0.0",
|
|
58
82
|
"@types/node": "^24.12.0",
|
|
59
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
60
|
-
"tsdown": "^0.22.0"
|
|
83
|
+
"@typescript/native-preview": "7.0.0-dev.20260522.1",
|
|
84
|
+
"tsdown": "^0.22.0",
|
|
85
|
+
"vitest": "^4.1.6"
|
|
61
86
|
}
|
|
62
87
|
}
|
package/dist/api.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.mts","names":[],"sources":["../src/api.ts"],"mappings":";cAAa,OAAA;AAAA,cAEA,SAAA;EAAA"}
|
package/dist/api.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|