prostgles-server 2.0.178 → 2.0.179

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.
Files changed (98) hide show
  1. package/dist/AuthHandler.d.ts +4 -4
  2. package/dist/AuthHandler.d.ts.map +1 -1
  3. package/dist/DBSchemaBuilder.d.ts +6 -6
  4. package/dist/DBSchemaBuilder.d.ts.map +1 -1
  5. package/dist/DBSchemaBuilder.js +25 -8
  6. package/dist/DBSchemaBuilder.js.map +1 -1
  7. package/dist/DboBuilder.d.ts +20 -21
  8. package/dist/DboBuilder.d.ts.map +1 -1
  9. package/dist/DboBuilder.js +1 -1
  10. package/dist/DboBuilder.js.map +1 -1
  11. package/dist/Prostgles.d.ts +8 -10
  12. package/dist/Prostgles.d.ts.map +1 -1
  13. package/dist/Prostgles.js.map +1 -1
  14. package/dist/PublishParser.d.ts +37 -37
  15. package/dist/PublishParser.d.ts.map +1 -1
  16. package/dist/PublishParser.js.map +1 -1
  17. package/dist/index.d.ts +2 -3
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js.map +1 -1
  20. package/lib/AuthHandler.d.ts +148 -0
  21. package/lib/AuthHandler.d.ts.map +1 -0
  22. package/lib/AuthHandler.js +411 -0
  23. package/lib/AuthHandler.ts +3 -3
  24. package/lib/DBEventsManager.d.ts +38 -0
  25. package/lib/DBEventsManager.d.ts.map +1 -0
  26. package/lib/DBEventsManager.js +136 -0
  27. package/lib/DBSchemaBuilder.d.ts +11 -0
  28. package/lib/DBSchemaBuilder.d.ts.map +1 -0
  29. package/lib/DBSchemaBuilder.js +102 -0
  30. package/lib/DBSchemaBuilder.ts +62 -27
  31. package/lib/DboBuilder.d.ts +428 -0
  32. package/lib/DboBuilder.d.ts.map +1 -0
  33. package/lib/DboBuilder.js +3078 -0
  34. package/lib/DboBuilder.ts +25 -25
  35. package/lib/FileManager.d.ts +168 -0
  36. package/lib/FileManager.d.ts.map +1 -0
  37. package/lib/FileManager.js +474 -0
  38. package/lib/Filtering.d.ts +15 -0
  39. package/lib/Filtering.d.ts.map +1 -0
  40. package/lib/Filtering.js +299 -0
  41. package/lib/PostgresNotifListenManager.d.ts +27 -0
  42. package/lib/PostgresNotifListenManager.d.ts.map +1 -0
  43. package/lib/PostgresNotifListenManager.js +122 -0
  44. package/lib/Prostgles.d.ts +193 -0
  45. package/lib/Prostgles.d.ts.map +1 -0
  46. package/lib/Prostgles.js +579 -0
  47. package/lib/Prostgles.ts +6 -6
  48. package/lib/PubSubManager.d.ts +157 -0
  49. package/lib/PubSubManager.d.ts.map +1 -0
  50. package/lib/PubSubManager.js +1400 -0
  51. package/lib/PublishParser.d.ts +262 -0
  52. package/lib/PublishParser.d.ts.map +1 -0
  53. package/lib/PublishParser.js +390 -0
  54. package/lib/PublishParser.ts +39 -38
  55. package/lib/QueryBuilder.d.ts +124 -0
  56. package/lib/QueryBuilder.d.ts.map +1 -0
  57. package/lib/QueryBuilder.js +1349 -0
  58. package/lib/SyncReplication.d.ts +34 -0
  59. package/lib/SyncReplication.d.ts.map +1 -0
  60. package/lib/SyncReplication.js +411 -0
  61. package/lib/TableConfig.d.ts +175 -0
  62. package/lib/TableConfig.d.ts.map +1 -0
  63. package/lib/TableConfig.js +231 -0
  64. package/lib/index.d.ts +10 -0
  65. package/lib/index.d.ts.map +1 -0
  66. package/lib/index.js +45 -0
  67. package/lib/index.ts +3 -4
  68. package/lib/shortestPath.d.ts +10 -0
  69. package/lib/shortestPath.d.ts.map +1 -0
  70. package/lib/shortestPath.js +111 -0
  71. package/lib/utils.d.ts +2 -0
  72. package/lib/utils.d.ts.map +1 -0
  73. package/lib/utils.js +5 -0
  74. package/package.json +3 -3
  75. package/tests/client/PID.txt +1 -1
  76. package/tests/client/index.d.ts +1 -1
  77. package/tests/client/index.d.ts.map +1 -1
  78. package/tests/client_only_queries.d.ts +4 -0
  79. package/tests/client_only_queries.d.ts.map +1 -0
  80. package/tests/isomorphic_queries.d.ts +6 -0
  81. package/tests/isomorphic_queries.d.ts.map +1 -0
  82. package/tests/server/DBoGenerated.d.ts +97 -193
  83. package/tests/server/dboTypeCheck.d.ts +2 -0
  84. package/tests/server/dboTypeCheck.d.ts.map +1 -0
  85. package/tests/server/dboTypeCheck.js +14 -0
  86. package/tests/server/dboTypeCheck.ts +17 -0
  87. package/tests/server/index.d.ts +2 -0
  88. package/tests/server/index.d.ts.map +1 -0
  89. package/tests/server/index.js +11 -11
  90. package/tests/server/index.ts +23 -16
  91. package/tests/server/package-lock.json +5 -5
  92. package/tests/server/publishTypeCheck.d.ts +2 -0
  93. package/tests/server/publishTypeCheck.d.ts.map +1 -0
  94. package/tests/server/publishTypeCheck.js +120 -0
  95. package/tests/server/publishTypeCheck.ts +129 -0
  96. package/tests/server/tsconfig.json +4 -5
  97. package/tests/server_only_queries.d.ts +2 -0
  98. package/tests/server_only_queries.d.ts.map +1 -0
