feathers-ucan 0.1.40 → 0.1.42
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/lib/env/version.d.ts +1 -1
- package/lib/index.cjs +15 -3
- package/lib/index.cjs.map +1 -1
- package/lib/index.modern.js +15 -3
- package/lib/index.modern.js.map +1 -1
- package/lib/index.umd.js +15 -3
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
package/lib/env/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.
|
|
1
|
+
export declare const VERSION = "0.1.42";
|
package/lib/index.cjs
CHANGED
|
@@ -436,7 +436,6 @@ class CoreCall {
|
|
|
436
436
|
return (_this$context$app2 = this.context.app) == null ? void 0 : _this$context$app2.service(this.service).find({
|
|
437
437
|
...params,
|
|
438
438
|
[this.entity]: params[this.entity],
|
|
439
|
-
skip_hooks: true,
|
|
440
439
|
admin_pass: true,
|
|
441
440
|
...{
|
|
442
441
|
[core_path]: this.core
|
|
@@ -503,6 +502,7 @@ class CoreCall {
|
|
|
503
502
|
return (_this$context$app7 = this.context.app) == null ? void 0 : _this$context$app7.service(this.service)._get(id, {
|
|
504
503
|
...params,
|
|
505
504
|
[this.entity]: params[this.entity],
|
|
505
|
+
skip_hooks: true,
|
|
506
506
|
...{
|
|
507
507
|
[core_path]: this.core
|
|
508
508
|
}
|
|
@@ -516,6 +516,7 @@ class CoreCall {
|
|
|
516
516
|
return (_this$context$app8 = this.context.app) == null ? void 0 : _this$context$app8.service(this.service)._find({
|
|
517
517
|
...params,
|
|
518
518
|
[this.entity]: params[this.entity],
|
|
519
|
+
skip_hooks: true,
|
|
519
520
|
...{
|
|
520
521
|
[core_path]: this.core
|
|
521
522
|
}
|
|
@@ -529,6 +530,7 @@ class CoreCall {
|
|
|
529
530
|
return (_this$context$app9 = this.context.app) == null ? void 0 : _this$context$app9.service(this.service)._create(data, {
|
|
530
531
|
...params,
|
|
531
532
|
[this.entity]: params[this.entity],
|
|
533
|
+
skip_hooks: true,
|
|
532
534
|
...{
|
|
533
535
|
[core_path]: this.core
|
|
534
536
|
}
|
|
@@ -542,6 +544,7 @@ class CoreCall {
|
|
|
542
544
|
return (_this$context$app10 = this.context.app) == null ? void 0 : _this$context$app10.service(this.service)._patch(id, data, {
|
|
543
545
|
...params,
|
|
544
546
|
[this.entity]: params[this.entity],
|
|
547
|
+
skip_hooks: true,
|
|
545
548
|
...{
|
|
546
549
|
[core_path]: this.core
|
|
547
550
|
}
|
|
@@ -555,6 +558,7 @@ class CoreCall {
|
|
|
555
558
|
return (_this$context$app11 = this.context.app) == null ? void 0 : _this$context$app11.service(this.service)._update(id, data, {
|
|
556
559
|
...params,
|
|
557
560
|
[this.entity]: params[this.entity],
|
|
561
|
+
skip_hooks: true,
|
|
558
562
|
...{
|
|
559
563
|
[core_path]: this.core
|
|
560
564
|
}
|
|
@@ -568,6 +572,7 @@ class CoreCall {
|
|
|
568
572
|
return (_this$context$app12 = this.context.app) == null ? void 0 : _this$context$app12.service(this.service)._remove(id, {
|
|
569
573
|
...params,
|
|
570
574
|
[this.entity]: params[this.entity],
|
|
575
|
+
skip_hooks: true,
|
|
571
576
|
...{
|
|
572
577
|
[core_path]: this.core
|
|
573
578
|
}
|
|
@@ -782,7 +787,13 @@ const verifyAgainstReqs = (reqs, config, options) => {
|
|
|
782
787
|
return async context => {
|
|
783
788
|
var _v3;
|
|
784
789
|
const log = options == null ? void 0 : options.log;
|
|
785
|
-
|
|
790
|
+
let rawUcan = symbolUcan._get(context.params, config.client_ucan);
|
|
791
|
+
if (!rawUcan) {
|
|
792
|
+
const authCfg = context.app.get('authentication');
|
|
793
|
+
const entityKey = (authCfg == null ? void 0 : authCfg.entity) || 'login';
|
|
794
|
+
rawUcan = symbolUcan._get(context.params, [entityKey, 'ucan']);
|
|
795
|
+
}
|
|
796
|
+
if (log) console.log('get initial ucan', rawUcan);
|
|
786
797
|
let ucan = rawUcan;
|
|
787
798
|
try {
|
|
788
799
|
// ucanToken will stringify a UCAN object or return the compact form for strings
|
|
@@ -968,6 +979,7 @@ const checkUcan = (requiredCapabilities, options) => {
|
|
|
968
979
|
/** function for comparing record login id with context login*/
|
|
969
980
|
const checkLogin = (recordLoginPassId, loginIdPath = '_id') => {
|
|
970
981
|
const loginCheckId = symbolUcan._get(context.params, `${configuration.entity}.${loginIdPath}`);
|
|
982
|
+
if (options != null && options.log) console.log('checkLoginPass', loginCheckId, recordLoginPassId);
|
|
971
983
|
/**Make sure both are present to avoid pass on undefined*/
|
|
972
984
|
if (loginCheckId && recordLoginPassId) {
|
|
973
985
|
/** change login path result to array no matter what */
|
|
@@ -1108,7 +1120,7 @@ const ucanAuth = (requiredCapabilities, options) => {
|
|
|
1108
1120
|
const loginId = typeof existingLogin === 'string' ? existingLogin : existingLogin == null ? void 0 : existingLogin._id;
|
|
1109
1121
|
const hasLogin = !!(existingLogin && (typeof existingLogin === 'string' || !!loginId));
|
|
1110
1122
|
// Per requirement: UCAN is always at context.params[entity].ucan
|
|
1111
|
-
const existingUcan = symbolUcan._get(context.params, configuration.client_ucan || 'client_ucan');
|
|
1123
|
+
const existingUcan = symbolUcan._get(context.params, configuration.client_ucan || 'client_ucan') || symbolUcan._get(context.params, [entity, 'ucan']);
|
|
1112
1124
|
if (options != null && options.log) console.log('ucan auth', 'hasLogin', hasLogin, 'loginId', loginId, 'existingUcan', !!existingUcan, 'core_path', core_path, 'entity', entity, 'core', context.params[core_path], 'params login', context.params.login, 'required capabilities', requiredCapabilities);
|
|
1113
1125
|
if (options != null && options.log && !hasLogin) {
|
|
1114
1126
|
try {
|