@brimble/models 1.4.73 → 1.4.75

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.
@@ -1 +1,3 @@
1
+ yarn run v1.22.19
1
2
  $ tsc -p .
3
+ Done in 1.81s.
package/dist/index.d.ts CHANGED
@@ -15,6 +15,6 @@ export { default as Tenancy } from "./tenancy";
15
15
  export { IUser, IGit, IProject, IFollowing, IIntegration, IEnv, IServer, ITenancy, IDomain, IToken, IMember, ITeam, IInstalledIntegration, ILog, ISubscriptionPlan, ICard } from "./types";
16
16
  export { GIT_TYPE, INTEGRATION_TYPES, INTEGRATION_PROVIDERS, OAUTH_PERMISSIONS, ENVIRONMENT, SERVER_STATUS, ROLES, PROJECT_STATUS, SUBSCRIPTION_STATUS, CARD_TYPES } from "./enum";
17
17
  import mongoose from "mongoose";
18
- export declare const connectToMongo: (mongoUrl: string, retryCount?: number) => Promise<void>;
18
+ export declare const connectToMongo: (mongoUrl: string, retryCount?: number, config?: mongoose.ConnectOptions) => Promise<void>;
19
19
  export declare const db: mongoose.Connection;
20
20
  export declare const closeMongo: () => Promise<void>;
package/dist/index.js CHANGED
@@ -55,13 +55,8 @@ Object.defineProperty(exports, "CARD_TYPES", { enumerable: true, get: function (
55
55
  const mongoose_1 = __importDefault(require("mongoose"));
56
56
  const utils_1 = require("@brimble/utils");
57
57
  // Connection to Mongo
58
- const connectToMongo = (mongoUrl, retryCount) => __awaiter(void 0, void 0, void 0, function* () {
59
- const options = {
60
- useNewUrlParser: true,
61
- useUnifiedTopology: true,
62
- poolSize: 10,
63
- socketTimeoutMS: 30000,
64
- };
58
+ const connectToMongo = (mongoUrl, retryCount, config) => __awaiter(void 0, void 0, void 0, function* () {
59
+ const options = Object.assign({ useNewUrlParser: true, useUnifiedTopology: true, poolSize: 10, socketTimeoutMS: 30000 }, config);
65
60
  mongoose_1.default.set("useFindAndModify", false);
66
61
  mongoose_1.default.set("useCreateIndex", true);
67
62
  // connect to mongo
@@ -1,21 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const mongoose_1 = require("mongoose");
4
- const installedIntegrationSchema = new mongoose_1.Schema({
4
+ const installedIntegrationSchema = new mongoose_1.Schema(
5
+ {
5
6
  user_id: {
6
- type: mongoose_1.Schema.Types.ObjectId,
7
- ref: "User",
8
- default: null,
9
- required: false,
7
+ type: mongoose_1.Schema.Types.ObjectId,
8
+ ref: "User",
9
+ default: null,
10
+ required: false,
10
11
  },
11
12
  integration_id: {
12
- type: mongoose_1.Schema.Types.ObjectId,
13
- ref: "Integration",
14
- required: true,
13
+ type: mongoose_1.Schema.Types.ObjectId,
14
+ ref: "Integration",
15
+ required: true,
15
16
  },
16
17
  enabled: {
17
- type: Boolean,
18
- default: true,
18
+ type: Boolean,
19
+ default: true,
19
20
  },
20
- }, { timestamps: true });
21
- exports.default = (0, mongoose_1.model)("InstalledIntegration", installedIntegrationSchema);
21
+ },
22
+ { timestamps: true },
23
+ );
24
+ exports.default = mongoose_1.model(
25
+ "InstalledIntegration",
26
+ installedIntegrationSchema,
27
+ );
package/dist/logs.d.ts CHANGED
File without changes
package/dist/logs.js CHANGED
File without changes
File without changes
File without changes
package/dist/user.js CHANGED
@@ -25,6 +25,11 @@ const userSchema = new mongoose_1.Schema({
25
25
  default: true,
26
26
  required: false,
27
27
  },
28
- tenant: { type: mongoose_1.Schema.Types.ObjectId, ref: "Tenancy", required: false }
29
- }, { timestamps: true });
28
+ tenant: { type: mongoose_1.Schema.Types.ObjectId, ref: "Tenancy", required: false },
29
+ }, {
30
+ timestamps: {
31
+ createdAt: "created_at",
32
+ updatedAt: "updated_at",
33
+ },
34
+ });
30
35
  exports.default = (0, mongoose_1.model)("User", userSchema);
package/index.ts CHANGED
@@ -51,12 +51,14 @@ import { log } from "@brimble/utils";
51
51
  export const connectToMongo = async (
52
52
  mongoUrl: string,
53
53
  retryCount?: number,
54
+ config?: mongoose.ConnectOptions
54
55
  ): Promise<void> => {
55
56
  const options = {
56
57
  useNewUrlParser: true,
57
58
  useUnifiedTopology: true,
58
59
  poolSize: 10,
59
60
  socketTimeoutMS: 30000,
61
+ ...config
60
62
  };
61
63
  mongoose.set("useFindAndModify", false);
62
64
  mongoose.set("useCreateIndex", true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brimble/models",
3
- "version": "1.4.73",
3
+ "version": "1.4.75",
4
4
  "description": "Brimble models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
- "@brimble/utils": "^1.5.8",
12
+ "@brimble/utils": "^1.5.10",
13
13
  "dotenv": "^8.2.0",
14
14
  "mongoose": "^5.8.11",
15
15
  "uuid": "^8.3.2"
@@ -21,5 +21,5 @@
21
21
  "ts-node": "^8.10.2",
22
22
  "typescript": "^4.9.4"
23
23
  },
24
- "gitHead": "e7edcd295068373ff4eca66a9f0ccb6cc9d71191"
24
+ "gitHead": "7a6f022e4782116612ce06e48d227b3ca06034a2"
25
25
  }
package/user.ts CHANGED
@@ -27,9 +27,14 @@ const userSchema: Schema = new Schema(
27
27
  default: true,
28
28
  required: false,
29
29
  },
30
- tenant: { type: Schema.Types.ObjectId, ref: "Tenancy", required: false }
30
+ tenant: { type: Schema.Types.ObjectId, ref: "Tenancy", required: false },
31
+ },
32
+ {
33
+ timestamps: {
34
+ createdAt: "created_at",
35
+ updatedAt: "updated_at",
36
+ },
31
37
  },
32
- { timestamps: true },
33
38
  );
34
39
 
35
40
  export default model<IUser>("User", userSchema);