@interncom/diplomatic 0.0.47 → 0.0.49
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/entityDB.d.ts +10 -5
- package/dist/index.mjs +6 -4
- package/dist/shared/types.d.ts +2 -0
- package/package.json +1 -1
package/dist/entityDB.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { type DBSchema } from
|
|
2
|
-
import { Applier } from
|
|
3
|
-
import {
|
|
1
|
+
import { type DBSchema } from "idb";
|
|
2
|
+
import { Applier } from "./types";
|
|
3
|
+
import { GroupID } from "./shared/types";
|
|
4
|
+
import { StateManager } from "./state";
|
|
4
5
|
export declare const entityTableName = "entities";
|
|
5
|
-
export declare const typeIndexName = "
|
|
6
|
+
export declare const typeIndexName = "entity_type_created_at";
|
|
7
|
+
export declare const typeGroupIndexName = "entity_type_group_id";
|
|
6
8
|
export interface IEntity<T> {
|
|
7
9
|
eid: Uint8Array;
|
|
10
|
+
gid?: GroupID;
|
|
11
|
+
pid?: Uint8Array;
|
|
8
12
|
type: string;
|
|
9
13
|
updatedAt: Date;
|
|
10
14
|
createdAt: Date;
|
|
@@ -15,7 +19,8 @@ interface IEntityDB extends DBSchema {
|
|
|
15
19
|
key: Uint8Array;
|
|
16
20
|
value: IEntity<unknown>;
|
|
17
21
|
indexes: {
|
|
18
|
-
"
|
|
22
|
+
"entity_type_created_at": [string, Date];
|
|
23
|
+
"entity_type_group_id": [string, GroupID];
|
|
19
24
|
};
|
|
20
25
|
};
|
|
21
26
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -11714,10 +11714,12 @@ __export(entityDB_exports, {
|
|
|
11714
11714
|
db: () => db2,
|
|
11715
11715
|
entityTableName: () => entityTableName,
|
|
11716
11716
|
stateManager: () => stateManager,
|
|
11717
|
+
typeGroupIndexName: () => typeGroupIndexName,
|
|
11717
11718
|
typeIndexName: () => typeIndexName
|
|
11718
11719
|
});
|
|
11719
11720
|
var entityTableName = "entities";
|
|
11720
11721
|
var typeIndexName = "entity_type_created_at";
|
|
11722
|
+
var typeGroupIndexName = "entity_type_group_id";
|
|
11721
11723
|
var db2 = await openDB("db", 7, {
|
|
11722
11724
|
upgrade(db3, prevVersion, currVersion, tx) {
|
|
11723
11725
|
if (!db3.objectStoreNames.contains(entityTableName)) {
|
|
@@ -11727,13 +11729,13 @@ var db2 = await openDB("db", 7, {
|
|
|
11727
11729
|
});
|
|
11728
11730
|
}
|
|
11729
11731
|
const store = tx.objectStore(entityTableName);
|
|
11730
|
-
if (!store.indexNames.contains(
|
|
11731
|
-
store.createIndex(
|
|
11732
|
+
if (!store.indexNames.contains(typeIndexName)) {
|
|
11733
|
+
store.createIndex(typeIndexName, ["type", "createdAt"], {
|
|
11732
11734
|
unique: false
|
|
11733
11735
|
});
|
|
11734
11736
|
}
|
|
11735
|
-
if (!store.indexNames.contains(
|
|
11736
|
-
store.createIndex(
|
|
11737
|
+
if (!store.indexNames.contains(typeGroupIndexName)) {
|
|
11738
|
+
store.createIndex(typeGroupIndexName, ["type", "gid"], {
|
|
11737
11739
|
unique: false
|
|
11738
11740
|
});
|
|
11739
11741
|
}
|
package/dist/shared/types.d.ts
CHANGED