@aeriajs/common 0.0.130 → 0.0.132
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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/dist/isGranted.js +3 -1
- package/dist/isGranted.mjs +1 -0
- package/dist/isValidCollection.d.ts +3 -0
- package/dist/isValidCollection.js +20 -0
- package/dist/isValidCollection.mjs +7 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -30,5 +30,6 @@ __exportStar(require("./http.js"), exports);
|
|
|
30
30
|
__exportStar(require("./isGranted.js"), exports);
|
|
31
31
|
__exportStar(require("./isReference.js"), exports);
|
|
32
32
|
__exportStar(require("./isRequired.js"), exports);
|
|
33
|
+
__exportStar(require("./isValidCollection.js"), exports);
|
|
33
34
|
__exportStar(require("./pipe.js"), exports);
|
|
34
35
|
__exportStar(require("./serialize.js"), exports);
|
package/dist/index.mjs
CHANGED
package/dist/isGranted.js
CHANGED
|
@@ -9,7 +9,9 @@ const isGranted = (condition, token) => {
|
|
|
9
9
|
: condition.includes('unauthenticated');
|
|
10
10
|
}
|
|
11
11
|
switch (condition) {
|
|
12
|
-
case false:
|
|
12
|
+
case false:
|
|
13
|
+
case undefined:
|
|
14
|
+
return false;
|
|
13
15
|
case true: return token.authenticated;
|
|
14
16
|
case 'unauthenticated':
|
|
15
17
|
return true;
|
package/dist/isGranted.mjs
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isValidCollection = exports.isValidDescription = void 0;
|
|
4
|
+
const isValidDescription = (value) => {
|
|
5
|
+
return !!(value
|
|
6
|
+
&& typeof value === 'object'
|
|
7
|
+
&& '$id' in value
|
|
8
|
+
&& 'properties' in value
|
|
9
|
+
&& value.properties
|
|
10
|
+
&& typeof value.$id === 'string'
|
|
11
|
+
&& typeof value.properties === 'object');
|
|
12
|
+
};
|
|
13
|
+
exports.isValidDescription = isValidDescription;
|
|
14
|
+
const isValidCollection = (value) => {
|
|
15
|
+
return !!(value
|
|
16
|
+
&& typeof value === 'object'
|
|
17
|
+
&& 'description' in value
|
|
18
|
+
&& (0, exports.isValidDescription)(value.description));
|
|
19
|
+
};
|
|
20
|
+
exports.isValidCollection = isValidCollection;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
export const isValidDescription = (value) => {
|
|
3
|
+
return !!(value && typeof value === "object" && "$id" in value && "properties" in value && value.properties && typeof value.$id === "string" && typeof value.properties === "object");
|
|
4
|
+
};
|
|
5
|
+
export const isValidCollection = (value) => {
|
|
6
|
+
return !!(value && typeof value === "object" && "description" in value && isValidDescription(value.description));
|
|
7
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeriajs/common",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.132",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"bson": "^6.5.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@aeriajs/types": "^0.0.
|
|
34
|
+
"@aeriajs/types": "^0.0.114",
|
|
35
35
|
"bson": "^6.5.0"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|