goby-database 1.0.8 → 2.0.9
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/index.d.ts +125 -0
- package/dist/index.js +969 -0
- package/dist/index.js.map +1 -0
- package/dist/sandbox.d.ts +1 -0
- package/dist/sandbox.js.map +1 -0
- package/dist/types.d.ts +170 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/unit-tests.d.ts +1 -0
- package/dist/unit-tests.js +82 -0
- package/dist/unit-tests.js.map +1 -0
- package/dist/utils.d.ts +13 -0
- package/dist/utils.js +106 -0
- package/dist/utils.js.map +1 -0
- package/package.json +11 -3
- package/src/index.ts +1251 -0
- package/src/sandbox.ts +107 -0
- package/src/types.ts +214 -0
- package/src/unit-tests.ts +117 -0
- package/src/utils.ts +133 -0
- package/tsconfig.json +111 -0
- package/index.js +0 -840
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { Database as DatabaseType, Statement } from 'better-sqlite3';
|
|
2
|
+
import type { SQLTableType, SQLClassListRow, SQLJunctonListRow, JunctionSides, JunctionList, ClassList, Property, DataType, ItemRelationSide, SQLApplicationWindow, ApplicationWindow, WorkspaceBlock, ClassData, ClassRow, ClassEdit, RelationEdit, PropertyEdit, MaxValues, PropertyType, RelationProperty, DataProperty, RelationEditValidSides } from './types.js';
|
|
3
|
+
export default class Project {
|
|
4
|
+
db: DatabaseType;
|
|
5
|
+
run: {
|
|
6
|
+
[key: string]: Statement;
|
|
7
|
+
get_all_classes: Statement<[], SQLClassListRow>;
|
|
8
|
+
get_junctionlist: Statement<[], SQLJunctonListRow>;
|
|
9
|
+
get_junctions_matching_property: Statement<{
|
|
10
|
+
class_id: number;
|
|
11
|
+
prop_id: number | null;
|
|
12
|
+
}, {
|
|
13
|
+
id: number;
|
|
14
|
+
sides: string;
|
|
15
|
+
}>;
|
|
16
|
+
get_windows: Statement<[], SQLApplicationWindow>;
|
|
17
|
+
get_class_id: Statement<[string], {
|
|
18
|
+
id: number;
|
|
19
|
+
}>;
|
|
20
|
+
};
|
|
21
|
+
class_cache: ClassList;
|
|
22
|
+
item_cache: {
|
|
23
|
+
class_id: number;
|
|
24
|
+
items: ClassRow[];
|
|
25
|
+
}[];
|
|
26
|
+
junction_cache: JunctionList;
|
|
27
|
+
constructor(source: string);
|
|
28
|
+
get_latest_table_row_id(table_name: string): number | null;
|
|
29
|
+
init(): void;
|
|
30
|
+
refresh_caches(caches: ('classlist' | 'items' | 'junctions')[]): void;
|
|
31
|
+
create_table(type: SQLTableType, name: string | number, columns: string[]): void;
|
|
32
|
+
action_create_class(name: string): number;
|
|
33
|
+
action_add_data_property({ class_id, name, data_type, max_values, create_column }: {
|
|
34
|
+
class_id: number;
|
|
35
|
+
name: string;
|
|
36
|
+
data_type: DataType;
|
|
37
|
+
max_values: MaxValues;
|
|
38
|
+
create_column?: boolean;
|
|
39
|
+
}): void;
|
|
40
|
+
action_add_relation_property(class_id: number, name: string, max_values: MaxValues): number;
|
|
41
|
+
delete_property(class_id: number, prop_id: number): void;
|
|
42
|
+
get_junctions(): {
|
|
43
|
+
sides: JunctionSides;
|
|
44
|
+
id: number;
|
|
45
|
+
metadata: string;
|
|
46
|
+
}[];
|
|
47
|
+
action_edit_class_schema({ class_edits, property_edits, relationship_edits }: {
|
|
48
|
+
class_edits?: ClassEdit[];
|
|
49
|
+
property_edits?: PropertyEdit[];
|
|
50
|
+
relationship_edits?: RelationEdit[];
|
|
51
|
+
}): void;
|
|
52
|
+
consolidate_relationship_edits(relationship_edits: RelationEdit[]): RelationEditValidSides[];
|
|
53
|
+
action_delete_class(class_id: number): void;
|
|
54
|
+
create_junction_table(sides: JunctionSides): number;
|
|
55
|
+
transfer_connections(source: {
|
|
56
|
+
sides: JunctionSides;
|
|
57
|
+
id: number;
|
|
58
|
+
}, target: {
|
|
59
|
+
sides: JunctionSides;
|
|
60
|
+
id: number;
|
|
61
|
+
}): void;
|
|
62
|
+
delete_junction_table(id: number): void;
|
|
63
|
+
check_conditions({ class_id, prop_id, property, class_data }: {
|
|
64
|
+
class_id?: number;
|
|
65
|
+
prop_id?: number;
|
|
66
|
+
property?: Property;
|
|
67
|
+
class_data: ClassData;
|
|
68
|
+
}): void;
|
|
69
|
+
action_save(): void;
|
|
70
|
+
action_create_item_in_root({ type, value }: {
|
|
71
|
+
type: string | null;
|
|
72
|
+
value?: string;
|
|
73
|
+
}): number;
|
|
74
|
+
action_delete_item_from_root(id: number): void;
|
|
75
|
+
action_set_root_item_value(id: number, value: string): void;
|
|
76
|
+
action_add_row(class_id: number): number;
|
|
77
|
+
get_next_order(table_name: string): number;
|
|
78
|
+
action_make_relation(input_1: ItemRelationSide, input_2: ItemRelationSide): void;
|
|
79
|
+
retrieve_class_items({ class_id, class_name, class_data }: {
|
|
80
|
+
class_id: number;
|
|
81
|
+
class_name?: string;
|
|
82
|
+
class_data?: ClassData;
|
|
83
|
+
}): ClassRow[];
|
|
84
|
+
retrieve_all_classes(): ClassData[];
|
|
85
|
+
parse_sql_prop(class_id: number, sql_prop: {
|
|
86
|
+
id: number;
|
|
87
|
+
type: PropertyType;
|
|
88
|
+
data_type: 'string' | null;
|
|
89
|
+
max_values: MaxValues;
|
|
90
|
+
name: string;
|
|
91
|
+
metadata: string;
|
|
92
|
+
}): (DataProperty | RelationProperty);
|
|
93
|
+
retrieve_windows(): SQLApplicationWindow[];
|
|
94
|
+
retrieve_workspace_contents(id: number): {
|
|
95
|
+
blocks_parsed: WorkspaceBlock[];
|
|
96
|
+
items: unknown[];
|
|
97
|
+
};
|
|
98
|
+
action_config_window({ type, open, metadata, id }: {
|
|
99
|
+
type: ApplicationWindow["type"];
|
|
100
|
+
open: ApplicationWindow["open"];
|
|
101
|
+
metadata: ApplicationWindow["metadata"];
|
|
102
|
+
id: number;
|
|
103
|
+
}): number | undefined;
|
|
104
|
+
create_workspace(open: ApplicationWindow["open"], metadata: ApplicationWindow["metadata"]): number;
|
|
105
|
+
action_create_workspace_block({ workspace_id, thing_type, block_metadata, thing_id }: {
|
|
106
|
+
workspace_id: ApplicationWindow["id"];
|
|
107
|
+
thing_type: WorkspaceBlock["thing_type"];
|
|
108
|
+
block_metadata: WorkspaceBlock["metadata"];
|
|
109
|
+
thing_id: WorkspaceBlock["thing_id"];
|
|
110
|
+
}): number;
|
|
111
|
+
action_remove_workspace_block({ workspace_id, block_id }: {
|
|
112
|
+
workspace_id: number;
|
|
113
|
+
block_id: number;
|
|
114
|
+
}): void;
|
|
115
|
+
action_create_and_add_to_workspace({ workspace_id, thing_type, block_metadata, thing_data }: {
|
|
116
|
+
workspace_id: number;
|
|
117
|
+
thing_type: WorkspaceBlock["thing_type"];
|
|
118
|
+
block_metadata: WorkspaceBlock["metadata"];
|
|
119
|
+
thing_data: any;
|
|
120
|
+
}): {
|
|
121
|
+
thing_id: number;
|
|
122
|
+
block_id: number;
|
|
123
|
+
};
|
|
124
|
+
action_remove_from_workspace_and_delete(workspace_id: number, block_id: number, thing_type: WorkspaceBlock["thing_type"], thing_id: number): void;
|
|
125
|
+
}
|