@@ -0,0 +1,231 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const prostgles_types_1 = require("prostgles-types");
4
+ const PubSubManager_1 = require("./PubSubManager");
5
+ /**
6
+ * Will be run between initSQL and fileTable
7
+ */
8
+ class TableConfigurator {
9
+ constructor(prostgles) {
10
+ this.getColumnConfig = (tableName, colName) => {
11
+ const tconf = this.config?.[tableName];
12
+ if (tconf && "columns" in tconf) {
13
+ return tconf.columns[colName];
14
+ }
15
+ return undefined;
16
+ };
17
+ this.getColInfo = (params) => {
18
+ const colConf = this.getColumnConfig(params.table, params.col);
19
+ let result = undefined;
20
+ if (colConf) {
21
+ if ("info" in colConf) {
22
+ result = {
23
+ ...(result ?? {}),
24
+ ...colConf?.info
25
+ };
26
+ }
27
+ /**
28
+ * Get labels from TableConfig if specified
29
+ */
30
+ if (colConf.label) {
31
+ const { lang } = params;
32
+ const lbl = colConf?.label;
33
+ if (["string", "object"].includes(typeof lbl)) {
34
+ if (typeof lbl === "string") {
35
+ result ?? (result = {});
36
+ result.label = lbl;
37
+ }
38
+ else if (lang && (lbl?.[lang] || lbl?.en)) {
39
+ result ?? (result = {});
40
+ result.label = (lbl?.[lang]) || lbl?.en;
41
+ }
42
+ }
43
+ }
44
+ }
45
+ return result;
46
+ };
47
+ this.checkColVal = (params) => {
48
+ const conf = this.getColInfo(params);
49
+ if (conf) {
50
+ const { value } = params;
51
+ const { min, max } = conf;
52
+ if (min !== undefined && value !== undefined && value < min)
53
+ throw `${params.col} must be less than ${min}`;
54
+ if (max !== undefined && value !== undefined && value > max)
55
+ throw `${params.col} must be greater than ${max}`;
56
+ }
57
+ };
58
+ this.getJoinInfo = (sourceTable, targetTable) => {
59
+ if (this.config &&
60
+ sourceTable in this.config &&
61
+ this.config[sourceTable] &&
62
+ "columns" in this.config[sourceTable]) {
63
+ const td = this.config[sourceTable];
64
+ if ("columns" in td && td.columns[targetTable]) {
65
+ const cd = td.columns[targetTable];
66
+ if ("joinDef" in cd) {
67
+ const { joinDef } = cd;
68
+ const res = {
69
+ expectOne: false,
70
+ paths: joinDef.map(({ sourceTable, targetTable: table, on }) => ({
71
+ source: sourceTable,
72
+ target: targetTable,
73
+ table,
74
+ on
75
+ })),
76
+ };
77
+ return res;
78
+ }
79
+ }
80
+ }
81
+ return undefined;
82
+ };
83
+ this.config = prostgles.opts.tableConfig;
84
+ this.prostgles = prostgles;
85
+ }
86
+ get dbo() {
87
+ if (!this.prostgles.dbo)
88
+ throw "this.prostgles.dbo missing";
89
+ return this.prostgles.dbo;
90
+ }
91
+ ;
92
+ get db() {
93
+ if (!this.prostgles.db)
94
+ throw "this.prostgles.db missing";
95
+ return this.prostgles.db;
96
+ }
97
+ ;
98
+ async init() {
99
+ let queries = [];
100
+ if (!this.config || !this.prostgles.pgp)
101
+ throw "config or pgp missing";
102
+ /* Create lookup tables */
103
+ Object.keys(this.config).map(tableName => {
104
+ const tableConf = this.config[tableName];
105
+ const { dropIfExists = false, dropIfExistsCascade = false } = tableConf;
106
+ if (dropIfExistsCascade) {
107
+ queries.push(`DROP TABLE IF EXISTS ${tableName} CASCADE;`);
108
+ }
109
+ else if (dropIfExists) {
110
+ queries.push(`DROP TABLE IF EXISTS ${tableName} ;`);
111
+ }
112
+ if ("isLookupTable" in tableConf && Object.keys(tableConf.isLookupTable?.values).length) {
113
+ const rows = Object.keys(tableConf.isLookupTable?.values).map(id => ({ id, ...(tableConf.isLookupTable?.values[id]) }));
114
+ if (dropIfExists || dropIfExistsCascade || !this.dbo?.[tableName]) {
115
+ const keys = Object.keys(rows[0]).filter(k => k !== "id");
116
+ queries.push(`CREATE TABLE IF NOT EXISTS ${tableName} (
117
+ id TEXT PRIMARY KEY
118
+ ${keys.length ? (", " + keys.map(k => (0, prostgles_types_1.asName)(k) + " TEXT ").join(", ")) : ""}
119
+ );`);
120
+ rows.map(row => {
121
+ const values = this.prostgles.pgp.helpers.values(row);
122
+ queries.push(this.prostgles.pgp.as.format(`INSERT INTO ${tableName} (${["id", ...keys].map(t => (0, prostgles_types_1.asName)(t)).join(", ")}) ` + " VALUES ${values:raw} ;", { values }));
123
+ });
124
+ // console.log("Created lookup table " + tableName)
125
+ }
126
+ }
127
+ });
128
+ if (queries.length) {
129
+ const q = queries.join("\n");
130
+ console.log("TableConfig: \n", q);
131
+ await this.db.multi(q);
132
+ await this.prostgles.refreshDBO();
133
+ }
134
+ queries = [];
135
+ /* Create referenced columns */
136
+ await Promise.all(Object.keys(this.config).map(async (tableName) => {
137
+ const tableConf = this.config[tableName];
138
+ if ("columns" in tableConf) {
139
+ const getColDef = (name, colConf) => {
140
+ const colNameEsc = (0, prostgles_types_1.asName)(name);
141
+ const getTextDef = (colConf) => {
142
+ const { nullable, defaultValue } = colConf;
143
+ return ` TEXT ${!nullable ? " NOT NULL " : ""} ${defaultValue ? ` DEFAULT ${(0, PubSubManager_1.asValue)(defaultValue)} ` : ""}`;
144
+ };
145
+ if ("references" in colConf && colConf.references) {
146
+ const { tableName: lookupTable, columnName: lookupCol = "id" } = colConf.references;
147
+ return ` ${colNameEsc} ${getTextDef(colConf.references)} REFERENCES ${lookupTable} (${lookupCol}) `;
148
+ }
149
+ else if ("sqlDefinition" in colConf && colConf.sqlDefinition) {
150
+ return ` ${colNameEsc} ${colConf.sqlDefinition} `;
151
+ }
152
+ else if ("isText" in colConf && colConf.isText) {
153
+ let checks = "", cArr = [];
154
+ if (colConf.lowerCased) {
155
+ cArr.push(`${colNameEsc} = LOWER(${colNameEsc})`);
156
+ }
157
+ if (colConf.trimmed) {
158
+ cArr.push(`${colNameEsc} = BTRIM(${colNameEsc})`);
159
+ }
160
+ if (cArr.length) {
161
+ checks = `CHECK (${cArr.join(" AND ")})`;
162
+ }
163
+ return ` ${colNameEsc} ${getTextDef(colConf)} ${checks}`;
164
+ }
165
+ else {
166
+ throw "Unknown column config: " + JSON.stringify(colConf);
167
+ }
168
+ };
169
+ const colDefs = [];
170
+ Object.keys(tableConf.columns).filter(c => !("joinDef" in tableConf.columns[c])).map(colName => {
171
+ const colConf = tableConf.columns[colName];
172
+ if (!this.dbo[tableName]) {
173
+ colDefs.push(getColDef(colName, colConf));
174
+ }
175
+ else if (!colDefs.length && !this.dbo[tableName].columns?.find(c => colName === c.name)) {
176
+ if ("references" in colConf && colConf.references) {
177
+ const { tableName: lookupTable, } = colConf.references;
178
+ queries.push(`
179
+ ALTER TABLE ${(0, prostgles_types_1.asName)(tableName)}
180
+ ADD COLUMN ${getColDef(colName, colConf)};
181
+ `);
182
+ console.log(`TableConfigurator: ${tableName}(${colName})` + " referenced lookup table " + lookupTable);
183
+ }
184
+ else if ("sqlDefinition" in colConf && colConf.sqlDefinition) {
185
+ queries.push(`
186
+ ALTER TABLE ${(0, prostgles_types_1.asName)(tableName)}
187
+ ADD COLUMN ${getColDef(colName, colConf)};
188
+ `);
189
+ console.log(`TableConfigurator: created/added column ${tableName}(${colName}) ` + colConf.sqlDefinition);
190
+ }
191
+ }
192
+ });
193
+ if (colDefs.length) {
194
+ queries.push(`CREATE TABLE ${(0, prostgles_types_1.asName)(tableName)} (
195
+ ${colDefs.join(", \n")}
196
+ );`);
197
+ console.error("TableConfigurator: Created table: \n" + queries[0]);
198
+ }
199
+ }
200
+ if ("constraints" in tableConf && tableConf.constraints) {
201
+ (0, prostgles_types_1.getKeys)(tableConf.constraints).map(constraintName => {
202
+ queries.push(`ALTER TABLE ${(0, prostgles_types_1.asName)(tableName)} ADD CONSTRAINT ${(0, prostgles_types_1.asName)(constraintName)} ${tableConf.constraints[constraintName]} ;`);
203
+ });
204
+ }
205
+ if ("indexes" in tableConf && tableConf.indexes) {
206
+ (0, prostgles_types_1.getKeys)(tableConf.indexes).map(indexName => {
207
+ const { concurrently, unique, using, definition, replace } = tableConf.indexes[indexName];
208
+ if (replace || typeof replace !== "boolean" && tableConf.replaceUniqueIndexes) {
209
+ queries.push(`DROP INDEX IF EXISTS ${(0, prostgles_types_1.asName)(indexName)} ;`);
210
+ }
211
+ queries.push(`CREATE ${unique ? "UNIQUE" : ""} ${!concurrently ? "" : "CONCURRENTLY"} INDEX ${(0, prostgles_types_1.asName)(indexName)} ON ${(0, prostgles_types_1.asName)(tableName)} ${!using ? "" : ("USING " + using)} (${definition}) ;`);
212
+ });
213
+ }
214
+ }));
215
+ if (queries.length) {
216
+ const q = queries.join("\n");
217
+ console.log("TableConfig: \n", q);
218
+ await this.db.multi(q);
219
+ }
220
+ }
221
+ }
222
+ exports.default = TableConfigurator;
223
+ async function columnExists(args) {
224
+ const { db, tableName, colName } = args;
225
+ return Boolean((await db.oneOrNone(`
226
+ SELECT column_name, table_name
227
+ FROM information_schema.columns
228
+ WHERE table_name=${(0, PubSubManager_1.asValue)(tableName)} and column_name=${(0, PubSubManager_1.asValue)(colName)}
229
+ LIMIT 1;
230
+ `))?.column_name);
231
+ }
package/lib/index.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { ProstglesInitOptions } from "./Prostgles";
2
+ declare function prostgles<S = void>(params: ProstglesInitOptions<S>): Promise<{
3
+ db: import("./DboBuilder").DBHandlerServer;
4
+ _db: import("./Prostgles").DB;
5
+ pgp: import("./Prostgles").PGP;
6
+ io?: any;
7
+ destroy: () => Promise<boolean>;
8
+ }>;
9
+ export = prostgles;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE9D,iBAAS,SAAS,CAAC,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC;;;;;;GAI3D;AACD,SAAS,SAAS,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ const Prostgles_1 = require("./Prostgles");
3
+ function prostgles(params) {
4
+ let prgl = new Prostgles_1.Prostgles(params);
5
+ return prgl.init(params.onReady);
6
+ }
7
+ module.exports = prostgles;
8
+ // declare const init (params: InitOptions) => {
9
+ // let prgl = new Prostgles(params);
10
+ // prgl.init(params.isReady);
11
+ // }
12
+ // module.exports = {
13
+ // pgp,
14
+ // init,
15
+ // Prostgles
16
+ // }
17
+ // module.exports = prostgles;
18
+ // module.exports = init;
19
+ // declare module "ProstglesServer" {
20
+ // function iinit(params: InitOptions): void ;
21
+ // // namespace iinit {
22
+ // // interface ReduxLoggerOptions {
23
+ // // actionTransformer?: (action: any) => any;
24
+ // // collapsed?: boolean;
25
+ // // duration?: boolean;
26
+ // // level?: string;
27
+ // // logger?: any;
28
+ // // predicate?: (getState: Function, action: any) => boolean;
29
+ // // timestamp?: boolean;
30
+ // // transformer?: (state:any) => any;
31
+ // // }
32
+ // // }
33
+ // export = iinit;
34
+ // // export = init;
35
+ // }
36
+ //var init =
37
+ // export function init(params: InitOptions){
38
+ // let prgl = new Prostgles(params);
39
+ // prgl.init(params.isReady);
40
+ // }
41
+ // declare const init (params: InitOptions) => {
42
+ // let prgl = new Prostgles(params);
43
+ // prgl.init(params.isReady);
44
+ // }
45
+ // export = init;
package/lib/index.ts CHANGED
@@ -1,10 +1,9 @@
1
1
  import { Prostgles, ProstglesInitOptions } from "./Prostgles";
