@entrolytics/protocol 2.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Entrolytics <hey@entrolytics.click>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,86 @@
1
+ export declare const EVENT_TYPES: {
2
+ readonly pageView: 'pageview';
3
+ readonly custom: 'custom_event';
4
+ readonly click: 'click';
5
+ };
6
+ export type CoreEventType = (typeof EVENT_TYPES)[keyof typeof EVENT_TYPES];
7
+ export declare const VITAL_TYPES: {
8
+ readonly LCP: 'LCP';
9
+ readonly INP: 'INP';
10
+ readonly CLS: 'CLS';
11
+ readonly TTFB: 'TTFB';
12
+ readonly FCP: 'FCP';
13
+ };
14
+ export type VitalType = (typeof VITAL_TYPES)[keyof typeof VITAL_TYPES];
15
+ export declare const VITAL_RATINGS: {
16
+ readonly good: 'good';
17
+ readonly needsImprovement: 'needs-improvement';
18
+ readonly poor: 'poor';
19
+ };
20
+ export type VitalRating = (typeof VITAL_RATINGS)[keyof typeof VITAL_RATINGS];
21
+ export declare const VITAL_THRESHOLDS: {
22
+ readonly LCP: {
23
+ readonly good: 2500;
24
+ readonly poor: 4000;
25
+ };
26
+ readonly INP: {
27
+ readonly good: 200;
28
+ readonly poor: 500;
29
+ };
30
+ readonly CLS: {
31
+ readonly good: 0.1;
32
+ readonly poor: 0.25;
33
+ };
34
+ readonly TTFB: {
35
+ readonly good: 800;
36
+ readonly poor: 1800;
37
+ };
38
+ readonly FCP: {
39
+ readonly good: 1800;
40
+ readonly poor: 3000;
41
+ };
42
+ };
43
+ export declare function isVitalRating(value: string): value is VitalRating;
44
+ export declare function getVitalRating(metric: VitalType, value: number): VitalRating;
45
+ export declare const FORM_EVENT_TYPES: {
46
+ readonly start: 'start';
47
+ readonly fieldFocus: 'field_focus';
48
+ readonly fieldBlur: 'field_blur';
49
+ readonly fieldError: 'field_error';
50
+ readonly submit: 'submit';
51
+ readonly abandon: 'abandon';
52
+ };
53
+ export type FormEventType = (typeof FORM_EVENT_TYPES)[keyof typeof FORM_EVENT_TYPES];
54
+ export declare const FORM_FIELD_TYPES: {
55
+ readonly text: 'text';
56
+ readonly email: 'email';
57
+ readonly password: 'password';
58
+ readonly tel: 'tel';
59
+ readonly number: 'number';
60
+ readonly url: 'url';
61
+ readonly textarea: 'textarea';
62
+ readonly select: 'select';
63
+ readonly checkbox: 'checkbox';
64
+ readonly radio: 'radio';
65
+ readonly date: 'date';
66
+ readonly file: 'file';
67
+ readonly hidden: 'hidden';
68
+ readonly submit: 'submit';
69
+ readonly other: 'other';
70
+ };
71
+ export type FormFieldType = (typeof FORM_FIELD_TYPES)[keyof typeof FORM_FIELD_TYPES];
72
+ export declare const DEPLOYMENT_SOURCES: {
73
+ readonly vercel: 'vercel';
74
+ readonly netlify: 'netlify';
75
+ readonly cloudflare: 'cloudflare';
76
+ readonly railway: 'railway';
77
+ readonly render: 'render';
78
+ readonly fly: 'fly';
79
+ readonly heroku: 'heroku';
80
+ readonly aws: 'aws';
81
+ readonly gcp: 'gcp';
82
+ readonly azure: 'azure';
83
+ readonly custom: 'custom';
84
+ };
85
+ export type DeploymentSource = (typeof DEPLOYMENT_SOURCES)[keyof typeof DEPLOYMENT_SOURCES];
86
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;aACtB,QAAQ,EAAE,UAAU;aACpB,MAAM,EAAE,cAAc;aACtB,KAAK,EAAE,OAAO;CACN,CAAA;AAEV,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAA;AAE1E,eAAO,MAAM,WAAW;aACtB,GAAG,EAAE,KAAK;aACV,GAAG,EAAE,KAAK;aACV,GAAG,EAAE,KAAK;aACV,IAAI,EAAE,MAAM;aACZ,GAAG,EAAE,KAAK;CACF,CAAA;AAEV,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAA;AAEtE,eAAO,MAAM,aAAa;aACxB,IAAI,EAAE,MAAM;aACZ,gBAAgB,EAAE,mBAAmB;aACrC,IAAI,EAAE,MAAM;CACJ,CAAA;AAEV,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAA;AAE5E,eAAO,MAAM,gBAAgB;;iBACpB,IAAI,EAAE,IAAI;iBAAE,IAAI,EAAE,IAAI;;;iBACtB,IAAI,EAAE,GAAG;iBAAE,IAAI,EAAE,GAAG;;;iBACpB,IAAI,EAAE,GAAG;iBAAE,IAAI,EAAE,IAAI;;;iBACpB,IAAI,EAAE,GAAG;iBAAE,IA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,EAAE,KAAK;aACV,GAAG,EAAE,KAAK;aACV,KAAK,EAAE,OAAO;aACd,MAAM,EAAE,QAAQ;CACR,CAAA;AAEV,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAA"}
@@ -0,0 +1,74 @@
1
+ export const EVENT_TYPES = {
2
+ pageView: 'pageview',
3
+ custom: 'custom_event',
4
+ click: 'click',
5
+ };
6
+ export const VITAL_TYPES = {
7
+ LCP: 'LCP',
8
+ INP: 'INP',
9
+ CLS: 'CLS',
10
+ TTFB: 'TTFB',
11
+ FCP: 'FCP',
12
+ };
13
+ export const VITAL_RATINGS = {
14
+ good: 'good',
15
+ needsImprovement: 'needs-improvement',
16
+ poor: 'poor',
17
+ };
18
+ export const VITAL_THRESHOLDS = {
19
+ LCP: { good: 2500, poor: 4000 },
20
+ INP: { good: 200, poor: 500 },
21
+ CLS: { good: 0.1, poor: 0.25 },
22
+ TTFB: { good: 800, poor: 1800 },
23
+ FCP: { good: 1800, poor: 3000 },
24
+ };
25
+ export function isVitalRating(value) {
26
+ return Object.values(VITAL_RATINGS).includes(value);
27
+ }
28
+ export function getVitalRating(metric, value) {
29
+ const threshold = VITAL_THRESHOLDS[metric];
30
+ if (value <= threshold.good)
31
+ return VITAL_RATINGS.good;
32
+ if (value <= threshold.poor)
33
+ return VITAL_RATINGS.needsImprovement;
34
+ return VITAL_RATINGS.poor;
35
+ }
36
+ export const FORM_EVENT_TYPES = {
37
+ start: 'start',
38
+ fieldFocus: 'field_focus',
39
+ fieldBlur: 'field_blur',
40
+ fieldError: 'field_error',
41
+ submit: 'submit',
42
+ abandon: 'abandon',
43
+ };
44
+ export const FORM_FIELD_TYPES = {
45
+ text: 'text',
46
+ email: 'email',
47
+ password: 'password',
48
+ tel: 'tel',
49
+ number: 'number',
50
+ url: 'url',
51
+ textarea: 'textarea',
52
+ select: 'select',
53
+ checkbox: 'checkbox',
54
+ radio: 'radio',
55
+ date: 'date',
56
+ file: 'file',
57
+ hidden: 'hidden',
58
+ submit: 'submit',
59
+ other: 'other',
60
+ };
61
+ export const DEPLOYMENT_SOURCES = {
62
+ vercel: 'vercel',
63
+ netlify: 'netlify',
64
+ cloudflare: 'cloudflare',
65
+ railway: 'railway',
66
+ render: 'render',
67
+ fly: 'fly',
68
+ heroku: 'heroku',
69
+ aws: 'aws',
70
+ gcp: 'gcp',
71
+ azure: 'azure',
72
+ custom: 'custom',
73
+ };
74
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,cAAc;IACtB,KAAK,EAAE,OAAO;CACN,CAAA;AAIV,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;CACF,CAAA;AAIV,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,MAAM;IACZ,gBAAgB,EAAE,mBAAmB;IACrC,IAAI,EAAE,MAAM;CACJ,CAAA;AAIV,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,GAAG,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE;IAC/B,GAAG,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE;IAC7B,GAAG,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE;IAC9B,IAAI,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE;IAC/B,GAAG,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE;CACqC,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,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;CACR,CAAA"}
@@ -0,0 +1,70 @@
1
+ import { z } from 'zod';
2
+ import { EVENT_TYPES } from './constants.js';
3
+ export declare const EventType: {
4
+ readonly pageView: 'pageview';
5
+ readonly custom: 'custom_event';
6
+ readonly click: 'click';
7
+ };
8
+ export type EventType = (typeof EVENT_TYPES)[keyof typeof EVENT_TYPES] | 'pixel';
9
+ export declare const EventPayloadSchema: z.ZodObject<{
10
+ websiteId: z.ZodUUID;
11
+ clientKey: z.ZodOptional<z.ZodString>;
12
+ eventId: z.ZodUUID;
13
+ sessionId: z.ZodUUID;
14
+ visitorId: z.ZodUUID;
15
+ url: z.ZodURL;
16
+ referrer: z.ZodOptional<z.ZodURL>;
17
+ eventType: z.ZodEnum<{
18
+ click: "click";
19
+ custom_event: "custom_event";
20
+ pageview: "pageview";
21
+ }>;
22
+ eventName: z.ZodOptional<z.ZodString>;
23
+ dnt: z.ZodOptional<z.ZodBoolean>;
24
+ consent: z.ZodOptional<z.ZodBoolean>;
25
+ properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
26
+ screenWidth: z.ZodOptional<z.ZodNumber>;
27
+ screenHeight: z.ZodOptional<z.ZodNumber>;
28
+ loadTime: z.ZodOptional<z.ZodNumber>;
29
+ domInteractive: z.ZodOptional<z.ZodNumber>;
30
+ domComplete: z.ZodOptional<z.ZodNumber>;
31
+ utmSource: z.ZodOptional<z.ZodString>;
32
+ utmMedium: z.ZodOptional<z.ZodString>;
33
+ utmCampaign: z.ZodOptional<z.ZodString>;
34
+ utmTerm: z.ZodOptional<z.ZodString>;
35
+ utmContent: z.ZodOptional<z.ZodString>;
36
+ }, z.core.$strip>;
37
+ export type EventPayload = z.infer<typeof EventPayloadSchema>;
38
+ export interface EventDBRow {
39
+ id: string;
40
+ website_id: string;
41
+ session_id: string;
42
+ visitor_id: string;
43
+ timestamp: string;
44
+ event_type: EventType;
45
+ event_name: string | null;
46
+ url: string;
47
+ path: string;
48
+ referrer: string | null;
49
+ referrer_domain: string | null;
50
+ browser: string;
51
+ browser_version: string | null;
52
+ os: string;
53
+ os_version: string | null;
54
+ device_type: 'desktop' | 'mobile' | 'tablet' | 'server' | 'unknown';
55
+ screen_width: number | null;
56
+ screen_height: number | null;
57
+ country: string | null;
58
+ city: string | null;
59
+ region: string | null;
60
+ load_time: number | null;
61
+ dom_interactive: number | null;
62
+ dom_complete: number | null;
63
+ utm_source: string | null;
64
+ utm_medium: string | null;
65
+ utm_campaign: string | null;
66
+ utm_term: string | null;
67
+ utm_content: string | null;
68
+ properties: string;
69
+ }
70
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAG5C,eAAO,MAAM,SAAS;;;;CAAc,CAAA;AAEpC,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,GAAG,OAAO,CAAA;AAEhF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoC7B,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAE7D,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,SAAS,CAAA;IACrB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,WAAW,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAA;IACnE,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,UAAU,EAAE,MAAM,CAAA;CACnB"}
package/dist/events.js ADDED
@@ -0,0 +1,39 @@
1
+ import { z } from 'zod';
2
+ import { EVENT_TYPES } from './constants.js';
3
+ // Re-export the shared event constants so protocol validation stays in sync.
4
+ export const EventType = EVENT_TYPES;
5
+ export const EventPayloadSchema = z.object({
6
+ websiteId: z.uuid(),
7
+ clientKey: z.string().min(1).max(64).optional(),
8
+ // Stable client-generated idempotency key for a single logical event. It
9
+ // becomes the ClickHouse row id and the ingestion seen-set key, so transport
10
+ // retries cannot inflate counts or usage.
11
+ eventId: z.uuid(),
12
+ sessionId: z.uuid(),
13
+ visitorId: z.uuid(),
14
+ url: z.url(),
15
+ referrer: z.url().optional(),
16
+ eventType: z.enum([EventType.pageView, EventType.custom, EventType.click]),
17
+ eventName: z.string().optional(),
18
+ // Browser Do-Not-Track signal forwarded by the tracker. When true and the
19
+ // website has respectDnt enabled, the server drops the event (ING-009).
20
+ dnt: z.boolean().optional(),
21
+ // Browser consent signal forwarded by client-key trackers. When a website
22
+ // requires cookie consent, client-key events are accepted only when true.
23
+ consent: z.boolean().optional(),
24
+ properties: z.record(z.string(), z.unknown()).optional(),
25
+ // Device info
26
+ screenWidth: z.number().optional(),
27
+ screenHeight: z.number().optional(),
28
+ // Performance metrics
29
+ loadTime: z.number().optional(),
30
+ domInteractive: z.number().optional(),
31
+ domComplete: z.number().optional(),
32
+ // UTM parameters
33
+ utmSource: z.string().optional(),
34
+ utmMedium: z.string().optional(),
35
+ utmCampaign: z.string().optional(),
36
+ utmTerm: z.string().optional(),
37
+ utmContent: z.string().optional(),
38
+ });
39
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,6EAA6E;AAC7E,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAA;AAIpC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE;IACnB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC/C,yEAAyE;IACzE,6EAA6E;IAC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E,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ export * from './constants.js';
2
+ export * from './events.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from './constants.js';
2
+ export * from './events.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA"}
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@entrolytics/protocol",
3
+ "version": "2.2.1",
4
+ "description": "Shared protocol definitions and schemas for Entrolytics",
5
+ "files": [
6
+ "dist",
7
+ "!dist/*.tsbuildinfo",
8
+ "package.json"
9
+ ],
10
+ "type": "module",
11
+ "main": "./dist/index.js",
12
+ "types": "./dist/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "default": "./dist/index.js"
17
+ }
18
+ },
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "dependencies": {
23
+ "zod": "^4.4.3"
24
+ },
25
+ "devDependencies": {
26
+ "@types/node": "^26.1.1",
27
+ "@typescript/native-preview": "latest",
28
+ "typescript": "^7.0.2"
29
+ },
30
+ "scripts": {
31
+ "build": "tsc",
32
+ "check-types": "tsgo --noEmit"
33
+ }
34
+ }