@likewatt/models 1.61.0 → 1.63.0

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,4 +1,5 @@
1
1
  import { Document } from 'mongoose';
2
+ import { WebhookTenantOptions } from './webhookTypes/webhook-tenant-options';
2
3
  export type LeadTenantDocument = LeadTenant & Document;
3
4
  export declare class LeadThemeConfig {
4
5
  logoUrl?: string;
@@ -32,6 +33,7 @@ export declare const LeadLimitRuleSchema: import("mongoose").Schema<LeadLimitRul
32
33
  }>;
33
34
  export declare class LeadTenantLimits {
34
35
  subscribedPowers?: LeadLimitRule;
36
+ blockedDepartements?: number[];
35
37
  }
36
38
  export declare const LeadTenantLimitsSchema: import("mongoose").Schema<LeadTenantLimits, import("mongoose").Model<LeadTenantLimits, any, any, any, Document<unknown, any, LeadTenantLimits, any, {}> & LeadTenantLimits & {
37
39
  _id: import("mongoose").Types.ObjectId;
@@ -52,6 +54,8 @@ export declare class LeadTenant {
52
54
  isActive: boolean;
53
55
  limits?: LeadTenantLimits;
54
56
  email: string[];
57
+ webhookActive: boolean;
58
+ webhookOptions?: WebhookTenantOptions;
55
59
  createdAt?: Date | string;
56
60
  updatedAt?: Date | string;
57
61
  }
@@ -13,6 +13,7 @@ exports.LeadTenantSchema = exports.LeadTenant = exports.LeadTenantLimitsSchema =
13
13
  const mongoose_1 = require("@nestjs/mongoose");
14
14
  const uuid_1 = require("uuid");
15
15
  const Regex_1 = require("./Regex");
16
+ const webhook_tenant_options_1 = require("./webhookTypes/webhook-tenant-options");
16
17
  let LeadThemeConfig = class LeadThemeConfig {
17
18
  };
18
19
  exports.LeadThemeConfig = LeadThemeConfig;
@@ -66,6 +67,10 @@ __decorate([
66
67
  (0, mongoose_1.Prop)({ type: exports.LeadLimitRuleSchema }),
67
68
  __metadata("design:type", LeadLimitRule)
68
69
  ], LeadTenantLimits.prototype, "subscribedPowers", void 0);
70
+ __decorate([
71
+ (0, mongoose_1.Prop)({ type: [Number], default: undefined }),
72
+ __metadata("design:type", Array)
73
+ ], LeadTenantLimits.prototype, "blockedDepartements", void 0);
69
74
  exports.LeadTenantLimits = LeadTenantLimits = __decorate([
70
75
  (0, mongoose_1.Schema)({ _id: false })
71
76
  ], LeadTenantLimits);
@@ -124,6 +129,14 @@ __decorate([
124
129
  (0, mongoose_1.Prop)({ type: [String], default: [] }),
125
130
  __metadata("design:type", Array)
126
131
  ], LeadTenant.prototype, "email", void 0);
132
+ __decorate([
133
+ (0, mongoose_1.Prop)({ type: Boolean, default: false, index: true }),
134
+ __metadata("design:type", Boolean)
135
+ ], LeadTenant.prototype, "webhookActive", void 0);
136
+ __decorate([
137
+ (0, mongoose_1.Prop)({ type: webhook_tenant_options_1.WebhookTenantOptionsSchema }),
138
+ __metadata("design:type", webhook_tenant_options_1.WebhookTenantOptions)
139
+ ], LeadTenant.prototype, "webhookOptions", void 0);
127
140
  exports.LeadTenant = LeadTenant = __decorate([
128
141
  (0, mongoose_1.Schema)({
129
142
  id: false,
@@ -0,0 +1,16 @@
1
+ export declare enum WebhookAuthType {
2
+ NONE = "none",
3
+ BEARER = "bearer",
4
+ API_KEY = "apiKey"
5
+ }
6
+ export type WebhookCredentials = {
7
+ type: WebhookAuthType.NONE;
8
+ } | {
9
+ type: WebhookAuthType.BEARER;
10
+ token: string;
11
+ } | {
12
+ type: WebhookAuthType.API_KEY;
13
+ headerName: string;
14
+ apiKey: string;
15
+ };
16
+ export declare const DEFAULT_API_KEY_HEADER = "x-make-apikey";
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_API_KEY_HEADER = exports.WebhookAuthType = void 0;
4
+ var WebhookAuthType;
5
+ (function (WebhookAuthType) {
6
+ WebhookAuthType["NONE"] = "none";
7
+ WebhookAuthType["BEARER"] = "bearer";
8
+ WebhookAuthType["API_KEY"] = "apiKey";
9
+ })(WebhookAuthType || (exports.WebhookAuthType = WebhookAuthType = {}));
10
+ exports.DEFAULT_API_KEY_HEADER = 'x-make-apikey';
@@ -0,0 +1,30 @@
1
+ import { WebhookAuthType } from './webhook-auth';
2
+ export declare class WebhookTenantCredentials {
3
+ type: WebhookAuthType;
4
+ token?: string;
5
+ headerName?: string;
6
+ apiKey?: string;
7
+ }
8
+ export declare const WebhookTenantCredentialsSchema: import("mongoose").Schema<WebhookTenantCredentials, import("mongoose").Model<WebhookTenantCredentials, any, any, any, import("mongoose").Document<unknown, any, WebhookTenantCredentials, any, {}> & WebhookTenantCredentials & {
9
+ _id: import("mongoose").Types.ObjectId;
10
+ } & {
11
+ __v: number;
12
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, WebhookTenantCredentials, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<WebhookTenantCredentials>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<WebhookTenantCredentials> & {
13
+ _id: import("mongoose").Types.ObjectId;
14
+ } & {
15
+ __v: number;
16
+ }>;
17
+ export declare class WebhookTenantOptions {
18
+ endpoint: string;
19
+ authType: WebhookAuthType;
20
+ credentials?: WebhookTenantCredentials;
21
+ }
22
+ export declare const WebhookTenantOptionsSchema: import("mongoose").Schema<WebhookTenantOptions, import("mongoose").Model<WebhookTenantOptions, any, any, any, import("mongoose").Document<unknown, any, WebhookTenantOptions, any, {}> & WebhookTenantOptions & {
23
+ _id: import("mongoose").Types.ObjectId;
24
+ } & {
25
+ __v: number;
26
+ }, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, WebhookTenantOptions, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<WebhookTenantOptions>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<WebhookTenantOptions> & {
27
+ _id: import("mongoose").Types.ObjectId;
28
+ } & {
29
+ __v: number;
30
+ }>;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.WebhookTenantOptionsSchema = exports.WebhookTenantOptions = exports.WebhookTenantCredentialsSchema = exports.WebhookTenantCredentials = void 0;
13
+ const mongoose_1 = require("@nestjs/mongoose");
14
+ const webhook_auth_1 = require("./webhook-auth");
15
+ let WebhookTenantCredentials = class WebhookTenantCredentials {
16
+ };
17
+ exports.WebhookTenantCredentials = WebhookTenantCredentials;
18
+ __decorate([
19
+ (0, mongoose_1.Prop)({
20
+ type: String,
21
+ required: true,
22
+ enum: Object.values(webhook_auth_1.WebhookAuthType),
23
+ }),
24
+ __metadata("design:type", String)
25
+ ], WebhookTenantCredentials.prototype, "type", void 0);
26
+ __decorate([
27
+ (0, mongoose_1.Prop)({ type: String }),
28
+ __metadata("design:type", String)
29
+ ], WebhookTenantCredentials.prototype, "token", void 0);
30
+ __decorate([
31
+ (0, mongoose_1.Prop)({ type: String }),
32
+ __metadata("design:type", String)
33
+ ], WebhookTenantCredentials.prototype, "headerName", void 0);
34
+ __decorate([
35
+ (0, mongoose_1.Prop)({ type: String }),
36
+ __metadata("design:type", String)
37
+ ], WebhookTenantCredentials.prototype, "apiKey", void 0);
38
+ exports.WebhookTenantCredentials = WebhookTenantCredentials = __decorate([
39
+ (0, mongoose_1.Schema)({ _id: false })
40
+ ], WebhookTenantCredentials);
41
+ exports.WebhookTenantCredentialsSchema = mongoose_1.SchemaFactory.createForClass(WebhookTenantCredentials);
42
+ let WebhookTenantOptions = class WebhookTenantOptions {
43
+ };
44
+ exports.WebhookTenantOptions = WebhookTenantOptions;
45
+ __decorate([
46
+ (0, mongoose_1.Prop)({ type: String, required: true }),
47
+ __metadata("design:type", String)
48
+ ], WebhookTenantOptions.prototype, "endpoint", void 0);
49
+ __decorate([
50
+ (0, mongoose_1.Prop)({
51
+ type: String,
52
+ required: true,
53
+ enum: Object.values(webhook_auth_1.WebhookAuthType),
54
+ default: webhook_auth_1.WebhookAuthType.NONE,
55
+ }),
56
+ __metadata("design:type", String)
57
+ ], WebhookTenantOptions.prototype, "authType", void 0);
58
+ __decorate([
59
+ (0, mongoose_1.Prop)({ type: exports.WebhookTenantCredentialsSchema }),
60
+ __metadata("design:type", WebhookTenantCredentials)
61
+ ], WebhookTenantOptions.prototype, "credentials", void 0);
62
+ exports.WebhookTenantOptions = WebhookTenantOptions = __decorate([
63
+ (0, mongoose_1.Schema)({ _id: false })
64
+ ], WebhookTenantOptions);
65
+ exports.WebhookTenantOptionsSchema = mongoose_1.SchemaFactory.createForClass(WebhookTenantOptions);
package/dist/index.d.ts CHANGED
@@ -78,3 +78,5 @@ export * from './core/internal/leads-form';
78
78
  export * from './core/internal/koncile';
79
79
  export * from './core/webhookTypes/webhook-leads-output.dto';
80
80
  export * from './core/webhookTypes/webhook-optimend-output.dto';
81
+ export * from './core/webhookTypes/webhook-auth';
82
+ export * from './core/webhookTypes/webhook-tenant-options';
package/dist/index.js CHANGED
@@ -105,3 +105,5 @@ __exportStar(require("./core/internal/koncile"), exports);
105
105
  // Webhook types
106
106
  __exportStar(require("./core/webhookTypes/webhook-leads-output.dto"), exports);
107
107
  __exportStar(require("./core/webhookTypes/webhook-optimend-output.dto"), exports);
108
+ __exportStar(require("./core/webhookTypes/webhook-auth"), exports);
109
+ __exportStar(require("./core/webhookTypes/webhook-tenant-options"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@likewatt/models",
3
- "version": "1.61.0",
3
+ "version": "1.63.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {