remult 0.22.7-exp.0 → 0.22.7
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 +25 -25
- package/SseSubscriptionServer.js +145 -145
- package/ably.d.ts +13 -13
- package/ably.js +59 -59
- package/assign.d.ts +1 -1
- package/assign.js +9 -9
- package/classType.d.ts +3 -3
- package/classType.js +2 -2
- package/esm/SseSubscriptionServer.d.ts +25 -25
- package/esm/SseSubscriptionServer.js +107 -104
- package/esm/ably.d.ts +13 -13
- package/esm/ably.js +30 -28
- package/esm/assign.d.ts +1 -1
- package/esm/assign.js +5 -5
- package/esm/classType.d.ts +3 -3
- package/esm/classType.js +1 -1
- package/esm/graphql.d.ts +14 -14
- package/esm/graphql.js +785 -785
- package/esm/index.d.ts +31 -31
- package/esm/index.js +25 -25
- package/esm/inputTypes.d.ts +9 -9
- package/esm/inputTypes.js +9 -9
- package/esm/live-query/data-provider-live-query-storage.d.ts +23 -23
- package/esm/live-query/data-provider-live-query-storage.js +91 -93
- package/esm/myLog.d.ts +1 -1
- package/esm/myLog.js +5 -5
- package/esm/postgres/index.d.ts +2 -2
- package/esm/postgres/index.js +2 -2
- package/esm/postgres/postgres-data-provider.d.ts +36 -36
- package/esm/postgres/postgres-data-provider.js +126 -122
- package/esm/postgres/schema-builder.d.ts +19 -19
- package/esm/postgres/schema-builder.js +197 -196
- package/esm/remult-express.d.ts +9 -9
- package/esm/remult-express.js +26 -25
- package/esm/remult-fastify.d.ts +6 -6
- package/esm/remult-fastify.js +68 -68
- package/esm/remult-fresh.d.ts +17 -17
- package/esm/remult-fresh.js +26 -26
- package/esm/remult-knex/index.d.ts +30 -30
- package/esm/remult-knex/index.js +466 -460
- package/esm/remult-mongo.d.ts +24 -24
- package/esm/remult-mongo.js +269 -262
- package/esm/remult-next.d.ts +25 -25
- package/esm/remult-next.js +114 -114
- package/esm/remult-sveltekit.d.ts +4 -4
- package/esm/remult-sveltekit.js +71 -71
- package/esm/server/JsonEntityFileStorage.d.ts +11 -11
- package/esm/server/JsonEntityFileStorage.js +27 -26
- package/esm/server/core.d.ts +4 -4
- package/esm/server/core.js +4 -4
- package/esm/server/expressBridge.d.ts +128 -128
- package/esm/server/expressBridge.js +988 -971
- package/esm/server/index.d.ts +6 -6
- package/esm/server/index.js +12 -12
- package/esm/server/initAsyncHooks.d.ts +1 -1
- package/esm/server/initAsyncHooks.js +9 -9
- package/esm/server/initDataProvider.d.ts +2 -2
- package/esm/server/initDataProvider.js +14 -14
- package/esm/src/CompoundIdField.d.ts +27 -27
- package/esm/src/CompoundIdField.js +54 -41
- package/esm/src/__EntityValueProvider.d.ts +11 -11
- package/esm/src/__EntityValueProvider.js +1 -1
- package/esm/src/__RowsOfDataForTesting.d.ts +3 -3
- package/esm/src/__RowsOfDataForTesting.js +1 -1
- package/esm/src/buildRestDataProvider.d.ts +31 -31
- package/esm/src/buildRestDataProvider.js +121 -120
- package/esm/src/column-interfaces.d.ts +160 -160
- package/esm/src/column-interfaces.js +7 -7
- package/esm/src/column.d.ts +31 -31
- package/esm/src/column.js +108 -101
- package/esm/src/context.d.ts +134 -134
- package/esm/src/context.js +287 -282
- package/esm/src/data-api.d.ts +38 -38
- package/esm/src/data-api.js +281 -279
- package/esm/src/data-interfaces.d.ts +41 -41
- package/esm/src/data-interfaces.js +12 -12
- package/esm/src/data-providers/array-entity-data-provider.d.ts +22 -22
- package/esm/src/data-providers/array-entity-data-provider.js +252 -249
- package/esm/src/data-providers/in-memory-database.d.ts +9 -9
- package/esm/src/data-providers/in-memory-database.js +16 -18
- package/esm/src/data-providers/json-data-provider.d.ts +12 -12
- package/esm/src/data-providers/json-data-provider.js +55 -52
- package/esm/src/data-providers/rest-data-provider.d.ts +39 -39
- package/esm/src/data-providers/rest-data-provider.js +272 -267
- package/esm/src/data-providers/sql-database.d.ts +33 -33
- package/esm/src/data-providers/sql-database.js +401 -394
- package/esm/src/data-providers/web-sql-data-provider.d.ts +21 -21
- package/esm/src/data-providers/web-sql-data-provider.js +145 -137
- package/esm/src/entity.d.ts +95 -95
- package/esm/src/entity.js +1 -1
- package/esm/src/filter/filter-consumer-bridge-to-sql-request.d.ts +50 -50
- package/esm/src/filter/filter-consumer-bridge-to-sql-request.js +165 -162
- package/esm/src/filter/filter-interfaces.d.ts +86 -86
- package/esm/src/filter/filter-interfaces.js +524 -515
- package/esm/src/live-query/LiveQueryClient.d.ts +1 -1
- package/esm/src/live-query/LiveQueryClient.js +196 -192
- package/esm/src/live-query/SseSubscriptionClient.d.ts +5 -5
- package/esm/src/live-query/SseSubscriptionClient.js +86 -86
- package/esm/src/live-query/SubscriptionChannel.d.ts +41 -41
- package/esm/src/live-query/SubscriptionChannel.js +126 -121
- package/esm/src/live-query/SubscriptionServer.d.ts +38 -38
- package/esm/src/live-query/SubscriptionServer.js +114 -112
- package/esm/src/remult-proxy.d.ts +2 -2
- package/esm/src/remult-proxy.js +177 -178
- package/esm/src/remult3/DecoratorReplacer.d.ts +10 -10
- package/esm/src/remult3/DecoratorReplacer.js +20 -20
- package/esm/src/remult3/RepositoryImplementation.d.ts +332 -332
- package/esm/src/remult3/RepositoryImplementation.js +2122 -2051
- package/esm/src/remult3/__updateEntityBasedOnWhere.d.ts +2 -2
- package/esm/src/remult3/__updateEntityBasedOnWhere.js +24 -24
- package/esm/src/remult3/entity.d.ts +28 -28
- package/esm/src/remult3/entity.js +70 -70
- package/esm/src/remult3/getEntityRef.d.ts +9 -9
- package/esm/src/remult3/getEntityRef.js +27 -27
- package/esm/src/remult3/remult3.d.ts +397 -397
- package/esm/src/remult3/remult3.js +1 -1
- package/esm/src/resultCompoundIdFilter.d.ts +3 -3
- package/esm/src/resultCompoundIdFilter.js +16 -16
- package/esm/src/server-action-info.d.ts +10 -10
- package/esm/src/server-action-info.js +12 -12
- package/esm/src/server-action.d.ts +79 -79
- package/esm/src/server-action.js +397 -387
- package/esm/src/sort.d.ts +16 -16
- package/esm/src/sort.js +105 -104
- package/esm/src/sql-command.d.ts +19 -19
- package/esm/src/sql-command.js +1 -1
- package/esm/src/validators.d.ts +14 -14
- package/esm/src/validators.js +36 -36
- package/esm/src/valueConverters.d.ts +13 -13
- package/esm/src/valueConverters.js +210 -210
- package/esm/urlBuilder.d.ts +6 -6
- package/esm/urlBuilder.js +20 -19
- package/graphql.d.ts +14 -14
- package/graphql.js +953 -953
- package/index.d.ts +31 -31
- package/index.js +67 -67
- package/inputTypes.d.ts +9 -9
- package/inputTypes.js +16 -16
- package/live-query/data-provider-live-query-storage.d.ts +23 -23
- package/live-query/data-provider-live-query-storage.js +263 -263
- package/myLog.d.ts +1 -1
- package/myLog.js +20 -20
- package/package.json +1 -1
- package/postgres/index.d.ts +2 -2
- package/postgres/index.js +5 -5
- package/postgres/postgres-data-provider.d.ts +36 -36
- package/postgres/postgres-data-provider.js +191 -191
- package/postgres/schema-builder.d.ts +19 -19
- package/postgres/schema-builder.js +369 -369
- package/remult-express.d.ts +9 -9
- package/remult-express.js +34 -33
- package/remult-fastify.d.ts +6 -6
- package/remult-fastify.js +79 -79
- package/remult-fresh.d.ts +17 -17
- package/remult-fresh.js +41 -41
- package/remult-knex/index.d.ts +30 -30
- package/remult-knex/index.js +917 -915
- package/remult-mongo.d.ts +24 -24
- package/remult-mongo.js +515 -515
- package/remult-next.d.ts +25 -25
- package/remult-next.js +171 -171
- package/remult-sveltekit.d.ts +4 -4
- package/remult-sveltekit.js +110 -110
- package/server/JsonEntityFileStorage.d.ts +11 -11
- package/server/JsonEntityFileStorage.js +35 -35
- package/server/core.d.ts +4 -4
- package/server/core.js +12 -12
- package/server/expressBridge.d.ts +128 -128
- package/server/expressBridge.js +1401 -1402
- package/server/index.d.ts +6 -6
- package/server/index.js +24 -24
- package/server/initAsyncHooks.d.ts +1 -1
- package/server/initAsyncHooks.js +13 -13
- package/server/initDataProvider.d.ts +2 -2
- package/server/initDataProvider.js +26 -26
- package/src/CompoundIdField.d.ts +27 -27
- package/src/CompoundIdField.js +54 -54
- package/src/__EntityValueProvider.d.ts +11 -11
- package/src/__EntityValueProvider.js +2 -2
- package/src/__RowsOfDataForTesting.d.ts +3 -3
- package/src/__RowsOfDataForTesting.js +2 -2
- package/src/buildRestDataProvider.d.ts +31 -31
- package/src/buildRestDataProvider.js +177 -174
- package/src/column-interfaces.d.ts +160 -160
- package/src/column-interfaces.js +11 -11
- package/src/column.d.ts +31 -31
- package/src/column.js +132 -132
- package/src/context.d.ts +134 -134
- package/src/context.js +451 -451
- package/src/data-api.d.ts +38 -38
- package/src/data-api.js +524 -524
- package/src/data-interfaces.d.ts +41 -41
- package/src/data-interfaces.js +16 -16
- package/src/data-providers/array-entity-data-provider.d.ts +22 -22
- package/src/data-providers/array-entity-data-provider.js +364 -364
- package/src/data-providers/in-memory-database.d.ts +9 -9
- package/src/data-providers/in-memory-database.js +33 -33
- package/src/data-providers/json-data-provider.d.ts +12 -12
- package/src/data-providers/json-data-provider.js +106 -106
- package/src/data-providers/rest-data-provider.d.ts +39 -39
- package/src/data-providers/rest-data-provider.js +388 -388
- package/src/data-providers/sql-database.d.ts +33 -33
- package/src/data-providers/sql-database.js +653 -653
- package/src/data-providers/web-sql-data-provider.d.ts +21 -21
- package/src/data-providers/web-sql-data-provider.js +229 -229
- package/src/entity.d.ts +95 -95
- package/src/entity.js +2 -2
- package/src/filter/filter-consumer-bridge-to-sql-request.d.ts +50 -50
- package/src/filter/filter-consumer-bridge-to-sql-request.js +307 -307
- package/src/filter/filter-interfaces.d.ts +86 -86
- package/src/filter/filter-interfaces.js +693 -685
- package/src/live-query/LiveQueryClient.d.ts +1 -1
- package/src/live-query/LiveQueryClient.js +293 -293
- package/src/live-query/SseSubscriptionClient.d.ts +5 -5
- package/src/live-query/SseSubscriptionClient.js +154 -154
- package/src/live-query/SubscriptionChannel.d.ts +41 -41
- package/src/live-query/SubscriptionChannel.js +189 -189
- package/src/live-query/SubscriptionServer.d.ts +38 -38
- package/src/live-query/SubscriptionServer.js +264 -264
- package/src/remult-proxy.d.ts +2 -2
- package/src/remult-proxy.js +307 -307
- package/src/remult3/DecoratorReplacer.d.ts +10 -10
- package/src/remult3/DecoratorReplacer.js +24 -24
- package/src/remult3/RepositoryImplementation.d.ts +332 -332
- package/src/remult3/RepositoryImplementation.js +3391 -3373
- package/src/remult3/__updateEntityBasedOnWhere.d.ts +2 -2
- package/src/remult3/__updateEntityBasedOnWhere.js +28 -28
- package/src/remult3/entity.d.ts +28 -28
- package/src/remult3/entity.js +88 -88
- package/src/remult3/getEntityRef.d.ts +9 -9
- package/src/remult3/getEntityRef.js +35 -35
- package/src/remult3/remult3.d.ts +397 -397
- package/src/remult3/remult3.js +2 -2
- package/src/resultCompoundIdFilter.d.ts +3 -3
- package/src/resultCompoundIdFilter.js +20 -20
- package/src/server-action-info.d.ts +10 -10
- package/src/server-action-info.js +15 -15
- package/src/server-action.d.ts +79 -79
- package/src/server-action.js +632 -632
- package/src/sort.d.ts +16 -16
- package/src/sort.js +161 -161
- package/src/sql-command.d.ts +19 -19
- package/src/sql-command.js +2 -2
- package/src/validators.d.ts +14 -14
- package/src/validators.js +71 -69
- package/src/valueConverters.d.ts +13 -13
- package/src/valueConverters.js +213 -213
- package/urlBuilder.d.ts +6 -6
- package/urlBuilder.js +25 -25
package/src/column.js
CHANGED
|
@@ -1,132 +1,132 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OneToMany = exports.LookupColumn = exports.makeTitle = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var assign_1 = require("../assign");
|
|
6
|
-
var __updateEntityBasedOnWhere_1 = require("./remult3/__updateEntityBasedOnWhere");
|
|
7
|
-
var getEntityRef_1 = require("./remult3/getEntityRef");
|
|
8
|
-
function makeTitle(name) {
|
|
9
|
-
// insert a space before all caps
|
|
10
|
-
return (name
|
|
11
|
-
.replace(/([A-Z])/g, ' $1')
|
|
12
|
-
// uppercase the first character
|
|
13
|
-
.replace(/^./, function (str) { return str.toUpperCase(); })
|
|
14
|
-
.replace('Email', 'eMail')
|
|
15
|
-
.replace(' I D', ' ID'));
|
|
16
|
-
}
|
|
17
|
-
exports.makeTitle = makeTitle;
|
|
18
|
-
var LookupColumn = /** @class */ (function () {
|
|
19
|
-
function LookupColumn(repository, id) {
|
|
20
|
-
this.repository = repository;
|
|
21
|
-
this.id = id;
|
|
22
|
-
}
|
|
23
|
-
LookupColumn.prototype.toJson = function () {
|
|
24
|
-
if (this.item === null)
|
|
25
|
-
return null;
|
|
26
|
-
return this.repository.toJson(this.item);
|
|
27
|
-
};
|
|
28
|
-
LookupColumn.prototype.setId = function (val) {
|
|
29
|
-
if (this.repository.metadata.idMetadata.field.valueType == Number)
|
|
30
|
-
val = +val;
|
|
31
|
-
this.id = val;
|
|
32
|
-
};
|
|
33
|
-
LookupColumn.prototype.waitLoadOf = function (id) {
|
|
34
|
-
if (id === undefined || id === null)
|
|
35
|
-
return null;
|
|
36
|
-
return this.repository.getCachedByIdAsync(id);
|
|
37
|
-
};
|
|
38
|
-
LookupColumn.prototype.get = function (id) {
|
|
39
|
-
if (id === undefined || id === null)
|
|
40
|
-
return null;
|
|
41
|
-
return this.repository.getCachedById(id);
|
|
42
|
-
};
|
|
43
|
-
LookupColumn.prototype.set = function (item) {
|
|
44
|
-
this.storedItem = undefined;
|
|
45
|
-
if (item) {
|
|
46
|
-
if (typeof item === 'string' || typeof item === 'number')
|
|
47
|
-
this.id = item;
|
|
48
|
-
else {
|
|
49
|
-
var eo = getEntityRef_1.getEntityRef(item, false);
|
|
50
|
-
if (eo) {
|
|
51
|
-
this.repository.addToCache(item);
|
|
52
|
-
this.id = eo.getId();
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
this.storedItem = { item: item };
|
|
56
|
-
this.id = item[this.repository.metadata.idMetadata.field.key];
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
else if (item === null) {
|
|
61
|
-
this.id = null;
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
this.id = undefined;
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
Object.defineProperty(LookupColumn.prototype, "item", {
|
|
68
|
-
get: function () {
|
|
69
|
-
if (this.storedItem)
|
|
70
|
-
return this.storedItem.item;
|
|
71
|
-
return this.get(this.id);
|
|
72
|
-
},
|
|
73
|
-
enumerable: false,
|
|
74
|
-
configurable: true
|
|
75
|
-
});
|
|
76
|
-
LookupColumn.prototype.waitLoad = function () {
|
|
77
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
78
|
-
return tslib_1.__generator(this, function (_a) {
|
|
79
|
-
return [2 /*return*/, this.waitLoadOf(this.id)];
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
return LookupColumn;
|
|
84
|
-
}());
|
|
85
|
-
exports.LookupColumn = LookupColumn;
|
|
86
|
-
9000;
|
|
87
|
-
var OneToMany = /** @class */ (function () {
|
|
88
|
-
function OneToMany(provider, settings) {
|
|
89
|
-
this.provider = provider;
|
|
90
|
-
this.settings = settings;
|
|
91
|
-
}
|
|
92
|
-
Object.defineProperty(OneToMany.prototype, "lazyItems", {
|
|
93
|
-
get: function () {
|
|
94
|
-
this.load();
|
|
95
|
-
return this._items;
|
|
96
|
-
},
|
|
97
|
-
enumerable: false,
|
|
98
|
-
configurable: true
|
|
99
|
-
});
|
|
100
|
-
OneToMany.prototype.load = function () {
|
|
101
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
102
|
-
var _this = this;
|
|
103
|
-
return tslib_1.__generator(this, function (_a) {
|
|
104
|
-
if (this._currentPromise != null)
|
|
105
|
-
return [2 /*return*/, this._currentPromise];
|
|
106
|
-
if (this._items === undefined)
|
|
107
|
-
this._items = [];
|
|
108
|
-
return [2 /*return*/, (this._currentPromise = this.find().then(function (x) {
|
|
109
|
-
var _a;
|
|
110
|
-
_this._items.splice(0);
|
|
111
|
-
(_a = _this._items).push.apply(_a, tslib_1.
|
|
112
|
-
return _this._items;
|
|
113
|
-
}))];
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
};
|
|
117
|
-
OneToMany.prototype.find = function () {
|
|
118
|
-
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
119
|
-
return tslib_1.__generator(this, function (_a) {
|
|
120
|
-
return [2 /*return*/, this.provider.find(this.settings)];
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
OneToMany.prototype.create = function (item) {
|
|
125
|
-
var r = this.provider.create();
|
|
126
|
-
__updateEntityBasedOnWhere_1.__updateEntityBasedOnWhere(this.provider.metadata, this.settings.where, r);
|
|
127
|
-
assign_1.assign(r, item);
|
|
128
|
-
return r;
|
|
129
|
-
};
|
|
130
|
-
return OneToMany;
|
|
131
|
-
}());
|
|
132
|
-
exports.OneToMany = OneToMany;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OneToMany = exports.LookupColumn = exports.makeTitle = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var assign_1 = require("../assign");
|
|
6
|
+
var __updateEntityBasedOnWhere_1 = require("./remult3/__updateEntityBasedOnWhere");
|
|
7
|
+
var getEntityRef_1 = require("./remult3/getEntityRef");
|
|
8
|
+
function makeTitle(name) {
|
|
9
|
+
// insert a space before all caps
|
|
10
|
+
return (name
|
|
11
|
+
.replace(/([A-Z])/g, ' $1')
|
|
12
|
+
// uppercase the first character
|
|
13
|
+
.replace(/^./, function (str) { return str.toUpperCase(); })
|
|
14
|
+
.replace('Email', 'eMail')
|
|
15
|
+
.replace(' I D', ' ID'));
|
|
16
|
+
}
|
|
17
|
+
exports.makeTitle = makeTitle;
|
|
18
|
+
var LookupColumn = /** @class */ (function () {
|
|
19
|
+
function LookupColumn(repository, id) {
|
|
20
|
+
this.repository = repository;
|
|
21
|
+
this.id = id;
|
|
22
|
+
}
|
|
23
|
+
LookupColumn.prototype.toJson = function () {
|
|
24
|
+
if (this.item === null)
|
|
25
|
+
return null;
|
|
26
|
+
return this.repository.toJson(this.item);
|
|
27
|
+
};
|
|
28
|
+
LookupColumn.prototype.setId = function (val) {
|
|
29
|
+
if (this.repository.metadata.idMetadata.field.valueType == Number)
|
|
30
|
+
val = +val;
|
|
31
|
+
this.id = val;
|
|
32
|
+
};
|
|
33
|
+
LookupColumn.prototype.waitLoadOf = function (id) {
|
|
34
|
+
if (id === undefined || id === null)
|
|
35
|
+
return null;
|
|
36
|
+
return this.repository.getCachedByIdAsync(id);
|
|
37
|
+
};
|
|
38
|
+
LookupColumn.prototype.get = function (id) {
|
|
39
|
+
if (id === undefined || id === null)
|
|
40
|
+
return null;
|
|
41
|
+
return this.repository.getCachedById(id);
|
|
42
|
+
};
|
|
43
|
+
LookupColumn.prototype.set = function (item) {
|
|
44
|
+
this.storedItem = undefined;
|
|
45
|
+
if (item) {
|
|
46
|
+
if (typeof item === 'string' || typeof item === 'number')
|
|
47
|
+
this.id = item;
|
|
48
|
+
else {
|
|
49
|
+
var eo = (0, getEntityRef_1.getEntityRef)(item, false);
|
|
50
|
+
if (eo) {
|
|
51
|
+
this.repository.addToCache(item);
|
|
52
|
+
this.id = eo.getId();
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
this.storedItem = { item: item };
|
|
56
|
+
this.id = item[this.repository.metadata.idMetadata.field.key];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else if (item === null) {
|
|
61
|
+
this.id = null;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
this.id = undefined;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
Object.defineProperty(LookupColumn.prototype, "item", {
|
|
68
|
+
get: function () {
|
|
69
|
+
if (this.storedItem)
|
|
70
|
+
return this.storedItem.item;
|
|
71
|
+
return this.get(this.id);
|
|
72
|
+
},
|
|
73
|
+
enumerable: false,
|
|
74
|
+
configurable: true
|
|
75
|
+
});
|
|
76
|
+
LookupColumn.prototype.waitLoad = function () {
|
|
77
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
78
|
+
return tslib_1.__generator(this, function (_a) {
|
|
79
|
+
return [2 /*return*/, this.waitLoadOf(this.id)];
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
return LookupColumn;
|
|
84
|
+
}());
|
|
85
|
+
exports.LookupColumn = LookupColumn;
|
|
86
|
+
9000;
|
|
87
|
+
var OneToMany = /** @class */ (function () {
|
|
88
|
+
function OneToMany(provider, settings) {
|
|
89
|
+
this.provider = provider;
|
|
90
|
+
this.settings = settings;
|
|
91
|
+
}
|
|
92
|
+
Object.defineProperty(OneToMany.prototype, "lazyItems", {
|
|
93
|
+
get: function () {
|
|
94
|
+
this.load();
|
|
95
|
+
return this._items;
|
|
96
|
+
},
|
|
97
|
+
enumerable: false,
|
|
98
|
+
configurable: true
|
|
99
|
+
});
|
|
100
|
+
OneToMany.prototype.load = function () {
|
|
101
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
102
|
+
var _this = this;
|
|
103
|
+
return tslib_1.__generator(this, function (_a) {
|
|
104
|
+
if (this._currentPromise != null)
|
|
105
|
+
return [2 /*return*/, this._currentPromise];
|
|
106
|
+
if (this._items === undefined)
|
|
107
|
+
this._items = [];
|
|
108
|
+
return [2 /*return*/, (this._currentPromise = this.find().then(function (x) {
|
|
109
|
+
var _a;
|
|
110
|
+
_this._items.splice(0);
|
|
111
|
+
(_a = _this._items).push.apply(_a, tslib_1.__spreadArray([], tslib_1.__read(x), false));
|
|
112
|
+
return _this._items;
|
|
113
|
+
}))];
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
OneToMany.prototype.find = function () {
|
|
118
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
119
|
+
return tslib_1.__generator(this, function (_a) {
|
|
120
|
+
return [2 /*return*/, this.provider.find(this.settings)];
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
OneToMany.prototype.create = function (item) {
|
|
125
|
+
var r = this.provider.create();
|
|
126
|
+
(0, __updateEntityBasedOnWhere_1.__updateEntityBasedOnWhere)(this.provider.metadata, this.settings.where, r);
|
|
127
|
+
(0, assign_1.assign)(r, item);
|
|
128
|
+
return r;
|
|
129
|
+
};
|
|
130
|
+
return OneToMany;
|
|
131
|
+
}());
|
|
132
|
+
exports.OneToMany = OneToMany;
|
package/src/context.d.ts
CHANGED
|
@@ -1,134 +1,134 @@
|
|
|
1
|
-
import type { ClassType } from '../classType';
|
|
2
|
-
import type { DataProvider } from './data-interfaces';
|
|
3
|
-
import type { EntityMetadata, EntityRef, FindOptions, Repository } from './remult3/remult3';
|
|
4
|
-
import type { ExternalHttpProvider } from './buildRestDataProvider';
|
|
5
|
-
import type { SubscriptionClient, Unsubscribe } from './live-query/SubscriptionChannel';
|
|
6
|
-
import type { SubscriptionServer } from './live-query/SubscriptionServer';
|
|
7
|
-
export declare class RemultAsyncLocalStorage {
|
|
8
|
-
private readonly remultObjectStorage;
|
|
9
|
-
static enable(): void;
|
|
10
|
-
static disable(): void;
|
|
11
|
-
constructor(remultObjectStorage: myAsyncLocalStorage<Remult>);
|
|
12
|
-
run(remult: Remult, callback: VoidFunction): void;
|
|
13
|
-
getRemult(): Remult;
|
|
14
|
-
static instance: RemultAsyncLocalStorage;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
run<R>(store: T, callback: (...args: any[]) => R, ...args: any[]): R;
|
|
18
|
-
getStore(): T;
|
|
19
|
-
};
|
|
20
|
-
export declare function isBackend(): boolean;
|
|
21
|
-
export declare class Remult {
|
|
22
|
-
/**Return's a `Repository` of the specific entity type
|
|
23
|
-
* @example
|
|
24
|
-
* const taskRepo = remult.repo(Task);
|
|
25
|
-
* @see [Repository](https://remult.dev/docs/ref_repository.html)
|
|
26
|
-
* @param entity - the entity to use
|
|
27
|
-
* @param dataProvider - an optional alternative data provider to use. Useful for writing to offline storage or an alternative data provider
|
|
28
|
-
*/
|
|
29
|
-
repo<T>(entity: ClassType<T>, dataProvider?: DataProvider): Repository<T>;
|
|
30
|
-
/** Returns the current user's info */
|
|
31
|
-
user?: UserInfo;
|
|
32
|
-
/** Checks if a user was authenticated */
|
|
33
|
-
authenticated(): boolean;
|
|
34
|
-
/** checks if the user has any of the roles specified in the parameters
|
|
35
|
-
* @example
|
|
36
|
-
* remult.isAllowed("admin")
|
|
37
|
-
* @see
|
|
38
|
-
* [Allowed](https://remult.dev/docs/allowed.html)
|
|
39
|
-
*/
|
|
40
|
-
isAllowed(roles?: Allowed): boolean;
|
|
41
|
-
/** checks if the user matches the allowedForInstance callback
|
|
42
|
-
* @see
|
|
43
|
-
* [Allowed](https://remult.dev/docs/allowed.html)
|
|
44
|
-
*/
|
|
45
|
-
isAllowedForInstance(instance: any, allowed?: AllowedForInstance<any>): boolean;
|
|
46
|
-
/** The current data provider */
|
|
47
|
-
dataProvider: DataProvider;
|
|
48
|
-
/** Creates a new instance of the `remult` object.
|
|
49
|
-
*
|
|
50
|
-
* Can receive either an HttpProvider or a DataProvider as a parameter - which will be used to fetch data from.
|
|
51
|
-
*
|
|
52
|
-
* If no provider is specified, `fetch` will be used as an http provider
|
|
53
|
-
*/
|
|
54
|
-
constructor(http: ExternalHttpProvider | typeof fetch | ApiClient);
|
|
55
|
-
constructor(p: DataProvider);
|
|
56
|
-
constructor();
|
|
57
|
-
subscriptionServer?: SubscriptionServer;
|
|
58
|
-
/** Used to call a `backendMethod` using a specific `remult` object
|
|
59
|
-
* @example
|
|
60
|
-
* await remult.call(TasksController.setAll, undefined, true);
|
|
61
|
-
* @param backendMethod - the backend method to call
|
|
62
|
-
* @param classInstance - the class instance of the backend method, for static backend methods use undefined
|
|
63
|
-
* @param args - the arguments to send to the backend method
|
|
64
|
-
*/
|
|
65
|
-
call<T extends (...args: any[]) => Promise<any>>(backendMethod: T, classInstance?: any, ...args: GetArguments<T>): ReturnType<T>;
|
|
66
|
-
/** A helper callback that can be used to debug and trace all find operations. Useful in debugging scenarios */
|
|
67
|
-
static onFind: (metadata: EntityMetadata, options: FindOptions<any>) => void;
|
|
68
|
-
clearAllCache(): any;
|
|
69
|
-
/** A helper callback that is called whenever an entity is created. */
|
|
70
|
-
static entityRefInit?: (ref: EntityRef<any>, row: any) => void;
|
|
71
|
-
/** context information that can be used to store custom information that will be disposed as part of the `remult` object */
|
|
72
|
-
readonly context: RemultContext;
|
|
73
|
-
/** The api client that will be used by `remult` to perform calls to the `api` */
|
|
74
|
-
apiClient: ApiClient;
|
|
75
|
-
static run<T>(callback: () => T, options: {
|
|
76
|
-
dataProvider: DataProvider;
|
|
77
|
-
}): T;
|
|
78
|
-
}
|
|
79
|
-
export
|
|
80
|
-
export interface RemultContext {
|
|
81
|
-
}
|
|
82
|
-
export interface ApiClient {
|
|
83
|
-
/** The http client to use when making api calls.
|
|
84
|
-
* @example
|
|
85
|
-
* remult.apiClient.httpClient = axios;
|
|
86
|
-
* @example
|
|
87
|
-
* remult.apiClient.httpClient = httpClient;//angular http client
|
|
88
|
-
* @example
|
|
89
|
-
* remult.apiClient.httpClient = fetch; //this is the default
|
|
90
|
-
*/
|
|
91
|
-
httpClient?: ExternalHttpProvider | typeof fetch;
|
|
92
|
-
/** The base url to for making api calls */
|
|
93
|
-
url?: string;
|
|
94
|
-
subscriptionClient?: SubscriptionClient;
|
|
95
|
-
wrapMessageHandling?: (x: VoidFunction) => void;
|
|
96
|
-
}
|
|
97
|
-
export declare const allEntities: ClassType<any>[];
|
|
98
|
-
export interface ControllerOptions {
|
|
99
|
-
key: string;
|
|
100
|
-
}
|
|
101
|
-
export declare const classHelpers: Map<any, ClassHelper>;
|
|
102
|
-
export declare class ClassHelper {
|
|
103
|
-
classes: Map<any, ControllerOptions>;
|
|
104
|
-
}
|
|
105
|
-
export declare function setControllerSettings(target: any, options: ControllerOptions): void;
|
|
106
|
-
export interface UserInfo {
|
|
107
|
-
id: string;
|
|
108
|
-
name?: string;
|
|
109
|
-
roles?: string[];
|
|
110
|
-
}
|
|
111
|
-
export declare type Allowed = boolean | string | string[] | ((c?: Remult) => boolean);
|
|
112
|
-
export declare type AllowedForInstance<T> = boolean | string | string[] | ((entity?: T, c?: Remult) => boolean);
|
|
113
|
-
export declare class Allow {
|
|
114
|
-
static everyone: () => boolean;
|
|
115
|
-
static authenticated: (...args: any[]) => any;
|
|
116
|
-
}
|
|
117
|
-
export declare const queryConfig: {
|
|
118
|
-
defaultPageSize: number;
|
|
119
|
-
};
|
|
120
|
-
export interface EventDispatcher {
|
|
121
|
-
observe(what: () => any | Promise<any>): Promise<Unsubscribe>;
|
|
122
|
-
}
|
|
123
|
-
export declare class EventSource {
|
|
124
|
-
listeners: (() => {})[];
|
|
125
|
-
fire(): Promise<void>;
|
|
126
|
-
dispatcher: EventDispatcher;
|
|
127
|
-
}
|
|
128
|
-
export interface itemChange {
|
|
129
|
-
id: any;
|
|
130
|
-
oldId: any;
|
|
131
|
-
deleted: boolean;
|
|
132
|
-
}
|
|
133
|
-
export declare function doTransaction(remult: Remult, what: () => Promise<void>): Promise<void>;
|
|
134
|
-
export {};
|
|
1
|
+
import type { ClassType } from '../classType';
|
|
2
|
+
import type { DataProvider } from './data-interfaces';
|
|
3
|
+
import type { EntityMetadata, EntityRef, FindOptions, Repository } from './remult3/remult3';
|
|
4
|
+
import type { ExternalHttpProvider } from './buildRestDataProvider';
|
|
5
|
+
import type { SubscriptionClient, Unsubscribe } from './live-query/SubscriptionChannel';
|
|
6
|
+
import type { SubscriptionServer } from './live-query/SubscriptionServer';
|
|
7
|
+
export declare class RemultAsyncLocalStorage {
|
|
8
|
+
private readonly remultObjectStorage;
|
|
9
|
+
static enable(): void;
|
|
10
|
+
static disable(): void;
|
|
11
|
+
constructor(remultObjectStorage: myAsyncLocalStorage<Remult>);
|
|
12
|
+
run(remult: Remult, callback: VoidFunction): void;
|
|
13
|
+
getRemult(): Remult;
|
|
14
|
+
static instance: RemultAsyncLocalStorage;
|
|
15
|
+
}
|
|
16
|
+
type myAsyncLocalStorage<T> = {
|
|
17
|
+
run<R>(store: T, callback: (...args: any[]) => R, ...args: any[]): R;
|
|
18
|
+
getStore(): T;
|
|
19
|
+
};
|
|
20
|
+
export declare function isBackend(): boolean;
|
|
21
|
+
export declare class Remult {
|
|
22
|
+
/**Return's a `Repository` of the specific entity type
|
|
23
|
+
* @example
|
|
24
|
+
* const taskRepo = remult.repo(Task);
|
|
25
|
+
* @see [Repository](https://remult.dev/docs/ref_repository.html)
|
|
26
|
+
* @param entity - the entity to use
|
|
27
|
+
* @param dataProvider - an optional alternative data provider to use. Useful for writing to offline storage or an alternative data provider
|
|
28
|
+
*/
|
|
29
|
+
repo<T>(entity: ClassType<T>, dataProvider?: DataProvider): Repository<T>;
|
|
30
|
+
/** Returns the current user's info */
|
|
31
|
+
user?: UserInfo;
|
|
32
|
+
/** Checks if a user was authenticated */
|
|
33
|
+
authenticated(): boolean;
|
|
34
|
+
/** checks if the user has any of the roles specified in the parameters
|
|
35
|
+
* @example
|
|
36
|
+
* remult.isAllowed("admin")
|
|
37
|
+
* @see
|
|
38
|
+
* [Allowed](https://remult.dev/docs/allowed.html)
|
|
39
|
+
*/
|
|
40
|
+
isAllowed(roles?: Allowed): boolean;
|
|
41
|
+
/** checks if the user matches the allowedForInstance callback
|
|
42
|
+
* @see
|
|
43
|
+
* [Allowed](https://remult.dev/docs/allowed.html)
|
|
44
|
+
*/
|
|
45
|
+
isAllowedForInstance(instance: any, allowed?: AllowedForInstance<any>): boolean;
|
|
46
|
+
/** The current data provider */
|
|
47
|
+
dataProvider: DataProvider;
|
|
48
|
+
/** Creates a new instance of the `remult` object.
|
|
49
|
+
*
|
|
50
|
+
* Can receive either an HttpProvider or a DataProvider as a parameter - which will be used to fetch data from.
|
|
51
|
+
*
|
|
52
|
+
* If no provider is specified, `fetch` will be used as an http provider
|
|
53
|
+
*/
|
|
54
|
+
constructor(http: ExternalHttpProvider | typeof fetch | ApiClient);
|
|
55
|
+
constructor(p: DataProvider);
|
|
56
|
+
constructor();
|
|
57
|
+
subscriptionServer?: SubscriptionServer;
|
|
58
|
+
/** Used to call a `backendMethod` using a specific `remult` object
|
|
59
|
+
* @example
|
|
60
|
+
* await remult.call(TasksController.setAll, undefined, true);
|
|
61
|
+
* @param backendMethod - the backend method to call
|
|
62
|
+
* @param classInstance - the class instance of the backend method, for static backend methods use undefined
|
|
63
|
+
* @param args - the arguments to send to the backend method
|
|
64
|
+
*/
|
|
65
|
+
call<T extends (...args: any[]) => Promise<any>>(backendMethod: T, classInstance?: any, ...args: GetArguments<T>): ReturnType<T>;
|
|
66
|
+
/** A helper callback that can be used to debug and trace all find operations. Useful in debugging scenarios */
|
|
67
|
+
static onFind: (metadata: EntityMetadata, options: FindOptions<any>) => void;
|
|
68
|
+
clearAllCache(): any;
|
|
69
|
+
/** A helper callback that is called whenever an entity is created. */
|
|
70
|
+
static entityRefInit?: (ref: EntityRef<any>, row: any) => void;
|
|
71
|
+
/** context information that can be used to store custom information that will be disposed as part of the `remult` object */
|
|
72
|
+
readonly context: RemultContext;
|
|
73
|
+
/** The api client that will be used by `remult` to perform calls to the `api` */
|
|
74
|
+
apiClient: ApiClient;
|
|
75
|
+
static run<T>(callback: () => T, options: {
|
|
76
|
+
dataProvider: DataProvider;
|
|
77
|
+
}): T;
|
|
78
|
+
}
|
|
79
|
+
export type GetArguments<T> = T extends (...args: infer FirstArgument) => any ? FirstArgument : never;
|
|
80
|
+
export interface RemultContext {
|
|
81
|
+
}
|
|
82
|
+
export interface ApiClient {
|
|
83
|
+
/** The http client to use when making api calls.
|
|
84
|
+
* @example
|
|
85
|
+
* remult.apiClient.httpClient = axios;
|
|
86
|
+
* @example
|
|
87
|
+
* remult.apiClient.httpClient = httpClient;//angular http client
|
|
88
|
+
* @example
|
|
89
|
+
* remult.apiClient.httpClient = fetch; //this is the default
|
|
90
|
+
*/
|
|
91
|
+
httpClient?: ExternalHttpProvider | typeof fetch;
|
|
92
|
+
/** The base url to for making api calls */
|
|
93
|
+
url?: string;
|
|
94
|
+
subscriptionClient?: SubscriptionClient;
|
|
95
|
+
wrapMessageHandling?: (x: VoidFunction) => void;
|
|
96
|
+
}
|
|
97
|
+
export declare const allEntities: ClassType<any>[];
|
|
98
|
+
export interface ControllerOptions {
|
|
99
|
+
key: string;
|
|
100
|
+
}
|
|
101
|
+
export declare const classHelpers: Map<any, ClassHelper>;
|
|
102
|
+
export declare class ClassHelper {
|
|
103
|
+
classes: Map<any, ControllerOptions>;
|
|
104
|
+
}
|
|
105
|
+
export declare function setControllerSettings(target: any, options: ControllerOptions): void;
|
|
106
|
+
export interface UserInfo {
|
|
107
|
+
id: string;
|
|
108
|
+
name?: string;
|
|
109
|
+
roles?: string[];
|
|
110
|
+
}
|
|
111
|
+
export declare type Allowed = boolean | string | string[] | ((c?: Remult) => boolean);
|
|
112
|
+
export declare type AllowedForInstance<T> = boolean | string | string[] | ((entity?: T, c?: Remult) => boolean);
|
|
113
|
+
export declare class Allow {
|
|
114
|
+
static everyone: () => boolean;
|
|
115
|
+
static authenticated: (...args: any[]) => any;
|
|
116
|
+
}
|
|
117
|
+
export declare const queryConfig: {
|
|
118
|
+
defaultPageSize: number;
|
|
119
|
+
};
|
|
120
|
+
export interface EventDispatcher {
|
|
121
|
+
observe(what: () => any | Promise<any>): Promise<Unsubscribe>;
|
|
122
|
+
}
|
|
123
|
+
export declare class EventSource {
|
|
124
|
+
listeners: (() => {})[];
|
|
125
|
+
fire(): Promise<void>;
|
|
126
|
+
dispatcher: EventDispatcher;
|
|
127
|
+
}
|
|
128
|
+
export interface itemChange {
|
|
129
|
+
id: any;
|
|
130
|
+
oldId: any;
|
|
131
|
+
deleted: boolean;
|
|
132
|
+
}
|
|
133
|
+
export declare function doTransaction(remult: Remult, what: () => Promise<void>): Promise<void>;
|
|
134
|
+
export {};
|