@brimble/models 1.5.12 → 1.5.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.
@@ -0,0 +1,4 @@
1
+ /// <reference types="mongoose" />
2
+ import { IDns } from "../types";
3
+ declare const _default: import("mongoose").Model<IDns, {}, {}>;
4
+ export default _default;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mongoose_1 = require("mongoose");
4
+ const enum_1 = require("../enum");
5
+ const dnsSchema = new mongoose_1.Schema({
6
+ name: {
7
+ type: String,
8
+ required: true,
9
+ },
10
+ ttl: {
11
+ type: Number,
12
+ default: 3600,
13
+ },
14
+ type: {
15
+ type: String,
16
+ enum: Object.values(enum_1.DNS_TYPE),
17
+ required: true,
18
+ },
19
+ value: {
20
+ type: String,
21
+ required: true,
22
+ },
23
+ domain: {
24
+ type: mongoose_1.Schema.Types.ObjectId,
25
+ ref: "Domain",
26
+ required: true,
27
+ },
28
+ });
29
+ exports.default = (0, mongoose_1.model)("Dns", dnsSchema);
@@ -0,0 +1,4 @@
1
+ /// <reference types="mongoose" />
2
+ import { IDomain } from "../types";
3
+ declare const _default: import("mongoose").Model<IDomain, {}, {}>;
4
+ export default _default;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mongoose_1 = require("mongoose");
4
+ const domainSchema = new mongoose_1.Schema({
5
+ project: {
6
+ ref: "Project",
7
+ type: mongoose_1.Schema.Types.ObjectId,
8
+ required: false,
9
+ },
10
+ name: {
11
+ type: String,
12
+ required: true,
13
+ unique: true,
14
+ },
15
+ team_id: {
16
+ type: mongoose_1.Schema.Types.ObjectId,
17
+ required: false,
18
+ },
19
+ user_id: {
20
+ type: mongoose_1.Schema.Types.ObjectId,
21
+ required: true,
22
+ },
23
+ primary: {
24
+ type: Boolean,
25
+ default: false,
26
+ },
27
+ is_free: {
28
+ type: Boolean,
29
+ default: false,
30
+ },
31
+ privacy_enabled: {
32
+ type: Boolean,
33
+ default: false,
34
+ },
35
+ renewal_date: {
36
+ type: String,
37
+ required: false,
38
+ },
39
+ renewal_price: {
40
+ type: Number,
41
+ required: false,
42
+ },
43
+ preview: {
44
+ ref: "Preview",
45
+ type: mongoose_1.Schema.Types.ObjectId,
46
+ },
47
+ nameservers: {
48
+ type: Array,
49
+ required: false,
50
+ },
51
+ dns: [
52
+ {
53
+ ref: "Dns",
54
+ type: mongoose_1.Schema.Types.ObjectId,
55
+ },
56
+ ],
57
+ }, { timestamps: true });
58
+ exports.default = (0, mongoose_1.model)("Domain", domainSchema);
@@ -59,3 +59,11 @@ export declare enum SERVER_STATUS {
59
59
  Active = "active",
60
60
  InActive = "in-active"
61
61
  }
