@likewatt/models 1.12.0 → 1.14.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.
- package/dist/core/Leads.d.ts +32 -24
- package/dist/core/Leads.js +73 -130
- package/dist/core/enums/LeadsAuthMode.d.ts +4 -0
- package/dist/core/enums/LeadsAuthMode.js +8 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/dist/core/Leads.d.ts
CHANGED
|
@@ -1,43 +1,51 @@
|
|
|
1
1
|
import { Document } from 'mongoose';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
color?: string;
|
|
2
|
+
import { AuthMode } from './enums/LeadsAuthMode';
|
|
3
|
+
export type LeadWidgetTenantDocument = LeadWidgetTenant & Document;
|
|
4
|
+
export declare class LeadThemeConfig {
|
|
5
|
+
logoUrl?: string;
|
|
6
|
+
backgroundImageUrl?: string;
|
|
7
|
+
primaryColor?: string;
|
|
9
8
|
}
|
|
10
|
-
export declare const
|
|
9
|
+
export declare const LeadThemeConfigSchema: import("mongoose").Schema<LeadThemeConfig, import("mongoose").Model<LeadThemeConfig, any, any, any, Document<unknown, any, LeadThemeConfig, any, {}> & LeadThemeConfig & {
|
|
11
10
|
_id: import("mongoose").Types.ObjectId;
|
|
12
11
|
} & {
|
|
13
12
|
__v: number;
|
|
14
|
-
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions,
|
|
13
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, LeadThemeConfig, Document<unknown, {}, import("mongoose").FlatRecord<LeadThemeConfig>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<LeadThemeConfig> & {
|
|
15
14
|
_id: import("mongoose").Types.ObjectId;
|
|
16
15
|
} & {
|
|
17
16
|
__v: number;
|
|
18
17
|
}>;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*/
|
|
22
|
-
export declare class Leads {
|
|
23
|
-
_id: string;
|
|
24
|
-
userId: string;
|
|
25
|
-
url: string;
|
|
26
|
-
apiToken: string;
|
|
18
|
+
export declare class LeadAuthConfig {
|
|
19
|
+
mode: AuthMode;
|
|
27
20
|
apiLogin?: string;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
apiPasswordEncryptedOrSecretRef?: string;
|
|
22
|
+
apiTokenHash?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare const LeadAuthConfigSchema: import("mongoose").Schema<LeadAuthConfig, import("mongoose").Model<LeadAuthConfig, any, any, any, Document<unknown, any, LeadAuthConfig, any, {}> & LeadAuthConfig & {
|
|
25
|
+
_id: import("mongoose").Types.ObjectId;
|
|
26
|
+
} & {
|
|
27
|
+
__v: number;
|
|
28
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, LeadAuthConfig, Document<unknown, {}, import("mongoose").FlatRecord<LeadAuthConfig>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<LeadAuthConfig> & {
|
|
29
|
+
_id: import("mongoose").Types.ObjectId;
|
|
30
|
+
} & {
|
|
31
|
+
__v: number;
|
|
32
|
+
}>;
|
|
33
|
+
export declare class LeadWidgetTenant {
|
|
34
|
+
_id: string;
|
|
35
|
+
tenantId: string;
|
|
36
|
+
subdomain: string;
|
|
37
|
+
domain: string;
|
|
38
|
+
auth: LeadAuthConfig;
|
|
39
|
+
defaultScenarioIds: string[];
|
|
40
|
+
theme?: LeadThemeConfig;
|
|
32
41
|
isActive: boolean;
|
|
33
42
|
}
|
|
34
|
-
export declare const
|
|
43
|
+
export declare const LeadWidgetTenantSchema: import("mongoose").Schema<LeadWidgetTenant, import("mongoose").Model<LeadWidgetTenant, any, any, any, Document<unknown, any, LeadWidgetTenant, any, {}> & LeadWidgetTenant & Required<{
|
|
35
44
|
_id: string;
|
|
36
45
|
}> & {
|
|
37
46
|
__v: number;
|
|
38
|
-
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions,
|
|
47
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, LeadWidgetTenant, Document<unknown, {}, import("mongoose").FlatRecord<LeadWidgetTenant>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<LeadWidgetTenant> & Required<{
|
|
39
48
|
_id: string;
|
|
40
49
|
}> & {
|
|
41
50
|
__v: number;
|
|
42
51
|
}>;
|
|
43
|
-
export type LeadsDocument = Leads & Document;
|
package/dist/core/Leads.js
CHANGED
|
@@ -9,63 +9,57 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.LeadWidgetTenantSchema = exports.LeadWidgetTenant = exports.LeadAuthConfigSchema = exports.LeadAuthConfig = exports.LeadThemeConfigSchema = exports.LeadThemeConfig = void 0;
|
|
13
13
|
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
|
-
const swagger_1 = require("@nestjs/swagger");
|
|
15
14
|
const uuid_1 = require("uuid");
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*/
|
|
20
|
-
let LeadsConfig = class LeadsConfig {
|
|
15
|
+
const LeadsAuthMode_1 = require("./enums/LeadsAuthMode");
|
|
16
|
+
const SUBDOMAIN_REGEX = /^(?!-)[a-z0-9-]{1,63}(?<!-)$/;
|
|
17
|
+
let LeadThemeConfig = class LeadThemeConfig {
|
|
21
18
|
};
|
|
22
|
-
exports.
|
|
19
|
+
exports.LeadThemeConfig = LeadThemeConfig;
|
|
23
20
|
__decorate([
|
|
24
|
-
(0,
|
|
25
|
-
description: 'URL du logo',
|
|
26
|
-
example: 'https://example.com/logo.png',
|
|
27
|
-
}),
|
|
28
|
-
(0, mongoose_1.Prop)({ type: String, required: false }),
|
|
29
|
-
(0, class_validator_1.IsString)(),
|
|
30
|
-
(0, class_validator_1.IsOptional)(),
|
|
21
|
+
(0, mongoose_1.Prop)({ type: String }),
|
|
31
22
|
__metadata("design:type", String)
|
|
32
|
-
],
|
|
23
|
+
], LeadThemeConfig.prototype, "logoUrl", void 0);
|
|
33
24
|
__decorate([
|
|
34
|
-
(0,
|
|
35
|
-
description: "URL de l'image de fond",
|
|
36
|
-
example: 'https://example.com/background.jpg',
|
|
37
|
-
}),
|
|
38
|
-
(0, mongoose_1.Prop)({ type: String, required: false }),
|
|
39
|
-
(0, class_validator_1.IsString)(),
|
|
40
|
-
(0, class_validator_1.IsOptional)(),
|
|
25
|
+
(0, mongoose_1.Prop)({ type: String }),
|
|
41
26
|
__metadata("design:type", String)
|
|
42
|
-
],
|
|
27
|
+
], LeadThemeConfig.prototype, "backgroundImageUrl", void 0);
|
|
43
28
|
__decorate([
|
|
44
|
-
(0,
|
|
45
|
-
description: 'Couleur principale (format hex)',
|
|
46
|
-
example: '#3498db',
|
|
47
|
-
}),
|
|
48
|
-
(0, mongoose_1.Prop)({ type: String, required: false }),
|
|
49
|
-
(0, class_validator_1.IsString)(),
|
|
50
|
-
(0, class_validator_1.IsOptional)(),
|
|
29
|
+
(0, mongoose_1.Prop)({ type: String, match: /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/ }),
|
|
51
30
|
__metadata("design:type", String)
|
|
52
|
-
],
|
|
53
|
-
exports.
|
|
31
|
+
], LeadThemeConfig.prototype, "primaryColor", void 0);
|
|
32
|
+
exports.LeadThemeConfig = LeadThemeConfig = __decorate([
|
|
54
33
|
(0, mongoose_1.Schema)({ _id: false })
|
|
55
|
-
],
|
|
56
|
-
exports.
|
|
57
|
-
|
|
58
|
-
* Schéma pour les Leads
|
|
59
|
-
*/
|
|
60
|
-
let Leads = class Leads {
|
|
34
|
+
], LeadThemeConfig);
|
|
35
|
+
exports.LeadThemeConfigSchema = mongoose_1.SchemaFactory.createForClass(LeadThemeConfig);
|
|
36
|
+
let LeadAuthConfig = class LeadAuthConfig {
|
|
61
37
|
};
|
|
62
|
-
exports.
|
|
38
|
+
exports.LeadAuthConfig = LeadAuthConfig;
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, mongoose_1.Prop)({ type: String, enum: LeadsAuthMode_1.AuthMode, required: true }),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], LeadAuthConfig.prototype, "mode", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, mongoose_1.Prop)({ type: String }),
|
|
45
|
+
__metadata("design:type", String)
|
|
46
|
+
], LeadAuthConfig.prototype, "apiLogin", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, mongoose_1.Prop)({ type: String }),
|
|
49
|
+
__metadata("design:type", String)
|
|
50
|
+
], LeadAuthConfig.prototype, "apiPasswordEncryptedOrSecretRef", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, mongoose_1.Prop)({ type: String }),
|
|
53
|
+
__metadata("design:type", String)
|
|
54
|
+
], LeadAuthConfig.prototype, "apiTokenHash", void 0);
|
|
55
|
+
exports.LeadAuthConfig = LeadAuthConfig = __decorate([
|
|
56
|
+
(0, mongoose_1.Schema)({ _id: false })
|
|
57
|
+
], LeadAuthConfig);
|
|
58
|
+
exports.LeadAuthConfigSchema = mongoose_1.SchemaFactory.createForClass(LeadAuthConfig);
|
|
59
|
+
let LeadWidgetTenant = class LeadWidgetTenant {
|
|
60
|
+
};
|
|
61
|
+
exports.LeadWidgetTenant = LeadWidgetTenant;
|
|
63
62
|
__decorate([
|
|
64
|
-
(0, swagger_1.ApiProperty)({
|
|
65
|
-
description: 'Identifiant unique (UUID)',
|
|
66
|
-
example: '550e8400-e29b-41d4-a716-446655440000',
|
|
67
|
-
type: String,
|
|
68
|
-
}),
|
|
69
63
|
(0, mongoose_1.Prop)({
|
|
70
64
|
type: String,
|
|
71
65
|
unique: true,
|
|
@@ -73,111 +67,60 @@ __decorate([
|
|
|
73
67
|
index: true,
|
|
74
68
|
default: () => (0, uuid_1.v4)(),
|
|
75
69
|
}),
|
|
76
|
-
(0, class_validator_1.IsString)(),
|
|
77
70
|
__metadata("design:type", String)
|
|
78
|
-
],
|
|
71
|
+
], LeadWidgetTenant.prototype, "_id", void 0);
|
|
79
72
|
__decorate([
|
|
80
|
-
(0, swagger_1.ApiProperty)({
|
|
81
|
-
description: "Identifiant de l'utilisateur propriétaire",
|
|
82
|
-
example: '2M61PGSm7lRpqXeaDacbAYOLTYG3',
|
|
83
|
-
}),
|
|
84
73
|
(0, mongoose_1.Prop)({ type: String, required: true, index: true }),
|
|
85
|
-
(0, class_validator_1.IsString)(),
|
|
86
|
-
__metadata("design:type", String)
|
|
87
|
-
], Leads.prototype, "userId", void 0);
|
|
88
|
-
__decorate([
|
|
89
|
-
(0, swagger_1.ApiProperty)({
|
|
90
|
-
description: 'URL leads',
|
|
91
|
-
example: 'https://likewatt.autoconsommation.eu',
|
|
92
|
-
}),
|
|
93
|
-
(0, mongoose_1.Prop)({ type: String, required: true }),
|
|
94
|
-
(0, class_validator_1.IsString)(),
|
|
95
74
|
__metadata("design:type", String)
|
|
96
|
-
],
|
|
75
|
+
], LeadWidgetTenant.prototype, "tenantId", void 0);
|
|
97
76
|
__decorate([
|
|
98
|
-
(0,
|
|
99
|
-
|
|
100
|
-
|
|
77
|
+
(0, mongoose_1.Prop)({
|
|
78
|
+
type: String,
|
|
79
|
+
required: true,
|
|
80
|
+
lowercase: true,
|
|
81
|
+
trim: true,
|
|
82
|
+
match: SUBDOMAIN_REGEX,
|
|
101
83
|
}),
|
|
102
|
-
(0, mongoose_1.Prop)({ type: String, required: true, unique: true }),
|
|
103
|
-
(0, class_validator_1.IsString)(),
|
|
104
84
|
__metadata("design:type", String)
|
|
105
|
-
],
|
|
85
|
+
], LeadWidgetTenant.prototype, "subdomain", void 0);
|
|
106
86
|
__decorate([
|
|
107
|
-
(0,
|
|
108
|
-
|
|
109
|
-
|
|
87
|
+
(0, mongoose_1.Prop)({
|
|
88
|
+
type: String,
|
|
89
|
+
required: true,
|
|
90
|
+
lowercase: true,
|
|
91
|
+
trim: true,
|
|
92
|
+
default: 'autoconsommation.eu',
|
|
110
93
|
}),
|
|
111
|
-
(0, mongoose_1.Prop)({ type: String, required: false }),
|
|
112
|
-
(0, class_validator_1.IsString)(),
|
|
113
|
-
(0, class_validator_1.IsOptional)(),
|
|
114
94
|
__metadata("design:type", String)
|
|
115
|
-
],
|
|
95
|
+
], LeadWidgetTenant.prototype, "domain", void 0);
|
|
116
96
|
__decorate([
|
|
117
|
-
(0,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}),
|
|
121
|
-
(0, mongoose_1.Prop)({ type: String, required: false }),
|
|
122
|
-
(0, class_validator_1.IsString)(),
|
|
123
|
-
(0, class_validator_1.IsOptional)(),
|
|
124
|
-
__metadata("design:type", String)
|
|
125
|
-
], Leads.prototype, "apiPassword", void 0);
|
|
97
|
+
(0, mongoose_1.Prop)({ type: exports.LeadAuthConfigSchema, required: true }),
|
|
98
|
+
__metadata("design:type", LeadAuthConfig)
|
|
99
|
+
], LeadWidgetTenant.prototype, "auth", void 0);
|
|
126
100
|
__decorate([
|
|
127
|
-
(0, swagger_1.ApiProperty)({
|
|
128
|
-
description: 'Tableau des identifiants de scénarios par défaut',
|
|
129
|
-
example: [
|
|
130
|
-
'550e8400-e29b-41d4-a716-446655440001',
|
|
131
|
-
'550e8400-e29b-41d4-a716-446655440002',
|
|
132
|
-
'550e8400-e29b-41d4-a716-446655440003',
|
|
133
|
-
],
|
|
134
|
-
type: [String],
|
|
135
|
-
}),
|
|
136
101
|
(0, mongoose_1.Prop)({ type: [String], default: [] }),
|
|
137
|
-
(0, class_validator_1.IsArray)(),
|
|
138
|
-
(0, class_validator_1.IsString)({ each: true }),
|
|
139
102
|
__metadata("design:type", Array)
|
|
140
|
-
],
|
|
141
|
-
__decorate([
|
|
142
|
-
(0, swagger_1.ApiPropertyOptional)({
|
|
143
|
-
description: 'Configuration visuelle des leads',
|
|
144
|
-
type: LeadsConfig,
|
|
145
|
-
}),
|
|
146
|
-
(0, mongoose_1.Prop)({ type: exports.LeadsConfigSchema, required: false }),
|
|
147
|
-
(0, class_validator_1.IsObject)(),
|
|
148
|
-
(0, class_validator_1.IsOptional)(),
|
|
149
|
-
__metadata("design:type", LeadsConfig)
|
|
150
|
-
], Leads.prototype, "config", void 0);
|
|
103
|
+
], LeadWidgetTenant.prototype, "defaultScenarioIds", void 0);
|
|
151
104
|
__decorate([
|
|
152
|
-
(0,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
'550e8400-e29b-41d4-a716-446655440010',
|
|
156
|
-
'550e8400-e29b-41d4-a716-446655440011',
|
|
157
|
-
],
|
|
158
|
-
type: [String],
|
|
159
|
-
}),
|
|
160
|
-
(0, mongoose_1.Prop)({ type: [String], default: [] }),
|
|
161
|
-
(0, class_validator_1.IsArray)(),
|
|
162
|
-
(0, class_validator_1.IsString)({ each: true }),
|
|
163
|
-
(0, class_validator_1.IsOptional)(),
|
|
164
|
-
__metadata("design:type", Array)
|
|
165
|
-
], Leads.prototype, "projects", void 0);
|
|
105
|
+
(0, mongoose_1.Prop)({ type: exports.LeadThemeConfigSchema }),
|
|
106
|
+
__metadata("design:type", LeadThemeConfig)
|
|
107
|
+
], LeadWidgetTenant.prototype, "theme", void 0);
|
|
166
108
|
__decorate([
|
|
167
|
-
(0,
|
|
168
|
-
description: 'Indique si le compte Leads est actif',
|
|
169
|
-
example: true,
|
|
170
|
-
}),
|
|
171
|
-
(0, mongoose_1.Prop)({ type: Boolean, default: true }),
|
|
172
|
-
(0, class_validator_1.IsBoolean)(),
|
|
109
|
+
(0, mongoose_1.Prop)({ type: Boolean, default: true, index: true }),
|
|
173
110
|
__metadata("design:type", Boolean)
|
|
174
|
-
],
|
|
175
|
-
exports.
|
|
111
|
+
], LeadWidgetTenant.prototype, "isActive", void 0);
|
|
112
|
+
exports.LeadWidgetTenant = LeadWidgetTenant = __decorate([
|
|
176
113
|
(0, mongoose_1.Schema)({
|
|
177
114
|
id: false,
|
|
178
115
|
timestamps: true,
|
|
179
116
|
toJSON: { virtuals: true, versionKey: false },
|
|
180
117
|
toObject: { virtuals: true, versionKey: false },
|
|
181
118
|
})
|
|
182
|
-
],
|
|
183
|
-
exports.
|
|
119
|
+
], LeadWidgetTenant);
|
|
120
|
+
exports.LeadWidgetTenantSchema = mongoose_1.SchemaFactory.createForClass(LeadWidgetTenant);
|
|
121
|
+
// Index composé : un subdomain unique par domaine
|
|
122
|
+
exports.LeadWidgetTenantSchema.index({ domain: 1, subdomain: 1 }, { unique: true });
|
|
123
|
+
// Virtuel : URL publique dérivée
|
|
124
|
+
exports.LeadWidgetTenantSchema.virtual('publicBaseUrl').get(function () {
|
|
125
|
+
return `https://${this.subdomain}.${this.domain}`;
|
|
126
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthMode = void 0;
|
|
4
|
+
var AuthMode;
|
|
5
|
+
(function (AuthMode) {
|
|
6
|
+
AuthMode["V1_LOGIN_PASSWORD"] = "v1_login_password";
|
|
7
|
+
AuthMode["V2_TOKEN"] = "v2_token";
|
|
8
|
+
})(AuthMode || (exports.AuthMode = AuthMode = {}));
|
package/dist/index.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export * from './core/internal/enums';
|
|
|
27
27
|
export * from './core/enums/BuildingDataStatus';
|
|
28
28
|
export * from './core/enums/FileType';
|
|
29
29
|
export * from './core/enums/ImageryQuality';
|
|
30
|
+
export * from './core/enums/LeadsAuthMode';
|
|
30
31
|
export * from './core/internal/battery-params';
|
|
31
32
|
export * from './core/internal/bounding-box';
|
|
32
33
|
export * from './core/internal/building-data';
|
package/dist/index.js
CHANGED
|
@@ -50,6 +50,7 @@ __exportStar(require("./core/internal/enums"), exports);
|
|
|
50
50
|
__exportStar(require("./core/enums/BuildingDataStatus"), exports);
|
|
51
51
|
__exportStar(require("./core/enums/FileType"), exports);
|
|
52
52
|
__exportStar(require("./core/enums/ImageryQuality"), exports);
|
|
53
|
+
__exportStar(require("./core/enums/LeadsAuthMode"), exports);
|
|
53
54
|
// Sub-models
|
|
54
55
|
__exportStar(require("./core/internal/battery-params"), exports);
|
|
55
56
|
__exportStar(require("./core/internal/bounding-box"), exports);
|