@prostgles/prostgles 2.3.6-dev.1787077577 → 2.3.6-dev.1787224693
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/client/build/js/main.bundle.js +1 -1
- package/dist/server/package.json +5 -1
- package/dist/server/src/ConnectionManager/applyStartupSchemaConfig.d.ts +7 -1
- package/dist/server/src/ConnectionManager/applyStartupSchemaConfig.d.ts.map +1 -1
- package/dist/server/src/ConnectionManager/applyStartupSchemaConfig.js +17 -7
- package/dist/server/src/ConnectionManager/applyStartupSchemaConfig.js.map +1 -1
- package/dist/server/src/ConnectionManager/getHotReloadConfigs.d.ts.map +1 -1
- package/dist/server/src/ConnectionManager/getHotReloadConfigs.js +3 -3
- package/dist/server/src/ConnectionManager/getHotReloadConfigs.js.map +1 -1
- package/dist/server/src/McpHub/ProstglesMcpHub/ProstglesMCPServers/Web/getDocumentText.d.ts +2 -1
- package/dist/server/src/McpHub/ProstglesMcpHub/ProstglesMCPServers/Web/getDocumentText.d.ts.map +1 -1
- package/dist/server/src/McpHub/ProstglesMcpHub/ProstglesMCPServers/Web/getDocumentText.js.map +1 -1
- package/dist/server/src/McpHub/ProstglesMcpHub/ProstglesMCPServers/WebDev/tools/searchWebDevFiles.spec.js +1 -0
- package/dist/server/src/McpHub/ProstglesMcpHub/ProstglesMCPServers/WebDev/tools/searchWebDevFiles.spec.js.map +1 -1
- package/dist/server/src/ServiceManager/ServiceManager.d.ts +22 -11
- package/dist/server/src/ServiceManager/ServiceManager.d.ts.map +1 -1
- package/dist/server/src/ServiceManager/ServiceManager.js +39 -4
- package/dist/server/src/ServiceManager/ServiceManager.js.map +1 -1
- package/dist/server/src/ServiceManager/ServiceManager.spec.d.ts.map +1 -1
- package/dist/server/src/ServiceManager/ServiceManager.spec.js +37 -1
- package/dist/server/src/ServiceManager/ServiceManager.spec.js.map +1 -1
- package/dist/server/src/ServiceManager/ServiceManagerTypes.d.ts +7 -0
- package/dist/server/src/ServiceManager/ServiceManagerTypes.d.ts.map +1 -1
- package/dist/server/src/ServiceManager/ServiceManagerTypes.js.map +1 -1
- package/dist/server/src/ServiceManager/buildService.d.ts +3 -3
- package/dist/server/src/ServiceManager/buildService.d.ts.map +1 -1
- package/dist/server/src/ServiceManager/buildService.js +10 -6
- package/dist/server/src/ServiceManager/buildService.js.map +1 -1
- package/dist/server/src/ServiceManager/enableService.d.ts +3 -3
- package/dist/server/src/ServiceManager/enableService.d.ts.map +1 -1
- package/dist/server/src/ServiceManager/enableService.js.map +1 -1
- package/dist/server/src/ServiceManager/getSelectedConfigEnvs.d.ts +2 -3
- package/dist/server/src/ServiceManager/getSelectedConfigEnvs.d.ts.map +1 -1
- package/dist/server/src/ServiceManager/getSelectedConfigEnvs.js +3 -3
- package/dist/server/src/ServiceManager/getSelectedConfigEnvs.js.map +1 -1
- package/dist/server/src/ServiceManager/getServiceEndpoints.d.ts.map +1 -1
- package/dist/server/src/ServiceManager/getServiceEndpoints.js +9 -1
- package/dist/server/src/ServiceManager/getServiceEndpoints.js.map +1 -1
- package/dist/server/src/ServiceManager/initialiseServices.d.ts.map +1 -1
- package/dist/server/src/ServiceManager/initialiseServices.js +3 -2
- package/dist/server/src/ServiceManager/initialiseServices.js.map +1 -1
- package/dist/server/src/ServiceManager/startService.d.ts +3 -3
- package/dist/server/src/ServiceManager/startService.d.ts.map +1 -1
- package/dist/server/src/ServiceManager/startService.js +9 -7
- package/dist/server/src/ServiceManager/startService.js.map +1 -1
- package/dist/server/src/ServiceManager/stopService.d.ts +1 -2
- package/dist/server/src/ServiceManager/stopService.d.ts.map +1 -1
- package/dist/server/src/ServiceManager/stopService.js +1 -1
- package/dist/server/src/ServiceManager/stopService.js.map +1 -1
- package/dist/server/src/cli/cli.js +4 -34
- package/dist/server/src/cli/cli.js.map +1 -1
- package/dist/server/src/cli/cliTemplateFiles.d.ts +8 -0
- package/dist/server/src/cli/cliTemplateFiles.d.ts.map +1 -0
- package/dist/server/src/cli/cliTemplateFiles.js +409 -0
- package/dist/server/src/cli/cliTemplateFiles.js.map +1 -0
- package/dist/server/src/cli/getCliAgentsFile.d.ts.map +1 -1
- package/dist/server/src/cli/getCliAgentsFile.js +8 -0
- package/dist/server/src/cli/getCliAgentsFile.js.map +1 -1
- package/dist/server/src/init/prostglesOnReady.d.ts +2 -1
- package/dist/server/src/init/prostglesOnReady.d.ts.map +1 -1
- package/dist/server/src/init/prostglesOnReady.js +18 -3
- package/dist/server/src/init/prostglesOnReady.js.map +1 -1
- package/dist/server/src/schemaConfig.d.ts +4 -0
- package/dist/server/src/schemaConfig.d.ts.map +1 -1
- package/dist/server/src/schemaConfig.js.map +1 -1
- package/dist/server/src/serverFunctions/adminServerFunctions/stateServerAdminFunctions.d.ts.map +1 -1
- package/dist/server/src/serverFunctions/adminServerFunctions/stateServerAdminFunctions.js +1 -2
- package/dist/server/src/serverFunctions/adminServerFunctions/stateServerAdminFunctions.js.map +1 -1
- package/dist/server/src/services.d.ts +4 -0
- package/dist/server/src/services.d.ts.map +1 -0
- package/dist/server/src/services.js +8 -0
- package/dist/server/src/services.js.map +1 -0
- package/package.json +5 -1
- package/dist/server/src/cli/cliUtils.d.ts +0 -64
- package/dist/server/src/cli/cliUtils.d.ts.map +0 -1
- package/dist/server/src/cli/cliUtils.js +0 -201
- package/dist/server/src/cli/cliUtils.js.map +0 -1
- package/dist/server/src/testing/createTestDeployment.d.ts +0 -37
- package/dist/server/src/testing/createTestDeployment.d.ts.map +0 -1
- package/dist/server/src/testing/createTestDeployment.js +0 -393
- package/dist/server/src/testing/createTestDeployment.js.map +0 -1
- package/dist/server/src/testing/index.d.ts +0 -2
- package/dist/server/src/testing/index.d.ts.map +0 -1
- package/dist/server/src/testing/index.js +0 -6
- package/dist/server/src/testing/index.js.map +0 -1
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.srcSubfolderNames = exports.generatedFolderName = exports.srcFolderName = exports.saveCliTemplateFiles = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const utils_1 = require("../../../common/utils");
|
|
6
|
+
const crypto_1 = require("crypto");
|
|
7
|
+
const package_json_1 = tslib_1.__importDefault(require("../../package.json"));
|
|
8
|
+
const prostgles_types_1 = require("prostgles-types");
|
|
9
|
+
const path_1 = require("path");
|
|
10
|
+
const fs_1 = require("fs");
|
|
11
|
+
const saveCliTemplateFiles = ({ configId, targetPath, }) => {
|
|
12
|
+
saveFolderFiles(targetPath, getCliTemplateFiles({ configId }));
|
|
13
|
+
};
|
|
14
|
+
exports.saveCliTemplateFiles = saveCliTemplateFiles;
|
|
15
|
+
exports.srcFolderName = "src";
|
|
16
|
+
exports.generatedFolderName = "generated";
|
|
17
|
+
const testsFolderName = "tests";
|
|
18
|
+
const servicesFolderName = "services";
|
|
19
|
+
exports.srcSubfolderNames = [
|
|
20
|
+
"functions",
|
|
21
|
+
"tableConfigs",
|
|
22
|
+
"tableOptions",
|
|
23
|
+
"tableHooks",
|
|
24
|
+
servicesFolderName,
|
|
25
|
+
];
|
|
26
|
+
const saveFolderFiles = (targetPath, folderFiles) => {
|
|
27
|
+
for (const [relativePath, content] of Object.entries(folderFiles)) {
|
|
28
|
+
const fullPath = (0, path_1.join)(targetPath, relativePath);
|
|
29
|
+
const fullPathDirectory = (0, path_1.dirname)(fullPath);
|
|
30
|
+
if (typeof content === "string") {
|
|
31
|
+
(0, fs_1.mkdirSync)(fullPathDirectory, { recursive: true });
|
|
32
|
+
(0, fs_1.writeFileSync)(fullPath, (0, utils_1.fixIndent)(content));
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
(0, fs_1.mkdirSync)(fullPath, { recursive: true });
|
|
36
|
+
saveFolderFiles(fullPath, content);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const getCliTemplateFiles = ({ configId }) => ({
|
|
41
|
+
"package.json": JSON.stringify(getPackageJson(configId), null, 2) + "\n",
|
|
42
|
+
"tsconfig.json": JSON.stringify({
|
|
43
|
+
compilerOptions: {
|
|
44
|
+
target: "ES2022",
|
|
45
|
+
module: "Node16",
|
|
46
|
+
moduleResolution: "Node16",
|
|
47
|
+
rootDir: ".",
|
|
48
|
+
outDir: "build",
|
|
49
|
+
esModuleInterop: true,
|
|
50
|
+
forceConsistentCasingInFileNames: true,
|
|
51
|
+
noImplicitAny: true,
|
|
52
|
+
noUncheckedIndexedAccess: true,
|
|
53
|
+
skipLibCheck: true,
|
|
54
|
+
strict: true,
|
|
55
|
+
strictFunctionTypes: true,
|
|
56
|
+
},
|
|
57
|
+
include: [exports.srcFolderName, exports.generatedFolderName, testsFolderName],
|
|
58
|
+
exclude: [`${exports.srcFolderName}/services/**/src`],
|
|
59
|
+
}, null, 2) + "\n",
|
|
60
|
+
"AGENTS.md": getCliAgentsFile(),
|
|
61
|
+
[exports.generatedFolderName]: {
|
|
62
|
+
"DBGeneratedSchema.ts": "export type DBGeneratedSchema = Record<string, { columns: Record<string, unknown> }>\n",
|
|
63
|
+
},
|
|
64
|
+
[exports.srcFolderName]: {
|
|
65
|
+
...(0, prostgles_types_1.fromEntries)(exports.srcSubfolderNames.map((folderName) => [folderName, {}])),
|
|
66
|
+
"index.ts": `
|
|
67
|
+
import { defineConfig } from "@prostgles/prostgles";
|
|
68
|
+
import type { DBGeneratedSchema } from "../${exports.generatedFolderName}/DBGeneratedSchema";
|
|
69
|
+
import { serviceManagerConfig } from "./serviceManager";
|
|
70
|
+
|
|
71
|
+
const prostgles = defineConfig<DBGeneratedSchema>();
|
|
72
|
+
|
|
73
|
+
export default prostgles({
|
|
74
|
+
id: ${JSON.stringify(configId)},
|
|
75
|
+
connection: {
|
|
76
|
+
table_options: {},
|
|
77
|
+
},
|
|
78
|
+
services: serviceManagerConfig,
|
|
79
|
+
tableConfig: {},
|
|
80
|
+
});`,
|
|
81
|
+
[servicesFolderName]: {
|
|
82
|
+
myService: {
|
|
83
|
+
"myService.service.ts": `
|
|
84
|
+
import type { ProstglesService } from "@prostgles/prostgles/services";
|
|
85
|
+
|
|
86
|
+
export const myService = {
|
|
87
|
+
icon: "Extension",
|
|
88
|
+
label: "My service",
|
|
89
|
+
description: "Example local Docker service.",
|
|
90
|
+
port: 8080,
|
|
91
|
+
healthCheck: { endpoint: "/health" },
|
|
92
|
+
endpoints: {
|
|
93
|
+
"/hey": {
|
|
94
|
+
method: "GET",
|
|
95
|
+
inputSchema: undefined,
|
|
96
|
+
description: "Service info endpoint",
|
|
97
|
+
outputSchema: "string",
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
} as const satisfies ProstglesService;`,
|
|
101
|
+
src: {
|
|
102
|
+
Dockerfile: `
|
|
103
|
+
FROM python:3.13-alpine
|
|
104
|
+
|
|
105
|
+
WORKDIR /app
|
|
106
|
+
RUN printf 'service-ok' > health
|
|
107
|
+
RUN printf 'Hello from myService!' > hey
|
|
108
|
+
|
|
109
|
+
EXPOSE 8080
|
|
110
|
+
|
|
111
|
+
CMD ["python", "-m", "http.server", "8080", "--bind", "0.0.0.0"]`,
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
"serviceManager.ts": `
|
|
116
|
+
import {
|
|
117
|
+
getServiceManager,
|
|
118
|
+
type ServiceManagerConfig,
|
|
119
|
+
} from "@prostgles/prostgles/services";
|
|
120
|
+
import { myService } from "./services/myService/myService.service";
|
|
121
|
+
import path from "node:path";
|
|
122
|
+
|
|
123
|
+
export const services = { myService };
|
|
124
|
+
|
|
125
|
+
export const serviceManagerConfig = {
|
|
126
|
+
services,
|
|
127
|
+
serviceRoot: path.resolve(__dirname, "..", "..", "src", "services"),
|
|
128
|
+
} satisfies ServiceManagerConfig<typeof services>;
|
|
129
|
+
|
|
130
|
+
/** The host-owned instance used by Prostgles and the Services UI. */
|
|
131
|
+
export const serviceManager = getServiceManager<typeof services>();`,
|
|
132
|
+
},
|
|
133
|
+
[testsFolderName]: {
|
|
134
|
+
"deployment.test.ts": `
|
|
135
|
+
import assert from "node:assert/strict";
|
|
136
|
+
import { resolve } from "node:path";
|
|
137
|
+
import test from "node:test";
|
|
138
|
+
import { createTestDeployment } from "@prostgles/prostgles/testing";
|
|
139
|
+
import type { DBGeneratedSchema } from "../generated/DBGeneratedSchema";
|
|
140
|
+
|
|
141
|
+
void test("starts the configured app with an isolated database", async (context) => {
|
|
142
|
+
const deployment = await createTestDeployment<DBGeneratedSchema>({
|
|
143
|
+
configPath: resolve(__dirname, "../.."),
|
|
144
|
+
configId: ${JSON.stringify(configId)},
|
|
145
|
+
users: [
|
|
146
|
+
{ key: "admin", type: "admin" },
|
|
147
|
+
{ key: "member", type: "default" },
|
|
148
|
+
],
|
|
149
|
+
// Add deterministic rows with:
|
|
150
|
+
// seed: async ({ projectDatabase }) => {
|
|
151
|
+
// await projectDatabase.query("INSERT INTO ...");
|
|
152
|
+
// },
|
|
153
|
+
});
|
|
154
|
+
context.after(async () => await deployment.dispose());
|
|
155
|
+
|
|
156
|
+
const client = await deployment.connectProjectAs("admin");
|
|
157
|
+
|
|
158
|
+
assert.equal(client.socket.connected, true);
|
|
159
|
+
assert.equal(client.auth.user?.type, "admin");
|
|
160
|
+
assert.ok(client.db);
|
|
161
|
+
|
|
162
|
+
const memberClient = await deployment.connectProjectAs("member");
|
|
163
|
+
assert.equal(memberClient.socket.connected, true);
|
|
164
|
+
assert.equal(memberClient.auth.user?.type, "default");
|
|
165
|
+
});`,
|
|
166
|
+
},
|
|
167
|
+
"eslint.config.mjs": eslintConfig,
|
|
168
|
+
".gitignore": `
|
|
169
|
+
node_modules/
|
|
170
|
+
build/
|
|
171
|
+
.env
|
|
172
|
+
.prostgles/test-logs/
|
|
173
|
+
*.log`,
|
|
174
|
+
".env.example": `
|
|
175
|
+
# Fixed admin credentials for CLI development.
|
|
176
|
+
PRGL_USERNAME=admin
|
|
177
|
+
PRGL_PASSWORD=${(0, crypto_1.randomBytes)(24).toString("base64url")}
|
|
178
|
+
|
|
179
|
+
# Prostgles UI state. Created automatically when missing.
|
|
180
|
+
PROSTGLES_STATE_DATABASE_URL=postgres://user:password@localhost:5432/prostgles_state_database
|
|
181
|
+
|
|
182
|
+
# Database exposed by this config. Must use the same server as the state database.
|
|
183
|
+
PROSTGLES_DATABASE_URL=postgres://user:password@localhost:5432/${configId}
|
|
184
|
+
|
|
185
|
+
# npm test starts an ephemeral PostgreSQL Docker container bound to 127.0.0.1 only.
|
|
186
|
+
# Override only when the app needs a different PostgreSQL/PostGIS version.
|
|
187
|
+
# PROSTGLES_TEST_POSTGRES_IMAGE=postgis/postgis:17-3.4`,
|
|
188
|
+
});
|
|
189
|
+
const getPackageJson = (configId) => ({
|
|
190
|
+
name: configId,
|
|
191
|
+
private: true,
|
|
192
|
+
version: "0.0.0",
|
|
193
|
+
main: "build/src/index.js",
|
|
194
|
+
scripts: {
|
|
195
|
+
build: "npm run lint && tsc --project tsconfig.json",
|
|
196
|
+
dev: "prostgles dev --config .",
|
|
197
|
+
lint: "eslint .",
|
|
198
|
+
"lint:fix": "eslint . --fix",
|
|
199
|
+
start: "prostgles start --config .",
|
|
200
|
+
test: 'npm run build && node --env-file-if-exists=.env --test "build/tests/**/*.test.js"',
|
|
201
|
+
},
|
|
202
|
+
dependencies: { [package_json_1.default.name]: `^${package_json_1.default.version}` },
|
|
203
|
+
devDependencies: {
|
|
204
|
+
...(0, prostgles_types_1.pickKeys)(package_json_1.default.dependencies, ["typescript"]),
|
|
205
|
+
...(0, prostgles_types_1.pickKeys)(package_json_1.default.devDependencies, [
|
|
206
|
+
"@eslint/js",
|
|
207
|
+
"eslint",
|
|
208
|
+
"eslint-plugin-security",
|
|
209
|
+
"typescript-eslint",
|
|
210
|
+
"@types/node",
|
|
211
|
+
]),
|
|
212
|
+
},
|
|
213
|
+
exports: {
|
|
214
|
+
"./generated": {
|
|
215
|
+
types: "./build/generated/index.d.ts",
|
|
216
|
+
default: "./build/generated/index.js",
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
});
|
|
220
|
+
const eslintConfig = `
|
|
221
|
+
import eslint from "@eslint/js";
|
|
222
|
+
import pluginSecurity from "eslint-plugin-security";
|
|
223
|
+
import path from "node:path";
|
|
224
|
+
import tseslint from "typescript-eslint";
|
|
225
|
+
import { defineConfig } from "eslint/config";
|
|
226
|
+
|
|
227
|
+
const semanticFilenameRule = {
|
|
228
|
+
meta: {
|
|
229
|
+
type: "problem",
|
|
230
|
+
schema: [{ type: "string" }],
|
|
231
|
+
messages: {
|
|
232
|
+
invalidSuffix: "Files in this folder must end in '{{suffix}}'.",
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
create(context) {
|
|
236
|
+
const suffix = context.options[0];
|
|
237
|
+
return {
|
|
238
|
+
Program(node) {
|
|
239
|
+
if (!path.basename(context.filename).endsWith(suffix)) {
|
|
240
|
+
context.report({
|
|
241
|
+
node,
|
|
242
|
+
messageId: "invalidSuffix",
|
|
243
|
+
data: { suffix },
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
};
|
|
248
|
+
},
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
const semanticFileConfig = (folder, suffix) => ({
|
|
252
|
+
files: [\`${exports.srcFolderName}/\${folder}/**/*.ts\`],
|
|
253
|
+
rules: {
|
|
254
|
+
"prostgles-config/semantic-filename": ["error", suffix],
|
|
255
|
+
},
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
export default defineConfig(
|
|
259
|
+
{
|
|
260
|
+
ignores: [
|
|
261
|
+
"build",
|
|
262
|
+
"${exports.generatedFolderName}",
|
|
263
|
+
"node_modules",
|
|
264
|
+
"eslint.config.mjs",
|
|
265
|
+
"src/${servicesFolderName}/*/src",
|
|
266
|
+
],
|
|
267
|
+
},
|
|
268
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
269
|
+
pluginSecurity.configs.recommended,
|
|
270
|
+
eslint.configs.recommended,
|
|
271
|
+
tseslint.configs.recommendedTypeChecked,
|
|
272
|
+
{
|
|
273
|
+
files: ["${exports.srcFolderName}/**/*.ts", "${testsFolderName}/**/*.ts"],
|
|
274
|
+
languageOptions: {
|
|
275
|
+
parserOptions: {
|
|
276
|
+
projectService: true,
|
|
277
|
+
tsconfigRootDir: import.meta.dirname,
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
plugins: {
|
|
281
|
+
"prostgles-config": {
|
|
282
|
+
rules: { "semantic-filename": semanticFilenameRule },
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
rules: {
|
|
286
|
+
"no-cond-assign": "error",
|
|
287
|
+
"no-unused-vars": "off",
|
|
288
|
+
"security/detect-object-injection": "off",
|
|
289
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
290
|
+
"@typescript-eslint/no-floating-promises": "error",
|
|
291
|
+
"@typescript-eslint/no-unnecessary-condition": "error",
|
|
292
|
+
"@typescript-eslint/no-unused-vars": [
|
|
293
|
+
"error",
|
|
294
|
+
{
|
|
295
|
+
argsIgnorePattern: "^_",
|
|
296
|
+
varsIgnorePattern: "^_",
|
|
297
|
+
caughtErrorsIgnorePattern: "^_",
|
|
298
|
+
},
|
|
299
|
+
],
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
${exports.srcSubfolderNames
|
|
303
|
+
.filter((f) => f !== "services")
|
|
304
|
+
.map((folderName) => `semanticFileConfig("${folderName}", ".${folderName.slice(0, -1)}.ts")`)
|
|
305
|
+
.join(",\n ")}
|
|
306
|
+
);`;
|
|
307
|
+
/**
|
|
308
|
+
* This exhaustive map keeps the generated guidance in step with SchemaConfig.
|
|
309
|
+
* Adding or removing a config property requires its guidance to be updated too.
|
|
310
|
+
*/
|
|
311
|
+
const schemaConfigGuidance = {
|
|
312
|
+
access_control: "Configure database permissions with `access_control` using the Prostgles `dbPermissions` shape.",
|
|
313
|
+
connection: "Keep non-secret connection presentation settings in `connection`; database URLs belong in `.env`.",
|
|
314
|
+
databaseConfig: "Use `databaseConfig` for host-managed database features such as file storage and REST access.",
|
|
315
|
+
functions: "Put privileged operations, cross-table workflows, and server-only business logic in top-level `functions`.",
|
|
316
|
+
id: "Keep `id` stable because it identifies the deployed configuration.",
|
|
317
|
+
joins: "Use `joins` only for relationships that cannot be inferred from foreign keys.",
|
|
318
|
+
onInitSQL: "Use `onInitSQL` only for SQL initialization that cannot be expressed by `tableConfig`.",
|
|
319
|
+
onMount: "Use `onMount` for startup integration work and return cleanup logic when resources are opened.",
|
|
320
|
+
services: "Register Docker-backed runtimes with `services` so Prostgles can expose and control them.",
|
|
321
|
+
tableConfig: "Define tables and columns in `tableConfig`, including constraints and indexes.",
|
|
322
|
+
tableConfigMigrations: "For schema changes that transform existing data, increment `tableConfigMigrations.version` and use `onMigrate`.",
|
|
323
|
+
tableHooks: "Define `tableHooks` as a separate top-level config property.",
|
|
324
|
+
watchSchemaType: "Set `watchSchemaType` only when schema watching must differ from the default.",
|
|
325
|
+
workspaces: "Define typed `workspaces` as useful default dashboards that bring related data together.",
|
|
326
|
+
};
|
|
327
|
+
const connectionGuidance = {
|
|
328
|
+
db_schema_filter: "Use `connection.db_schema_filter` only for connection-level schema visibility.",
|
|
329
|
+
display_options: "Use `connection.display_options` for connection-wide display behavior.",
|
|
330
|
+
table_options: "Populate `connection.table_options` for every user-facing table so data renders clearly. Add useful labels and icons, column renderers and styles, and a practical `card` layout with header, subheader, avatar, and visible columns where appropriate.",
|
|
331
|
+
};
|
|
332
|
+
const getCliAgentsFile = () => `
|
|
333
|
+
# Prostgles configuration
|
|
334
|
+
|
|
335
|
+
Build the application around the typed Prostgles schema config.
|
|
336
|
+
|
|
337
|
+
## Config structure
|
|
338
|
+
|
|
339
|
+
- Import \`DBGeneratedSchema\` from \`generated/DBGeneratedSchema\`, create the typed config helper with \`const prostgles = defineConfig<DBGeneratedSchema>()\`, and default-export \`prostgles({ ... })\`. Keep the helper name \`prostgles\` so function return types can be discovered during schema generation.
|
|
340
|
+
- Run \`npm run dev\` after schema or function changes. It rebuilds the config and refreshes \`generated/DBGeneratedSchema.ts\`, including \`GeneratedFunctionSchema\` for clients.
|
|
341
|
+
- ${schemaConfigGuidance.id}
|
|
342
|
+
- ${schemaConfigGuidance.connection} ${connectionGuidance.db_schema_filter} ${connectionGuidance.display_options}
|
|
343
|
+
- ${schemaConfigGuidance.databaseConfig}
|
|
344
|
+
- ${schemaConfigGuidance.access_control}
|
|
345
|
+
- ${schemaConfigGuidance.watchSchemaType}
|
|
346
|
+
- ${schemaConfigGuidance.onInitSQL} ${schemaConfigGuidance.onMount}
|
|
347
|
+
|
|
348
|
+
## Services
|
|
349
|
+
|
|
350
|
+
- If a server function needs a non-Node.js runtime or system dependencies, implement that work as a service instead of running it directly in the function.
|
|
351
|
+
- Define services under \`src/services/<serviceName>/\`, with the typed \`*.service.ts\` definition beside a \`src/\` Docker build context. Declare a health check and typed endpoints for every operation the app calls.
|
|
352
|
+
- Register each service in \`src/serviceManager.ts\` and expose its config through the top-level \`services\` property. Service names must not collide with built-in Prostgles services or another app service.
|
|
353
|
+
- Import the exported \`serviceManager\` in server functions and use \`getServiceWithRetries(serviceName)\` before calling an endpoint. This is the host-owned instance shown in the Prostgles Services UI; do not construct another \`ServiceManager\`.
|
|
354
|
+
|
|
355
|
+
## Typed database object
|
|
356
|
+
|
|
357
|
+
- The Prostgles \`dbo\` object available in \`onMount\`, \`tableHooks\`, and server functions is \`DBOFullyTyped<DBGeneratedSchema>\`. Table names, columns, filters, selects, inserts, updates, and results are fully typed.
|
|
358
|
+
- Keep the schema generic connected when moving code into separate modules. Use \`ProstglesOnMount<DBGeneratedSchema>\` for \`onMount\`, \`TableHooks<DBGeneratedSchema>\` for hooks, and the typed function definers for functions.
|
|
359
|
+
- Prefer typed \`dbo\` table handlers and let TypeScript infer values. Casts should be very rare; before adding one, check the table definition, JSONB schema, generated schema, and helper generic.
|
|
360
|
+
- Every table and view handler supports realtime \`subscribe\` and \`subscribeOne\`, for example \`dbo.orders.subscribe(filter, params, onData)\`. Prefer subscriptions over polling the database. Keep the returned subscription handler and call \`unsubscribe()\` during cleanup; an \`onMount\` callback can return that cleanup function.
|
|
361
|
+
|
|
362
|
+
## Project structure
|
|
363
|
+
|
|
364
|
+
- Keep \`src/index.ts\` focused on composing and exporting the config.
|
|
365
|
+
- Put server functions in \`src/functions/\`, table definitions in \`src/tableConfigs/\`, display metadata in \`src/tableOptions/\`, and hooks in \`src/tableHooks/\`. Add domain subfolders when a folder becomes crowded.
|
|
366
|
+
- Use semantic names ending in \`*.function.ts\`, \`*.tableConfig.ts\`, \`*.tableOptions.ts\`, and \`*.tableHooks.ts\`. Examples: \`deployProject.function.ts\`, \`orders.tableConfig.ts\`, \`customers.tableOptions.ts\`, and \`users.tableHooks.ts\`.
|
|
367
|
+
- The generated ESLint config enforces these suffixes inside their corresponding folders. Run \`npm run lint\` before committing.
|
|
368
|
+
|
|
369
|
+
## Tests
|
|
370
|
+
|
|
371
|
+
- Run \`npm test\` before committing. Tests use \`@prostgles/prostgles/testing\` to start the real app against fresh state and project databases without opening the UI.
|
|
372
|
+
- Keep deployment tests in \`tests/\`. Each call to \`createTestDeployment\` starts a disposable PostgreSQL Docker container bound only to \`127.0.0.1\`, creates fresh state and project databases, and removes the container during cleanup.
|
|
373
|
+
- Deployment stdout and stderr remain available after cleanup in \`.prostgles/test-logs/\`. The exact file is returned as \`deployment.logPath\`.
|
|
374
|
+
- Test logs may be large. Inspect them with \`tail\` or search them with \`rg\`; do not read an entire log unless its size is known to be small.
|
|
375
|
+
- If the deployment fixture blocks a valid scenario, inspect \`deployment.logPath\` and report the issue against \`@prostgles/prostgles\`; do not weaken the app or its assertions to work around the fixture.
|
|
376
|
+
- Add test users through the fixture's \`users\` option and connect with \`connectProjectAs(userKey)\`. Sessions are seeded directly, so deployment tests do not need to exercise the login UI.
|
|
377
|
+
- Add deterministic database state with the fixture's \`seed\` callback. Never use development or production database URLs for test setup.
|
|
378
|
+
|
|
379
|
+
## Tables, display options, and hooks
|
|
380
|
+
|
|
381
|
+
- ${schemaConfigGuidance.tableConfig} ${schemaConfigGuidance.tableConfigMigrations}
|
|
382
|
+
- ${schemaConfigGuidance.tableHooks} Use hooks such as \`beforeEach\`, \`afterEach\`, and \`afterAll\` for application behavior instead of PostgreSQL triggers as this allows interaction with typescript and provides full type safety.
|
|
383
|
+
- ${connectionGuidance.table_options} Keep each table's options in its matching \`*.tableOptions.ts\` module and merge them under \`connection.table_options\`.
|
|
384
|
+
- Give every JSONB column a \`jsonbSchema\` or \`jsonbSchemaType\` so its contents are validated and typed.
|
|
385
|
+
- Follow PostgreSQL schema best practices: use primary and foreign keys, appropriate nullability, unique constraints, and indexes. Model fixed sets of values as lookup tables with \`isLookupTable\` and references instead of \`CHECK (value IN (...))\` constraints.
|
|
386
|
+
- ${schemaConfigGuidance.joins}
|
|
387
|
+
|
|
388
|
+
## Workspaces
|
|
389
|
+
|
|
390
|
+
- ${schemaConfigGuidance.workspaces} Include tables and, where useful, aggregate SQL results, bar charts, time charts, maps, and summary statistics.
|
|
391
|
+
- Keep window IDs stable and ensure every layout item references the matching window ID.
|
|
392
|
+
|
|
393
|
+
## File storage
|
|
394
|
+
|
|
395
|
+
- Enable managed file storage with \`databaseConfig.file_table_config\`. For local storage, use \`{ fileTable: "files", storageType: { type: "local" } }\`. Prostgles creates and manages the file table and serves its files.
|
|
396
|
+
- For S3 storage, use \`storageType: { type: "S3", credential_id }\`; configure the credential in Prostgles and never put access keys in this repository.
|
|
397
|
+
- Reference \`files.id\` from application tables with foreign keys rather than storing file URLs. Referencing tables must have a primary key. Use \`referencedTables\` when file type or size restrictions are required.
|
|
398
|
+
- Use \`delayedDelete\` when files should remain recoverable for a retention period. Enable \`extractText\` and provide an \`annotationsTable\` only when document extraction or annotations are needed.
|
|
399
|
+
- Local file data lives outside PostgreSQL. Use persistent storage and include it in deployment backups.
|
|
400
|
+
|
|
401
|
+
## Server-side functions
|
|
402
|
+
|
|
403
|
+
- ${schemaConfigGuidance.functions}
|
|
404
|
+
- Organize \`functions\` into groups shaped as \`{ userFilter, functions }\`. The group filter controls which authenticated users receive those functions.
|
|
405
|
+
- Create a schema-aware group helper with \`createFunctionGroupDefiner<DBGeneratedSchema>()\`. For function maps kept in separate modules, use \`createFunctionsDefiner<DBGeneratedSchema>()\` so names, database context, inputs, and return types remain inferred across imports.
|
|
406
|
+
- Define individual functions with \`defineFunction({ input, description, run })\`. Inputs use Prostgles JSONB field definitions and are validated before \`run\` executes.
|
|
407
|
+
- Functions have restricted database access by default. Set \`unrestrictedDbAccess: true\` only when the function needs raw SQL, transactions, or client DB-handler generation.
|
|
408
|
+
- Keep secrets on the server and use database transactions for multi-step writes.`;
|
|
409
|
+
//# sourceMappingURL=cliTemplateFiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cliTemplateFiles.js","sourceRoot":"","sources":["../../../../src/cli/cliTemplateFiles.ts"],"names":[],"mappings":";;;;AAAA,yCAA0C;AAC1C,mCAAqC;AAErC,8EAA6C;AAC7C,qDAAwD;AACxD,+BAAqC;AACrC,2BAA8C;AAEvC,MAAM,oBAAoB,GAAG,CAAC,EACnC,QAAQ,EACR,UAAU,GAIX,EAAE,EAAE;IACH,eAAe,CAAC,UAAU,EAAE,mBAAmB,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;AACjE,CAAC,CAAC;AARW,QAAA,oBAAoB,wBAQ/B;AAEW,QAAA,aAAa,GAAG,KAAK,CAAC;AACtB,QAAA,mBAAmB,GAAG,WAAW,CAAC;AAC/C,MAAM,eAAe,GAAG,OAAO,CAAC;AAEhC,MAAM,kBAAkB,GAAG,UAAU,CAAC;AACzB,QAAA,iBAAiB,GAAG;IAC/B,WAAW;IACX,cAAc;IACd,cAAc;IACd,YAAY;IACZ,kBAAkB;CACV,CAAC;AAMX,MAAM,eAAe,GAAG,CAAC,UAAkB,EAAE,WAAwB,EAAE,EAAE;IACvE,KAAK,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,IAAI,M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IAC1F,OAAO,EACL,gGAAgG;IAClG,QAAQ,EACN,2FAA2F;IAC7F,WAAW,EACT,gFAAgF;IAClF,qBAAqB,EACnB,iHAAiH;IACnH,UAAU,EAAE,8DAA8D;IAC1E,eAAe,EACb,+EAA+E;IACjF,UAAU,EACR,0FAA0F;CAC9D,CAAC;AAEjC,MAAM,kBAAkB,GAAG;IACzB,gBAAgB,EACd,gFAAgF;IAClF,eAAe,EACb,wEAAwE;IAC1E,aAAa,EACX,yPAAyP;CAC/N,CAAC;AAE/B,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC;;;;;;;;;MASzB,oBAAoB,CAAC,EAAE;MACvB,oBAAoB,CAAC,UAAU,IAAI,kBAAkB,CAAC,gBAAgB,IAAI,kBAAkB,CAAC,eAAe;MAC5G,oBAAoB,CAAC,cAAc;MACnC,oBAAoB,CAAC,cAAc;MACnC,oBAAoB,CAAC,eAAe;MACpC,oBAAoB,CAAC,SAAS,IAAI,oBAAoB,CAAC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAmC9D,oBAAoB,CAAC,WAAW,IAAI,oBAAoB,CAAC,qBAAqB;MAC9E,oBAAoB,CAAC,UAAU;MAC/B,kBAAkB,CAAC,aAAa;;;MAGhC,oBAAoB,CAAC,KAAK;;;;MAI1B,oBAAoB,CAAC,UAAU;;;;;;;;;;;;;MAa/B,oBAAoB,CAAC,SAAS;;;;;oFAKgD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCliAgentsFile.d.ts","sourceRoot":"","sources":["../../../../src/cli/getCliAgentsFile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getCliAgentsFile.d.ts","sourceRoot":"","sources":["../../../../src/cli/getCliAgentsFile.ts"],"names":[],"mappings":"AAqDA,eAAO,MAAM,gBAAgB,cA6E0D,CAAC"}
|
|
@@ -15,6 +15,7 @@ const schemaConfigGuidance = {
|
|
|
15
15
|
joins: "Use `joins` only for relationships that cannot be inferred from foreign keys.",
|
|
16
16
|
onInitSQL: "Use `onInitSQL` only for SQL initialization that cannot be expressed by `tableConfig`.",
|
|
17
17
|
onMount: "Use `onMount` for startup integration work and return cleanup logic when resources are opened.",
|
|
18
|
+
services: "Register Docker-backed runtimes with `services` so Prostgles can expose and control them.",
|
|
18
19
|
tableConfig: "Define tables and columns in `tableConfig`, including constraints and indexes.",
|
|
19
20
|
tableConfigMigrations: "For schema changes that transform existing data, increment `tableConfigMigrations.version` and use `onMigrate`.",
|
|
20
21
|
tableHooks: "Define `tableHooks` as a separate top-level config property.",
|
|
@@ -42,6 +43,13 @@ const getCliAgentsFile = () => (0, utils_1.fixIndent)(`
|
|
|
42
43
|
- ${schemaConfigGuidance.watchSchemaType}
|
|
43
44
|
- ${schemaConfigGuidance.onInitSQL} ${schemaConfigGuidance.onMount}
|
|
44
45
|
|
|
46
|
+
## Services
|
|
47
|
+
|
|
48
|
+
- If a server function needs a non-Node.js runtime or system dependencies, implement that work as a service instead of running it directly in the function.
|
|
49
|
+
- Define services under \`src/services/<serviceName>/\`, with the typed \`*.service.ts\` definition beside a \`src/\` Docker build context. Declare a health check and typed endpoints for every operation the app calls.
|
|
50
|
+
- Register each service in \`src/serviceManager.ts\` and expose its config through the top-level \`services\` property. Service names must not collide with built-in Prostgles services or another app service.
|
|
51
|
+
- Import the exported \`serviceManager\` in server functions and use \`getServiceWithRetries(serviceName)\` before calling an endpoint. This is the host-owned instance shown in the Prostgles Services UI; do not construct another \`ServiceManager\`.
|
|
52
|
+
|
|
45
53
|
## Typed database object
|
|
46
54
|
|
|
47
55
|
- The Prostgles \`dbo\` object available in \`onMount\`, \`tableHooks\`, and server functions is \`DBOFullyTyped<DBGeneratedSchema>\`. Table names, columns, filters, selects, inserts, updates, and results are fully typed.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCliAgentsFile.js","sourceRoot":"","sources":["../../../../src/cli/getCliAgentsFile.ts"],"names":[],"mappings":";;;AAAA,yCAA0C;AAW1C;;;GAGG;AACH,MAAM,oBAAoB,GAAG;IAC3B,cAAc,EACZ,iGAAiG;IACnG,UAAU,EACR,mGAAmG;IACrG,cAAc,EACZ,+FAA+F;IACjG,SAAS,EACP,4GAA4G;IAC9G,EAAE,EAAE,oEAAoE;IACxE,KAAK,EACH,+EAA+E;IACjF,SAAS,EACP,wFAAwF;IAC1F,OAAO,EACL,gGAAgG;IAClG,WAAW,EACT,gFAAgF;IAClF,qBAAqB,EACnB,iHAAiH;IACnH,UAAU,EAAE,8DAA8D;IAC1E,eAAe,EACb,+EAA+E;IACjF,UAAU,EACR,0FAA0F;CAC9D,CAAC;AAEjC,MAAM,kBAAkB,GAAG;IACzB,gBAAgB,EACd,gFAAgF;IAClF,eAAe,EACb,wEAAwE;IAC1E,aAAa,EACX,yPAAyP;CAC/N,CAAC;AAExB,MAAM,gBAAgB,GAAG,GAAG,EAAE,CACnC,IAAA,iBAAS,EAAC;;;;;;;;;QASJ,oBAAoB,CAAC,EAAE;QACvB,oBAAoB,CAAC,UAAU,IAAI,kBAAkB,CAAC,gBAAgB,IAAI,kBAAkB,CAAC,eAAe;QAC5G,oBAAoB,CAAC,cAAc;QACnC,oBAAoB,CAAC,cAAc;QACnC,oBAAoB,CAAC,eAAe;QACpC,oBAAoB,CAAC,SAAS,IAAI,oBAAoB,CAAC,OAAO
|
|
1
|
+
{"version":3,"file":"getCliAgentsFile.js","sourceRoot":"","sources":["../../../../src/cli/getCliAgentsFile.ts"],"names":[],"mappings":";;;AAAA,yCAA0C;AAW1C;;;GAGG;AACH,MAAM,oBAAoB,GAAG;IAC3B,cAAc,EACZ,iGAAiG;IACnG,UAAU,EACR,mGAAmG;IACrG,cAAc,EACZ,+FAA+F;IACjG,SAAS,EACP,4GAA4G;IAC9G,EAAE,EAAE,oEAAoE;IACxE,KAAK,EACH,+EAA+E;IACjF,SAAS,EACP,wFAAwF;IAC1F,OAAO,EACL,gGAAgG;IAClG,QAAQ,EACN,2FAA2F;IAC7F,WAAW,EACT,gFAAgF;IAClF,qBAAqB,EACnB,iHAAiH;IACnH,UAAU,EAAE,8DAA8D;IAC1E,eAAe,EACb,+EAA+E;IACjF,UAAU,EACR,0FAA0F;CAC9D,CAAC;AAEjC,MAAM,kBAAkB,GAAG;IACzB,gBAAgB,EACd,gFAAgF;IAClF,eAAe,EACb,wEAAwE;IAC1E,aAAa,EACX,yPAAyP;CAC/N,CAAC;AAExB,MAAM,gBAAgB,GAAG,GAAG,EAAE,CACnC,IAAA,iBAAS,EAAC;;;;;;;;;QASJ,oBAAoB,CAAC,EAAE;QACvB,oBAAoB,CAAC,UAAU,IAAI,kBAAkB,CAAC,gBAAgB,IAAI,kBAAkB,CAAC,eAAe;QAC5G,oBAAoB,CAAC,cAAc;QACnC,oBAAoB,CAAC,cAAc;QACnC,oBAAoB,CAAC,eAAe;QACpC,oBAAoB,CAAC,SAAS,IAAI,oBAAoB,CAAC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAmC9D,oBAAoB,CAAC,WAAW,IAAI,oBAAoB,CAAC,qBAAqB;QAC9E,oBAAoB,CAAC,UAAU;QAC/B,kBAAkB,CAAC,aAAa;;;QAGhC,oBAAoB,CAAC,KAAK;;;;QAI1B,oBAAoB,CAAC,UAAU;;;;;;;;;;;;;QAa/B,oBAAoB,CAAC,SAAS;;;;;sFAKgD,CAAC,CAAC;AA7E3E,QAAA,gBAAgB,oBA6E2D"}
|
|
@@ -5,7 +5,8 @@ import type { DBSConnectionInfo } from "../electronConfig";
|
|
|
5
5
|
import type e from "express";
|
|
6
6
|
import type { OnReadyCallback } from "prostgles-server/dist/initProstgles";
|
|
7
7
|
import BackupManager from "../BackupManager/BackupManager";
|
|
8
|
+
import { prostglesServices, type ServiceRegistry } from "../ServiceManager/ServiceManagerTypes";
|
|
8
9
|
export declare const getBackupManager: () => BackupManager;
|
|
9
|
-
export declare const getServiceManager: () => ServiceManager
|
|
10
|
+
export declare const getServiceManager: <AdditionalServices extends ServiceRegistry = Record<never, never>>() => ServiceManager<typeof prostglesServices & AdditionalServices>;
|
|
10
11
|
export declare const prostglesOnReady: (params: Parameters<OnReadyCallback<DBGeneratedSchema, SUser>>[0], update: Parameters<OnReadyCallback<DBGeneratedSchema, SUser>>[1], app: e.Express, con: DBSConnectionInfo, port: number) => Promise<void>;
|
|
11
12
|
//# sourceMappingURL=prostglesOnReady.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prostglesOnReady.d.ts","sourceRoot":"","sources":["../../../../src/init/prostglesOnReady.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAInE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,aAAa,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"prostglesOnReady.d.ts","sourceRoot":"","sources":["../../../../src/init/prostglesOnReady.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAInE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,aAAa,MAAM,gCAAgC,CAAC;AAgB3D,OAAO,EACL,iBAAiB,EACjB,KAAK,eAAe,EACrB,MAAM,yCAAyC,CAAC;AAMjD,eAAO,MAAM,gBAAgB,qBAK5B,CAAC;AAIF,eAAO,MAAM,iBAAiB,GAC5B,kBAAkB,SAAS,eAAe,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,OAOxC,cAAc,CACrC,OAAO,iBAAiB,GAAG,kBAAkB,CAEhD,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,UAAU,CAAC,eAAe,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAChE,QAAQ,UAAU,CAAC,eAAe,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAChE,KAAK,CAAC,CAAC,OAAO,EACd,KAAK,iBAAiB,EACtB,MAAM,MAAM,kBAiGb,CAAC"}
|
|
@@ -17,6 +17,8 @@ const setupLLM_1 = require("../serverFunctions/askLLM/setupLLM");
|
|
|
17
17
|
const initUsers_1 = require("./initUsers");
|
|
18
18
|
const insertStateDatabase_1 = require("./insertStateDatabase");
|
|
19
19
|
const tryStartProstgles_1 = require("./tryStartProstgles");
|
|
20
|
+
const ServiceManagerTypes_1 = require("../ServiceManager/ServiceManagerTypes");
|
|
21
|
+
const path_1 = require("path");
|
|
20
22
|
let authSetupDataListener;
|
|
21
23
|
let backupManager;
|
|
22
24
|
const getBackupManager = () => {
|
|
@@ -29,7 +31,7 @@ exports.getBackupManager = getBackupManager;
|
|
|
29
31
|
let serviceManager = undefined;
|
|
30
32
|
const getServiceManager = () => {
|
|
31
33
|
if (!serviceManager) {
|
|
32
|
-
throw new Error("ServiceManager not
|
|
34
|
+
throw new Error("ServiceManager is not available before Prostgles startup.");
|
|
33
35
|
}
|
|
34
36
|
return serviceManager;
|
|
35
37
|
};
|
|
@@ -48,8 +50,21 @@ const prostglesOnReady = async (params, update, app, con, port) => {
|
|
|
48
50
|
await (0, startMcpHub_1.setupMCPServerHub)(db);
|
|
49
51
|
await index_1.connectionManager.destroy();
|
|
50
52
|
await index_1.connectionManager.init(db, _db);
|
|
51
|
-
|
|
52
|
-
serviceManager ??=
|
|
53
|
+
const isNewServiceManager = !serviceManager;
|
|
54
|
+
serviceManager ??= await ServiceManager_1.ServiceManager.create({
|
|
55
|
+
services: ServiceManagerTypes_1.prostglesServices,
|
|
56
|
+
serviceRoot: (0, path_1.resolve)(__dirname, "../../../../src/ServiceManager/services"),
|
|
57
|
+
}, db);
|
|
58
|
+
const startupSchemaConfig = (0, applyStartupSchemaConfig_1.getStartupSchemaConfig)();
|
|
59
|
+
if (isNewServiceManager &&
|
|
60
|
+
startupSchemaConfig?.schemaConfig.services) {
|
|
61
|
+
await serviceManager.addServices(startupSchemaConfig.schemaConfig.services);
|
|
62
|
+
}
|
|
63
|
+
await (0, applyStartupSchemaConfig_1.applyStartupSchemaConfig)({
|
|
64
|
+
dbs: db,
|
|
65
|
+
db: _db,
|
|
66
|
+
startupSchemaConfig,
|
|
67
|
+
});
|
|
53
68
|
backupManager ??= await BackupManager_1.default.create(_db, db, sql, index_1.connectionManager);
|
|
54
69
|
const newAuthSetupDataListener = (0, subscribeToAuthSetupChanges_1.subscribeToAuthSetupChanges)(db, async (authData) => {
|
|
55
70
|
const { stateDatabaseConfig } = authData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prostglesOnReady.js","sourceRoot":"","sources":["../../../../src/init/prostglesOnReady.ts"],"names":[],"mappings":";;;;AACA,0FAAiF;AACjF,kFAA+E;AAC/E,iFAAiF;AACjF,uEAAoE;AAGpE,sCAA+C;AAI/C,2FAA2D;AAC3D,
|
|
1
|
+
{"version":3,"file":"prostglesOnReady.js","sourceRoot":"","sources":["../../../../src/init/prostglesOnReady.ts"],"names":[],"mappings":";;;;AACA,0FAAiF;AACjF,kFAA+E;AAC/E,iFAAiF;AACjF,uEAAoE;AAGpE,sCAA+C;AAI/C,2FAA2D;AAC3D,4FAGuD;AACvD,sCAAyC;AACzC,uEAA0E;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C;QACjC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEvB,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3B,MAAM,eAAe,GAAG,QAAQ,CAAC,KAAK,EAAG,CAAC;YAE1C,IAAI,CAAC;gBACH,MAAM,eAAe,EAAE,CAAC;YAC1B,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,CAAC,KAAK,CAAC,wCAAwC,EAAE,CAAC,CAAC,CAAC;YAC7D,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|
|
@@ -4,6 +4,8 @@ import { type SessionUser } from "prostgles-server";
|
|
|
4
4
|
export { defineFunction, createFunctionGroupDefiner, createFunctionsDefiner, } from "prostgles-server";
|
|
5
5
|
import type { ProstglesInitOptions } from "prostgles-server/dist/ProstglesTypes";
|
|
6
6
|
import type { OnReadyParams } from "prostgles-server/dist/initProstgles";
|
|
7
|
+
import type { ServiceManagerConfig } from "./ServiceManager/ServiceManager";
|
|
8
|
+
import type { ServiceRegistry } from "./ServiceManager/ServiceManagerTypes";
|
|
7
9
|
export type { DBGeneratedSchema } from "../../common/DBGeneratedSchema";
|
|
8
10
|
export type * from "../../common/DashboardTypes";
|
|
9
11
|
export type { DBSSchema } from "../../common/publishUtils";
|
|
@@ -34,6 +36,8 @@ export type SchemaConfig<S = void, SUser extends SessionUser = SessionUser> = Sc
|
|
|
34
36
|
publish?: never;
|
|
35
37
|
onInitSQL?: string;
|
|
36
38
|
onMount?: ProstglesOnMount<S>;
|
|
39
|
+
/** Docker-backed services managed by the host Prostgles instance. */
|
|
40
|
+
services?: ServiceManagerConfig<ServiceRegistry>;
|
|
37
41
|
workspaces?: WorkspaceInsertModel[];
|
|
38
42
|
};
|
|
39
43
|
/** Gives a config object contextual types while preserving its exact shape. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemaConfig.d.ts","sourceRoot":"","sources":["../../../src/schemaConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EACL,cAAc,EACd,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"schemaConfig.d.ts","sourceRoot":"","sources":["../../../src/schemaConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EACL,cAAc,EACd,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAE5E,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,mBAAmB,wBAAwB,CAAC;AAC5C,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EA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CAAC,GAAG;IAC3C,4EAA4E;IAC5E,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,+EAA+E;IAC/E,UAAU,CAAC,EAAE,sBAAsB,CAAC;IACpC,cAAc,CAAC,EAAE,oBAAoB,CAAC;IACtC,8EAA8E;IAC9E,cAAc,CAAC,EAAE,yBAAyB,CAAC;IAC3C,gFAAgF;IAChF,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAC9B,qEAAqE;IACrE,QAAQ,CAAC,EAAE,oBAAoB,CAAC,eAAe,CAAC,CAAC;IACjD,UAAU,CAAC,EAAE,oBAAoB,EAAE,CAAC;CACrC,CAAC;AAEF,+EAA+E;AAC/E,eAAO,MAAM,YAAY,GACtB,CAAC,GAAG,IAAI,EAAE,KAAK,SAAS,WAAW,GAAG,WAAW,QACjD,CAAC,SAAS,YAAY,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,QAAQ,CAAC,KAAG,CACvC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemaConfig.js","sourceRoot":"","sources":["../../../src/schemaConfig.ts"],"names":[],"mappings":";;;AAGA,qDAI0B;AAHxB,kHAAA,cAAc,OAAA;AACd,8HAAA,0BAA0B,OAAA;AAC1B,0HAAA,sBAAsB,OAAA;
|
|
1
|
+
{"version":3,"file":"schemaConfig.js","sourceRoot":"","sources":["../../../src/schemaConfig.ts"],"names":[],"mappings":";;;AAGA,qDAI0B;AAHxB,kHAAA,cAAc,OAAA;AACd,8HAAA,0BAA0B,OAAA;AAC1B,0HAAA,sBAAsB,OAAA;AAoFxB,+EAA+E;AACxE,MAAM,YAAY,GACvB,GAAsD,EAAE,CACxD,CAAmC,MAAS,EAAK,EAAE,CACjD,MAAM,CAAC;AAHE,QAAA,YAAY,gBAGd"}
|
package/dist/server/src/serverFunctions/adminServerFunctions/stateServerAdminFunctions.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stateServerAdminFunctions.d.ts","sourceRoot":"","sources":["../../../../../src/serverFunctions/adminServerFunctions/stateServerAdminFunctions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stateServerAdminFunctions.d.ts","sourceRoot":"","sources":["../../../../../src/serverFunctions/adminServerFunctions/stateServerAdminFunctions.ts"],"names":[],"mappings":"AAyCA,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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CAAD;+CAAsB,CAAC;;;;6CAGlB,CAAC;6CACD,CAAN;6CACQ,CAAZ;+CAAsB,CAAC;;4CACX,CAAF;6CAAc,CAAC;6CAEf,CAAL;6CACO,CAAJ;+CACI,CAAT;;;;;;;;;;;;;4BAIQ,CAAC;wCAEJ,CAAF;wCAAuB,CAAC;2CAA0B,CAAC;0CACrC,CAAC;;yCAEf,CAAN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qCAtW+D,CAAC;sCACvC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyczB,CAAC"}
|
|
@@ -17,7 +17,6 @@ const prostglesOnReady_1 = require("../../init/prostglesOnReady");
|
|
|
17
17
|
const startProstgles_1 = require("../../init/startProstgles");
|
|
18
18
|
const getPidStats_1 = require("../../methods/getPidStats");
|
|
19
19
|
const statusMonitorUtils_1 = require("../../methods/statusMonitorUtils");
|
|
20
|
-
const ServiceManagerTypes_1 = require("../../ServiceManager/ServiceManagerTypes");
|
|
21
20
|
const tableConfigDatabaseConfig_1 = require("../../tableConfig/tableConfigDatabaseConfig");
|
|
22
21
|
const upsertConnection_1 = require("../../upsertConnection");
|
|
23
22
|
const fs_1 = require("fs");
|
|
@@ -210,7 +209,7 @@ exports.stateServerAdminFunctions = {
|
|
|
210
209
|
input: { serviceName: "string", enable: "boolean" },
|
|
211
210
|
run: async ({ serviceName, enable }, { dbo: dbs }) => {
|
|
212
211
|
const serviceManager = (0, prostglesOnReady_1.getServiceManager)();
|
|
213
|
-
if (!
|
|
212
|
+
if (!Object.hasOwn(serviceManager.services, serviceName)) {
|
|
214
213
|
throw "Service not found";
|
|
215
214
|
}
|
|
216
215
|
if (enable) {
|