@prostgles/app 2.3.6-dev.1792579748 → 2.3.6-dev.1792595016

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 (51) hide show
  1. package/client/build/js/main.bundle.js +2 -2
  2. package/dist/common/DBGeneratedSchema.d.ts +4 -0
  3. package/dist/common/DBGeneratedSchema.d.ts.map +1 -1
  4. package/dist/common/DashboardTypes.d.ts +2 -0
  5. package/dist/common/DashboardTypes.d.ts.map +1 -1
  6. package/dist/server/package.json +1 -1
  7. package/dist/server/src/ConnectionManager/fetchUserAccessControlRules.js +2 -2
  8. package/dist/server/src/ConnectionManager/fetchUserAccessControlRules.js.map +1 -1
  9. package/dist/server/src/ConnectionManager/getConnectionUser.d.ts.map +1 -1
  10. package/dist/server/src/ConnectionManager/getConnectionUser.js +2 -5
  11. package/dist/server/src/ConnectionManager/getConnectionUser.js.map +1 -1
  12. package/dist/server/src/authConfig/getAuth.d.ts.map +1 -1
  13. package/dist/server/src/authConfig/getAuth.js +0 -10
  14. package/dist/server/src/authConfig/getAuth.js.map +1 -1
  15. package/dist/server/src/electronConfig.d.ts +3 -0
  16. package/dist/server/src/electronConfig.d.ts.map +1 -1
  17. package/dist/server/src/electronConfig.js +6 -1
  18. package/dist/server/src/electronConfig.js.map +1 -1
  19. package/dist/server/src/publish/businessAccessFilters.d.ts +53 -51
  20. package/dist/server/src/publish/businessAccessFilters.d.ts.map +1 -1
  21. package/dist/server/src/publish/businessAccessFilters.js +9 -15
  22. package/dist/server/src/publish/businessAccessFilters.js.map +1 -1
  23. package/dist/server/src/publish/getAllowedConnectionsFilter.d.ts +89 -0
  24. package/dist/server/src/publish/getAllowedConnectionsFilter.d.ts.map +1 -0
  25. package/dist/server/src/publish/getAllowedConnectionsFilter.js +83 -0
  26. package/dist/server/src/publish/getAllowedConnectionsFilter.js.map +1 -0
  27. package/dist/server/src/publish/getBusinessAccessPublish.d.ts +444 -374
  28. package/dist/server/src/publish/getBusinessAccessPublish.d.ts.map +1 -1
  29. package/dist/server/src/publish/getBusinessAccessPublish.js +18 -10
  30. package/dist/server/src/publish/getBusinessAccessPublish.js.map +1 -1
  31. package/dist/server/src/publish/publish.d.ts.map +1 -1
  32. package/dist/server/src/publish/publish.js +5 -11
  33. package/dist/server/src/publish/publish.js.map +1 -1
  34. package/dist/server/src/serverFunctions/adminServerFunctions/stateServerAdminFunctions.d.ts +13 -0
  35. package/dist/server/src/serverFunctions/adminServerFunctions/stateServerAdminFunctions.d.ts.map +1 -1
  36. package/dist/server/src/serverFunctions/adminServerFunctions/stateServerAdminFunctions.js +31 -0
  37. package/dist/server/src/serverFunctions/adminServerFunctions/stateServerAdminFunctions.js.map +1 -1
  38. package/dist/server/src/serverFunctions/loadGeneratedWorkspaces/loadGeneratedTable.d.ts +1 -0
  39. package/dist/server/src/serverFunctions/loadGeneratedWorkspaces/loadGeneratedTable.d.ts.map +1 -1
  40. package/dist/server/src/serverFunctions/loadGeneratedWorkspaces/loadGeneratedTable.js +1 -0
  41. package/dist/server/src/serverFunctions/loadGeneratedWorkspaces/loadGeneratedTable.js.map +1 -1
  42. package/dist/server/src/serverFunctions/stateServerFunctions.d.ts +13 -0
  43. package/dist/server/src/serverFunctions/stateServerFunctions.d.ts.map +1 -1
  44. package/dist/server/src/testElectron.js +3 -0
  45. package/dist/server/src/testElectron.js.map +1 -1
  46. package/package.json +1 -1
  47. package/sample_schemas/food_delivery/dist/connection.js +0 -1008
  48. package/sample_schemas/food_delivery/dist/databaseConfig.js +0 -116
  49. package/sample_schemas/food_delivery/dist/index.js +0 -17
  50. package/sample_schemas/food_delivery/dist/onMount.js +0 -132
  51. package/sample_schemas/food_delivery/dist/workspaceConfig.js +0 -56
