fable 3.0.77 → 3.0.79
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/fable.compatible.js +364 -181
- package/dist/fable.compatible.min.js +2 -2
- package/dist/fable.compatible.min.js.map +1 -1
- package/dist/fable.js +294 -111
- package/dist/fable.min.js +2 -2
- package/dist/fable.min.js.map +1 -1
- package/package.json +3 -3
- package/source/services/Fable-Service-DataFormat.js +8 -5
- package/source/services/Fable-Service-Utility.js +2 -2
package/dist/fable.compatible.js
CHANGED
|
@@ -10,7 +10,250 @@ var len=placeHoldersLen>0?validLen-4:validLen;var i;for(i=0;i<len;i+=4){tmp=revL
|
|
|
10
10
|
var parts=[];var maxChunkLength=16383;// must be multiple of 3
|
|
11
11
|
// go through the array every three bytes, we'll deal with trailing stuff later
|
|
12
12
|
for(var i=0,len2=len-extraBytes;i<len2;i+=maxChunkLength){parts.push(encodeChunk(uint8,i,i+maxChunkLength>len2?len2:i+maxChunkLength));}// pad the end with zeros, but make sure to not forget the extra bytes
|
|
13
|
-
if(extraBytes===1){tmp=uint8[len-1];parts.push(lookup[tmp>>2]+lookup[tmp<<4&0x3F]+'==');}else if(extraBytes===2){tmp=(uint8[len-2]<<8)+uint8[len-1];parts.push(lookup[tmp>>10]+lookup[tmp>>4&0x3F]+lookup[tmp<<2&0x3F]+'=');}return parts.join('');}},{}],17:[function(require,module,exports){
|
|
13
|
+
if(extraBytes===1){tmp=uint8[len-1];parts.push(lookup[tmp>>2]+lookup[tmp<<4&0x3F]+'==');}else if(extraBytes===2){tmp=(uint8[len-2]<<8)+uint8[len-1];parts.push(lookup[tmp>>10]+lookup[tmp>>4&0x3F]+lookup[tmp<<2&0x3F]+'=');}return parts.join('');}},{}],17:[function(require,module,exports){/*
|
|
14
|
+
* big.js v6.2.1
|
|
15
|
+
* A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
|
|
16
|
+
* Copyright (c) 2022 Michael Mclaughlin
|
|
17
|
+
* https://github.com/MikeMcl/big.js/LICENCE.md
|
|
18
|
+
*/;(function(GLOBAL){'use strict';var Big,/************************************** EDITABLE DEFAULTS *****************************************/ // The default values below must be integers within the stated ranges.
|
|
19
|
+
/*
|
|
20
|
+
* The maximum number of decimal places (DP) of the results of operations involving division:
|
|
21
|
+
* div and sqrt, and pow with negative exponents.
|
|
22
|
+
*/DP=20,// 0 to MAX_DP
|
|
23
|
+
/*
|
|
24
|
+
* The rounding mode (RM) used when rounding to the above decimal places.
|
|
25
|
+
*
|
|
26
|
+
* 0 Towards zero (i.e. truncate, no rounding). (ROUND_DOWN)
|
|
27
|
+
* 1 To nearest neighbour. If equidistant, round up. (ROUND_HALF_UP)
|
|
28
|
+
* 2 To nearest neighbour. If equidistant, to even. (ROUND_HALF_EVEN)
|
|
29
|
+
* 3 Away from zero. (ROUND_UP)
|
|
30
|
+
*/RM=1,// 0, 1, 2 or 3
|
|
31
|
+
// The maximum value of DP and Big.DP.
|
|
32
|
+
MAX_DP=1E6,// 0 to 1000000
|
|
33
|
+
// The maximum magnitude of the exponent argument to the pow method.
|
|
34
|
+
MAX_POWER=1E6,// 1 to 1000000
|
|
35
|
+
/*
|
|
36
|
+
* The negative exponent (NE) at and beneath which toString returns exponential notation.
|
|
37
|
+
* (JavaScript numbers: -7)
|
|
38
|
+
* -1000000 is the minimum recommended exponent value of a Big.
|
|
39
|
+
*/NE=-7,// 0 to -1000000
|
|
40
|
+
/*
|
|
41
|
+
* The positive exponent (PE) at and above which toString returns exponential notation.
|
|
42
|
+
* (JavaScript numbers: 21)
|
|
43
|
+
* 1000000 is the maximum recommended exponent value of a Big, but this limit is not enforced.
|
|
44
|
+
*/PE=21,// 0 to 1000000
|
|
45
|
+
/*
|
|
46
|
+
* When true, an error will be thrown if a primitive number is passed to the Big constructor,
|
|
47
|
+
* or if valueOf is called, or if toNumber is called on a Big which cannot be converted to a
|
|
48
|
+
* primitive number without a loss of precision.
|
|
49
|
+
*/STRICT=false,// true or false
|
|
50
|
+
/**************************************************************************************************/ // Error messages.
|
|
51
|
+
NAME='[big.js] ',INVALID=NAME+'Invalid ',INVALID_DP=INVALID+'decimal places',INVALID_RM=INVALID+'rounding mode',DIV_BY_ZERO=NAME+'Division by zero',// The shared prototype object.
|
|
52
|
+
P={},UNDEFINED=void 0,NUMERIC=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;/*
|
|
53
|
+
* Create and return a Big constructor.
|
|
54
|
+
*/function _Big_(){/*
|
|
55
|
+
* The Big constructor and exported function.
|
|
56
|
+
* Create and return a new instance of a Big number object.
|
|
57
|
+
*
|
|
58
|
+
* n {number|string|Big} A numeric value.
|
|
59
|
+
*/function Big(n){var x=this;// Enable constructor usage without new.
|
|
60
|
+
if(!(x instanceof Big))return n===UNDEFINED?_Big_():new Big(n);// Duplicate.
|
|
61
|
+
if(n instanceof Big){x.s=n.s;x.e=n.e;x.c=n.c.slice();}else{if(typeof n!=='string'){if(Big.strict===true&&typeof n!=='bigint'){throw TypeError(INVALID+'value');}// Minus zero?
|
|
62
|
+
n=n===0&&1/n<0?'-0':String(n);}parse(x,n);}// Retain a reference to this Big constructor.
|
|
63
|
+
// Shadow Big.prototype.constructor which points to Object.
|
|
64
|
+
x.constructor=Big;}Big.prototype=P;Big.DP=DP;Big.RM=RM;Big.NE=NE;Big.PE=PE;Big.strict=STRICT;Big.roundDown=0;Big.roundHalfUp=1;Big.roundHalfEven=2;Big.roundUp=3;return Big;}/*
|
|
65
|
+
* Parse the number or string value passed to a Big constructor.
|
|
66
|
+
*
|
|
67
|
+
* x {Big} A Big number instance.
|
|
68
|
+
* n {number|string} A numeric value.
|
|
69
|
+
*/function parse(x,n){var e,i,nl;if(!NUMERIC.test(n)){throw Error(INVALID+'number');}// Determine sign.
|
|
70
|
+
x.s=n.charAt(0)=='-'?(n=n.slice(1),-1):1;// Decimal point?
|
|
71
|
+
if((e=n.indexOf('.'))>-1)n=n.replace('.','');// Exponential form?
|
|
72
|
+
if((i=n.search(/e/i))>0){// Determine exponent.
|
|
73
|
+
if(e<0)e=i;e+=+n.slice(i+1);n=n.substring(0,i);}else if(e<0){// Integer.
|
|
74
|
+
e=n.length;}nl=n.length;// Determine leading zeros.
|
|
75
|
+
for(i=0;i<nl&&n.charAt(i)=='0';)++i;if(i==nl){// Zero.
|
|
76
|
+
x.c=[x.e=0];}else{// Determine trailing zeros.
|
|
77
|
+
for(;nl>0&&n.charAt(--nl)=='0';);x.e=e-i-1;x.c=[];// Convert string to array of digits without leading/trailing zeros.
|
|
78
|
+
for(e=0;i<=nl;)x.c[e++]=+n.charAt(i++);}return x;}/*
|
|
79
|
+
* Round Big x to a maximum of sd significant digits using rounding mode rm.
|
|
80
|
+
*
|
|
81
|
+
* x {Big} The Big to round.
|
|
82
|
+
* sd {number} Significant digits: integer, 0 to MAX_DP inclusive.
|
|
83
|
+
* rm {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
84
|
+
* [more] {boolean} Whether the result of division was truncated.
|
|
85
|
+
*/function round(x,sd,rm,more){var xc=x.c;if(rm===UNDEFINED)rm=x.constructor.RM;if(rm!==0&&rm!==1&&rm!==2&&rm!==3){throw Error(INVALID_RM);}if(sd<1){more=rm===3&&(more||!!xc[0])||sd===0&&(rm===1&&xc[0]>=5||rm===2&&(xc[0]>5||xc[0]===5&&(more||xc[1]!==UNDEFINED)));xc.length=1;if(more){// 1, 0.1, 0.01, 0.001, 0.0001 etc.
|
|
86
|
+
x.e=x.e-sd+1;xc[0]=1;}else{// Zero.
|
|
87
|
+
xc[0]=x.e=0;}}else if(sd<xc.length){// xc[sd] is the digit after the digit that may be rounded up.
|
|
88
|
+
more=rm===1&&xc[sd]>=5||rm===2&&(xc[sd]>5||xc[sd]===5&&(more||xc[sd+1]!==UNDEFINED||xc[sd-1]&1))||rm===3&&(more||!!xc[0]);// Remove any digits after the required precision.
|
|
89
|
+
xc.length=sd;// Round up?
|
|
90
|
+
if(more){// Rounding up may mean the previous digit has to be rounded up.
|
|
91
|
+
for(;++xc[--sd]>9;){xc[sd]=0;if(sd===0){++x.e;xc.unshift(1);break;}}}// Remove trailing zeros.
|
|
92
|
+
for(sd=xc.length;!xc[--sd];)xc.pop();}return x;}/*
|
|
93
|
+
* Return a string representing the value of Big x in normal or exponential notation.
|
|
94
|
+
* Handles P.toExponential, P.toFixed, P.toJSON, P.toPrecision, P.toString and P.valueOf.
|
|
95
|
+
*/function stringify(x,doExponential,isNonzero){var e=x.e,s=x.c.join(''),n=s.length;// Exponential notation?
|
|
96
|
+
if(doExponential){s=s.charAt(0)+(n>1?'.'+s.slice(1):'')+(e<0?'e':'e+')+e;// Normal notation.
|
|
97
|
+
}else if(e<0){for(;++e;)s='0'+s;s='0.'+s;}else if(e>0){if(++e>n){for(e-=n;e--;)s+='0';}else if(e<n){s=s.slice(0,e)+'.'+s.slice(e);}}else if(n>1){s=s.charAt(0)+'.'+s.slice(1);}return x.s<0&&isNonzero?'-'+s:s;}// Prototype/instance methods
|
|
98
|
+
/*
|
|
99
|
+
* Return a new Big whose value is the absolute value of this Big.
|
|
100
|
+
*/P.abs=function(){var x=new this.constructor(this);x.s=1;return x;};/*
|
|
101
|
+
* Return 1 if the value of this Big is greater than the value of Big y,
|
|
102
|
+
* -1 if the value of this Big is less than the value of Big y, or
|
|
103
|
+
* 0 if they have the same value.
|
|
104
|
+
*/P.cmp=function(y){var isneg,x=this,xc=x.c,yc=(y=new x.constructor(y)).c,i=x.s,j=y.s,k=x.e,l=y.e;// Either zero?
|
|
105
|
+
if(!xc[0]||!yc[0])return!xc[0]?!yc[0]?0:-j:i;// Signs differ?
|
|
106
|
+
if(i!=j)return i;isneg=i<0;// Compare exponents.
|
|
107
|
+
if(k!=l)return k>l^isneg?1:-1;j=(k=xc.length)<(l=yc.length)?k:l;// Compare digit by digit.
|
|
108
|
+
for(i=-1;++i<j;){if(xc[i]!=yc[i])return xc[i]>yc[i]^isneg?1:-1;}// Compare lengths.
|
|
109
|
+
return k==l?0:k>l^isneg?1:-1;};/*
|
|
110
|
+
* Return a new Big whose value is the value of this Big divided by the value of Big y, rounded,
|
|
111
|
+
* if necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
|
|
112
|
+
*/P.div=function(y){var x=this,Big=x.constructor,a=x.c,// dividend
|
|
113
|
+
b=(y=new Big(y)).c,// divisor
|
|
114
|
+
k=x.s==y.s?1:-1,dp=Big.DP;if(dp!==~~dp||dp<0||dp>MAX_DP){throw Error(INVALID_DP);}// Divisor is zero?
|
|
115
|
+
if(!b[0]){throw Error(DIV_BY_ZERO);}// Dividend is 0? Return +-0.
|
|
116
|
+
if(!a[0]){y.s=k;y.c=[y.e=0];return y;}var bl,bt,n,cmp,ri,bz=b.slice(),ai=bl=b.length,al=a.length,r=a.slice(0,bl),// remainder
|
|
117
|
+
rl=r.length,q=y,// quotient
|
|
118
|
+
qc=q.c=[],qi=0,p=dp+(q.e=x.e-y.e)+1;// precision of the result
|
|
119
|
+
q.s=k;k=p<0?0:p;// Create version of divisor with leading zero.
|
|
120
|
+
bz.unshift(0);// Add zeros to make remainder as long as divisor.
|
|
121
|
+
for(;rl++<bl;)r.push(0);do{// n is how many times the divisor goes into current remainder.
|
|
122
|
+
for(n=0;n<10;n++){// Compare divisor and remainder.
|
|
123
|
+
if(bl!=(rl=r.length)){cmp=bl>rl?1:-1;}else{for(ri=-1,cmp=0;++ri<bl;){if(b[ri]!=r[ri]){cmp=b[ri]>r[ri]?1:-1;break;}}}// If divisor < remainder, subtract divisor from remainder.
|
|
124
|
+
if(cmp<0){// Remainder can't be more than 1 digit longer than divisor.
|
|
125
|
+
// Equalise lengths using divisor with extra leading zero?
|
|
126
|
+
for(bt=rl==bl?b:bz;rl;){if(r[--rl]<bt[rl]){ri=rl;for(;ri&&!r[--ri];)r[ri]=9;--r[ri];r[rl]+=10;}r[rl]-=bt[rl];}for(;!r[0];)r.shift();}else{break;}}// Add the digit n to the result array.
|
|
127
|
+
qc[qi++]=cmp?n:++n;// Update the remainder.
|
|
128
|
+
if(r[0]&&cmp)r[rl]=a[ai]||0;else r=[a[ai]];}while((ai++<al||r[0]!==UNDEFINED)&&k--);// Leading zero? Do not remove if result is simply zero (qi == 1).
|
|
129
|
+
if(!qc[0]&&qi!=1){// There can't be more than one zero.
|
|
130
|
+
qc.shift();q.e--;p--;}// Round?
|
|
131
|
+
if(qi>p)round(q,p,Big.RM,r[0]!==UNDEFINED);return q;};/*
|
|
132
|
+
* Return true if the value of this Big is equal to the value of Big y, otherwise return false.
|
|
133
|
+
*/P.eq=function(y){return this.cmp(y)===0;};/*
|
|
134
|
+
* Return true if the value of this Big is greater than the value of Big y, otherwise return
|
|
135
|
+
* false.
|
|
136
|
+
*/P.gt=function(y){return this.cmp(y)>0;};/*
|
|
137
|
+
* Return true if the value of this Big is greater than or equal to the value of Big y, otherwise
|
|
138
|
+
* return false.
|
|
139
|
+
*/P.gte=function(y){return this.cmp(y)>-1;};/*
|
|
140
|
+
* Return true if the value of this Big is less than the value of Big y, otherwise return false.
|
|
141
|
+
*/P.lt=function(y){return this.cmp(y)<0;};/*
|
|
142
|
+
* Return true if the value of this Big is less than or equal to the value of Big y, otherwise
|
|
143
|
+
* return false.
|
|
144
|
+
*/P.lte=function(y){return this.cmp(y)<1;};/*
|
|
145
|
+
* Return a new Big whose value is the value of this Big minus the value of Big y.
|
|
146
|
+
*/P.minus=P.sub=function(y){var i,j,t,xlty,x=this,Big=x.constructor,a=x.s,b=(y=new Big(y)).s;// Signs differ?
|
|
147
|
+
if(a!=b){y.s=-b;return x.plus(y);}var xc=x.c.slice(),xe=x.e,yc=y.c,ye=y.e;// Either zero?
|
|
148
|
+
if(!xc[0]||!yc[0]){if(yc[0]){y.s=-b;}else if(xc[0]){y=new Big(x);}else{y.s=1;}return y;}// Determine which is the bigger number. Prepend zeros to equalise exponents.
|
|
149
|
+
if(a=xe-ye){if(xlty=a<0){a=-a;t=xc;}else{ye=xe;t=yc;}t.reverse();for(b=a;b--;)t.push(0);t.reverse();}else{// Exponents equal. Check digit by digit.
|
|
150
|
+
j=((xlty=xc.length<yc.length)?xc:yc).length;for(a=b=0;b<j;b++){if(xc[b]!=yc[b]){xlty=xc[b]<yc[b];break;}}}// x < y? Point xc to the array of the bigger number.
|
|
151
|
+
if(xlty){t=xc;xc=yc;yc=t;y.s=-y.s;}/*
|
|
152
|
+
* Append zeros to xc if shorter. No need to add zeros to yc if shorter as subtraction only
|
|
153
|
+
* needs to start at yc.length.
|
|
154
|
+
*/if((b=(j=yc.length)-(i=xc.length))>0)for(;b--;)xc[i++]=0;// Subtract yc from xc.
|
|
155
|
+
for(b=i;j>a;){if(xc[--j]<yc[j]){for(i=j;i&&!xc[--i];)xc[i]=9;--xc[i];xc[j]+=10;}xc[j]-=yc[j];}// Remove trailing zeros.
|
|
156
|
+
for(;xc[--b]===0;)xc.pop();// Remove leading zeros and adjust exponent accordingly.
|
|
157
|
+
for(;xc[0]===0;){xc.shift();--ye;}if(!xc[0]){// n - n = +0
|
|
158
|
+
y.s=1;// Result must be zero.
|
|
159
|
+
xc=[ye=0];}y.c=xc;y.e=ye;return y;};/*
|
|
160
|
+
* Return a new Big whose value is the value of this Big modulo the value of Big y.
|
|
161
|
+
*/P.mod=function(y){var ygtx,x=this,Big=x.constructor,a=x.s,b=(y=new Big(y)).s;if(!y.c[0]){throw Error(DIV_BY_ZERO);}x.s=y.s=1;ygtx=y.cmp(x)==1;x.s=a;y.s=b;if(ygtx)return new Big(x);a=Big.DP;b=Big.RM;Big.DP=Big.RM=0;x=x.div(y);Big.DP=a;Big.RM=b;return this.minus(x.times(y));};/*
|
|
162
|
+
* Return a new Big whose value is the value of this Big negated.
|
|
163
|
+
*/P.neg=function(){var x=new this.constructor(this);x.s=-x.s;return x;};/*
|
|
164
|
+
* Return a new Big whose value is the value of this Big plus the value of Big y.
|
|
165
|
+
*/P.plus=P.add=function(y){var e,k,t,x=this,Big=x.constructor;y=new Big(y);// Signs differ?
|
|
166
|
+
if(x.s!=y.s){y.s=-y.s;return x.minus(y);}var xe=x.e,xc=x.c,ye=y.e,yc=y.c;// Either zero?
|
|
167
|
+
if(!xc[0]||!yc[0]){if(!yc[0]){if(xc[0]){y=new Big(x);}else{y.s=x.s;}}return y;}xc=xc.slice();// Prepend zeros to equalise exponents.
|
|
168
|
+
// Note: reverse faster than unshifts.
|
|
169
|
+
if(e=xe-ye){if(e>0){ye=xe;t=yc;}else{e=-e;t=xc;}t.reverse();for(;e--;)t.push(0);t.reverse();}// Point xc to the longer array.
|
|
170
|
+
if(xc.length-yc.length<0){t=yc;yc=xc;xc=t;}e=yc.length;// Only start adding at yc.length - 1 as the further digits of xc can be left as they are.
|
|
171
|
+
for(k=0;e;xc[e]%=10)k=(xc[--e]=xc[e]+yc[e]+k)/10|0;// No need to check for zero, as +x + +y != 0 && -x + -y != 0
|
|
172
|
+
if(k){xc.unshift(k);++ye;}// Remove trailing zeros.
|
|
173
|
+
for(e=xc.length;xc[--e]===0;)xc.pop();y.c=xc;y.e=ye;return y;};/*
|
|
174
|
+
* Return a Big whose value is the value of this Big raised to the power n.
|
|
175
|
+
* If n is negative, round to a maximum of Big.DP decimal places using rounding
|
|
176
|
+
* mode Big.RM.
|
|
177
|
+
*
|
|
178
|
+
* n {number} Integer, -MAX_POWER to MAX_POWER inclusive.
|
|
179
|
+
*/P.pow=function(n){var x=this,one=new x.constructor('1'),y=one,isneg=n<0;if(n!==~~n||n<-MAX_POWER||n>MAX_POWER){throw Error(INVALID+'exponent');}if(isneg)n=-n;for(;;){if(n&1)y=y.times(x);n>>=1;if(!n)break;x=x.times(x);}return isneg?one.div(y):y;};/*
|
|
180
|
+
* Return a new Big whose value is the value of this Big rounded to a maximum precision of sd
|
|
181
|
+
* significant digits using rounding mode rm, or Big.RM if rm is not specified.
|
|
182
|
+
*
|
|
183
|
+
* sd {number} Significant digits: integer, 1 to MAX_DP inclusive.
|
|
184
|
+
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
185
|
+
*/P.prec=function(sd,rm){if(sd!==~~sd||sd<1||sd>MAX_DP){throw Error(INVALID+'precision');}return round(new this.constructor(this),sd,rm);};/*
|
|
186
|
+
* Return a new Big whose value is the value of this Big rounded to a maximum of dp decimal places
|
|
187
|
+
* using rounding mode rm, or Big.RM if rm is not specified.
|
|
188
|
+
* If dp is negative, round to an integer which is a multiple of 10**-dp.
|
|
189
|
+
* If dp is not specified, round to 0 decimal places.
|
|
190
|
+
*
|
|
191
|
+
* dp? {number} Integer, -MAX_DP to MAX_DP inclusive.
|
|
192
|
+
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
193
|
+
*/P.round=function(dp,rm){if(dp===UNDEFINED)dp=0;else if(dp!==~~dp||dp<-MAX_DP||dp>MAX_DP){throw Error(INVALID_DP);}return round(new this.constructor(this),dp+this.e+1,rm);};/*
|
|
194
|
+
* Return a new Big whose value is the square root of the value of this Big, rounded, if
|
|
195
|
+
* necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM.
|
|
196
|
+
*/P.sqrt=function(){var r,c,t,x=this,Big=x.constructor,s=x.s,e=x.e,half=new Big('0.5');// Zero?
|
|
197
|
+
if(!x.c[0])return new Big(x);// Negative?
|
|
198
|
+
if(s<0){throw Error(NAME+'No square root');}// Estimate.
|
|
199
|
+
s=Math.sqrt(x+'');// Math.sqrt underflow/overflow?
|
|
200
|
+
// Re-estimate: pass x coefficient to Math.sqrt as integer, then adjust the result exponent.
|
|
201
|
+
if(s===0||s===1/0){c=x.c.join('');if(!(c.length+e&1))c+='0';s=Math.sqrt(c);e=((e+1)/2|0)-(e<0||e&1);r=new Big((s==1/0?'5e':(s=s.toExponential()).slice(0,s.indexOf('e')+1))+e);}else{r=new Big(s+'');}e=r.e+(Big.DP+=4);// Newton-Raphson iteration.
|
|
202
|
+
do{t=r;r=half.times(t.plus(x.div(t)));}while(t.c.slice(0,e).join('')!==r.c.slice(0,e).join(''));return round(r,(Big.DP-=4)+r.e+1,Big.RM);};/*
|
|
203
|
+
* Return a new Big whose value is the value of this Big times the value of Big y.
|
|
204
|
+
*/P.times=P.mul=function(y){var c,x=this,Big=x.constructor,xc=x.c,yc=(y=new Big(y)).c,a=xc.length,b=yc.length,i=x.e,j=y.e;// Determine sign of result.
|
|
205
|
+
y.s=x.s==y.s?1:-1;// Return signed 0 if either 0.
|
|
206
|
+
if(!xc[0]||!yc[0]){y.c=[y.e=0];return y;}// Initialise exponent of result as x.e + y.e.
|
|
207
|
+
y.e=i+j;// If array xc has fewer digits than yc, swap xc and yc, and lengths.
|
|
208
|
+
if(a<b){c=xc;xc=yc;yc=c;j=a;a=b;b=j;}// Initialise coefficient array of result with zeros.
|
|
209
|
+
for(c=new Array(j=a+b);j--;)c[j]=0;// Multiply.
|
|
210
|
+
// i is initially xc.length.
|
|
211
|
+
for(i=b;i--;){b=0;// a is yc.length.
|
|
212
|
+
for(j=a+i;j>i;){// Current sum of products at this digit position, plus carry.
|
|
213
|
+
b=c[j]+yc[i]*xc[j-i-1]+b;c[j--]=b%10;// carry
|
|
214
|
+
b=b/10|0;}c[j]=b;}// Increment result exponent if there is a final carry, otherwise remove leading zero.
|
|
215
|
+
if(b)++y.e;else c.shift();// Remove trailing zeros.
|
|
216
|
+
for(i=c.length;!c[--i];)c.pop();y.c=c;return y;};/*
|
|
217
|
+
* Return a string representing the value of this Big in exponential notation rounded to dp fixed
|
|
218
|
+
* decimal places using rounding mode rm, or Big.RM if rm is not specified.
|
|
219
|
+
*
|
|
220
|
+
* dp? {number} Decimal places: integer, 0 to MAX_DP inclusive.
|
|
221
|
+
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
222
|
+
*/P.toExponential=function(dp,rm){var x=this,n=x.c[0];if(dp!==UNDEFINED){if(dp!==~~dp||dp<0||dp>MAX_DP){throw Error(INVALID_DP);}x=round(new x.constructor(x),++dp,rm);for(;x.c.length<dp;)x.c.push(0);}return stringify(x,true,!!n);};/*
|
|
223
|
+
* Return a string representing the value of this Big in normal notation rounded to dp fixed
|
|
224
|
+
* decimal places using rounding mode rm, or Big.RM if rm is not specified.
|
|
225
|
+
*
|
|
226
|
+
* dp? {number} Decimal places: integer, 0 to MAX_DP inclusive.
|
|
227
|
+
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
228
|
+
*
|
|
229
|
+
* (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
|
|
230
|
+
* (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
|
|
231
|
+
*/P.toFixed=function(dp,rm){var x=this,n=x.c[0];if(dp!==UNDEFINED){if(dp!==~~dp||dp<0||dp>MAX_DP){throw Error(INVALID_DP);}x=round(new x.constructor(x),dp+x.e+1,rm);// x.e may have changed if the value is rounded up.
|
|
232
|
+
for(dp=dp+x.e+1;x.c.length<dp;)x.c.push(0);}return stringify(x,false,!!n);};/*
|
|
233
|
+
* Return a string representing the value of this Big.
|
|
234
|
+
* Return exponential notation if this Big has a positive exponent equal to or greater than
|
|
235
|
+
* Big.PE, or a negative exponent equal to or less than Big.NE.
|
|
236
|
+
* Omit the sign for negative zero.
|
|
237
|
+
*/P.toJSON=P.toString=function(){var x=this,Big=x.constructor;return stringify(x,x.e<=Big.NE||x.e>=Big.PE,!!x.c[0]);};/*
|
|
238
|
+
* Return the value of this Big as a primitve number.
|
|
239
|
+
*/P.toNumber=function(){var n=Number(stringify(this,true,true));if(this.constructor.strict===true&&!this.eq(n.toString())){throw Error(NAME+'Imprecise conversion');}return n;};/*
|
|
240
|
+
* Return a string representing the value of this Big rounded to sd significant digits using
|
|
241
|
+
* rounding mode rm, or Big.RM if rm is not specified.
|
|
242
|
+
* Use exponential notation if sd is less than the number of digits necessary to represent
|
|
243
|
+
* the integer part of the value in normal notation.
|
|
244
|
+
*
|
|
245
|
+
* sd {number} Significant digits: integer, 1 to MAX_DP inclusive.
|
|
246
|
+
* rm? {number} Rounding mode: 0 (down), 1 (half-up), 2 (half-even) or 3 (up).
|
|
247
|
+
*/P.toPrecision=function(sd,rm){var x=this,Big=x.constructor,n=x.c[0];if(sd!==UNDEFINED){if(sd!==~~sd||sd<1||sd>MAX_DP){throw Error(INVALID+'precision');}x=round(new Big(x),sd,rm);for(;x.c.length<sd;)x.c.push(0);}return stringify(x,sd<=x.e||x.e<=Big.NE||x.e>=Big.PE,!!n);};/*
|
|
248
|
+
* Return a string representing the value of this Big.
|
|
249
|
+
* Return exponential notation if this Big has a positive exponent equal to or greater than
|
|
250
|
+
* Big.PE, or a negative exponent equal to or less than Big.NE.
|
|
251
|
+
* Include the sign for negative zero.
|
|
252
|
+
*/P.valueOf=function(){var x=this,Big=x.constructor;if(Big.strict===true){throw Error(NAME+'valueOf disallowed');}return stringify(x,x.e<=Big.NE||x.e>=Big.PE,true);};// Export
|
|
253
|
+
Big=_Big_();Big['default']=Big.Big=Big;//AMD.
|
|
254
|
+
if(typeof define==='function'&&define.amd){define(function(){return Big;});// Node and other CommonJS-like environments that support module.exports.
|
|
255
|
+
}else if(typeof module!=='undefined'&&module.exports){module.exports=Big;//Browser.
|
|
256
|
+
}else{GLOBAL.Big=Big;}})(this);},{}],18:[function(require,module,exports){},{}],19:[function(require,module,exports){arguments[4][18][0].apply(exports,arguments);},{"dup":18}],20:[function(require,module,exports){(function(Buffer){(function(){/*!
|
|
14
257
|
* The buffer module from node.js, for the browser.
|
|
15
258
|
*
|
|
16
259
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
@@ -153,7 +396,7 @@ byteArray.push(str.charCodeAt(i)&0xFF);}return byteArray;}function utf16leToByte
|
|
|
153
396
|
// See: https://github.com/feross/buffer/issues/166
|
|
154
397
|
function isInstance(obj,type){return obj instanceof type||obj!=null&&obj.constructor!=null&&obj.constructor.name!=null&&obj.constructor.name===type.name;}function numberIsNaN(obj){// For IE11 support
|
|
155
398
|
return obj!==obj;// eslint-disable-line no-self-compare
|
|
156
|
-
}}).call(this);}).call(this,require("buffer").Buffer);},{"base64-js":16,"buffer":
|
|
399
|
+
}}).call(this);}).call(this,require("buffer").Buffer);},{"base64-js":16,"buffer":20,"ieee754":50}],21:[function(require,module,exports){module.exports={"100":"Continue","101":"Switching Protocols","102":"Processing","200":"OK","201":"Created","202":"Accepted","203":"Non-Authoritative Information","204":"No Content","205":"Reset Content","206":"Partial Content","207":"Multi-Status","208":"Already Reported","226":"IM Used","300":"Multiple Choices","301":"Moved Permanently","302":"Found","303":"See Other","304":"Not Modified","305":"Use Proxy","307":"Temporary Redirect","308":"Permanent Redirect","400":"Bad Request","401":"Unauthorized","402":"Payment Required","403":"Forbidden","404":"Not Found","405":"Method Not Allowed","406":"Not Acceptable","407":"Proxy Authentication Required","408":"Request Timeout","409":"Conflict","410":"Gone","411":"Length Required","412":"Precondition Failed","413":"Payload Too Large","414":"URI Too Long","415":"Unsupported Media Type","416":"Range Not Satisfiable","417":"Expectation Failed","418":"I'm a teapot","421":"Misdirected Request","422":"Unprocessable Entity","423":"Locked","424":"Failed Dependency","425":"Unordered Collection","426":"Upgrade Required","428":"Precondition Required","429":"Too Many Requests","431":"Request Header Fields Too Large","451":"Unavailable For Legal Reasons","500":"Internal Server Error","501":"Not Implemented","502":"Bad Gateway","503":"Service Unavailable","504":"Gateway Timeout","505":"HTTP Version Not Supported","506":"Variant Also Negotiates","507":"Insufficient Storage","508":"Loop Detected","509":"Bandwidth Limit Exceeded","510":"Not Extended","511":"Network Authentication Required"};},{}],22:[function(require,module,exports){/**
|
|
157
400
|
* Cache data structure with:
|
|
158
401
|
* - enumerable items
|
|
159
402
|
* - unique hash item access (if none is passed in, one is generated)
|
|
@@ -199,7 +442,7 @@ if(fPruneFunction(tmpNode.Datum,tmpNode.Hash,tmpNode)){tmpRemovedRecords.push(th
|
|
|
199
442
|
if(this._List.length<1){return fComplete(tmpRemovedRecords);}// Now prune based on expiration time
|
|
200
443
|
this.pruneBasedOnExpiration(function(fExpirationPruneComplete){// Now prune based on length, then return the removed records in the callback.
|
|
201
444
|
_this4.pruneBasedOnLength(fComplete,tmpRemovedRecords);},tmpRemovedRecords);}// Get a low level node (including metadata statistics) by hash from the cache
|
|
202
|
-
},{key:"getNode",value:function getNode(pHash){if(!this._HashMap.hasOwnProperty(pHash))return false;return this._HashMap[pHash];}}]);return CashMoney;}(libFableServiceProviderBase);module.exports=CashMoney;},{"./LinkedList.js":
|
|
445
|
+
},{key:"getNode",value:function getNode(pHash){if(!this._HashMap.hasOwnProperty(pHash))return false;return this._HashMap[pHash];}}]);return CashMoney;}(libFableServiceProviderBase);module.exports=CashMoney;},{"./LinkedList.js":24,"fable-serviceproviderbase":36}],23:[function(require,module,exports){/**
|
|
203
446
|
* Double Linked List Node
|
|
204
447
|
*
|
|
205
448
|
* @author Steven Velozo <steven@velozo.com>
|
|
@@ -211,7 +454,7 @@ _this4.pruneBasedOnLength(fComplete,tmpRemovedRecords);},tmpRemovedRecords);}//
|
|
|
211
454
|
* @constructor
|
|
212
455
|
*/var LinkedListNode=/*#__PURE__*/_createClass2(function LinkedListNode(){_classCallCheck2(this,LinkedListNode);this.Hash=false;this.Datum=false;// This is where expiration and other elements are stored;
|
|
213
456
|
this.Metadata={};this.LeftNode=false;this.RightNode=false;// To allow safe specialty operations on nodes
|
|
214
|
-
this.__ISNODE=true;});module.exports=LinkedListNode;},{}],
|
|
457
|
+
this.__ISNODE=true;});module.exports=LinkedListNode;},{}],24:[function(require,module,exports){"use strict";/**
|
|
215
458
|
* Simple double linked list to hold the cache entries in, in order.
|
|
216
459
|
*
|
|
217
460
|
* @author Steven Velozo <steven@velozo.com>
|
|
@@ -250,9 +493,9 @@ else tmpNode=tmpNode.RightNode;// Call the actual action
|
|
|
250
493
|
// I hate this pattern because long tails eventually cause stack overflows.
|
|
251
494
|
fAction(tmpNode.Datum,tmpNode.Hash,fIterator);};// Now kick off the iterator
|
|
252
495
|
return fIterator();}// Seek a specific node, 0 is the index of the first node.
|
|
253
|
-
},{key:"seek",value:function seek(pNodeIndex){if(!pNodeIndex)return false;if(this.length<1)return false;if(pNodeIndex>=this.length)return false;var tmpNode=this.head;for(var i=0;i<pNodeIndex;i++){tmpNode=tmpNode.RightNode;}return tmpNode;}}]);return LinkedList;}();module.exports=LinkedList;},{"./LinkedList-Node.js":
|
|
496
|
+
},{key:"seek",value:function seek(pNodeIndex){if(!pNodeIndex)return false;if(this.length<1)return false;if(pNodeIndex>=this.length)return false;var tmpNode=this.head;for(var i=0;i<pNodeIndex;i++){tmpNode=tmpNode.RightNode;}return tmpNode;}}]);return LinkedList;}();module.exports=LinkedList;},{"./LinkedList-Node.js":23}],25:[function(require,module,exports){'use strict';var GetIntrinsic=require('get-intrinsic');var callBind=require('./');var $indexOf=callBind(GetIntrinsic('String.prototype.indexOf'));module.exports=function callBoundIntrinsic(name,allowMissing){var intrinsic=GetIntrinsic(name,!!allowMissing);if(typeof intrinsic==='function'&&$indexOf(name,'.prototype.')>-1){return callBind(intrinsic);}return intrinsic;};},{"./":26,"get-intrinsic":44}],26:[function(require,module,exports){'use strict';var bind=require('function-bind');var GetIntrinsic=require('get-intrinsic');var $apply=GetIntrinsic('%Function.prototype.apply%');var $call=GetIntrinsic('%Function.prototype.call%');var $reflectApply=GetIntrinsic('%Reflect.apply%',true)||bind.call($call,$apply);var $gOPD=GetIntrinsic('%Object.getOwnPropertyDescriptor%',true);var $defineProperty=GetIntrinsic('%Object.defineProperty%',true);var $max=GetIntrinsic('%Math.max%');if($defineProperty){try{$defineProperty({},'a',{value:1});}catch(e){// IE 8 has a broken defineProperty
|
|
254
497
|
$defineProperty=null;}}module.exports=function callBind(originalFunction){var func=$reflectApply(bind,$call,arguments);if($gOPD&&$defineProperty){var desc=$gOPD(func,'length');if(desc.configurable){// original length, plus the receiver, minus any additional arguments (after the receiver)
|
|
255
|
-
$defineProperty(func,'length',{value:1+$max(0,originalFunction.length-(arguments.length-1))});}}return func;};var applyBind=function applyBind(){return $reflectApply(bind,$apply,arguments);};if($defineProperty){$defineProperty(module.exports,'apply',{value:applyBind});}else{module.exports.apply=applyBind;}},{"function-bind":
|
|
498
|
+
$defineProperty(func,'length',{value:1+$max(0,originalFunction.length-(arguments.length-1))});}}return func;};var applyBind=function applyBind(){return $reflectApply(bind,$apply,arguments);};if($defineProperty){$defineProperty(module.exports,'apply',{value:applyBind});}else{module.exports.apply=applyBind;}},{"function-bind":43,"get-intrinsic":44}],27:[function(require,module,exports){/*!
|
|
256
499
|
* cookie
|
|
257
500
|
* Copyright(c) 2012-2014 Roman Shtylman
|
|
258
501
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
@@ -318,7 +561,7 @@ if(val.charCodeAt(0)===0x22){val=val.slice(1,-1);}obj[key]=tryDecode(val,dec);}i
|
|
|
318
561
|
* @param {string} str
|
|
319
562
|
* @param {function} decode
|
|
320
563
|
* @private
|
|
321
|
-
*/function tryDecode(str,decode){try{return decode(str);}catch(e){return str;}}},{}],
|
|
564
|
+
*/function tryDecode(str,decode){try{return decode(str);}catch(e){return str;}}},{}],28:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
|
|
322
565
|
//
|
|
323
566
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
324
567
|
// copy of this software and associated documentation files (the
|
|
@@ -367,35 +610,35 @@ for(i=listeners.length-1;i>=0;i--){this.removeListener(type,listeners[i]);}}retu
|
|
|
367
610
|
// EventEmitters, we do not listen for `error` events here.
|
|
368
611
|
emitter.addEventListener(name,function wrapListener(arg){// IE does not have builtin `{ once: true }` support so we
|
|
369
612
|
// have to do it manually.
|
|
370
|
-
if(flags.once){emitter.removeEventListener(name,wrapListener);}listener(arg);});}else{throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+_typeof(emitter));}}},{}],
|
|
613
|
+
if(flags.once){emitter.removeEventListener(name,wrapListener);}listener(arg);});}else{throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+_typeof(emitter));}}},{}],29:[function(require,module,exports){/**
|
|
371
614
|
* Base Logger Class
|
|
372
615
|
*
|
|
373
616
|
*
|
|
374
617
|
* @author Steven Velozo <steven@velozo.com>
|
|
375
|
-
*/var BaseLogger=/*#__PURE__*/function(){function BaseLogger(pLogStreamSettings,
|
|
376
|
-
|
|
618
|
+
*/var libFableServiceProviderBase=require('fable-serviceproviderbase').CoreServiceProviderBase;var BaseLogger=/*#__PURE__*/function(_libFableServiceProvi2){_inherits(BaseLogger,_libFableServiceProvi2);var _super2=_createSuper(BaseLogger);function BaseLogger(pLogStreamSettings,pLogStreamHash){var _this6;_classCallCheck2(this,BaseLogger);_this6=_super2.call(this,pLogStreamSettings,pLogStreamHash);// This should not possibly be able to be instantiated without a settings object
|
|
619
|
+
_this6._Settings=_typeof(pLogStreamSettings)=='object'?pLogStreamSettings:{};_this6.serviceType='Logging-Provider';// The base logger does nothing but associate a UUID with itself
|
|
377
620
|
// We added this as the mechanism for tracking loggers to allow multiple simultaneous streams
|
|
378
621
|
// to the same provider.
|
|
379
|
-
|
|
622
|
+
_this6.loggerUUID=_this6.generateInsecureUUID();// Eventually we can use this array to ompute which levels the provider allows.
|
|
380
623
|
// For now it's just used to precompute some string concatenations.
|
|
381
|
-
|
|
624
|
+
_this6.levels=["trace","debug","info","warn","error","fatal"];return _this6;}// This is meant to generate programmatically insecure UUIDs to identify loggers
|
|
382
625
|
_createClass2(BaseLogger,[{key:"generateInsecureUUID",value:function generateInsecureUUID(){var tmpDate=new Date().getTime();var tmpUUID='LOGSTREAM-xxxxxx-yxxxxx'.replace(/[xy]/g,function(pCharacter){// Funny algorithm from w3resource that is twister-ish without the deep math and security
|
|
383
626
|
// ..but good enough for unique log stream identifiers
|
|
384
627
|
var tmpRandomData=(tmpDate+Math.random()*16)%16|0;tmpDate=Math.floor(tmpDate/16);return(pCharacter=='x'?tmpRandomData:tmpRandomData&0x3|0x8).toString(16);});return tmpUUID;}},{key:"initialize",value:function initialize(){// No operation.
|
|
385
628
|
}},{key:"trace",value:function trace(pLogText,pLogObject){this.write("trace",pLogText,pLogObject);}},{key:"debug",value:function debug(pLogText,pLogObject){this.write("debug",pLogText,pLogObject);}},{key:"info",value:function info(pLogText,pLogObject){this.write("info",pLogText,pLogObject);}},{key:"warn",value:function warn(pLogText,pLogObject){this.write("warn",pLogText,pLogObject);}},{key:"error",value:function error(pLogText,pLogObject){this.write("error",pLogText,pLogObject);}},{key:"fatal",value:function fatal(pLogText,pLogObject){this.write("fatal",pLogText,pLogObject);}},{key:"write",value:function write(pLogLevel,pLogText,pLogObject){// The base logger does nothing.
|
|
386
|
-
return true;}}]);return BaseLogger;}();module.exports=BaseLogger;},{}],
|
|
629
|
+
return true;}}]);return BaseLogger;}(libFableServiceProviderBase);module.exports=BaseLogger;},{"fable-serviceproviderbase":36}],30:[function(require,module,exports){/**
|
|
387
630
|
* Default Logger Provider Function
|
|
388
631
|
*
|
|
389
632
|
*
|
|
390
633
|
* @author Steven Velozo <steven@velozo.com>
|
|
391
634
|
*/ // Return the providers that are available without extensions loaded
|
|
392
|
-
var getDefaultProviders=function getDefaultProviders(){var tmpDefaultProviders={};tmpDefaultProviders.console=require('./Fable-Log-Logger-Console.js');tmpDefaultProviders["default"]=tmpDefaultProviders.console;return tmpDefaultProviders;};module.exports=getDefaultProviders();},{"./Fable-Log-Logger-Console.js":
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
635
|
+
var getDefaultProviders=function getDefaultProviders(){var tmpDefaultProviders={};tmpDefaultProviders.console=require('./Fable-Log-Logger-Console.js');tmpDefaultProviders["default"]=tmpDefaultProviders.console;return tmpDefaultProviders;};module.exports=getDefaultProviders();},{"./Fable-Log-Logger-Console.js":32}],31:[function(require,module,exports){module.exports=[{"loggertype":"console","streamtype":"console","level":"trace"}];},{}],32:[function(require,module,exports){var libBaseLogger=require('./Fable-Log-BaseLogger.js');var ConsoleLogger=/*#__PURE__*/function(_libBaseLogger){_inherits(ConsoleLogger,_libBaseLogger);var _super3=_createSuper(ConsoleLogger);function ConsoleLogger(pLogStreamSettings,pFableLog){var _this7;_classCallCheck2(this,ConsoleLogger);_this7=_super3.call(this,pLogStreamSettings);_this7._ShowTimeStamps=_this7._Settings.hasOwnProperty('showtimestamps')?_this7._Settings.showtimestamps==true:true;_this7._FormattedTimeStamps=_this7._Settings.hasOwnProperty('formattedtimestamps')?_this7._Settings.formattedtimestamps==true:true;_this7._ContextMessage=_this7._Settings.hasOwnProperty('Context')?"(".concat(_this7._Settings.Context,")"):pFableLog._Settings.hasOwnProperty('Product')?"(".concat(pFableLog._Settings.Product,")"):'Unnamed_Log_Context';// Allow the user to decide what gets output to the console
|
|
636
|
+
_this7._OutputLogLinesToConsole=_this7._Settings.hasOwnProperty('outputloglinestoconsole')?_this7._Settings.outputloglinestoconsole:true;_this7._OutputObjectsToConsole=_this7._Settings.hasOwnProperty('outputobjectstoconsole')?_this7._Settings.outputobjectstoconsole:true;// Precompute the prefix for each level
|
|
637
|
+
_this7.prefixCache={};for(var i=0;i<=_this7.levels.length;i++){_this7.prefixCache[_this7.levels[i]]="[".concat(_this7.levels[i],"] ").concat(_this7._ContextMessage,": ");if(_this7._ShowTimeStamps){// If there is a timestamp we need a to prepend space before the prefixcache string, since the timestamp comes first
|
|
638
|
+
_this7.prefixCache[_this7.levels[i]]=' '+_this7.prefixCache[_this7.levels[i]];}}return _this7;}_createClass2(ConsoleLogger,[{key:"write",value:function write(pLevel,pLogText,pObject){var tmpTimeStamp='';if(this._ShowTimeStamps&&this._FormattedTimeStamps){tmpTimeStamp=new Date().toISOString();}else if(this._ShowTimeStamps){tmpTimeStamp=+new Date();}var tmpLogLine="".concat(tmpTimeStamp).concat(this.prefixCache[pLevel]).concat(pLogText);if(this._OutputLogLinesToConsole){console.log(tmpLogLine);}// Write out the object on a separate line if it is passed in
|
|
396
639
|
if(this._OutputObjectsToConsole&&typeof pObject!=='undefined'){console.log(JSON.stringify(pObject,null,2));}// Provide an easy way to be overridden and be consistent
|
|
397
|
-
return tmpLogLine;}}]);return ConsoleLogger;}(libBaseLogger);module.exports=ConsoleLogger;},{"./Fable-Log-BaseLogger.js":
|
|
398
|
-
|
|
640
|
+
return tmpLogLine;}}]);return ConsoleLogger;}(libBaseLogger);module.exports=ConsoleLogger;},{"./Fable-Log-BaseLogger.js":29}],33:[function(require,module,exports){var libConsoleLog=require('./Fable-Log-Logger-Console.js');var libFS=require('fs');var libPath=require('path');var SimpleFlatFileLogger=/*#__PURE__*/function(_libConsoleLog){_inherits(SimpleFlatFileLogger,_libConsoleLog);var _super4=_createSuper(SimpleFlatFileLogger);function SimpleFlatFileLogger(pLogStreamSettings,pFableLog){var _this8;_classCallCheck2(this,SimpleFlatFileLogger);_this8=_super4.call(this,pLogStreamSettings,pFableLog);// If a path isn't provided for the logfile, it tries to use the ProductName or Context
|
|
641
|
+
_this8.logFileRawPath=_this8._Settings.hasOwnProperty('path')?_this8._Settings.path:"./".concat(_this8._ContextMessage,".log");_this8.logFilePath=libPath.normalize(_this8.logFileRawPath);_this8.logFileStreamOptions=_this8._Settings.hasOwnProperty('fileStreamoptions')?_this8._Settings.fileStreamOptions:{"flags":"a","encoding":"utf8"};_this8.fileWriter=libFS.createWriteStream(_this8.logFilePath,_this8.logFileStreamOptions);_this8.activelyWriting=false;_this8.logLineStrings=[];_this8.logObjectStrings=[];_this8.defaultWriteCompleteCallback=function(){};_this8.defaultBufferFlushCallback=function(){};return _this8;}_createClass2(SimpleFlatFileLogger,[{key:"closeWriter",value:function closeWriter(fCloseComplete){var tmpCloseComplete=typeof fCloseComplete=='function'?fCloseComplete:function(){};if(this.fileWriter){this.fileWriter.end('\n');return this.fileWriter.once('finish',tmpCloseComplete.bind(this));}}},{key:"completeBufferFlushToLogFile",value:function completeBufferFlushToLogFile(fFlushComplete){this.activelyWriting=false;var tmpFlushComplete=typeof fFlushComplete=='function'?fFlushComplete:this.defaultBufferFlushCallback;if(this.logLineStrings.length>0){this.flushBufferToLogFile(tmpFlushComplete);}else{return tmpFlushComplete();}}},{key:"flushBufferToLogFile",value:function flushBufferToLogFile(fFlushComplete){if(!this.activelyWriting){// Only want to be writing one thing at a time....
|
|
399
642
|
this.activelyWriting=true;var tmpFlushComplete=typeof fFlushComplete=='function'?fFlushComplete:this.defaultBufferFlushCallback;// Get the current buffer arrays. These should always have matching number of elements.
|
|
400
643
|
var tmpLineStrings=this.logLineStrings;var tmpObjectStrings=this.logObjectStrings;// Reset these to be filled while we process this queue...
|
|
401
644
|
this.logLineStrings=[];this.logObjectStrings=[];// This is where we will put each line before writing it to the file...
|
|
@@ -403,20 +646,19 @@ var tmpConstructedBufferOutputString='';for(var i=0;i<tmpLineStrings.length;i++)
|
|
|
403
646
|
tmpConstructedBufferOutputString+="".concat(tmpLineStrings[i],"\n");if(tmpObjectStrings[i]!==false){tmpConstructedBufferOutputString+="".concat(tmpObjectStrings[i],"\n");}}if(!this.fileWriter.write(tmpConstructedBufferOutputString,'utf8')){// If the streamwriter returns false, we need to wait for it to drain.
|
|
404
647
|
this.fileWriter.once('drain',this.completeBufferFlushToLogFile.bind(this,tmpFlushComplete));}else{return this.completeBufferFlushToLogFile(tmpFlushComplete);}}}},{key:"write",value:function write(pLevel,pLogText,pObject){var tmpLogLine=_get(_getPrototypeOf(SimpleFlatFileLogger.prototype),"write",this).call(this,pLevel,pLogText,pObject);// Use a very simple array as the write buffer
|
|
405
648
|
this.logLineStrings.push(tmpLogLine);// Write out the object on a separate line if it is passed in
|
|
406
|
-
if(typeof pObject!=='undefined'){this.logObjectStrings.push(JSON.stringify(pObject,null,4));}else{this.logObjectStrings.push(false);}this.flushBufferToLogFile();}}]);return SimpleFlatFileLogger;}(libConsoleLog);module.exports=SimpleFlatFileLogger;},{"./Fable-Log-Logger-Console.js":
|
|
649
|
+
if(typeof pObject!=='undefined'){this.logObjectStrings.push(JSON.stringify(pObject,null,4));}else{this.logObjectStrings.push(false);}this.flushBufferToLogFile();}}]);return SimpleFlatFileLogger;}(libConsoleLog);module.exports=SimpleFlatFileLogger;},{"./Fable-Log-Logger-Console.js":32,"fs":19,"path":65}],34:[function(require,module,exports){/**
|
|
407
650
|
* Fable Logging Service
|
|
408
|
-
*/var libFableServiceProviderBase=require('fable-serviceproviderbase').CoreServiceProviderBase;var FableLog=/*#__PURE__*/function(
|
|
651
|
+
*/var libFableServiceProviderBase=require('fable-serviceproviderbase').CoreServiceProviderBase;var FableLog=/*#__PURE__*/function(_libFableServiceProvi3){_inherits(FableLog,_libFableServiceProvi3);var _super5=_createSuper(FableLog);function FableLog(pSettings,pServiceHash){var _this9;_classCallCheck2(this,FableLog);_this9=_super5.call(this,pSettings,pServiceHash);_this9.serviceType='Logging';var tmpSettings=_typeof(pSettings)==='object'?pSettings:{};_this9._Settings=tmpSettings;_this9._Providers=require('./Fable-Log-DefaultProviders-Node.js');_this9._StreamDefinitions=tmpSettings.hasOwnProperty('LogStreams')?tmpSettings.LogStreams:require('./Fable-Log-DefaultStreams.json');_this9.logStreams=[];// This object gets decorated for one-time instantiated providers that
|
|
409
652
|
// have multiple outputs, such as bunyan.
|
|
410
|
-
|
|
411
|
-
|
|
653
|
+
_this9.logProviders={};// A hash list of the GUIDs for each log stream, so they can't be added to the set more than one time
|
|
654
|
+
_this9.activeLogStreams={};_this9.logStreamsTrace=[];_this9.logStreamsDebug=[];_this9.logStreamsInfo=[];_this9.logStreamsWarn=[];_this9.logStreamsError=[];_this9.logStreamsFatal=[];_this9.datumDecorator=function(pDatum){return pDatum;};_this9.uuid=typeof tmpSettings.Product==='string'?tmpSettings.Product:'Default';return _this9;}_createClass2(FableLog,[{key:"addLogger",value:function addLogger(pLogger,pLevel){// Bail out if we've already created one.
|
|
412
655
|
if(this.activeLogStreams.hasOwnProperty(pLogger.loggerUUID)){return false;}// Add it to the streams and to the mutex
|
|
413
656
|
this.logStreams.push(pLogger);this.activeLogStreams[pLogger.loggerUUID]=true;// Make sure a kosher level was passed in
|
|
414
657
|
switch(pLevel){case'trace':this.logStreamsTrace.push(pLogger);case'debug':this.logStreamsDebug.push(pLogger);case'info':this.logStreamsInfo.push(pLogger);case'warn':this.logStreamsWarn.push(pLogger);case'error':this.logStreamsError.push(pLogger);case'fatal':this.logStreamsFatal.push(pLogger);break;}return true;}},{key:"setDatumDecorator",value:function setDatumDecorator(fDatumDecorator){if(typeof fDatumDecorator==='function'){this.datumDecorator=fDatumDecorator;}else{this.datumDecorator=function(pDatum){return pDatum;};}}},{key:"trace",value:function trace(pMessage,pDatum){var tmpDecoratedDatum=this.datumDecorator(pDatum);for(var i=0;i<this.logStreamsTrace.length;i++){this.logStreamsTrace[i].trace(pMessage,tmpDecoratedDatum);}}},{key:"debug",value:function debug(pMessage,pDatum){var tmpDecoratedDatum=this.datumDecorator(pDatum);for(var i=0;i<this.logStreamsDebug.length;i++){this.logStreamsDebug[i].debug(pMessage,tmpDecoratedDatum);}}},{key:"info",value:function info(pMessage,pDatum){var tmpDecoratedDatum=this.datumDecorator(pDatum);for(var i=0;i<this.logStreamsInfo.length;i++){this.logStreamsInfo[i].info(pMessage,tmpDecoratedDatum);}}},{key:"warn",value:function warn(pMessage,pDatum){var tmpDecoratedDatum=this.datumDecorator(pDatum);for(var i=0;i<this.logStreamsWarn.length;i++){this.logStreamsWarn[i].warn(pMessage,tmpDecoratedDatum);}}},{key:"error",value:function error(pMessage,pDatum){var tmpDecoratedDatum=this.datumDecorator(pDatum);for(var i=0;i<this.logStreamsError.length;i++){this.logStreamsError[i].error(pMessage,tmpDecoratedDatum);}}},{key:"fatal",value:function fatal(pMessage,pDatum){var tmpDecoratedDatum=this.datumDecorator(pDatum);for(var i=0;i<this.logStreamsFatal.length;i++){this.logStreamsFatal[i].fatal(pMessage,tmpDecoratedDatum);}}},{key:"initialize",value:function initialize(){// "initialize" each logger as defined in the logging parameters
|
|
415
658
|
for(var i=0;i<this._StreamDefinitions.length;i++){var tmpStreamDefinition=Object.assign({loggertype:'default',streamtype:'console',level:'info'},this._StreamDefinitions[i]);if(!this._Providers.hasOwnProperty(tmpStreamDefinition.loggertype)){console.log("Error initializing log stream: bad loggertype in stream definition ".concat(JSON.stringify(tmpStreamDefinition)));}else{this.addLogger(new this._Providers[tmpStreamDefinition.loggertype](tmpStreamDefinition,this),tmpStreamDefinition.level);}}// Now initialize each one.
|
|
416
659
|
for(var _i=0;_i<this.logStreams.length;_i++){this.logStreams[_i].initialize();}}},{key:"logTime",value:function logTime(pMessage,pDatum){var tmpMessage=typeof pMessage!=='undefined'?pMessage:'Time';var tmpTime=new Date();this.info("".concat(tmpMessage," ").concat(tmpTime," (epoch ").concat(+tmpTime,")"),pDatum);}// Get a timestamp
|
|
417
660
|
},{key:"getTimeStamp",value:function getTimeStamp(){return+new Date();}},{key:"getTimeDelta",value:function getTimeDelta(pTimeStamp){var tmpEndTime=+new Date();return tmpEndTime-pTimeStamp;}// Log the delta between a timestamp, and now with a message
|
|
418
|
-
},{key:"logTimeDelta",value:function logTimeDelta(pTimeDelta,pMessage,pDatum){var tmpMessage=typeof pMessage!=='undefined'?pMessage:'Time Measurement';var tmpDatum=_typeof(pDatum)==='object'?pDatum:{};var tmpEndTime=+new Date();this.info("".concat(tmpMessage," logged at (epoch ").concat(+tmpEndTime,") took (").concat(pTimeDelta,"ms)"),pDatum);}},{key:"logTimeDeltaHuman",value:function logTimeDeltaHuman(pTimeDelta,pMessage,pDatum){var tmpMessage=typeof pMessage!=='undefined'?pMessage:'Time Measurement';var tmpEndTime=+new Date();var tmpMs=parseInt(pTimeDelta%1000);var tmpSeconds=parseInt(pTimeDelta/1000%60);var tmpMinutes=parseInt(pTimeDelta/(1000*60)%60);var tmpHours=parseInt(pTimeDelta/(1000*60*60));tmpMs=tmpMs<10?"00"+tmpMs:tmpMs<100?"0"+tmpMs:tmpMs;tmpSeconds=tmpSeconds<10?"0"+tmpSeconds:tmpSeconds;tmpMinutes=tmpMinutes<10?"0"+tmpMinutes:tmpMinutes;tmpHours=tmpHours<10?"0"+tmpHours:tmpHours;this.info("".concat(tmpMessage," logged at (epoch ").concat(+tmpEndTime,") took (").concat(pTimeDelta,"ms) or (").concat(tmpHours,":").concat(tmpMinutes,":").concat(tmpSeconds,".").concat(tmpMs,")"),pDatum);}},{key:"logTimeDeltaRelative",value:function logTimeDeltaRelative(pStartTime,pMessage,pDatum){this.logTimeDelta(this.getTimeDelta(pStartTime),pMessage,pDatum);}},{key:"logTimeDeltaRelativeHuman",value:function logTimeDeltaRelativeHuman(pStartTime,pMessage,pDatum){this.logTimeDeltaHuman(this.getTimeDelta(pStartTime),pMessage,pDatum);}}]);return FableLog;}(libFableServiceProviderBase)
|
|
419
|
-
function autoConstruct(pSettings){return new FableLog(pSettings);}module.exports=FableLog;module.exports["new"]=autoConstruct;module.exports.LogProviderBase=require('./Fable-Log-BaseLogger.js');module.exports.LogProviderConsole=require('./Fable-Log-Logger-Console.js');module.exports.LogProviderConsole=require('./Fable-Log-Logger-SimpleFlatFile.js');},{"./Fable-Log-BaseLogger.js":28,"./Fable-Log-DefaultProviders-Node.js":29,"./Fable-Log-DefaultStreams.json":30,"./Fable-Log-Logger-Console.js":31,"./Fable-Log-Logger-SimpleFlatFile.js":32,"fable-serviceproviderbase":35}],34:[function(require,module,exports){/**
|
|
661
|
+
},{key:"logTimeDelta",value:function logTimeDelta(pTimeDelta,pMessage,pDatum){var tmpMessage=typeof pMessage!=='undefined'?pMessage:'Time Measurement';var tmpDatum=_typeof(pDatum)==='object'?pDatum:{};var tmpEndTime=+new Date();this.info("".concat(tmpMessage," logged at (epoch ").concat(+tmpEndTime,") took (").concat(pTimeDelta,"ms)"),pDatum);}},{key:"logTimeDeltaHuman",value:function logTimeDeltaHuman(pTimeDelta,pMessage,pDatum){var tmpMessage=typeof pMessage!=='undefined'?pMessage:'Time Measurement';var tmpEndTime=+new Date();var tmpMs=parseInt(pTimeDelta%1000);var tmpSeconds=parseInt(pTimeDelta/1000%60);var tmpMinutes=parseInt(pTimeDelta/(1000*60)%60);var tmpHours=parseInt(pTimeDelta/(1000*60*60));tmpMs=tmpMs<10?"00"+tmpMs:tmpMs<100?"0"+tmpMs:tmpMs;tmpSeconds=tmpSeconds<10?"0"+tmpSeconds:tmpSeconds;tmpMinutes=tmpMinutes<10?"0"+tmpMinutes:tmpMinutes;tmpHours=tmpHours<10?"0"+tmpHours:tmpHours;this.info("".concat(tmpMessage," logged at (epoch ").concat(+tmpEndTime,") took (").concat(pTimeDelta,"ms) or (").concat(tmpHours,":").concat(tmpMinutes,":").concat(tmpSeconds,".").concat(tmpMs,")"),pDatum);}},{key:"logTimeDeltaRelative",value:function logTimeDeltaRelative(pStartTime,pMessage,pDatum){this.logTimeDelta(this.getTimeDelta(pStartTime),pMessage,pDatum);}},{key:"logTimeDeltaRelativeHuman",value:function logTimeDeltaRelativeHuman(pStartTime,pMessage,pDatum){this.logTimeDeltaHuman(this.getTimeDelta(pStartTime),pMessage,pDatum);}}]);return FableLog;}(libFableServiceProviderBase);module.exports=FableLog;module.exports.LogProviderBase=require('./Fable-Log-BaseLogger.js');module.exports.LogProviderConsole=require('./Fable-Log-Logger-Console.js');module.exports.LogProviderFlatfile=require('./Fable-Log-Logger-SimpleFlatFile.js');},{"./Fable-Log-BaseLogger.js":29,"./Fable-Log-DefaultProviders-Node.js":30,"./Fable-Log-DefaultStreams.json":31,"./Fable-Log-Logger-Console.js":32,"./Fable-Log-Logger-SimpleFlatFile.js":33,"fable-serviceproviderbase":36}],35:[function(require,module,exports){/**
|
|
420
662
|
* Fable Core Pre-initialization Service Base
|
|
421
663
|
*
|
|
422
664
|
* For a couple services, we need to be able to instantiate them before the Fable object is fully initialized.
|
|
@@ -425,11 +667,11 @@ function autoConstruct(pSettings){return new FableLog(pSettings);}module.exports
|
|
|
425
667
|
* @author <steven@velozo.com>
|
|
426
668
|
*/var FableCoreServiceProviderBase=/*#__PURE__*/function(){function FableCoreServiceProviderBase(pOptions,pServiceHash){_classCallCheck2(this,FableCoreServiceProviderBase);this.fable=false;this.options=_typeof(pOptions)==='object'?pOptions:{};this.serviceType='Unknown';// The hash will be a non-standard UUID ... the UUID service uses this base class!
|
|
427
669
|
this.UUID="CORESVC-".concat(Math.floor(Math.random()*(99999-10000)+10000));this.Hash=typeof pServiceHash==='string'?pServiceHash:"".concat(this.UUID);}_createClass2(FableCoreServiceProviderBase,[{key:"connectFable",value:// After fable is initialized, it would be expected to be wired in as a normal service.
|
|
428
|
-
function connectFable(pFable){this.fable=pFable;return true;}}]);return FableCoreServiceProviderBase;}();_defineProperty2(FableCoreServiceProviderBase,"isFableService",true);module.exports=FableCoreServiceProviderBase;},{}],
|
|
670
|
+
function connectFable(pFable){this.fable=pFable;return true;}}]);return FableCoreServiceProviderBase;}();_defineProperty2(FableCoreServiceProviderBase,"isFableService",true);module.exports=FableCoreServiceProviderBase;},{}],36:[function(require,module,exports){/**
|
|
429
671
|
* Fable Service Base
|
|
430
672
|
* @author <steven@velozo.com>
|
|
431
673
|
*/var FableServiceProviderBase=/*#__PURE__*/_createClass2(function FableServiceProviderBase(pFable,pOptions,pServiceHash){_classCallCheck2(this,FableServiceProviderBase);this.fable=pFable;this.options=_typeof(pOptions)==='object'?pOptions:_typeof(pFable)==='object'&&!pFable.isFable?pFable:{};this.serviceType='Unknown';if(typeof pFable.getUUID=='function'){this.UUID=pFable.getUUID();}else{this.UUID="NoFABLESVC-".concat(Math.floor(Math.random()*(99999-10000)+10000));}this.Hash=typeof pServiceHash==='string'?pServiceHash:"".concat(this.UUID);// Pull back a few things
|
|
432
|
-
this.log=this.fable.log;this.servicesMap=this.fable.servicesMap;this.services=this.fable.services;});_defineProperty2(FableServiceProviderBase,"isFableService",true);module.exports=FableServiceProviderBase;module.exports.CoreServiceProviderBase=require('./Fable-ServiceProviderBase-Preinit.js');},{"./Fable-ServiceProviderBase-Preinit.js":
|
|
674
|
+
this.log=this.fable.log;this.servicesMap=this.fable.servicesMap;this.services=this.fable.services;});_defineProperty2(FableServiceProviderBase,"isFableService",true);module.exports=FableServiceProviderBase;module.exports.CoreServiceProviderBase=require('./Fable-ServiceProviderBase-Preinit.js');},{"./Fable-ServiceProviderBase-Preinit.js":35}],37:[function(require,module,exports){module.exports={"Product":"ApplicationNameHere","ProductVersion":"0.0.0","ConfigFile":false,"LogStreams":[{"level":"trace"}]};},{}],38:[function(require,module,exports){(function(process){(function(){/**
|
|
433
675
|
* Fable Settings Template Processor
|
|
434
676
|
*
|
|
435
677
|
* This class allows environment variables to come in via templated expressions, and defaults to be set.
|
|
@@ -439,23 +681,23 @@ this.log=this.fable.log;this.servicesMap=this.fable.servicesMap;this.services=th
|
|
|
439
681
|
* @module Fable Settings
|
|
440
682
|
*/var libPrecedent=require('precedent');var FableSettingsTemplateProcessor=/*#__PURE__*/function(){function FableSettingsTemplateProcessor(pDependencies){_classCallCheck2(this,FableSettingsTemplateProcessor);// Use a no-dependencies templating engine to parse out environment variables
|
|
441
683
|
this.templateProcessor=new libPrecedent();// TODO: Make the environment variable wrap expression demarcation characters configurable?
|
|
442
|
-
this.templateProcessor.addPattern('${','}',function(pTemplateValue){var tmpTemplateValue=pTemplateValue.trim();var tmpSeparatorIndex=tmpTemplateValue.indexOf('|');var tmpDefaultValue=tmpSeparatorIndex>=0?tmpTemplateValue.substring(tmpSeparatorIndex+1):'';var tmpEnvironmentVariableName=tmpSeparatorIndex>-1?tmpTemplateValue.substring(0,tmpSeparatorIndex):tmpTemplateValue;if(process.env.hasOwnProperty(tmpEnvironmentVariableName)){return process.env[tmpEnvironmentVariableName];}else{return tmpDefaultValue;}});}_createClass2(FableSettingsTemplateProcessor,[{key:"parseSetting",value:function parseSetting(pString){return this.templateProcessor.parseString(pString);}}]);return FableSettingsTemplateProcessor;}();module.exports=FableSettingsTemplateProcessor;}).call(this);}).call(this,require('_process'));},{"_process":69,"precedent":66}],
|
|
684
|
+
this.templateProcessor.addPattern('${','}',function(pTemplateValue){var tmpTemplateValue=pTemplateValue.trim();var tmpSeparatorIndex=tmpTemplateValue.indexOf('|');var tmpDefaultValue=tmpSeparatorIndex>=0?tmpTemplateValue.substring(tmpSeparatorIndex+1):'';var tmpEnvironmentVariableName=tmpSeparatorIndex>-1?tmpTemplateValue.substring(0,tmpSeparatorIndex):tmpTemplateValue;if(process.env.hasOwnProperty(tmpEnvironmentVariableName)){return process.env[tmpEnvironmentVariableName];}else{return tmpDefaultValue;}});}_createClass2(FableSettingsTemplateProcessor,[{key:"parseSetting",value:function parseSetting(pString){return this.templateProcessor.parseString(pString);}}]);return FableSettingsTemplateProcessor;}();module.exports=FableSettingsTemplateProcessor;}).call(this);}).call(this,require('_process'));},{"_process":69,"precedent":66}],39:[function(require,module,exports){/**
|
|
443
685
|
* Fable Settings Add-on
|
|
444
686
|
*
|
|
445
687
|
*
|
|
446
688
|
* @author Steven Velozo <steven@velozo.com>
|
|
447
689
|
* @module Fable Settings
|
|
448
|
-
*/var libFableServiceProviderBase=require('fable-serviceproviderbase').CoreServiceProviderBase;var libFableSettingsTemplateProcessor=require('./Fable-Settings-TemplateProcessor.js');var FableSettings=/*#__PURE__*/function(
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
var tmpSettings=
|
|
452
|
-
|
|
453
|
-
tmpSettings=
|
|
690
|
+
*/var libFableServiceProviderBase=require('fable-serviceproviderbase').CoreServiceProviderBase;var libFableSettingsTemplateProcessor=require('./Fable-Settings-TemplateProcessor.js');var FableSettings=/*#__PURE__*/function(_libFableServiceProvi4){_inherits(FableSettings,_libFableServiceProvi4);var _super6=_createSuper(FableSettings);function FableSettings(pSettings,pServiceHash){var _this10;_classCallCheck2(this,FableSettings);_this10=_super6.call(this,pSettings,pServiceHash);_this10.serviceType='SettingsManager';// Initialize the settings value template processor
|
|
691
|
+
_this10.settingsTemplateProcessor=new libFableSettingsTemplateProcessor();// set straight away so anything that uses it respects the initial setting
|
|
692
|
+
_this10._configureEnvTemplating(pSettings);_this10["default"]=_this10.buildDefaultSettings();// Construct a new settings object
|
|
693
|
+
var tmpSettings=_this10.merge(pSettings,_this10.buildDefaultSettings());// The base settings object (what they were on initialization, before other actors have altered them)
|
|
694
|
+
_this10.base=JSON.parse(JSON.stringify(tmpSettings));if(tmpSettings.DefaultConfigFile){try{// If there is a DEFAULT configuration file, try to load and merge it.
|
|
695
|
+
tmpSettings=_this10.merge(require(tmpSettings.DefaultConfigFile),tmpSettings);}catch(pException){// Why this? Often for an app we want settings to work out of the box, but
|
|
454
696
|
// would potentially want to have a config file for complex settings.
|
|
455
697
|
console.log('Fable-Settings Warning: Default configuration file specified but there was a problem loading it. Falling back to base.');console.log(' Loading Exception: '+pException);}}if(tmpSettings.ConfigFile){try{// If there is a configuration file, try to load and merge it.
|
|
456
|
-
tmpSettings=
|
|
698
|
+
tmpSettings=_this10.merge(require(tmpSettings.ConfigFile),tmpSettings);}catch(pException){// Why this? Often for an app we want settings to work out of the box, but
|
|
457
699
|
// would potentially want to have a config file for complex settings.
|
|
458
|
-
console.log('Fable-Settings Warning: Configuration file specified but there was a problem loading it. Falling back to base.');console.log(' Loading Exception: '+pException);}}
|
|
700
|
+
console.log('Fable-Settings Warning: Configuration file specified but there was a problem loading it. Falling back to base.');console.log(' Loading Exception: '+pException);}}_this10.settings=tmpSettings;return _this10;}// Build a default settings object. Use the JSON jimmy to ensure it is always a new object.
|
|
459
701
|
_createClass2(FableSettings,[{key:"buildDefaultSettings",value:function buildDefaultSettings(){return JSON.parse(JSON.stringify(require('./Fable-Settings-Default')));}// Update the configuration for environment variable templating based on the current settings object
|
|
460
702
|
},{key:"_configureEnvTemplating",value:function _configureEnvTemplating(pSettings){// default environment variable templating to on
|
|
461
703
|
this._PerformEnvTemplating=!pSettings||pSettings.NoEnvReplacement!==true;}// Resolve (recursive) any environment variables found in settings object.
|
|
@@ -463,8 +705,8 @@ this._PerformEnvTemplating=!pSettings||pSettings.NoEnvReplacement!==true;}// Res
|
|
|
463
705
|
* Check to see if a value is an object (but not an array).
|
|
464
706
|
*/},{key:"_isObject",value:function _isObject(value){return _typeof(value)==='object'&&!Array.isArray(value);}/**
|
|
465
707
|
* Merge two plain objects. Keys that are objects in both will be merged property-wise.
|
|
466
|
-
*/},{key:"_deepMergeObjects",value:function _deepMergeObjects(toObject,fromObject){var
|
|
467
|
-
|
|
708
|
+
*/},{key:"_deepMergeObjects",value:function _deepMergeObjects(toObject,fromObject){var _this11=this;if(!fromObject||!this._isObject(fromObject)){return;}Object.keys(fromObject).forEach(function(key){var fromValue=fromObject[key];if(_this11._isObject(fromValue)){var toValue=toObject[key];if(toValue&&_this11._isObject(toValue)){// both are objects, so do a recursive merge
|
|
709
|
+
_this11._deepMergeObjects(toValue,fromValue);return;}}toObject[key]=fromValue;});return toObject;}// Merge some new object into the existing settings.
|
|
468
710
|
},{key:"merge",value:function merge(pSettingsFrom,pSettingsTo){// If an invalid settings from object is passed in (e.g. object constructor without passing in anything) this should still work
|
|
469
711
|
var tmpSettingsFrom=_typeof(pSettingsFrom)==='object'?pSettingsFrom:{};// Default to the settings object if none is passed in for the merge.
|
|
470
712
|
var tmpSettingsTo=_typeof(pSettingsTo)==='object'?pSettingsTo:this.settings;// do not mutate the From object property values
|
|
@@ -473,7 +715,7 @@ this._configureEnvTemplating(tmpSettingsTo);return tmpSettingsTo;}// Fill in set
|
|
|
473
715
|
},{key:"fill",value:function fill(pSettingsFrom){// If an invalid settings from object is passed in (e.g. object constructor without passing in anything) this should still work
|
|
474
716
|
var tmpSettingsFrom=_typeof(pSettingsFrom)==='object'?pSettingsFrom:{};// do not mutate the From object property values
|
|
475
717
|
var tmpSettingsFromCopy=JSON.parse(JSON.stringify(tmpSettingsFrom));this.settings=this._deepMergeObjects(tmpSettingsFromCopy,this.settings);return this.settings;}}]);return FableSettings;}(libFableServiceProviderBase);;// This is for backwards compatibility
|
|
476
|
-
function autoConstruct(pSettings){return new FableSettings(pSettings);}module.exports=FableSettings;module.exports["new"]=autoConstruct;},{"./Fable-Settings-Default":
|
|
718
|
+
function autoConstruct(pSettings){return new FableSettings(pSettings);}module.exports=FableSettings;module.exports["new"]=autoConstruct;},{"./Fable-Settings-Default":37,"./Fable-Settings-TemplateProcessor.js":38,"fable-serviceproviderbase":36}],40:[function(require,module,exports){/**
|
|
477
719
|
* Random Byte Generator - Browser version
|
|
478
720
|
*
|
|
479
721
|
*
|
|
@@ -491,22 +733,22 @@ this.getRandomValues(tmpBuffer);return tmpBuffer;}// Math.random()-based (RNG)
|
|
|
491
733
|
},{key:"generateRandomBytes",value:function generateRandomBytes(){// If all else fails, use Math.random(). It's fast, but is of unspecified
|
|
492
734
|
// quality.
|
|
493
735
|
var tmpBuffer=new Uint8Array(16);// eslint-disable-line no-undef
|
|
494
|
-
for(var i=0,tmpValue;i<16;i++){if((i&0x03)===0){tmpValue=Math.random()*0x100000000;}tmpBuffer[i]=tmpValue>>>((i&0x03)<<3)&0xff;}return tmpBuffer;}},{key:"generate",value:function generate(){if(this.getRandomValues){return this.generateWhatWGBytes();}else{return this.generateRandomBytes();}}}]);return RandomBytes;}();module.exports=RandomBytes;},{}],
|
|
736
|
+
for(var i=0,tmpValue;i<16;i++){if((i&0x03)===0){tmpValue=Math.random()*0x100000000;}tmpBuffer[i]=tmpValue>>>((i&0x03)<<3)&0xff;}return tmpBuffer;}},{key:"generate",value:function generate(){if(this.getRandomValues){return this.generateWhatWGBytes();}else{return this.generateRandomBytes();}}}]);return RandomBytes;}();module.exports=RandomBytes;},{}],41:[function(require,module,exports){/**
|
|
495
737
|
* Fable UUID Generator
|
|
496
|
-
*/var libFableServiceProviderBase=require('fable-serviceproviderbase').CoreServiceProviderBase;0;var libRandomByteGenerator=require('./Fable-UUID-Random.js');var FableUUID=/*#__PURE__*/function(
|
|
738
|
+
*/var libFableServiceProviderBase=require('fable-serviceproviderbase').CoreServiceProviderBase;0;var libRandomByteGenerator=require('./Fable-UUID-Random.js');var FableUUID=/*#__PURE__*/function(_libFableServiceProvi5){_inherits(FableUUID,_libFableServiceProvi5);var _super7=_createSuper(FableUUID);function FableUUID(pSettings,pServiceHash){var _this12;_classCallCheck2(this,FableUUID);_this12=_super7.call(this,pSettings,pServiceHash);_this12.serviceType='UUID';// Determine if the module is in "Random UUID Mode" which means just use the random character function rather than the v4 random UUID spec.
|
|
497
739
|
// Note this allows UUIDs of various lengths (including very short ones) although guaranteed uniqueness goes downhill fast.
|
|
498
|
-
|
|
740
|
+
_this12._UUIDModeRandom=_typeof(pSettings)==='object'&&pSettings.hasOwnProperty('UUIDModeRandom')?pSettings.UUIDModeRandom==true:false;// These two properties are only useful if we are in Random mode. Otherwise it generates a v4 spec
|
|
499
741
|
// Length for "Random UUID Mode" is set -- if not set it to 8
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
742
|
+
_this12._UUIDLength=_typeof(pSettings)==='object'&&pSettings.hasOwnProperty('UUIDLength')?pSettings.UUIDLength+0:8;// Dictionary for "Random UUID Mode"
|
|
743
|
+
_this12._UUIDRandomDictionary=_typeof(pSettings)==='object'&&pSettings.hasOwnProperty('UUIDDictionary')?pSettings.UUIDDictionary+0:'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';_this12.randomByteGenerator=new libRandomByteGenerator();// Lookup table for hex codes
|
|
744
|
+
_this12._HexLookup=[];for(var i=0;i<256;++i){_this12._HexLookup[i]=(i+0x100).toString(16).substr(1);}return _this12;}// Adapted from node-uuid (https://github.com/kelektiv/node-uuid)
|
|
503
745
|
_createClass2(FableUUID,[{key:"bytesToUUID",value:function bytesToUUID(pBuffer){var i=0;// join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
|
|
504
746
|
return[this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],'-',this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],'-',this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],'-',this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],'-',this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]],this._HexLookup[pBuffer[i++]]].join('');}// Adapted from node-uuid (https://github.com/kelektiv/node-uuid)
|
|
505
747
|
},{key:"generateUUIDv4",value:function generateUUIDv4(){var tmpBuffer=new Array(16);var tmpRandomBytes=this.randomByteGenerator.generate();// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
506
748
|
tmpRandomBytes[6]=tmpRandomBytes[6]&0x0f|0x40;tmpRandomBytes[8]=tmpRandomBytes[8]&0x3f|0x80;return this.bytesToUUID(tmpRandomBytes);}// Simple random UUID generation
|
|
507
749
|
},{key:"generateRandom",value:function generateRandom(){var tmpUUID='';for(var i=0;i<this._UUIDLength;i++){tmpUUID+=this._UUIDRandomDictionary.charAt(Math.floor(Math.random()*(this._UUIDRandomDictionary.length-1)));}return tmpUUID;}// Adapted from node-uuid (https://github.com/kelektiv/node-uuid)
|
|
508
750
|
},{key:"getUUID",value:function getUUID(){if(this._UUIDModeRandom){return this.generateRandom();}else{return this.generateUUIDv4();}}}]);return FableUUID;}(libFableServiceProviderBase);// This is for backwards compatibility
|
|
509
|
-
function autoConstruct(pSettings){return new FableUUID(pSettings);}module.exports=FableUUID;module.exports["new"]=autoConstruct;},{"./Fable-UUID-Random.js":
|
|
751
|
+
function autoConstruct(pSettings){return new FableUUID(pSettings);}module.exports=FableUUID;module.exports["new"]=autoConstruct;},{"./Fable-UUID-Random.js":40,"fable-serviceproviderbase":36}],42:[function(require,module,exports){'use strict';/* eslint no-invalid-this: 1 */var ERROR_MESSAGE='Function.prototype.bind called on incompatible ';var slice=Array.prototype.slice;var toStr=Object.prototype.toString;var funcType='[object Function]';module.exports=function bind(that){var target=this;if(typeof target!=='function'||toStr.call(target)!==funcType){throw new TypeError(ERROR_MESSAGE+target);}var args=slice.call(arguments,1);var bound;var binder=function binder(){if(this instanceof bound){var result=target.apply(this,args.concat(slice.call(arguments)));if(Object(result)===result){return result;}return this;}else{return target.apply(that,args.concat(slice.call(arguments)));}};var boundLength=Math.max(0,target.length-args.length);var boundArgs=[];for(var i=0;i<boundLength;i++){boundArgs.push('$'+i);}bound=Function('binder','return function ('+boundArgs.join(',')+'){ return binder.apply(this,arguments); }')(binder);if(target.prototype){var Empty=function Empty(){};Empty.prototype=target.prototype;bound.prototype=new Empty();Empty.prototype=null;}return bound;};},{}],43:[function(require,module,exports){'use strict';var implementation=require('./implementation');module.exports=Function.prototype.bind||implementation;},{"./implementation":42}],44:[function(require,module,exports){'use strict';var undefined;var $SyntaxError=SyntaxError;var $Function=Function;var $TypeError=TypeError;// eslint-disable-next-line consistent-return
|
|
510
752
|
var getEvalledConstructor=function getEvalledConstructor(expressionSyntax){try{return $Function('"use strict"; return ('+expressionSyntax+').constructor;')();}catch(e){}};var $gOPD=Object.getOwnPropertyDescriptor;if($gOPD){try{$gOPD({},'');}catch(e){$gOPD=null;// this is IE 8, which has a broken gOPD
|
|
511
753
|
}}var throwTypeError=function throwTypeError(){throw new $TypeError();};var ThrowTypeError=$gOPD?function(){try{// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
|
|
512
754
|
arguments.callee;// IE 8 does not throw here
|
|
@@ -522,75 +764,16 @@ var errorProto=getProto(getProto(e));INTRINSICS['%Error.prototype%']=errorProto;
|
|
|
522
764
|
// uphold the illusion by pretending to see that original data
|
|
523
765
|
// property, i.e., returning the value rather than the getter
|
|
524
766
|
// itself.
|
|
525
|
-
if(isOwn&&'get'in desc&&!('originalValue'in desc.get)){value=desc.get;}else{value=value[part];}}else{isOwn=hasOwn(value,part);value=value[part];}if(isOwn&&!skipFurtherCaching){INTRINSICS[intrinsicRealName]=value;}}}return value;};},{"function-bind":
|
|
767
|
+
if(isOwn&&'get'in desc&&!('originalValue'in desc.get)){value=desc.get;}else{value=value[part];}}else{isOwn=hasOwn(value,part);value=value[part];}if(isOwn&&!skipFurtherCaching){INTRINSICS[intrinsicRealName]=value;}}}return value;};},{"function-bind":43,"has":48,"has-proto":45,"has-symbols":46}],45:[function(require,module,exports){'use strict';var test={foo:{}};var $Object=Object;module.exports=function hasProto(){return{__proto__:test}.foo===test.foo&&!({__proto__:null}instanceof $Object);};},{}],46:[function(require,module,exports){'use strict';var origSymbol=typeof Symbol!=='undefined'&&Symbol;var hasSymbolSham=require('./shams');module.exports=function hasNativeSymbols(){if(typeof origSymbol!=='function'){return false;}if(typeof Symbol!=='function'){return false;}if(_typeof(origSymbol('foo'))!=='symbol'){return false;}if(_typeof(Symbol('bar'))!=='symbol'){return false;}return hasSymbolSham();};},{"./shams":47}],47:[function(require,module,exports){'use strict';/* eslint complexity: [2, 18], max-statements: [2, 33] */module.exports=function hasSymbols(){if(typeof Symbol!=='function'||typeof Object.getOwnPropertySymbols!=='function'){return false;}if(_typeof(Symbol.iterator)==='symbol'){return true;}var obj={};var sym=Symbol('test');var symObj=Object(sym);if(typeof sym==='string'){return false;}if(Object.prototype.toString.call(sym)!=='[object Symbol]'){return false;}if(Object.prototype.toString.call(symObj)!=='[object Symbol]'){return false;}// temp disabled per https://github.com/ljharb/object.assign/issues/17
|
|
526
768
|
// if (sym instanceof Symbol) { return false; }
|
|
527
769
|
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
|
|
528
770
|
// if (!(symObj instanceof Symbol)) { return false; }
|
|
529
771
|
// if (typeof Symbol.prototype.toString !== 'function') { return false; }
|
|
530
772
|
// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
|
|
531
773
|
var symVal=42;obj[sym]=symVal;for(sym in obj){return false;}// eslint-disable-line no-restricted-syntax, no-unreachable-loop
|
|
532
|
-
if(typeof Object.keys==='function'&&Object.keys(obj).length!==0){return false;}if(typeof Object.getOwnPropertyNames==='function'&&Object.getOwnPropertyNames(obj).length!==0){return false;}var syms=Object.getOwnPropertySymbols(obj);if(syms.length!==1||syms[0]!==sym){return false;}if(!Object.prototype.propertyIsEnumerable.call(obj,sym)){return false;}if(typeof Object.getOwnPropertyDescriptor==='function'){var descriptor=Object.getOwnPropertyDescriptor(obj,sym);if(descriptor.value!==symVal||descriptor.enumerable!==true){return false;}}return true;};},{}],
|
|
774
|
+
if(typeof Object.keys==='function'&&Object.keys(obj).length!==0){return false;}if(typeof Object.getOwnPropertyNames==='function'&&Object.getOwnPropertyNames(obj).length!==0){return false;}var syms=Object.getOwnPropertySymbols(obj);if(syms.length!==1||syms[0]!==sym){return false;}if(!Object.prototype.propertyIsEnumerable.call(obj,sym)){return false;}if(typeof Object.getOwnPropertyDescriptor==='function'){var descriptor=Object.getOwnPropertyDescriptor(obj,sym);if(descriptor.value!==symVal||descriptor.enumerable!==true){return false;}}return true;};},{}],48:[function(require,module,exports){'use strict';var bind=require('function-bind');module.exports=bind.call(Function.call,Object.prototype.hasOwnProperty);},{"function-bind":43}],49:[function(require,module,exports){var http=require('http');var url=require('url');var https=module.exports;for(var key in http){if(http.hasOwnProperty(key))https[key]=http[key];}https.request=function(params,cb){params=validateParams(params);return http.request.call(this,params,cb);};https.get=function(params,cb){params=validateParams(params);return http.get.call(this,params,cb);};function validateParams(params){if(typeof params==='string'){params=url.parse(params);}if(!params.protocol){params.protocol='https:';}if(params.protocol!=='https:'){throw new Error('Protocol "'+params.protocol+'" not supported. Expected "https:"');}return params;}},{"http":83,"url":104}],50:[function(require,module,exports){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m;var eLen=nBytes*8-mLen-1;var eMax=(1<<eLen)-1;var eBias=eMax>>1;var nBits=-7;var i=isLE?nBytes-1:0;var d=isLE?-1:1;var s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8){}if(e===0){e=1-eBias;}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity;}else{m=m+Math.pow(2,mLen);e=e-eBias;}return(s?-1:1)*m*Math.pow(2,e-mLen);};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c;var eLen=nBytes*8-mLen-1;var eMax=(1<<eLen)-1;var eBias=eMax>>1;var rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0;var i=isLE?0:nBytes-1;var d=isLE?1:-1;var s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax;}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2;}if(e+eBias>=1){value+=rt/c;}else{value+=rt*Math.pow(2,1-eBias);}if(value*c>=2){e++;c/=2;}if(e+eBias>=eMax){m=0;e=eMax;}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias;}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0;}}for(;mLen>=8;buffer[offset+i]=m&0xff,i+=d,m/=256,mLen-=8){}e=e<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[offset+i]=e&0xff,i+=d,e/=256,eLen-=8){}buffer[offset+i-d]|=s*128;};},{}],51:[function(require,module,exports){if(typeof Object.create==='function'){// implementation from standard node.js 'util' module
|
|
533
775
|
module.exports=function inherits(ctor,superCtor){if(superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}});}};}else{// old school shim for old browsers
|
|
534
|
-
module.exports=function inherits(ctor,superCtor){if(superCtor){ctor.super_=superCtor;var TempCtor=function TempCtor(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor();ctor.prototype.constructor=ctor;}};}},{}],
|
|
535
|
-
/******/"use strict";/******/var __webpack_modules__={/***/165:/***/function _(__unused_webpack_module,exports){Object.defineProperty(exports,"__esModule",{value:true});exports.abs=void 0;function abs(n){if(typeof n=='number'||typeof n=='bigint')n=n.toString();if(n[0]=='-')return n.substring(1);return n;}exports.abs=abs;/***/},/***/217:/***/function _(__unused_webpack_module,exports){Object.defineProperty(exports,"__esModule",{value:true});exports.pad=exports.trim=exports.add=void 0;//function add {
|
|
536
|
-
function add(number1,number2){var _a;if(number2===void 0){number2="0";}var neg=0,ind=-1,neg_len;//check for negatives
|
|
537
|
-
if(number1[0]=='-'){number1=number1.substring(1);if(!testZero(number1)){neg++;ind=1;neg_len=number1.length;}}if(number2[0]=='-'){number2=number2.substring(1);if(!testZero(number2)){neg++;ind=2;neg_len=number2.length;}}number1=trim(number1);number2=trim(number2);_a=pad(trim(number1),trim(number2)),number1=_a[0],number2=_a[1];if(neg==1){if(ind===1)number1=compliment(number1);else if(ind===2)number2=compliment(number2);}var res=addCore(number1,number2);if(!neg)return trim(res);else if(neg==2)return'-'+trim(res);else{if(number1.length<res.length)return trim(res.substring(1));else return'-'+trim(compliment(res));}}exports.add=add;function compliment(number){if(testZero(number)){return number;}var s='',l=number.length,dec=number.split('.')[1],ld=dec?dec.length:0;for(var i=0;i<l;i++){if(number[i]>='0'&&number[i]<='9')s+=9-parseInt(number[i]);else s+=number[i];}var one=ld>0?'0.'+new Array(ld).join('0')+'1':'1';return addCore(s,one);}function trim(number){var parts=number.split('.');if(!parts[0])parts[0]='0';while(parts[0][0]=='0'&&parts[0].length>1)parts[0]=parts[0].substring(1);return parts[0]+(parts[1]?'.'+parts[1]:'');}exports.trim=trim;function pad(number1,number2){var parts1=number1.split('.'),parts2=number2.split('.');//pad integral part
|
|
538
|
-
var length1=parts1[0].length,length2=parts2[0].length;if(length1>length2){parts2[0]=new Array(Math.abs(length1-length2)+1).join('0')+(parts2[0]?parts2[0]:'');}else{parts1[0]=new Array(Math.abs(length1-length2)+1).join('0')+(parts1[0]?parts1[0]:'');}//pad fractional part
|
|
539
|
-
length1=parts1[1]?parts1[1].length:0,length2=parts2[1]?parts2[1].length:0;if(length1||length2){if(length1>length2){parts2[1]=(parts2[1]?parts2[1]:'')+new Array(Math.abs(length1-length2)+1).join('0');}else{parts1[1]=(parts1[1]?parts1[1]:'')+new Array(Math.abs(length1-length2)+1).join('0');}}number1=parts1[0]+(parts1[1]?'.'+parts1[1]:'');number2=parts2[0]+(parts2[1]?'.'+parts2[1]:'');return[number1,number2];}exports.pad=pad;function addCore(number1,number2){var _a;_a=pad(number1,number2),number1=_a[0],number2=_a[1];var sum='',carry=0;for(var i=number1.length-1;i>=0;i--){if(number1[i]==='.'){sum='.'+sum;continue;}var temp=parseInt(number1[i])+parseInt(number2[i])+carry;sum=temp%10+sum;carry=Math.floor(temp/10);}return carry?carry.toString()+sum:sum;}function testZero(number){return /^0[0]*[.]{0,1}[0]*$/.test(number);}/***/},/***/423:/***/function _(module,__unused_webpack_exports,__webpack_require__){var add_1=__webpack_require__(217);var abs_1=__webpack_require__(165);var round_1=__webpack_require__(350);var multiply_1=__webpack_require__(182);var divide_1=__webpack_require__(415);var modulus_1=__webpack_require__(213);var compareTo_1=__webpack_require__(664);var subtract_1=__webpack_require__(26);var roundingModes_1=__webpack_require__(916);var bigDecimal=/** @class */function(){function bigDecimal(number){if(number===void 0){number='0';}this.value=bigDecimal.validate(number);}bigDecimal.validate=function(number){if(number){number=number.toString();if(isNaN(number))throw Error("Parameter is not a number: "+number);if(number[0]=='+')number=number.substring(1);}else number='0';//handle missing leading zero
|
|
540
|
-
if(number.startsWith('.'))number='0'+number;else if(number.startsWith('-.'))number='-0'+number.substr(1);//handle exponentiation
|
|
541
|
-
if(/e/i.test(number)){var _a=number.split(/[eE]/),mantisa=_a[0],exponent=_a[1];mantisa=(0,add_1.trim)(mantisa);var sign='';if(mantisa[0]=='-'){sign='-';mantisa=mantisa.substring(1);}if(mantisa.indexOf('.')>=0){exponent=parseInt(exponent)+mantisa.indexOf('.');mantisa=mantisa.replace('.','');}else{exponent=parseInt(exponent)+mantisa.length;}if(mantisa.length<exponent){number=sign+mantisa+new Array(exponent-mantisa.length+1).join('0');}else if(mantisa.length>=exponent&&exponent>0){number=sign+(0,add_1.trim)(mantisa.substring(0,exponent))+(mantisa.length>exponent?'.'+mantisa.substring(exponent):'');}else{number=sign+'0.'+new Array(-exponent+1).join('0')+mantisa;}}return number;};bigDecimal.prototype.getValue=function(){return this.value;};bigDecimal.prototype.setValue=function(num){this.value=bigDecimal.validate(num);};bigDecimal.getPrettyValue=function(number,digits,separator){if(!(digits||separator)){digits=3;separator=',';}else if(!(digits&&separator)){throw Error('Illegal Arguments. Should pass both digits and separator or pass none');}number=bigDecimal.validate(number);var neg=number.charAt(0)=='-';if(neg)number=number.substring(1);var len=number.indexOf('.');len=len>0?len:number.length;var temp='';for(var i=len;i>0;){if(i<digits){digits=i;i=0;}else i-=digits;temp=number.substring(i,i+digits)+(i<len-digits&&i>=0?separator:'')+temp;}return(neg?'-':'')+temp+number.substring(len);};bigDecimal.prototype.getPrettyValue=function(digits,separator){return bigDecimal.getPrettyValue(this.value,digits,separator);};bigDecimal.round=function(number,precision,mode){if(precision===void 0){precision=0;}if(mode===void 0){mode=roundingModes_1.RoundingModes.HALF_EVEN;}number=bigDecimal.validate(number);// console.log(number)
|
|
542
|
-
if(isNaN(precision))throw Error("Precision is not a number: "+precision);return(0,round_1.roundOff)(number,precision,mode);};bigDecimal.prototype.round=function(precision,mode){if(precision===void 0){precision=0;}if(mode===void 0){mode=roundingModes_1.RoundingModes.HALF_EVEN;}if(isNaN(precision))throw Error("Precision is not a number: "+precision);return new bigDecimal((0,round_1.roundOff)(this.value,precision,mode));};bigDecimal.abs=function(number){number=bigDecimal.validate(number);return(0,abs_1.abs)(number);};bigDecimal.prototype.abs=function(){return new bigDecimal((0,abs_1.abs)(this.value));};bigDecimal.floor=function(number){number=bigDecimal.validate(number);if(number.indexOf('.')===-1)return number;return bigDecimal.round(number,0,roundingModes_1.RoundingModes.FLOOR);};bigDecimal.prototype.floor=function(){if(this.value.indexOf('.')===-1)return new bigDecimal(this.value);return new bigDecimal(this.value).round(0,roundingModes_1.RoundingModes.FLOOR);};bigDecimal.ceil=function(number){number=bigDecimal.validate(number);if(number.indexOf('.')===-1)return number;return bigDecimal.round(number,0,roundingModes_1.RoundingModes.CEILING);};bigDecimal.prototype.ceil=function(){if(this.value.indexOf('.')===-1)return new bigDecimal(this.value);return new bigDecimal(this.value).round(0,roundingModes_1.RoundingModes.CEILING);};bigDecimal.add=function(number1,number2){number1=bigDecimal.validate(number1);number2=bigDecimal.validate(number2);return(0,add_1.add)(number1,number2);};bigDecimal.prototype.add=function(number){return new bigDecimal((0,add_1.add)(this.value,number.getValue()));};bigDecimal.subtract=function(number1,number2){number1=bigDecimal.validate(number1);number2=bigDecimal.validate(number2);return(0,subtract_1.subtract)(number1,number2);};bigDecimal.prototype.subtract=function(number){return new bigDecimal((0,subtract_1.subtract)(this.value,number.getValue()));};bigDecimal.multiply=function(number1,number2){number1=bigDecimal.validate(number1);number2=bigDecimal.validate(number2);return(0,multiply_1.multiply)(number1,number2);};bigDecimal.prototype.multiply=function(number){return new bigDecimal((0,multiply_1.multiply)(this.value,number.getValue()));};bigDecimal.divide=function(number1,number2,precision){number1=bigDecimal.validate(number1);number2=bigDecimal.validate(number2);return(0,divide_1.divide)(number1,number2,precision);};bigDecimal.prototype.divide=function(number,precision){return new bigDecimal((0,divide_1.divide)(this.value,number.getValue(),precision));};bigDecimal.modulus=function(number1,number2){number1=bigDecimal.validate(number1);number2=bigDecimal.validate(number2);return(0,modulus_1.modulus)(number1,number2);};bigDecimal.prototype.modulus=function(number){return new bigDecimal((0,modulus_1.modulus)(this.value,number.getValue()));};bigDecimal.compareTo=function(number1,number2){number1=bigDecimal.validate(number1);number2=bigDecimal.validate(number2);return(0,compareTo_1.compareTo)(number1,number2);};bigDecimal.prototype.compareTo=function(number){return(0,compareTo_1.compareTo)(this.value,number.getValue());};bigDecimal.negate=function(number){number=bigDecimal.validate(number);return(0,subtract_1.negate)(number);};bigDecimal.prototype.negate=function(){return new bigDecimal((0,subtract_1.negate)(this.value));};bigDecimal.RoundingModes=roundingModes_1.RoundingModes;return bigDecimal;}();module.exports=bigDecimal;/***/},/***/664:/***/function _(__unused_webpack_module,exports,__webpack_require__){Object.defineProperty(exports,"__esModule",{value:true});exports.compareTo=void 0;var add_1=__webpack_require__(217);function compareTo(number1,number2){var _a;var negative=false;if(number1[0]=='-'&&number2[0]!="-"){return-1;}else if(number1[0]!='-'&&number2[0]=='-'){return 1;}else if(number1[0]=='-'&&number2[0]=='-'){number1=number1.substr(1);number2=number2.substr(1);negative=true;}_a=(0,add_1.pad)(number1,number2),number1=_a[0],number2=_a[1];if(number1.localeCompare(number2)==0){return 0;}for(var i=0;i<number1.length;i++){if(number1[i]==number2[i]){continue;}else if(number1[i]>number2[i]){if(negative){return-1;}else{return 1;}}else{if(negative){return 1;}else{return-1;}}}return 0;}exports.compareTo=compareTo;/***/},/***/415:/***/function _(__unused_webpack_module,exports,__webpack_require__){Object.defineProperty(exports,"__esModule",{value:true});exports.divide=void 0;var add_1=__webpack_require__(217);var round_1=__webpack_require__(350);function divide(dividend,divisor,precission){if(precission===void 0){precission=8;}if(divisor==0){throw new Error('Cannot divide by 0');}dividend=dividend.toString();divisor=divisor.toString();// remove trailing zeros in decimal ISSUE#18
|
|
543
|
-
dividend=dividend.replace(/(\.\d*?[1-9])0+$/g,"$1").replace(/\.0+$/,"");divisor=divisor.replace(/(\.\d*?[1-9])0+$/g,"$1").replace(/\.0+$/,"");if(dividend==0)return'0';var neg=0;if(divisor[0]=='-'){divisor=divisor.substring(1);neg++;}if(dividend[0]=='-'){dividend=dividend.substring(1);neg++;}var pt_dvsr=divisor.indexOf('.')>0?divisor.length-divisor.indexOf('.')-1:-1;divisor=(0,add_1.trim)(divisor.replace('.',''));if(pt_dvsr>=0){var pt_dvnd=dividend.indexOf('.')>0?dividend.length-dividend.indexOf('.')-1:-1;if(pt_dvnd==-1){dividend=(0,add_1.trim)(dividend+new Array(pt_dvsr+1).join('0'));}else{if(pt_dvsr>pt_dvnd){dividend=dividend.replace('.','');dividend=(0,add_1.trim)(dividend+new Array(pt_dvsr-pt_dvnd+1).join('0'));}else if(pt_dvsr<pt_dvnd){dividend=dividend.replace('.','');var loc=dividend.length-pt_dvnd+pt_dvsr;dividend=(0,add_1.trim)(dividend.substring(0,loc)+'.'+dividend.substring(loc));}else if(pt_dvsr==pt_dvnd){dividend=(0,add_1.trim)(dividend.replace('.',''));}}}var prec=0,dl=divisor.length,rem='0',quotent='';var dvnd=dividend.indexOf('.')>-1&÷nd.indexOf('.')<dl?dividend.substring(0,dl+1):dividend.substring(0,dl);dividend=dividend.indexOf('.')>-1&÷nd.indexOf('.')<dl?dividend.substring(dl+1):dividend.substring(dl);if(dvnd.indexOf('.')>-1){var shift=dvnd.length-dvnd.indexOf('.')-1;dvnd=dvnd.replace('.','');if(dl>dvnd.length){shift+=dl-dvnd.length;dvnd=dvnd+new Array(dl-dvnd.length+1).join('0');}prec=shift;quotent='0.'+new Array(shift).join('0');}precission=precission+2;while(prec<=precission){var qt=0;while(parseInt(dvnd)>=parseInt(divisor)){dvnd=(0,add_1.add)(dvnd,'-'+divisor);qt++;}quotent+=qt;if(!dividend){if(!prec)quotent+='.';prec++;dvnd=dvnd+'0';}else{if(dividend[0]=='.'){quotent+='.';prec++;dividend=dividend.substring(1);}dvnd=dvnd+dividend.substring(0,1);dividend=dividend.substring(1);}}return(neg==1?'-':'')+(0,add_1.trim)((0,round_1.roundOff)(quotent,precission-2));}exports.divide=divide;/***/},/***/213:/***/function _(__unused_webpack_module,exports,__webpack_require__){Object.defineProperty(exports,"__esModule",{value:true});exports.modulus=void 0;var divide_1=__webpack_require__(415);var round_1=__webpack_require__(350);var multiply_1=__webpack_require__(182);var subtract_1=__webpack_require__(26);var roundingModes_1=__webpack_require__(916);function modulus(dividend,divisor){if(divisor==0){throw new Error('Cannot divide by 0');}dividend=dividend.toString();divisor=divisor.toString();validate(dividend);validate(divisor);var sign='';if(dividend[0]=='-'){sign='-';dividend=dividend.substr(1);}if(divisor[0]=='-'){divisor=divisor.substr(1);}var result=(0,subtract_1.subtract)(dividend,(0,multiply_1.multiply)(divisor,(0,round_1.roundOff)((0,divide_1.divide)(dividend,divisor),0,roundingModes_1.RoundingModes.FLOOR)));return sign+result;}exports.modulus=modulus;function validate(oparand){if(oparand.indexOf('.')!=-1){throw new Error('Modulus of non-integers not supported');}}/***/},/***/182:/***/function _(__unused_webpack_module,exports){Object.defineProperty(exports,"__esModule",{value:true});exports.multiply=void 0;function multiply(number1,number2){number1=number1.toString();number2=number2.toString();/*Filter numbers*/var negative=0;if(number1[0]=='-'){negative++;number1=number1.substr(1);}if(number2[0]=='-'){negative++;number2=number2.substr(1);}number1=trailZero(number1);number2=trailZero(number2);var decimalLength1=0;var decimalLength2=0;if(number1.indexOf('.')!=-1){decimalLength1=number1.length-number1.indexOf('.')-1;}if(number2.indexOf('.')!=-1){decimalLength2=number2.length-number2.indexOf('.')-1;}var decimalLength=decimalLength1+decimalLength2;number1=trailZero(number1.replace('.',''));number2=trailZero(number2.replace('.',''));if(number1.length<number2.length){var temp=number1;number1=number2;number2=temp;}if(number2=='0'){return'0';}/*
|
|
544
|
-
* Core multiplication
|
|
545
|
-
*/var length=number2.length;var carry=0;var positionVector=[];var currentPosition=length-1;var result="";for(var i=0;i<length;i++){positionVector[i]=number1.length-1;}for(var i=0;i<2*number1.length;i++){var sum=0;for(var j=number2.length-1;j>=currentPosition&&j>=0;j--){if(positionVector[j]>-1&&positionVector[j]<number1.length){sum+=parseInt(number1[positionVector[j]--])*parseInt(number2[j]);}}sum+=carry;carry=Math.floor(sum/10);result=sum%10+result;currentPosition--;}/*
|
|
546
|
-
* Formatting result
|
|
547
|
-
*/result=trailZero(adjustDecimal(result,decimalLength));if(negative==1){result='-'+result;}return result;}exports.multiply=multiply;/*
|
|
548
|
-
* Add decimal point
|
|
549
|
-
*/function adjustDecimal(number,decimal){if(decimal==0)return number;else{number=decimal>=number.length?new Array(decimal-number.length+1).join('0')+number:number;return number.substr(0,number.length-decimal)+'.'+number.substr(number.length-decimal,decimal);}}/*
|
|
550
|
-
* Removes zero from front and back*/function trailZero(number){while(number[0]=='0'){number=number.substr(1);}if(number.indexOf('.')!=-1){while(number[number.length-1]=='0'){number=number.substr(0,number.length-1);}}if(number==""||number=="."){number='0';}else if(number[number.length-1]=='.'){number=number.substr(0,number.length-1);}if(number[0]=='.'){number='0'+number;}return number;}/***/},/***/350:/***/function _(__unused_webpack_module,exports,__webpack_require__){Object.defineProperty(exports,"__esModule",{value:true});exports.roundOff=void 0;var roundingModes_1=__webpack_require__(916);/**
|
|
551
|
-
*
|
|
552
|
-
* @param input the number to round
|
|
553
|
-
* @param n precision
|
|
554
|
-
* @param mode Rounding Mode
|
|
555
|
-
*/function roundOff(input,n,mode){if(n===void 0){n=0;}if(mode===void 0){mode=roundingModes_1.RoundingModes.HALF_EVEN;}if(mode===roundingModes_1.RoundingModes.UNNECESSARY){throw new Error("UNNECESSARY Rounding Mode has not yet been implemented");}if(typeof input=='number'||typeof input=='bigint')input=input.toString();var neg=false;if(input[0]==='-'){neg=true;input=input.substring(1);}var parts=input.split('.'),partInt=parts[0],partDec=parts[1];//handle case of -ve n: roundOff(12564,-2)=12600
|
|
556
|
-
if(n<0){n=-n;if(partInt.length<=n)return'0';else{var prefix=partInt.substr(0,partInt.length-n);input=prefix+'.'+partInt.substr(partInt.length-n)+partDec;prefix=roundOff(input,0,mode);return(neg?'-':'')+prefix+new Array(n+1).join('0');}}// handle case when integer output is desired
|
|
557
|
-
if(n==0){var l=partInt.length;if(greaterThanFive(parts[1],partInt,neg,mode)){partInt=increment(partInt);}return(neg&&parseInt(partInt)?'-':'')+partInt;}// handle case when n>0
|
|
558
|
-
if(!parts[1]){return(neg?'-':'')+partInt+'.'+new Array(n+1).join('0');}else if(parts[1].length<n){return(neg?'-':'')+partInt+'.'+parts[1]+new Array(n-parts[1].length+1).join('0');}partDec=parts[1].substring(0,n);var rem=parts[1].substring(n);if(rem&&greaterThanFive(rem,partDec,neg,mode)){partDec=increment(partDec);if(partDec.length>n){return(neg?'-':'')+increment(partInt,parseInt(partDec[0]))+'.'+partDec.substring(1);}}return(neg&&(parseInt(partInt)||parseInt(partDec))?'-':'')+partInt+'.'+partDec;}exports.roundOff=roundOff;function greaterThanFive(part,pre,neg,mode){if(!part||part===new Array(part.length+1).join('0'))return false;// #region UP, DOWN, CEILING, FLOOR
|
|
559
|
-
if(mode===roundingModes_1.RoundingModes.DOWN||!neg&&mode===roundingModes_1.RoundingModes.FLOOR||neg&&mode===roundingModes_1.RoundingModes.CEILING)return false;if(mode===roundingModes_1.RoundingModes.UP||neg&&mode===roundingModes_1.RoundingModes.FLOOR||!neg&&mode===roundingModes_1.RoundingModes.CEILING)return true;// #endregion
|
|
560
|
-
// case when part !== five
|
|
561
|
-
var five='5'+new Array(part.length).join('0');if(part>five)return true;else if(part<five)return false;// case when part === five
|
|
562
|
-
switch(mode){case roundingModes_1.RoundingModes.HALF_DOWN:return false;case roundingModes_1.RoundingModes.HALF_UP:return true;case roundingModes_1.RoundingModes.HALF_EVEN:default:return parseInt(pre[pre.length-1])%2==1;}}function increment(part,c){if(c===void 0){c=0;}if(!c)c=1;if(typeof part=='number')part.toString();var l=part.length-1,s='';for(var i=l;i>=0;i--){var x=parseInt(part[i])+c;if(x==10){c=1;x=0;}else{c=0;}s+=x;}if(c)s+=c;return s.split('').reverse().join('');}/***/},/***/916:/***/function _(__unused_webpack_module,exports){Object.defineProperty(exports,"__esModule",{value:true});exports.RoundingModes=void 0;var RoundingModes;(function(RoundingModes){/**
|
|
563
|
-
* Rounding mode to round towards positive infinity.
|
|
564
|
-
*/RoundingModes[RoundingModes["CEILING"]=0]="CEILING";/**
|
|
565
|
-
* Rounding mode to round towards zero.
|
|
566
|
-
*/RoundingModes[RoundingModes["DOWN"]=1]="DOWN";/**
|
|
567
|
-
* Rounding mode to round towards negative infinity.
|
|
568
|
-
*/RoundingModes[RoundingModes["FLOOR"]=2]="FLOOR";/**
|
|
569
|
-
* Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant,
|
|
570
|
-
* in which case round down.
|
|
571
|
-
*/RoundingModes[RoundingModes["HALF_DOWN"]=3]="HALF_DOWN";/**
|
|
572
|
-
* Rounding mode to round towards the "nearest neighbor" unless both neighbors are equidistant,
|
|
573
|
-
* in which case, round towards the even neighbor.
|
|
574
|
-
*/RoundingModes[RoundingModes["HALF_EVEN"]=4]="HALF_EVEN";/**
|
|
575
|
-
* Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant,
|
|
576
|
-
* in which case round up.
|
|
577
|
-
*/RoundingModes[RoundingModes["HALF_UP"]=5]="HALF_UP";/**
|
|
578
|
-
* Rounding mode to assert that the requested operation has an exact result, hence no rounding is necessary.
|
|
579
|
-
* UNIMPLEMENTED
|
|
580
|
-
*/RoundingModes[RoundingModes["UNNECESSARY"]=6]="UNNECESSARY";/**
|
|
581
|
-
* Rounding mode to round away from zero.
|
|
582
|
-
*/RoundingModes[RoundingModes["UP"]=7]="UP";})(RoundingModes=exports.RoundingModes||(exports.RoundingModes={}));/***/},/***/26:/***/function _(__unused_webpack_module,exports,__webpack_require__){Object.defineProperty(exports,"__esModule",{value:true});exports.negate=exports.subtract=void 0;var add_1=__webpack_require__(217);function subtract(number1,number2){number1=number1.toString();number2=number2.toString();number2=negate(number2);return(0,add_1.add)(number1,number2);}exports.subtract=subtract;function negate(number){if(number[0]=='-'){number=number.substr(1);}else{number='-'+number;}return number;}exports.negate=negate;/***/}/******/};/************************************************************************/ /******/ // The module cache
|
|
583
|
-
/******/var __webpack_module_cache__={};/******/ /******/ // The require function
|
|
584
|
-
/******/function __webpack_require__(moduleId){/******/ // Check if module is in cache
|
|
585
|
-
/******/var cachedModule=__webpack_module_cache__[moduleId];/******/if(cachedModule!==undefined){/******/return cachedModule.exports;/******/}/******/ // Create a new module (and put it into the cache)
|
|
586
|
-
/******/var module=__webpack_module_cache__[moduleId]={/******/ // no module.id needed
|
|
587
|
-
/******/ // no module.loaded needed
|
|
588
|
-
/******/exports:{}/******/};/******/ /******/ // Execute the module function
|
|
589
|
-
/******/__webpack_modules__[moduleId](module,module.exports,__webpack_require__);/******/ /******/ // Return the exports of the module
|
|
590
|
-
/******/return module.exports;/******/}/******/ /************************************************************************/ /******/ /******/ // startup
|
|
591
|
-
/******/ // Load entry module and return exports
|
|
592
|
-
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
593
|
-
/******/var __webpack_exports__=__webpack_require__(423);/******/ /******/return __webpack_exports__;/******/}());});}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],52:[function(require,module,exports){// When a boxed property is passed in, it should have quotes of some
|
|
776
|
+
module.exports=function inherits(ctor,superCtor){if(superCtor){ctor.super_=superCtor;var TempCtor=function TempCtor(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor();ctor.prototype.constructor=ctor;}};}},{}],52:[function(require,module,exports){// When a boxed property is passed in, it should have quotes of some
|
|
594
777
|
// kind around it.
|
|
595
778
|
//
|
|
596
779
|
// For instance:
|
|
@@ -622,12 +805,12 @@ var cleanWrapCharacters=function cleanWrapCharacters(pCharacter,pString){if(pStr
|
|
|
622
805
|
*
|
|
623
806
|
* @class ManyfestHashTranslation
|
|
624
807
|
*/var ManyfestHashTranslation=/*#__PURE__*/function(){function ManyfestHashTranslation(pInfoLog,pErrorLog){_classCallCheck2(this,ManyfestHashTranslation);// Wire in logging
|
|
625
|
-
this.logInfo=typeof pInfoLog==='function'?pInfoLog:libSimpleLog;this.logError=typeof pErrorLog==='function'?pErrorLog:libSimpleLog;this.translationTable={};}_createClass2(ManyfestHashTranslation,[{key:"translationCount",value:function translationCount(){return Object.keys(this.translationTable).length;}},{key:"addTranslation",value:function addTranslation(pTranslation){var
|
|
808
|
+
this.logInfo=typeof pInfoLog==='function'?pInfoLog:libSimpleLog;this.logError=typeof pErrorLog==='function'?pErrorLog:libSimpleLog;this.translationTable={};}_createClass2(ManyfestHashTranslation,[{key:"translationCount",value:function translationCount(){return Object.keys(this.translationTable).length;}},{key:"addTranslation",value:function addTranslation(pTranslation){var _this13=this;// This adds a translation in the form of:
|
|
626
809
|
// { "SourceHash": "DestinationHash", "SecondSourceHash":"SecondDestinationHash" }
|
|
627
|
-
if(_typeof(pTranslation)!='object'){this.logError("Hash translation addTranslation expected a translation be type object but was passed in ".concat(_typeof(pTranslation)));return false;}var tmpTranslationSources=Object.keys(pTranslation);tmpTranslationSources.forEach(function(pTranslationSource){if(typeof pTranslation[pTranslationSource]!='string'){
|
|
810
|
+
if(_typeof(pTranslation)!='object'){this.logError("Hash translation addTranslation expected a translation be type object but was passed in ".concat(_typeof(pTranslation)));return false;}var tmpTranslationSources=Object.keys(pTranslation);tmpTranslationSources.forEach(function(pTranslationSource){if(typeof pTranslation[pTranslationSource]!='string'){_this13.logError("Hash translation addTranslation expected a translation destination hash for [".concat(pTranslationSource,"] to be a string but the referrant was a ").concat(_typeof(pTranslation[pTranslationSource])));}else{_this13.translationTable[pTranslationSource]=pTranslation[pTranslationSource];}});}},{key:"removeTranslationHash",value:function removeTranslationHash(pTranslationHash){if(this.translationTable.hasOwnProperty(pTranslationHash)){delete this.translationTable[pTranslationHash];}}// This removes translations.
|
|
628
811
|
// If passed a string, just removes the single one.
|
|
629
812
|
// If passed an object, it does all the source keys.
|
|
630
|
-
},{key:"removeTranslation",value:function removeTranslation(pTranslation){var
|
|
813
|
+
},{key:"removeTranslation",value:function removeTranslation(pTranslation){var _this14=this;if(typeof pTranslation=='string'){this.removeTranslationHash(pTranslation);return true;}else if(_typeof(pTranslation)=='object'){var tmpTranslationSources=Object.keys(pTranslation);tmpTranslationSources.forEach(function(pTranslationSource){_this14.removeTranslation(pTranslationSource);});return true;}else{this.logError("Hash translation removeTranslation expected either a string or an object but the passed-in translation was type ".concat(_typeof(pTranslation)));return false;}}},{key:"clearTranslations",value:function clearTranslations(){this.translationTable={};}},{key:"translate",value:function translate(pTranslation){if(this.translationTable.hasOwnProperty(pTranslation)){return this.translationTable[pTranslation];}else{return pTranslation;}}}]);return ManyfestHashTranslation;}();module.exports=ManyfestHashTranslation;},{"./Manyfest-LogToConsole.js":54}],54:[function(require,module,exports){/**
|
|
631
814
|
* @author <steven@velozo.com>
|
|
632
815
|
*/ /**
|
|
633
816
|
* Manyfest simple logging shim (for browser and dependency-free running)
|
|
@@ -1175,9 +1358,9 @@ var tmpDescriptorAddresses=Object.keys(tmpSource);tmpDescriptorAddresses.forEach
|
|
|
1175
1358
|
* Manyfest object address-based descriptions and manipulations.
|
|
1176
1359
|
*
|
|
1177
1360
|
* @class Manyfest
|
|
1178
|
-
*/var Manyfest=/*#__PURE__*/function(
|
|
1179
|
-
|
|
1180
|
-
|
|
1361
|
+
*/var Manyfest=/*#__PURE__*/function(_libFableServiceProvi6){_inherits(Manyfest,_libFableServiceProvi6);var _super8=_createSuper(Manyfest);function Manyfest(pFable,pManifest,pServiceHash){var _this15;_classCallCheck2(this,Manyfest);if(pFable===undefined){_this15=_super8.call(this,{});}else{_this15=_super8.call(this,pFable,pManifest,pServiceHash);}_this15.serviceType='Manifest';// Wire in logging
|
|
1362
|
+
_this15.logInfo=libSimpleLog;_this15.logError=libSimpleLog;// Create an object address resolver and map in the functions
|
|
1363
|
+
_this15.objectAddressCheckAddressExists=new libObjectAddressCheckAddressExists(_this15.logInfo,_this15.logError);_this15.objectAddressGetValue=new libObjectAddressGetValue(_this15.logInfo,_this15.logError);_this15.objectAddressSetValue=new libObjectAddressSetValue(_this15.logInfo,_this15.logError);_this15.objectAddressDeleteValue=new libObjectAddressDeleteValue(_this15.logInfo,_this15.logError);if(!_this15.options.hasOwnProperty('defaultValues')){_this15.options.defaultValues={"String":"","Number":0,"Float":0.0,"Integer":0,"Boolean":false,"Binary":0,"DateTime":0,"Array":[],"Object":{},"Null":null};}if(!_this15.options.hasOwnProperty('strict')){_this15.options.strict=false;}_this15.scope=undefined;_this15.elementAddresses=undefined;_this15.elementHashes=undefined;_this15.elementDescriptors=undefined;_this15.reset();if(_typeof(_this15.options)==='object'){_this15.loadManifest(_this15.options);}_this15.schemaManipulations=new libSchemaManipulation(_this15.logInfo,_this15.logError);_this15.objectAddressGeneration=new libObjectAddressGeneration(_this15.logInfo,_this15.logError);_this15.hashTranslations=new libHashTranslation(_this15.logInfo,_this15.logError);return _possibleConstructorReturn(_this15);}/*************************************************************************
|
|
1181
1364
|
* Schema Manifest Loading, Reading, Manipulation and Serialization Functions
|
|
1182
1365
|
*/ // Reset critical manifest properties
|
|
1183
1366
|
_createClass2(Manyfest,[{key:"reset",value:function reset(){this.scope='DEFAULT';this.elementAddresses=[];this.elementHashes={};this.elementDescriptors={};}},{key:"clone",value:function clone(){// Make a copy of the options in-place
|
|
@@ -1228,13 +1411,13 @@ return null;}}}// Enumerate through the schema and populate default values if th
|
|
|
1228
1411
|
},{key:"populateDefaults",value:function populateDefaults(pObject,pOverwriteProperties){return this.populateObject(pObject,pOverwriteProperties,// This just sets up a simple filter to see if there is a default set.
|
|
1229
1412
|
function(pDescriptor){return pDescriptor.hasOwnProperty('Default');});}// Forcefully populate all values even if they don't have defaults.
|
|
1230
1413
|
// Based on type, this can do unexpected things.
|
|
1231
|
-
},{key:"populateObject",value:function populateObject(pObject,pOverwriteProperties,fFilter){var
|
|
1414
|
+
},{key:"populateObject",value:function populateObject(pObject,pOverwriteProperties,fFilter){var _this16=this;// Automatically create an object if one isn't passed in.
|
|
1232
1415
|
var tmpObject=_typeof(pObject)==='object'?pObject:{};// Default to *NOT OVERWRITING* properties
|
|
1233
1416
|
var tmpOverwriteProperties=typeof pOverwriteProperties=='undefined'?false:pOverwriteProperties;// This is a filter function, which is passed the schema and allows complex filtering of population
|
|
1234
1417
|
// The default filter function just returns true, populating everything.
|
|
1235
|
-
var tmpFilterFunction=typeof fFilter=='function'?fFilter:function(pDescriptor){return true;};this.elementAddresses.forEach(function(pAddress){var tmpDescriptor=
|
|
1418
|
+
var tmpFilterFunction=typeof fFilter=='function'?fFilter:function(pDescriptor){return true;};this.elementAddresses.forEach(function(pAddress){var tmpDescriptor=_this16.getDescriptor(pAddress);// Check the filter function to see if this is an address we want to set the value for.
|
|
1236
1419
|
if(tmpFilterFunction(tmpDescriptor)){// If we are overwriting properties OR the property does not exist
|
|
1237
|
-
if(tmpOverwriteProperties||!
|
|
1420
|
+
if(tmpOverwriteProperties||!_this16.checkAddressExists(tmpObject,pAddress)){_this16.setValueAtAddress(tmpObject,pAddress,_this16.getDefaultValue(tmpDescriptor));}}});return tmpObject;}}]);return Manyfest;}(libFableServiceProviderBase);;module.exports=Manyfest;},{"./Manyfest-HashTranslation.js":53,"./Manyfest-LogToConsole.js":54,"./Manyfest-ObjectAddress-CheckAddressExists.js":55,"./Manyfest-ObjectAddress-DeleteValue.js":56,"./Manyfest-ObjectAddress-GetValue.js":57,"./Manyfest-ObjectAddress-SetValue.js":58,"./Manyfest-ObjectAddressGeneration.js":59,"./Manyfest-SchemaManipulation.js":61,"fable-serviceproviderbase":36}],63:[function(require,module,exports){var hasMap=typeof Map==='function'&&Map.prototype;var mapSizeDescriptor=Object.getOwnPropertyDescriptor&&hasMap?Object.getOwnPropertyDescriptor(Map.prototype,'size'):null;var mapSize=hasMap&&mapSizeDescriptor&&typeof mapSizeDescriptor.get==='function'?mapSizeDescriptor.get:null;var mapForEach=hasMap&&Map.prototype.forEach;var hasSet=typeof Set==='function'&&Set.prototype;var setSizeDescriptor=Object.getOwnPropertyDescriptor&&hasSet?Object.getOwnPropertyDescriptor(Set.prototype,'size'):null;var setSize=hasSet&&setSizeDescriptor&&typeof setSizeDescriptor.get==='function'?setSizeDescriptor.get:null;var setForEach=hasSet&&Set.prototype.forEach;var hasWeakMap=typeof WeakMap==='function'&&WeakMap.prototype;var weakMapHas=hasWeakMap?WeakMap.prototype.has:null;var hasWeakSet=typeof WeakSet==='function'&&WeakSet.prototype;var weakSetHas=hasWeakSet?WeakSet.prototype.has:null;var hasWeakRef=typeof WeakRef==='function'&&WeakRef.prototype;var weakRefDeref=hasWeakRef?WeakRef.prototype.deref:null;var booleanValueOf=Boolean.prototype.valueOf;var objectToString=Object.prototype.toString;var functionToString=Function.prototype.toString;var $match=String.prototype.match;var $slice=String.prototype.slice;var $replace=String.prototype.replace;var $toUpperCase=String.prototype.toUpperCase;var $toLowerCase=String.prototype.toLowerCase;var $test=RegExp.prototype.test;var $concat=Array.prototype.concat;var $join=Array.prototype.join;var $arrSlice=Array.prototype.slice;var $floor=Math.floor;var bigIntValueOf=typeof BigInt==='function'?BigInt.prototype.valueOf:null;var gOPS=Object.getOwnPropertySymbols;var symToString=typeof Symbol==='function'&&_typeof(Symbol.iterator)==='symbol'?Symbol.prototype.toString:null;var hasShammedSymbols=typeof Symbol==='function'&&_typeof(Symbol.iterator)==='object';// ie, `has-tostringtag/shams
|
|
1238
1421
|
var toStringTag=typeof Symbol==='function'&&Symbol.toStringTag&&(_typeof(Symbol.toStringTag)===hasShammedSymbols?'object':'symbol')?Symbol.toStringTag:null;var isEnumerable=Object.prototype.propertyIsEnumerable;var gPO=(typeof Reflect==='function'?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype// eslint-disable-line no-proto
|
|
1239
1422
|
?function(O){return O.__proto__;// eslint-disable-line no-proto
|
|
1240
1423
|
}:null);function addNumericSeparator(num,str){if(num===Infinity||num===-Infinity||num!==num||num&&num>-1000&&num<1000||$test.call(/e/,str)){return str;}var sepRegex=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof num==='number'){var _int=num<0?-$floor(-num):$floor(num);// trunc(num)
|
|
@@ -1250,7 +1433,7 @@ if(!has(obj,key)){continue;}// eslint-disable-line no-restricted-syntax, no-cont
|
|
|
1250
1433
|
if(isArr&&String(Number(key))===key&&key<obj.length){continue;}// eslint-disable-line no-restricted-syntax, no-continue
|
|
1251
1434
|
if(hasShammedSymbols&&symMap['$'+key]instanceof Symbol){// this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section
|
|
1252
1435
|
continue;// eslint-disable-line no-restricted-syntax, no-continue
|
|
1253
|
-
}else if($test.call(/[^\w$]/,key)){xs.push(inspect(key,obj)+': '+inspect(obj[key],obj));}else{xs.push(key+': '+inspect(obj[key],obj));}}if(typeof gOPS==='function'){for(var j=0;j<syms.length;j++){if(isEnumerable.call(obj,syms[j])){xs.push('['+inspect(syms[j])+']: '+inspect(obj[syms[j]],obj));}}}return xs;}},{"./util.inspect":
|
|
1436
|
+
}else if($test.call(/[^\w$]/,key)){xs.push(inspect(key,obj)+': '+inspect(obj[key],obj));}else{xs.push(key+': '+inspect(obj[key],obj));}}if(typeof gOPS==='function'){for(var j=0;j<syms.length;j++){if(isEnumerable.call(obj,syms[j])){xs.push('['+inspect(syms[j])+']: '+inspect(obj[syms[j]],obj));}}}return xs;}},{"./util.inspect":18}],64:[function(require,module,exports){var wrappy=require('wrappy');module.exports=wrappy(once);module.exports.strict=wrappy(onceStrict);once.proto=once(function(){Object.defineProperty(Function.prototype,'once',{value:function value(){return once(this);},configurable:true});Object.defineProperty(Function.prototype,'onceStrict',{value:function value(){return onceStrict(this);},configurable:true});});function once(fn){var f=function f(){if(f.called)return f.value;f.called=true;return f.value=fn.apply(this,arguments);};f.called=false;return f;}function onceStrict(fn){var f=function f(){if(f.called)throw new Error(f.onceError);f.called=true;return f.value=fn.apply(this,arguments);};var name=fn.name||'Function wrapped with `once`';f.onceError=name+" shouldn't be called more than once";f.called=false;return f;}},{"wrappy":106}],65:[function(require,module,exports){(function(process){(function(){// 'path' module extracted from Node.js v8.11.1 (only the posix part)
|
|
1254
1437
|
// transplited with Babel
|
|
1255
1438
|
// Copyright Joyent, Inc. and other Node contributors.
|
|
1256
1439
|
//
|
|
@@ -1692,7 +1875,7 @@ if(maxKeys>0&&len>maxKeys){len=maxKeys;}for(var i=0;i<len;++i){var x=qs[i].repla
|
|
|
1692
1875
|
'use strict';var stringifyPrimitive=function stringifyPrimitive(v){switch(_typeof(v)){case'string':return v;case'boolean':return v?'true':'false';case'number':return isFinite(v)?v:'';default:return'';}};module.exports=function(obj,sep,eq,name){sep=sep||'&';eq=eq||'=';if(obj===null){obj=undefined;}if(_typeof(obj)==='object'){return map(objectKeys(obj),function(k){var ks=encodeURIComponent(stringifyPrimitive(k))+eq;if(isArray(obj[k])){return map(obj[k],function(v){return ks+encodeURIComponent(stringifyPrimitive(v));}).join(sep);}else{return ks+encodeURIComponent(stringifyPrimitive(obj[k]));}}).join(sep);}if(!name)return'';return encodeURIComponent(stringifyPrimitive(name))+eq+encodeURIComponent(stringifyPrimitive(obj));};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==='[object Array]';};function map(xs,f){if(xs.map)return xs.map(f);var res=[];for(var i=0;i<xs.length;i++){res.push(f(xs[i],i));}return res;}var objectKeys=Object.keys||function(obj){var res=[];for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))res.push(key);}return res;};},{}],78:[function(require,module,exports){'use strict';exports.decode=exports.parse=require('./decode');exports.encode=exports.stringify=require('./encode');},{"./decode":76,"./encode":77}],79:[function(require,module,exports){/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */ /* eslint-disable node/no-deprecated-api */var buffer=require('buffer');var Buffer=buffer.Buffer;// alternative to using Object.keys for old browsers
|
|
1693
1876
|
function copyProps(src,dst){for(var key in src){dst[key]=src[key];}}if(Buffer.from&&Buffer.alloc&&Buffer.allocUnsafe&&Buffer.allocUnsafeSlow){module.exports=buffer;}else{// Copy properties from require('buffer')
|
|
1694
1877
|
copyProps(buffer,exports);exports.Buffer=SafeBuffer;}function SafeBuffer(arg,encodingOrOffset,length){return Buffer(arg,encodingOrOffset,length);}SafeBuffer.prototype=Object.create(Buffer.prototype);// Copy static methods from Buffer
|
|
1695
|
-
copyProps(Buffer,SafeBuffer);SafeBuffer.from=function(arg,encodingOrOffset,length){if(typeof arg==='number'){throw new TypeError('Argument must not be a number');}return Buffer(arg,encodingOrOffset,length);};SafeBuffer.alloc=function(size,fill,encoding){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}var buf=Buffer(size);if(fill!==undefined){if(typeof encoding==='string'){buf.fill(fill,encoding);}else{buf.fill(fill);}}else{buf.fill(0);}return buf;};SafeBuffer.allocUnsafe=function(size){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}return Buffer(size);};SafeBuffer.allocUnsafeSlow=function(size){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}return buffer.SlowBuffer(size);};},{"buffer":
|
|
1878
|
+
copyProps(Buffer,SafeBuffer);SafeBuffer.from=function(arg,encodingOrOffset,length){if(typeof arg==='number'){throw new TypeError('Argument must not be a number');}return Buffer(arg,encodingOrOffset,length);};SafeBuffer.alloc=function(size,fill,encoding){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}var buf=Buffer(size);if(fill!==undefined){if(typeof encoding==='string'){buf.fill(fill,encoding);}else{buf.fill(fill);}}else{buf.fill(0);}return buf;};SafeBuffer.allocUnsafe=function(size){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}return Buffer(size);};SafeBuffer.allocUnsafeSlow=function(size){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}return buffer.SlowBuffer(size);};},{"buffer":20}],80:[function(require,module,exports){'use strict';var GetIntrinsic=require('get-intrinsic');var callBound=require('call-bind/callBound');var inspect=require('object-inspect');var $TypeError=GetIntrinsic('%TypeError%');var $WeakMap=GetIntrinsic('%WeakMap%',true);var $Map=GetIntrinsic('%Map%',true);var $weakMapGet=callBound('WeakMap.prototype.get',true);var $weakMapSet=callBound('WeakMap.prototype.set',true);var $weakMapHas=callBound('WeakMap.prototype.has',true);var $mapGet=callBound('Map.prototype.get',true);var $mapSet=callBound('Map.prototype.set',true);var $mapHas=callBound('Map.prototype.has',true);/*
|
|
1696
1879
|
* This function traverses the list returning the node corresponding to the
|
|
1697
1880
|
* given key.
|
|
1698
1881
|
*
|
|
@@ -1710,7 +1893,7 @@ return listHas($o,key);}}return false;},set:function set(key,value){if($WeakMap&
|
|
|
1710
1893
|
* Initialize the linked list as an empty node, so that we don't have
|
|
1711
1894
|
* to special-case handling of the first node: we can always refer to
|
|
1712
1895
|
* it as (previous node).next, instead of something like (list).head
|
|
1713
|
-
*/$o={key:{},next:null};}listSet($o,key,value);}}};return channel;};},{"call-bind/callBound":
|
|
1896
|
+
*/$o={key:{},next:null};}listSet($o,key,value);}}};return channel;};},{"call-bind/callBound":25,"get-intrinsic":44,"object-inspect":63}],81:[function(require,module,exports){(function(Buffer){(function(){/*! simple-concat. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */module.exports=function(stream,cb){var chunks=[];stream.on('data',function(chunk){chunks.push(chunk);});stream.once('end',function(){if(cb)cb(null,Buffer.concat(chunks));cb=null;});stream.once('error',function(err){if(cb)cb(err);cb=null;});};}).call(this);}).call(this,require("buffer").Buffer);},{"buffer":20}],82:[function(require,module,exports){(function(Buffer){(function(){/*! simple-get. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */module.exports=simpleGet;var concat=require('simple-concat');var decompressResponse=require('decompress-response');// excluded from browser build
|
|
1714
1897
|
var http=require('http');var https=require('https');var once=require('once');var querystring=require('querystring');var url=require('url');var isStream=function isStream(o){return o!==null&&_typeof(o)==='object'&&typeof o.pipe==='function';};function simpleGet(opts,cb){opts=Object.assign({maxRedirects:10},typeof opts==='string'?{url:opts}:opts);cb=once(cb);if(opts.url){var _url$parse=url.parse(opts.url),hostname=_url$parse.hostname,port=_url$parse.port,_protocol=_url$parse.protocol,auth=_url$parse.auth,path=_url$parse.path;// eslint-disable-line node/no-deprecated-api
|
|
1715
1898
|
delete opts.url;if(!hostname&&!port&&!_protocol&&!auth)opts.path=path;// Relative redirect
|
|
1716
1899
|
else Object.assign(opts,{hostname:hostname,port:port,protocol:_protocol,auth:auth,path:path});// Absolute redirect
|
|
@@ -1722,13 +1905,13 @@ res.resume();// Discard response
|
|
|
1722
1905
|
var redirectHost=url.parse(opts.url).hostname;// eslint-disable-line node/no-deprecated-api
|
|
1723
1906
|
// If redirected host is different than original host, drop headers to prevent cookie leak (#73)
|
|
1724
1907
|
if(redirectHost!==null&&redirectHost!==originalHost){delete opts.headers.cookie;delete opts.headers.authorization;}if(opts.method==='POST'&&[301,302].includes(res.statusCode)){opts.method='GET';// On 301/302 redirect, change POST to GET (see #35)
|
|
1725
|
-
delete opts.headers['content-length'];delete opts.headers['content-type'];}if(opts.maxRedirects--===0)return cb(new Error('too many redirects'));else return simpleGet(opts,cb);}var tryUnzip=typeof decompressResponse==='function'&&opts.method!=='HEAD';cb(null,tryUnzip?decompressResponse(res):res);});req.on('timeout',function(){req.abort();cb(new Error('Request timed out'));});req.on('error',cb);if(isStream(body))body.on('error',cb).pipe(req);else req.end(body);return req;}simpleGet.concat=function(opts,cb){return simpleGet(opts,function(err,res){if(err)return cb(err);concat(res,function(err,data){if(err)return cb(err);if(opts.json){try{data=JSON.parse(data.toString());}catch(err){return cb(err,res,data);}}cb(null,res,data);});});};['get','post','put','patch','head','delete'].forEach(function(method){simpleGet[method]=function(opts,cb){if(typeof opts==='string')opts={url:opts};return simpleGet(Object.assign({method:method.toUpperCase()},opts),cb);};});}).call(this);}).call(this,require("buffer").Buffer);},{"buffer":
|
|
1908
|
+
delete opts.headers['content-length'];delete opts.headers['content-type'];}if(opts.maxRedirects--===0)return cb(new Error('too many redirects'));else return simpleGet(opts,cb);}var tryUnzip=typeof decompressResponse==='function'&&opts.method!=='HEAD';cb(null,tryUnzip?decompressResponse(res):res);});req.on('timeout',function(){req.abort();cb(new Error('Request timed out'));});req.on('error',cb);if(isStream(body))body.on('error',cb).pipe(req);else req.end(body);return req;}simpleGet.concat=function(opts,cb){return simpleGet(opts,function(err,res){if(err)return cb(err);concat(res,function(err,data){if(err)return cb(err);if(opts.json){try{data=JSON.parse(data.toString());}catch(err){return cb(err,res,data);}}cb(null,res,data);});});};['get','post','put','patch','head','delete'].forEach(function(method){simpleGet[method]=function(opts,cb){if(typeof opts==='string')opts={url:opts};return simpleGet(Object.assign({method:method.toUpperCase()},opts),cb);};});}).call(this);}).call(this,require("buffer").Buffer);},{"buffer":20,"decompress-response":18,"http":83,"https":49,"once":64,"querystring":78,"simple-concat":81,"url":104}],83:[function(require,module,exports){(function(global){(function(){var ClientRequest=require('./lib/request');var response=require('./lib/response');var extend=require('xtend');var statusCodes=require('builtin-status-codes');var url=require('url');var http=exports;http.request=function(opts,cb){if(typeof opts==='string')opts=url.parse(opts);else opts=extend(opts);// Normally, the page is loaded from http or https, so not specifying a protocol
|
|
1726
1909
|
// will result in a (valid) protocol-relative url. However, this won't work if
|
|
1727
1910
|
// the protocol is something else, like 'file:'
|
|
1728
1911
|
var defaultProtocol=global.location.protocol.search(/^https?:$/)===-1?'http:':'';var protocol=opts.protocol||defaultProtocol;var host=opts.hostname||opts.host;var port=opts.port;var path=opts.path||'/';// Necessary for IPv6 addresses
|
|
1729
1912
|
if(host&&host.indexOf(':')!==-1)host='['+host+']';// This may be a relative url. The browser should always be able to interpret it correctly.
|
|
1730
1913
|
opts.url=(host?protocol+'//'+host:'')+(port?':'+port:'')+path;opts.method=(opts.method||'GET').toUpperCase();opts.headers=opts.headers||{};// Also valid opts.auth, opts.mode
|
|
1731
|
-
var req=new ClientRequest(opts);if(cb)req.on('response',cb);return req;};http.get=function get(opts,cb){var req=http.request(opts,cb);req.end();return req;};http.ClientRequest=ClientRequest;http.IncomingMessage=response.IncomingMessage;http.Agent=function(){};http.Agent.defaultMaxSockets=4;http.globalAgent=new http.Agent();http.STATUS_CODES=statusCodes;http.METHODS=['CHECKOUT','CONNECT','COPY','DELETE','GET','HEAD','LOCK','M-SEARCH','MERGE','MKACTIVITY','MKCOL','MOVE','NOTIFY','OPTIONS','PATCH','POST','PROPFIND','PROPPATCH','PURGE','PUT','REPORT','SEARCH','SUBSCRIBE','TRACE','UNLOCK','UNSUBSCRIBE'];}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"./lib/request":85,"./lib/response":86,"builtin-status-codes":
|
|
1914
|
+
var req=new ClientRequest(opts);if(cb)req.on('response',cb);return req;};http.get=function get(opts,cb){var req=http.request(opts,cb);req.end();return req;};http.ClientRequest=ClientRequest;http.IncomingMessage=response.IncomingMessage;http.Agent=function(){};http.Agent.defaultMaxSockets=4;http.globalAgent=new http.Agent();http.STATUS_CODES=statusCodes;http.METHODS=['CHECKOUT','CONNECT','COPY','DELETE','GET','HEAD','LOCK','M-SEARCH','MERGE','MKACTIVITY','MKCOL','MOVE','NOTIFY','OPTIONS','PATCH','POST','PROPFIND','PROPPATCH','PURGE','PUT','REPORT','SEARCH','SUBSCRIBE','TRACE','UNLOCK','UNSUBSCRIBE'];}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"./lib/request":85,"./lib/response":86,"builtin-status-codes":21,"url":104,"xtend":107}],84:[function(require,module,exports){(function(global){(function(){exports.fetch=isFunction(global.fetch)&&isFunction(global.ReadableStream);exports.writableStream=isFunction(global.WritableStream);exports.abortController=isFunction(global.AbortController);// The xhr request to example.com may violate some restrictive CSP configurations,
|
|
1732
1915
|
// so if we're running in a browser that supports `fetch`, avoid calling getXHR()
|
|
1733
1916
|
// and assume support for certain features below.
|
|
1734
1917
|
var xhr;function getXHR(){// Cache the xhr value
|
|
@@ -1760,7 +1943,7 @@ if(self._mode==='moz-chunked-arraybuffer'){xhr.onprogress=function(){self._onXHR
|
|
|
1760
1943
|
* Even though the spec says it should be available in readyState 3,
|
|
1761
1944
|
* accessing it throws an exception in IE8
|
|
1762
1945
|
*/function statusValid(xhr){try{var status=xhr.status;return status!==null&&status!==0;}catch(e){return false;}}ClientRequest.prototype._onXHRProgress=function(){var self=this;self._resetTimers(false);if(!statusValid(self._xhr)||self._destroyed)return;if(!self._response)self._connect();self._response._onXHRProgress(self._resetTimers.bind(self));};ClientRequest.prototype._connect=function(){var self=this;if(self._destroyed)return;self._response=new IncomingMessage(self._xhr,self._fetchResponse,self._mode,self._resetTimers.bind(self));self._response.on('error',function(err){self.emit('error',err);});self.emit('response',self._response);};ClientRequest.prototype._write=function(chunk,encoding,cb){var self=this;self._body.push(chunk);cb();};ClientRequest.prototype._resetTimers=function(done){var self=this;global.clearTimeout(self._socketTimer);self._socketTimer=null;if(done){global.clearTimeout(self._fetchTimer);self._fetchTimer=null;}else if(self._socketTimeout){self._socketTimer=global.setTimeout(function(){self.emit('timeout');},self._socketTimeout);}};ClientRequest.prototype.abort=ClientRequest.prototype.destroy=function(err){var self=this;self._destroyed=true;self._resetTimers(true);if(self._response)self._response._destroyed=true;if(self._xhr)self._xhr.abort();else if(self._fetchAbortController)self._fetchAbortController.abort();if(err)self.emit('error',err);};ClientRequest.prototype.end=function(data,encoding,cb){var self=this;if(typeof data==='function'){cb=data;data=undefined;}stream.Writable.prototype.end.call(self,data,encoding,cb);};ClientRequest.prototype.setTimeout=function(timeout,cb){var self=this;if(cb)self.once('timeout',cb);self._socketTimeout=timeout;self._resetTimers(false);};ClientRequest.prototype.flushHeaders=function(){};ClientRequest.prototype.setNoDelay=function(){};ClientRequest.prototype.setSocketKeepAlive=function(){};// Taken from http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method
|
|
1763
|
-
var unsafeHeaders=['accept-charset','accept-encoding','access-control-request-headers','access-control-request-method','connection','content-length','cookie','cookie2','date','dnt','expect','host','keep-alive','origin','referer','te','trailer','transfer-encoding','upgrade','via'];}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer);},{"./capability":84,"./response":86,"_process":69,"buffer":
|
|
1946
|
+
var unsafeHeaders=['accept-charset','accept-encoding','access-control-request-headers','access-control-request-method','connection','content-length','cookie','cookie2','date','dnt','expect','host','keep-alive','origin','referer','te','trailer','transfer-encoding','upgrade','via'];}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer);},{"./capability":84,"./response":86,"_process":69,"buffer":20,"inherits":51,"readable-stream":101}],86:[function(require,module,exports){(function(process,global,Buffer){(function(){var capability=require('./capability');var inherits=require('inherits');var stream=require('readable-stream');var rStates=exports.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4};var IncomingMessage=exports.IncomingMessage=function(xhr,response,mode,resetTimers){var self=this;stream.Readable.call(self);self._mode=mode;self.headers={};self.rawHeaders=[];self.trailers={};self.rawTrailers=[];// Fake the 'close' event, but only once 'end' fires
|
|
1764
1947
|
self.on('end',function(){// The nextTick is necessary to prevent the 'request' module from causing an infinite loop
|
|
1765
1948
|
process.nextTick(function(){self.emit('close');});});if(mode==='fetch'){var read=function read(){reader.read().then(function(result){if(self._destroyed)return;resetTimers(result.done);if(result.done){self.push(null);return;}self.push(Buffer.from(result.value));read();})["catch"](function(err){resetTimers(true);if(!self._destroyed)self.emit('error',err);});};self._fetchResponse=response;self.url=response.url;self.statusCode=response.status;self.statusMessage=response.statusText;response.headers.forEach(function(header,key){self.headers[key.toLowerCase()]=header;self.rawHeaders.push(key,header);});if(capability.writableStream){var writable=new WritableStream({write:function write(chunk){resetTimers(false);return new Promise(function(resolve,reject){if(self._destroyed){reject();}else if(self.push(Buffer.from(chunk))){resolve();}else{self._resumeFetch=resolve;}});},close:function close(){resetTimers(true);if(!self._destroyed)self.push(null);},abort:function abort(err){resetTimers(true);if(!self._destroyed)self.emit('error',err);}});try{response.body.pipeTo(writable)["catch"](function(err){resetTimers(true);if(!self._destroyed)self.emit('error',err);});return;}catch(e){}// pipeTo method isn't defined. Can't find a better way to feature test this
|
|
1766
1949
|
}// fallback for when writableStream or pipeTo aren't available
|
|
@@ -1768,7 +1951,7 @@ var reader=response.body.getReader();read();}else{self._xhr=xhr;self._pos=0;self
|
|
|
1768
1951
|
}}};inherits(IncomingMessage,stream.Readable);IncomingMessage.prototype._read=function(){var self=this;var resolve=self._resumeFetch;if(resolve){self._resumeFetch=null;resolve();}};IncomingMessage.prototype._onXHRProgress=function(resetTimers){var self=this;var xhr=self._xhr;var response=null;switch(self._mode){case'text':response=xhr.responseText;if(response.length>self._pos){var newData=response.substr(self._pos);if(self._charset==='x-user-defined'){var buffer=Buffer.alloc(newData.length);for(var i=0;i<newData.length;i++)buffer[i]=newData.charCodeAt(i)&0xff;self.push(buffer);}else{self.push(newData,self._charset);}self._pos=response.length;}break;case'arraybuffer':if(xhr.readyState!==rStates.DONE||!xhr.response)break;response=xhr.response;self.push(Buffer.from(new Uint8Array(response)));break;case'moz-chunked-arraybuffer':// take whole
|
|
1769
1952
|
response=xhr.response;if(xhr.readyState!==rStates.LOADING||!response)break;self.push(Buffer.from(new Uint8Array(response)));break;case'ms-stream':response=xhr.response;if(xhr.readyState!==rStates.LOADING)break;var reader=new global.MSStreamReader();reader.onprogress=function(){if(reader.result.byteLength>self._pos){self.push(Buffer.from(new Uint8Array(reader.result.slice(self._pos))));self._pos=reader.result.byteLength;}};reader.onload=function(){resetTimers(true);self.push(null);};// reader.onerror = ??? // TODO: this
|
|
1770
1953
|
reader.readAsArrayBuffer(response);break;}// The ms-stream case handles end separately in reader.onload()
|
|
1771
|
-
if(self._xhr.readyState===rStates.DONE&&self._mode!=='ms-stream'){resetTimers(true);self.push(null);}};}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer);},{"./capability":84,"_process":69,"buffer":
|
|
1954
|
+
if(self._xhr.readyState===rStates.DONE&&self._mode!=='ms-stream'){resetTimers(true);self.push(null);}};}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer);},{"./capability":84,"_process":69,"buffer":20,"inherits":51,"readable-stream":101}],87:[function(require,module,exports){'use strict';function _inheritsLoose(subClass,superClass){subClass.prototype=Object.create(superClass.prototype);subClass.prototype.constructor=subClass;subClass.__proto__=superClass;}var codes={};function createErrorType(code,message,Base){if(!Base){Base=Error;}function getMessage(arg1,arg2,arg3){if(typeof message==='string'){return message;}else{return message(arg1,arg2,arg3);}}var NodeError=/*#__PURE__*/function(_Base){_inheritsLoose(NodeError,_Base);function NodeError(arg1,arg2,arg3){return _Base.call(this,getMessage(arg1,arg2,arg3))||this;}return NodeError;}(Base);NodeError.prototype.name=Base.name;NodeError.prototype.code=code;codes[code]=NodeError;}// https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
|
|
1772
1955
|
function oneOf(expected,thing){if(Array.isArray(expected)){var len=expected.length;expected=expected.map(function(i){return String(i);});if(len>2){return"one of ".concat(thing," ").concat(expected.slice(0,len-1).join(', '),", or ")+expected[len-1];}else if(len===2){return"one of ".concat(thing," ").concat(expected[0]," or ").concat(expected[1]);}else{return"of ".concat(thing," ").concat(expected[0]);}}else{return"of ".concat(thing," ").concat(String(expected));}}// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
|
|
1773
1956
|
function startsWith(str,search,pos){return str.substr(!pos||pos<0?0:+pos,search.length)===search;}// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
|
|
1774
1957
|
function endsWith(str,search,this_len){if(this_len===undefined||this_len>str.length){this_len=str.length;}return str.substring(this_len-search.length,this_len)===search;}// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
|
|
@@ -1819,7 +2002,7 @@ enumerable:false,get:function get(){if(this._readableState===undefined||this._wr
|
|
|
1819
2002
|
// has not been initialized yet
|
|
1820
2003
|
if(this._readableState===undefined||this._writableState===undefined){return;}// backward compatibility, the user is explicitly
|
|
1821
2004
|
// managing destroyed
|
|
1822
|
-
this._readableState.destroyed=value;this._writableState.destroyed=value;}});}).call(this);}).call(this,require('_process'));},{"./_stream_readable":90,"./_stream_writable":92,"_process":69,"inherits":
|
|
2005
|
+
this._readableState.destroyed=value;this._writableState.destroyed=value;}});}).call(this);}).call(this,require('_process'));},{"./_stream_readable":90,"./_stream_writable":92,"_process":69,"inherits":51}],89:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
|
|
1823
2006
|
//
|
|
1824
2007
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
1825
2008
|
// copy of this software and associated documentation files (the
|
|
@@ -1842,7 +2025,7 @@ this._readableState.destroyed=value;this._writableState.destroyed=value;}});}).c
|
|
|
1842
2025
|
// a passthrough stream.
|
|
1843
2026
|
// basically just the most minimal sort of Transform stream.
|
|
1844
2027
|
// Every written chunk gets output as-is.
|
|
1845
|
-
'use strict';module.exports=PassThrough;var Transform=require('./_stream_transform');require('inherits')(PassThrough,Transform);function PassThrough(options){if(!(this instanceof PassThrough))return new PassThrough(options);Transform.call(this,options);}PassThrough.prototype._transform=function(chunk,encoding,cb){cb(null,chunk);};},{"./_stream_transform":91,"inherits":
|
|
2028
|
+
'use strict';module.exports=PassThrough;var Transform=require('./_stream_transform');require('inherits')(PassThrough,Transform);function PassThrough(options){if(!(this instanceof PassThrough))return new PassThrough(options);Transform.call(this,options);}PassThrough.prototype._transform=function(chunk,encoding,cb){cb(null,chunk);};},{"./_stream_transform":91,"inherits":51}],90:[function(require,module,exports){(function(process,global){(function(){// Copyright Joyent, Inc. and other Node contributors.
|
|
1846
2029
|
//
|
|
1847
2030
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
1848
2031
|
// copy of this software and associated documentation files (the
|
|
@@ -2094,7 +2277,7 @@ if(state.decoder)ret=state.buffer.join('');else if(state.buffer.length===1)ret=s
|
|
|
2094
2277
|
ret=state.buffer.consume(n,state.decoder);}return ret;}function endReadable(stream){var state=stream._readableState;debug('endReadable',state.endEmitted);if(!state.endEmitted){state.ended=true;process.nextTick(endReadableNT,state,stream);}}function endReadableNT(state,stream){debug('endReadableNT',state.endEmitted,state.length);// Check that we didn't get one last unshift.
|
|
2095
2278
|
if(!state.endEmitted&&state.length===0){state.endEmitted=true;stream.readable=false;stream.emit('end');if(state.autoDestroy){// In case of duplex streams we need a way to detect
|
|
2096
2279
|
// if the writable side is ready for autoDestroy as well
|
|
2097
|
-
var wState=stream._writableState;if(!wState||wState.autoDestroy&&wState.finished){stream.destroy();}}}}if(typeof Symbol==='function'){Readable.from=function(iterable,opts){if(from===undefined){from=require('./internal/streams/from');}return from(Readable,iterable,opts);};}function indexOf(xs,x){for(var i=0,l=xs.length;i<l;i++){if(xs[i]===x)return i;}return-1;}}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"../errors":87,"./_stream_duplex":88,"./internal/streams/async_iterator":93,"./internal/streams/buffer_list":94,"./internal/streams/destroy":95,"./internal/streams/from":97,"./internal/streams/state":99,"./internal/streams/stream":100,"_process":69,"buffer":
|
|
2280
|
+
var wState=stream._writableState;if(!wState||wState.autoDestroy&&wState.finished){stream.destroy();}}}}if(typeof Symbol==='function'){Readable.from=function(iterable,opts){if(from===undefined){from=require('./internal/streams/from');}return from(Readable,iterable,opts);};}function indexOf(xs,x){for(var i=0,l=xs.length;i<l;i++){if(xs[i]===x)return i;}return-1;}}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"../errors":87,"./_stream_duplex":88,"./internal/streams/async_iterator":93,"./internal/streams/buffer_list":94,"./internal/streams/destroy":95,"./internal/streams/from":97,"./internal/streams/state":99,"./internal/streams/stream":100,"_process":69,"buffer":20,"events":28,"inherits":51,"string_decoder/":102,"util":18}],91:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
|
|
2098
2281
|
//
|
|
2099
2282
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
2100
2283
|
// copy of this software and associated documentation files (the
|
|
@@ -2180,7 +2363,7 @@ ts.needTransform=true;}};Transform.prototype._destroy=function(err,cb){Duplex.pr
|
|
|
2180
2363
|
stream.push(data);// TODO(BridgeAR): Write a test for these two error cases
|
|
2181
2364
|
// if there's nothing in the write buffer, then that means
|
|
2182
2365
|
// that nothing more will ever be provided
|
|
2183
|
-
if(stream._writableState.length)throw new ERR_TRANSFORM_WITH_LENGTH_0();if(stream._transformState.transforming)throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();return stream.push(null);}},{"../errors":87,"./_stream_duplex":88,"inherits":
|
|
2366
|
+
if(stream._writableState.length)throw new ERR_TRANSFORM_WITH_LENGTH_0();if(stream._transformState.transforming)throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();return stream.push(null);}},{"../errors":87,"./_stream_duplex":88,"inherits":51}],92:[function(require,module,exports){(function(process,global){(function(){// Copyright Joyent, Inc. and other Node contributors.
|
|
2184
2367
|
//
|
|
2185
2368
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
2186
2369
|
// copy of this software and associated documentation files (the
|
|
@@ -2315,7 +2498,7 @@ enumerable:false,get:function get(){if(this._writableState===undefined){return f
|
|
|
2315
2498
|
// has not been initialized yet
|
|
2316
2499
|
if(!this._writableState){return;}// backward compatibility, the user is explicitly
|
|
2317
2500
|
// managing destroyed
|
|
2318
|
-
this._writableState.destroyed=value;}});Writable.prototype.destroy=destroyImpl.destroy;Writable.prototype._undestroy=destroyImpl.undestroy;Writable.prototype._destroy=function(err,cb){cb(err);};}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"../errors":87,"./_stream_duplex":88,"./internal/streams/destroy":95,"./internal/streams/state":99,"./internal/streams/stream":100,"_process":69,"buffer":
|
|
2501
|
+
this._writableState.destroyed=value;}});Writable.prototype.destroy=destroyImpl.destroy;Writable.prototype._undestroy=destroyImpl.undestroy;Writable.prototype._destroy=function(err,cb){cb(err);};}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"../errors":87,"./_stream_duplex":88,"./internal/streams/destroy":95,"./internal/streams/state":99,"./internal/streams/stream":100,"_process":69,"buffer":20,"inherits":51,"util-deprecate":105}],93:[function(require,module,exports){(function(process){(function(){'use strict';var _Object$setPrototypeO;function _defineProperty(obj,key,value){key=_toPropertyKey(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return _typeof(key)==="symbol"?key:String(key);}function _toPrimitive(input,hint){if(_typeof(input)!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(_typeof(res)!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.");}return(hint==="string"?String:Number)(input);}var finished=require('./end-of-stream');var kLastResolve=Symbol('lastResolve');var kLastReject=Symbol('lastReject');var kError=Symbol('error');var kEnded=Symbol('ended');var kLastPromise=Symbol('lastPromise');var kHandlePromise=Symbol('handlePromise');var kStream=Symbol('stream');function createIterResult(value,done){return{value:value,done:done};}function readAndResolve(iter){var resolve=iter[kLastResolve];if(resolve!==null){var data=iter[kStream].read();// we defer if data is null
|
|
2319
2502
|
// we can be expecting either 'end' or
|
|
2320
2503
|
// 'error'
|
|
2321
2504
|
if(data!==null){iter[kLastPromise]=null;iter[kLastResolve]=null;iter[kLastReject]=null;resolve(createIterResult(data,false));}}}function onReadable(iter){// we wait for the next tick, because it might
|
|
@@ -2346,7 +2529,7 @@ ret=hasStrings?this._getString(n):this._getBuffer(n);}return ret;}},{key:"first"
|
|
|
2346
2529
|
},{key:"_getBuffer",value:function _getBuffer(n){var ret=Buffer.allocUnsafe(n);var p=this.head;var c=1;p.data.copy(ret);n-=p.data.length;while(p=p.next){var buf=p.data;var nb=n>buf.length?buf.length:n;buf.copy(ret,ret.length-n,0,nb);n-=nb;if(n===0){if(nb===buf.length){++c;if(p.next)this.head=p.next;else this.head=this.tail=null;}else{this.head=p;p.data=buf.slice(nb);}break;}++c;}this.length-=c;return ret;}// Make sure the linked list only shows the minimal necessary information.
|
|
2347
2530
|
},{key:custom,value:function value(_,options){return inspect(this,_objectSpread(_objectSpread({},options),{},{// Only inspect one level.
|
|
2348
2531
|
depth:0,// It should not recurse.
|
|
2349
|
-
customInspect:false}));}}]);return BufferList;}();},{"buffer":
|
|
2532
|
+
customInspect:false}));}}]);return BufferList;}();},{"buffer":20,"util":18}],95:[function(require,module,exports){(function(process){(function(){'use strict';// undocumented cb() API, needed for core, not for public API
|
|
2350
2533
|
function destroy(err,cb){var _this=this;var readableDestroyed=this._readableState&&this._readableState.destroyed;var writableDestroyed=this._writableState&&this._writableState.destroyed;if(readableDestroyed||writableDestroyed){if(cb){cb(err);}else if(err){if(!this._writableState){process.nextTick(emitErrorNT,this,err);}else if(!this._writableState.errorEmitted){this._writableState.errorEmitted=true;process.nextTick(emitErrorNT,this,err);}}return this;}// we set destroyed to true before firing error callbacks in order
|
|
2351
2534
|
// to make it re-entrance safe in case destroy() is called within callbacks
|
|
2352
2535
|
if(this._readableState){this._readableState.destroyed=true;}// if this is a duplex stream mark the writable part as destroyed as well
|
|
@@ -2363,7 +2546,7 @@ stream.on('end',onlegacyfinish);stream.on('close',onlegacyfinish);}stream.on('en
|
|
|
2363
2546
|
'use strict';var eos;function once(callback){var called=false;return function(){if(called)return;called=true;callback.apply(void 0,arguments);};}var _require$codes=require('../../../errors').codes,ERR_MISSING_ARGS=_require$codes.ERR_MISSING_ARGS,ERR_STREAM_DESTROYED=_require$codes.ERR_STREAM_DESTROYED;function noop(err){// Rethrow the error if it exists to avoid swallowing it
|
|
2364
2547
|
if(err)throw err;}function isRequest(stream){return stream.setHeader&&typeof stream.abort==='function';}function destroyer(stream,reading,writing,callback){callback=once(callback);var closed=false;stream.on('close',function(){closed=true;});if(eos===undefined)eos=require('./end-of-stream');eos(stream,{readable:reading,writable:writing},function(err){if(err)return callback(err);closed=true;callback();});var destroyed=false;return function(err){if(closed)return;if(destroyed)return;destroyed=true;// request.destroy just do .end - .abort is what we want
|
|
2365
2548
|
if(isRequest(stream))return stream.abort();if(typeof stream.destroy==='function')return stream.destroy();callback(err||new ERR_STREAM_DESTROYED('pipe'));};}function call(fn){fn();}function pipe(from,to){return from.pipe(to);}function popCallback(streams){if(!streams.length)return noop;if(typeof streams[streams.length-1]!=='function')return noop;return streams.pop();}function pipeline(){for(var _len=arguments.length,streams=new Array(_len),_key=0;_key<_len;_key++){streams[_key]=arguments[_key];}var callback=popCallback(streams);if(Array.isArray(streams[0]))streams=streams[0];if(streams.length<2){throw new ERR_MISSING_ARGS('streams');}var error;var destroys=streams.map(function(stream,i){var reading=i<streams.length-1;var writing=i>0;return destroyer(stream,reading,writing,function(err){if(!error)error=err;if(err)destroys.forEach(call);if(reading)return;destroys.forEach(call);callback(error);});});return streams.reduce(pipe);}module.exports=pipeline;},{"../../../errors":87,"./end-of-stream":96}],99:[function(require,module,exports){'use strict';var ERR_INVALID_OPT_VALUE=require('../../../errors').codes.ERR_INVALID_OPT_VALUE;function highWaterMarkFrom(options,isDuplex,duplexKey){return options.highWaterMark!=null?options.highWaterMark:isDuplex?options[duplexKey]:null;}function getHighWaterMark(state,options,duplexKey,isDuplex){var hwm=highWaterMarkFrom(options,isDuplex,duplexKey);if(hwm!=null){if(!(isFinite(hwm)&&Math.floor(hwm)===hwm)||hwm<0){var name=isDuplex?duplexKey:'highWaterMark';throw new ERR_INVALID_OPT_VALUE(name,hwm);}return Math.floor(hwm);}// Default value
|
|
2366
|
-
return state.objectMode?16:16*1024;}module.exports={getHighWaterMark:getHighWaterMark};},{"../../../errors":87}],100:[function(require,module,exports){module.exports=require('events').EventEmitter;},{"events":
|
|
2549
|
+
return state.objectMode?16:16*1024;}module.exports={getHighWaterMark:getHighWaterMark};},{"../../../errors":87}],100:[function(require,module,exports){module.exports=require('events').EventEmitter;},{"events":28}],101:[function(require,module,exports){exports=module.exports=require('./lib/_stream_readable.js');exports.Stream=exports;exports.Readable=exports;exports.Writable=require('./lib/_stream_writable.js');exports.Duplex=require('./lib/_stream_duplex.js');exports.Transform=require('./lib/_stream_transform.js');exports.PassThrough=require('./lib/_stream_passthrough.js');exports.finished=require('./lib/internal/streams/end-of-stream.js');exports.pipeline=require('./lib/internal/streams/pipeline.js');},{"./lib/_stream_duplex.js":88,"./lib/_stream_passthrough.js":89,"./lib/_stream_readable.js":90,"./lib/_stream_transform.js":91,"./lib/_stream_writable.js":92,"./lib/internal/streams/end-of-stream.js":96,"./lib/internal/streams/pipeline.js":98}],102:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
|
|
2367
2550
|
//
|
|
2368
2551
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
2369
2552
|
// copy of this software and associated documentation files (the
|
|
@@ -2634,11 +2817,11 @@ try{if(!global.localStorage)return false;}catch(_){return false;}var val=global.
|
|
|
2634
2817
|
module.exports=wrappy;function wrappy(fn,cb){if(fn&&cb)return wrappy(fn)(cb);if(typeof fn!=='function')throw new TypeError('need wrapper function');Object.keys(fn).forEach(function(k){wrapper[k]=fn[k];});return wrapper;function wrapper(){var args=new Array(arguments.length);for(var i=0;i<args.length;i++){args[i]=arguments[i];}var ret=fn.apply(this,args);var cb=args[args.length-1];if(typeof ret==='function'&&ret!==cb){Object.keys(cb).forEach(function(k){ret[k]=cb[k];});}return ret;}}},{}],107:[function(require,module,exports){module.exports=extend;var hasOwnProperty=Object.prototype.hasOwnProperty;function extend(){var target={};for(var i=0;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;}},{}],108:[function(require,module,exports){/**
|
|
2635
2818
|
* Fable Application Services Management
|
|
2636
2819
|
* @author <steven@velozo.com>
|
|
2637
|
-
*/var libFableServiceBase=require('fable-serviceproviderbase');var FableService=/*#__PURE__*/function(_libFableServiceBase$){_inherits(FableService,_libFableServiceBase$);var
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2820
|
+
*/var libFableServiceBase=require('fable-serviceproviderbase');var FableService=/*#__PURE__*/function(_libFableServiceBase$){_inherits(FableService,_libFableServiceBase$);var _super9=_createSuper(FableService);function FableService(pSettings,pServiceHash){var _this17;_classCallCheck2(this,FableService);_this17=_super9.call(this,pSettings,pServiceHash);_this17.serviceType='ServiceManager';_this17.serviceTypes=[];// A map of instantiated services
|
|
2821
|
+
_this17.servicesMap={};// A map of the default instantiated service by type
|
|
2822
|
+
_this17.services={};// A map of class constructors for services
|
|
2823
|
+
_this17.serviceClasses={};// If we need extra service initialization capabilities
|
|
2824
|
+
_this17.extraServiceInitialization=false;return _this17;}_createClass2(FableService,[{key:"addServiceType",value:function addServiceType(pServiceType,pServiceClass){if(this.servicesMap.hasOwnProperty(pServiceType)){// TODO: Check if any services are running?
|
|
2642
2825
|
this.fable.log.warn("Adding a service type [".concat(pServiceType,"] that already exists."));}else{// Add the container for instantiated services to go in
|
|
2643
2826
|
this.servicesMap[pServiceType]={};// Add the type to the list of types
|
|
2644
2827
|
this.serviceTypes.push(pServiceType);}// Using the static member of the class is a much more reliable way to check if it is a service class than instanceof
|
|
@@ -2660,7 +2843,7 @@ pServiceInstance.connectFable(this.fable);if(!this.servicesMap.hasOwnProperty(tm
|
|
|
2660
2843
|
// This means you couldn't register another with this type unless it was later registered with a constructor class.
|
|
2661
2844
|
this.servicesMap[tmpServiceType]={};}// Add the service to the service map
|
|
2662
2845
|
this.servicesMap[tmpServiceType][tmpServiceHash]=pServiceInstance;// If this is the first service of this type, make it the default
|
|
2663
|
-
if(!this.services.hasOwnProperty(tmpServiceType)){this.setDefaultServiceInstantiation(tmpServiceType,tmpServiceHash);}return pServiceInstance;}},{key:"setDefaultServiceInstantiation",value:function setDefaultServiceInstantiation(pServiceType,pServiceHash){if(this.servicesMap[pServiceType].hasOwnProperty(pServiceHash)){this.fable[pServiceType]=this.servicesMap[pServiceType][pServiceHash];this.services[pServiceType]=this.servicesMap[pServiceType][pServiceHash];return true;}return false;}}]);return FableService;}(libFableServiceBase.CoreServiceProviderBase);module.exports=FableService;module.exports.ServiceProviderBase=libFableServiceBase;module.exports.CoreServiceProviderBase=libFableServiceBase.CoreServiceProviderBase;},{"fable-serviceproviderbase":
|
|
2846
|
+
if(!this.services.hasOwnProperty(tmpServiceType)){this.setDefaultServiceInstantiation(tmpServiceType,tmpServiceHash);}return pServiceInstance;}},{key:"setDefaultServiceInstantiation",value:function setDefaultServiceInstantiation(pServiceType,pServiceHash){if(this.servicesMap[pServiceType].hasOwnProperty(pServiceHash)){this.fable[pServiceType]=this.servicesMap[pServiceType][pServiceHash];this.services[pServiceType]=this.servicesMap[pServiceType][pServiceHash];return true;}return false;}}]);return FableService;}(libFableServiceBase.CoreServiceProviderBase);module.exports=FableService;module.exports.ServiceProviderBase=libFableServiceBase;module.exports.CoreServiceProviderBase=libFableServiceBase.CoreServiceProviderBase;},{"fable-serviceproviderbase":36}],109:[function(require,module,exports){/**
|
|
2664
2847
|
* Fable Application Services Support Library
|
|
2665
2848
|
* @author <steven@velozo.com>
|
|
2666
2849
|
*/ // Pre-init services
|
|
@@ -2678,8 +2861,8 @@ this._coreServices.ServiceManager=new libFableServiceManager(this);this.serviceM
|
|
|
2678
2861
|
// They will then be available in the Default service provider set as well.
|
|
2679
2862
|
this.serviceManager.connectPreinitServiceProviderInstance(this._coreServices.ServiceManager);this.serviceManager.connectPreinitServiceProviderInstance(this._coreServices.UUID);this.serviceManager.connectPreinitServiceProviderInstance(this._coreServices.Logging);this.serviceManager.connectPreinitServiceProviderInstance(this._coreServices.SettingsManager);// Initialize and instantiate the default baked-in Data Arithmatic service
|
|
2680
2863
|
this.serviceManager.addAndInstantiateServiceType('EnvironmentData',require('./services/Fable-Service-EnvironmentData.js'));this.serviceManager.addServiceType('Template',require('./services/Fable-Service-Template.js'));this.serviceManager.addServiceType('MetaTemplate',require('./services/Fable-Service-MetaTemplate.js'));this.serviceManager.addServiceType('Anticipate',require('./services/Fable-Service-Anticipate.js'));this.serviceManager.addAndInstantiateServiceType('DataFormat',require('./services/Fable-Service-DataFormat.js'));this.serviceManager.addAndInstantiateServiceType('DataGeneration',require('./services/Fable-Service-DataGeneration.js'));this.serviceManager.addAndInstantiateServiceType('Utility',require('./services/Fable-Service-Utility.js'));this.serviceManager.addServiceType('Operation',require('./services/Fable-Service-Operation.js'));this.serviceManager.addServiceType('RestClient',require('./services/Fable-Service-RestClient.js'));this.serviceManager.addServiceType('CSVParser',require('./services/Fable-Service-CSVParser.js'));this.serviceManager.addServiceType('Manifest',require('manyfest'));this.serviceManager.addServiceType('ObjectCache',require('cachetrax'));this.serviceManager.addServiceType('FilePersistence',require('./services/Fable-Service-FilePersistence.js'));}_createClass2(Fable,[{key:"isFable",get:function get(){return true;}},{key:"settings",get:function get(){return this._coreServices.SettingsManager.settings;}},{key:"settingsManager",get:function get(){return this._coreServices.SettingsManager;}},{key:"log",get:function get(){return this._coreServices.Logging;}},{key:"services",get:function get(){return this._coreServices.ServiceManager.services;}},{key:"servicesMap",get:function get(){return this._coreServices.ServiceManager.servicesMap;}},{key:"getUUID",value:function getUUID(){return this._coreServices.UUID.getUUID();}},{key:"fable",get:function get(){return this;}}]);return Fable;}();// This is for backwards compatibility
|
|
2681
|
-
function autoConstruct(pSettings){return new Fable(pSettings);}module.exports=Fable;module.exports["new"]=autoConstruct;module.exports.LogProviderBase=libFableLog.LogProviderBase;module.exports.ServiceProviderBase=libFableServiceManager.ServiceProviderBase;module.exports.CoreServiceProviderBase=libFableServiceManager.CoreServiceProviderBase;module.exports.precedent=libFableSettings.precedent;},{"./Fable-ServiceManager.js":108,"./services/Fable-Service-Anticipate.js":110,"./services/Fable-Service-CSVParser.js":111,"./services/Fable-Service-DataFormat.js":112,"./services/Fable-Service-DataGeneration.js":114,"./services/Fable-Service-EnvironmentData.js":115,"./services/Fable-Service-FilePersistence.js":116,"./services/Fable-Service-MetaTemplate.js":117,"./services/Fable-Service-Operation.js":121,"./services/Fable-Service-RestClient.js":122,"./services/Fable-Service-Template.js":123,"./services/Fable-Service-Utility.js":124,"cachetrax":
|
|
2682
|
-
|
|
2864
|
+
function autoConstruct(pSettings){return new Fable(pSettings);}module.exports=Fable;module.exports["new"]=autoConstruct;module.exports.LogProviderBase=libFableLog.LogProviderBase;module.exports.ServiceProviderBase=libFableServiceManager.ServiceProviderBase;module.exports.CoreServiceProviderBase=libFableServiceManager.CoreServiceProviderBase;module.exports.precedent=libFableSettings.precedent;},{"./Fable-ServiceManager.js":108,"./services/Fable-Service-Anticipate.js":110,"./services/Fable-Service-CSVParser.js":111,"./services/Fable-Service-DataFormat.js":112,"./services/Fable-Service-DataGeneration.js":114,"./services/Fable-Service-EnvironmentData.js":115,"./services/Fable-Service-FilePersistence.js":116,"./services/Fable-Service-MetaTemplate.js":117,"./services/Fable-Service-Operation.js":121,"./services/Fable-Service-RestClient.js":122,"./services/Fable-Service-Template.js":123,"./services/Fable-Service-Utility.js":124,"cachetrax":22,"fable-log":34,"fable-settings":39,"fable-uuid":41,"manyfest":62}],110:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var FableServiceAnticipate=/*#__PURE__*/function(_libFableServiceBase){_inherits(FableServiceAnticipate,_libFableServiceBase);var _super10=_createSuper(FableServiceAnticipate);function FableServiceAnticipate(pFable,pOptions,pServiceHash){var _this18;_classCallCheck2(this,FableServiceAnticipate);_this18=_super10.call(this,pFable,pOptions,pServiceHash);_this18.serviceType='AsyncAnticipate';// The queue of operations waiting to run.
|
|
2865
|
+
_this18.operationQueue=[];_this18.erroredOperations=[];_this18.executingOperationCount=0;_this18.completedOperationCount=0;_this18.maxOperations=1;_this18.lastError=undefined;_this18.waitingFunctions=[];return _this18;}_createClass2(FableServiceAnticipate,[{key:"checkQueue",value:function checkQueue(){// This checks to see if we need to start any operations.
|
|
2683
2866
|
if(this.operationQueue.length>0&&this.executingOperationCount<this.maxOperations){var tmpOperation=this.operationQueue.shift();this.executingOperationCount+=1;tmpOperation(this.buildAnticipatorCallback());}else if(this.waitingFunctions.length>0&&this.executingOperationCount<1){// If there are no operations left, and we have waiting functions, call them.
|
|
2684
2867
|
for(var i=0;i<this.waitingFunctions.length;i++){this.waitingFunctions[i](this.lastError);}// Reset our state
|
|
2685
2868
|
this.lastError=undefined;this.waitingFunctions=[];}}// Expects a function fAsynchronousFunction(fCallback)
|
|
@@ -2697,8 +2880,8 @@ throw new Error("Anticipation async callback called twice...");}tmpCallbackState
|
|
|
2697
2880
|
* do anything; unfortunately some files have a sequence issue with that.
|
|
2698
2881
|
*
|
|
2699
2882
|
* @class CSVParser
|
|
2700
|
-
*/var CSVParser=/*#__PURE__*/function(
|
|
2701
|
-
|
|
2883
|
+
*/var CSVParser=/*#__PURE__*/function(_libFableServiceProvi7){_inherits(CSVParser,_libFableServiceProvi7);var _super11=_createSuper(CSVParser);function CSVParser(pFable,pOptions,pServiceHash){var _this19;_classCallCheck2(this,CSVParser);_this19=_super11.call(this,pFable,pOptions,pServiceHash);_this19.serviceType='CSVParser';_this19.Header=[];_this19.HeaderFieldNames=[];_this19.Delimiter=',';_this19.QuoteCharacter='"';_this19.CleanCharacters=['\r'];_this19.HeaderLineIndex=0;_this19.HasHeader=true;_this19.HasSetHeader=false;_this19.EmitHeader=false;_this19.EmitJSON=true;_this19.EscapedQuoteString='"';// Current Line Parsing State
|
|
2884
|
+
_this19.CurrentLine='';_this19.CurrentRecord=[];_this19.InQuote=false;_this19.InEscapedQuote=false;_this19.LinesParsed=0;_this19.RowsEmitted=0;return _this19;}_createClass2(CSVParser,[{key:"marshalRowToJSON",value:function marshalRowToJSON(pRowArray){if(!Array.isArray(pRowArray)){return false;}for(var i=this.HeaderFieldNames.length;i<pRowArray.length;i++){this.HeaderFieldNames[i]="".concat(i);}var tmpObject={};for(var _i11=0;_i11<pRowArray.length;_i11++){tmpObject[this.HeaderFieldNames[_i11]]=pRowArray[_i11];}return tmpObject;}// Set the header data, for use in marshalling to JSON.
|
|
2702
2885
|
},{key:"setHeader",value:function setHeader(pHeaderArray){this.Header=pHeaderArray;for(var i=0;i<this.Header.length;i++){if(typeof this.Header[i]=='undefined'){this.HeaderFieldNames[i]="".concat(i);}else{this.HeaderFieldNames[i]=this.Header[i].toString();}}}},{key:"resetRowState",value:function resetRowState(){this.CurrentRecord=[];}},{key:"pushLine",value:function pushLine(){for(var i=0;i<this.CleanCharacters.length;i++){this.CurrentLine=this.CurrentLine.replace(this.CleanCharacters[i],'');}this.CurrentRecord.push(this.CurrentLine);this.CurrentLine='';}},{key:"emitRow",value:function emitRow(pFormatAsJSON){var tmpFormatAsJSON=typeof pFormatAsJSON=='undefined'?this.EmitJSON:pFormatAsJSON;this.RowsEmitted++;var tmpCompletedRecord=this.CurrentRecord;this.CurrentRecord=[];if(tmpFormatAsJSON){return this.marshalRowToJSON(tmpCompletedRecord);}else{return tmpCompletedRecord;}}},{key:"parseCSVLine",value:function parseCSVLine(pLineString){this.LinesParsed++;for(var i=0;i<pLineString.length;i++){if(!this.InQuote&&pLineString[i]==this.Delimiter){this.pushLine();}else if(pLineString[i]==this.QuoteCharacter){// If we are in the second part of an escaped quote, ignore it.
|
|
2703
2886
|
if(this.InEscapedQuote){this.InEscapedQuote=false;}// If we aren't in a quote, enter quote
|
|
2704
2887
|
else if(!this.InQuote){this.InQuote=true;}// We are in a quote, so peek forward to see if this is an "escaped" quote pair
|
|
@@ -2708,30 +2891,30 @@ if(!this.InQuote){// Push the last remaining column from the buffer to the curre
|
|
|
2708
2891
|
this.pushLine();// Check to see if there is a header -- and if so, if this is the header row
|
|
2709
2892
|
if(this.HasHeader&&!this.HasSetHeader&&this.RowsEmitted==this.HeaderLineIndex){this.HasSetHeader=true;// Override the format as json bit
|
|
2710
2893
|
this.setHeader(this.emitRow(false));// No matter what, formatting this as JSON is silly and we don't want to go there anyway.
|
|
2711
|
-
if(this.EmitHeader){return this.Header;}else{return false;}}else{return this.emitRow();}}else{return false;}}}]);return CSVParser;}(libFableServiceProviderBase);module.exports=CSVParser;},{"fable-serviceproviderbase":
|
|
2894
|
+
if(this.EmitHeader){return this.Header;}else{return false;}}else{return this.emitRow();}}else{return false;}}}]);return CSVParser;}(libFableServiceProviderBase);module.exports=CSVParser;},{"fable-serviceproviderbase":36}],112:[function(require,module,exports){var libFableServiceProviderBase=require('fable-serviceproviderbase');/**
|
|
2712
2895
|
* Data Formatting and Translation Functions
|
|
2713
2896
|
*
|
|
2714
2897
|
* @class DataFormat
|
|
2715
|
-
*/var DataFormat=/*#__PURE__*/function(
|
|
2898
|
+
*/var DataFormat=/*#__PURE__*/function(_libFableServiceProvi8){_inherits(DataFormat,_libFableServiceProvi8);var _super12=_createSuper(DataFormat);function DataFormat(pFable,pOptions,pServiceHash){var _this20;_classCallCheck2(this,DataFormat);_this20=_super12.call(this,pFable,pOptions,pServiceHash);/**
|
|
2716
2899
|
* Pad the start of a string.
|
|
2717
2900
|
*
|
|
2718
2901
|
* @param {*} pString
|
|
2719
2902
|
* @param {number} pTargetLength
|
|
2720
2903
|
* @returns {string} pPadString
|
|
2721
|
-
*/_defineProperty2(_assertThisInitialized(
|
|
2904
|
+
*/_defineProperty2(_assertThisInitialized(_this20),"stringPadStart",function(pString,pTargetLength,pPadString){var tmpString=pString.toString();return this.stringGeneratePaddingString(tmpString,pTargetLength,pPadString)+tmpString;});/**
|
|
2722
2905
|
* Pad the end of a string.
|
|
2723
2906
|
*
|
|
2724
2907
|
* @param {*} pString
|
|
2725
2908
|
* @param {number} pTargetLength
|
|
2726
2909
|
* @returns {string} pPadString
|
|
2727
|
-
*/_defineProperty2(_assertThisInitialized(
|
|
2910
|
+
*/_defineProperty2(_assertThisInitialized(_this20),"stringPadEnd",function(pString,pTargetLength,pPadString){var tmpString=pString.toString();return tmpString+this.stringGeneratePaddingString(tmpString,pTargetLength,pPadString);});_this20.serviceType='DataArithmatic';// Regular Expressions (so they don't have to be recompiled every time)
|
|
2728
2911
|
// These could be defined as static, but I'm not sure if that will work with browserify ... and specifically the QT browser.
|
|
2729
|
-
|
|
2912
|
+
_this20._Regex_formatterInsertCommas=/.{1,3}/g;// Match Function:
|
|
2730
2913
|
// function(pMatch, pSign, pZeros, pBefore, pDecimal, pAfter)
|
|
2731
2914
|
// Thoughts about below: /^([+-]?)(0*)(\d+)(\.(\d+))?$/;
|
|
2732
|
-
|
|
2915
|
+
_this20._Regex_formatterAddCommasToNumber=/^([-+]?)(0?)(\d+)(.?)(\d+)$/g;_this20._Regex_formatterDollarsRemoveCommas=/,/gi;_this20._Regex_formatterCleanNonAlphaChar=/[^a-zA-Z]/gi;_this20._Regex_formatterCapitalizeEachWord=/([a-zA-Z]+)/g;// TODO: Potentially pull these in from a configuration.
|
|
2733
2916
|
// TODO: Use locale data for this if it's defaults all the way down.
|
|
2734
|
-
|
|
2917
|
+
_this20._Value_MoneySign_Currency='$';_this20._Value_NaN_Currency='--';_this20._Value_GroupSeparator_Number=',';_this20._Value_Prefix_StringHash='HSH';_this20._Value_Clean_formatterCleanNonAlpha='';_this20._UseEngineStringStartsWith=typeof String.prototype.startsWith==='function';_this20._UseEngineStringEndsWith=typeof String.prototype.endsWith==='function';return _this20;}/*************************************************************************
|
|
2735
2918
|
* String Manipulation and Comparison Functions
|
|
2736
2919
|
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ /**
|
|
2737
2920
|
* Reverse a string
|
|
@@ -2820,7 +3003,7 @@ return pNumber.toString().replace(this._Regex_formatterAddCommasToNumber,this.pr
|
|
|
2820
3003
|
*
|
|
2821
3004
|
* @param {*} pValue
|
|
2822
3005
|
* @returns {string}
|
|
2823
|
-
*/},{key:"formatterDollars",value:function formatterDollars(pValue){if(isNaN(pValue)){return this._Value_NaN_Currency;}var
|
|
3006
|
+
*/},{key:"formatterDollars",value:function formatterDollars(pValue){if(isNaN(pValue)){return this._Value_NaN_Currency;}var tmpDollarAmountArbitrary=this.fable.Utility.bigNumber(pValue);var tmpDollarAmount=tmpDollarAmountArbitrary.toFixed(2);if(isNaN(tmpDollarAmount)){// Try again and see if what was passed in was a dollars string.
|
|
2824
3007
|
if(typeof pValue=='string'){// TODO: Better rounding function? This is a hack to get rid of the currency symbol and commas.
|
|
2825
3008
|
tmpDollarAmount=parseFloat(pValue.replace(this._Value_MoneySign_Currency,'').replace(this._Regex_formatterDollarsRemoveCommas,'')).toFixed(2);}// If we didn't get a number, return the "not a number" string.
|
|
2826
3009
|
if(isNaN(tmpDollarAmount)){return this._Value_NaN_Currency;}}// TODO: Get locale data and use that for this stuff.
|
|
@@ -2830,7 +3013,7 @@ return"$".concat(this.formatterAddCommasToNumber(tmpDollarAmount));}/**
|
|
|
2830
3013
|
* @param {*} pValue
|
|
2831
3014
|
* @param {number} pDigits
|
|
2832
3015
|
* @returns {string}
|
|
2833
|
-
*/},{key:"formatterRoundNumber",value:function formatterRoundNumber(pValue,pDigits){var tmpDigits=typeof pDigits=='undefined'?2:pDigits;if(isNaN(pValue)){var tmpZed=0;return tmpZed.toFixed(tmpDigits);}var
|
|
3016
|
+
*/},{key:"formatterRoundNumber",value:function formatterRoundNumber(pValue,pDigits){var tmpDigits=typeof pDigits=='undefined'?2:pDigits;if(isNaN(pValue)){var tmpZed=0;return tmpZed.toFixed(tmpDigits);}var tmpAmountArbitrary=this.fable.Utility.bigNumber(pValue);var tmpValue=tmpAmountArbitrary.toFixed(tmpDigits);if(isNaN(tmpValue)){var _tmpZed=0;return _tmpZed.toFixed(tmpDigits);}else{return tmpValue;}}/**
|
|
2834
3017
|
* Generate a reapeating padding string to be appended before or after depending on
|
|
2835
3018
|
* which padding function it uses.
|
|
2836
3019
|
*
|
|
@@ -2838,7 +3021,7 @@ return"$".concat(this.formatterAddCommasToNumber(tmpDollarAmount));}/**
|
|
|
2838
3021
|
* @param {number} pTargetLength
|
|
2839
3022
|
* @returns {string} pPadString
|
|
2840
3023
|
*/},{key:"stringGeneratePaddingString",value:function stringGeneratePaddingString(pString,pTargetLength,pPadString){var tmpTargetLength=pTargetLength>>0;var tmpPadString=String(typeof pPadString!=='undefined'?pPadString:' ');if(pString.length>pTargetLength){// No padding string if the source string is already longer than the target length, return an empty string
|
|
2841
|
-
return'';}else{var tmpPadLength=pTargetLength-pString.length;if(tmpPadLength>
|
|
3024
|
+
return'';}else{var tmpPadLength=pTargetLength-pString.length;if(tmpPadLength>tmpPadString.length){tmpPadString+=tmpPadString.repeat(tmpTargetLength/tmpPadString.length);}return tmpPadString.slice(0,tmpPadLength);}}},{key:"formatTimeSpan",value:/*************************************************************************
|
|
2842
3025
|
* Time Formatting Functions (milliseconds)
|
|
2843
3026
|
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ /**
|
|
2844
3027
|
* Format a time length in milliseconds into a human readable string.
|
|
@@ -2904,12 +3087,12 @@ return'';}if(tmpEnclosedValueEndIndex>0&&tmpEnclosedValueEndIndex>tmpEnclosedVal
|
|
|
2904
3087
|
* @param {number} pEnclosureEnd
|
|
2905
3088
|
* @returns {string}
|
|
2906
3089
|
*/},{key:"stringRemoveEnclosureByIndex",value:function stringRemoveEnclosureByIndex(pString,pEnclosureIndexToRemove,pEnclosureStart,pEnclosureEnd){var tmpString=typeof pString=='string'?pString:'';var tmpEnclosureIndexToRemove=typeof pEnclosureIndexToRemove=='number'?pEnclosureIndexToRemove:0;var tmpEnclosureStart=typeof pEnclosureStart=='string'?pEnclosureStart:'(';var tmpEnclosureEnd=typeof pEnclosureEnd=='string'?pEnclosureEnd:')';var tmpEnclosureCount=0;var tmpEnclosureDepth=0;var tmpMatchedEnclosureIndex=false;var tmpEnclosureStartIndex=0;var tmpEnclosureEndIndex=0;for(var i=0;i<tmpString.length;i++){// This is the start of an enclosure
|
|
2907
|
-
if(tmpString[i]==tmpEnclosureStart){tmpEnclosureDepth++;if(tmpEnclosureDepth==1){tmpEnclosureCount++;if(tmpEnclosureIndexToRemove==tmpEnclosureCount-1){tmpMatchedEnclosureIndex=true;tmpEnclosureStartIndex=i;}}}else if(tmpString[i]==tmpEnclosureEnd){tmpEnclosureDepth--;if(tmpEnclosureDepth==0&&tmpMatchedEnclosureIndex&&tmpEnclosureEndIndex<=tmpEnclosureStartIndex){tmpEnclosureEndIndex=i;tmpMatchedEnclosureIndex=false;}}}if(tmpEnclosureCount<=tmpEnclosureIndexToRemove){return tmpString;}var tmpReturnString='';if(tmpEnclosureStartIndex>1){tmpReturnString=tmpString.substring(0,tmpEnclosureStartIndex);}if(tmpString.length>tmpEnclosureEndIndex+1&&tmpEnclosureEndIndex>tmpEnclosureStartIndex){tmpReturnString+=tmpString.substring(tmpEnclosureEndIndex+1);}return tmpReturnString;}}]);return DataFormat;}(libFableServiceProviderBase);module.exports=DataFormat;},{"fable-serviceproviderbase":
|
|
3090
|
+
if(tmpString[i]==tmpEnclosureStart){tmpEnclosureDepth++;if(tmpEnclosureDepth==1){tmpEnclosureCount++;if(tmpEnclosureIndexToRemove==tmpEnclosureCount-1){tmpMatchedEnclosureIndex=true;tmpEnclosureStartIndex=i;}}}else if(tmpString[i]==tmpEnclosureEnd){tmpEnclosureDepth--;if(tmpEnclosureDepth==0&&tmpMatchedEnclosureIndex&&tmpEnclosureEndIndex<=tmpEnclosureStartIndex){tmpEnclosureEndIndex=i;tmpMatchedEnclosureIndex=false;}}}if(tmpEnclosureCount<=tmpEnclosureIndexToRemove){return tmpString;}var tmpReturnString='';if(tmpEnclosureStartIndex>1){tmpReturnString=tmpString.substring(0,tmpEnclosureStartIndex);}if(tmpString.length>tmpEnclosureEndIndex+1&&tmpEnclosureEndIndex>tmpEnclosureStartIndex){tmpReturnString+=tmpString.substring(tmpEnclosureEndIndex+1);}return tmpReturnString;}}]);return DataFormat;}(libFableServiceProviderBase);module.exports=DataFormat;},{"fable-serviceproviderbase":36}],113:[function(require,module,exports){module.exports={"DefaultIntegerMinimum":0,"DefaultIntegerMaximum":9999999,"DefaultNumericStringLength":10,"MonthSet":["January","February","March","April","May","June","July","August","September","October","November","December"],"WeekDaySet":["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],"ColorSet":["Red","Orange","Yellow","Green","Blue","Indigo","Violet","Pink","Purple","Turquoise","Gold","Lime","Maroon","Navy","Coral","Teal","Brown","White","Black","Sky","Berry","Grey","Straw","Silver","Sapphire"],"SurNameSet":["Smith","Johnson","Williams","Brown","Jones","Miller","Davis","Garcia","Rodriguez","Wilson","Martinez","Anderson","Taylor","Thomas","Hernandez","Moore","Martin","Jackson","Thompson","White","Lopez","Lee","Gonzalez","Harris","Clark","Lewis","Robinson","Walker","Perez","Hall","Young","Allen","Sanchez","Wright","King","Scott","Green","Baker","Adams","Nelson","Hill","Ramirez","Campbell","Mitchell","Roberts","Carter","Phillips","Evans","Turner","Torres","Parker","Collins","Edwards","Stewart","Flores","Morris","Nguyen","Murphy","Rivera","Cook","Rogers","Morgan","Peterson","Cooper","Reed","Bailey","Bell","Gomez","Kelly","Howard","Ward","Cox","Diaz","Richardson","Wood","Watson","Brooks","Bennett","Gray","James","Reyes","Cruz","Hughes","Price","Myers","Long","Foster","Sanders","Ross","Morales","Powell","Sullivan","Russell","Ortiz","Jenkins","Gutierrez","Perry","Butler","Barnes","Fisher"],"NameSet":["Mary","Patricia","Jennifer","Linda","Elizabeth","Barbara","Susan","Jessica","Sarah","Karen","Lisa","Nancy","Betty","Sandra","Margaret","Ashley","Kimberly","Emily","Donna","Michelle","Carol","Amanda","Melissa","Deborah","Stephanie","Dorothy","Rebecca","Sharon","Laura","Cynthia","Amy","Kathleen","Angela","Shirley","Brenda","Emma","Anna","Pamela","Nicole","Samantha","Katherine","Christine","Helen","Debra","Rachel","Carolyn","Janet","Maria","Catherine","Heather","Diane","Olivia","Julie","Joyce","Victoria","Ruth","Virginia","Lauren","Kelly","Christina","Joan","Evelyn","Judith","Andrea","Hannah","Megan","Cheryl","Jacqueline","Martha","Madison","Teresa","Gloria","Sara","Janice","Ann","Kathryn","Abigail","Sophia","Frances","Jean","Alice","Judy","Isabella","Julia","Grace","Amber","Denise","Danielle","Marilyn","Beverly","Charlotte","Natalie","Theresa","Diana","Brittany","Doris","Kayla","Alexis","Lori","Marie","James","Robert","John","Michael","David","William","Richard","Joseph","Thomas","Christopher","Charles","Daniel","Matthew","Anthony","Mark","Donald","Steven","Andrew","Paul","Joshua","Kenneth","Kevin","Brian","George","Timothy","Ronald","Jason","Edward","Jeffrey","Ryan","Jacob","Gary","Nicholas","Eric","Jonathan","Stephen","Larry","Justin","Scott","Brandon","Benjamin","Samuel","Gregory","Alexander","Patrick","Frank","Raymond","Jack","Dennis","Jerry","Tyler","Aaron","Jose","Adam","Nathan","Henry","Zachary","Douglas","Peter","Kyle","Noah","Ethan","Jeremy","Walter","Christian","Keith","Roger","Terry","Austin","Sean","Gerald","Carl","Harold","Dylan","Arthur","Lawrence","Jordan","Jesse","Bryan","Billy","Bruce","Gabriel","Joe","Logan","Alan","Juan","Albert","Willie","Elijah","Wayne","Randy","Vincent","Mason","Roy","Ralph","Bobby","Russell","Bradley","Philip","Eugene"]};},{}],114:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var FableServiceDataGeneration=/*#__PURE__*/function(_libFableServiceBase2){_inherits(FableServiceDataGeneration,_libFableServiceBase2);var _super13=_createSuper(FableServiceDataGeneration);function FableServiceDataGeneration(pFable,pOptions,pServiceHash){var _this21;_classCallCheck2(this,FableServiceDataGeneration);_this21=_super13.call(this,pFable,pOptions,pServiceHash);_this21.serviceType='DataGeneration';_this21.defaultData=require('./Fable-Service-DataGeneration-DefaultValues.json');return _this21;}// Return a random integer between pMinimum and pMaximum
|
|
2908
3091
|
_createClass2(FableServiceDataGeneration,[{key:"randomIntegerBetween",value:function randomIntegerBetween(pMinimum,pMaximum){return Math.floor(Math.random()*(pMaximum-pMinimum))+pMinimum;}// Return a random integer up to the passed-in maximum
|
|
2909
3092
|
},{key:"randomIntegerUpTo",value:function randomIntegerUpTo(pMaximum){return this.randomIntegerBetween(0,pMaximum);}// Return a random integer between 0 and 9999999
|
|
2910
|
-
},{key:"randomInteger",value:function randomInteger(){return Math.floor(Math.random()*this.defaultData.DefaultIntegerMaximum);}},{key:"randomNumericString",value:function randomNumericString(pLength,pMaxNumber){var tmpLength=typeof pLength==='undefined'?10:pLength;var tmpMaxNumber=typeof pMaxNumber==='undefined'?Math.pow(10,tmpLength)-1:pMaxNumber;return this.services.DataFormat.stringPadStart(this.randomIntegerUpTo(tmpMaxNumber),pLength,'0');}},{key:"randomMonth",value:function randomMonth(){return this.defaultData.MonthSet[this.randomIntegerUpTo(this.defaultData.MonthSet.length-1)];}},{key:"randomDayOfWeek",value:function randomDayOfWeek(){return this.defaultData.WeekDaySet[this.randomIntegerUpTo(this.defaultData.WeekDaySet.length-1)];}},{key:"randomColor",value:function randomColor(){return this.defaultData.ColorSet[this.randomIntegerUpTo(this.defaultData.ColorSet.length-1)];}},{key:"randomName",value:function randomName(){return this.defaultData.NameSet[this.randomIntegerUpTo(this.defaultData.NameSet.length-1)];}},{key:"randomSurname",value:function randomSurname(){return this.defaultData.SurNameSet[this.randomIntegerUpTo(this.defaultData.SurNameSet.length-1)];}}]);return FableServiceDataGeneration;}(libFableServiceBase);module.exports=FableServiceDataGeneration;},{"../Fable-ServiceManager.js":108,"./Fable-Service-DataGeneration-DefaultValues.json":113}],115:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var FableServiceEnvironmentData=/*#__PURE__*/function(_libFableServiceBase3){_inherits(FableServiceEnvironmentData,_libFableServiceBase3);var
|
|
3093
|
+
},{key:"randomInteger",value:function randomInteger(){return Math.floor(Math.random()*this.defaultData.DefaultIntegerMaximum);}},{key:"randomNumericString",value:function randomNumericString(pLength,pMaxNumber){var tmpLength=typeof pLength==='undefined'?10:pLength;var tmpMaxNumber=typeof pMaxNumber==='undefined'?Math.pow(10,tmpLength)-1:pMaxNumber;return this.services.DataFormat.stringPadStart(this.randomIntegerUpTo(tmpMaxNumber),pLength,'0');}},{key:"randomMonth",value:function randomMonth(){return this.defaultData.MonthSet[this.randomIntegerUpTo(this.defaultData.MonthSet.length-1)];}},{key:"randomDayOfWeek",value:function randomDayOfWeek(){return this.defaultData.WeekDaySet[this.randomIntegerUpTo(this.defaultData.WeekDaySet.length-1)];}},{key:"randomColor",value:function randomColor(){return this.defaultData.ColorSet[this.randomIntegerUpTo(this.defaultData.ColorSet.length-1)];}},{key:"randomName",value:function randomName(){return this.defaultData.NameSet[this.randomIntegerUpTo(this.defaultData.NameSet.length-1)];}},{key:"randomSurname",value:function randomSurname(){return this.defaultData.SurNameSet[this.randomIntegerUpTo(this.defaultData.SurNameSet.length-1)];}}]);return FableServiceDataGeneration;}(libFableServiceBase);module.exports=FableServiceDataGeneration;},{"../Fable-ServiceManager.js":108,"./Fable-Service-DataGeneration-DefaultValues.json":113}],115:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var FableServiceEnvironmentData=/*#__PURE__*/function(_libFableServiceBase3){_inherits(FableServiceEnvironmentData,_libFableServiceBase3);var _super14=_createSuper(FableServiceEnvironmentData);function FableServiceEnvironmentData(pFable,pOptions,pServiceHash){var _this22;_classCallCheck2(this,FableServiceEnvironmentData);_this22=_super14.call(this,pFable,pOptions,pServiceHash);_this22.serviceType='EnvironmentData';_this22.Environment="node.js";return _this22;}return _createClass2(FableServiceEnvironmentData);}(libFableServiceBase);module.exports=FableServiceEnvironmentData;},{"../Fable-ServiceManager.js":108}],116:[function(require,module,exports){(function(process){(function(){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var libFS=require('fs');var libPath=require('path');var FableServiceFilePersistence=/*#__PURE__*/function(_libFableServiceBase4){_inherits(FableServiceFilePersistence,_libFableServiceBase4);var _super15=_createSuper(FableServiceFilePersistence);function FableServiceFilePersistence(pFable,pOptions,pServiceHash){var _this23;_classCallCheck2(this,FableServiceFilePersistence);_this23=_super15.call(this,pFable,pOptions,pServiceHash);_this23.serviceType='FilePersistence';if(!_this23.options.hasOwnProperty('Mode')){_this23.options.Mode=parseInt('0777',8)&~process.umask();}_this23.currentInputFolder="/tmp";_this23.currentOutputFolder="/tmp";return _this23;}_createClass2(FableServiceFilePersistence,[{key:"joinPath",value:function joinPath(){return libPath.resolve.apply(libPath,arguments);}},{key:"existsSync",value:function existsSync(pPath){return libFS.existsSync(pPath);}},{key:"exists",value:function exists(pPath,fCallback){var tmpFileExists=this.existsSync(pPath);;return fCallback(null,tmpFileExists);}},{key:"writeFileSync",value:function writeFileSync(pFileName,pFileContent,pOptions){var tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.writeFileSync(pFileName,pFileContent,tmpOptions);}},{key:"appendFileSync",value:function appendFileSync(pFileName,pAppendContent,pOptions){var tmpOptions=typeof pOptions==='undefined'?'utf8':pOptions;return libFS.appendFileSync(pFileName,pAppendContent,tmpOptions);}},{key:"deleteFileSync",value:function deleteFileSync(pFileName){return libFS.unlinkSync(pFileName);}},{key:"deleteFolderSync",value:function deleteFolderSync(pFileName){return libFS.rmdirSync(pFileName);}},{key:"writeFileSyncFromObject",value:function writeFileSyncFromObject(pFileName,pObject){return this.writeFileSync(pFileName,JSON.stringify(pObject,null,4));}},{key:"writeFileSyncFromArray",value:function writeFileSyncFromArray(pFileName,pFileArray){if(!Array.isArray(pFileArray)){this.log.error("File Persistence Service attempted to write ".concat(pFileName," from array but the expected array was not an array (it was a ").concat(_typeof(pFileArray),")."));return Error('Attempted to write ${pFileName} from array but the expected array was not an array (it was a ${typeof(pFileArray)}).');}else{for(var i=0;i<pFileArray.length;i++){return this.appendFileSync(pFileName,"".concat(pFileArray[i],"\n"));}}}// Default folder behaviors
|
|
2911
3094
|
},{key:"getDefaultOutputPath",value:function getDefaultOutputPath(pFileName){return libPath.join(this.currentOutputFolder,pFileName);}},{key:"dataFolderWriteSync",value:function dataFolderWriteSync(pFileName,pFileContent){return this.writeFileSync(this.getDefaultOutputPath(pFileName),pFileContent);}},{key:"dataFolderWriteSyncFromObject",value:function dataFolderWriteSyncFromObject(pFileName,pObject){return this.writeFileSyncFromObject(this.getDefaultOutputPath(pFileName),pObject);}},{key:"dataFolderWriteSyncFromArray",value:function dataFolderWriteSyncFromArray(pFileName,pFileArray){return this.writeFileSyncFromArray(this.getDefaultOutputPath(pFileName),pFileArray);}// Folder management
|
|
2912
|
-
},{key:"makeFolderRecursive",value:function makeFolderRecursive(pParameters,fCallback){var
|
|
3095
|
+
},{key:"makeFolderRecursive",value:function makeFolderRecursive(pParameters,fCallback){var _this24=this;var tmpParameters=pParameters;if(typeof pParameters=='string'){tmpParameters={Path:pParameters};}else if(_typeof(pParameters)!=='object'){fCallback(new Error('Parameters object or string not properly passed to recursive folder create.'));return false;}if(typeof tmpParameters.Path!=='string'){fCallback(new Error('Parameters object needs a path to run the folder create operation.'));return false;}if(!tmpParameters.hasOwnProperty('Mode')){tmpParameters.Mode=this.options.Mode;}// Check if we are just starting .. if so, build the initial state for our recursive function
|
|
2913
3096
|
if(typeof tmpParameters.CurrentPathIndex==='undefined'){// Build the tools to start recursing
|
|
2914
3097
|
tmpParameters.ActualPath=libPath.normalize(tmpParameters.Path);tmpParameters.ActualPathParts=tmpParameters.ActualPath.split(libPath.sep);tmpParameters.CurrentPathIndex=0;tmpParameters.CurrentPath='';}else{// This is not our first run, so we will continue the recursion.
|
|
2915
3098
|
// Build the new base path
|
|
@@ -2917,13 +3100,13 @@ if(tmpParameters.CurrentPath==libPath.sep){tmpParameters.CurrentPath=tmpParamete
|
|
|
2917
3100
|
tmpParameters.CurrentPathIndex++;}// Check if the path is fully complete
|
|
2918
3101
|
if(tmpParameters.CurrentPathIndex>=tmpParameters.ActualPathParts.length){return fCallback(null);}// Check if the path exists (and is a folder)
|
|
2919
3102
|
libFS.open(tmpParameters.CurrentPath+libPath.sep+tmpParameters.ActualPathParts[tmpParameters.CurrentPathIndex],'r',function(pError,pFileDescriptor){if(pFileDescriptor){libFS.closeSync(pFileDescriptor);}if(pError&&pError.code=='ENOENT'){/* Path doesn't exist, create it */libFS.mkdir(tmpParameters.CurrentPath+libPath.sep+tmpParameters.ActualPathParts[tmpParameters.CurrentPathIndex],tmpParameters.Mode,function(pCreateError){if(!pCreateError){// We have now created our folder and there was no error -- continue.
|
|
2920
|
-
return
|
|
2921
|
-
return
|
|
3103
|
+
return _this24.makeFolderRecursive(tmpParameters,fCallback);}else if(pCreateError.code=='EEXIST'){// The folder exists -- our dev might be running this in parallel/async/whatnot.
|
|
3104
|
+
return _this24.makeFolderRecursive(tmpParameters,fCallback);}else{console.log(pCreateError.code);return fCallback(pCreateError);}});}else{return _this24.makeFolderRecursive(tmpParameters,fCallback);}});}}]);return FableServiceFilePersistence;}(libFableServiceBase);module.exports=FableServiceFilePersistence;}).call(this);}).call(this,require('_process'));},{"../Fable-ServiceManager.js":108,"_process":69,"fs":19,"path":65}],117:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;/**
|
|
2922
3105
|
* Precedent Meta-Templating
|
|
2923
3106
|
* @author Steven Velozo <steven@velozo.com>
|
|
2924
3107
|
* @description Process text stream trie and postfix tree, parsing out meta-template expression functions.
|
|
2925
|
-
*/var libWordTree=require("./Fable-Service-MetaTemplate/MetaTemplate-WordTree.js");var libStringParser=require("./Fable-Service-MetaTemplate/MetaTemplate-StringParser.js");var FableServiceMetaTemplate=/*#__PURE__*/function(_libFableServiceBase5){_inherits(FableServiceMetaTemplate,_libFableServiceBase5);var
|
|
2926
|
-
|
|
3108
|
+
*/var libWordTree=require("./Fable-Service-MetaTemplate/MetaTemplate-WordTree.js");var libStringParser=require("./Fable-Service-MetaTemplate/MetaTemplate-StringParser.js");var FableServiceMetaTemplate=/*#__PURE__*/function(_libFableServiceBase5){_inherits(FableServiceMetaTemplate,_libFableServiceBase5);var _super16=_createSuper(FableServiceMetaTemplate);function FableServiceMetaTemplate(pFable,pOptions,pServiceHash){var _this25;_classCallCheck2(this,FableServiceMetaTemplate);_this25=_super16.call(this,pFable,pOptions,pServiceHash);_this25.serviceType='MetaTemplate';_this25.WordTree=new libWordTree();// In order to allow asynchronous template processing we need to use the async.eachLimit function
|
|
3109
|
+
_this25.StringParser=new libStringParser(_this25.fable.services.Utility.eachLimit);_this25.ParseTree=_this25.WordTree.ParseTree;return _this25;}/**
|
|
2927
3110
|
* Add a Pattern to the Parse Tree
|
|
2928
3111
|
* @method addPattern
|
|
2929
3112
|
* @param {Object} pTree - A node on the parse tree to push the characters into
|
|
@@ -2989,7 +3172,7 @@ this.resetOutputBuffer(pParserState);this.appendOutputBuffer(pCharacter,pParserS
|
|
|
2989
3172
|
* @param {string} pCharacter - The character to append
|
|
2990
3173
|
* @param {Object} pParserState - The state object for the current parsing task
|
|
2991
3174
|
* @private
|
|
2992
|
-
*/},{key:"parseCharacterAsync",value:function parseCharacterAsync(pCharacter,pParserState,pData,fCallback){var
|
|
3175
|
+
*/},{key:"parseCharacterAsync",value:function parseCharacterAsync(pCharacter,pParserState,pData,fCallback){var _this26=this;// If we are already in a pattern match traversal
|
|
2993
3176
|
if(pParserState.PatternMatch){// If the pattern is still matching the start and we haven't passed the buffer
|
|
2994
3177
|
if(!pParserState.StartPatternMatchComplete&&pParserState.Pattern.hasOwnProperty(pCharacter)){pParserState.Pattern=pParserState.Pattern[pCharacter];this.appendOutputBuffer(pCharacter,pParserState);}else if(pParserState.EndPatternMatchBegan){if(pParserState.Pattern.PatternEnd.hasOwnProperty(pCharacter)){// This leaf has a PatternEnd tree, so we will wait until that end is met.
|
|
2995
3178
|
pParserState.Pattern=pParserState.Pattern.PatternEnd[pCharacter];// Flush the output buffer.
|
|
@@ -2997,7 +3180,7 @@ this.appendOutputBuffer(pCharacter,pParserState);// If this last character is th
|
|
|
2997
3180
|
if(pParserState.Pattern.hasOwnProperty('Parse')){// ... this is the end of a pattern, cut off the end tag and parse it.
|
|
2998
3181
|
// Trim the start and end tags off the output buffer now
|
|
2999
3182
|
if(pParserState.Pattern.isAsync){// Run the function
|
|
3000
|
-
return pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,function(pError,pAsyncOutput){if(pError){console.log("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;
|
|
3183
|
+
return pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,function(pError,pAsyncOutput){if(pError){console.log("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;_this26.resetOutputBuffer(pParserState);return fCallback();});}else{// Run the t*mplate function
|
|
3001
3184
|
pParserState.OutputBuffer=pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData);this.resetOutputBuffer(pParserState);return fCallback();}}}else if(pParserState.PatternStartNode.PatternEnd.hasOwnProperty(pCharacter)){// We broke out of the end -- see if this is a new start of the end.
|
|
3002
3185
|
pParserState.Pattern=pParserState.PatternStartNode.PatternEnd[pCharacter];this.appendOutputBuffer(pCharacter,pParserState);}else{pParserState.EndPatternMatchBegan=false;this.appendOutputBuffer(pCharacter,pParserState);}}else if(pParserState.Pattern.hasOwnProperty('PatternEnd')){if(!pParserState.StartPatternMatchComplete){pParserState.StartPatternMatchComplete=true;pParserState.PatternStartNode=pParserState.Pattern;}this.appendOutputBuffer(pCharacter,pParserState);if(pParserState.Pattern.PatternEnd.hasOwnProperty(pCharacter)){// This is the first character of the end pattern.
|
|
3003
3186
|
pParserState.EndPatternMatchBegan=true;// This leaf has a PatternEnd tree, so we will wait until that end is met.
|
|
@@ -3005,7 +3188,7 @@ pParserState.Pattern=pParserState.Pattern.PatternEnd[pCharacter];// If this last
|
|
|
3005
3188
|
if(pParserState.Pattern.hasOwnProperty('Parse')){// ... this is the end of a pattern, cut off the end tag and parse it.
|
|
3006
3189
|
// Trim the start and end tags off the output buffer now
|
|
3007
3190
|
if(pParserState.Pattern.isAsync){// Run the function
|
|
3008
|
-
return pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,function(pError,pAsyncOutput){if(pError){console.log("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;
|
|
3191
|
+
return pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData,function(pError,pAsyncOutput){if(pError){console.log("Precedent ERROR: Async template error happened parsing ".concat(pParserState.Pattern.PatternStart," ... ").concat(pParserState.Pattern.PatternEnd,": ").concat(pError));}pParserState.OutputBuffer=pAsyncOutput;_this26.resetOutputBuffer(pParserState);return fCallback();});}else{// Run the t*mplate function
|
|
3009
3192
|
pParserState.OutputBuffer=pParserState.Pattern.Parse(pParserState.OutputBuffer.substr(pParserState.Pattern.PatternStartString.length,pParserState.OutputBuffer.length-(pParserState.Pattern.PatternStartString.length+pParserState.Pattern.PatternEndString.length)),pData);this.resetOutputBuffer(pParserState);return fCallback();}}}}else{// We are in a pattern start but didn't match one; reset and start trying again from this character.
|
|
3010
3193
|
this.resetOutputBuffer(pParserState);return fCallback();}}// If we aren't in a pattern match or pattern, and this isn't the start of a new pattern (RAW mode)....
|
|
3011
3194
|
if(!pParserState.PatternMatch){// This may be the start of a new pattern....
|
|
@@ -3017,10 +3200,10 @@ this.resetOutputBuffer(pParserState);this.appendOutputBuffer(pCharacter,pParserS
|
|
|
3017
3200
|
* @param {Object} pParseTree - The parse tree to begin parsing from (usually root)
|
|
3018
3201
|
* @param {Object} pData - The data to pass to the function as a second parameter
|
|
3019
3202
|
* @param {function} fCallback - The callback function to call when the parse is complete
|
|
3020
|
-
*/},{key:"parseString",value:function parseString(pString,pParseTree,pData,fCallback){var
|
|
3203
|
+
*/},{key:"parseString",value:function parseString(pString,pParseTree,pData,fCallback){var _this27=this;if(typeof fCallback!=='function'){var tmpParserState=this.newParserState(pParseTree);for(var i=0;i<pString.length;i++){// TODO: This is not fast.
|
|
3021
3204
|
this.parseCharacter(pString[i],tmpParserState,pData,fCallback);}this.flushOutputBuffer(tmpParserState);return tmpParserState.Output;}else{// This is the async mode
|
|
3022
|
-
var _tmpParserState=this.newParserState(pParseTree);_tmpParserState.Asynchronous=true;this.eachLimit(pString,1,function(pCharacter,fCharacterCallback){
|
|
3023
|
-
|
|
3205
|
+
var _tmpParserState=this.newParserState(pParseTree);_tmpParserState.Asynchronous=true;this.eachLimit(pString,1,function(pCharacter,fCharacterCallback){_this27.parseCharacterAsync(pCharacter,_tmpParserState,pData,fCharacterCallback);},function(pError){// Flush the remaining data
|
|
3206
|
+
_this27.flushOutputBuffer(_tmpParserState);fCallback(pError,_tmpParserState.Output);});}}}]);return StringParser;}();module.exports=StringParser;},{}],119:[function(require,module,exports){/**
|
|
3024
3207
|
* Word Tree
|
|
3025
3208
|
* @author Steven Velozo <steven@velozo.com>
|
|
3026
3209
|
* @description Create a tree (directed graph) of Javascript objects, one character per object.
|
|
@@ -3053,20 +3236,20 @@ for(var i=0;i<pPatternStart.length;i++){tmpLeaf=this.addChild(tmpLeaf,pPatternSt
|
|
|
3053
3236
|
* @param {string} pPatternEnd - The ending string for the pattern (e.g. "}")
|
|
3054
3237
|
* @param {function} fParser - The function to parse if this is the matched pattern, once the Pattern End is met. If this is a string, a simple replacement occurs.
|
|
3055
3238
|
* @return {bool} True if adding the pattern was successful
|
|
3056
|
-
*/},{key:"addPatternAsync",value:function addPatternAsync(pPatternStart,pPatternEnd,fParser){var tmpLeaf=this.addPattern(pPatternStart,pPatternEnd,fParser);if(tmpLeaf){tmpLeaf.isAsync=true;}}}]);return WordTree;}();module.exports=WordTree;},{}],120:[function(require,module,exports){module.exports={"Metadata":{"UUID":false,"Hash":false,"Title":"","Summary":"","Version":0},"Status":{"Completed":false,"CompletionProgress":0,"CompletionTimeElapsed":0,"Steps":1,"StepsCompleted":0,"StartTime":0,"EndTime":0},"Errors":[],"Log":[]};},{}],121:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var _OperationStatePrototypeString=JSON.stringify(require('./Fable-Service-Operation-DefaultSettings.js'));var FableOperation=/*#__PURE__*/function(_libFableServiceBase6){_inherits(FableOperation,_libFableServiceBase6);var
|
|
3057
|
-
|
|
3239
|
+
*/},{key:"addPatternAsync",value:function addPatternAsync(pPatternStart,pPatternEnd,fParser){var tmpLeaf=this.addPattern(pPatternStart,pPatternEnd,fParser);if(tmpLeaf){tmpLeaf.isAsync=true;}}}]);return WordTree;}();module.exports=WordTree;},{}],120:[function(require,module,exports){module.exports={"Metadata":{"UUID":false,"Hash":false,"Title":"","Summary":"","Version":0},"Status":{"Completed":false,"CompletionProgress":0,"CompletionTimeElapsed":0,"Steps":1,"StepsCompleted":0,"StartTime":0,"EndTime":0},"Errors":[],"Log":[]};},{}],121:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var _OperationStatePrototypeString=JSON.stringify(require('./Fable-Service-Operation-DefaultSettings.js'));var FableOperation=/*#__PURE__*/function(_libFableServiceBase6){_inherits(FableOperation,_libFableServiceBase6);var _super17=_createSuper(FableOperation);function FableOperation(pFable,pOptions,pServiceHash){var _this28;_classCallCheck2(this,FableOperation);_this28=_super17.call(this,pFable,pOptions,pServiceHash);_this28.serviceType='PhasedOperation';_this28.state=JSON.parse(_OperationStatePrototypeString);// Match the service instantiation to the operation.
|
|
3240
|
+
_this28.state.Metadata.Hash=_this28.Hash;_this28.state.Metadata.UUID=_this28.UUID;_this28.name=typeof _this28.options.Name=='string'?_this28.options.Name:"Unnamed Operation ".concat(_this28.state.Metadata.UUID);_this28.log=_assertThisInitialized(_this28);return _this28;}_createClass2(FableOperation,[{key:"writeOperationLog",value:function writeOperationLog(pLogLevel,pLogText,pLogObject){this.state.Log.push("".concat(new Date().toUTCString()," [").concat(pLogLevel,"]: ").concat(pLogText));if(_typeof(pLogObject)=='object'){this.state.Log.push(JSON.stringify(pLogObject));}}},{key:"writeOperationErrors",value:function writeOperationErrors(pLogText,pLogObject){this.state.Errors.push("".concat(pLogText));if(_typeof(pLogObject)=='object'){this.state.Errors.push(JSON.stringify(pLogObject));}}},{key:"trace",value:function trace(pLogText,pLogObject){this.writeOperationLog('TRACE',pLogText,pLogObject);this.fable.log.trace(pLogText,pLogObject);}},{key:"debug",value:function debug(pLogText,pLogObject){this.writeOperationLog('DEBUG',pLogText,pLogObject);this.fable.log.debug(pLogText,pLogObject);}},{key:"info",value:function info(pLogText,pLogObject){this.writeOperationLog('INFO',pLogText,pLogObject);this.fable.log.info(pLogText,pLogObject);}},{key:"warn",value:function warn(pLogText,pLogObject){this.writeOperationLog('WARN',pLogText,pLogObject);this.fable.log.warn(pLogText,pLogObject);}},{key:"error",value:function error(pLogText,pLogObject){this.writeOperationLog('ERROR',pLogText,pLogObject);this.writeOperationErrors(pLogText,pLogObject);this.fable.log.error(pLogText,pLogObject);}},{key:"fatal",value:function fatal(pLogText,pLogObject){this.writeOperationLog('FATAL',pLogText,pLogObject);this.writeOperationErrors(pLogText,pLogObject);this.fable.log.fatal(pLogText,pLogObject);}}]);return FableOperation;}(libFableServiceBase);module.exports=FableOperation;},{"../Fable-ServiceManager.js":108,"./Fable-Service-Operation-DefaultSettings.js":120}],122:[function(require,module,exports){(function(Buffer){(function(){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var libSimpleGet=require('simple-get');var libCookie=require('cookie');var FableServiceRestClient=/*#__PURE__*/function(_libFableServiceBase7){_inherits(FableServiceRestClient,_libFableServiceBase7);var _super18=_createSuper(FableServiceRestClient);function FableServiceRestClient(pFable,pOptions,pServiceHash){var _this29;_classCallCheck2(this,FableServiceRestClient);_this29=_super18.call(this,pFable,pOptions,pServiceHash);_this29.TraceLog=false;if(_this29.options.TraceLog||_this29.fable.TraceLog){_this29.TraceLog=true;}_this29.dataFormat=_this29.fable.services.DataFormat;_this29.serviceType='RestClient';_this29.cookie=false;// This is a function that can be overridden, to allow the management
|
|
3058
3241
|
// of the request options before they are passed to the request library.
|
|
3059
|
-
|
|
3242
|
+
_this29.prepareRequestOptions=function(pOptions){return pOptions;};return _this29;}_createClass2(FableServiceRestClient,[{key:"simpleGet",get:function get(){return libSimpleGet;}},{key:"prepareCookies",value:function prepareCookies(pRequestOptions){if(this.cookie){var tmpCookieObject=this.cookie;if(!pRequestOptions.hasOwnProperty('headers')){pRequestOptions.headers={};}var tmpCookieKeys=Object.keys(tmpCookieObject);if(tmpCookieKeys.length>0){// Only grab the first for now.
|
|
3060
3243
|
pRequestOptions.headers.cookie=libCookie.serialize(tmpCookieKeys[0],tmpCookieObject[tmpCookieKeys[0]]);}}return pRequestOptions;}},{key:"preRequest",value:function preRequest(pOptions){// Validate the options object
|
|
3061
|
-
var tmpOptions=this.prepareCookies(pOptions);return this.prepareRequestOptions(tmpOptions);}},{key:"executeChunkedRequest",value:function executeChunkedRequest(pOptions,fCallback){var
|
|
3062
|
-
if(
|
|
3063
|
-
if(
|
|
3064
|
-
if(!tmpDataBuffer){tmpDataBuffer=Buffer.from(pChunk);}else{tmpDataBuffer=Buffer.concat([tmpDataBuffer,pChunk]);}});pResponse.on('end',function(){if(
|
|
3244
|
+
var tmpOptions=this.prepareCookies(pOptions);return this.prepareRequestOptions(tmpOptions);}},{key:"executeChunkedRequest",value:function executeChunkedRequest(pOptions,fCallback){var _this30=this;var tmpOptions=this.preRequest(pOptions);tmpOptions.RequestStartTime=this.fable.log.getTimeStamp();if(this.TraceLog){this.fable.log.debug("Beginning ".concat(tmpOptions.method," request to ").concat(tmpOptions.url," at ").concat(tmpOptions.RequestStartTime));}return libSimpleGet(tmpOptions,function(pError,pResponse){if(pError){return fCallback(pError,pResponse);}if(_this30.TraceLog){var tmpConnectTime=_this30.fable.log.getTimeStamp();_this30.fable.log.debug("--> ".concat(tmpOptions.method," connected in ").concat(_this30.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpConnectTime),"ms code ").concat(pResponse.statusCode));}var tmpData='';pResponse.on('data',function(pChunk){// For JSON, the chunk is the serialized object.
|
|
3245
|
+
if(_this30.TraceLog){var tmpChunkTime=_this30.fable.log.getTimeStamp();_this30.fable.log.debug("--> ".concat(tmpOptions.method," data chunk size ").concat(pChunk.length,"b received in ").concat(_this30.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpChunkTime),"ms"));}tmpData+=pChunk;});pResponse.on('end',function(){if(_this30.TraceLog){var tmpCompletionTime=_this30.fable.log.getTimeStamp();_this30.fable.log.debug("==> ".concat(tmpOptions.method," completed data size ").concat(tmpData.length,"b received in ").concat(_this30.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpCompletionTime),"ms"));}return fCallback(pError,pResponse,tmpData);});});}},{key:"executeChunkedRequestBinary",value:function executeChunkedRequestBinary(pOptions,fCallback){var _this31=this;var tmpOptions=this.preRequest(pOptions);tmpOptions.RequestStartTime=this.fable.log.getTimeStamp();if(this.TraceLog){this.fable.log.debug("Beginning ".concat(tmpOptions.method," request to ").concat(tmpOptions.url," at ").concat(tmpOptions.RequestStartTime));}tmpOptions.json=false;tmpOptions.encoding=null;return libSimpleGet(tmpOptions,function(pError,pResponse){if(pError){return fCallback(pError,pResponse);}if(_this31.TraceLog){var tmpConnectTime=_this31.fable.log.getTimeStamp();_this31.fable.log.debug("--> ".concat(tmpOptions.method," connected in ").concat(_this31.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpConnectTime),"ms code ").concat(pResponse.statusCode));}var tmpDataBuffer=false;pResponse.on('data',function(pChunk){// For JSON, the chunk is the serialized object.
|
|
3246
|
+
if(_this31.TraceLog){var tmpChunkTime=_this31.fable.log.getTimeStamp();_this31.fable.log.debug("--> ".concat(tmpOptions.method," data chunk size ").concat(pChunk.length,"b received in ").concat(_this31.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpChunkTime),"ms"));}// TODO: Potentially create a third option that streams this to a file? So it doesn't have to hold it all in memory.
|
|
3247
|
+
if(!tmpDataBuffer){tmpDataBuffer=Buffer.from(pChunk);}else{tmpDataBuffer=Buffer.concat([tmpDataBuffer,pChunk]);}});pResponse.on('end',function(){if(_this31.TraceLog){var tmpCompletionTime=_this31.fable.log.getTimeStamp();_this31.fable.log.debug("==> ".concat(tmpOptions.method," completed data size ").concat(tmpDataBuffer.length,"b received in ").concat(_this31.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpCompletionTime),"ms"));}return fCallback(pError,pResponse,tmpDataBuffer);});});}},{key:"executeJSONRequest",value:function executeJSONRequest(pOptions,fCallback){var _this32=this;pOptions.json=true;var tmpOptions=this.preRequest(pOptions);if(!tmpOptions.hasOwnProperty('headers')){tmpOptions.headers={};}/* Automated headers break some APIs
|
|
3065
3248
|
if (!tmpOptions.headers.hasOwnProperty('Content-Type'))
|
|
3066
3249
|
{
|
|
3067
3250
|
tmpOptions.headers['Content-Type'] = 'application/json';
|
|
3068
3251
|
}
|
|
3069
|
-
*/tmpOptions.RequestStartTime=this.fable.log.getTimeStamp();if(this.TraceLog){this.fable.log.debug("Beginning ".concat(tmpOptions.method," JSON request to ").concat(tmpOptions.url," at ").concat(tmpOptions.RequestStartTime));}return libSimpleGet(tmpOptions,function(pError,pResponse){if(pError){return fCallback(pError,pResponse);}if(
|
|
3252
|
+
*/tmpOptions.RequestStartTime=this.fable.log.getTimeStamp();if(this.TraceLog){this.fable.log.debug("Beginning ".concat(tmpOptions.method," JSON request to ").concat(tmpOptions.url," at ").concat(tmpOptions.RequestStartTime));}return libSimpleGet(tmpOptions,function(pError,pResponse){if(pError){return fCallback(pError,pResponse);}if(_this32.TraceLog){var tmpConnectTime=_this32.fable.log.getTimeStamp();_this32.fable.log.debug("--> JSON ".concat(tmpOptions.method," connected in ").concat(_this32.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpConnectTime),"ms code ").concat(pResponse.statusCode));}var tmpJSONData='';pResponse.on('data',function(pChunk){if(_this32.TraceLog){var tmpChunkTime=_this32.fable.log.getTimeStamp();_this32.fable.log.debug("--> JSON ".concat(tmpOptions.method," data chunk size ").concat(pChunk.length,"b received in ").concat(_this32.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpChunkTime),"ms"));}tmpJSONData+=pChunk;});pResponse.on('end',function(){if(_this32.TraceLog){var tmpCompletionTime=_this32.fable.log.getTimeStamp();_this32.fable.log.debug("==> JSON ".concat(tmpOptions.method," completed - received in ").concat(_this32.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpCompletionTime),"ms"));}return fCallback(pError,pResponse,JSON.parse(tmpJSONData));});});}},{key:"getJSON",value:function getJSON(pOptionsOrURL,fCallback){var tmpRequestOptions=_typeof(pOptionsOrURL)=='object'?pOptionsOrURL:{};if(typeof pOptionsOrURL=='string'){tmpRequestOptions.url=pOptionsOrURL;}tmpRequestOptions.method='GET';return this.executeJSONRequest(tmpRequestOptions,fCallback);}},{key:"putJSON",value:function putJSON(pOptions,fCallback){if(_typeof(pOptions.body)!='object'){return fCallback(new Error("PUT JSON Error Invalid options object"));}pOptions.method='PUT';return this.executeJSONRequest(pOptions,fCallback);}},{key:"postJSON",value:function postJSON(pOptions,fCallback){if(_typeof(pOptions.body)!='object'){return fCallback(new Error("POST JSON Error Invalid options object"));}pOptions.method='POST';return this.executeJSONRequest(pOptions,fCallback);}},{key:"patchJSON",value:function patchJSON(pOptions,fCallback){if(_typeof(pOptions.body)!='object'){return fCallback(new Error("PATCH JSON Error Invalid options object"));}pOptions.method='PATCH';return this.executeJSONRequest(pOptions,fCallback);}},{key:"headJSON",value:function headJSON(pOptions,fCallback){if(_typeof(pOptions.body)!='object'){return fCallback(new Error("HEAD JSON Error Invalid options object"));}pOptions.method='HEAD';return this.executeJSONRequest(pOptions,fCallback);}},{key:"delJSON",value:function delJSON(pOptions,fCallback){pOptions.method='DELETE';return this.executeJSONRequest(pOptions,fCallback);}},{key:"getRawText",value:function getRawText(pOptionsOrURL,fCallback){var tmpRequestOptions=_typeof(pOptionsOrURL)=='object'?pOptionsOrURL:{};if(typeof pOptionsOrURL=='string'){tmpRequestOptions.url=pOptionsOrURL;}tmpRequestOptions.method='GET';return this.executeChunkedRequest(tmpRequestOptions,fCallback);}}]);return FableServiceRestClient;}(libFableServiceBase);module.exports=FableServiceRestClient;}).call(this);}).call(this,require("buffer").Buffer);},{"../Fable-ServiceManager.js":108,"buffer":20,"cookie":27,"simple-get":82}],123:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var FableServiceTemplate=/*#__PURE__*/function(_libFableServiceBase8){_inherits(FableServiceTemplate,_libFableServiceBase8);var _super19=_createSuper(FableServiceTemplate);// Underscore and lodash have a behavior, _.template, which compiles a
|
|
3070
3253
|
// string-based template with code snippets into simple executable pieces,
|
|
3071
3254
|
// with the added twist of returning a precompiled function ready to go.
|
|
3072
3255
|
//
|
|
@@ -3075,19 +3258,19 @@ if(!tmpDataBuffer){tmpDataBuffer=Buffer.from(pChunk);}else{tmpDataBuffer=Buffer.
|
|
|
3075
3258
|
//
|
|
3076
3259
|
// This is an implementation of that.
|
|
3077
3260
|
// TODO: Make this use precedent, add configuration, add debugging.
|
|
3078
|
-
function FableServiceTemplate(pFable,pOptions,pServiceHash){var
|
|
3261
|
+
function FableServiceTemplate(pFable,pOptions,pServiceHash){var _this33;_classCallCheck2(this,FableServiceTemplate);_this33=_super19.call(this,pFable,pOptions,pServiceHash);_this33.serviceType='Template';// These are the exact regex's used in lodash/underscore
|
|
3079
3262
|
// TODO: Switch this to precedent
|
|
3080
|
-
|
|
3263
|
+
_this33.Matchers={Evaluate:/<%([\s\S]+?)%>/g,Interpolate:/<%=([\s\S]+?)%>/g,Escaper:/\\|'|\r|\n|\t|\u2028|\u2029/g,Unescaper:/\\(\\|'|r|n|t|u2028|u2029)/g,// This is how underscore does it, so we are keeping it for now.
|
|
3081
3264
|
GuaranteedNonMatch:/.^/};// This is a helper for the escaper and unescaper functions.
|
|
3082
3265
|
// Right now we are going to keep what underscore is doing, but, not forever.
|
|
3083
|
-
|
|
3266
|
+
_this33.templateEscapes={'\\':'\\',"'":"'",'r':'\r','\r':'r','n':'\n','\n':'n','t':'\t','\t':'t','u2028':"\u2028","\u2028":'u2028','u2029':"\u2029","\u2029":'u2029'};// This is defined as such to underscore that it is a dynamic programming
|
|
3084
3267
|
// function on this class.
|
|
3085
|
-
|
|
3268
|
+
_this33.renderFunction=false;_this33.templateString=false;return _this33;}_createClass2(FableServiceTemplate,[{key:"renderTemplate",value:function renderTemplate(pData){return this.renderFunction(pData);}},{key:"templateFunction",value:function templateFunction(pData){var fRenderTemplateBound=this.renderTemplate.bind(this);return fRenderTemplateBound;}},{key:"buildTemplateFunction",value:function buildTemplateFunction(pTemplateText,pData){var _this34=this;// For now this is being kept in a weird form ... this is to mimic the old
|
|
3086
3269
|
// underscore code until this is rewritten using precedent.
|
|
3087
|
-
this.TemplateSource="__p+='"+pTemplateText.replace(this.Matchers.Escaper,function(pMatch){return"\\".concat(
|
|
3270
|
+
this.TemplateSource="__p+='"+pTemplateText.replace(this.Matchers.Escaper,function(pMatch){return"\\".concat(_this34.templateEscapes[pMatch]);}).replace(this.Matchers.Interpolate||this.Matchers.GuaranteedNonMatch,function(pMatch,pCode){return"'+\n(".concat(decodeURIComponent(pCode),")+\n'");}).replace(this.Matchers.Evaluate||this.Matchers.GuaranteedNonMatch,function(pMatch,pCode){return"';\n".concat(decodeURIComponent(pCode),"\n;__p+='");})+"';\n";this.TemplateSource="with(pTemplateDataObject||{}){\n".concat(this.TemplateSource,"}\n");this.TemplateSource="var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n".concat(this.TemplateSource,"return __p;\n");this.renderFunction=new Function('pTemplateDataObject',this.TemplateSource);if(typeof pData!='undefined'){return this.renderFunction(pData);}// Provide the compiled function source as a convenience for build time
|
|
3088
3271
|
// precompilation.
|
|
3089
3272
|
this.TemplateSourceCompiled='function(obj){\n'+this.TemplateSource+'}';return this.templateFunction();}}]);return FableServiceTemplate;}(libFableServiceBase);module.exports=FableServiceTemplate;},{"../Fable-ServiceManager.js":108}],124:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;// TODO: These are still pretty big -- consider the smaller polyfills
|
|
3090
|
-
var libAsyncWaterfall=require('async.waterfall');var libAsyncEachLimit=require('async.eachlimit');var
|
|
3273
|
+
var libAsyncWaterfall=require('async.waterfall');var libAsyncEachLimit=require('async.eachlimit');var libBigNumber=require('big.js');var FableServiceUtility=/*#__PURE__*/function(_libFableServiceBase9){_inherits(FableServiceUtility,_libFableServiceBase9);var _super20=_createSuper(FableServiceUtility);// Underscore and lodash have a behavior, _.template, which compiles a
|
|
3091
3274
|
// string-based template with code snippets into simple executable pieces,
|
|
3092
3275
|
// with the added twist of returning a precompiled function ready to go.
|
|
3093
3276
|
//
|
|
@@ -3096,8 +3279,8 @@ var libAsyncWaterfall=require('async.waterfall');var libAsyncEachLimit=require('
|
|
|
3096
3279
|
//
|
|
3097
3280
|
// This is an implementation of that.
|
|
3098
3281
|
// TODO: Make this use precedent, add configuration, add debugging.
|
|
3099
|
-
function FableServiceUtility(pFable,pOptions,pServiceHash){var
|
|
3100
|
-
|
|
3282
|
+
function FableServiceUtility(pFable,pOptions,pServiceHash){var _this35;_classCallCheck2(this,FableServiceUtility);_this35=_super20.call(this,pFable,pOptions,pServiceHash);_this35.templates={};// These two functions are used extensively throughout
|
|
3283
|
+
_this35.waterfall=libAsyncWaterfall;_this35.eachLimit=libAsyncEachLimit;_this35.bigNumber=libBigNumber;return _this35;}// Underscore and lodash have a behavior, _.extend, which merges objects.
|
|
3101
3284
|
// Now that es6 gives us this, use the native thingy.
|
|
3102
3285
|
// Nevermind, the native thing is not stable enough across environments
|
|
3103
3286
|
// Basic shallow copy
|
|
@@ -3140,4 +3323,4 @@ tmpTimeZoneOffsetInHours=parseInt(tmpDateParts[7])+tmpTimeZoneOffsetInMinutes;//
|
|
|
3140
3323
|
if(pISOString.substr(-6,1)=="+"){// Make the offset negative since the hours will need to be subtracted from the date.
|
|
3141
3324
|
tmpTimeZoneOffsetInHours*=-1;}}// Get the current hours for the date and add the offset to get the correct time adjusted for timezone.
|
|
3142
3325
|
tmpReturnDate.setHours(tmpReturnDate.getHours()+tmpTimeZoneOffsetInHours);// Return the Date object calculated from the string.
|
|
3143
|
-
return tmpReturnDate;}}]);return FableServiceUtility;}(libFableServiceBase);module.exports=FableServiceUtility;},{"../Fable-ServiceManager.js":108,"async.eachlimit":1,"async.waterfall":15,"js
|
|
3326
|
+
return tmpReturnDate;}}]);return FableServiceUtility;}(libFableServiceBase);module.exports=FableServiceUtility;},{"../Fable-ServiceManager.js":108,"async.eachlimit":1,"async.waterfall":15,"big.js":17}]},{},[109])(109);});
|