@interfere/constants 0.0.1 → 0.0.2-alpha.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/dist/api.d.mts +8 -0
- package/dist/api.d.mts.map +1 -0
- package/dist/api.mjs +8 -0
- package/dist/api.mjs.map +1 -0
- package/dist/http.d.mts +2 -0
- package/dist/http.mjs +2 -0
- package/package.json +21 -16
- package/dist/index.d.ts +0 -55
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -66
- package/dist/index.js.map +0 -1
package/dist/api.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.mts","names":[],"sources":["../src/api.ts"],"mappings":";cAAa,OAAA;AAAA,cAEA,SAAA;EAAA,SAGH,MAAA;EAAA,SAAA,OAAA;AAAA"}
|
package/dist/api.mjs
ADDED
package/dist/api.mjs.map
ADDED
|
@@ -0,0 +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 INGEST: \"/v1/ingest\",\n SESSION: \"/v1/session\",\n} as const;\n"],"mappings":";AAAA,MAAa,UAAU;AAEvB,MAAa,YAAY;CACvB,QAAQ;CACR,SAAS;CACV"}
|
package/dist/http.d.mts
ADDED
package/dist/http.mjs
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interfere/constants",
|
|
3
|
-
"version": "0.0.1",
|
|
3
|
+
"version": "0.0.2-alpha.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Build apps that never break.",
|
|
6
6
|
"keywords": [
|
|
@@ -16,32 +16,37 @@
|
|
|
16
16
|
"url": "mailto:support@interfere.com"
|
|
17
17
|
},
|
|
18
18
|
"author": "Interfere <support@interfere.com> (https://interfere.com)",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/interfere-inc/interfere.git",
|
|
22
|
+
"directory": "src/packages/public/constants"
|
|
23
|
+
},
|
|
19
24
|
"files": [
|
|
20
25
|
"dist"
|
|
21
26
|
],
|
|
22
27
|
"type": "module",
|
|
23
|
-
"main": "./dist/index.js",
|
|
24
|
-
"types": "./dist/index.d.ts",
|
|
25
28
|
"exports": {
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
+
"./*": {
|
|
30
|
+
"@source": "./src/*.ts",
|
|
31
|
+
"types": "./dist/*.d.mts",
|
|
32
|
+
"default": "./dist/*.mjs"
|
|
29
33
|
}
|
|
30
34
|
},
|
|
31
35
|
"publishConfig": {
|
|
32
36
|
"access": "public"
|
|
33
37
|
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsdown",
|
|
40
|
+
"dev": "tsdown --watch",
|
|
41
|
+
"typecheck": "tsc --noEmit --incremental"
|
|
42
|
+
},
|
|
34
43
|
"dependencies": {
|
|
35
|
-
"
|
|
44
|
+
"better-status-codes": "catalog:"
|
|
36
45
|
},
|
|
37
46
|
"devDependencies": {
|
|
38
|
-
"@
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
"scripts": {
|
|
43
|
-
"build": "tsc",
|
|
44
|
-
"dev": "tsc --watch",
|
|
45
|
-
"check-types": "tsc --noEmit --incremental"
|
|
47
|
+
"@interfere/typescript-config": "workspace:*",
|
|
48
|
+
"@types/node": "catalog:",
|
|
49
|
+
"tsdown": "catalog:",
|
|
50
|
+
"typescript": "catalog:"
|
|
46
51
|
}
|
|
47
|
-
}
|
|
52
|
+
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/** biome-ignore-all lint/style/noMagicNumbers: Self-explanatory */
|
|
2
|
-
/**
|
|
3
|
-
* Core constants and configuration defaults
|
|
4
|
-
*/
|
|
5
|
-
import type { EventType } from "@interfere/schemas/envelope";
|
|
6
|
-
export declare const BACKGROUND_EVENT_TYPES: EventType[];
|
|
7
|
-
export declare const REPLAY_CHUNK_MS = 5000;
|
|
8
|
-
export declare const RAGE_CLICK_THRESHOLD = 3;
|
|
9
|
-
export declare const RAGE_CLICK_TIME_WINDOW = 1000;
|
|
10
|
-
export declare const SESSION_SUMMARY_INTERVAL = 30000;
|
|
11
|
-
export declare const MAX_QUEUE_SIZE = 10;
|
|
12
|
-
export declare const DEFAULT_FLUSH_INTERVAL = 10000;
|
|
13
|
-
export declare const API_PATHS: {
|
|
14
|
-
readonly INGEST_V0: "/ingest/v0";
|
|
15
|
-
readonly RELEASES: "/internal/releases";
|
|
16
|
-
};
|
|
17
|
-
export declare const MS_PER_SECOND = 1000;
|
|
18
|
-
export declare const SECONDS_PER_MINUTE = 60;
|
|
19
|
-
export declare const MINUTES_PER_HOUR = 60;
|
|
20
|
-
export declare const HOURS_PER_DAY = 24;
|
|
21
|
-
export declare const MINUTES_IN_MS: number;
|
|
22
|
-
export declare const HOUR_IN_MS: number;
|
|
23
|
-
export declare const DAY_IN_MS: number;
|
|
24
|
-
export declare const FIVE_SECONDS_MS: number;
|
|
25
|
-
export declare const TEN_SECONDS_MS: number;
|
|
26
|
-
export declare const FIVE_MINUTES_MS: number;
|
|
27
|
-
export declare const THREE_MINUTES_MS: number;
|
|
28
|
-
export declare const THIRTY_MINUTES_MS: number;
|
|
29
|
-
export declare const RADIX_36 = 36;
|
|
30
|
-
export declare const RADIX_16 = 16;
|
|
31
|
-
export declare const RANDOM_SUBSTRING_START = 2;
|
|
32
|
-
export declare const RANDOM_ID_LENGTH_SHORT = 7;
|
|
33
|
-
export declare const RANDOM_ID_LENGTH_MEDIUM = 9;
|
|
34
|
-
export declare const RANDOM_ID_LENGTH_LONG = 13;
|
|
35
|
-
export declare const RANDOM_SUBSTRING_END = 15;
|
|
36
|
-
export declare const MAX_RETRIES = 3;
|
|
37
|
-
export declare const BACKOFF_BASE_MS = 1000;
|
|
38
|
-
export declare const BACKOFF_MULTIPLIER = 2;
|
|
39
|
-
export declare const MAX_BACKOFF_MS = 30000;
|
|
40
|
-
export declare const BATCH_SIZE = 10;
|
|
41
|
-
export declare const BATCH_TIMEOUT_MS = 5000;
|
|
42
|
-
export declare const MAX_BATCH_SIZE = 100;
|
|
43
|
-
export declare const MAX_SESSIONS = 1000;
|
|
44
|
-
export declare const MAX_STORAGE_SIZE_BYTES: number;
|
|
45
|
-
export declare const COMPRESSION_MIN_SIZE = 1000;
|
|
46
|
-
export declare const COMPRESSION_RATIO = 0.7;
|
|
47
|
-
export declare const QUEUE_REDUCTION_FACTOR = 0.9;
|
|
48
|
-
export declare const CLEANUP_INTERVAL_MINUTES = 5;
|
|
49
|
-
export declare const SESSION_CLEANUP_INTERVAL_MS: number;
|
|
50
|
-
export declare const SESSION_KEY = "interfere_session";
|
|
51
|
-
export declare const SESSION_DURATION_MS: number;
|
|
52
|
-
export declare const SESSION_EXTEND_THRESHOLD_MS: number;
|
|
53
|
-
export declare const SESSION_ID_REGEX: RegExp;
|
|
54
|
-
export declare const UUID_REGEX: RegExp;
|
|
55
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAEnE;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAG7D,eAAO,MAAM,sBAAsB,EAAE,SAAS,EAG7C,CAAC;AAEF,eAAO,MAAM,eAAe,OAAO,CAAC;AACpC,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAC3C,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAG/C,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,eAAO,MAAM,sBAAsB,QAAS,CAAC;AAG7C,eAAO,MAAM,SAAS;;;CAGZ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C1C,eAAO,MAAM,2BAA2B,QACE,CAAC;AAG3C,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAC/C,eAAO,MAAM,mBAAmB,QAAoB,CAAC;AACrD,eAAO,MAAM,2BAA2B,QAAkB,CAAC;AAG3D,eAAO,MAAM,gBAAgB,QAA8B,CAAC;AAC5D,eAAO,MAAM,UAAU,QAC4C,CAAC"}
|
package/dist/index.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/** biome-ignore-all lint/style/noMagicNumbers: Self-explanatory */
|
|
2
|
-
// Background event types that don't count as user activity for session timeout
|
|
3
|
-
export const BACKGROUND_EVENT_TYPES = [
|
|
4
|
-
"replay_chunk",
|
|
5
|
-
"session_summary",
|
|
6
|
-
];
|
|
7
|
-
export const REPLAY_CHUNK_MS = 5000; // Send replay chunks every 5 seconds
|
|
8
|
-
export const RAGE_CLICK_THRESHOLD = 3; // 3 clicks in rapid succession
|
|
9
|
-
export const RAGE_CLICK_TIME_WINDOW = 1000; // Within 1 second
|
|
10
|
-
export const SESSION_SUMMARY_INTERVAL = 30_000; // Send summary every 30 seconds
|
|
11
|
-
// Queue thresholds
|
|
12
|
-
export const MAX_QUEUE_SIZE = 10;
|
|
13
|
-
export const DEFAULT_FLUSH_INTERVAL = 10_000; // 10 seconds
|
|
14
|
-
// API paths
|
|
15
|
-
export const API_PATHS = {
|
|
16
|
-
INGEST_V0: "/ingest/v0",
|
|
17
|
-
RELEASES: "/internal/releases",
|
|
18
|
-
};
|
|
19
|
-
// Time conversion constants
|
|
20
|
-
export const MS_PER_SECOND = 1000;
|
|
21
|
-
export const SECONDS_PER_MINUTE = 60;
|
|
22
|
-
export const MINUTES_PER_HOUR = 60;
|
|
23
|
-
export const HOURS_PER_DAY = 24;
|
|
24
|
-
export const MINUTES_IN_MS = SECONDS_PER_MINUTE * MS_PER_SECOND;
|
|
25
|
-
export const HOUR_IN_MS = MINUTES_PER_HOUR * MINUTES_IN_MS;
|
|
26
|
-
export const DAY_IN_MS = HOURS_PER_DAY * HOUR_IN_MS;
|
|
27
|
-
// Common durations in milliseconds
|
|
28
|
-
export const FIVE_SECONDS_MS = 5 * MS_PER_SECOND;
|
|
29
|
-
export const TEN_SECONDS_MS = 10 * MS_PER_SECOND;
|
|
30
|
-
export const FIVE_MINUTES_MS = 5 * MINUTES_IN_MS;
|
|
31
|
-
export const THREE_MINUTES_MS = 3 * MINUTES_IN_MS;
|
|
32
|
-
export const THIRTY_MINUTES_MS = 30 * MINUTES_IN_MS;
|
|
33
|
-
// ID generation constants
|
|
34
|
-
export const RADIX_36 = 36;
|
|
35
|
-
export const RADIX_16 = 16;
|
|
36
|
-
export const RANDOM_SUBSTRING_START = 2;
|
|
37
|
-
export const RANDOM_ID_LENGTH_SHORT = 7; // For event IDs
|
|
38
|
-
export const RANDOM_ID_LENGTH_MEDIUM = 9; // For window IDs
|
|
39
|
-
export const RANDOM_ID_LENGTH_LONG = 13; // For session IDs
|
|
40
|
-
export const RANDOM_SUBSTRING_END = 15; // Max substring end for Math.random()
|
|
41
|
-
// Retry and backoff constants
|
|
42
|
-
export const MAX_RETRIES = 3;
|
|
43
|
-
export const BACKOFF_BASE_MS = 1000; // 1 second
|
|
44
|
-
export const BACKOFF_MULTIPLIER = 2;
|
|
45
|
-
export const MAX_BACKOFF_MS = 30_000; // 30 seconds
|
|
46
|
-
// Event batching constants
|
|
47
|
-
export const BATCH_SIZE = 10;
|
|
48
|
-
export const BATCH_TIMEOUT_MS = 5000; // 5 seconds
|
|
49
|
-
export const MAX_BATCH_SIZE = 100;
|
|
50
|
-
// Storage limits
|
|
51
|
-
export const MAX_SESSIONS = 1000;
|
|
52
|
-
export const MAX_STORAGE_SIZE_BYTES = 5 * 1024 * 1024; // 5MB
|
|
53
|
-
export const COMPRESSION_MIN_SIZE = 1000; // bytes
|
|
54
|
-
export const COMPRESSION_RATIO = 0.7;
|
|
55
|
-
// Queue management
|
|
56
|
-
export const QUEUE_REDUCTION_FACTOR = 0.9;
|
|
57
|
-
export const CLEANUP_INTERVAL_MINUTES = 5;
|
|
58
|
-
export const SESSION_CLEANUP_INTERVAL_MS = CLEANUP_INTERVAL_MINUTES * MINUTES_IN_MS;
|
|
59
|
-
// Session constants
|
|
60
|
-
export const SESSION_KEY = "interfere_session";
|
|
61
|
-
export const SESSION_DURATION_MS = THIRTY_MINUTES_MS;
|
|
62
|
-
export const SESSION_EXTEND_THRESHOLD_MS = FIVE_MINUTES_MS;
|
|
63
|
-
// Validation patterns
|
|
64
|
-
export const SESSION_ID_REGEX = /^ses_[a-z0-9]+_[a-z0-9]+$/;
|
|
65
|
-
export const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
66
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AAQnE,+EAA+E;AAC/E,MAAM,CAAC,MAAM,sBAAsB,GAAgB;IACjD,cAAc;IACd,iBAAiB;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC,CAAC,qCAAqC;AAC1E,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,CAAC,+BAA+B;AACtE,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC,CAAC,kBAAkB;AAC9D,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,CAAC,gCAAgC;AAEhF,mBAAmB;AACnB,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AACjC,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,CAAC,aAAa;AAE3D,YAAY;AACZ,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,SAAS,EAAE,YAAY;IACvB,QAAQ,EAAE,oBAAoB;CACtB,CAAC;AAEX,4BAA4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