@vsaas/loopback 11.1.0 → 11.2.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/dist/lib/model.cjs +49 -0
- package/dist/package.cjs +1 -1
- package/package.json +5 -5
package/dist/lib/model.cjs
CHANGED
|
@@ -14,6 +14,31 @@ var require_model = /* @__PURE__ */ require_runtime.__commonJSMin(((exports, mod
|
|
|
14
14
|
const SharedClass = require("@vsaas/remoting").SharedClass;
|
|
15
15
|
const utils = require_lib_utils;
|
|
16
16
|
const deprecated = require("depd")("loopback");
|
|
17
|
+
function completeSyncRemoteHook(retval, next) {
|
|
18
|
+
if (retval && typeof retval.then === "function") {
|
|
19
|
+
retval.then(function() {
|
|
20
|
+
next();
|
|
21
|
+
return null;
|
|
22
|
+
}, next);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
next();
|
|
26
|
+
}
|
|
27
|
+
function invokeSyncRemoteHook(fn, ctx, result, next) {
|
|
28
|
+
let hasResult = true;
|
|
29
|
+
if (next === void 0) {
|
|
30
|
+
next = result;
|
|
31
|
+
result = void 0;
|
|
32
|
+
hasResult = false;
|
|
33
|
+
}
|
|
34
|
+
let retval;
|
|
35
|
+
try {
|
|
36
|
+
retval = hasResult ? fn(ctx, result) : fn(ctx);
|
|
37
|
+
} catch (err) {
|
|
38
|
+
return next(err);
|
|
39
|
+
}
|
|
40
|
+
completeSyncRemoteHook(retval, next);
|
|
41
|
+
}
|
|
17
42
|
module.exports = function(registry) {
|
|
18
43
|
/**
|
|
19
44
|
* The base class for **all models**.
|
|
@@ -188,6 +213,14 @@ var require_model = /* @__PURE__ */ require_runtime.__commonJSMin(((exports, mod
|
|
|
188
213
|
});
|
|
189
214
|
});
|
|
190
215
|
};
|
|
216
|
+
ModelCtor.beforeRemoteSync = function(name, fn) {
|
|
217
|
+
const className = this.modelName;
|
|
218
|
+
this._runWhenAttachedToApp(function(app) {
|
|
219
|
+
app.remotes().before(className + "." + name, function(ctx, next) {
|
|
220
|
+
invokeSyncRemoteHook(fn, ctx, next);
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
};
|
|
191
224
|
ModelCtor.afterRemote = function(name, fn) {
|
|
192
225
|
const className = this.modelName;
|
|
193
226
|
this._runWhenAttachedToApp(function(app) {
|
|
@@ -196,12 +229,28 @@ var require_model = /* @__PURE__ */ require_runtime.__commonJSMin(((exports, mod
|
|
|
196
229
|
});
|
|
197
230
|
});
|
|
198
231
|
};
|
|
232
|
+
ModelCtor.afterRemoteSync = function(name, fn) {
|
|
233
|
+
const className = this.modelName;
|
|
234
|
+
this._runWhenAttachedToApp(function(app) {
|
|
235
|
+
app.remotes().after(className + "." + name, function(ctx, next) {
|
|
236
|
+
invokeSyncRemoteHook(fn, ctx, ctx.result, next);
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
};
|
|
199
240
|
ModelCtor.afterRemoteError = function(name, fn) {
|
|
200
241
|
const className = this.modelName;
|
|
201
242
|
this._runWhenAttachedToApp(function(app) {
|
|
202
243
|
app.remotes().afterError(className + "." + name, fn);
|
|
203
244
|
});
|
|
204
245
|
};
|
|
246
|
+
ModelCtor.afterRemoteErrorSync = function(name, fn) {
|
|
247
|
+
const className = this.modelName;
|
|
248
|
+
this._runWhenAttachedToApp(function(app) {
|
|
249
|
+
app.remotes().afterError(className + "." + name, function(ctx, next) {
|
|
250
|
+
invokeSyncRemoteHook(fn, ctx, next);
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
};
|
|
205
254
|
ModelCtor._runWhenAttachedToApp = function(fn) {
|
|
206
255
|
if (typeof fn === "function") {
|
|
207
256
|
if (this.app) return fn(this.app);
|
package/dist/package.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var require_package = /* @__PURE__ */ require("./_virtual/_rolldown/runtime.cjs").__commonJSMin(((exports, module) => {
|
|
3
3
|
module.exports = {
|
|
4
4
|
"name": "@vsaas/loopback",
|
|
5
|
-
"version": "11.
|
|
5
|
+
"version": "11.2.0",
|
|
6
6
|
"description": "Fork of LoopBack 3 framework for building APIs and microservices in Node.js",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"StrongLoop",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vsaas/loopback",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.2.0",
|
|
4
4
|
"description": "Fork of LoopBack 3 framework for building APIs and microservices in Node.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"StrongLoop",
|
|
@@ -68,9 +68,9 @@
|
|
|
68
68
|
"loopback-filters": "^1.0.0",
|
|
69
69
|
"nodemailer": "^8.0.4",
|
|
70
70
|
"serve-favicon": "^2.2.0",
|
|
71
|
+
"@vsaas/loopback-connector-remote": "^11.0.2",
|
|
71
72
|
"@vsaas/remoting": "^11.0.2",
|
|
72
|
-
"@vsaas/loopback-datasource-juggler": "^11.0
|
|
73
|
-
"@vsaas/loopback-connector-remote": "^11.0.2"
|
|
73
|
+
"@vsaas/loopback-datasource-juggler": "^11.1.0"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@types/node": "25.5.0",
|
|
@@ -87,8 +87,8 @@
|
|
|
87
87
|
"supertest": "7.2.2",
|
|
88
88
|
"tsdown": "0.21.7",
|
|
89
89
|
"typescript": "6.0.2",
|
|
90
|
-
"vitest": "4.1.
|
|
91
|
-
"@vsaas/error-handler": "^11.0.
|
|
90
|
+
"vitest": "4.1.2",
|
|
91
|
+
"@vsaas/error-handler": "^11.0.5",
|
|
92
92
|
"@vsaas/loopback-boot": "^11.0.2"
|
|
93
93
|
},
|
|
94
94
|
"engines": {
|