@brimble/models 1.3.10 → 1.3.13

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,2 +1,2 @@
1
- @brimble/models:build: cache hit, replaying output 29b510b8b7235235
1
+ @brimble/models:build: cache hit, replaying output 42b46fe101e599f8
2
2
  @brimble/models:build: $ tsc -p .
package/dist/domain.d.ts CHANGED
File without changes
package/dist/domain.js CHANGED
File without changes
@@ -7,6 +7,10 @@ export declare enum INTEGRATION_TYPE {
7
7
  SLACK = "SLACK",
8
8
  ASANA = "ASANA",
9
9
  SENTRY = "SENTRY",
10
- DOPPLER = "DOPPLER",
11
10
  CONTENTFUL = "CONTENTFUL"
12
11
  }
12
+ export declare enum OAUTH_PERMISSIONS {
13
+ READ_USER = "read_user",
14
+ READ_PROJECT = "read_project",
15
+ UPDATE_CREDENTIALS = "update_credentials"
16
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.INTEGRATION_TYPE = exports.GIT_TYPE = void 0;
3
+ exports.OAUTH_PERMISSIONS = exports.INTEGRATION_TYPE = exports.GIT_TYPE = void 0;
4
4
  var GIT_TYPE;
5
5
  (function (GIT_TYPE) {
6
6
  GIT_TYPE["GITHUB"] = "GITHUB";
@@ -12,6 +12,11 @@ var INTEGRATION_TYPE;
12
12
  INTEGRATION_TYPE["SLACK"] = "SLACK";
13
13
  INTEGRATION_TYPE["ASANA"] = "ASANA";
14
14
  INTEGRATION_TYPE["SENTRY"] = "SENTRY";
15
- INTEGRATION_TYPE["DOPPLER"] = "DOPPLER";
16
15
  INTEGRATION_TYPE["CONTENTFUL"] = "CONTENTFUL";
17
16
  })(INTEGRATION_TYPE = exports.INTEGRATION_TYPE || (exports.INTEGRATION_TYPE = {}));
17
+ var OAUTH_PERMISSIONS;
18
+ (function (OAUTH_PERMISSIONS) {
19
+ OAUTH_PERMISSIONS["READ_USER"] = "read_user";
20
+ OAUTH_PERMISSIONS["READ_PROJECT"] = "read_project";
21
+ OAUTH_PERMISSIONS["UPDATE_CREDENTIALS"] = "update_credentials";
22
+ })(OAUTH_PERMISSIONS = exports.OAUTH_PERMISSIONS || (exports.OAUTH_PERMISSIONS = {}));
package/dist/env.d.ts CHANGED
File without changes
package/dist/env.js CHANGED
@@ -14,5 +14,10 @@ const envSchema = new mongoose_1.Schema({
14
14
  type: String,
15
15
  required: true,
16
16
  },
17
+ user: {
18
+ type: mongoose_1.Schema.Types.ObjectId,
19
+ ref: "User",
20
+ required: true,
21
+ }
17
22
  }, { timestamps: true });
18
23
  exports.default = mongoose_1.model("Env", envSchema);
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export { default as Following } from "./following";
4
4
  export { default as Integration } from "./integration";
5
5
  export { default as Domain } from "./domain";
6
6
  export { default as Env } from "./env";
7
- export { IUser, IGit, IProject, IFollowing, IIntegration, IEnv, IDomain, } from "./types";
8
- export { GIT_TYPE, INTEGRATION_TYPE } from "./enum";
7
+ export { default as Token } from "./token";
8
+ export { IUser, IGit, IProject, IFollowing, IIntegration, IEnv, IDomain, IToken } from "./types";
9
+ export { GIT_TYPE, INTEGRATION_TYPE, OAUTH_PERMISSIONS } from "./enum";
9
10
  export declare const connectToMongo: (mongoUrl: string) => Promise<void>;
package/dist/index.js CHANGED
@@ -25,9 +25,12 @@ var domain_1 = require("./domain");
25
25
  Object.defineProperty(exports, "Domain", { enumerable: true, get: function () { return domain_1.default; } });
26
26
  var env_1 = require("./env");
27
27
  Object.defineProperty(exports, "Env", { enumerable: true, get: function () { return env_1.default; } });
28
+ var token_1 = require("./token");
29
+ Object.defineProperty(exports, "Token", { enumerable: true, get: function () { return token_1.default; } });
28
30
  var enum_1 = require("./enum");
29
31
  Object.defineProperty(exports, "GIT_TYPE", { enumerable: true, get: function () { return enum_1.GIT_TYPE; } });
30
32
  Object.defineProperty(exports, "INTEGRATION_TYPE", { enumerable: true, get: function () { return enum_1.INTEGRATION_TYPE; } });
33
+ Object.defineProperty(exports, "OAUTH_PERMISSIONS", { enumerable: true, get: function () { return enum_1.OAUTH_PERMISSIONS; } });
31
34
  const mongoose_1 = __importDefault(require("mongoose"));
32
35
  const utils_1 = require("@brimble/utils");
33
36
  // Connection to Mongo
