@brimble/models 3.7.1 → 3.7.3
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/provider.d.ts +30 -0
- package/dist/provider.js +10 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/provider.d.ts +7 -0
- package/dist/types/provider.js +2 -0
- package/index.ts +16 -1
- package/package.json +1 -1
- package/provider.ts +11 -0
- package/types/index.ts +1 -0
- package/types/provider.ts +8 -0
package/dist/index.d.ts
CHANGED
|
@@ -34,9 +34,11 @@ 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
36
|
export { default as Intention } from "./intention";
|
|
37
|
-
export {
|
|
37
|
+
export { default as Provider } from "./provider";
|
|
38
|
+
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, IProvider } from "./types";
|
|
38
39
|
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";
|
|
39
40
|
import mongoose from "mongoose";
|
|
40
41
|
export declare const connectToMongo: (mongoUrl: string, config?: mongoose.ConnectOptions) => Promise<void>;
|
|
41
42
|
export declare const db: mongoose.Connection;
|
|
42
43
|
export declare const closeMongo: () => Promise<void>;
|
|
44
|
+
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 = exports.REQUEST_TYPE = void 0;
|
|
15
|
+
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.Provider = 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 = exports.PERMISSION_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");
|
|
@@ -87,6 +87,8 @@ var webhook_setting_1 = require("./webhook-setting");
|
|
|
87
87
|
Object.defineProperty(exports, "WebhookSetting", { enumerable: true, get: function () { return __importDefault(webhook_setting_1).default; } });
|
|
88
88
|
var intention_1 = require("./intention");
|
|
89
89
|
Object.defineProperty(exports, "Intention", { enumerable: true, get: function () { return __importDefault(intention_1).default; } });
|
|
90
|
+
var provider_1 = require("./provider");
|
|
91
|
+
Object.defineProperty(exports, "Provider", { enumerable: true, get: function () { return __importDefault(provider_1).default; } });
|
|
90
92
|
var enum_1 = require("./enum");
|
|
91
93
|
Object.defineProperty(exports, "GIT_TYPE", { enumerable: true, get: function () { return enum_1.GIT_TYPE; } });
|
|
92
94
|
Object.defineProperty(exports, "INTEGRATION_TYPES", { enumerable: true, get: function () { return enum_1.INTEGRATION_TYPES; } });
|
|
@@ -133,3 +135,17 @@ exports.connectToMongo = connectToMongo;
|
|
|
133
135
|
exports.db = mongoose_1.default.connection;
|
|
134
136
|
const closeMongo = () => mongoose_1.default.connection.close(true);
|
|
135
137
|
exports.closeMongo = closeMongo;
|
|
138
|
+
const healthCheckMongo = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
139
|
+
try {
|
|
140
|
+
if (mongoose_1.default.connection.readyState !== 1) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
yield mongoose_1.default.connection.db.admin().ping();
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
utils_1.log.error(`MongoDB health check failed`, error);
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
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 { IProvider } from "./types/provider";
|
|
27
|
+
declare const _default: import("mongoose").Model<IProvider, {}, {}, {}, import("mongoose").Document<unknown, {}, IProvider> & IProvider & {
|
|
28
|
+
_id: import("mongoose").Types.ObjectId;
|
|
29
|
+
}, any>;
|
|
30
|
+
export default _default;
|
package/dist/provider.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mongoose_1 = require("mongoose");
|
|
4
|
+
const providerSchema = new mongoose_1.Schema({
|
|
5
|
+
name: { type: String, required: true },
|
|
6
|
+
slug: { type: String, required: true, unique: true },
|
|
7
|
+
logo: { type: String, required: true },
|
|
8
|
+
enabled: { type: Boolean, default: true },
|
|
9
|
+
});
|
|
10
|
+
exports.default = (0, mongoose_1.model)("Provider", providerSchema, "providers");
|
package/dist/types/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export type { IMember } from "./member";
|
|
|
20
20
|
export type { IMemberPermission } from "./member-permission";
|
|
21
21
|
export type { IPermission } from "./permission";
|
|
22
22
|
export type { IPlanConfiguration } from "./plan_configuration";
|
|
23
|
+
export type { IProvider } from "./provider";
|
|
23
24
|
export type { IProject } from "./project";
|
|
24
25
|
export type { IProjectConnection } from "./project/connection";
|
|
25
26
|
export type { IPreview } from "./project/preview";
|
package/index.ts
CHANGED
|
@@ -34,6 +34,7 @@ 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
36
|
export { default as Intention } from "./intention";
|
|
37
|
+
export { default as Provider } from "./provider";
|
|
37
38
|
|
|
38
39
|
export {
|
|
39
40
|
IUser,
|
|
@@ -74,7 +75,8 @@ export {
|
|
|
74
75
|
IWebhookCategory,
|
|
75
76
|
IWebhookEvent,
|
|
76
77
|
IWebhookSetting,
|
|
77
|
-
IIntention
|
|
78
|
+
IIntention,
|
|
79
|
+
IProvider
|
|
78
80
|
} from "./types";
|
|
79
81
|
export {
|
|
80
82
|
GIT_TYPE,
|
|
@@ -135,3 +137,16 @@ export const connectToMongo = async (
|
|
|
135
137
|
export const db = mongoose.connection;
|
|
136
138
|
|
|
137
139
|
export const closeMongo = () => mongoose.connection.close(true);
|
|
140
|
+
|
|
141
|
+
export const healthCheckMongo = async (): Promise<boolean> => {
|
|
142
|
+
try {
|
|
143
|
+
if (mongoose.connection.readyState !== 1) {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
await mongoose.connection.db.admin().ping();
|
|
147
|
+
return true;
|
|
148
|
+
} catch (error) {
|
|
149
|
+
log.error(`MongoDB health check failed`, error);
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
};
|
package/package.json
CHANGED
package/provider.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Schema, model } from "mongoose";
|
|
2
|
+
import { IProvider } from "./types/provider";
|
|
3
|
+
|
|
4
|
+
const providerSchema = new Schema({
|
|
5
|
+
name: { type: String, required: true },
|
|
6
|
+
slug: { type: String, required: true, unique: true },
|
|
7
|
+
logo: { type: String, required: true },
|
|
8
|
+
enabled: { type: Boolean, default: true },
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export default model<IProvider>("Provider", providerSchema, "providers");
|
package/types/index.ts
CHANGED
|
@@ -20,6 +20,7 @@ export type { IMember } from "./member";
|
|
|
20
20
|
export type { IMemberPermission } from "./member-permission";
|
|
21
21
|
export type { IPermission } from "./permission";
|
|
22
22
|
export type { IPlanConfiguration } from "./plan_configuration";
|
|
23
|
+
export type { IProvider } from "./provider";
|
|
23
24
|
export type { IProject } from "./project";
|
|
24
25
|
export type { IProjectConnection } from "./project/connection";
|
|
25
26
|
export type { IPreview } from "./project/preview";
|