@aneuhold/core-ts-db-lib 1.0.10 → 1.0.12
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/documents/common/ApiKey.d.ts +2 -4
- package/lib/documents/common/ApiKey.d.ts.map +1 -1
- package/lib/documents/dashboard/UserConfig.d.ts +2 -4
- package/lib/documents/dashboard/UserConfig.d.ts.map +1 -1
- package/lib/index.d.ts +6 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +30 -4
- package/lib/schemas/type-guards/commonTypeGuards.d.ts +4 -4
- package/lib/schemas/type-guards/commonTypeGuards.d.ts.map +1 -1
- package/lib/schemas/type-guards/commonTypeGuards.js +4 -4
- package/lib/schemas/validators/ValidateUtil.js +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { ObjectId } from 'bson';
|
|
2
2
|
import BaseDocument from '../BaseDocument';
|
|
3
3
|
import RequiredUserId from '../../schemas/required-refs/RequiredUserId';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
errors: string[];
|
|
7
|
-
};
|
|
4
|
+
import { DocumentValidator } from '../../schemas/validators/DocumentValidator';
|
|
5
|
+
export declare const validateApiKey: DocumentValidator<ApiKey>;
|
|
8
6
|
/**
|
|
9
7
|
* A document containing an API key for a particular user. This is stored
|
|
10
8
|
* separately from the {@link User} document to enhance security a bit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiKey.d.ts","sourceRoot":"","sources":["../../../src/documents/common/ApiKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAEhC,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,cAAc,MAAM,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"ApiKey.d.ts","sourceRoot":"","sources":["../../../src/documents/common/ApiKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAEhC,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,cAAc,MAAM,4CAA4C,CAAC;AAExE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAE/E,eAAO,MAAM,cAAc,EAAE,iBAAiB,CAAC,MAAM,CAQpD,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,YAAa,YAAW,cAAc;IACxE;;OAEG;IACH,GAAG,sDAAuB;IAE1B;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC;IAEjB;;OAEG;gBACS,MAAM,EAAE,QAAQ;CAI7B"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { ObjectId } from 'bson';
|
|
2
2
|
import BaseDocumentWithType from '../BaseDocumentWithType';
|
|
3
3
|
import RequiredUserId from '../../schemas/required-refs/RequiredUserId';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
errors: string[];
|
|
7
|
-
};
|
|
4
|
+
import { DocumentValidator } from '../../schemas/validators/DocumentValidator';
|
|
5
|
+
export declare const validateDashboardUserConfig: DocumentValidator<DashboardUserConfig>;
|
|
8
6
|
export default class DashboardUserConfig extends BaseDocumentWithType implements RequiredUserId {
|
|
9
7
|
static docType: string;
|
|
10
8
|
docType: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserConfig.d.ts","sourceRoot":"","sources":["../../../src/documents/dashboard/UserConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAC3D,OAAO,cAAc,MAAM,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"UserConfig.d.ts","sourceRoot":"","sources":["../../../src/documents/dashboard/UserConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAC3D,OAAO,cAAc,MAAM,4CAA4C,CAAC;AAExE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAE/E,eAAO,MAAM,2BAA2B,EAAE,iBAAiB,CACzD,mBAAmB,CASpB,CAAC;AAEF,MAAM,CAAC,OAAO,OAAO,mBACnB,SAAQ,oBACR,YAAW,cAAc;IAEzB,MAAM,CAAC,OAAO,SAAgB;IAE9B,OAAO,SAA+B;IAEtC;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC;IAEjB;;OAEG;IACH,aAAa,UAAS;gBAEV,OAAO,EAAE,QAAQ;CAI9B"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import BaseDocument from './documents/BaseDocument';
|
|
2
2
|
import BaseDocumentWithType from './documents/BaseDocumentWithType';
|
|
3
|
-
import ApiKey from './documents/common/ApiKey';
|
|
4
|
-
import User from './documents/common/User';
|
|
5
|
-
import DashboardUserConfig from './documents/dashboard/UserConfig';
|
|
3
|
+
import ApiKey, { validateApiKey } from './documents/common/ApiKey';
|
|
4
|
+
import User, { validateUser } from './documents/common/User';
|
|
5
|
+
import DashboardUserConfig, { validateDashboardUserConfig } from './documents/dashboard/UserConfig';
|
|
6
6
|
import RequiredUserId from './schemas/required-refs/RequiredUserId';
|
|
7
|
-
|
|
8
|
-
export
|
|
7
|
+
import { DocumentValidator } from './schemas/validators/DocumentValidator';
|
|
8
|
+
export { User, validateUser, ApiKey, validateApiKey, DashboardUserConfig, validateDashboardUserConfig, BaseDocument, BaseDocumentWithType, RequiredUserId };
|
|
9
|
+
export type { DocumentValidator };
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,oBAAoB,MAAM,kCAAkC,CAAC;AACpE,OAAO,MAAM,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,oBAAoB,MAAM,kCAAkC,CAAC;AACpE,OAAO,MAAM,EAAE,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,mBAAmB,EAAE,EAC1B,2BAA2B,EAC5B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,cAAc,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAG3E,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,cAAc,EACd,mBAAmB,EACnB,2BAA2B,EAC3B,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACf,CAAC;AAGF,YAAY,EAAE,iBAAiB,EAAE,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,18 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.RequiredUserId = exports.BaseDocumentWithType = exports.BaseDocument = exports.DashboardUserConfig = exports.ApiKey = exports.User = void 0;
|
|
29
|
+
exports.RequiredUserId = exports.BaseDocumentWithType = exports.BaseDocument = exports.validateDashboardUserConfig = exports.DashboardUserConfig = exports.validateApiKey = exports.ApiKey = exports.validateUser = exports.User = void 0;
|
|
7
30
|
const BaseDocument_1 = __importDefault(require("./documents/BaseDocument"));
|
|
8
31
|
exports.BaseDocument = BaseDocument_1.default;
|
|
9
32
|
const BaseDocumentWithType_1 = __importDefault(require("./documents/BaseDocumentWithType"));
|
|
10
33
|
exports.BaseDocumentWithType = BaseDocumentWithType_1.default;
|
|
11
|
-
const ApiKey_1 =
|
|
34
|
+
const ApiKey_1 = __importStar(require("./documents/common/ApiKey"));
|
|
12
35
|
exports.ApiKey = ApiKey_1.default;
|
|
13
|
-
|
|
36
|
+
Object.defineProperty(exports, "validateApiKey", { enumerable: true, get: function () { return ApiKey_1.validateApiKey; } });
|
|
37
|
+
const User_1 = __importStar(require("./documents/common/User"));
|
|
14
38
|
exports.User = User_1.default;
|
|
15
|
-
|
|
39
|
+
Object.defineProperty(exports, "validateUser", { enumerable: true, get: function () { return User_1.validateUser; } });
|
|
40
|
+
const UserConfig_1 = __importStar(require("./documents/dashboard/UserConfig"));
|
|
16
41
|
exports.DashboardUserConfig = UserConfig_1.default;
|
|
42
|
+
Object.defineProperty(exports, "validateDashboardUserConfig", { enumerable: true, get: function () { return UserConfig_1.validateDashboardUserConfig; } });
|
|
17
43
|
const RequiredUserId_1 = __importDefault(require("./schemas/required-refs/RequiredUserId"));
|
|
18
44
|
exports.RequiredUserId = RequiredUserId_1.default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare function isOptionalObject(value: unknown): value is undefined | object;
|
|
2
|
-
export declare function isOptionalArray(value: unknown): value is undefined | Array<unknown
|
|
3
|
-
export declare function isOptionalString(value: unknown): value is undefined | string;
|
|
4
|
-
export declare function isOptionalNumber(value: unknown): value is undefined | number;
|
|
5
|
-
export declare function isOptionalBoolean(value: unknown): value is undefined | boolean;
|
|
2
|
+
export declare function isOptionalArray(value: unknown): value is undefined | Array<unknown> | null;
|
|
3
|
+
export declare function isOptionalString(value: unknown): value is undefined | string | null;
|
|
4
|
+
export declare function isOptionalNumber(value: unknown): value is undefined | null | number;
|
|
5
|
+
export declare function isOptionalBoolean(value: unknown): value is undefined | null | boolean;
|
|
6
6
|
//# sourceMappingURL=commonTypeGuards.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commonTypeGuards.d.ts","sourceRoot":"","sources":["../../../src/schemas/type-guards/commonTypeGuards.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,GAAG,MAAM,CAE5E;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"commonTypeGuards.d.ts","sourceRoot":"","sources":["../../../src/schemas/type-guards/commonTypeGuards.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,GAAG,MAAM,CAE5E;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,IAAI,CAE5C;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,SAAS,GAAG,MAAM,GAAG,IAAI,CAEpC;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,SAAS,GAAG,IAAI,GAAG,MAAM,CAEpC;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,SAAS,GAAG,IAAI,GAAG,OAAO,CAErC"}
|
|
@@ -6,18 +6,18 @@ function isOptionalObject(value) {
|
|
|
6
6
|
}
|
|
7
7
|
exports.isOptionalObject = isOptionalObject;
|
|
8
8
|
function isOptionalArray(value) {
|
|
9
|
-
return value === undefined || Array.isArray(value);
|
|
9
|
+
return value === undefined || value === null || Array.isArray(value);
|
|
10
10
|
}
|
|
11
11
|
exports.isOptionalArray = isOptionalArray;
|
|
12
12
|
function isOptionalString(value) {
|
|
13
|
-
return value === undefined || typeof value === 'string';
|
|
13
|
+
return value === undefined || value === null || typeof value === 'string';
|
|
14
14
|
}
|
|
15
15
|
exports.isOptionalString = isOptionalString;
|
|
16
16
|
function isOptionalNumber(value) {
|
|
17
|
-
return value === undefined || typeof value === 'number';
|
|
17
|
+
return value === undefined || value === null || typeof value === 'number';
|
|
18
18
|
}
|
|
19
19
|
exports.isOptionalNumber = isOptionalNumber;
|
|
20
20
|
function isOptionalBoolean(value) {
|
|
21
|
-
return value === undefined || typeof value === 'boolean';
|
|
21
|
+
return value === undefined || value === null || typeof value === 'boolean';
|
|
22
22
|
}
|
|
23
23
|
exports.isOptionalBoolean = isOptionalBoolean;
|
|
@@ -94,7 +94,7 @@ class Validate {
|
|
|
94
94
|
}
|
|
95
95
|
let currentObject = this.parentObject;
|
|
96
96
|
for (let i = 0; i < fieldPath.length - 1; i += 1) {
|
|
97
|
-
if (currentObject[fieldPath[i]]
|
|
97
|
+
if (typeof currentObject[fieldPath[i]] !== 'object') {
|
|
98
98
|
return false;
|
|
99
99
|
}
|
|
100
100
|
currentObject = currentObject[fieldPath[i]];
|