@spytecgps/nova-orm 1.3.1-rc3 → 1.3.1-rc5
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/index.js +167 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
var typeorm = require('typeorm');
|
|
4
4
|
var uuid = require('uuid');
|
|
5
5
|
var dayjs = require('dayjs');
|
|
6
|
-
var utc = require('dayjs/plugin/utc');
|
|
7
6
|
|
|
8
7
|
function _interopNamespaceDefault(e) {
|
|
9
8
|
var n = Object.create(null);
|
|
@@ -23,7 +22,6 @@ function _interopNamespaceDefault(e) {
|
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
var dayjs__namespace = /*#__PURE__*/_interopNamespaceDefault(dayjs);
|
|
26
|
-
var utc__namespace = /*#__PURE__*/_interopNamespaceDefault(utc);
|
|
27
25
|
|
|
28
26
|
/******************************************************************************
|
|
29
27
|
Copyright (c) Microsoft Corporation.
|
|
@@ -9660,11 +9658,17 @@ class NovaDataSource {
|
|
|
9660
9658
|
this.logger = logger;
|
|
9661
9659
|
const entities = [];
|
|
9662
9660
|
for (const key in Entities) {
|
|
9663
|
-
if (
|
|
9661
|
+
// if (Entities.hasOwnProperty(key)) {
|
|
9662
|
+
const entity = Entities[key];
|
|
9663
|
+
entities.push(entity);
|
|
9664
|
+
// }
|
|
9664
9665
|
}
|
|
9665
9666
|
const subscribers = [];
|
|
9666
9667
|
for (const key in Subscribers) {
|
|
9667
|
-
if (
|
|
9668
|
+
// if (Subscribers.hasOwnProperty(key)) {
|
|
9669
|
+
const subscriber = Subscribers[key];
|
|
9670
|
+
subscribers.push(subscriber);
|
|
9671
|
+
// }
|
|
9668
9672
|
}
|
|
9669
9673
|
const baseConfig = {
|
|
9670
9674
|
host: 'aws.connect.psdb.cloud',
|
|
@@ -16384,9 +16388,165 @@ class DevicePairingsRepository extends BaseRepository {
|
|
|
16384
16388
|
}
|
|
16385
16389
|
}
|
|
16386
16390
|
|
|
16387
|
-
|
|
16388
|
-
const
|
|
16389
|
-
const
|
|
16391
|
+
const SECONDS_A_MINUTE = 60;
|
|
16392
|
+
const MILLISECONDS_A_SECOND = 1000;
|
|
16393
|
+
const MILLISECONDS_A_MINUTE = SECONDS_A_MINUTE * MILLISECONDS_A_SECOND;
|
|
16394
|
+
const MIN = 'minute';
|
|
16395
|
+
|
|
16396
|
+
|
|
16397
|
+
const REGEX_VALID_OFFSET_FORMAT = /[+-]\d\d(?::?\d\d)?/g;
|
|
16398
|
+
const REGEX_OFFSET_HOURS_MINUTES_FORMAT = /([+-]|\d\d)/g;
|
|
16399
|
+
|
|
16400
|
+
function offsetFromString(value = '') {
|
|
16401
|
+
const offset = value.match(REGEX_VALID_OFFSET_FORMAT);
|
|
16402
|
+
|
|
16403
|
+
if (!offset) {
|
|
16404
|
+
return null
|
|
16405
|
+
}
|
|
16406
|
+
|
|
16407
|
+
const [indicator, hoursOffset, minutesOffset] = `${offset[0]}`.match(REGEX_OFFSET_HOURS_MINUTES_FORMAT) || ['-', 0, 0];
|
|
16408
|
+
const totalOffsetInMinutes = (+hoursOffset * 60) + (+minutesOffset);
|
|
16409
|
+
|
|
16410
|
+
if (totalOffsetInMinutes === 0) {
|
|
16411
|
+
return 0
|
|
16412
|
+
}
|
|
16413
|
+
|
|
16414
|
+
return indicator === '+' ? totalOffsetInMinutes : -totalOffsetInMinutes
|
|
16415
|
+
}
|
|
16416
|
+
|
|
16417
|
+
|
|
16418
|
+
var utc = (option, Dayjs, dayjs) => {
|
|
16419
|
+
const proto = Dayjs.prototype;
|
|
16420
|
+
dayjs.utc = function (date) {
|
|
16421
|
+
const cfg = { date, utc: true, args: arguments }; // eslint-disable-line prefer-rest-params
|
|
16422
|
+
return new Dayjs(cfg) // eslint-disable-line no-use-before-define
|
|
16423
|
+
};
|
|
16424
|
+
|
|
16425
|
+
proto.utc = function (keepLocalTime) {
|
|
16426
|
+
const ins = dayjs(this.toDate(), { locale: this.$L, utc: true });
|
|
16427
|
+
if (keepLocalTime) {
|
|
16428
|
+
return ins.add(this.utcOffset(), MIN)
|
|
16429
|
+
}
|
|
16430
|
+
return ins
|
|
16431
|
+
};
|
|
16432
|
+
|
|
16433
|
+
proto.local = function () {
|
|
16434
|
+
return dayjs(this.toDate(), { locale: this.$L, utc: false })
|
|
16435
|
+
};
|
|
16436
|
+
|
|
16437
|
+
const oldParse = proto.parse;
|
|
16438
|
+
proto.parse = function (cfg) {
|
|
16439
|
+
if (cfg.utc) {
|
|
16440
|
+
this.$u = true;
|
|
16441
|
+
}
|
|
16442
|
+
if (!this.$utils().u(cfg.$offset)) {
|
|
16443
|
+
this.$offset = cfg.$offset;
|
|
16444
|
+
}
|
|
16445
|
+
oldParse.call(this, cfg);
|
|
16446
|
+
};
|
|
16447
|
+
|
|
16448
|
+
const oldInit = proto.init;
|
|
16449
|
+
proto.init = function () {
|
|
16450
|
+
if (this.$u) {
|
|
16451
|
+
const { $d } = this;
|
|
16452
|
+
this.$y = $d.getUTCFullYear();
|
|
16453
|
+
this.$M = $d.getUTCMonth();
|
|
16454
|
+
this.$D = $d.getUTCDate();
|
|
16455
|
+
this.$W = $d.getUTCDay();
|
|
16456
|
+
this.$H = $d.getUTCHours();
|
|
16457
|
+
this.$m = $d.getUTCMinutes();
|
|
16458
|
+
this.$s = $d.getUTCSeconds();
|
|
16459
|
+
this.$ms = $d.getUTCMilliseconds();
|
|
16460
|
+
} else {
|
|
16461
|
+
oldInit.call(this);
|
|
16462
|
+
}
|
|
16463
|
+
};
|
|
16464
|
+
|
|
16465
|
+
const oldUtcOffset = proto.utcOffset;
|
|
16466
|
+
proto.utcOffset = function (input, keepLocalTime) {
|
|
16467
|
+
const { u } = this.$utils();
|
|
16468
|
+
if (u(input)) {
|
|
16469
|
+
if (this.$u) {
|
|
16470
|
+
return 0
|
|
16471
|
+
}
|
|
16472
|
+
if (!u(this.$offset)) {
|
|
16473
|
+
return this.$offset
|
|
16474
|
+
}
|
|
16475
|
+
return oldUtcOffset.call(this)
|
|
16476
|
+
}
|
|
16477
|
+
if (typeof input === 'string') {
|
|
16478
|
+
input = offsetFromString(input);
|
|
16479
|
+
if (input === null) {
|
|
16480
|
+
return this
|
|
16481
|
+
}
|
|
16482
|
+
}
|
|
16483
|
+
const offset = Math.abs(input) <= 16 ? input * 60 : input;
|
|
16484
|
+
let ins = this;
|
|
16485
|
+
if (keepLocalTime) {
|
|
16486
|
+
ins.$offset = offset;
|
|
16487
|
+
ins.$u = input === 0;
|
|
16488
|
+
return ins
|
|
16489
|
+
}
|
|
16490
|
+
if (input !== 0) {
|
|
16491
|
+
const localTimezoneOffset = this.$u
|
|
16492
|
+
? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
|
|
16493
|
+
ins = this.local().add(offset + localTimezoneOffset, MIN);
|
|
16494
|
+
ins.$offset = offset;
|
|
16495
|
+
ins.$x.$localOffset = localTimezoneOffset;
|
|
16496
|
+
} else {
|
|
16497
|
+
ins = this.utc();
|
|
16498
|
+
}
|
|
16499
|
+
return ins
|
|
16500
|
+
};
|
|
16501
|
+
|
|
16502
|
+
const oldFormat = proto.format;
|
|
16503
|
+
const UTC_FORMAT_DEFAULT = 'YYYY-MM-DDTHH:mm:ss[Z]';
|
|
16504
|
+
proto.format = function (formatStr) {
|
|
16505
|
+
const str = formatStr || (this.$u ? UTC_FORMAT_DEFAULT : '');
|
|
16506
|
+
return oldFormat.call(this, str)
|
|
16507
|
+
};
|
|
16508
|
+
|
|
16509
|
+
proto.valueOf = function () {
|
|
16510
|
+
const addedOffset = !this.$utils().u(this.$offset)
|
|
16511
|
+
? this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset()) : 0;
|
|
16512
|
+
return this.$d.valueOf() - (addedOffset * MILLISECONDS_A_MINUTE)
|
|
16513
|
+
};
|
|
16514
|
+
|
|
16515
|
+
proto.isUTC = function () {
|
|
16516
|
+
return !!this.$u
|
|
16517
|
+
};
|
|
16518
|
+
|
|
16519
|
+
proto.toISOString = function () {
|
|
16520
|
+
return this.toDate().toISOString()
|
|
16521
|
+
};
|
|
16522
|
+
|
|
16523
|
+
proto.toString = function () {
|
|
16524
|
+
return this.toDate().toUTCString()
|
|
16525
|
+
};
|
|
16526
|
+
|
|
16527
|
+
const oldToDate = proto.toDate;
|
|
16528
|
+
proto.toDate = function (type) {
|
|
16529
|
+
if (type === 's' && this.$offset) {
|
|
16530
|
+
return dayjs(this.format('YYYY-MM-DD HH:mm:ss:SSS')).toDate()
|
|
16531
|
+
}
|
|
16532
|
+
return oldToDate.call(this)
|
|
16533
|
+
};
|
|
16534
|
+
const oldDiff = proto.diff;
|
|
16535
|
+
proto.diff = function (input, units, float) {
|
|
16536
|
+
if (input && this.$u === input.$u) {
|
|
16537
|
+
return oldDiff.call(this, input, units, float)
|
|
16538
|
+
}
|
|
16539
|
+
const localThis = this.local();
|
|
16540
|
+
const localInput = dayjs(input).local();
|
|
16541
|
+
return oldDiff.call(localThis, localInput, units, float)
|
|
16542
|
+
};
|
|
16543
|
+
};
|
|
16544
|
+
|
|
16545
|
+
dayjs__namespace.extend(utc);
|
|
16546
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16547
|
+
const extendedDayjs = dayjs__namespace;
|
|
16548
|
+
const now = () => extendedDayjs.utc().toDate();
|
|
16549
|
+
const addMonthsToNow = (months) => extendedDayjs
|
|
16390
16550
|
.utc()
|
|
16391
16551
|
.add(months, 'month')
|
|
16392
16552
|
.toDate();
|