@whatsveg/wv-data-model 1.0.0 → 1.0.1

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.
@@ -0,0 +1,2 @@
1
+ export { User } from "./models";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.User = void 0;
4
+ var models_1 = require("./models");
5
+ Object.defineProperty(exports, "User", { enumerable: true, get: function () { return models_1.User; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAAvB,8FAAA,IAAI,OAAA"}
@@ -0,0 +1,6 @@
1
+ import { Model } from "mongoose";
2
+ import { UserAttributes } from "../schemas/UserSchema";
3
+ export type UserModel = Model<UserAttributes>;
4
+ declare const User: UserModel;
5
+ export default User;
6
+ //# sourceMappingURL=User.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"User.d.ts","sourceRoot":"","sources":["../../src/models/User.ts"],"names":[],"mappings":"AAAA,OAAiB,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAmB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEnE,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;AAE9C,QAAA,MAAM,IAAI,WAA4F,CAAC;AAEvG,eAAe,IAAI,CAAC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const mongoose_1 = __importDefault(require("mongoose"));
7
+ const UserSchema_1 = __importDefault(require("../schemas/UserSchema"));
8
+ const User = mongoose_1.default.models.User || mongoose_1.default.model("User", UserSchema_1.default);
9
+ exports.default = User;
10
+ //# sourceMappingURL=User.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"User.js","sourceRoot":"","sources":["../../src/models/User.ts"],"names":[],"mappings":";;;;;AAAA,wDAA2C;AAE3C,uEAAmE;AAInE,MAAM,IAAI,GAAI,kBAAQ,CAAC,MAAM,CAAC,IAAkB,IAAI,kBAAQ,CAAC,KAAK,CAAiB,MAAM,EAAE,oBAAU,CAAC,CAAC;AAEvG,kBAAe,IAAI,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default as User } from "./User";
2
+ export type { UserModel } from "./User";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.User = void 0;
7
+ var User_1 = require("./User");
8
+ Object.defineProperty(exports, "User", { enumerable: true, get: function () { return __importDefault(User_1).default; } });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";;;;;;AAAA,+BAAyC;AAAhC,6GAAA,OAAO,OAAQ"}
@@ -0,0 +1,75 @@
1
+ import { Schema } from "mongoose";
2
+ export interface UserAttributes {
3
+ userId: string;
4
+ name: string;
5
+ email: string;
6
+ age?: number;
7
+ createdAt?: Date;
8
+ updatedAt?: Date;
9
+ }
10
+ declare const UserSchema: Schema<UserAttributes, import("mongoose").Model<UserAttributes, any, any, any, any, any, UserAttributes>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, UserAttributes, import("mongoose").Document<unknown, {}, UserAttributes, {
11
+ id: string;
12
+ }, import("mongoose").DefaultSchemaOptions> & Omit<UserAttributes & {
13
+ _id: import("mongoose").Types.ObjectId;
14
+ } & {
15
+ __v: number;
16
+ }, "id"> & {
17
+ id: string;
18
+ }, {
19
+ userId?: import("mongoose").SchemaDefinitionProperty<string, UserAttributes, import("mongoose").Document<unknown, {}, UserAttributes, {
20
+ id: string;
21
+ }, import("mongoose").DefaultSchemaOptions> & Omit<UserAttributes & {
22
+ _id: import("mongoose").Types.ObjectId;
23
+ } & {
24
+ __v: number;
25
+ }, "id"> & {
26
+ id: string;
27
+ }> | undefined;
28
+ name?: import("mongoose").SchemaDefinitionProperty<string, UserAttributes, import("mongoose").Document<unknown, {}, UserAttributes, {
29
+ id: string;
30
+ }, import("mongoose").DefaultSchemaOptions> & Omit<UserAttributes & {
31
+ _id: import("mongoose").Types.ObjectId;
32
+ } & {
33
+ __v: number;
34
+ }, "id"> & {
35
+ id: string;
36
+ }> | undefined;
37
+ email?: import("mongoose").SchemaDefinitionProperty<string, UserAttributes, import("mongoose").Document<unknown, {}, UserAttributes, {
38
+ id: string;
39
+ }, import("mongoose").DefaultSchemaOptions> & Omit<UserAttributes & {
40
+ _id: import("mongoose").Types.ObjectId;
41
+ } & {
42
+ __v: number;
43
+ }, "id"> & {
44
+ id: string;
45
+ }> | undefined;
46
+ age?: import("mongoose").SchemaDefinitionProperty<number | undefined, UserAttributes, import("mongoose").Document<unknown, {}, UserAttributes, {
47
+ id: string;
48
+ }, import("mongoose").DefaultSchemaOptions> & Omit<UserAttributes & {
49
+ _id: import("mongoose").Types.ObjectId;
50
+ } & {
51
+ __v: number;
52
+ }, "id"> & {
53
+ id: string;
54
+ }> | undefined;
55
+ createdAt?: import("mongoose").SchemaDefinitionProperty<Date | undefined, UserAttributes, import("mongoose").Document<unknown, {}, UserAttributes, {
56
+ id: string;
57
+ }, import("mongoose").DefaultSchemaOptions> & Omit<UserAttributes & {
58
+ _id: import("mongoose").Types.ObjectId;
59
+ } & {
60
+ __v: number;
61
+ }, "id"> & {
62
+ id: string;
63
+ }> | undefined;
64
+ updatedAt?: import("mongoose").SchemaDefinitionProperty<Date | undefined, UserAttributes, import("mongoose").Document<unknown, {}, UserAttributes, {
65
+ id: string;
66
+ }, import("mongoose").DefaultSchemaOptions> & Omit<UserAttributes & {
67
+ _id: import("mongoose").Types.ObjectId;
68
+ } & {
69
+ __v: number;
70
+ }, "id"> & {
71
+ id: string;
72
+ }> | undefined;
73
+ }, UserAttributes>;
74
+ export default UserSchema;
75
+ //# sourceMappingURL=UserSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserSchema.d.ts","sourceRoot":"","sources":["../../src/schemas/UserSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB;AAED,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA2Bf,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mongoose_1 = require("mongoose");
4
+ const UserSchema = new mongoose_1.Schema({
5
+ userId: {
6
+ type: String,
7
+ required: true,
8
+ unique: true
9
+ },
10
+ name: {
11
+ type: String,
12
+ required: true
13
+ },
14
+ email: {
15
+ type: String,
16
+ required: true,
17
+ lowercase: true
18
+ },
19
+ age: {
20
+ type: Number,
21
+ default: 18
22
+ }
23
+ }, {
24
+ timestamps: true
25
+ });
26
+ exports.default = UserSchema;
27
+ //# sourceMappingURL=UserSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserSchema.js","sourceRoot":"","sources":["../../src/schemas/UserSchema.ts"],"names":[],"mappings":";;AAAA,uCAAkC;AAWlC,MAAM,UAAU,GAAG,IAAI,iBAAM,CAC3B;IACE,MAAM,EAAE;QACN,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,IAAI;KACb;IAED,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACf;IAED,KAAK,EAAE;QACL,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;QACd,SAAS,EAAE,IAAI;KAChB;IAED,GAAG,EAAE;QACH,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,EAAE;KACZ;CACF,EACD;IACE,UAAU,EAAE,IAAI;CACjB,CACF,CAAC;AAEF,kBAAe,UAAU,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default as UserSchema } from "./UserSchema";
2
+ export type { UserAttributes } from "./UserSchema";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.UserSchema = void 0;
7
+ var UserSchema_1 = require("./UserSchema");
8
+ Object.defineProperty(exports, "UserSchema", { enumerable: true, get: function () { return __importDefault(UserSchema_1).default; } });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAqD;AAA5C,yHAAA,OAAO,OAAc"}
package/package.json CHANGED
@@ -1,25 +1,44 @@
1
1
  {
2
2
  "name": "@whatsveg/wv-data-model",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "",
5
- "main": "./src/index.js",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
6
7
  "exports": {
7
- ".": "./src/index.js",
8
- "./models": "./src/models/index.js",
9
- "./schemas": "./src/schemas/index.js"
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "require": "./dist/index.js",
11
+ "default": "./dist/index.js"
12
+ },
13
+ "./models": {
14
+ "types": "./dist/models/index.d.ts",
15
+ "require": "./dist/models/index.js",
16
+ "default": "./dist/models/index.js"
17
+ },
18
+ "./schemas": {
19
+ "types": "./dist/schemas/index.d.ts",
20
+ "require": "./dist/schemas/index.js",
21
+ "default": "./dist/schemas/index.js"
22
+ }
10
23
  },
11
24
  "files": [
12
- "src"
25
+ "dist",
26
+ "README.md"
13
27
  ],
14
28
  "scripts": {
15
- "check": "npm pack",
29
+ "build": "tsc -p tsconfig.json",
30
+ "clean": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
31
+ "check": "npm run build && npm pack --dry-run",
32
+ "prepublishOnly": "npm run build",
33
+ "prepack": "npm run build",
16
34
  "version:patch": "npm version patch",
17
35
  "version:minor": "npm version minor",
18
36
  "version:major": "npm version major",
19
- "publish:npm": "npm publish",
20
- "release:patch": "npm version patch && npm publish",
21
- "release:minor": "npm version minor && npm publish",
22
- "release:major": "npm version major && npm publish"
37
+ "publish:all": "npm run clean && npm run build && npm pack --dry-run --ignore-scripts && npm publish --ignore-scripts",
38
+ "publish:npm": "npm run publish:all",
39
+ "release:patch": "npm run version:patch && npm run publish:npm",
40
+ "release:minor": "npm run version:minor && npm run publish:npm",
41
+ "release:major": "npm run version:major && npm run publish:npm"
23
42
  },
24
43
  "author": "Ravi Verma (Whatsveg)",
25
44
  "license": "ISC",
@@ -31,5 +50,8 @@
31
50
  },
32
51
  "publishConfig": {
33
52
  "access": "public"
53
+ },
54
+ "devDependencies": {
55
+ "typescript": "^6.0.3"
34
56
  }
35
57
  }
package/src/index.js DELETED
@@ -1 +0,0 @@
1
- module.exports = require("./models");
@@ -1,6 +0,0 @@
1
- const mongoose = require("mongoose");
2
- const UserSchema = require("../schemas/UserSchema");
3
-
4
- module.exports =
5
- mongoose.models.User ||
6
- mongoose.model("User", UserSchema);
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- User: require("./User")
3
- };
@@ -1,32 +0,0 @@
1
- const mongoose = require("mongoose");
2
-
3
- const UserSchema = new mongoose.Schema(
4
- {
5
- userId: {
6
- type: String,
7
- required: true,
8
- unique: true
9
- },
10
-
11
- name: {
12
- type: String,
13
- required: true
14
- },
15
-
16
- email: {
17
- type: String,
18
- required: true,
19
- lowercase: true
20
- },
21
-
22
- age: {
23
- type: Number,
24
- default: 18
25
- }
26
- },
27
- {
28
- timestamps: true
29
- }
30
- );
31
-
32
- module.exports = UserSchema;
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- UserSchema: require("./UserSchema")
3
- };