File without changes
File without changes
@@ -0,0 +1,4 @@
1
+ /// <reference types="mongoose" />
2
+ import { IToken } from "./types";
3
+ declare const _default: import("mongoose").Model<IToken, {}, {}>;
4
+ export default _default;
package/dist/token.js ADDED
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mongoose_1 = require("mongoose");
4
+ const tokenSchema = new mongoose_1.Schema({
5
+ name: {
6
+ type: String,
7
+ required: true,
8
+ unique: true,
9
+ },
10
+ apiKey: {
11
+ type: String,
12
+ required: true,
13
+ unique: true,
14
+ },
15
+ description: {
16
+ type: Array,
17
+ required: true
18
+ },
19
+ image: {
20
+ type: String,
21
+ required: true,
22
+ unique: true,
23
+ },
24
+ installationUrl: String,
25
+ permissions: {
26
+ type: Array,
27
+ required: true
28
+ }
29
+ }, { timestamps: true });
30
+ exports.default = mongoose_1.model("Token", tokenSchema);
File without changes
File without changes
@@ -1,7 +1,9 @@
1
1
  import { Document } from "mongoose";
2
2
  import { IProject } from "./project";
3
+ import { IUser } from "./user";
3
4
  export interface IEnv extends Document {
4
5
  name: string;
5
6
  value: string;
6
7
  project: IProject;
8
+ user: IUser;
7
9
  }
package/dist/types/env.js CHANGED
File without changes
@@ -5,3 +5,4 @@ export { IProject } from "./project";
5
5
  export { IIntegration } from "./integration";
6
6
  export { IEnv } from "./env";
7
7
  export { IDomain } from "./domain";
8
+ export { IToken } from "./token";
File without changes
File without changes
@@ -0,0 +1,10 @@
1
+ import { Document } from "mongoose";
2
+ import { OAUTH_PERMISSIONS } from "../enum";
3
+ export interface IToken extends Document {
4
+ name: string;
5
+ apiKey: string;
6
+ description: string[];
7
+ image: string;
8
+ installationUrl?: string;
9
+ permission: OAUTH_PERMISSIONS[];
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/enum/index.ts CHANGED
@@ -7,6 +7,11 @@ export enum INTEGRATION_TYPE {
7
7
  SLACK = "SLACK",
8
8
  ASANA = "ASANA",
9
9
  SENTRY = "SENTRY",
10
- DOPPLER = "DOPPLER",
11
10
  CONTENTFUL = "CONTENTFUL",
12
11
  }
12
+
13
+ export enum OAUTH_PERMISSIONS {
14
+ READ_USER = "read_user",
15
+ READ_PROJECT = "read_project",
16
+ UPDATE_CREDENTIALS = "update_credentials"
17
+ }
package/env.ts CHANGED
@@ -15,6 +15,11 @@ const envSchema = new Schema(
15
15
  type: String,
16
16
  required: true,
17
17
  },
18
+ user: {
19
+ type: Schema.Types.ObjectId,
20
+ ref: "User",
21
+ required: true,
22
+ }
18
23
  },
19
24
  { timestamps: true },
20
25
  );
package/index.ts CHANGED
@@ -4,6 +4,7 @@ export { default as Following } from "./following";
4
4
  export { default as Integration } from "./integration";
5
5
  export { default as Domain } from "./domain";
6
6
  export { default as Env } from "./env";
7
+ export { default as Token } from "./token";
7
8
  export {
8
9
  IUser,
9
10
  IGit,
@@ -12,8 +13,9 @@ export {
12
13
  IIntegration,
13
14
  IEnv,
14
15
  IDomain,
16
+ IToken
15
17
  } from "./types";
16
- export { GIT_TYPE, INTEGRATION_TYPE } from "./enum";
18
+ export { GIT_TYPE, INTEGRATION_TYPE, OAUTH_PERMISSIONS } from "./enum";
17
19
 
18
20
  import mongoose from "mongoose";
19
21
  import { log } from "@brimble/utils";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brimble/models",
3
- "version": "1.3.10",
3
+ "version": "1.3.13",
4
4
  "description": "Brimble models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/token.ts ADDED
@@ -0,0 +1,34 @@
1
+ import { model, Schema } from "mongoose";
2
+ import { IToken } from "./types";
3
+
4
+ const tokenSchema = new Schema(
5
+ {
6
+ name: {
7
+ type: String,
8
+ required: true,
9
+ unique: true,
10
+ },
11
+ apiKey: {
12
+ type: String,
13
+ required: true,
14
+ unique: true,
15
+ },
16
+ description: {
17
+ type: Array,
18
+ required: true
19
+ },
20
+ image: {
21
+ type: String,
22
+ required: true,
23
+ unique: true,
24
+ },
25
+ installationUrl: String,
26
+ permissions: {
27
+ type: Array,
28
+ required: true
29
+ }
30
+ },
31
+ { timestamps: true },
32
+ );
33
+
34
+ export default model<IToken>("Token", tokenSchema);
package/types/env.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  import { Document } from "mongoose";
2
2
  import { IProject } from "./project";
3
+ import { IUser } from "./user";
3
4
 
4
5
  export interface IEnv extends Document {
5
6
  name: string;
6
7
  value: string;
7
8
  project: IProject;
9
+ user: IUser;
8
10
  }
package/types/index.ts CHANGED
@@ -5,3 +5,4 @@ export { IProject } from "./project";
5
5
  export { IIntegration } from "./integration";
6
6
  export { IEnv } from "./env";
7
7
  export { IDomain } from "./domain";
8
+ export { IToken } from "./token";
package/types/token.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { Document } from "mongoose";
2
+ import { OAUTH_PERMISSIONS } from "../enum";
3
+
4
+ export interface IToken extends Document {
5
+ name: string;
6
+
7
+ apiKey: string;
8
+
9
+ description: string[];
10
+
11
+ image: string;
12
+
13
+ installationUrl?: string;
14
+
15
+ permission: OAUTH_PERMISSIONS[];
16
+ }