@balena/pinejs 19.7.1-build-renovate-postgres-17-x-c90cce5d38c07adff2542c378674dbc07f394cc7-1 → 19.7.1-build-esm-prep-c47a755613fec8293547c7cfb34cc9e707a7c703-1
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/.pinejs-cache.json +1 -1
- package/.versionbot/CHANGELOG.yml +38 -5
- package/CHANGELOG.md +6 -2
- package/docker-compose.npm-test.yml +1 -1
- package/out/bin/utils.d.ts +1 -1
- package/out/bin/utils.js +2 -1
- package/out/bin/utils.js.map +1 -1
- package/out/config-loader/env.d.ts +2 -1
- package/out/config-loader/env.js +38 -3
- package/out/config-loader/env.js.map +1 -1
- package/out/data-server/sbvr-server.d.ts +16 -2
- package/out/data-server/sbvr-server.js.map +1 -1
- package/out/extended-sbvr-parser/extended-sbvr-parser.js +4 -3
- package/out/extended-sbvr-parser/extended-sbvr-parser.js.map +1 -1
- package/out/http-transactions/transactions.js +2 -3
- package/out/http-transactions/transactions.js.map +1 -1
- package/out/migrator/async.js +1 -1
- package/out/migrator/async.js.map +1 -1
- package/out/migrator/sync.d.ts +1 -1
- package/out/migrator/sync.js +2 -1
- package/out/migrator/sync.js.map +1 -1
- package/out/odata-metadata/odata-metadata-generator.d.ts +1 -1
- package/out/odata-metadata/odata-metadata-generator.js +2 -2
- package/out/odata-metadata/odata-metadata-generator.js.map +1 -1
- package/out/passport-pinejs/passport-pinejs.js +3 -3
- package/out/passport-pinejs/passport-pinejs.js.map +1 -1
- package/out/sbvr-api/permissions.d.ts +7 -3
- package/out/sbvr-api/permissions.js +10 -9
- package/out/sbvr-api/permissions.js.map +1 -1
- package/out/sbvr-api/sbvr-utils.d.ts +1 -1
- package/out/sbvr-api/sbvr-utils.js +7 -6
- package/out/sbvr-api/sbvr-utils.js.map +1 -1
- package/out/sbvr-api/uri-parser.js +2 -2
- package/out/sbvr-api/uri-parser.js.map +1 -1
- package/out/server-glue/module.js +4 -4
- package/out/server-glue/module.js.map +1 -1
- package/out/server-glue/sbvr-loader.d.ts +1 -1
- package/out/server-glue/sbvr-loader.js +4 -0
- package/out/server-glue/sbvr-loader.js.map +1 -1
- package/out/tasks/index.js +3 -2
- package/out/tasks/index.js.map +1 -1
- package/package.json +2 -2
- package/src/bin/utils.ts +1 -3
- package/src/config-loader/env.ts +6 -1
- package/src/data-server/sbvr-server.ts +3 -3
- package/src/extended-sbvr-parser/extended-sbvr-parser.ts +4 -3
- package/src/http-transactions/transactions.js +2 -3
- package/src/migrator/async.ts +7 -7
- package/src/migrator/sync.ts +2 -2
- package/src/odata-metadata/odata-metadata-generator.ts +1 -3
- package/src/passport-pinejs/passport-pinejs.ts +3 -6
- package/src/sbvr-api/permissions.ts +6 -6
- package/src/sbvr-api/sbvr-utils.ts +5 -5
- package/src/sbvr-api/uri-parser.ts +1 -1
- package/src/server-glue/module.ts +4 -5
- package/src/server-glue/sbvr-loader.ts +13 -0
- package/src/tasks/index.ts +3 -3
@@ -91,11 +91,11 @@ const init = async (app, config, databaseOptions = envDatabaseOptions) => {
|
|
91
91
|
const promises = [];
|
92
92
|
if (process.env.SBVR_SERVER_ENABLED) {
|
93
93
|
const sbvrServer = await import('../data-server/sbvr-server.js');
|
94
|
-
const transactions =
|
94
|
+
const transactions = await import('../http-transactions/transactions.js');
|
95
95
|
promises.push(cfgLoader.loadConfig(sbvrServer.config));
|
96
|
-
promises.push(cfgLoader
|
97
|
-
.
|
98
|
-
|
96
|
+
promises.push(cfgLoader.loadConfig(transactions.config).then(() => {
|
97
|
+
transactions.addModelHooks('data');
|
98
|
+
}));
|
99
99
|
}
|
100
100
|
if (!process.env.CONFIG_LOADER_DISABLED) {
|
101
101
|
promises.push(cfgLoader.loadApplicationConfig(config));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/server-glue/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yB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,mBAAmB,EAAE,CAAC;YACrC,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,+BAA+B,CAAC,CAAC;YACjE,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,sCAAsC,CAAC,CAAC;YAC1E,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;YACvD,QAAQ,CAAC,IAAI,CACZ,SAAS,CAAC,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;gBACnD,YAAY,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;YACpC,CAAC,CAAC,CACF,CAAC;QACH,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,CAAC;YACzC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,CAAC;QACxD,CAAC;QACD,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAG5B,MAAM,SAAS,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QAEnC,OAAO,SAAS,CAAC;IAClB,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QACnB,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,GAAG,CAAC,CAAC;QAChD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;AACF,CAAC,CAAC;AA3CW,QAAA,IAAI,QA2Cf"}
|
@@ -1 +1 @@
|
|
1
|
-
export
|
1
|
+
export declare function requireSBVR(filePath: string, require: NodeRequire): string;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.requireSBVR = requireSBVR;
|
3
4
|
if (!process.browser) {
|
4
5
|
if (typeof nodeRequire === 'undefined' || nodeRequire == null) {
|
5
6
|
global.nodeRequire = require;
|
@@ -7,4 +8,7 @@ if (!process.browser) {
|
|
7
8
|
const fs = require('fs');
|
8
9
|
nodeRequire.extensions['.sbvr'] = (module, filename) => (module.exports = fs.readFileSync(filename, 'utf8'));
|
9
10
|
}
|
11
|
+
function requireSBVR(filePath, require) {
|
12
|
+
return require('fs').readFileSync(require.resolve(filePath), 'utf8');
|
13
|
+
}
|
10
14
|
//# sourceMappingURL=sbvr-loader.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"sbvr-loader.js","sourceRoot":"","sources":["../../src/server-glue/sbvr-loader.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"sbvr-loader.js","sourceRoot":"","sources":["../../src/server-glue/sbvr-loader.ts"],"names":[],"mappings":";;AA6BA,kCAKC;AAhCD,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IACtB,IAAI,OAAO,WAAW,KAAK,WAAW,IAAI,WAAW,IAAI,IAAI,EAAE,CAAC;QAW/D,MAAM,CAAC,WAAW,GAAG,OAAO,CAAC;IAC9B,CAAC;IAGD,MAAM,EAAE,GAAc,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,MAAkB,EAAE,QAAgB,EAAE,EAAE,CAC1E,CAAC,MAAM,CAAC,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;AACvD,CAAC;AAQD,SAAgB,WAAW,CAAC,QAAgB,EAAE,OAAoB;IACjE,OAAQ,OAAO,CAAC,IAAI,CAAyB,CAAC,YAAY,CACzD,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,EACzB,MAAM,CACN,CAAC;AACH,CAAC"}
|
package/out/tasks/index.js
CHANGED
@@ -42,7 +42,8 @@ const hooks_1 = require("../sbvr-api/hooks");
|
|
42
42
|
const sbvrUtils = __importStar(require("../sbvr-api/sbvr-utils"));
|
43
43
|
const common_1 = require("./common");
|
44
44
|
const worker_1 = require("./worker");
|
45
|
-
const
|
45
|
+
const sbvr_loader_1 = require("../server-glue/sbvr-loader");
|
46
|
+
const modelText = (0, sbvr_loader_1.requireSBVR)('./tasks.sbvr', require);
|
46
47
|
const initSql = `
|
47
48
|
CREATE INDEX IF NOT EXISTS idx_task_poll ON task USING btree (
|
48
49
|
"is executed by-handler",
|
@@ -56,7 +57,7 @@ exports.config = {
|
|
56
57
|
modelName: common_1.apiRoot,
|
57
58
|
apiRoot: common_1.apiRoot,
|
58
59
|
modelText,
|
59
|
-
customServerCode:
|
60
|
+
customServerCode: { setup },
|
60
61
|
initSql,
|
61
62
|
},
|
62
63
|
],
|
package/out/tasks/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tasks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,sBAgFC;AAeD,wCAmBC;AA/JD,wDAA0C;AAC1C,8CAAyD;AACzD,6CAAgD;AAChD,kEAAoD;AAEpD,qCAAwC;AAExC,qCAAkC;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tasks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,sBAgFC;AAeD,wCAmBC;AA/JD,wDAA0C;AAC1C,8CAAyD;AACzD,6CAAgD;AAChD,kEAAoD;AAEpD,qCAAwC;AAExC,qCAAkC;AAIlC,4DAAyD;AAIzD,MAAM,SAAS,GAAG,IAAA,yBAAW,EAAC,cAAc,EAAE,OAAO,CAAC,CAAC;AAGvD,MAAM,OAAO,GAAG;;;;;;CAMf,CAAC;AAQW,QAAA,MAAM,GAAwB;IAC1C,MAAM,EAAE;QACP;YACC,SAAS,EAAE,gBAAO;YAClB,OAAO,EAAP,gBAAO;YACP,SAAS;YACT,gBAAgB,EAAE,EAAE,KAAK,EAAE;YAC3B,OAAO;SACP;KACD;C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,EAEO,EACP,MAAU;IAEV,IAAI,cAAM,IAAI,IAAI,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,cAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,2BAA2B,IAAI,sBAAsB,CAAC,CAAC;IACxE,CAAC;IACD,cAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG;QACvB,IAAI;QACJ,EAAE;QACF,QAAQ,EAAE,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,YAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS;KAC1D,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@balena/pinejs",
|
3
|
-
"version": "19.7.1-build-
|
3
|
+
"version": "19.7.1-build-esm-prep-c47a755613fec8293547c7cfb34cc9e707a7c703-1",
|
4
4
|
"main": "out/server-glue/module",
|
5
5
|
"type": "commonjs",
|
6
6
|
"repository": "git@github.com:balena-io/pinejs.git",
|
@@ -147,6 +147,6 @@
|
|
147
147
|
"recursive": true
|
148
148
|
},
|
149
149
|
"versionist": {
|
150
|
-
"publishedAt": "2024-12-
|
150
|
+
"publishedAt": "2024-12-30T13:46:30.474Z"
|
151
151
|
}
|
152
152
|
}
|
package/src/bin/utils.ts
CHANGED
@@ -10,9 +10,7 @@ import * as fs from 'fs';
|
|
10
10
|
import * as path from 'path';
|
11
11
|
import '../server-glue/sbvr-loader';
|
12
12
|
|
13
|
-
export
|
14
|
-
fs.readFileSync(require.resolve('../../package.json'), 'utf8'),
|
15
|
-
);
|
13
|
+
export { version } from '../config-loader/env';
|
16
14
|
|
17
15
|
export const writeAll = (output: string, outputFile?: string): void => {
|
18
16
|
if (outputFile) {
|
package/src/config-loader/env.ts
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
import * as fs from 'fs';
|
2
|
+
export const { version } = JSON.parse(
|
3
|
+
fs.readFileSync(require.resolve('../../package.json'), 'utf8'),
|
4
|
+
);
|
5
|
+
|
1
6
|
const { PINEJS_DEBUG } = process.env;
|
2
7
|
if (![undefined, '', '0', '1'].includes(PINEJS_DEBUG)) {
|
3
8
|
throw new Error(`Invalid value for PINEJS_DEBUG '${PINEJS_DEBUG}'`);
|
@@ -51,7 +56,7 @@ export const cache = {
|
|
51
56
|
|
52
57
|
import { boolVar, intVar } from '@balena/env-parsing';
|
53
58
|
import memoize from 'memoizee';
|
54
|
-
import memoizeWeak
|
59
|
+
import memoizeWeak from 'memoizee/weak';
|
55
60
|
export const createCache = <T extends (...args: any[]) => any>(
|
56
61
|
cacheName: keyof typeof cache,
|
57
62
|
fn: T,
|
@@ -207,7 +207,7 @@ export const setup: SetupFunction = async (app, sbvrUtils, db) => {
|
|
207
207
|
console.warn(
|
208
208
|
'DEL /cleardb is very destructive and should really be followed by a full restart/reload.',
|
209
209
|
);
|
210
|
-
await sbvrUtils.executeModels(tx,
|
210
|
+
await sbvrUtils.executeModels(tx, config.models);
|
211
211
|
await setupModels(tx);
|
212
212
|
});
|
213
213
|
res.status(200).end();
|
@@ -377,7 +377,7 @@ export const setup: SetupFunction = async (app, sbvrUtils, db) => {
|
|
377
377
|
await db.transaction(setupModels);
|
378
378
|
};
|
379
379
|
|
380
|
-
export const config
|
380
|
+
export const config = {
|
381
381
|
models: [
|
382
382
|
{
|
383
383
|
modelName: 'ui',
|
@@ -409,4 +409,4 @@ ADD COLUMN IF NOT EXISTS "modified at" TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT N
|
|
409
409
|
},
|
410
410
|
},
|
411
411
|
],
|
412
|
-
};
|
412
|
+
} satisfies Config;
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import { SBVRParser } from '@balena/sbvr-parser';
|
2
|
-
|
3
|
-
const Types: string = require('@balena/sbvr-types/Type.sbvr');
|
2
|
+
import { requireSBVR } from '../server-glue/sbvr-loader';
|
4
3
|
import { version as sbvrParserVersion } from '@balena/sbvr-parser/package.json';
|
5
|
-
import { version } from '
|
4
|
+
import { version } from '../config-loader/env';
|
5
|
+
|
6
|
+
const Types = requireSBVR('@balena/sbvr-types/Type.sbvr', require);
|
6
7
|
|
7
8
|
export const ExtendedSBVRParser = SBVRParser._extend({
|
8
9
|
initialize() {
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { odataNameToSqlName } from '@balena/odata-to-abstract-sql';
|
2
|
-
|
3
|
-
|
4
|
-
const transactionModel = require('./transaction.sbvr');
|
2
|
+
import { requireSBVR } from '../server-glue/sbvr-loader';
|
3
|
+
const transactionModel = requireSBVR('./transaction.sbvr', require);
|
5
4
|
|
6
5
|
/** @type {import('../config-loader/config-loader').Config} */
|
7
6
|
export const config = {
|
package/src/migrator/async.ts
CHANGED
@@ -27,13 +27,6 @@ import {
|
|
27
27
|
} from './utils';
|
28
28
|
import { booleanToEnabledString } from '../config-loader/env';
|
29
29
|
|
30
|
-
// log the startup condition of the async migration
|
31
|
-
(sbvrUtils.logger?.migrations?.info ?? console.info)(
|
32
|
-
`Async migration execution is ${booleanToEnabledString(
|
33
|
-
migratorEnv.asyncMigrationIsEnabled,
|
34
|
-
)}`,
|
35
|
-
);
|
36
|
-
|
37
30
|
export const run = async (tx: Tx, model: ApiRootModel): Promise<void> => {
|
38
31
|
const { migrations } = model;
|
39
32
|
if (migrations == null || _.isEmpty(migrations)) {
|
@@ -188,6 +181,13 @@ const $run = async (
|
|
188
181
|
// created. When the transaction fails, the setup async migration entries in the DB will be
|
189
182
|
// rolled back automatically.
|
190
183
|
setupTx.on('end', () => {
|
184
|
+
// log the startup condition of the async migration
|
185
|
+
(sbvrUtils.logger?.migrations?.info ?? console.info)(
|
186
|
+
`Async migration execution is ${booleanToEnabledString(
|
187
|
+
migratorEnv.asyncMigrationIsEnabled,
|
188
|
+
)}`,
|
189
|
+
);
|
190
|
+
|
191
191
|
for (const {
|
192
192
|
key,
|
193
193
|
initMigrationState,
|
package/src/migrator/sync.ts
CHANGED
@@ -15,9 +15,9 @@ import type { Config, Model } from '../config-loader/config-loader';
|
|
15
15
|
|
16
16
|
import _ from 'lodash';
|
17
17
|
import * as sbvrUtils from '../sbvr-api/sbvr-utils';
|
18
|
+
import { requireSBVR } from '../server-glue/sbvr-loader';
|
18
19
|
|
19
|
-
|
20
|
-
const migrationsModel = require('./migrations.sbvr');
|
20
|
+
const migrationsModel = requireSBVR('./migrations.sbvr', require);
|
21
21
|
|
22
22
|
type ApiRootModel = Model & { apiRoot: string };
|
23
23
|
|
@@ -4,9 +4,7 @@ import type {
|
|
4
4
|
} from '@balena/abstract-sql-compiler';
|
5
5
|
|
6
6
|
import sbvrTypes, { type SbvrType } from '@balena/sbvr-types';
|
7
|
-
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
9
|
-
const { version }: { version: string } = require('../../package.json');
|
7
|
+
import { version } from '../config-loader/env';
|
10
8
|
|
11
9
|
const getResourceName = (resourceName: string): string =>
|
12
10
|
resourceName
|
@@ -33,16 +33,13 @@ export const checkPassword: PassportLocal.VerifyFunction = async (
|
|
33
33
|
}
|
34
34
|
};
|
35
35
|
|
36
|
-
const setup: ConfigLoader.SetupFunction = (app: Express.Application) => {
|
36
|
+
const setup: ConfigLoader.SetupFunction = async (app: Express.Application) => {
|
37
37
|
if (!process.browser) {
|
38
|
-
|
39
|
-
const passport: typeof Passport = require('passport');
|
38
|
+
const { default: passport } = await import('passport');
|
40
39
|
app.use(passport.initialize());
|
41
40
|
app.use(passport.session());
|
42
41
|
|
43
|
-
const {
|
44
|
-
Strategy: LocalStrategy, // eslint-disable-next-line @typescript-eslint/no-var-requires
|
45
|
-
}: typeof PassportLocal = require('passport-local');
|
42
|
+
const { Strategy: LocalStrategy } = await import('passport-local');
|
46
43
|
|
47
44
|
passport.serializeUser((user, done) => {
|
48
45
|
done(null, user);
|
@@ -51,13 +51,13 @@ import {
|
|
51
51
|
metadataEndpoints,
|
52
52
|
type ODataRequest,
|
53
53
|
} from './uri-parser';
|
54
|
-
import memoizeWeak
|
54
|
+
import memoizeWeak from 'memoizee/weak';
|
55
55
|
import type { Config } from '../config-loader/config-loader';
|
56
56
|
import type { ODataOptions } from 'pinejs-client-core';
|
57
57
|
import type { Permission } from './user';
|
58
|
+
import { requireSBVR } from '../server-glue/sbvr-loader';
|
58
59
|
|
59
|
-
|
60
|
-
const userModel: string = require('./user.sbvr');
|
60
|
+
const userModel = requireSBVR('./user.sbvr', require);
|
61
61
|
|
62
62
|
const DEFAULT_ACTOR_BIND = '@__ACTOR_ID';
|
63
63
|
const DEFAULT_ACTOR_BIND_REGEX = new RegExp(
|
@@ -1787,7 +1787,7 @@ declare module './sbvr-utils' {
|
|
1787
1787
|
const authModelConfig = {
|
1788
1788
|
apiRoot: 'Auth',
|
1789
1789
|
modelText: userModel,
|
1790
|
-
customServerCode:
|
1790
|
+
customServerCode: { setup },
|
1791
1791
|
migrations: {
|
1792
1792
|
'11.0.0-modified-at': `
|
1793
1793
|
ALTER TABLE "actor"
|
@@ -1826,7 +1826,7 @@ const authModelConfig = {
|
|
1826
1826
|
export const config = {
|
1827
1827
|
models: [authModelConfig],
|
1828
1828
|
} satisfies Config;
|
1829
|
-
export
|
1829
|
+
export function setup() {
|
1830
1830
|
addHook('all', 'all', 'all', {
|
1831
1831
|
sideEffects: false,
|
1832
1832
|
readOnlyTx: true,
|
@@ -1924,4 +1924,4 @@ export const setup = () => {
|
|
1924
1924
|
id: request.values.actor,
|
1925
1925
|
}),
|
1926
1926
|
});
|
1927
|
-
}
|
1927
|
+
}
|
@@ -44,10 +44,10 @@ import { ExtendedSBVRParser } from '../extended-sbvr-parser/extended-sbvr-parser
|
|
44
44
|
import * as asyncMigrator from '../migrator/async';
|
45
45
|
import * as syncMigrator from '../migrator/sync';
|
46
46
|
import { generateODataMetadata } from '../odata-metadata/odata-metadata-generator';
|
47
|
+
import { requireSBVR } from '../server-glue/sbvr-loader';
|
47
48
|
|
48
49
|
import type DevModel from './dev';
|
49
|
-
|
50
|
-
const devModel = require('./dev.sbvr');
|
50
|
+
const devModel = requireSBVR('./dev.sbvr', require);
|
51
51
|
import * as permissions from './permissions';
|
52
52
|
import {
|
53
53
|
BadRequestError,
|
@@ -83,7 +83,7 @@ export {
|
|
83
83
|
addSideEffectHook,
|
84
84
|
} from './hooks';
|
85
85
|
|
86
|
-
import memoizeWeak
|
86
|
+
import memoizeWeak from 'memoizee/weak';
|
87
87
|
import * as controlFlow from './control-flow';
|
88
88
|
|
89
89
|
export let db = undefined as any as Db.Database;
|
@@ -2069,7 +2069,7 @@ export const setup = async (
|
|
2069
2069
|
_app: Express.Application,
|
2070
2070
|
$db: Db.Database,
|
2071
2071
|
): Promise<void> => {
|
2072
|
-
|
2072
|
+
db = $db;
|
2073
2073
|
try {
|
2074
2074
|
await db.transaction(async (tx) => {
|
2075
2075
|
await executeStandardModels(tx);
|
@@ -2092,7 +2092,7 @@ export const postSetup = async (
|
|
2092
2092
|
_app: Express.Application,
|
2093
2093
|
$db: Db.Database,
|
2094
2094
|
): Promise<void> => {
|
2095
|
-
|
2095
|
+
db = $db;
|
2096
2096
|
try {
|
2097
2097
|
await db.transaction(async (tx) => {
|
2098
2098
|
await postExecuteModels(tx);
|
@@ -13,7 +13,7 @@ import * as ODataParser from '@balena/odata-parser';
|
|
13
13
|
export const SyntaxError = ODataParser.SyntaxError;
|
14
14
|
import { OData2AbstractSQL } from '@balena/odata-to-abstract-sql';
|
15
15
|
import _ from 'lodash';
|
16
|
-
import memoizeWeak
|
16
|
+
import memoizeWeak from 'memoizee/weak';
|
17
17
|
|
18
18
|
export { BadRequestError, ParsingError, TranslationError } from './errors';
|
19
19
|
import deepFreeze from 'deep-freeze';
|
@@ -70,13 +70,12 @@ export const init = async <T extends string>(
|
|
70
70
|
const promises: Array<Promise<void>> = [];
|
71
71
|
if (process.env.SBVR_SERVER_ENABLED) {
|
72
72
|
const sbvrServer = await import('../data-server/sbvr-server.js');
|
73
|
-
|
74
|
-
const transactions = require('../http-transactions/transactions');
|
73
|
+
const transactions = await import('../http-transactions/transactions.js');
|
75
74
|
promises.push(cfgLoader.loadConfig(sbvrServer.config));
|
76
75
|
promises.push(
|
77
|
-
cfgLoader
|
78
|
-
.
|
79
|
-
|
76
|
+
cfgLoader.loadConfig(transactions.config).then(() => {
|
77
|
+
transactions.addModelHooks('data');
|
78
|
+
}),
|
80
79
|
);
|
81
80
|
}
|
82
81
|
if (!process.env.CONFIG_LOADER_DISABLED) {
|
@@ -20,3 +20,16 @@ if (!process.browser) {
|
|
20
20
|
nodeRequire.extensions['.sbvr'] = (module: NodeModule, filename: string) =>
|
21
21
|
(module.exports = fs.readFileSync(filename, 'utf8'));
|
22
22
|
}
|
23
|
+
|
24
|
+
/**
|
25
|
+
*
|
26
|
+
* @param filePath The module to load
|
27
|
+
* @param parentUrl Use `require`
|
28
|
+
* @returns The sbvr file contents
|
29
|
+
*/
|
30
|
+
export function requireSBVR(filePath: string, require: NodeRequire) {
|
31
|
+
return (require('fs') as typeof import('fs')).readFileSync(
|
32
|
+
require.resolve(filePath),
|
33
|
+
'utf8',
|
34
|
+
);
|
35
|
+
}
|
package/src/tasks/index.ts
CHANGED
@@ -10,11 +10,11 @@ import { Worker } from './worker';
|
|
10
10
|
import type TasksModel from './tasks';
|
11
11
|
import type { Task } from './tasks';
|
12
12
|
import type { FromSchema } from 'json-schema-to-ts';
|
13
|
+
import { requireSBVR } from '../server-glue/sbvr-loader';
|
13
14
|
|
14
15
|
export type * from './tasks';
|
15
16
|
|
16
|
-
|
17
|
-
const modelText: string = require('./tasks.sbvr');
|
17
|
+
const modelText = requireSBVR('./tasks.sbvr', require);
|
18
18
|
|
19
19
|
// Create index for polling tasks table
|
20
20
|
const initSql = `
|
@@ -37,7 +37,7 @@ export const config: ConfigLoader.Config = {
|
|
37
37
|
modelName: apiRoot,
|
38
38
|
apiRoot,
|
39
39
|
modelText,
|
40
|
-
customServerCode:
|
40
|
+
customServerCode: { setup },
|
41
41
|
initSql,
|
42
42
|
},
|
43
43
|
],
|