@my-devkit/core 1.0.18
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/command.d.ts +5 -0
- package/command.js +26 -0
- package/command.js.map +1 -0
- package/date-helper.d.ts +5 -0
- package/date-helper.js +30 -0
- package/date-helper.js.map +1 -0
- package/decorators/cacheable.decorator.d.ts +1 -0
- package/decorators/cacheable.decorator.js +29 -0
- package/decorators/cacheable.decorator.js.map +1 -0
- package/decorators/index.d.ts +2 -0
- package/decorators/index.js +15 -0
- package/decorators/index.js.map +1 -0
- package/decorators/retryable.decorator.d.ts +2 -0
- package/decorators/retryable.decorator.js +64 -0
- package/decorators/retryable.decorator.js.map +1 -0
- package/document.d.ts +4 -0
- package/document.js +3 -0
- package/document.js.map +1 -0
- package/enum-helper.d.ts +7 -0
- package/enum-helper.js +31 -0
- package/enum-helper.js.map +1 -0
- package/errors/bad-request-error.d.ts +5 -0
- package/errors/bad-request-error.js +30 -0
- package/errors/bad-request-error.js.map +1 -0
- package/errors/domain-error.d.ts +5 -0
- package/errors/domain-error.js +30 -0
- package/errors/domain-error.js.map +1 -0
- package/errors/error-base.d.ts +3 -0
- package/errors/error-base.js +3 -0
- package/errors/error-base.js.map +1 -0
- package/errors/forbidden-error.d.ts +5 -0
- package/errors/forbidden-error.js +30 -0
- package/errors/forbidden-error.js.map +1 -0
- package/errors/index.d.ts +7 -0
- package/errors/index.js +20 -0
- package/errors/index.js.map +1 -0
- package/errors/not-found-error.d.ts +5 -0
- package/errors/not-found-error.js +30 -0
- package/errors/not-found-error.js.map +1 -0
- package/errors/not-implemented-error.d.ts +5 -0
- package/errors/not-implemented-error.js +30 -0
- package/errors/not-implemented-error.js.map +1 -0
- package/errors/unauthorized-error.d.ts +5 -0
- package/errors/unauthorized-error.js +30 -0
- package/errors/unauthorized-error.js.map +1 -0
- package/guid/index.d.ts +1 -0
- package/guid/index.js +6 -0
- package/guid/index.js.map +1 -0
- package/index.d.ts +18 -0
- package/index.js +33 -0
- package/index.js.map +1 -0
- package/logger.d.ts +26 -0
- package/logger.js +74 -0
- package/logger.js.map +1 -0
- package/maintenance-model.d.ts +5 -0
- package/maintenance-model.js +49 -0
- package/maintenance-model.js.map +1 -0
- package/model.d.ts +7 -0
- package/model.js +34 -0
- package/model.js.map +1 -0
- package/my-devkit-core-1.0.18.tgz +0 -0
- package/package.json +47 -0
- package/release-model.d.ts +5 -0
- package/release-model.js +49 -0
- package/release-model.js.map +1 -0
- package/retry.d.ts +16 -0
- package/retry.js +96 -0
- package/retry.js.map +1 -0
- package/serialize/deserialize.d.ts +1 -0
- package/serialize/deserialize.js +14 -0
- package/serialize/deserialize.js.map +1 -0
- package/serialize/index.d.ts +4 -0
- package/serialize/index.js +20 -0
- package/serialize/index.js.map +1 -0
- package/serialize/serializable.d.ts +8 -0
- package/serialize/serializable.js +29 -0
- package/serialize/serializable.js.map +1 -0
- package/serialize/serialize.d.ts +2 -0
- package/serialize/serialize.js +9 -0
- package/serialize/serialize.js.map +1 -0
- package/sleep.d.ts +5 -0
- package/sleep.js +52 -0
- package/sleep.js.map +1 -0
- package/validators/custom-validators/camel-case.d.ts +2 -0
- package/validators/custom-validators/camel-case.js +22 -0
- package/validators/custom-validators/camel-case.js.map +1 -0
- package/validators/custom-validators/equals-to.d.ts +2 -0
- package/validators/custom-validators/equals-to.js +24 -0
- package/validators/custom-validators/equals-to.js.map +1 -0
- package/validators/custom-validators/greater-or-equal-than.d.ts +2 -0
- package/validators/custom-validators/greater-or-equal-than.js +27 -0
- package/validators/custom-validators/greater-or-equal-than.js.map +1 -0
- package/validators/custom-validators/greater-than-date.d.ts +2 -0
- package/validators/custom-validators/greater-than-date.js +32 -0
- package/validators/custom-validators/greater-than-date.js.map +1 -0
- package/validators/custom-validators/index.d.ts +7 -0
- package/validators/custom-validators/index.js +20 -0
- package/validators/custom-validators/index.js.map +1 -0
- package/validators/custom-validators/is-not-in-relative-to.d.ts +2 -0
- package/validators/custom-validators/is-not-in-relative-to.js +29 -0
- package/validators/custom-validators/is-not-in-relative-to.js.map +1 -0
- package/validators/custom-validators/is-optional-if.d.ts +2 -0
- package/validators/custom-validators/is-optional-if.js +24 -0
- package/validators/custom-validators/is-optional-if.js.map +1 -0
- package/validators/custom-validators/pascal-case.d.ts +2 -0
- package/validators/custom-validators/pascal-case.js +22 -0
- package/validators/custom-validators/pascal-case.js.map +1 -0
- package/validators/index.d.ts +3 -0
- package/validators/index.js +89 -0
- package/validators/index.js.map +1 -0
- package/validators/validate.d.ts +2 -0
- package/validators/validate.js +134 -0
- package/validators/validate.js.map +1 -0
- package/validators/validation-error.d.ts +9 -0
- package/validators/validation-error.js +29 -0
- package/validators/validation-error.js.map +1 -0
- package/vendors/index.d.ts +1 -0
- package/vendors/index.js +14 -0
- package/vendors/index.js.map +1 -0
- package/vendors/lodash.d.ts +26 -0
- package/vendors/lodash.js +21 -0
- package/vendors/lodash.js.map +1 -0
package/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.ValidationError = exports.Validators = void 0;
|
|
14
|
+
var validators = require("./validators");
|
|
15
|
+
__exportStar(require("./decorators"), exports);
|
|
16
|
+
__exportStar(require("./document"), exports);
|
|
17
|
+
__exportStar(require("./command"), exports);
|
|
18
|
+
__exportStar(require("./date-helper"), exports);
|
|
19
|
+
__exportStar(require("./enum-helper"), exports);
|
|
20
|
+
__exportStar(require("./errors"), exports);
|
|
21
|
+
__exportStar(require("./guid"), exports);
|
|
22
|
+
__exportStar(require("./logger"), exports);
|
|
23
|
+
__exportStar(require("./model"), exports);
|
|
24
|
+
__exportStar(require("./maintenance-model"), exports);
|
|
25
|
+
__exportStar(require("./release-model"), exports);
|
|
26
|
+
__exportStar(require("./serialize"), exports);
|
|
27
|
+
__exportStar(require("./retry"), exports);
|
|
28
|
+
__exportStar(require("./sleep"), exports);
|
|
29
|
+
__exportStar(require("./vendors"), exports);
|
|
30
|
+
exports.Validators = validators;
|
|
31
|
+
var validation_error_1 = require("./validators/validation-error");
|
|
32
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return validation_error_1.ValidationError; } });
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,yCAA2C;AAE3C,+CAA6B;AAC7B,6CAA2B;AAC3B,4CAA0B;AAC1B,gDAA8B;AAC9B,gDAA8B;AAC9B,2CAAyB;AACzB,yCAAuB;AACvB,2CAAyB;AACzB,0CAAwB;AACxB,sDAAoC;AACpC,kDAAgC;AAChC,8CAA4B;AAC5B,0CAAwB;AACxB,0CAAwB;AACxB,4CAA0B;AACb,QAAA,UAAU,GAAG,UAAU,CAAC;AACrC,kEAAgE;AAAvD,mHAAA,eAAe,OAAA"}
|
package/logger.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare class Logger {
|
|
2
|
+
private static implementations;
|
|
3
|
+
static registerLogger(logger: Logger.Implementation): void;
|
|
4
|
+
static debug(message: string, meta?: Logger.LogMetaData): void;
|
|
5
|
+
static info(message: string, meta?: Logger.LogMetaData): void;
|
|
6
|
+
static infoWithElapesedTime(message: string, startDate: Date, meta?: Logger.LogMetaData): void;
|
|
7
|
+
static warn(message: string, meta?: Logger.LogMetaData): void;
|
|
8
|
+
static error(message: string, meta?: Logger.LogMetaData): void;
|
|
9
|
+
}
|
|
10
|
+
export declare namespace Logger {
|
|
11
|
+
interface LogMetaData {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}
|
|
14
|
+
interface Implementation {
|
|
15
|
+
debug(message: string, data: LogMetaData): void;
|
|
16
|
+
info(message: string, data: LogMetaData): void;
|
|
17
|
+
warn(message: string, data: LogMetaData): void;
|
|
18
|
+
error(message: string, data: LogMetaData): void;
|
|
19
|
+
}
|
|
20
|
+
class ConsoleImplementation implements Implementation {
|
|
21
|
+
debug(message: string): void;
|
|
22
|
+
info(message: string): void;
|
|
23
|
+
warn(message: string): void;
|
|
24
|
+
error(message: string): void;
|
|
25
|
+
}
|
|
26
|
+
}
|
package/logger.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.Logger = void 0;
|
|
15
|
+
var date_helper_1 = require("./date-helper");
|
|
16
|
+
var Logger = /** @class */ (function () {
|
|
17
|
+
function Logger() {
|
|
18
|
+
}
|
|
19
|
+
Logger.registerLogger = function (logger) {
|
|
20
|
+
this.implementations.push(logger);
|
|
21
|
+
};
|
|
22
|
+
Logger.debug = function (message, meta) {
|
|
23
|
+
for (var _i = 0, _a = this.implementations; _i < _a.length; _i++) {
|
|
24
|
+
var implementation = _a[_i];
|
|
25
|
+
implementation.debug(message, meta);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
Logger.info = function (message, meta) {
|
|
29
|
+
for (var _i = 0, _a = this.implementations; _i < _a.length; _i++) {
|
|
30
|
+
var implementation = _a[_i];
|
|
31
|
+
implementation.info(message, meta);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
Logger.infoWithElapesedTime = function (message, startDate, meta) {
|
|
35
|
+
this.info(message, __assign(__assign({}, meta), { elpasedTime: { ms: date_helper_1.DateHelper.getElapsedTime(startDate), readable: date_helper_1.DateHelper.getReadableElapsedTime(startDate) } }));
|
|
36
|
+
};
|
|
37
|
+
Logger.warn = function (message, meta) {
|
|
38
|
+
for (var _i = 0, _a = this.implementations; _i < _a.length; _i++) {
|
|
39
|
+
var implementation = _a[_i];
|
|
40
|
+
implementation.warn(message, meta);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
Logger.error = function (message, meta) {
|
|
44
|
+
for (var _i = 0, _a = this.implementations; _i < _a.length; _i++) {
|
|
45
|
+
var implementation = _a[_i];
|
|
46
|
+
implementation.error(message, meta);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
Logger.implementations = [];
|
|
50
|
+
return Logger;
|
|
51
|
+
}());
|
|
52
|
+
exports.Logger = Logger;
|
|
53
|
+
(function (Logger) {
|
|
54
|
+
var ConsoleImplementation = /** @class */ (function () {
|
|
55
|
+
function ConsoleImplementation() {
|
|
56
|
+
}
|
|
57
|
+
ConsoleImplementation.prototype.debug = function (message) {
|
|
58
|
+
console.debug("debug: " + message);
|
|
59
|
+
};
|
|
60
|
+
ConsoleImplementation.prototype.info = function (message) {
|
|
61
|
+
console.info("info: " + message);
|
|
62
|
+
};
|
|
63
|
+
ConsoleImplementation.prototype.warn = function (message) {
|
|
64
|
+
console.warn("warn: " + message);
|
|
65
|
+
};
|
|
66
|
+
ConsoleImplementation.prototype.error = function (message) {
|
|
67
|
+
console.error("error: " + message);
|
|
68
|
+
};
|
|
69
|
+
return ConsoleImplementation;
|
|
70
|
+
}());
|
|
71
|
+
Logger.ConsoleImplementation = ConsoleImplementation;
|
|
72
|
+
})(Logger = exports.Logger || (exports.Logger = {}));
|
|
73
|
+
exports.Logger = Logger;
|
|
74
|
+
//# sourceMappingURL=logger.js.map
|
package/logger.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,6CAA2C;AAE3C;IAAA;IAqCA,CAAC;IAlCiB,qBAAc,GAA5B,UAA6B,MAA6B;QACtD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;IAEa,YAAK,GAAnB,UAAoB,OAAe,EAAE,IAAyB;QAC1D,KAA6B,UAAoB,EAApB,KAAA,IAAI,CAAC,eAAe,EAApB,cAAoB,EAApB,IAAoB,EAAE;YAA9C,IAAM,cAAc,SAAA;YACrB,cAAc,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;SACvC;IACL,CAAC;IAEa,WAAI,GAAlB,UAAmB,OAAe,EAAE,IAAyB;QACzD,KAA6B,UAAoB,EAApB,KAAA,IAAI,CAAC,eAAe,EAApB,cAAoB,EAApB,IAAoB,EAAE;YAA9C,IAAM,cAAc,SAAA;YACrB,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;SACtC;IACL,CAAC;IAEa,2BAAoB,GAAlC,UAAmC,OAAe,EAAE,SAAe,EAAE,IAAyB;QAC1F,IAAI,CAAC,IAAI,CAAC,OAAO,wBACV,IAAI,KACP,WAAW,EAAE,EAAE,EAAE,EAAE,wBAAU,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,wBAAU,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE,IACnH,CAAC;IACP,CAAC;IAEa,WAAI,GAAlB,UAAmB,OAAe,EAAE,IAAyB;QACzD,KAA6B,UAAoB,EAApB,KAAA,IAAI,CAAC,eAAe,EAApB,cAAoB,EAApB,IAAoB,EAAE;YAA9C,IAAM,cAAc,SAAA;YACrB,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;SACtC;IACL,CAAC;IAEa,YAAK,GAAnB,UAAoB,OAAe,EAAE,IAAyB;QAC1D,KAA6B,UAAoB,EAApB,KAAA,IAAI,CAAC,eAAe,EAApB,cAAoB,EAApB,IAAoB,EAAE;YAA9C,IAAM,cAAc,SAAA;YACrB,cAAc,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;SACvC;IACL,CAAC;IAnCc,sBAAe,GAA4B,EAAE,CAAC;IAoCjE,aAAC;CAAA,AArCD,IAqCC;AArCY,wBAAM;AAuCnB,WAAiB,MAAM;IAYnB;QAAA;QAgBA,CAAC;QAfU,qCAAK,GAAZ,UAAa,OAAe;YACxB,OAAO,CAAC,KAAK,CAAC,YAAU,OAAS,CAAC,CAAC;QACvC,CAAC;QAEM,oCAAI,GAAX,UAAY,OAAe;YACvB,OAAO,CAAC,IAAI,CAAC,WAAS,OAAS,CAAC,CAAC;QACrC,CAAC;QAEM,oCAAI,GAAX,UAAY,OAAe;YACvB,OAAO,CAAC,IAAI,CAAC,WAAS,OAAS,CAAC,CAAC;QACrC,CAAC;QAEM,qCAAK,GAAZ,UAAa,OAAe;YACxB,OAAO,CAAC,KAAK,CAAC,YAAU,OAAS,CAAC,CAAC;QACvC,CAAC;QACL,4BAAC;IAAD,CAAC,AAhBD,IAgBC;IAhBY,4BAAqB,wBAgBjC,CAAA;AACL,CAAC,EA7BgB,MAAM,GAAN,cAAM,KAAN,cAAM,QA6BtB;AApEY,wBAAM"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
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;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.MaintenanceModel = void 0;
|
|
28
|
+
var model_1 = require("./model");
|
|
29
|
+
var serialize_1 = require("./serialize");
|
|
30
|
+
var MaintenanceModel = /** @class */ (function (_super) {
|
|
31
|
+
__extends(MaintenanceModel, _super);
|
|
32
|
+
function MaintenanceModel() {
|
|
33
|
+
var _this = _super.call(this, 'MaintenanceModel', function () { return "/continuous-integration/maintenance"; }) || this;
|
|
34
|
+
_this.status = null;
|
|
35
|
+
return _this;
|
|
36
|
+
}
|
|
37
|
+
__decorate([
|
|
38
|
+
serialize_1.autoserializeAs(Boolean),
|
|
39
|
+
__metadata("design:type", Boolean)
|
|
40
|
+
], MaintenanceModel.prototype, "status", void 0);
|
|
41
|
+
MaintenanceModel = __decorate([
|
|
42
|
+
serialize_1.serializable,
|
|
43
|
+
serialize_1.inheritSerialization(model_1.Model),
|
|
44
|
+
__metadata("design:paramtypes", [])
|
|
45
|
+
], MaintenanceModel);
|
|
46
|
+
return MaintenanceModel;
|
|
47
|
+
}(model_1.Model));
|
|
48
|
+
exports.MaintenanceModel = MaintenanceModel;
|
|
49
|
+
//# sourceMappingURL=maintenance-model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maintenance-model.js","sourceRoot":"","sources":["../src/maintenance-model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAgC;AAChC,yCAAkF;AAIlF;IAAsC,oCAAK;IAGvC;QAAA,YACI,kBAAM,kBAAkB,EAAE,cAAM,OAAA,qCAAqC,EAArC,CAAqC,CAAC,SACzE;QAJgC,YAAM,GAAY,IAAI,CAAC;;IAIxD,CAAC;IAJyB;QAAzB,2BAAe,CAAC,OAAO,CAAC;;oDAA+B;IAD/C,gBAAgB;QAF5B,wBAAY;QACZ,gCAAoB,CAAC,aAAK,CAAC;;OACf,gBAAgB,CAM5B;IAAD,uBAAC;CAAA,AAND,CAAsC,aAAK,GAM1C;AANY,4CAAgB"}
|
package/model.d.ts
ADDED
package/model.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
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.Model = void 0;
|
|
13
|
+
var cerialize_1 = require("cerialize");
|
|
14
|
+
var Model = /** @class */ (function () {
|
|
15
|
+
function Model(modelType, pathCallback) {
|
|
16
|
+
this.pathCallback = pathCallback;
|
|
17
|
+
this._type = null;
|
|
18
|
+
this._type = modelType;
|
|
19
|
+
}
|
|
20
|
+
Object.defineProperty(Model.prototype, "_path", {
|
|
21
|
+
get: function () {
|
|
22
|
+
return this.pathCallback();
|
|
23
|
+
},
|
|
24
|
+
enumerable: false,
|
|
25
|
+
configurable: true
|
|
26
|
+
});
|
|
27
|
+
__decorate([
|
|
28
|
+
cerialize_1.autoserializeAs(String),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], Model.prototype, "_type", void 0);
|
|
31
|
+
return Model;
|
|
32
|
+
}());
|
|
33
|
+
exports.Model = Model;
|
|
34
|
+
//# sourceMappingURL=model.js.map
|
package/model.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAA4C;AAI5C;IAGI,eAAY,SAAiB,EAAU,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;QAFjC,UAAK,GAAW,IAAI,CAAC;QAGjD,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;IAC3B,CAAC;IAED,sBAAW,wBAAK;aAAhB;YACI,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC;QAC/B,CAAC;;;OAAA;IARwB;QAAxB,2BAAe,CAAC,MAAM,CAAC;;wCAA6B;IASzD,YAAC;CAAA,AAVD,IAUC;AAVqB,sBAAK"}
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@my-devkit/core",
|
|
3
|
+
"version": "1.0.18",
|
|
4
|
+
"description": "My Devkit: common tools",
|
|
5
|
+
"module": "index.js",
|
|
6
|
+
"typings": "index.d.ts",
|
|
7
|
+
"keywords": [],
|
|
8
|
+
"author": "Jean-Guy BUON",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/BUONJG/my-devkit.git"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"prebuild": "npm run clean && npm run eslint",
|
|
16
|
+
"build": "tsc",
|
|
17
|
+
"watch": "tsc -w",
|
|
18
|
+
"deploy:increment-package-version": "npm version patch",
|
|
19
|
+
"deploy:copy": "cpx package.json dist",
|
|
20
|
+
"deploy:pack": "cd dist && npm pack",
|
|
21
|
+
"deploy:publish": "cd dist && npm publish --access public",
|
|
22
|
+
"predeploy": "rimraf ./dist && npm run deploy:increment-package-version",
|
|
23
|
+
"deploy": "npm run build && npm run deploy:copy && npm run deploy:pack && npm run deploy:publish",
|
|
24
|
+
"clean": "npx ts-cleaner -d ./dist -s ./src || true",
|
|
25
|
+
"eslint": "npx eslint src/**/*.ts",
|
|
26
|
+
"reinstall": "rimraf node_modules && npm install && npm outdated"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"cerialize": "0.1.18",
|
|
30
|
+
"class-validator": "0.11.1",
|
|
31
|
+
"lodash": "4.17.21",
|
|
32
|
+
"save": "2.4.0",
|
|
33
|
+
"uuid": "8.3.2"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/lodash": "4.14.173",
|
|
38
|
+
"@types/node": "14.11.8",
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "4.22.1",
|
|
40
|
+
"@typescript-eslint/parser": "4.22.1",
|
|
41
|
+
"cpx": "1.5.0",
|
|
42
|
+
"eslint": "7.26.0",
|
|
43
|
+
"ts-cleaner": "1.0.5",
|
|
44
|
+
"typescript": "4.2.4",
|
|
45
|
+
"rimraf": "3.0.2"
|
|
46
|
+
}
|
|
47
|
+
}
|
package/release-model.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
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;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.ReleaseModel = void 0;
|
|
28
|
+
var model_1 = require("./model");
|
|
29
|
+
var serialize_1 = require("./serialize");
|
|
30
|
+
var ReleaseModel = /** @class */ (function (_super) {
|
|
31
|
+
__extends(ReleaseModel, _super);
|
|
32
|
+
function ReleaseModel() {
|
|
33
|
+
var _this = _super.call(this, 'ReleaseModel', function () { return "/continuous-integration/release"; }) || this;
|
|
34
|
+
_this.version = null;
|
|
35
|
+
return _this;
|
|
36
|
+
}
|
|
37
|
+
__decorate([
|
|
38
|
+
serialize_1.autoserializeAs(String),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], ReleaseModel.prototype, "version", void 0);
|
|
41
|
+
ReleaseModel = __decorate([
|
|
42
|
+
serialize_1.serializable,
|
|
43
|
+
serialize_1.inheritSerialization(model_1.Model),
|
|
44
|
+
__metadata("design:paramtypes", [])
|
|
45
|
+
], ReleaseModel);
|
|
46
|
+
return ReleaseModel;
|
|
47
|
+
}(model_1.Model));
|
|
48
|
+
exports.ReleaseModel = ReleaseModel;
|
|
49
|
+
//# sourceMappingURL=release-model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"release-model.js","sourceRoot":"","sources":["../src/release-model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAgC;AAChC,yCAAkF;AAIlF;IAAkC,gCAAK;IAGnC;QAAA,YACI,kBAAM,cAAc,EAAE,cAAM,OAAA,iCAAiC,EAAjC,CAAiC,CAAC,SACjE;QAJ+B,aAAO,GAAW,IAAI,CAAC;;IAIvD,CAAC;IAJwB;QAAxB,2BAAe,CAAC,MAAM,CAAC;;iDAA+B;IAD9C,YAAY;QAFxB,wBAAY;QACZ,gCAAoB,CAAC,aAAK,CAAC;;OACf,YAAY,CAMxB;IAAD,mBAAC;CAAA,AAND,CAAkC,aAAK,GAMtC;AANY,oCAAY"}
|
package/retry.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retry operation
|
|
3
|
+
* @param operation
|
|
4
|
+
* @param options
|
|
5
|
+
*/
|
|
6
|
+
export declare function retry<T>(operation: () => Promise<T>, options?: retry.Options): Promise<T>;
|
|
7
|
+
export declare namespace retry {
|
|
8
|
+
interface Options {
|
|
9
|
+
/**
|
|
10
|
+
* Condition callback
|
|
11
|
+
*/
|
|
12
|
+
condition?: (error: any) => boolean;
|
|
13
|
+
maxAttempts?: number;
|
|
14
|
+
exponential?: boolean;
|
|
15
|
+
}
|
|
16
|
+
}
|
package/retry.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (_) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.retry = void 0;
|
|
51
|
+
var logger_1 = require("./logger");
|
|
52
|
+
var sleep_1 = require("./sleep");
|
|
53
|
+
/**
|
|
54
|
+
* Retry operation
|
|
55
|
+
* @param operation
|
|
56
|
+
* @param options
|
|
57
|
+
*/
|
|
58
|
+
function retry(operation, options) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
60
|
+
var continueTrying, retryCount, e_1;
|
|
61
|
+
return __generator(this, function (_a) {
|
|
62
|
+
switch (_a.label) {
|
|
63
|
+
case 0:
|
|
64
|
+
options = __assign({ maxAttempts: 6, exponential: false, condition: function () { return true; } }, options);
|
|
65
|
+
continueTrying = true;
|
|
66
|
+
retryCount = 0;
|
|
67
|
+
_a.label = 1;
|
|
68
|
+
case 1:
|
|
69
|
+
_a.trys.push([1, 3, , 6]);
|
|
70
|
+
return [4 /*yield*/, operation()];
|
|
71
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
72
|
+
case 3:
|
|
73
|
+
e_1 = _a.sent();
|
|
74
|
+
continueTrying = retryCount < options.maxAttempts && options.condition(e_1);
|
|
75
|
+
if (!continueTrying) {
|
|
76
|
+
throw e_1;
|
|
77
|
+
}
|
|
78
|
+
if (!options.exponential) return [3 /*break*/, 5];
|
|
79
|
+
return [4 /*yield*/, sleep_1.sleep(Math.pow(2, retryCount) * 1000 + Math.round(Math.random() * 1000))];
|
|
80
|
+
case 4:
|
|
81
|
+
_a.sent();
|
|
82
|
+
_a.label = 5;
|
|
83
|
+
case 5:
|
|
84
|
+
retryCount++;
|
|
85
|
+
logger_1.Logger.info("Retry: retrying... " + retryCount + "/" + options.maxAttempts);
|
|
86
|
+
return [3 /*break*/, 6];
|
|
87
|
+
case 6:
|
|
88
|
+
if (continueTrying) return [3 /*break*/, 1];
|
|
89
|
+
_a.label = 7;
|
|
90
|
+
case 7: return [2 /*return*/];
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
exports.retry = retry;
|
|
96
|
+
//# sourceMappingURL=retry.js.map
|
package/retry.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../src/retry.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAkC;AAClC,iCAAgC;AAEhC;;;;GAIG;AACH,SAAsB,KAAK,CAAI,SAA2B,EAAE,OAAuB;;;;;;oBAC/E,OAAO,cAAK,WAAW,EAAE,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,cAAM,OAAA,IAAI,EAAJ,CAAI,IAAK,OAAO,CAAE,CAAC;oBAEhF,cAAc,GAAG,IAAI,CAAC;oBACtB,UAAU,GAAG,CAAC,CAAC;;;;oBAGJ,qBAAM,SAAS,EAAE,EAAA;wBAAxB,sBAAO,SAAiB,EAAC;;;oBAEzB,cAAc,GAAG,UAAU,GAAG,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,SAAS,CAAC,GAAC,CAAC,CAAC;oBAC1E,IAAI,CAAC,cAAc,EAAE;wBACjB,MAAM,GAAC,CAAC;qBACX;yBACG,OAAO,CAAC,WAAW,EAAnB,wBAAmB;oBACnB,qBAAM,aAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,EAAA;;oBAA9E,SAA8E,CAAC;;;oBAGnF,UAAU,EAAE,CAAC;oBACb,eAAM,CAAC,IAAI,CAAC,wBAAsB,UAAU,SAAI,OAAO,CAAC,WAAa,CAAC,CAAC;;;wBAEtE,cAAc;;;;;;CAC1B;AArBD,sBAqBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function deserialize<T>(object: any, type?: new () => T): T;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deserialize = void 0;
|
|
4
|
+
var cerialize_1 = require("cerialize");
|
|
5
|
+
var serializable_1 = require("./serializable");
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
7
|
+
function deserialize(object, type) {
|
|
8
|
+
if (type) {
|
|
9
|
+
return cerialize_1.Deserialize(object, type);
|
|
10
|
+
}
|
|
11
|
+
return cerialize_1.Deserialize(object, serializable_1.serializable.getConstructor(object));
|
|
12
|
+
}
|
|
13
|
+
exports.deserialize = deserialize;
|
|
14
|
+
//# sourceMappingURL=deserialize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deserialize.js","sourceRoot":"","sources":["../../src/serialize/deserialize.ts"],"names":[],"mappings":";;;AAAA,uCAAwC;AAExC,+CAA8C;AAE9C,6EAA6E;AAC7E,SAAgB,WAAW,CAAI,MAAW,EAAE,IAAkB;IAC1D,IAAI,IAAI,EAAE;QACN,OAAO,uBAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;KACpC;IACD,OAAO,uBAAW,CAAC,MAAM,EAAE,2BAAY,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;AACpE,CAAC;AALD,kCAKC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.inheritSerialization = exports.autoserializeAs = void 0;
|
|
14
|
+
__exportStar(require("./deserialize"), exports);
|
|
15
|
+
__exportStar(require("./serialize"), exports);
|
|
16
|
+
__exportStar(require("./serializable"), exports);
|
|
17
|
+
var cerialize_1 = require("cerialize");
|
|
18
|
+
Object.defineProperty(exports, "autoserializeAs", { enumerable: true, get: function () { return cerialize_1.autoserializeAs; } });
|
|
19
|
+
Object.defineProperty(exports, "inheritSerialization", { enumerable: true, get: function () { return cerialize_1.inheritSerialization; } });
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/serialize/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,8CAA4B;AAC5B,iDAA+B;AAE/B,uCAAkE;AAAzD,4GAAA,eAAe,OAAA;AAAE,iHAAA,oBAAoB,OAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function serializable<T>(type: new (...args: any[]) => T): void;
|
|
2
|
+
export declare namespace serializable {
|
|
3
|
+
function register<T extends SerializableObject>(type: new (...args: any[]) => T): void;
|
|
4
|
+
function getConstructor<T extends SerializableObject>(object: T): new () => T;
|
|
5
|
+
interface SerializableObject {
|
|
6
|
+
_type: string;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializable = void 0;
|
|
4
|
+
function serializable(type) {
|
|
5
|
+
serializable.register(type);
|
|
6
|
+
}
|
|
7
|
+
exports.serializable = serializable;
|
|
8
|
+
(function (serializable) {
|
|
9
|
+
var types = new Map();
|
|
10
|
+
function register(type) {
|
|
11
|
+
types.set(new type()._type, type);
|
|
12
|
+
}
|
|
13
|
+
serializable.register = register;
|
|
14
|
+
function getConstructor(object) {
|
|
15
|
+
if (!object) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
if (!object._type) {
|
|
19
|
+
throw new Error("SerializeHelper: property __type is missing in " + JSON.stringify(object));
|
|
20
|
+
}
|
|
21
|
+
var type = types.get(object._type);
|
|
22
|
+
if (!type) {
|
|
23
|
+
throw new Error("SerializeHelper: no type registered for " + object._type);
|
|
24
|
+
}
|
|
25
|
+
return type;
|
|
26
|
+
}
|
|
27
|
+
serializable.getConstructor = getConstructor;
|
|
28
|
+
})(serializable = exports.serializable || (exports.serializable = {}));
|
|
29
|
+
//# sourceMappingURL=serializable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializable.js","sourceRoot":"","sources":["../../src/serialize/serializable.ts"],"names":[],"mappings":";;;AAAA,SAAgB,YAAY,CAAI,IAA+B;IAC3D,YAAY,CAAC,QAAQ,CAAC,IAAW,CAAC,CAAC;AACvC,CAAC;AAFD,oCAEC;AAED,WAAiB,YAAY;IAEzB,IAAM,KAAK,GAAG,IAAI,GAAG,EAAyB,CAAC;IAE/C,SAAgB,QAAQ,CAA+B,IAA+B;QAClF,KAAK,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;IAFe,qBAAQ,WAEvB,CAAA;IAED,SAAgB,cAAc,CAA+B,MAAS;QAClE,IAAI,CAAC,MAAM,EAAE;YACT,OAAO,IAAI,CAAC;SACf;QACD,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE;YACf,MAAM,IAAI,KAAK,CAAC,oDAAkD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAG,CAAC,CAAC;SAC/F;QACD,IAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACrC,IAAI,CAAC,IAAI,EAAE;YACP,MAAM,IAAI,KAAK,CAAC,6CAA2C,MAAM,CAAC,KAAO,CAAC,CAAC;SAC9E;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAZe,2BAAc,iBAY7B,CAAA;AAKL,CAAC,EAzBgB,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAyB5B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serialize = void 0;
|
|
4
|
+
var cerialize_1 = require("cerialize");
|
|
5
|
+
function serialize(object) {
|
|
6
|
+
return cerialize_1.Serialize(object);
|
|
7
|
+
}
|
|
8
|
+
exports.serialize = serialize;
|
|
9
|
+
//# sourceMappingURL=serialize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialize.js","sourceRoot":"","sources":["../../src/serialize/serialize.ts"],"names":[],"mappings":";;;AAAA,uCAAsC;AAItC,SAAgB,SAAS,CAAI,MAAS;IAClC,OAAO,qBAAS,CAAC,MAAM,CAAC,CAAC;AAC7B,CAAC;AAFD,8BAEC"}
|