remult 0.16.0-exp.14 → 0.16.0-exp.17
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/postgres/postgres-data-provider.d.ts +1 -1
- package/esm/postgres/postgres-data-provider.js +4 -3
- package/esm/remult-mongo.d.ts +1 -1
- package/esm/remult-mongo.js +1 -1
- package/esm/server/expressBridge.js +1 -1
- package/esm/src/remult3/RepositoryImplementation.js +8 -8
- package/package.json +1 -1
- package/postgres/postgres-data-provider.d.ts +1 -1
- package/postgres/postgres-data-provider.js +5 -4
- package/remult-mongo.d.ts +1 -1
- package/remult-mongo.js +5 -5
- package/server/expressBridge.js +1 -1
- package/src/remult3/RepositoryImplementation.js +8 -8
|
@@ -25,4 +25,4 @@ export declare function createPostgresConnection(options?: {
|
|
|
25
25
|
configuration?: "heroku" | PoolConfig;
|
|
26
26
|
autoCreateTables?: boolean;
|
|
27
27
|
}): Promise<SqlDatabase>;
|
|
28
|
-
export declare function preparePostgresQueueStorage(sql: SqlDatabase): Promise<import("../server/expressBridge").EntityQueueStorage>;
|
|
28
|
+
export declare function preparePostgresQueueStorage(sql: SqlDatabase): Promise<import("../server/expressBridge.js").EntityQueueStorage>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as pg from 'pg';
|
|
2
2
|
import { Remult } from '../src/context.js';
|
|
3
3
|
import { PostgresSchemaBuilder, verifyStructureOfAllEntities } from './schema-builder.js';
|
|
4
4
|
import { SqlDatabase } from '../src/data-providers/sql-database.js';
|
|
5
|
+
const { Pool } = pg;
|
|
5
6
|
export class PostgresDataProvider {
|
|
6
7
|
pool;
|
|
7
8
|
async entityIsUsedForTheFirstTime(entity) {
|
|
@@ -93,9 +94,9 @@ export async function createPostgresConnection(options) {
|
|
|
93
94
|
export async function preparePostgresQueueStorage(sql) {
|
|
94
95
|
let c = new Remult();
|
|
95
96
|
c.dataProvider = (sql);
|
|
96
|
-
let JobsInQueueEntity = (await import('../server/expressBridge')).JobsInQueueEntity;
|
|
97
|
+
let JobsInQueueEntity = (await import('../server/expressBridge.js')).JobsInQueueEntity;
|
|
97
98
|
let e = c.repo(JobsInQueueEntity);
|
|
98
99
|
await new PostgresSchemaBuilder(sql).createIfNotExist(e.metadata);
|
|
99
100
|
await new PostgresSchemaBuilder(sql).verifyAllColumns(e.metadata);
|
|
100
|
-
return new (await import('../server/expressBridge')).EntityQueueStorage(c.repo(JobsInQueueEntity));
|
|
101
|
+
return new (await import('../server/expressBridge.js')).EntityQueueStorage(c.repo(JobsInQueueEntity));
|
|
101
102
|
}
|
package/esm/remult-mongo.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MongoClient, Db } from 'mongodb';
|
|
2
|
-
import { DataProvider, EntityDataProvider, EntityMetadata } from '.';
|
|
2
|
+
import { DataProvider, EntityDataProvider, EntityMetadata } from './index.js';
|
|
3
3
|
export declare class MongoDataProvider implements DataProvider {
|
|
4
4
|
private db;
|
|
5
5
|
private client;
|
package/esm/remult-mongo.js
CHANGED
|
@@ -29,7 +29,7 @@ export function createRemultServer(options) {
|
|
|
29
29
|
dataProvider = dataProvider.then(async (dp) => {
|
|
30
30
|
if (dp)
|
|
31
31
|
return dp;
|
|
32
|
-
return new (await import('./JsonEntityFileStorage')).JsonFileDataProvider('./db');
|
|
32
|
+
return new (await import('./JsonEntityFileStorage.js')).JsonFileDataProvider('./db');
|
|
33
33
|
});
|
|
34
34
|
if (options.initApi) {
|
|
35
35
|
dataProvider = dataProvider.then(async (dp) => {
|
|
@@ -1157,13 +1157,6 @@ export class columnDefsImpl {
|
|
|
1157
1157
|
constructor(settings, entityDefs, remult) {
|
|
1158
1158
|
this.settings = settings;
|
|
1159
1159
|
this.entityDefs = entityDefs;
|
|
1160
|
-
if (settings.serverExpression)
|
|
1161
|
-
this.isServerExpression = true;
|
|
1162
|
-
if (typeof (this.settings.allowApiUpdate) === "boolean")
|
|
1163
|
-
this.readonly = this.settings.allowApiUpdate;
|
|
1164
|
-
if (!this.inputType)
|
|
1165
|
-
this.inputType = this.valueConverter.inputType;
|
|
1166
|
-
this.caption = buildCaption(settings.caption, settings.key, remult);
|
|
1167
1160
|
this.options = this.settings;
|
|
1168
1161
|
this.target = this.settings.target;
|
|
1169
1162
|
this.valueConverter = this.settings.valueConverter;
|
|
@@ -1171,6 +1164,13 @@ export class columnDefsImpl {
|
|
|
1171
1164
|
this.inputType = this.settings.inputType;
|
|
1172
1165
|
this.key = this.settings.key;
|
|
1173
1166
|
this.valueType = this.settings.valueType;
|
|
1167
|
+
if (settings.serverExpression)
|
|
1168
|
+
this.isServerExpression = true;
|
|
1169
|
+
if (typeof (this.settings.allowApiUpdate) === "boolean")
|
|
1170
|
+
this.readonly = this.settings.allowApiUpdate;
|
|
1171
|
+
if (!this.inputType)
|
|
1172
|
+
this.inputType = this.valueConverter.inputType;
|
|
1173
|
+
this.caption = buildCaption(settings.caption, settings.key, remult);
|
|
1174
1174
|
}
|
|
1175
1175
|
dbNamePromise;
|
|
1176
1176
|
getDbName() {
|
|
@@ -1233,6 +1233,7 @@ class EntityFullInfo {
|
|
|
1233
1233
|
this.remult = remult;
|
|
1234
1234
|
this.entityType = entityType;
|
|
1235
1235
|
this.key = key;
|
|
1236
|
+
this.options = this.entityInfo;
|
|
1236
1237
|
if (this.options.allowApiCrud !== undefined) {
|
|
1237
1238
|
if (this.options.allowApiDelete === undefined)
|
|
1238
1239
|
this.options.allowApiDelete = this.options.allowApiCrud;
|
|
@@ -1242,7 +1243,6 @@ class EntityFullInfo {
|
|
|
1242
1243
|
this.options.allowApiUpdate = this.options.allowApiCrud;
|
|
1243
1244
|
if (this.options.allowApiRead === undefined)
|
|
1244
1245
|
this.options.allowApiRead = this.options.allowApiCrud;
|
|
1245
|
-
this.options = this.entityInfo;
|
|
1246
1246
|
}
|
|
1247
1247
|
if (this.options.allowApiRead === undefined)
|
|
1248
1248
|
this.options.allowApiRead = true;
|
package/package.json
CHANGED
|
@@ -25,4 +25,4 @@ export declare function createPostgresConnection(options?: {
|
|
|
25
25
|
configuration?: "heroku" | PoolConfig;
|
|
26
26
|
autoCreateTables?: boolean;
|
|
27
27
|
}): Promise<SqlDatabase>;
|
|
28
|
-
export declare function preparePostgresQueueStorage(sql: SqlDatabase): Promise<import("../server/expressBridge").EntityQueueStorage>;
|
|
28
|
+
export declare function preparePostgresQueueStorage(sql: SqlDatabase): Promise<import("../server/expressBridge.js").EntityQueueStorage>;
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.preparePostgresQueueStorage = exports.createPostgresConnection = exports.PostgresDataProvider = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
-
var
|
|
5
|
+
var pg = require("pg");
|
|
6
6
|
var context_js_1 = require("../src/context.js");
|
|
7
7
|
var schema_builder_js_1 = require("./schema-builder.js");
|
|
8
8
|
var sql_database_js_1 = require("../src/data-providers/sql-database.js");
|
|
9
|
+
var Pool = pg.Pool;
|
|
9
10
|
var PostgresDataProvider = /** @class */ (function () {
|
|
10
11
|
function PostgresDataProvider(pool) {
|
|
11
12
|
this.pool = pool;
|
|
@@ -118,7 +119,7 @@ function createPostgresConnection(options) {
|
|
|
118
119
|
if (!config.connectionString && options.connectionString) {
|
|
119
120
|
config.connectionString = options.connectionString;
|
|
120
121
|
}
|
|
121
|
-
db = new sql_database_js_1.SqlDatabase(new PostgresDataProvider(new
|
|
122
|
+
db = new sql_database_js_1.SqlDatabase(new PostgresDataProvider(new Pool(config)));
|
|
122
123
|
remult = new context_js_1.Remult();
|
|
123
124
|
remult.dataProvider = (db);
|
|
124
125
|
if (!(options.autoCreateTables === undefined || options.autoCreateTables)) return [3 /*break*/, 2];
|
|
@@ -140,7 +141,7 @@ function preparePostgresQueueStorage(sql) {
|
|
|
140
141
|
case 0:
|
|
141
142
|
c = new context_js_1.Remult();
|
|
142
143
|
c.dataProvider = (sql);
|
|
143
|
-
return [4 /*yield*/, Promise.resolve().then(function () { return require('../server/expressBridge'); })];
|
|
144
|
+
return [4 /*yield*/, Promise.resolve().then(function () { return require('../server/expressBridge.js'); })];
|
|
144
145
|
case 1:
|
|
145
146
|
JobsInQueueEntity = (_a.sent()).JobsInQueueEntity;
|
|
146
147
|
e = c.repo(JobsInQueueEntity);
|
|
@@ -150,7 +151,7 @@ function preparePostgresQueueStorage(sql) {
|
|
|
150
151
|
return [4 /*yield*/, new schema_builder_js_1.PostgresSchemaBuilder(sql).verifyAllColumns(e.metadata)];
|
|
151
152
|
case 3:
|
|
152
153
|
_a.sent();
|
|
153
|
-
return [4 /*yield*/, Promise.resolve().then(function () { return require('../server/expressBridge'); })];
|
|
154
|
+
return [4 /*yield*/, Promise.resolve().then(function () { return require('../server/expressBridge.js'); })];
|
|
154
155
|
case 4: return [2 /*return*/, new (_a.sent()).EntityQueueStorage(c.repo(JobsInQueueEntity))];
|
|
155
156
|
}
|
|
156
157
|
});
|
package/remult-mongo.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MongoClient, Db } from 'mongodb';
|
|
2
|
-
import { DataProvider, EntityDataProvider, EntityMetadata } from '.';
|
|
2
|
+
import { DataProvider, EntityDataProvider, EntityMetadata } from './index.js';
|
|
3
3
|
export declare class MongoDataProvider implements DataProvider {
|
|
4
4
|
private db;
|
|
5
5
|
private client;
|
package/remult-mongo.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MongoDataProvider = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
-
var
|
|
5
|
+
var index_js_1 = require("./index.js");
|
|
6
6
|
var filter_consumer_bridge_to_sql_request_js_1 = require("./src/filter/filter-consumer-bridge-to-sql-request.js");
|
|
7
7
|
var MongoDataProvider = /** @class */ (function () {
|
|
8
8
|
function MongoDataProvider(db, client) {
|
|
@@ -172,14 +172,14 @@ var MongoEntityDataProvider = /** @class */ (function () {
|
|
|
172
172
|
case 1:
|
|
173
173
|
_a = _k.sent(), collection = _a.collection, e = _a.e;
|
|
174
174
|
f = new FilterConsumerBridgeToMongo(e);
|
|
175
|
-
|
|
175
|
+
index_js_1.Filter.fromEntityFilter(this.entity, this.entity.idMetadata.getIdFilter(id)).__applyToConsumer(f);
|
|
176
176
|
resultFilter = this.entity.idMetadata.getIdFilter(id);
|
|
177
177
|
if (data.id != undefined)
|
|
178
178
|
resultFilter = this.entity.idMetadata.getIdFilter(data.id);
|
|
179
179
|
try {
|
|
180
180
|
for (_b = tslib_1.__values(this.entity.fields), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
181
181
|
x = _c.value;
|
|
182
|
-
if (x instanceof
|
|
182
|
+
if (x instanceof index_js_1.CompoundIdField) {
|
|
183
183
|
resultFilter = x.resultIdFilter(id, data);
|
|
184
184
|
}
|
|
185
185
|
}
|
|
@@ -217,7 +217,7 @@ var MongoEntityDataProvider = /** @class */ (function () {
|
|
|
217
217
|
}])];
|
|
218
218
|
case 3:
|
|
219
219
|
r = _k.sent();
|
|
220
|
-
return [2 /*return*/, this.find({ where:
|
|
220
|
+
return [2 /*return*/, this.find({ where: index_js_1.Filter.fromEntityFilter(this.entity, resultFilter) }).then(function (y) { return y[0]; })];
|
|
221
221
|
}
|
|
222
222
|
});
|
|
223
223
|
});
|
|
@@ -231,7 +231,7 @@ var MongoEntityDataProvider = /** @class */ (function () {
|
|
|
231
231
|
case 1:
|
|
232
232
|
_a = _d.sent(), e = _a.e, collection = _a.collection;
|
|
233
233
|
f = new FilterConsumerBridgeToMongo(e);
|
|
234
|
-
|
|
234
|
+
index_js_1.Filter.fromEntityFilter(this.entity, this.entity.idMetadata.getIdFilter(id)).__applyToConsumer(f);
|
|
235
235
|
_c = (_b = collection).deleteOne;
|
|
236
236
|
return [4 /*yield*/, f.resolveWhere()];
|
|
237
237
|
case 2:
|
package/server/expressBridge.js
CHANGED
|
@@ -36,7 +36,7 @@ function createRemultServer(options) {
|
|
|
36
36
|
case 0:
|
|
37
37
|
if (dp)
|
|
38
38
|
return [2 /*return*/, dp];
|
|
39
|
-
return [4 /*yield*/, Promise.resolve().then(function () { return require('./JsonEntityFileStorage'); })];
|
|
39
|
+
return [4 /*yield*/, Promise.resolve().then(function () { return require('./JsonEntityFileStorage.js'); })];
|
|
40
40
|
case 1: return [2 /*return*/, new (_a.sent()).JsonFileDataProvider('./db')];
|
|
41
41
|
}
|
|
42
42
|
});
|
|
@@ -2035,13 +2035,6 @@ var columnDefsImpl = /** @class */ (function () {
|
|
|
2035
2035
|
function columnDefsImpl(settings, entityDefs, remult) {
|
|
2036
2036
|
this.settings = settings;
|
|
2037
2037
|
this.entityDefs = entityDefs;
|
|
2038
|
-
if (settings.serverExpression)
|
|
2039
|
-
this.isServerExpression = true;
|
|
2040
|
-
if (typeof (this.settings.allowApiUpdate) === "boolean")
|
|
2041
|
-
this.readonly = this.settings.allowApiUpdate;
|
|
2042
|
-
if (!this.inputType)
|
|
2043
|
-
this.inputType = this.valueConverter.inputType;
|
|
2044
|
-
this.caption = buildCaption(settings.caption, settings.key, remult);
|
|
2045
2038
|
this.options = this.settings;
|
|
2046
2039
|
this.target = this.settings.target;
|
|
2047
2040
|
this.valueConverter = this.settings.valueConverter;
|
|
@@ -2049,6 +2042,13 @@ var columnDefsImpl = /** @class */ (function () {
|
|
|
2049
2042
|
this.inputType = this.settings.inputType;
|
|
2050
2043
|
this.key = this.settings.key;
|
|
2051
2044
|
this.valueType = this.settings.valueType;
|
|
2045
|
+
if (settings.serverExpression)
|
|
2046
|
+
this.isServerExpression = true;
|
|
2047
|
+
if (typeof (this.settings.allowApiUpdate) === "boolean")
|
|
2048
|
+
this.readonly = this.settings.allowApiUpdate;
|
|
2049
|
+
if (!this.inputType)
|
|
2050
|
+
this.inputType = this.valueConverter.inputType;
|
|
2051
|
+
this.caption = buildCaption(settings.caption, settings.key, remult);
|
|
2052
2052
|
}
|
|
2053
2053
|
columnDefsImpl.prototype.getDbName = function () {
|
|
2054
2054
|
var _this = this;
|
|
@@ -2142,6 +2142,7 @@ var EntityFullInfo = /** @class */ (function () {
|
|
|
2142
2142
|
_b;
|
|
2143
2143
|
}
|
|
2144
2144
|
};
|
|
2145
|
+
this.options = this.entityInfo;
|
|
2145
2146
|
if (this.options.allowApiCrud !== undefined) {
|
|
2146
2147
|
if (this.options.allowApiDelete === undefined)
|
|
2147
2148
|
this.options.allowApiDelete = this.options.allowApiCrud;
|
|
@@ -2151,7 +2152,6 @@ var EntityFullInfo = /** @class */ (function () {
|
|
|
2151
2152
|
this.options.allowApiUpdate = this.options.allowApiCrud;
|
|
2152
2153
|
if (this.options.allowApiRead === undefined)
|
|
2153
2154
|
this.options.allowApiRead = this.options.allowApiCrud;
|
|
2154
|
-
this.options = this.entityInfo;
|
|
2155
2155
|
}
|
|
2156
2156
|
if (this.options.allowApiRead === undefined)
|
|
2157
2157
|
this.options.allowApiRead = true;
|