@likewatt/models 1.62.0 → 1.64.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;
@@ -53,6 +54,8 @@ export declare class LeadTenant {
53
54
  isActive: boolean;
54
55
  limits?: LeadTenantLimits;
55
56
  email: string[];
57
+ webhookActive: boolean;
58
+ webhookOptions?: WebhookTenantOptions;
56
59
  createdAt?: Date | string;
57
60
  updatedAt?: Date | string;
58
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;
@@ -128,6 +129,14 @@ __decorate([
128
129
  (0, mongoose_1.Prop)({ type: [String], default: [] }),
129
130
  __metadata("design:type", Array)
130
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);
131
140
  exports.LeadTenant = LeadTenant = __decorate([
132
141
  (0, mongoose_1.Schema)({
133
142
  id: false,
package/dist/core/Site.js CHANGED
@@ -14,6 +14,7 @@ const mongoose_1 = require("@nestjs/mongoose");
14
14
  const swagger_1 = require("@nestjs/swagger");
15
15
  const uuid_1 = require("uuid");
16
16
  const class_validator_1 = require("class-validator");
17
+ const class_transformer_1 = require("class-transformer");
17
18
  const enums_1 = require("./internal/enums");
18
19
  const energy_price_model_1 = require("./internal/energy-price.model");
19
20
  const peak_hour_model_1 = require("./internal/peak-hour.model");
@@ -230,6 +231,7 @@ __decorate([
230
231
  (0, mongoose_1.Prop)({ type: Date, required: false }),
231
232
  (0, class_validator_1.IsOptional)(),
232
233
  (0, class_validator_1.IsDate)(),
234
+ (0, class_transformer_1.Type)(() => Date),
233
235
  __metadata("design:type", Object)
234
236
  ], Site.prototype, "automaticUpdateRetryAt", void 0);
235
237
  __decorate([
@@ -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.62.0",
3
+ "version": "1.64.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -32,6 +32,7 @@
32
32
  "dependencies": {
33
33
  "@nestjs/mongoose": "^11.0.3",
34
34
  "@nestjs/swagger": "^11.2.0",
35
+ "class-transformer": "^0.5.1",
35
36
  "class-validator": "^0.14.2",
36
37
  "eslint": "^9.26.0",
37
38
  "eslint-config-prettier": "^10.1.5",