remult 0.26.21 → 0.26.23-next.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/SseSubscriptionServer.d.ts +3 -4
- package/assign.js +1 -2
- package/esm/graphql.js +1 -1
- package/esm/remult-hono.js +3 -1
- package/esm/remult-knex/index.js +3 -1
- package/esm/remult-sqlite3.js +4 -1
- package/esm/remult-sveltekit.js +1 -0
- package/esm/server/index.js +3 -2
- package/esm/server/initAsyncHooks.js +3 -3
- package/esm/server/remult-admin.js +1 -4
- package/esm/server/remult-api-server.js +47 -48
- package/esm/src/CompoundIdField.js +9 -9
- package/esm/src/data-api.js +1 -1
- package/esm/src/data-providers/json-entity-opfs-storage.js +9 -5
- package/esm/src/data-providers/sql-database.js +9 -9
- package/esm/src/filter/filter-consumer-bridge-to-sql-request.js +3 -1
- package/esm/src/live-query/LiveQueryClient.js +0 -1
- package/esm/src/remult-proxy.js +1 -3
- package/esm/src/remult-static.js +1 -0
- package/esm/src/remult3/Fields.js +4 -3
- package/esm/src/remult3/RepositoryImplementation.js +143 -104
- package/esm/src/remult3/entity.js +1 -1
- package/esm/src/remult3/relation-loader.js +2 -2
- package/esm/src/remult3/remult3.js +9 -0
- package/esm/src/server-action.js +16 -12
- package/esm/src/sort.js +0 -2
- package/esm/src/validators.js +3 -3
- package/esm/src/valueConverters.js +2 -2
- package/graphql.js +3 -4
- package/index.js +2 -2
- package/live-query/data-provider-live-query-storage.js +6 -6
- package/migrations/compare-migration-snapshots.js +48 -49
- package/migrations/generate-migrations.js +1 -2
- package/migrations/migrate.js +2 -3
- package/migrations/migration-types.d.ts +1 -1
- package/migrations/migration-types.js +4 -4
- package/migrations/update-migrations-ts-file.js +1 -2
- package/myLog.js +1 -2
- package/package.json +1 -1
- package/postgres/postgres-data-provider.d.ts +2 -2
- package/postgres/postgres-data-provider.js +5 -5
- package/postgres/schema-builder.js +3 -3
- package/remult-express.js +4 -3
- package/remult-fastify.js +4 -3
- package/remult-fresh.js +1 -2
- package/remult-hapi.js +4 -3
- package/remult-hono.js +6 -3
- package/remult-knex/index.d.ts +1 -1
- package/remult-knex/index.js +7 -5
- package/remult-mongo.d.ts +1 -1
- package/remult-next.d.ts +4 -5
- package/remult-next.js +11 -6
- package/remult-nuxt.js +1 -2
- package/remult-solid-start.js +1 -2
- package/remult-sqlite3.js +4 -1
- package/remult-sveltekit.js +33 -35
- package/server/JsonEntityFileStorage.d.ts +1 -1
- package/server/get-remult-admin-html.js +1 -2
- package/server/index.d.ts +1 -1
- package/server/index.js +4 -3
- package/server/initAsyncHooks.d.ts +10 -10
- package/server/initAsyncHooks.js +5 -2
- package/server/initDataProvider.js +1 -2
- package/server/initDataProviderOrJson.js +1 -2
- package/server/remult-admin.js +3 -7
- package/server/remult-api-server.d.ts +22 -22
- package/server/remult-api-server.js +54 -48
- package/src/CompoundIdField.d.ts +1 -1
- package/src/CompoundIdField.js +9 -0
- package/src/buildRestDataProvider.d.ts +1 -1
- package/src/buildRestDataProvider.js +8 -8
- package/src/column-interfaces.d.ts +8 -8
- package/src/column-interfaces.js +1 -2
- package/src/column.d.ts +4 -4
- package/src/column.js +2 -2
- package/src/context.d.ts +4 -4
- package/src/context.js +5 -5
- package/src/data-api.d.ts +2 -2
- package/src/data-api.js +4 -4
- package/src/data-interfaces.js +1 -2
- package/src/data-providers/json-entity-opfs-storage.js +30 -16
- package/src/data-providers/rest-data-provider.d.ts +3 -3
- package/src/data-providers/rest-data-provider.js +4 -4
- package/src/data-providers/sql-database.js +11 -11
- package/src/filter/filter-consumer-bridge-to-sql-request.d.ts +3 -3
- package/src/filter/filter-consumer-bridge-to-sql-request.js +21 -19
- package/src/filter/filter-interfaces.d.ts +1 -1
- package/src/filter/filter-interfaces.js +10 -6
- package/src/isOfType.js +2 -3
- package/src/live-query/SubscriptionServer.js +95 -97
- package/src/remult-proxy.js +1 -3
- package/src/remult-static.d.ts +2 -2
- package/src/remult-static.js +7 -4
- package/src/remult3/Fields.d.ts +2 -2
- package/src/remult3/Fields.js +11 -9
- package/src/remult3/RepositoryImplementation.d.ts +41 -39
- package/src/remult3/RepositoryImplementation.js +416 -365
- package/src/remult3/__updateEntityBasedOnWhere.js +1 -2
- package/src/remult3/addValidator.d.ts +1 -1
- package/src/remult3/addValidator.js +1 -2
- package/src/remult3/classDescribers.d.ts +3 -3
- package/src/remult3/classDescribers.js +3 -4
- package/src/remult3/entity.js +2 -4
- package/src/remult3/getEntityRef.js +4 -4
- package/src/remult3/relation-loader.d.ts +1 -1
- package/src/remult3/relationInfoMember.d.ts +2 -2
- package/src/remult3/relationInfoMember.js +4 -5
- package/src/remult3/remult3.d.ts +13 -10
- package/src/remult3/remult3.js +9 -0
- package/src/remult3/repository-internals.d.ts +3 -3
- package/src/remult3/repository-internals.js +2 -2
- package/src/server-action.d.ts +1 -1
- package/src/server-action.js +65 -58
- package/src/sort.d.ts +1 -1
- package/src/sort.js +0 -2
- package/src/sql-command.d.ts +1 -1
- package/src/validators.d.ts +1 -1
- package/src/validators.js +13 -11
- package/src/valueConverters.js +3 -2
|
@@ -17,109 +17,107 @@ var LiveQueryPublisher = /** @class */ (function () {
|
|
|
17
17
|
var _this = this;
|
|
18
18
|
return tslib_1.__generator(this, function (_a) {
|
|
19
19
|
switch (_a.label) {
|
|
20
|
-
case 0: return [4 /*yield*/, this.liveQueryStorage().forEach(entityKey, function (_a) {
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
20
|
+
case 0: return [4 /*yield*/, this.liveQueryStorage().forEach(entityKey, function (_a) { return tslib_1.__awaiter(_this, [_a], void 0, function (_b) {
|
|
21
|
+
var query;
|
|
22
|
+
var _this = this;
|
|
23
|
+
var q = _b.query, setData = _b.setData;
|
|
24
|
+
return tslib_1.__generator(this, function (_c) {
|
|
25
|
+
switch (_c.label) {
|
|
26
|
+
case 0:
|
|
27
|
+
query = tslib_1.__assign({}, q.data);
|
|
28
|
+
return [4 /*yield*/, this.performWithContext(query.requestJson, entityKey, function (repo) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
29
|
+
var messages, currentItems, currentIds, _loop_1, _a, _b, id, _loop_2, currentItems_1, currentItems_1_1, item;
|
|
30
|
+
var e_1, _c, e_2, _d;
|
|
31
|
+
return tslib_1.__generator(this, function (_e) {
|
|
32
|
+
switch (_e.label) {
|
|
33
|
+
case 0:
|
|
34
|
+
messages = [];
|
|
35
|
+
return [4 /*yield*/, repo.find((0, rest_data_provider_js_1.findOptionsFromJson)(query.findOptionsJson, repo.metadata))];
|
|
36
|
+
case 1:
|
|
37
|
+
currentItems = _e.sent();
|
|
38
|
+
currentIds = currentItems.map(function (x) {
|
|
39
|
+
return repo.getEntityRef(x).getId();
|
|
40
|
+
});
|
|
41
|
+
_loop_1 = function (id) {
|
|
42
|
+
var c = changes.find(function (c) { return c.oldId == id; });
|
|
43
|
+
if (c === undefined ||
|
|
44
|
+
id != c.oldId ||
|
|
45
|
+
!currentIds.includes(c.id))
|
|
46
|
+
messages.push({
|
|
47
|
+
type: 'remove',
|
|
48
|
+
data: {
|
|
49
|
+
id: id,
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
try {
|
|
54
|
+
for (_a = tslib_1.__values(query.lastIds.filter(function (y) { return !currentIds.includes(y); })), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
55
|
+
id = _b.value;
|
|
56
|
+
_loop_1(id);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
60
|
+
finally {
|
|
54
61
|
try {
|
|
55
|
-
|
|
56
|
-
id = _b.value;
|
|
57
|
-
_loop_1(id);
|
|
58
|
-
}
|
|
62
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
59
63
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
finally { if (e_1) throw e_1.error; }
|
|
65
|
+
}
|
|
66
|
+
_loop_2 = function (item) {
|
|
67
|
+
var itemRef = repo.getEntityRef(item);
|
|
68
|
+
var c = changes.find(function (c) { return c.id == itemRef.getId(); });
|
|
69
|
+
if (c !== undefined && query.lastIds.includes(c.oldId)) {
|
|
70
|
+
messages.push({
|
|
71
|
+
type: 'replace',
|
|
72
|
+
data: {
|
|
73
|
+
oldId: c.oldId,
|
|
74
|
+
item: itemRef.toApiJson(),
|
|
75
|
+
},
|
|
76
|
+
});
|
|
66
77
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
type: 'replace',
|
|
73
|
-
data: {
|
|
74
|
-
oldId: c.oldId,
|
|
75
|
-
item: itemRef.toApiJson(),
|
|
76
|
-
},
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
else if (!query.lastIds.includes(itemRef.getId())) {
|
|
80
|
-
messages.push({
|
|
81
|
-
type: 'add',
|
|
82
|
-
data: { item: itemRef.toApiJson() },
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
try {
|
|
87
|
-
for (currentItems_1 = tslib_1.__values(currentItems), currentItems_1_1 = currentItems_1.next(); !currentItems_1_1.done; currentItems_1_1 = currentItems_1.next()) {
|
|
88
|
-
item = currentItems_1_1.value;
|
|
89
|
-
_loop_2(item);
|
|
90
|
-
}
|
|
78
|
+
else if (!query.lastIds.includes(itemRef.getId())) {
|
|
79
|
+
messages.push({
|
|
80
|
+
type: 'add',
|
|
81
|
+
data: { item: itemRef.toApiJson() },
|
|
82
|
+
});
|
|
91
83
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
finally { if (e_2) throw e_2.error; }
|
|
84
|
+
};
|
|
85
|
+
try {
|
|
86
|
+
for (currentItems_1 = tslib_1.__values(currentItems), currentItems_1_1 = currentItems_1.next(); !currentItems_1_1.done; currentItems_1_1 = currentItems_1.next()) {
|
|
87
|
+
item = currentItems_1_1.value;
|
|
88
|
+
_loop_2(item);
|
|
98
89
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
90
|
+
}
|
|
91
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
92
|
+
finally {
|
|
93
|
+
try {
|
|
94
|
+
if (currentItems_1_1 && !currentItems_1_1.done && (_d = currentItems_1.return)) _d.call(currentItems_1);
|
|
95
|
+
}
|
|
96
|
+
finally { if (e_2) throw e_2.error; }
|
|
97
|
+
}
|
|
98
|
+
this.debugFileSaver({
|
|
99
|
+
query: q.id,
|
|
100
|
+
currentIds: currentIds,
|
|
101
|
+
changes: changes,
|
|
102
|
+
lastIds: query.lastIds,
|
|
103
|
+
messages: messages,
|
|
104
|
+
});
|
|
105
|
+
query.lastIds = currentIds;
|
|
106
|
+
return [4 /*yield*/, setData(query)];
|
|
107
|
+
case 2:
|
|
108
|
+
_e.sent();
|
|
109
|
+
if (messages.length > 0)
|
|
110
|
+
this.subscriptionServer().publishMessage(q.id, messages);
|
|
111
|
+
return [2 /*return*/];
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}); })];
|
|
115
|
+
case 1:
|
|
116
|
+
_c.sent();
|
|
117
|
+
return [2 /*return*/];
|
|
118
|
+
}
|
|
121
119
|
});
|
|
122
|
-
})];
|
|
120
|
+
}); })];
|
|
123
121
|
case 1:
|
|
124
122
|
_a.sent();
|
|
125
123
|
return [2 /*return*/];
|
package/src/remult-proxy.js
CHANGED
|
@@ -35,9 +35,7 @@ var RemultProxy = /** @class */ (function () {
|
|
|
35
35
|
//@ts-ignore
|
|
36
36
|
_a[repository_internals_js_1.getInternalKey] = function () {
|
|
37
37
|
var _a;
|
|
38
|
-
return (_a = self
|
|
39
|
-
.remultFactory())
|
|
40
|
-
.repo.apply(_a, tslib_1.__spreadArray([], tslib_1.__read(args), false))[repository_internals_js_1.getInternalKey]();
|
|
38
|
+
return (_a = self.remultFactory()).repo.apply(_a, tslib_1.__spreadArray([], tslib_1.__read(args), false))[repository_internals_js_1.getInternalKey]();
|
|
41
39
|
},
|
|
42
40
|
_a.relations = function (args2) {
|
|
43
41
|
var _a;
|
package/src/remult-static.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ClassType } from '../classType.js';
|
|
2
2
|
import type { ClassHelper, Remult, RemultAsyncLocalStorage } from './context.js';
|
|
3
|
-
import { DataProvider } from './data-interfaces';
|
|
3
|
+
import type { DataProvider } from './data-interfaces.js';
|
|
4
4
|
import type { columnInfo } from './remult3/columnInfo.js';
|
|
5
5
|
export declare const remultStatic: {
|
|
6
6
|
defaultRemultFactory: () => Remult;
|
|
@@ -20,7 +20,7 @@ export declare const remultStatic: {
|
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
captionTransformer: any;
|
|
23
|
-
defaultDataProvider: () => Promise<DataProvider>;
|
|
23
|
+
defaultDataProvider: () => Promise<DataProvider | undefined>;
|
|
24
24
|
};
|
|
25
25
|
export declare function defaultFactory(): Remult;
|
|
26
26
|
export declare function resetFactory(): void;
|
package/src/remult-static.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.remultStatic = void 0;
|
|
4
|
+
exports.defaultFactory = defaultFactory;
|
|
5
|
+
exports.resetFactory = resetFactory;
|
|
4
6
|
var remultStaticKey = Symbol.for('remult-static1');
|
|
5
7
|
var x = {
|
|
6
8
|
defaultRemultFactory: undefined,
|
|
@@ -22,11 +24,14 @@ var x = {
|
|
|
22
24
|
}); },
|
|
23
25
|
},
|
|
24
26
|
captionTransformer: undefined,
|
|
25
|
-
defaultDataProvider: function () {
|
|
27
|
+
defaultDataProvider: function () {
|
|
28
|
+
return undefined;
|
|
29
|
+
},
|
|
26
30
|
};
|
|
27
31
|
if ((typeof process !== 'undefined' &&
|
|
28
32
|
process.env['IGNORE_GLOBAL_REMULT_IN_TESTS']) ||
|
|
29
33
|
typeof globalThis[remultStaticKey] === 'undefined') {
|
|
34
|
+
;
|
|
30
35
|
globalThis[remultStaticKey] = x;
|
|
31
36
|
x.remultFactory = function () { return defaultFactory(); };
|
|
32
37
|
}
|
|
@@ -40,8 +45,6 @@ function defaultFactory() {
|
|
|
40
45
|
}
|
|
41
46
|
return exports.remultStatic.defaultRemult;
|
|
42
47
|
}
|
|
43
|
-
exports.defaultFactory = defaultFactory;
|
|
44
48
|
function resetFactory() {
|
|
45
49
|
exports.remultStatic.remultFactory = function () { return defaultFactory(); };
|
|
46
50
|
}
|
|
47
|
-
exports.resetFactory = resetFactory;
|
package/src/remult3/Fields.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ export declare class Fields {
|
|
|
52
52
|
* // This approach allows easy management and updates of the allowed values for the `status` field.
|
|
53
53
|
*/
|
|
54
54
|
static literal<entityType = any, valueType extends string = any>(optionalValues: () => readonly valueType[], ...options: (StringFieldOptions<entityType, valueType> | ((options: StringFieldOptions<entityType, valueType>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, valueType | undefined>;
|
|
55
|
-
static enum<entityType = any, theEnum =
|
|
55
|
+
static enum<entityType = any, theEnum = object>(enumType: () => theEnum, ...options: (FieldOptions<entityType, theEnum[keyof theEnum]> | ((options: FieldOptions<entityType, theEnum[keyof theEnum]>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, theEnum[keyof theEnum] | undefined>;
|
|
56
56
|
static string<entityType = any, valueType = string>(...options: (StringFieldOptions<entityType, valueType> | ((options: StringFieldOptions<entityType, valueType>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, valueType | undefined>;
|
|
57
57
|
static boolean<entityType = any>(...options: (FieldOptions<entityType, boolean> | ((options: FieldOptions<entityType, boolean>, remult: Remult) => void))[]): ClassFieldDecorator<entityType, boolean | undefined>;
|
|
58
58
|
}
|
|
@@ -162,7 +162,7 @@ export declare class Relations {
|
|
|
162
162
|
* @Fields.string((options,remult) => options.includeInApi = true)
|
|
163
163
|
* title='';
|
|
164
164
|
*/
|
|
165
|
-
export declare function Field<entityType = any, valueType = any>(valueType: (() => valueType extends number ? Number : valueType extends string ? String : valueType extends boolean ? Boolean : ClassType<valueType>) | undefined, ...options: (FieldOptions<entityType, valueType> | ((options: FieldOptions<entityType, valueType>, remult: Remult) => void))[]): (target: any, context: ClassFieldDecoratorContextStub<entityType, valueType | undefined> | string
|
|
165
|
+
export declare function Field<entityType = any, valueType = any>(valueType: (() => valueType extends number ? Number : valueType extends string ? String : valueType extends boolean ? Boolean : ClassType<valueType>) | undefined, ...options: (FieldOptions<entityType, valueType> | ((options: FieldOptions<entityType, valueType>, remult: Remult) => void))[]): (target: any, context: ClassFieldDecoratorContextStub<entityType, valueType | undefined> | string) => void;
|
|
166
166
|
export interface StringFieldOptions<entityType = any, valueType = string> extends FieldOptions<entityType, valueType> {
|
|
167
167
|
maxLength?: number;
|
|
168
168
|
minLength?: number;
|
package/src/remult3/Fields.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Relations = exports.Fields = void 0;
|
|
4
|
+
exports.Field = Field;
|
|
5
|
+
exports.checkTarget = checkTarget;
|
|
4
6
|
var tslib_1 = require("tslib");
|
|
5
7
|
var cuid2_1 = require("@paralleldrive/cuid2");
|
|
6
8
|
var uuid_1 = require("uuid");
|
|
@@ -218,14 +220,16 @@ var Fields = /** @class */ (function () {
|
|
|
218
220
|
options[_i - 1] = arguments[_i];
|
|
219
221
|
}
|
|
220
222
|
var valueConverter;
|
|
221
|
-
return Field.apply(void 0, tslib_1.__spreadArray(tslib_1.__spreadArray([
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
223
|
+
return Field.apply(void 0, tslib_1.__spreadArray(tslib_1.__spreadArray([
|
|
224
|
+
//@ts-ignore
|
|
225
|
+
function () { return enumType(); }, (_a = {
|
|
226
|
+
validate: function (entity, event) {
|
|
227
|
+
return validators_js_1.Validators.enum(enumType())(entity, event);
|
|
228
|
+
}
|
|
226
229
|
},
|
|
227
230
|
_a[RepositoryImplementation_js_1.fieldOptionalValuesFunctionKey] = function () { return (0, validators_js_1.getEnumValues)(enumType()); },
|
|
228
231
|
_a)], tslib_1.__read(options), false), [function (options) {
|
|
232
|
+
;
|
|
229
233
|
options[RepositoryImplementation_js_1.fieldOptionalValuesFunctionKey] = function () {
|
|
230
234
|
return (0, validators_js_1.getEnumValues)(enumType());
|
|
231
235
|
};
|
|
@@ -347,7 +351,7 @@ function Field(valueType) {
|
|
|
347
351
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
348
352
|
options[_i - 1] = arguments[_i];
|
|
349
353
|
}
|
|
350
|
-
return function (target, context
|
|
354
|
+
return function (target, context) {
|
|
351
355
|
var key = typeof context === 'string' ? context : context.name.toString();
|
|
352
356
|
var factory = function (remult) {
|
|
353
357
|
var r = (0, RepositoryImplementation_js_1.buildOptions)(options, remult);
|
|
@@ -402,9 +406,7 @@ function Field(valueType) {
|
|
|
402
406
|
}
|
|
403
407
|
};
|
|
404
408
|
}
|
|
405
|
-
exports.Field = Field;
|
|
406
409
|
function checkTarget(target) {
|
|
407
410
|
if (!target)
|
|
408
411
|
throw new Error("Set the 'experimentalDecorators:true' option in your 'tsconfig' or 'jsconfig' (target undefined)");
|
|
409
412
|
}
|
|
410
|
-
exports.checkTarget = checkTarget;
|
|
@@ -29,20 +29,20 @@ export declare class RepositoryImplementation<entityType> implements Repository<
|
|
|
29
29
|
returnNull: boolean;
|
|
30
30
|
returnUndefined: boolean;
|
|
31
31
|
};
|
|
32
|
-
private __edp
|
|
32
|
+
private __edp?;
|
|
33
33
|
private get _edp();
|
|
34
|
-
constructor(_entity: ClassType<entityType>, _remult: Remult, _dataProvider: DataProvider, _info: EntityFullInfo<entityType>, _defaultFindOptions?: FindOptions<entityType>);
|
|
34
|
+
constructor(_entity: ClassType<entityType>, _remult: Remult, _dataProvider: DataProvider, _info: EntityFullInfo<entityType>, _defaultFindOptions?: FindOptions<entityType> | undefined);
|
|
35
35
|
_idCache: Map<any, any>;
|
|
36
|
-
_getCachedById(id: any, doNotLoadIfNotFound: boolean): entityType;
|
|
37
|
-
_getCachedByIdAsync(id: any, doNotLoadIfNotFound: boolean): Promise<entityType>;
|
|
36
|
+
_getCachedById(id: any, doNotLoadIfNotFound: boolean): entityType | undefined;
|
|
37
|
+
_getCachedByIdAsync(id: any, doNotLoadIfNotFound: boolean): Promise<entityType | undefined>;
|
|
38
38
|
_addToCache(item: entityType): void;
|
|
39
39
|
get metadata(): EntityMetadata<entityType>;
|
|
40
|
-
listeners
|
|
40
|
+
listeners?: entityEventListener<entityType>[];
|
|
41
41
|
addEventListener(listener: entityEventListener<entityType>): () => void;
|
|
42
42
|
query(options?: QueryOptions<entityType>): QueryResult<entityType>;
|
|
43
43
|
getEntityRef(entity: entityType): EntityRef<entityType>;
|
|
44
44
|
delete(id: idType<entityType>): Promise<void>;
|
|
45
|
-
delete(item: entityType): Promise<void>;
|
|
45
|
+
delete(item: Partial<MembersOnly<entityType>>): Promise<void>;
|
|
46
46
|
insert(item: Partial<MembersOnly<entityType>>[]): Promise<entityType[]>;
|
|
47
47
|
insert(item: Partial<MembersOnly<entityType>>): Promise<entityType>;
|
|
48
48
|
get fields(): FieldsMetadata<entityType>;
|
|
@@ -57,26 +57,28 @@ export declare class RepositoryImplementation<entityType> implements Repository<
|
|
|
57
57
|
save(item: Partial<MembersOnly<entityType>>[]): Promise<entityType[]>;
|
|
58
58
|
save(item: Partial<MembersOnly<entityType>>): Promise<entityType>;
|
|
59
59
|
liveQuery(options?: FindOptions<entityType>): LiveQuery<entityType>;
|
|
60
|
-
_rawFind(options: FindOptions<entityType
|
|
61
|
-
find(options
|
|
60
|
+
_rawFind(options: FindOptions<entityType> | undefined, skipOrderByAndLimit: boolean | undefined, loader: RelationLoader): Promise<entityType[]>;
|
|
61
|
+
find(options?: FindOptions<entityType>): Promise<entityType[]>;
|
|
62
|
+
find(options?: FindOptions<entityType>, skipOrderByAndLimit?: boolean): Promise<entityType[]>;
|
|
62
63
|
_buildEntityDataProviderFindOptions(options: FindOptions<entityType>): Promise<EntityDataProviderFindOptions>;
|
|
63
64
|
_fromJsonArray(jsonItems: any[], loadOptions: LoadOptions<entityType>): Promise<entityType[]>;
|
|
64
65
|
private _loadManyToOneForManyRows;
|
|
65
66
|
private _mapRawDataToResult;
|
|
66
67
|
toJson(item: entityType | entityType[] | Promise<entityType> | Promise<entityType[]>): any;
|
|
67
|
-
fromJson(
|
|
68
|
+
fromJson(x: any[], isNew?: boolean): entityType[];
|
|
69
|
+
fromJson(x: any, isNew?: boolean): entityType;
|
|
68
70
|
count(where?: EntityFilter<entityType>): Promise<number>;
|
|
69
71
|
deleteMany({ where, }: {
|
|
70
72
|
where: EntityFilter<entityType>;
|
|
71
73
|
}): Promise<number>;
|
|
72
74
|
private _cache;
|
|
73
|
-
findOne(
|
|
74
|
-
findFirst(where?: EntityFilter<entityType>, options?: FindFirstOptions<entityType>, skipOrderByAndLimit?: boolean): Promise<entityType>;
|
|
75
|
+
findOne(pOptions?: FindFirstOptions<entityType>, skipOrderByAndLimit?: boolean): Promise<entityType | undefined>;
|
|
76
|
+
findFirst(where?: EntityFilter<entityType>, options?: FindFirstOptions<entityType>, skipOrderByAndLimit?: boolean): Promise<entityType | undefined>;
|
|
75
77
|
private _fieldsOf;
|
|
76
78
|
create(item?: Partial<MembersOnly<entityType>>): entityType;
|
|
77
79
|
_fixTypes(item: any): Promise<any>;
|
|
78
|
-
findId(id: any, options?: FindFirstOptionsBase<entityType>): Promise<entityType>;
|
|
79
|
-
_translateWhereToFilter(where
|
|
80
|
+
findId(id: any, options?: FindFirstOptionsBase<entityType>): Promise<entityType | undefined | null>;
|
|
81
|
+
_translateWhereToFilter(where?: EntityFilter<entityType>): Promise<Filter>;
|
|
80
82
|
}
|
|
81
83
|
export type EntityOptionsFactory = (remult: Remult) => EntityOptions;
|
|
82
84
|
export declare function createOldEntity<T>(entity: ClassType<T>, remult: Remult): EntityFullInfo<T>;
|
|
@@ -85,11 +87,11 @@ declare abstract class rowHelperBase<T> {
|
|
|
85
87
|
instance: T;
|
|
86
88
|
remult: Remult;
|
|
87
89
|
isNewRow: boolean;
|
|
88
|
-
_error
|
|
89
|
-
get error(): string;
|
|
90
|
-
set error(val: string);
|
|
90
|
+
_error?: string;
|
|
91
|
+
get error(): string | undefined;
|
|
92
|
+
set error(val: string | undefined);
|
|
91
93
|
constructor(fieldsMetadata: FieldMetadata[], instance: T, remult: Remult, isNewRow: boolean);
|
|
92
|
-
_subscribers
|
|
94
|
+
_subscribers?: SubscribableImp;
|
|
93
95
|
subscribe(listener: RefSubscriber): Unsubscribe;
|
|
94
96
|
_isLoading: boolean;
|
|
95
97
|
initSubscribers(): void;
|
|
@@ -97,8 +99,8 @@ declare abstract class rowHelperBase<T> {
|
|
|
97
99
|
set isLoading(val: boolean);
|
|
98
100
|
lookups: Map<string, LookupColumn<any>>;
|
|
99
101
|
waitLoad(): Promise<void>;
|
|
100
|
-
errors
|
|
101
|
-
[key: string]: string;
|
|
102
|
+
errors?: {
|
|
103
|
+
[key: string]: string | undefined;
|
|
102
104
|
};
|
|
103
105
|
protected __assertValidity(): void;
|
|
104
106
|
buildErrorInfoObject(): ErrorInfo<any>;
|
|
@@ -111,7 +113,7 @@ declare abstract class rowHelperBase<T> {
|
|
|
111
113
|
originalValues: any;
|
|
112
114
|
saveOriginalData(): void;
|
|
113
115
|
saveMoreOriginalData(): void;
|
|
114
|
-
validate(): Promise<ErrorInfo<any
|
|
116
|
+
validate(): Promise<ErrorInfo<any> | undefined>;
|
|
115
117
|
__validateEntity(): Promise<void>;
|
|
116
118
|
__performColumnAndEntityValidations(): Promise<void>;
|
|
117
119
|
toApiJson(includeRelatedEntities?: boolean, notJustApi?: boolean): any;
|
|
@@ -123,7 +125,7 @@ export declare class rowHelperImplementation<T> extends rowHelperBase<T> impleme
|
|
|
123
125
|
private edp;
|
|
124
126
|
private _isNew;
|
|
125
127
|
constructor(info: EntityFullInfo<T>, instance: T, repository: RepositoryImplementation<T>, edp: EntityDataProvider, remult: Remult, _isNew: boolean);
|
|
126
|
-
clone():
|
|
128
|
+
clone(): T;
|
|
127
129
|
get relations(): RepositoryRelations<T>;
|
|
128
130
|
get apiUpdateAllowed(): boolean;
|
|
129
131
|
get apiDeleteAllowed(): boolean;
|
|
@@ -135,7 +137,7 @@ export declare class rowHelperImplementation<T> extends rowHelperBase<T> impleme
|
|
|
135
137
|
wasDeleted(): boolean;
|
|
136
138
|
undoChanges(): void;
|
|
137
139
|
reload(): Promise<T>;
|
|
138
|
-
private _columns
|
|
140
|
+
private _columns?;
|
|
139
141
|
get fields(): FieldsRef<T>;
|
|
140
142
|
private _saving;
|
|
141
143
|
save(onlyTheseFieldsSentOnlyInTheCaseOfProxySaveWithPartialObject?: string[]): Promise<T>;
|
|
@@ -145,8 +147,8 @@ export declare class rowHelperImplementation<T> extends rowHelperBase<T> impleme
|
|
|
145
147
|
private getIdFilter;
|
|
146
148
|
delete(): Promise<void>;
|
|
147
149
|
loadDataFrom(data: any, loadItems?: FieldMetadata[]): Promise<void>;
|
|
148
|
-
id
|
|
149
|
-
originalId
|
|
150
|
+
id?: any;
|
|
151
|
+
originalId?: any;
|
|
150
152
|
getOriginalId(): any;
|
|
151
153
|
private calcServerExpression;
|
|
152
154
|
isNew(): boolean;
|
|
@@ -166,17 +168,17 @@ export declare class FieldRefImplementation<entityType, valueType> implements Fi
|
|
|
166
168
|
container: any;
|
|
167
169
|
private helper;
|
|
168
170
|
private rowBase;
|
|
169
|
-
constructor(settings: FieldOptions, metadata: FieldMetadata, container: any, helper: EntityRef<entityType
|
|
170
|
-
_subscribers
|
|
171
|
+
constructor(settings: FieldOptions, metadata: FieldMetadata, container: any, helper: EntityRef<entityType> | undefined, rowBase: rowHelperBase<entityType>);
|
|
172
|
+
_subscribers?: SubscribableImp;
|
|
171
173
|
subscribe(listener: RefSubscriber): Unsubscribe;
|
|
172
174
|
valueIsNull(): boolean;
|
|
173
175
|
originalValueIsNull(): boolean;
|
|
174
176
|
load(): Promise<valueType>;
|
|
175
|
-
target
|
|
177
|
+
target?: ClassType<any>;
|
|
176
178
|
reportObserved(): void;
|
|
177
179
|
reportChanged(): void;
|
|
178
|
-
get error(): string;
|
|
179
|
-
set error(error: string);
|
|
180
|
+
get error(): string | undefined;
|
|
181
|
+
set error(error: string | undefined);
|
|
180
182
|
get displayValue(): string;
|
|
181
183
|
get value(): any;
|
|
182
184
|
set value(value: any);
|
|
@@ -223,7 +225,7 @@ export declare const CaptionTransformer: {
|
|
|
223
225
|
*/
|
|
224
226
|
transformCaption: (remult: Remult, key: string, caption: string, entityMetaData: EntityMetadata<any>) => string;
|
|
225
227
|
};
|
|
226
|
-
export declare function buildCaption(caption: string | ((remult: Remult) => string), key: string, remult: Remult, metaData: EntityMetadata<any>): string;
|
|
228
|
+
export declare function buildCaption(caption: string | ((remult: Remult) => string) | undefined, key: string, remult: Remult, metaData: EntityMetadata<any>): string;
|
|
227
229
|
export declare class columnDefsImpl implements FieldMetadata {
|
|
228
230
|
private settings;
|
|
229
231
|
private entityDefs;
|
|
@@ -249,13 +251,13 @@ export declare class columnDefsImpl implements FieldMetadata {
|
|
|
249
251
|
valueType: any;
|
|
250
252
|
}
|
|
251
253
|
declare class EntityFullInfo<T> implements EntityMetadata<T> {
|
|
252
|
-
entityInfo: EntityOptions
|
|
254
|
+
entityInfo: EntityOptions<T>;
|
|
253
255
|
private remult;
|
|
254
256
|
readonly entityType: ClassType<T>;
|
|
255
257
|
readonly key: string;
|
|
256
258
|
options: EntityOptions<T>;
|
|
257
259
|
fieldsMetadata: FieldMetadata[];
|
|
258
|
-
constructor(columnsInfo: FieldOptions[], entityInfo: EntityOptions
|
|
260
|
+
constructor(columnsInfo: FieldOptions[], entityInfo: EntityOptions<T>, remult: Remult, entityType: ClassType<T>, key: string);
|
|
259
261
|
apiUpdateAllowed(item: T): boolean;
|
|
260
262
|
get apiReadAllowed(): boolean;
|
|
261
263
|
apiDeleteAllowed(item: T): boolean;
|
|
@@ -267,9 +269,9 @@ declare class EntityFullInfo<T> implements EntityMetadata<T> {
|
|
|
267
269
|
dbName: string;
|
|
268
270
|
caption: string;
|
|
269
271
|
}
|
|
270
|
-
export declare function FieldType<valueType = any>(...options: (FieldOptions<any, valueType> | ((options: FieldOptions<any, valueType>, remult: Remult) => void))[]): (target: any
|
|
272
|
+
export declare function FieldType<valueType = any>(...options: (FieldOptions<any, valueType> | ((options: FieldOptions<any, valueType>, remult: Remult) => void))[]): (target: any) => any;
|
|
271
273
|
export declare function isAutoIncrement(f: FieldMetadata): boolean;
|
|
272
|
-
export declare function ValueListFieldType<valueType extends ValueListItem = any>(...options: (ValueListFieldOptions<any, valueType> | ((options: FieldOptions<any, valueType>, remult: Remult) => void))[]): (type: ClassType<valueType
|
|
274
|
+
export declare function ValueListFieldType<valueType extends ValueListItem = any>(...options: (ValueListFieldOptions<any, valueType> | ((options: FieldOptions<any, valueType>, remult: Remult) => void))[]): (type: ClassType<valueType>) => void;
|
|
273
275
|
export interface ValueListFieldOptions<entityType, valueType> extends FieldOptions<entityType, valueType> {
|
|
274
276
|
getValues?: () => valueType[];
|
|
275
277
|
}
|
|
@@ -281,13 +283,13 @@ export declare class ValueListInfo<T extends ValueListItem> implements ValueConv
|
|
|
281
283
|
isNumeric: boolean;
|
|
282
284
|
private constructor();
|
|
283
285
|
getValues(): T[];
|
|
284
|
-
byId(key: any): T;
|
|
285
|
-
fromJson(val: any): T;
|
|
286
|
+
byId(key: any): T | undefined;
|
|
287
|
+
fromJson(val: any): T | undefined;
|
|
286
288
|
toJson(val: T): any;
|
|
287
|
-
fromDb(val: any): T;
|
|
289
|
+
fromDb(val: any): T | undefined;
|
|
288
290
|
toDb(val: T): any;
|
|
289
291
|
toInput(val: T, inputType: string): string;
|
|
290
|
-
fromInput(val: string, inputType: string): T;
|
|
292
|
+
fromInput(val: string, inputType: string): T | undefined | null;
|
|
291
293
|
displayValue?(val: T): string;
|
|
292
294
|
fieldTypeInDb?: string;
|
|
293
295
|
inputType?: string;
|
|
@@ -317,7 +319,7 @@ export declare class ControllerBase {
|
|
|
317
319
|
declare class SubscribableImp implements Subscribable {
|
|
318
320
|
reportChanged(): void;
|
|
319
321
|
reportObserved(): void;
|
|
320
|
-
private _subscribers
|
|
322
|
+
private _subscribers?;
|
|
321
323
|
subscribe(listener: (() => void) | {
|
|
322
324
|
reportChanged: () => void;
|
|
323
325
|
reportObserved: () => void;
|