@nest-extended/core 0.0.1-beta-8 → 0.0.1-beta-9
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/package.json +1 -1
- package/src/common/ensureObjectId.d.ts +3 -0
- package/src/common/ensureObjectId.js +14 -0
- package/src/common/ensureObjectId.js.map +1 -0
- package/src/index.d.ts +1 -1
- package/src/index.js +1 -1
- package/src/index.js.map +1 -1
- package/src/lib/core.d.ts +0 -1
- package/src/lib/core.js +0 -7
- package/src/lib/core.js.map +0 -1
package/package.json
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
4
|
+
const EnsureObjectId = (id) => {
|
|
5
|
+
if (typeof id === 'string') {
|
|
6
|
+
if (!mongoose_1.Types.ObjectId.isValid(id)) {
|
|
7
|
+
throw new Error('Invalid ObjectId');
|
|
8
|
+
}
|
|
9
|
+
return new mongoose_1.Types.ObjectId(id);
|
|
10
|
+
}
|
|
11
|
+
return id;
|
|
12
|
+
};
|
|
13
|
+
exports.default = EnsureObjectId;
|
|
14
|
+
//# sourceMappingURL=ensureObjectId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensureObjectId.js","sourceRoot":"","sources":["../../../../../packages/core/src/common/ensureObjectId.ts"],"names":[],"mappings":";;AAAA,uCAAiC;AAEjC,MAAM,cAAc,GAAG,CAAC,EAA2B,EAAkB,EAAE;IACnE,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE,CAAC;QACzB,IAAI,CAAC,gBAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACxC,CAAC;QACD,OAAO,IAAI,gBAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,EAAE,CAAC;AACd,CAAC,CAAC;AAEF,kBAAe,cAAc,CAAC"}
|
package/src/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from './lib/core';
|
|
2
1
|
export * from './lib/nest.controller';
|
|
3
2
|
export * from './lib/nest-extended.module';
|
|
4
3
|
export { default as options } from './common/options';
|
|
@@ -9,3 +8,4 @@ export * from './common/cls.helper';
|
|
|
9
8
|
export * from './types/nest-extended.config';
|
|
10
9
|
export * from './types/PaginatedResponse';
|
|
11
10
|
export * from './types/ServiceOptions';
|
|
11
|
+
export * from './common/ensureObjectId';
|
package/src/index.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.options = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
tslib_1.__exportStar(require("./lib/core"), exports);
|
|
6
5
|
tslib_1.__exportStar(require("./lib/nest.controller"), exports);
|
|
7
6
|
tslib_1.__exportStar(require("./lib/nest-extended.module"), exports);
|
|
8
7
|
var options_1 = require("./common/options");
|
|
@@ -14,4 +13,5 @@ tslib_1.__exportStar(require("./common/cls.helper"), exports);
|
|
|
14
13
|
tslib_1.__exportStar(require("./types/nest-extended.config"), exports);
|
|
15
14
|
tslib_1.__exportStar(require("./types/PaginatedResponse"), exports);
|
|
16
15
|
tslib_1.__exportStar(require("./types/ServiceOptions"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./common/ensureObjectId"), exports);
|
|
17
17
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/core/src/index.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/core/src/index.ts"],"names":[],"mappings":";;;;AAAA,gEAAsC;AACtC,qEAA2C;AAC3C,4CAAsD;AAA7C,kGAAA,OAAO,OAAW;AAC3B,mFAAyD;AACzD,+EAAqD;AACrD,6EAAmD;AACnD,8DAAoC;AACpC,uEAA6C;AAC7C,oEAA0C;AAC1C,iEAAuC;AACvC,kEAAwC"}
|
package/src/lib/core.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function core(): string;
|
package/src/lib/core.js
DELETED
package/src/lib/core.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../../../packages/core/src/lib/core.ts"],"names":[],"mappings":";;AAAA,oBAEC;AAFD,SAAgB,IAAI;IAClB,OAAO,MAAM,CAAC;AAChB,CAAC"}
|