@likewatt/models 1.96.0 → 1.97.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/ApiKey.d.ts +22 -0
- package/dist/core/ApiKey.js +87 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Document } from 'mongoose';
|
|
2
|
+
export type ApiKeyDocument = ApiKey & Document;
|
|
3
|
+
export declare class ApiKey {
|
|
4
|
+
readonly _id: string;
|
|
5
|
+
userId: string;
|
|
6
|
+
name: string;
|
|
7
|
+
keyHash: string;
|
|
8
|
+
keyPrefix: string;
|
|
9
|
+
lastUsedAt?: Date | null;
|
|
10
|
+
revokedAt?: Date | null;
|
|
11
|
+
createdAt?: Date;
|
|
12
|
+
updatedAt?: Date;
|
|
13
|
+
}
|
|
14
|
+
export declare const ApiKeySchema: import("mongoose").Schema<ApiKey, import("mongoose").Model<ApiKey, any, any, any, Document<unknown, any, ApiKey, any, {}> & ApiKey & Required<{
|
|
15
|
+
_id: string;
|
|
16
|
+
}> & {
|
|
17
|
+
__v: number;
|
|
18
|
+
}, any>, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, ApiKey, Document<unknown, {}, import("mongoose").FlatRecord<ApiKey>, {}, import("mongoose").ResolveSchemaOptions<import("mongoose").DefaultSchemaOptions>> & import("mongoose").FlatRecord<ApiKey> & Required<{
|
|
19
|
+
_id: string;
|
|
20
|
+
}> & {
|
|
21
|
+
__v: number;
|
|
22
|
+
}>;
|
|
@@ -0,0 +1,87 @@
|
|
|
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.ApiKeySchema = exports.ApiKey = void 0;
|
|
13
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
14
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
15
|
+
const class_validator_1 = require("class-validator");
|
|
16
|
+
const uuid_1 = require("uuid");
|
|
17
|
+
let ApiKey = class ApiKey {
|
|
18
|
+
};
|
|
19
|
+
exports.ApiKey = ApiKey;
|
|
20
|
+
__decorate([
|
|
21
|
+
(0, swagger_1.ApiProperty)({ type: String, readOnly: true }),
|
|
22
|
+
(0, mongoose_1.Prop)({ type: String }),
|
|
23
|
+
__metadata("design:type", String)
|
|
24
|
+
], ApiKey.prototype, "_id", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, swagger_1.ApiProperty)({ description: 'Compte principal propriétaire de la clé' }),
|
|
27
|
+
(0, mongoose_1.Prop)({ type: String, required: true, index: true }),
|
|
28
|
+
(0, class_validator_1.IsString)(),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], ApiKey.prototype, "userId", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, swagger_1.ApiProperty)({ example: 'Prod CRM' }),
|
|
33
|
+
(0, mongoose_1.Prop)({ type: String, required: true }),
|
|
34
|
+
(0, class_validator_1.IsString)(),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], ApiKey.prototype, "name", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, swagger_1.ApiProperty)({
|
|
39
|
+
description: 'SHA-256 hex de la clé complète',
|
|
40
|
+
writeOnly: true,
|
|
41
|
+
}),
|
|
42
|
+
(0, mongoose_1.Prop)({ type: String, required: true, unique: true, index: true }),
|
|
43
|
+
(0, class_validator_1.IsString)(),
|
|
44
|
+
__metadata("design:type", String)
|
|
45
|
+
], ApiKey.prototype, "keyHash", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, swagger_1.ApiProperty)({ description: '12 premiers caractères, pour identification UI' }),
|
|
48
|
+
(0, mongoose_1.Prop)({ type: String, required: true }),
|
|
49
|
+
(0, class_validator_1.IsString)(),
|
|
50
|
+
__metadata("design:type", String)
|
|
51
|
+
], ApiKey.prototype, "keyPrefix", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, swagger_1.ApiPropertyOptional)({ type: Date }),
|
|
54
|
+
(0, mongoose_1.Prop)({ type: Date, default: null }),
|
|
55
|
+
(0, class_validator_1.IsOptional)(),
|
|
56
|
+
__metadata("design:type", Object)
|
|
57
|
+
], ApiKey.prototype, "lastUsedAt", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, swagger_1.ApiPropertyOptional)({ type: Date }),
|
|
60
|
+
(0, mongoose_1.Prop)({ type: Date, default: null }),
|
|
61
|
+
(0, class_validator_1.IsOptional)(),
|
|
62
|
+
__metadata("design:type", Object)
|
|
63
|
+
], ApiKey.prototype, "revokedAt", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, swagger_1.ApiPropertyOptional)({ type: Date, readOnly: true }),
|
|
66
|
+
__metadata("design:type", Date)
|
|
67
|
+
], ApiKey.prototype, "createdAt", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, swagger_1.ApiPropertyOptional)({ type: Date, readOnly: true }),
|
|
70
|
+
__metadata("design:type", Date)
|
|
71
|
+
], ApiKey.prototype, "updatedAt", void 0);
|
|
72
|
+
exports.ApiKey = ApiKey = __decorate([
|
|
73
|
+
(0, mongoose_1.Schema)({
|
|
74
|
+
collection: 'apiKeys',
|
|
75
|
+
id: false,
|
|
76
|
+
timestamps: true,
|
|
77
|
+
toJSON: { virtuals: true, versionKey: false },
|
|
78
|
+
toObject: { virtuals: true, versionKey: false },
|
|
79
|
+
})
|
|
80
|
+
], ApiKey);
|
|
81
|
+
exports.ApiKeySchema = mongoose_1.SchemaFactory.createForClass(ApiKey);
|
|
82
|
+
exports.ApiKeySchema.pre('save', function (next) {
|
|
83
|
+
if (!this._id) {
|
|
84
|
+
this._id = (0, uuid_1.v4)();
|
|
85
|
+
}
|
|
86
|
+
next();
|
|
87
|
+
});
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.ExtractionSource = exports.ExtractionType = exports.ExtractionSens = exports.EnedisReportOperationType = exports.EnedisReportAcquisitionMethod = void 0;
|
|
18
18
|
// Main entities
|
|
19
|
+
__exportStar(require("./core/ApiKey"), exports);
|
|
19
20
|
__exportStar(require("./core/CollectiveSite"), exports);
|
|
20
21
|
__exportStar(require("./core/Scenario"), exports);
|
|
21
22
|
__exportStar(require("./core/Site"), exports);
|