62
+ export declare enum DNS_TYPE {
63
+ A = "A",
64
+ CNAME = "CNAME",
65
+ NS = "NS",
66
+ TXT = "TXT",
67
+ MX = "MX",
68
+ SPF = "SPF"
69
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SERVER_STATUS = exports.OAUTH_PERMISSIONS = exports.SUBSCRIPTION_STATUS = exports.PROJECT_STATUS = exports.CARD_TYPES = exports.ROLES = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.ENVIRONMENT = exports.GIT_TYPE = void 0;
3
+ exports.DNS_TYPE = exports.SERVER_STATUS = exports.OAUTH_PERMISSIONS = exports.SUBSCRIPTION_STATUS = exports.PROJECT_STATUS = exports.CARD_TYPES = exports.ROLES = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.ENVIRONMENT = exports.GIT_TYPE = void 0;
4
4
  var GIT_TYPE;
5
5
  (function (GIT_TYPE) {
6
6
  GIT_TYPE["GITHUB"] = "GITHUB";
@@ -72,3 +72,12 @@ var SERVER_STATUS;
72
72
  SERVER_STATUS["Active"] = "active";
73
73
  SERVER_STATUS["InActive"] = "in-active";
74
74
  })(SERVER_STATUS = exports.SERVER_STATUS || (exports.SERVER_STATUS = {}));
75
+ var DNS_TYPE;
76
+ (function (DNS_TYPE) {
77
+ DNS_TYPE["A"] = "A";
78
+ DNS_TYPE["CNAME"] = "CNAME";
79
+ DNS_TYPE["NS"] = "NS";
80
+ DNS_TYPE["TXT"] = "TXT";
81
+ DNS_TYPE["MX"] = "MX";
82
+ DNS_TYPE["SPF"] = "SPF";
83
+ })(DNS_TYPE = exports.DNS_TYPE || (exports.DNS_TYPE = {}));
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export { default as Preview } from "./project/preview";
4
4
  export { default as Following } from "./following";
5
5
  export { default as Integration } from "./integration";
6
6
  export { default as Domain } from "./domain";
7
+ export { default as Dns } from "./domain/dns";
7
8
  export { default as Env } from "./env";
8
9
  export { default as Token } from "./token";
9
10
  export { default as Team } from "./team";
@@ -13,8 +14,8 @@ export { default as SubscriptionPlan } from "./subscription";
13
14
  export { default as Card } from "./card";
14
15
  export { default as Server } from "./server";
15
16
  export { default as Tenancy } from "./tenancy";
16
- export { IUser, IGit, IProject, IPreview, IFollowing, IIntegration, IEnv, IServer, ITenancy, IDomain, IToken, IMember, ITeam, IInstalledIntegration, ILog, ISubscription, ICard, } from "./types";
17
- export { GIT_TYPE, INTEGRATION_TYPES, INTEGRATION_PROVIDERS, OAUTH_PERMISSIONS, ENVIRONMENT, SERVER_STATUS, ROLES, PROJECT_STATUS, SUBSCRIPTION_STATUS, CARD_TYPES, } from "./enum";
17
+ export { IUser, IGit, IProject, IPreview, IFollowing, IIntegration, IEnv, IServer, ITenancy, IDomain, IToken, IMember, ITeam, IInstalledIntegration, ILog, ISubscription, ICard, IDns, } from "./types";
18
+ export { GIT_TYPE, INTEGRATION_TYPES, INTEGRATION_PROVIDERS, OAUTH_PERMISSIONS, ENVIRONMENT, SERVER_STATUS, ROLES, PROJECT_STATUS, SUBSCRIPTION_STATUS, CARD_TYPES, DNS_TYPE, } from "./enum";
18
19
  import mongoose from "mongoose";
19
20
  export declare const connectToMongo: (mongoUrl: string, config?: mongoose.ConnectOptions) => Promise<void>;
20
21
  export declare const db: mongoose.Connection;
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.closeMongo = exports.db = exports.connectToMongo = exports.CARD_TYPES = exports.SUBSCRIPTION_STATUS = exports.PROJECT_STATUS = exports.ROLES = exports.SERVER_STATUS = exports.ENVIRONMENT = exports.OAUTH_PERMISSIONS = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.GIT_TYPE = exports.Tenancy = exports.Server = exports.Card = exports.SubscriptionPlan = exports.Log = exports.Member = exports.Team = exports.Token = exports.Env = exports.Domain = exports.Integration = exports.Following = exports.Preview = exports.Project = exports.User = void 0;
15
+ exports.closeMongo = exports.db = exports.connectToMongo = exports.DNS_TYPE = exports.CARD_TYPES = exports.SUBSCRIPTION_STATUS = exports.PROJECT_STATUS = exports.ROLES = exports.SERVER_STATUS = exports.ENVIRONMENT = exports.OAUTH_PERMISSIONS = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.GIT_TYPE = exports.Tenancy = exports.Server = exports.Card = exports.SubscriptionPlan = exports.Log = exports.Member = exports.Team = exports.Token = exports.Env = exports.Dns = exports.Domain = exports.Integration = exports.Following = exports.Preview = exports.Project = exports.User = void 0;
16
16
  var user_1 = require("./user");
17
17
  Object.defineProperty(exports, "User", { enumerable: true, get: function () { return __importDefault(user_1).default; } });
18
18
  var project_1 = require("./project");
@@ -25,6 +25,8 @@ var integration_1 = require("./integration");
25
25
  Object.defineProperty(exports, "Integration", { enumerable: true, get: function () { return __importDefault(integration_1).default; } });
26
26
  var domain_1 = require("./domain");
27
27
  Object.defineProperty(exports, "Domain", { enumerable: true, get: function () { return __importDefault(domain_1).default; } });
28
+ var dns_1 = require("./domain/dns");
29
+ Object.defineProperty(exports, "Dns", { enumerable: true, get: function () { return __importDefault(dns_1).default; } });
28
30
  var env_1 = require("./env");
29
31
  Object.defineProperty(exports, "Env", { enumerable: true, get: function () { return __importDefault(env_1).default; } });
30
32
  var token_1 = require("./token");
@@ -54,6 +56,7 @@ Object.defineProperty(exports, "ROLES", { enumerable: true, get: function () { r
54
56
  Object.defineProperty(exports, "PROJECT_STATUS", { enumerable: true, get: function () { return enum_1.PROJECT_STATUS; } });
55
57
  Object.defineProperty(exports, "SUBSCRIPTION_STATUS", { enumerable: true, get: function () { return enum_1.SUBSCRIPTION_STATUS; } });
56
58
  Object.defineProperty(exports, "CARD_TYPES", { enumerable: true, get: function () { return enum_1.CARD_TYPES; } });
59
+ Object.defineProperty(exports, "DNS_TYPE", { enumerable: true, get: function () { return enum_1.DNS_TYPE; } });
57
60
  const mongoose_1 = __importDefault(require("mongoose"));
58
61
  const utils_1 = require("@brimble/utils");
59
62
  const connectToMongo = (mongoUrl, config) => __awaiter(void 0, void 0, void 0, function* () {
@@ -0,0 +1,9 @@
1
+ import { Document } from "mongoose";
2
+ import { IDomain } from ".";
3
+ export interface IDns extends Document {
4
+ name: string;
5
+ ttl: number;
6
+ type: string;
7
+ value: string;
8
+ domain: IDomain;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ import { Document } from "mongoose";
2
+ import { IPreview, IProject } from "../";
3
+ import { IDns } from "./dns";
4
+ export interface IDomain extends Document {
5
+ name: string;
6
+ project: IProject;
7
+ user_id: string;
8
+ team_id: string;
9
+ primary: boolean;
10
+ preview: IPreview;
11
+ is_free: boolean;
12
+ privacy_enabled: boolean;
13
+ renewal_date: string;
14
+ renewal_price: number;
15
+ nameservers: string[];
16
+ dns: IDns[];
17
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -6,6 +6,7 @@ export { IPreview } from "./project/preview";
6
6
  export { IIntegration } from "./integration";
7
7
  export { IEnv } from "./env";
8
8
  export { IDomain } from "./domain";
9
+ export { IDns } from "./domain/dns";
9
10
  export { IToken } from "./token";
10
11
  export { ITeam } from "./team";
11
12
  export { IMember } from "./member";
package/domain/dns.ts ADDED
@@ -0,0 +1,30 @@
1
+ import { model, Schema } from "mongoose";
2
+ import { IDns } from "../types";
3
+ import { DNS_TYPE } from "../enum";
4
+
5
+ const dnsSchema = new Schema({
6
+ name: {
7
+ type: String,
8
+ required: true,
9
+ },
10
+ ttl: {
11
+ type: Number,
12
+ default: 3600,
13
+ },
14
+ type: {
15
+ type: String,
16
+ enum: Object.values(DNS_TYPE),
17
+ required: true,
18
+ },
19
+ value: {
20
+ type: String,
21
+ required: true,
22
+ },
23
+ domain: {
24
+ type: Schema.Types.ObjectId,
25
+ ref: "Domain",
26
+ required: true,
27
+ },
28
+ });
29
+
30
+ export default model<IDns>("Dns", dnsSchema);
@@ -1,6 +1,5 @@
1
1
  import { model, Schema } from "mongoose";
2
- import { IDomain } from "./types";
3
- import { ENVIRONMENT } from "./enum";
2
+ import { IDomain } from "../types";
4
3
 
5
4
  const domainSchema = new Schema(
6
5
  {
@@ -46,6 +45,16 @@ const domainSchema = new Schema(
46
45
  ref: "Preview",
47
46
  type: Schema.Types.ObjectId,
48
47
  },
48
+ nameservers: {
49
+ type: Array,
50
+ required: false,
51
+ },
52
+ dns: [
53
+ {
54
+ ref: "Dns",
55
+ type: Schema.Types.ObjectId,
56
+ },
57
+ ],
49
58
  },
50
59
  { timestamps: true },
51
60
  );
package/enum/index.ts CHANGED
@@ -68,3 +68,12 @@ export enum SERVER_STATUS {
68
68
  Active = "active",
69
69
  InActive = "in-active",
70
70
  }
71
+
72
+ export enum DNS_TYPE {
73
+ A = "A",
74
+ CNAME = "CNAME",
75
+ NS = "NS",
76
+ TXT = "TXT",
77
+ MX = "MX",
78
+ SPF = "SPF",
79
+ }
package/index.ts CHANGED
@@ -4,6 +4,7 @@ export { default as Preview } from "./project/preview";
4
4
  export { default as Following } from "./following";
5
5
  export { default as Integration } from "./integration";
6
6
  export { default as Domain } from "./domain";
7
+ export { default as Dns } from "./domain/dns";
7
8
  export { default as Env } from "./env";
8
9
  export { default as Token } from "./token";
9
10
  export { default as Team } from "./team";
@@ -32,6 +33,7 @@ export {
32
33
  ILog,
33
34
  ISubscription,
34
35
  ICard,
36
+ IDns,
35
37
  } from "./types";
36
38
  export {
37
39
  GIT_TYPE,
@@ -44,6 +46,7 @@ export {
44
46
  PROJECT_STATUS,
45
47
  SUBSCRIPTION_STATUS,
46
48
  CARD_TYPES,
49
+ DNS_TYPE,
47
50
  } from "./enum";
48
51
 
49
52
  import mongoose from "mongoose";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brimble/models",
3
- "version": "1.5.11",
3
+ "version": "1.5.13",
4
4
  "description": "Brimble models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,10 @@
1
+ import { Document } from "mongoose";
2
+ import { IDomain } from ".";
3
+
4
+ export interface IDns extends Document {
5
+ name: string;
6
+ ttl: number;
7
+ type: string;
8
+ value: string;
9
+ domain: IDomain;
10
+ }
@@ -1,5 +1,6 @@
1
1
  import { Document } from "mongoose";
2
- import { IPreview, IProject } from "./";
2
+ import { IPreview, IProject } from "../";
3
+ import { IDns } from "./dns";
3
4
 
4
5
  export interface IDomain extends Document {
5
6
  name: string;
@@ -12,4 +13,6 @@ export interface IDomain extends Document {
12
13
  privacy_enabled: boolean;
13
14
  renewal_date: string;
14
15
  renewal_price: number;
16
+ nameservers: string[];
17
+ dns: IDns[];
15
18
  }
package/types/index.ts CHANGED
@@ -6,6 +6,7 @@ export { IPreview } from "./project/preview";
6
6
  export { IIntegration } from "./integration";
7
7
  export { IEnv } from "./env";
8
8
  export { IDomain } from "./domain";
9
+ export { IDns } from "./domain/dns";
9
10
  export { IToken } from "./token";
10
11
  export { ITeam } from "./team";
11
12
  export { IMember } from "./member";