@spytecgps/nova-orm 1.3.1-rc1 → 1.3.1-rc3

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.
Files changed (2) hide show
  1. package/dist/index.js +32 -90
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,6 +1,29 @@
1
1
  'use strict';
2
2
 
3
3
  var typeorm = require('typeorm');
4
+ var uuid = require('uuid');
5
+ var dayjs = require('dayjs');
6
+ var utc = require('dayjs/plugin/utc');
7
+
8
+ function _interopNamespaceDefault(e) {
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
18
+ }
19
+ });
20
+ }
21
+ n.default = e;
22
+ return Object.freeze(n);
23
+ }
24
+
25
+ var dayjs__namespace = /*#__PURE__*/_interopNamespaceDefault(dayjs);
26
+ var utc__namespace = /*#__PURE__*/_interopNamespaceDefault(utc);
4
27
 
5
28
  /******************************************************************************
6
29
  Copyright (c) Microsoft Corporation.
@@ -6423,80 +6446,6 @@ LatestUserAppInfo = __decorate([
6423
6446
  typeorm.Entity('latestUserAppInfo', { schema: 'nova' })
6424
6447
  ], LatestUserAppInfo);
6425
6448
 
6426
- var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
6427
-
6428
- function validate(uuid) {
6429
- return typeof uuid === 'string' && REGEX.test(uuid);
6430
- }
6431
-
6432
- function parse(uuid) {
6433
- if (!validate(uuid)) {
6434
- throw TypeError('Invalid UUID');
6435
- }
6436
- let v;
6437
- return Uint8Array.of((v = parseInt(uuid.slice(0, 8), 16)) >>> 24, (v >>> 16) & 0xff, (v >>> 8) & 0xff, v & 0xff, (v = parseInt(uuid.slice(9, 13), 16)) >>> 8, v & 0xff, (v = parseInt(uuid.slice(14, 18), 16)) >>> 8, v & 0xff, (v = parseInt(uuid.slice(19, 23), 16)) >>> 8, v & 0xff, ((v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000) & 0xff, (v / 0x100000000) & 0xff, (v >>> 24) & 0xff, (v >>> 16) & 0xff, (v >>> 8) & 0xff, v & 0xff);
6438
- }
6439
-
6440
- const byteToHex = [];
6441
- for (let i = 0; i < 256; ++i) {
6442
- byteToHex.push((i + 0x100).toString(16).slice(1));
6443
- }
6444
- function unsafeStringify(arr, offset = 0) {
6445
- return (byteToHex[arr[offset + 0]] +
6446
- byteToHex[arr[offset + 1]] +
6447
- byteToHex[arr[offset + 2]] +
6448
- byteToHex[arr[offset + 3]] +
6449
- '-' +
6450
- byteToHex[arr[offset + 4]] +
6451
- byteToHex[arr[offset + 5]] +
6452
- '-' +
6453
- byteToHex[arr[offset + 6]] +
6454
- byteToHex[arr[offset + 7]] +
6455
- '-' +
6456
- byteToHex[arr[offset + 8]] +
6457
- byteToHex[arr[offset + 9]] +
6458
- '-' +
6459
- byteToHex[arr[offset + 10]] +
6460
- byteToHex[arr[offset + 11]] +
6461
- byteToHex[arr[offset + 12]] +
6462
- byteToHex[arr[offset + 13]] +
6463
- byteToHex[arr[offset + 14]] +
6464
- byteToHex[arr[offset + 15]]).toLowerCase();
6465
- }
6466
- function stringify(arr, offset = 0) {
6467
- const uuid = unsafeStringify(arr, offset);
6468
- if (!validate(uuid)) {
6469
- throw TypeError('Stringified UUID is invalid');
6470
- }
6471
- return uuid;
6472
- }
6473
-
6474
- let getRandomValues;
6475
- const rnds8 = new Uint8Array(16);
6476
- function rng() {
6477
- if (!getRandomValues) {
6478
- if (typeof crypto === 'undefined' || !crypto.getRandomValues) {
6479
- throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
6480
- }
6481
- getRandomValues = crypto.getRandomValues.bind(crypto);
6482
- }
6483
- return getRandomValues(rnds8);
6484
- }
6485
-
6486
- const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
6487
- var native = { randomUUID };
6488
-
6489
- function v4(options, buf, offset) {
6490
- if (native.randomUUID && !buf && !options) {
6491
- return native.randomUUID();
6492
- }
6493
- options = options || {};
6494
- const rnds = options.random || (options.rng || rng)();
6495
- rnds[6] = (rnds[6] & 0x0f) | 0x40;
6496
- rnds[8] = (rnds[8] & 0x3f) | 0x80;
6497
- return unsafeStringify(rnds);
6498
- }
6499
-
6500
6449
  /**
6501
6450
  * A reusable transformer to serialize and deserialize UUID values using the 'uuid' package.
6502
6451
  */
@@ -6511,7 +6460,7 @@ const UUIDTransformer = {
6511
6460
  return null;
6512
6461
  }
6513
6462
  try {
6514
- const parsed = parse(value); // Convert UUID string to an array of bytes
6463
+ const parsed = uuid.parse(value); // Convert UUID string to an array of bytes
6515
6464
  return Buffer.from(parsed); // Convert byte array to Buffer
6516
6465
  }
