@brimble/models 3.7.0 → 3.7.2
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/dist/index.d.ts +3 -1
- package/dist/index.js +18 -2
- package/dist/intention.d.ts +30 -0
- package/dist/intention.js +36 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/intention.d.ts +13 -0
- package/dist/types/intention.js +2 -0
- package/index.ts +16 -1
- package/intention.ts +40 -0
- package/package.json +1 -1
- package/types/index.ts +1 -0
- package/types/intention.ts +14 -0
package/dist/index.d.ts
CHANGED
|
@@ -33,9 +33,11 @@ export { default as DomainRenewal } from "./domain/renewal";
|
|
|
33
33
|
export { default as WebhookCategory } from "./webhook-category";
|
|
34
34
|
export { default as WebhookEvent } from "./webhook-event";
|
|
35
35
|
export { default as WebhookSetting } from "./webhook-setting";
|
|
36
|
-
export {
|
|
36
|
+
export { default as Intention } from "./intention";
|
|
37
|
+
export { IUser, IGit, IProject, IPreview, IProjectConnection, IFollowing, IIntegration, IEnv, IServer, IDomain, IToken, IMember, ITeam, IInstalledIntegration, ILog, ISubscription, ICard, IDns, IRole, IPermission, IMemberPermission, IWallet, IDbImage, IJob, ILicense, IPlanConfiguration, IAutoScalingGroup, IComputeChange, IRegion, IVolume, IFramework, BrimbleFrameworkType, ISettings, ILoadBalancerPort, IDomainRenewal, IWebhookCategory, IWebhookEvent, IWebhookSetting, IIntention } from "./types";
|
|
37
38
|
export { GIT_TYPE, INTEGRATION_TYPES, INTEGRATION_PROVIDERS, OAUTH_PERMISSIONS, ENVIRONMENT, SERVER_STATUS, ROLES, SUBSCRIPTION_PLAN_TYPE, PROJECT_STATUS, SUBSCRIPTION_STATUS, CARD_TYPES, DNS_TYPE, PERMISSION_TYPE, REQUEST_TYPE, ServiceType, DatabaseEngine, JobStatus, LicenseStatus, REGION_CONTINENT, BUILD_DISABLED_BY, SERVER_PROTOCOL, FrameworkApplicationType, DomainRenewalStatus, NomadDeploymentStatus } from "./enum";
|
|
38
39
|
import mongoose from "mongoose";
|
|
39
40
|
export declare const connectToMongo: (mongoUrl: string, config?: mongoose.ConnectOptions) => Promise<void>;
|
|
40
41
|
export declare const db: mongoose.Connection;
|
|
41
42
|
export declare const closeMongo: () => Promise<void>;
|
|
43
|
+
export declare const healthCheckMongo: () => Promise<boolean>;
|
package/dist/index.js
CHANGED
|
@@ -12,8 +12,8 @@ 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.
|
|
16
|
-
exports.closeMongo = exports.db = exports.connectToMongo = exports.NomadDeploymentStatus = exports.DomainRenewalStatus = exports.FrameworkApplicationType = exports.SERVER_PROTOCOL = exports.BUILD_DISABLED_BY = exports.REGION_CONTINENT = exports.LicenseStatus = exports.JobStatus = exports.DatabaseEngine = exports.ServiceType = void 0;
|
|
15
|
+
exports.PERMISSION_TYPE = exports.DNS_TYPE = exports.CARD_TYPES = exports.SUBSCRIPTION_STATUS = exports.PROJECT_STATUS = exports.SUBSCRIPTION_PLAN_TYPE = exports.ROLES = exports.SERVER_STATUS = exports.ENVIRONMENT = exports.OAUTH_PERMISSIONS = exports.INTEGRATION_PROVIDERS = exports.INTEGRATION_TYPES = exports.GIT_TYPE = exports.Intention = exports.WebhookSetting = exports.WebhookEvent = exports.WebhookCategory = exports.DomainRenewal = exports.LoadBalancerPort = exports.Settings = exports.Framework = exports.Volume = exports.Region = exports.ComputeChange = exports.AutoScalingGroup = exports.PlanConfiguration = exports.Liscense = exports.Job = exports.DbImage = exports.Wallet = exports.Server = exports.Card = exports.Subscription = exports.Log = exports.Role = exports.MemberPermission = exports.Permission = exports.Member = exports.Team = exports.Token = exports.Env = exports.Dns = exports.Domain = exports.Integration = exports.Following = exports.ProjectConnection = exports.Preview = exports.DeletedProject = exports.Project = exports.User = void 0;
|
|
16
|
+
exports.healthCheckMongo = exports.closeMongo = exports.db = exports.connectToMongo = exports.NomadDeploymentStatus = exports.DomainRenewalStatus = exports.FrameworkApplicationType = exports.SERVER_PROTOCOL = exports.BUILD_DISABLED_BY = exports.REGION_CONTINENT = exports.LicenseStatus = exports.JobStatus = exports.DatabaseEngine = exports.ServiceType = exports.REQUEST_TYPE = void 0;
|
|
17
17
|
var user_1 = require("./user");
|
|
18
18
|
Object.defineProperty(exports, "User", { enumerable: true, get: function () { return __importDefault(user_1).default; } });
|
|
19
19
|
var project_1 = require("./project");
|
|
@@ -85,6 +85,8 @@ var webhook_event_1 = require("./webhook-event");
|
|
|
85
85
|
Object.defineProperty(exports, "WebhookEvent", { enumerable: true, get: function () { return __importDefault(webhook_event_1).default; } });
|
|
86
86
|
var webhook_setting_1 = require("./webhook-setting");
|
|
87
87
|
Object.defineProperty(exports, "WebhookSetting", { enumerable: true, get: function () { return __importDefault(webhook_setting_1).default; } });
|
|
88
|
+
var intention_1 = require("./intention");
|
|
89
|
+
Object.defineProperty(exports, "Intention", { enumerable: true, get: function () { return __importDefault(intention_1).default; } });
|
|
88
90
|
var enum_1 = require("./enum");
|
|
89
91
|
Object.defineProperty(exports, "GIT_TYPE", { enumerable: true, get: function () { return enum_1.GIT_TYPE; } });
|
|
90
92
|
Object.defineProperty(exports, "INTEGRATION_TYPES", { enumerable: true, get: function () { return enum_1.INTEGRATION_TYPES; } });
|
|
@@ -131,3 +133,17 @@ exports.connectToMongo = connectToMongo;
|
|
|
131
133
|
exports.db = mongoose_1.default.connection;
|
|
132
134
|
const closeMongo = () => mongoose_1.default.connection.close(true);
|
|
133
135
|
exports.closeMongo = closeMongo;
|
|
136
|
+
const healthCheckMongo = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
137
|
+
try {
|
|
138
|
+
if (mongoose_1.default.connection.readyState !== 1) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
yield mongoose_1.default.connection.db.admin().ping();
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
utils_1.log.error(`MongoDB health check failed`, error);
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
exports.healthCheckMongo = healthCheckMongo;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
+
/// <reference types="mongoose/types/session" />
|
|
20
|
+
/// <reference types="mongoose/types/types" />
|
|
21
|
+
/// <reference types="mongoose/types/utility" />
|
|
22
|
+
/// <reference types="mongoose/types/validation" />
|
|
23
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="mongoose" />
|
|
25
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
26
|
+
import { IIntention } from "./types";
|
|
27
|
+
declare const _default: import("mongoose").Model<IIntention, {}, {}, {}, import("mongoose").Document<unknown, {}, IIntention> & IIntention & {
|
|
28
|
+
_id: import("mongoose").Types.ObjectId;
|
|
29
|
+
}, any>;
|
|
30
|
+
export default _default;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
4
|
+
const intentionSchema = new mongoose_1.Schema({
|
|
5
|
+
project: {
|
|
6
|
+
ref: "Project",
|
|
7
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
8
|
+
required: true,
|
|
9
|
+
},
|
|
10
|
+
sourceName: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
destinationName: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
sourceNamespace: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: "default",
|
|
21
|
+
},
|
|
22
|
+
destinationNamespace: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: "default",
|
|
25
|
+
},
|
|
26
|
+
action: {
|
|
27
|
+
type: String,
|
|
28
|
+
enum: ["allow", "deny"],
|
|
29
|
+
default: "allow",
|
|
30
|
+
},
|
|
31
|
+
description: {
|
|
32
|
+
type: String,
|
|
33
|
+
required: false,
|
|
34
|
+
},
|
|
35
|
+
}, { timestamps: true });
|
|
36
|
+
exports.default = (0, mongoose_1.model)("Intention", intentionSchema);
|
package/dist/types/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export type { BrimbleFrameworkType, IFramework } from "./framework";
|
|
|
11
11
|
export type { IGit } from "./git";
|
|
12
12
|
export type { IInstalledIntegration } from "./installed_integration";
|
|
13
13
|
export type { IIntegration } from "./integration";
|
|
14
|
+
export type { IIntention } from "./intention";
|
|
14
15
|
export type { IJob } from "./job";
|
|
15
16
|
export type { ILicense } from "./license";
|
|
16
17
|
export type { ILoadBalancerPort } from "./load-balancer-port";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Document } from "mongoose";
|
|
2
|
+
import { IProject } from "./";
|
|
3
|
+
export interface IIntention extends Document {
|
|
4
|
+
project: IProject;
|
|
5
|
+
sourceName: string;
|
|
6
|
+
destinationName: string;
|
|
7
|
+
sourceNamespace: string;
|
|
8
|
+
destinationNamespace: string;
|
|
9
|
+
action: "allow" | "deny";
|
|
10
|
+
description?: string;
|
|
11
|
+
createdAt: Date;
|
|
12
|
+
updatedAt: Date;
|
|
13
|
+
}
|
package/index.ts
CHANGED
|
@@ -33,6 +33,7 @@ export { default as DomainRenewal } from "./domain/renewal";
|
|
|
33
33
|
export { default as WebhookCategory } from "./webhook-category";
|
|
34
34
|
export { default as WebhookEvent } from "./webhook-event";
|
|
35
35
|
export { default as WebhookSetting } from "./webhook-setting";
|
|
36
|
+
export { default as Intention } from "./intention";
|
|
36
37
|
|
|
37
38
|
export {
|
|
38
39
|
IUser,
|
|
@@ -72,7 +73,8 @@ export {
|
|
|
72
73
|
IDomainRenewal,
|
|
73
74
|
IWebhookCategory,
|
|
74
75
|
IWebhookEvent,
|
|
75
|
-
IWebhookSetting
|
|
76
|
+
IWebhookSetting,
|
|
77
|
+
IIntention
|
|
76
78
|
} from "./types";
|
|
77
79
|
export {
|
|
78
80
|
GIT_TYPE,
|
|
@@ -133,3 +135,16 @@ export const connectToMongo = async (
|
|
|
133
135
|
export const db = mongoose.connection;
|
|
134
136
|
|
|
135
137
|
export const closeMongo = () => mongoose.connection.close(true);
|
|
138
|
+
|
|
139
|
+
export const healthCheckMongo = async (): Promise<boolean> => {
|
|
140
|
+
try {
|
|
141
|
+
if (mongoose.connection.readyState !== 1) {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
await mongoose.connection.db.admin().ping();
|
|
145
|
+
return true;
|
|
146
|
+
} catch (error) {
|
|
147
|
+
log.error(`MongoDB health check failed`, error);
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
};
|
package/intention.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { model, Schema } from "mongoose";
|
|
2
|
+
import { IIntention } from "./types";
|
|
3
|
+
|
|
4
|
+
const intentionSchema = new Schema(
|
|
5
|
+
{
|
|
6
|
+
project: {
|
|
7
|
+
ref: "Project",
|
|
8
|
+
type: Schema.Types.ObjectId,
|
|
9
|
+
required: true,
|
|
10
|
+
},
|
|
11
|
+
sourceName: {
|
|
12
|
+
type: String,
|
|
13
|
+
required: true,
|
|
14
|
+
},
|
|
15
|
+
destinationName: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
sourceNamespace: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "default",
|
|
22
|
+
},
|
|
23
|
+
destinationNamespace: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: "default",
|
|
26
|
+
},
|
|
27
|
+
action: {
|
|
28
|
+
type: String,
|
|
29
|
+
enum: ["allow", "deny"],
|
|
30
|
+
default: "allow",
|
|
31
|
+
},
|
|
32
|
+
description: {
|
|
33
|
+
type: String,
|
|
34
|
+
required: false,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
{ timestamps: true },
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
export default model<IIntention>("Intention", intentionSchema);
|
package/package.json
CHANGED
package/types/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ export type { BrimbleFrameworkType, IFramework } from "./framework";
|
|
|
11
11
|
export type { IGit } from "./git";
|
|
12
12
|
export type { IInstalledIntegration } from "./installed_integration";
|
|
13
13
|
export type { IIntegration } from "./integration";
|
|
14
|
+
export type { IIntention } from "./intention";
|
|
14
15
|
export type { IJob } from "./job";
|
|
15
16
|
export type { ILicense } from "./license";
|
|
16
17
|
export type { ILoadBalancerPort } from "./load-balancer-port";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Document } from "mongoose";
|
|
2
|
+
import { IProject } from "./";
|
|
3
|
+
|
|
4
|
+
export interface IIntention extends Document {
|
|
5
|
+
project: IProject;
|
|
6
|
+
sourceName: string;
|
|
7
|
+
destinationName: string;
|
|
8
|
+
sourceNamespace: string;
|
|
9
|
+
destinationNamespace: string;
|
|
10
|
+
action: "allow" | "deny";
|
|
11
|
+
description?: string;
|
|
12
|
+
createdAt: Date;
|
|
13
|
+
updatedAt: Date;
|
|
14
|
+
}
|