@constructive-io/express-context 0.29.0 → 0.30.0
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/esm/loaders/events.js +7 -5
- package/loaders/events.d.ts +3 -3
- package/loaders/events.js +7 -5
- package/package.json +2 -2
- package/types.d.ts +6 -1
package/esm/loaders/events.js
CHANGED
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
* Events Module Loader
|
|
3
3
|
*
|
|
4
4
|
* Resolves the tenant's app-scoped events module from
|
|
5
|
-
* metaschema_modules_public.events_module: the private schema and the
|
|
6
|
-
* its `record_event`
|
|
7
|
-
* hard-coding the generated schema or function names.
|
|
5
|
+
* metaschema_modules_public.events_module: the private schema and the names of
|
|
6
|
+
* its `record_event` and `record_error` functions, so the server can record
|
|
7
|
+
* events without hard-coding the generated schema or function names.
|
|
8
8
|
*/
|
|
9
9
|
import { createModuleLoader } from './create-loader';
|
|
10
10
|
// ─── SQL ────────────────────────────────────────────────────────────────────
|
|
11
11
|
const EVENTS_MODULE_SQL = `
|
|
12
12
|
SELECT
|
|
13
13
|
s.schema_name AS private_schema_name,
|
|
14
|
-
em.record_event
|
|
14
|
+
em.record_event,
|
|
15
|
+
em.record_error
|
|
15
16
|
FROM metaschema_modules_public.events_module em
|
|
16
17
|
JOIN metaschema_public.schema s ON s.id = em.private_schema_id
|
|
17
18
|
WHERE em.database_id = $1
|
|
@@ -30,7 +31,8 @@ export const eventsLoader = createModuleLoader({
|
|
|
30
31
|
return undefined;
|
|
31
32
|
return {
|
|
32
33
|
privateSchemaName: row.private_schema_name,
|
|
33
|
-
recordEvent: row.record_event
|
|
34
|
+
recordEvent: row.record_event,
|
|
35
|
+
recordError: row.record_error ?? null
|
|
34
36
|
};
|
|
35
37
|
}
|
|
36
38
|
});
|
package/loaders/events.d.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Events Module Loader
|
|
3
3
|
*
|
|
4
4
|
* Resolves the tenant's app-scoped events module from
|
|
5
|
-
* metaschema_modules_public.events_module: the private schema and the
|
|
6
|
-
* its `record_event`
|
|
7
|
-
* hard-coding the generated schema or function names.
|
|
5
|
+
* metaschema_modules_public.events_module: the private schema and the names of
|
|
6
|
+
* its `record_event` and `record_error` functions, so the server can record
|
|
7
|
+
* events without hard-coding the generated schema or function names.
|
|
8
8
|
*/
|
|
9
9
|
import type { EventsConfig } from '../types';
|
|
10
10
|
import type { ModuleLoader } from './types';
|
package/loaders/events.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Events Module Loader
|
|
4
4
|
*
|
|
5
5
|
* Resolves the tenant's app-scoped events module from
|
|
6
|
-
* metaschema_modules_public.events_module: the private schema and the
|
|
7
|
-
* its `record_event`
|
|
8
|
-
* hard-coding the generated schema or function names.
|
|
6
|
+
* metaschema_modules_public.events_module: the private schema and the names of
|
|
7
|
+
* its `record_event` and `record_error` functions, so the server can record
|
|
8
|
+
* events without hard-coding the generated schema or function names.
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.eventsLoader = void 0;
|
|
@@ -14,7 +14,8 @@ const create_loader_1 = require("./create-loader");
|
|
|
14
14
|
const EVENTS_MODULE_SQL = `
|
|
15
15
|
SELECT
|
|
16
16
|
s.schema_name AS private_schema_name,
|
|
17
|
-
em.record_event
|
|
17
|
+
em.record_event,
|
|
18
|
+
em.record_error
|
|
18
19
|
FROM metaschema_modules_public.events_module em
|
|
19
20
|
JOIN metaschema_public.schema s ON s.id = em.private_schema_id
|
|
20
21
|
WHERE em.database_id = $1
|
|
@@ -33,7 +34,8 @@ exports.eventsLoader = (0, create_loader_1.createModuleLoader)({
|
|
|
33
34
|
return undefined;
|
|
34
35
|
return {
|
|
35
36
|
privateSchemaName: row.private_schema_name,
|
|
36
|
-
recordEvent: row.record_event
|
|
37
|
+
recordEvent: row.record_event,
|
|
38
|
+
recordError: row.record_error ?? null
|
|
37
39
|
};
|
|
38
40
|
}
|
|
39
41
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructive-io/express-context",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"description": "Extractable Express middleware for Constructive tenant context — domain resolution, JWT auth, pgSettings, and withPgClient",
|
|
5
5
|
"author": "Constructive <developers@constructive.io>",
|
|
6
6
|
"homepage": "https://github.com/constructive-io/constructive",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"jwt",
|
|
60
60
|
"pgSettings"
|
|
61
61
|
],
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "10d3a11478d17a20c80da5a827f8e8da4facfc80"
|
|
63
63
|
}
|
package/types.d.ts
CHANGED
|
@@ -199,10 +199,15 @@ export interface ComputeModuleConfig {
|
|
|
199
199
|
export interface ComputeConfig {
|
|
200
200
|
modules: ComputeModuleConfig[];
|
|
201
201
|
}
|
|
202
|
-
/**
|
|
202
|
+
/**
|
|
203
|
+
* The tenant's app-scoped events module: where `record_event` and
|
|
204
|
+
* `record_error` live. `recordError` is null on a tenant whose events module
|
|
205
|
+
* predates the function; callers must report that rather than skip silently.
|
|
206
|
+
*/
|
|
203
207
|
export interface EventsConfig {
|
|
204
208
|
privateSchemaName: string;
|
|
205
209
|
recordEvent: string;
|
|
210
|
+
recordError: string | null;
|
|
206
211
|
}
|
|
207
212
|
export interface LlmConfig {
|
|
208
213
|
embeddingProvider: string;
|