@vacantthinker/firefox-addon-framework-easy 2026.616.2042 → 2026.617.739

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,19 @@
1
+ import { BaseORM } from './BaseORM';
2
+ /**
3
+ * Abstract class for ORMs that store Map<number, V> data.
4
+ * Automatically handles the conversion between internal Record<number, V> and
5
+ * Map<number, V>.
6
+ */
7
+ export declare abstract class BaseNumberKeyORM<V> extends BaseORM<Record<number, V>> {
8
+ protected constructor(prefix: string, id: string);
9
+ /**
10
+ * Fetches data as Record, handles legacy arrays/corruption,
11
+ * and converts it to Map<number, V> with properly cast number keys.
12
+ */
13
+ protected getMap(): Promise<Map<number, V>>;
14
+ /**
15
+ * Converts internal Map<number, V> back to Record for storage.
16
+ */
17
+ protected setMap(map: Map<number, V>): Promise<void>;
18
+ }
19
+ //# sourceMappingURL=BaseNumberKeyORM.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseNumberKeyORM.d.ts","sourceRoot":"","sources":["../src/BaseNumberKeyORM.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAElC;;;;GAIG;AACH,8BAAsB,gBAAgB,CAAC,CAAC,CAAE,SAAQ,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC1E,SAAS,aAAa,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;IAKhD;;;OAGG;cACa,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAmBjD;;OAEG;cACa,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAG3D"}
@@ -0,0 +1,37 @@
1
+ import { BaseORM } from './BaseORM';
2
+ /**
3
+ * Abstract class for ORMs that store Map<number, V> data.
4
+ * Automatically handles the conversion between internal Record<number, V> and
5
+ * Map<number, V>.
6
+ */
7
+ export class BaseNumberKeyORM extends BaseORM {
8
+ constructor(prefix, id) {
9
+ // Hardcode the default value to an empty object
10
+ super(prefix, id, {});
11
+ }
12
+ /**
13
+ * Fetches data as Record, handles legacy arrays/corruption,
14
+ * and converts it to Map<number, V> with properly cast number keys.
15
+ */
16
+ async getMap() {
17
+ let data = await this.get();
18
+ // Data Migration / Corruption Guard (carried over from your original logic)
19
+ if (Array.isArray(data)) {
20
+ console.warn(`BaseNumberKeyORM: Old Array data detected for ${this.storageKey}. Migrating to Record.`);
21
+ data = Object.fromEntries(data);
22
+ await this.set(data);
23
+ }
24
+ else if (typeof data !== 'object' || data === null) {
25
+ data = {};
26
+ await this.set(data);
27
+ }
28
+ // Convert object entries back to Map, casting string keys to numbers
29
+ return new Map(Object.entries(data).map(([key, value]) => [Number(key), value]));
30
+ }
31
+ /**
32
+ * Converts internal Map<number, V> back to Record for storage.
33
+ */
34
+ async setMap(map) {
35
+ await this.set(Object.fromEntries(map));
36
+ }
37
+ }
@@ -0,0 +1,18 @@
1
+ import { BaseORM } from './BaseORM';
2
+ /**
3
+ * Abstract class for ORMs that store Map<string, V> data.
4
+ * Automatically handles the conversion between internal Record<string, V> and
5
+ * Map<string, V>.
6
+ */
7
+ export declare abstract class BaseStringKeyORM<V> extends BaseORM<Record<string, V>> {
8
+ protected constructor(prefix: string, id: string);
9
+ /**
10
+ * Fetches data as Record and converts it to Map<string, V>.
11
+ */
12
+ protected getMap(): Promise<Map<string, V>>;
13
+ /**
14
+ * Converts internal Map<string, V> back to Record for storage.
15
+ */
16
+ protected setMap(map: Map<string, V>): Promise<void>;
17
+ }
18
+ //# sourceMappingURL=BaseStringKeyORM.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseStringKeyORM.d.ts","sourceRoot":"","sources":["../src/BaseStringKeyORM.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAElC;;;;GAIG;AACH,8BAAsB,gBAAgB,CAAC,CAAC,CAAE,SAAQ,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAC1E,SAAS,aAAa,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;IAKhD;;OAEG;cACa,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAOjD;;OAEG;cACa,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAG3D"}
@@ -0,0 +1,26 @@
1
+ import { BaseORM } from './BaseORM';
2
+ /**
3
+ * Abstract class for ORMs that store Map<string, V> data.
4
+ * Automatically handles the conversion between internal Record<string, V> and
5
+ * Map<string, V>.
6
+ */
7
+ export class BaseStringKeyORM extends BaseORM {
8
+ constructor(prefix, id) {
9
+ // Hardcode the default value to an empty object
10
+ super(prefix, id, {});
11
+ }
12
+ /**
13
+ * Fetches data as Record and converts it to Map<string, V>.
14
+ */
15
+ async getMap() {
16
+ const data = await this.get();
17
+ // Convert object entries to Map
18
+ return new Map(Object.entries(data || {}));
19
+ }
20
+ /**
21
+ * Converts internal Map<string, V> back to Record for storage.
22
+ */
23
+ async setMap(map) {
24
+ await this.set(Object.fromEntries(map));
25
+ }
26
+ }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
+ export * from './BaseNumberKeyORM';
1
2
  export * from './BaseORM';
3
+ export * from './BaseStringKeyORM';
2
4
  export * from './browserBrowsingData';
3
5
  export * from './browserDownload';
4
6
  export * from './browserNotification';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,6 @@
1
+ export * from './BaseNumberKeyORM';
1
2
  export * from './BaseORM';
3
+ export * from './BaseStringKeyORM';
2
4
  export * from './browserBrowsingData';
3
5
  export * from './browserDownload';
4
6
  export * from './browserNotification';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vacantthinker/firefox-addon-framework-easy",
3
- "version": "2026.0616.2042",
3
+ "version": "2026.0617.0739",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",