2
- import { DBSchema } from "prostgles-types";
3
2
 
4
- function prostgles<S extends DBSchema | undefined = undefined>(params: ProstglesInitOptions<S>){
3
+ function prostgles<S = void>(params: ProstglesInitOptions<S>){
5
4
 
6
- let prgl = new Prostgles<S>(params as any);
7
- return prgl.init(params.onReady);
5
+ let prgl = new Prostgles(params as any);
6
+ return prgl.init(params.onReady as any);
8
7
  }
9
8
  export = prostgles;//{ , TableHandler, ViewHandler };
10
9
 
@@ -0,0 +1,10 @@
1
+ export declare type Graph = {
2
+ [key: string]: {
3
+ [key: string]: number;
4
+ };
5
+ };
6
+ export declare const findShortestPath: (graph: Graph, startNode: string, endNode: string) => {
7
+ distance: number;
8
+ path: string[];
9
+ };
10
+ //# sourceMappingURL=shortestPath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shortestPath.d.ts","sourceRoot":"","sources":["shortestPath.ts"],"names":[],"mappings":"AAcA,oBAAY,KAAK,GAAG;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CACxC,CAAC;AAEF,eAAO,MAAM,gBAAgB,UAAW,KAAK,aAAa,MAAM,WAAW,MAAM,KAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAgErH,CAAC"}
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findShortestPath = void 0;
4
+ const shortestDistanceNode = (distances, visited) => {
5
+ let shortest = null;
6
+ for (let node in distances) {
7
+ let currentIsShortest = shortest === null || distances[node] < distances[shortest];
8
+ if (currentIsShortest && !visited.includes(node)) {
9
+ shortest = node;
10
+ }
11
+ }
12
+ return shortest;
13
+ };
14
+ const findShortestPath = (graph, startNode, endNode) => {
15
+ // establish object for recording distances from the start node
16
+ let distances = {};
17
+ distances[endNode] = "Infinity";
18
+ distances = Object.assign(distances, graph[startNode]);
19
+ // track paths
20
+ let parents = { endNode: null };
21
+ for (let child in graph[startNode]) {
22
+ parents[child] = startNode;
23
+ }
24
+ // track nodes that have already been visited
25
+ let visited = [];
26
+ // find the nearest node
27
+ let node = shortestDistanceNode(distances, visited);
28
+ // for that node
29
+ while (node) {
30
+ // find its distance from the start node & its child nodes
31
+ let distance = distances[node];
32
+ let children = graph[node];
33
+ // for each of those child nodes
34
+ for (let child in children) {
35
+ // make sure each child node is not the start node
36
+ if (String(child) === String(startNode)) {
37
+ continue;
38
+ }
39
+ else {
40
+ // save the distance from the start node to the child node
41
+ let newdistance = distance + children[child];
42
+ // if there's no recorded distance from the start node to the child node in the distances object
43
+ // or if the recorded distance is shorter than the previously stored distance from the start node to the child node
44
+ // save the distance to the object
45
+ // record the path
46
+ if (!distances[child] || distances[child] > newdistance) {
47
+ distances[child] = newdistance;
48
+ parents[child] = node;
49
+ }
50
+ }
51
+ }
52
+ // move the node to the visited set
53
+ visited.push(node);
54
+ // move to the nearest neighbor node
55
+ node = shortestDistanceNode(distances, visited);
56
+ }
57
+ // using the stored paths from start node to end node
58
+ // record the shortest path
59
+ let shortestPath = [endNode];
60
+ let parent = parents[endNode];
61
+ while (parent) {
62
+ shortestPath.push(parent);
63
+ parent = parents[parent];
64
+ }
65
+ shortestPath.reverse();
66
+ // return the shortest path from start node to end node & its distance
67
+ let results = {
68
+ distance: distances[endNode],
69
+ path: shortestPath,
70
+ };
71
+ return results;
72
+ };
73
+ exports.findShortestPath = findShortestPath;
74
+ /* Usage:
75
+
76
+ const graph = {
77
+ start: { A: 5, B: 2 },
78
+ A: { start: 1, C: 4, D: 2 },
79
+ B: { A: 8, D: 7 },
80
+ C: { D: 6, end: 3 },
81
+ D: { end: 1 },
82
+ end: {},
83
+ };
84
+
85
+ findShortestPath(graph, 'start', 'end');
86
+
87
+ {
88
+ "distance": 8,
89
+ "path": [
90
+ "start",
91
+ "A",
92
+ "D",
93
+ "end"
94
+ ]
95
+ }
96
+
97
+
98
+
99
+
100
+ // The graph is unidirectional
101
+
102
+ const graph = {
103
+ start: { A: 5 },
104
+ end: { A: 1 },
105
+ A: { start: 1, end: 1 },
106
+ };
107
+
108
+ findShortestPath(graph, 'start', 'end');
109
+
110
+
111
+ */
package/lib/utils.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { get } from "prostgles-types";
2
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC"}
package/lib/utils.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.get = void 0;
4
+ var prostgles_types_1 = require("prostgles-types");
5
+ Object.defineProperty(exports, "get", { enumerable: true, get: function () { return prostgles_types_1.get; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prostgles-server",
3
- "version": "2.0.178",
3
+ "version": "2.0.179",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -29,7 +29,7 @@
29
29
  "bluebird": "^3.7.2",
30
30
  "file-type": "^16.5.3",
31
31
  "pg-promise": "^10.11.1",
32
- "prostgles-types": "^1.5.153",
32
+ "prostgles-types": "^1.5.155",
33
33
  "sharp": "^0.30.5"
34
34
  },
35
35
  "devDependencies": {
@@ -37,6 +37,6 @@
37
37
  "@types/bluebird": "^3.5.36",
38
38
  "@types/node": "^14.14.35",
39
39
  "@types/sharp": "^0.30.2",
40
- "typescript": "^4.7.2"
40
+ "typescript": "^4.7.3"
41
41
  }
42
42
  }
@@ -1 +1 @@
1
- 85322
1
+ 14775
@@ -1,2 +1,2 @@
1
- export { DBHandlerClient } from "prostgles-client/dist/prostgles";
1
+ export { DBHandlerClient, Auth } from "prostgles-client/dist/prostgles";
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { DBHandlerClient, Auth } from "./client/index";
2
+ import { DBSchemaTable } from "./client/node_modules/prostgles-types/dist";
3
+ export default function client_only(db: DBHandlerClient, auth: Auth, log: (...args: any[]) => any, methods: any, tableSchema: DBSchemaTable[]): Promise<void>;
4
+ //# sourceMappingURL=client_only_queries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client_only_queries.d.ts","sourceRoot":"","sources":["client_only_queries.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAa,MAAM,4CAA4C,CAAC;AAGtF,wBAA8B,WAAW,CAAC,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,OAAO,KAAA,EAAE,WAAW,EAAE,aAAa,EAAE,iBA6S7I"}
@@ -0,0 +1,6 @@
1
+ import { DBHandlerServer } from "../dist/Prostgles";
2
+ import { DBHandlerClient } from "./client/index";
3
+ export declare function tryRun(desc: string, func: () => any, log?: Function): Promise<void>;
4
+ export declare function tryRunP(desc: string, func: (resolve: any, reject: any) => any, log?: Function): Promise<unknown>;
5
+ export default function isomorphic(db: Partial<DBHandlerServer> | Partial<DBHandlerClient>): Promise<void>;
6
+ //# sourceMappingURL=isomorphic_queries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isomorphic_queries.d.ts","sourceRoot":"","sources":["isomorphic_queries.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAC,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGjD,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,EAAE,GAAG,CAAC,EAAE,QAAQ,iBAWzE;AACD,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,KAAK,GAAG,EAAE,GAAG,CAAC,EAAE,QAAQ,oBAW7F;AAED,wBAA8B,UAAU,CAAC,EAAE,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,iBAurB/F"}