@@ -1,116 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const table_schema_positions = {
4
- users: {
5
- x: -1184,
6
- y: -638,
7
- },
8
- orders: {
9
- x: -430,
10
- y: -1052,
11
- },
12
- routes: {
13
- x: -115,
14
- y: -240,
15
- },
16
- ratings: {
17
- x: -418,
18
- y: -454,
19
- },
20
- v_riders: {
21
- x: 632,
22
- y: 880,
23
- },
24
- addresses: {
25
- x: -1159,
26
- y: -1031,
27
- },
28
- customers: {
29
- x: 958,
30
- y: -464,
31
- },
32
- menu_items: {
33
- x: -412,
34
- y: -186,
35
- },
36
- user_types: {
37
- x: -1175,
38
- y: -263,
39
- },
40
- _menu_items: {
41
- x: 690,
42
- y: -123,
43
- },
44
- order_items: {
45
- x: -61,
46
- y: -896,
47
- },
48
- restaurants: {
49
- x: -765,
50
- y: -564,
51
- },
52
- order_updates: {
53
- x: -71,
54
- y: -1166,
55
- },
56
- v_restaurants: {
57
- x: 272,
58
- y: 880,
59
- },
60
- customers_info: {
61
- x: 873,
62
- y: 642,
63
- },
64
- user_addresses: {
65
- x: -760,
66
- y: -1135,
67
- },
68
- hygiene_ratings: {
69
- x: -123,
70
- y: -33,
71
- },
72
- spatial_ref_sys: {
73
- x: 970,
74
- y: 880,
75
- },
76
- geometry_columns: {
77
- x: 404,
78
- y: 597,
79
- },
80
- geography_columns: {
81
- x: 683,
82
- y: 389,
83
- },
84
- order_status_types: {
85
- x: -768,
86
- y: -941,
87
- },
88
- customers_info_view: {
89
- x: -40,
90
- y: 880,
91
- },
92
- restaurant_managers: {
93
- x: -429,
94
- y: -627,
95
- },
96
- delivery_status_types: {
97
- x: -115,
98
- y: -413,
99
- },
100
- delivery_status_changes: {
101
- x: -71,
102
- y: -617,
103
- },
104
- '"london_restaurants.geojson"': {
105
- x: 970,
106
- y: 60,
107
- },
108
- };
109
- const table_schema_transform = {
110
- scale: 0.541,
111
- translate: { x: 685.5, y: 664.5 },
112
- };
113
- exports.default = {
114
- table_schema_positions,
115
- table_schema_transform,
116
- };
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.onInitSQL = exports.workspaceConfig = exports.databaseConfig = exports.connection = exports.onMount = void 0;
7
- const fs_1 = require("fs");
8
- const path_1 = require("path");
9
- var onMount_1 = require("./onMount");
10
- Object.defineProperty(exports, "onMount", { enumerable: true, get: function () { return onMount_1.onMount; } });
11
- var connection_1 = require("./connection");
12
- Object.defineProperty(exports, "connection", { enumerable: true, get: function () { return __importDefault(connection_1).default; } });
13
- var databaseConfig_1 = require("./databaseConfig");
14
- Object.defineProperty(exports, "databaseConfig", { enumerable: true, get: function () { return __importDefault(databaseConfig_1).default; } });
15
- var workspaceConfig_1 = require("./workspaceConfig");
16
- Object.defineProperty(exports, "workspaceConfig", { enumerable: true, get: function () { return workspaceConfig_1.workspaceConfig; } });
17
- exports.onInitSQL = (0, fs_1.readFileSync)((0, path_1.join)(__dirname, "../onInit.sql"), "utf8");
@@ -1,132 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.onMount = void 0;
4
- const onMount = async ({ dbo: db, sql }) => {
5
- const roadTableHandler = db.routes;
6
- if (!roadTableHandler)
7
- return;
8
- const count = await roadTableHandler.count();
9
- // const { elements } = await fetch("http://overpass-api.de/api/interpreter", {
10
- // method: "POST",
11
- // body: "[out:json];(way(51.31087184032102,-0.33782958984375,51.723200166800346,0.053558349609375)[highway];); out 200000 ids geom;",
12
- // headers: {
13
- // "Content-Type": "application/json",
14
- // },
15
- // }).then((res) => res.json());
16
- if (!count) {
17
- console.log("Downloading road data...");
18
- const { elements } = await fetch("https://prostgles.com/static/routes.json").then((res) => res.json());
19
- console.log("Inserting road data into database...");
20
- await db.routes.insert(elements.map((d) => ({
21
- id: d.id,
22
- geometry: {
23
- type: "LineString",
24
- coordinates: d.geometry.map(({ lat, lon }) => [lon, lat]),
25
- },
26
- })));
27
- console.log("Creating indexes...");
28
- await sql(`
29
-
30
- DELETE FROM routes
31
- WHERE st_isempty(geog::GEOMETRY) = true
32
- OR st_length(geog) < 100
33
- OR id IS NULL;
34
-
35
- CREATE INDEX IF NOT EXISTS idx_roads
36
- ON routes USING gist (geog);
37
-
38
- CREATE INDEX IF NOT EXISTS idx_order_items_order_id ON order_items(order_id);
39
-
40
- `);
41
- console.log("Indexes and mock data...");
42
- for (const query of [
43
- `CALL mock_users(1e5::integer, '1 year');`,
44
- `CALL ensure_popular_restaurant_customer_coverage('1 month'::INTERVAL, 'Sun Cafe');`,
45
- `CALL mock_orders(10::INTEGER, '1 month'::INTERVAL, 'Sun Cafe');`,
46
- `CALL mock_orders(1e3::INTEGER, '6 month'::INTERVAL);`,
47
- `CALL mock_orders(1e3::INTEGER, '3 month'::INTERVAL);`,
48
- `CALL mock_orders(1e3::INTEGER, '2 month'::INTERVAL);`,
49
- `CALL mock_orders(1e3::INTEGER, '1 month'::INTERVAL);`,
50
- // `CALL mock_orders(35e3::INTEGER, '1 hour'::INTERVAL);`,
51
- ]) {
52
- console.log("Running query:", query);
53
- await sql(query);
54
- }
55
- console.log("Finished inserting mock data.");
56
- }
57
- await sql(`
58
- VACUUM;
59
- `);
60
- let shownProcInfo = false;
61
- let stopped = false;
62
- const mockLocations = async () => {
63
- if (stopped)
64
- return;
65
- try {
66
- if (!shownProcInfo) {
67
- shownProcInfo = true;
68
- console.log(await sql(`
69
- SELECT pg_get_function_arguments(p.oid), postgis_full_version()
70
- FROM pg_proc p
71
- WHERE proname = 'st_lineinterpolatepoint';
72
- `, {}, { returnType: "rows" }));
73
- }
74
- await sql(`CALL mock_locations(); /* from fork */`);
75
- }
76
- catch (error) {
77
- if (stopped)
78
- return;
79
- console.error("Error calling mock_locations", error);
80
- const funcs = await sql(`
81
- SELECT proname, probin, pg_get_function_arguments(oid), current_database(), (SELECT string_agg(extname, '; ') FROM pg_catalog.pg_extension) as extensions
82
- FROM pg_catalog.pg_proc
83
- WHERE proname = 'st_lineinterpolatepoint'
84
- `, {}, { returnType: "rows" });
85
- console.error(funcs);
86
- throw error;
87
- }
88
- if (!stopped)
89
- void mockLocations();
90
- };
91
- void mockLocations();
92
- const orderInterval = setInterval(async () => {
93
- if (stopped)
94
- return;
95
- const hourOfDayAverageOrders = {
96
- 0: 2,
97
- 1: 1,
98
- 2: 1,
99
- 3: 1,
100
- 4: 1,
101
- 5: 1,
102
- 6: 2,
103
- 7: 3,
104
- 8: 5,
105
- 9: 8,
106
- 10: 10,
107
- 11: 12,
108
- 12: 12,
109
- 13: 12,
110
- 14: 10,
111
- 15: 10,
112
- 16: 10,
113
- 17: 12,
114
- 18: 15,
115
- 19: 15,
116
- 20: 12,
117
- 21: 8,
118
- 22: 5,
119
- 23: 3,
120
- };
121
- const hourOfDay = new Date().getHours();
122
- const orderRatePerSecond = hourOfDayAverageOrders[hourOfDay] ?? 1;
123
- await sql(`CALL mock_orders(\${orderRatePerSecond}::integer)`, {
124
- orderRatePerSecond,
125
- });
126
- }, 3e3);
127
- return () => {
128
- stopped = true;
129
- clearInterval(orderInterval);
130
- };
131
- };
132
- exports.onMount = onMount;
@@ -1,56 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.workspaceConfig = void 0;
4
- exports.workspaceConfig = {
5
- workspaces: [
6
- {
7
- name: "Main",
8
- options: {
9
- hideCounts: false,
10
- pinnedMenu: true,
11
- tableListSortBy: "extraInfo",
12
- tableListEndInfo: "count",
13
- defaultLayoutType: "tab",
14
- },
15
- windows: [
16
- {
17
- type: "sql",
18
- name: "Stats",
19
- sql: `/* Most popular menu items */
20
- SELECT mi.name, COUNT(*) as order_count
21
- FROM order_items oi
22
- LEFT JOIN menu_items mi
23
- ON mi.id = oi.menu_item_id
24
- LEFT JOIN orders o
25
- ON o.id = oi.order_id
26
- GROUP BY 1
27
- ORDER BY 2 desc
28
-
29
- /* Busiest delivery times */
30
- SELECT EXTRACT(HOUR FROM created_at) as hour, COUNT(*) as order_count
31
- FROM orders
32
- GROUP BY hour
33
- ORDER BY order_count DESC
34
-
35
- /* Top-performing restaurants */
36
- SELECT restaurants.name, SUM(orders.total_price) as total_revenue
37
- FROM orders
38
- JOIN restaurants ON orders.restaurant_id = restaurants.id
39
- GROUP BY restaurants.id, restaurants.name
40
- ORDER BY total_revenue DESC
41
- LIMIT 10;
42
-
43
- /* Customer retention rate */
44
- WITH customer_orders AS (
45
- SELECT customer_id, MIN(created_at) as first_order, MAX(created_at) as last_order
46
- FROM orders
47
- GROUP BY customer_id
48
- )
49
- SELECT
50
- (COUNT(CASE WHEN last_order >= DATE_TRUNC('month', CURRENT_DATE) - INTERVAL '1 month' THEN 1 END) * 100.0 / COUNT(*))::NUMERIC(8,2) as retention_rate
51
- FROM customer_orders;`,
52
- },
53
- ],
54
- },
55
- ],
56
- };