@ovineko/spa-guard 0.0.1-alpha-16 → 0.0.1-alpha-17

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.
@@ -0,0 +1,20 @@
1
+ // src/schema/parse.ts
2
+ function parseBeacon(data) {
3
+ if (!data || typeof data !== "object" || Array.isArray(data)) {
4
+ throw new Error("Invalid beacon");
5
+ }
6
+ const d = data;
7
+ return {
8
+ appName: typeof d.appName === "string" ? d.appName : void 0,
9
+ errorMessage: typeof d.errorMessage === "string" ? d.errorMessage : void 0,
10
+ eventMessage: typeof d.eventMessage === "string" ? d.eventMessage : void 0,
11
+ eventName: typeof d.eventName === "string" ? d.eventName : void 0,
12
+ retryAttempt: typeof d.retryAttempt === "number" ? d.retryAttempt : void 0,
13
+ retryId: typeof d.retryId === "string" ? d.retryId : void 0,
14
+ serialized: typeof d.serialized === "string" ? d.serialized : void 0
15
+ };
16
+ }
17
+
18
+ export {
19
+ parseBeacon
20
+ };
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  parseBeacon
3
- } from "../chunk-WE7SWL5H.js";
4
- import "../chunk-KZEBQNOZ.js";
3
+ } from "../chunk-Q267YLSE.js";
5
4
  import {
6
5
  BeaconError
7
6
  } from "../chunk-3SCN2UE4.js";
@@ -1,11 +1,9 @@
1
- import { Type } from "typebox";
2
- export declare const beaconSchema: Type.TObject<{
3
- appName: Type.TOptional<Type.TString>;
4
- errorMessage: Type.TOptional<Type.TString>;
5
- eventMessage: Type.TOptional<Type.TString>;
6
- eventName: Type.TOptional<Type.TString>;
7
- retryAttempt: Type.TOptional<Type.TNumber>;
8
- retryId: Type.TOptional<Type.TString>;
9
- serialized: Type.TOptional<Type.TString>;
10
- }>;
11
- export type BeaconSchema = Type.Static<typeof beaconSchema>;
1
+ export interface BeaconSchema {
2
+ appName?: string;
3
+ errorMessage?: string;
4
+ eventMessage?: string;
5
+ eventName?: string;
6
+ retryAttempt?: number;
7
+ retryId?: string;
8
+ serialized?: string;
9
+ }
@@ -1,7 +0,0 @@
1
- import {
2
- beaconSchema
3
- } from "../chunk-KZEBQNOZ.js";
4
- import "../chunk-MLKGABMK.js";
5
- export {
6
- beaconSchema
7
- };
@@ -1,2 +1,2 @@
1
1
  import type { BeaconSchema } from ".";
2
- export declare const parseBeacon: (value: unknown) => BeaconSchema;
2
+ export declare function parseBeacon(data: unknown): BeaconSchema;
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  parseBeacon
3
- } from "../chunk-WE7SWL5H.js";
4
- import "../chunk-KZEBQNOZ.js";
3
+ } from "../chunk-Q267YLSE.js";
5
4
  import "../chunk-MLKGABMK.js";
6
5
  export {
7
6
  parseBeacon
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ovineko/spa-guard",
3
- "version": "0.0.1-alpha-16",
3
+ "version": "0.0.1-alpha-17",
4
4
  "description": "Chunk load error handling for SPAs with automatic recovery, beacon reporting, and deployment monitoring",
5
5
  "keywords": [
6
6
  "spa",
@@ -93,16 +93,15 @@
93
93
  ],
94
94
  "dependencies": {
95
95
  "@fastify/accept-negotiator": "2.0.1",
96
- "html-minifier-terser": "7.2.0"
96
+ "html-minifier-terser": "7.2.0",
97
+ "parse5": "8.0.0"
97
98
  },
98
99
  "peerDependencies": {
99
100
  "eslint": "^9 || ^10",
100
101
  "fastify": "^5 || ^4",
101
102
  "fastify-plugin": "^5 || ^4",
102
- "parse5": "^8",
103
103
  "react": "^19",
104
104
  "react-router": "^7",
105
- "typebox": "^1",
106
105
  "vite": "^8 || ^7"
107
106
  },
108
107
  "peerDependenciesMeta": {
@@ -115,18 +114,12 @@
115
114
  "fastify-plugin": {
116
115
  "optional": true
117
116
  },
118
- "parse5": {
119
- "optional": true
120
- },
121
117
  "react": {
122
118
  "optional": true
123
119
  },
124
120
  "react-router": {
125
121
  "optional": true
126
122
  },
127
- "typebox": {
128
- "optional": true
129
- },
130
123
  "vite": {
131
124
  "optional": true
132
125
  }
@@ -1,18 +0,0 @@
1
- // src/schema/index.ts
2
- import { Type } from "typebox";
3
- var beaconSchema = Type.Object(
4
- {
5
- appName: Type.Optional(Type.String()),
6
- errorMessage: Type.Optional(Type.String()),
7
- eventMessage: Type.Optional(Type.String()),
8
- eventName: Type.Optional(Type.String()),
9
- retryAttempt: Type.Optional(Type.Number()),
10
- retryId: Type.Optional(Type.String()),
11
- serialized: Type.Optional(Type.String())
12
- },
13
- { additionalProperties: false }
14
- );
15
-
16
- export {
17
- beaconSchema
18
- };
@@ -1,19 +0,0 @@
1
- import {
2
- beaconSchema
3
- } from "./chunk-KZEBQNOZ.js";
4
-
5
- // src/schema/parse.ts
6
- import { Value } from "typebox/value";
7
- var parseBeacon = (value) => {
8
- const cleaned = Value.Clean(beaconSchema, value);
9
- const isValid = Value.Check(beaconSchema, cleaned);
10
- if (!isValid) {
11
- const errors = [...Value.Errors(beaconSchema, cleaned)];
12
- throw new Error(`Beacon validation failed: ${JSON.stringify(errors)}`);
13
- }
14
- return cleaned;
15
- };
16
-
17
- export {
18
- parseBeacon
19
- };