6517
6466
  catch (err) {
@@ -6532,7 +6481,7 @@ const UUIDTransformer = {
6532
6481
  if (!value || value.length !== 16) {
6533
6482
  throw new TypeError('Invalid Buffer length for UUID');
6534
6483
  }
6535
- return stringify(value); // Convert Buffer to a UUID string
6484
+ return uuid.stringify(value); // Convert Buffer to a UUID string
6536
6485
  },
6537
6486
  };
6538
6487
 
@@ -6552,7 +6501,7 @@ let LiveLink = class LiveLink {
6552
6501
  historyAccess;
6553
6502
  generateDefaults() {
6554
6503
  if (!this.id) {
6555
- this.id = v4();
6504
+ this.id = uuid.v4();
6556
6505
  }
6557
6506
  if (!this.createdAt) {
6558
6507
  this.createdAt = new Date();
@@ -9117,7 +9066,7 @@ let UserInvitation = class UserInvitation {
9117
9066
  tasksAccess;
9118
9067
  generateDefaults() {
9119
9068
  if (!this.id) {
9120
- this.id = v4();
9069
+ this.id = uuid.v4();
9121
9070
  }
9122
9071
  if (!this.createdAt) {
9123
9072
  this.createdAt = new Date();
@@ -15600,7 +15549,7 @@ const createDataExports = async (novaDataSource, params, logger) => {
15600
15549
  const dataExports = params.dataExports.map(e => {
15601
15550
  let bufferId = uuidStringToBinaryBuffer(e.id);
15602
15551
  if (bufferId === null) {
15603
- bufferId = uuidStringToBinaryBuffer(v4());
15552
+ bufferId = uuidStringToBinaryBuffer(uuid.v4());
15604
15553
  }
15605
15554
  return {
15606
15555
  id: bufferId,
@@ -16435,17 +16384,10 @@ class DevicePairingsRepository extends BaseRepository {
16435
16384
  }
16436
16385
  }
16437
16386
 
16438
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).dayjs=e();}(undefined,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
16439
-
16440
- !function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t="undefined"!=typeof globalThis?globalThis:t||self).dayjs_plugin_utc=i();}(undefined,(function(){var t="minute",i=/[+-]\d\d(?::?\d\d)?/g,e=/([+-]|\d\d)/g;return function(s,f,n){var u=f.prototype;n.utc=function(t){var i={date:t,utc:!0,args:arguments};return new f(i)},u.utc=function(i){var e=n(this.toDate(),{locale:this.$L,utc:!0});return i?e.add(this.utcOffset(),t):e},u.local=function(){return n(this.toDate(),{locale:this.$L,utc:!1})};var o=u.parse;u.parse=function(t){t.utc&&(this.$u=!0),this.$utils().u(t.$offset)||(this.$offset=t.$offset),o.call(this,t);};var r=u.init;u.init=function(){if(this.$u){var t=this.$d;this.$y=t.getUTCFullYear(),this.$M=t.getUTCMonth(),this.$D=t.getUTCDate(),this.$W=t.getUTCDay(),this.$H=t.getUTCHours(),this.$m=t.getUTCMinutes(),this.$s=t.getUTCSeconds(),this.$ms=t.getUTCMilliseconds();}else r.call(this);};var a=u.utcOffset;u.utcOffset=function(s,f){var n=this.$utils().u;if(n(s))return this.$u?0:n(this.$offset)?a.call(this):this.$offset;if("string"==typeof s&&(s=function(t){void 0===t&&(t="");var s=t.match(i);if(!s)return null;var f=(""+s[0]).match(e)||["-",0,0],n=f[0],u=60*+f[1]+ +f[2];return 0===u?0:"+"===n?u:-u}(s),null===s))return this;var u=Math.abs(s)<=16?60*s:s,o=this;if(f)return o.$offset=u,o.$u=0===s,o;if(0!==s){var r=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(o=this.local().add(u+r,t)).$offset=u,o.$x.$localOffset=r;}else o=this.utc();return o};var h=u.format;u.format=function(t){var i=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,i)},u.valueOf=function(){var t=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t},u.isUTC=function(){return !!this.$u},u.toISOString=function(){return this.toDate().toISOString()},u.toString=function(){return this.toDate().toUTCString()};var l=u.toDate;u.toDate=function(t){return "s"===t&&this.$offset?n(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():l.call(this)};var c=u.diff;u.diff=function(t,i,e){if(t&&this.$u===t.$u)return c.call(this,t,i,e);var s=this.local(),f=n(t).local();return c.call(s,f,i,e)};}}));
16441
-
16442
- var utc = /*#__PURE__*/Object.freeze({
16443
- __proto__: null
16444
- });
16445
-
16446
- undefined(utc);
16447
- const now = () => undefined().toDate();
16448
- const addMonthsToNow = (months) => undefined()
16387
+ dayjs__namespace.extend(utc__namespace);
16388
+ const now = () => dayjs__namespace.utc().toDate();
16389
+ const addMonthsToNow = (months) => dayjs__namespace
16390
+ .utc()
16449
16391
  .add(months, 'month')
16450
16392
  .toDate();
16451
16393
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spytecgps/nova-orm",
3
- "version": "1.3.1-rc1",
3
+ "version": "1.3.1-rc3",
4
4
  "description": "ORM with PlanetScale",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",