fable 3.0.17 → 3.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fable.js +115 -105
- package/dist/fable.min.js +4 -4
- package/dist/fable.min.js.map +1 -1
- package/package.json +1 -1
package/dist/fable.js
CHANGED
|
@@ -2094,6 +2094,7 @@
|
|
|
2094
2094
|
class FableOperation {
|
|
2095
2095
|
constructor(pFable, pOperationName, pOperationHash) {
|
|
2096
2096
|
this.fable = pFable;
|
|
2097
|
+
this.name = pOperationName;
|
|
2097
2098
|
this.state = JSON.parse(_OperationStatePrototype);
|
|
2098
2099
|
this.state.Metadata.GUID = this.fable.getUUID();
|
|
2099
2100
|
this.state.Metadata.Hash = this.state.GUID;
|
|
@@ -2152,93 +2153,8 @@
|
|
|
2152
2153
|
module.exports = FableOperation;
|
|
2153
2154
|
}, {}],
|
|
2154
2155
|
36: [function (require, module, exports) {
|
|
2155
|
-
/**
|
|
2156
|
-
* Fable Application Services Management
|
|
2157
|
-
* @license MIT
|
|
2158
|
-
* @author <steven@velozo.com>
|
|
2159
|
-
*/
|
|
2160
|
-
|
|
2161
2156
|
const libFableServiceBase = require('./Fable-ServiceProviderBase.js');
|
|
2162
|
-
class
|
|
2163
|
-
constructor(pFable) {
|
|
2164
|
-
this.fable = pFable;
|
|
2165
|
-
this.serviceTypes = [];
|
|
2166
|
-
|
|
2167
|
-
// A map of instantiated services
|
|
2168
|
-
this.services = {};
|
|
2169
|
-
|
|
2170
|
-
// A map of the default instantiated service by type
|
|
2171
|
-
this.defaultServices = {};
|
|
2172
|
-
|
|
2173
|
-
// A map of class constructors for services
|
|
2174
|
-
this.serviceClasses = {};
|
|
2175
|
-
}
|
|
2176
|
-
addServiceType(pServiceType, pServiceClass) {
|
|
2177
|
-
// Add the type to the list of types
|
|
2178
|
-
this.serviceTypes.push(pServiceType);
|
|
2179
|
-
|
|
2180
|
-
// Add the container for instantiated services to go in
|
|
2181
|
-
this.services[pServiceType] = {};
|
|
2182
|
-
if (typeof pServiceClass == 'object' && pServiceClass.prototype instanceof libFableServiceBase) {
|
|
2183
|
-
// Add the class to the list of classes
|
|
2184
|
-
this.serviceClasses[pServiceType] = pServiceClass;
|
|
2185
|
-
} else {
|
|
2186
|
-
// Add the base class to the list of classes
|
|
2187
|
-
this.serviceClasses[pServiceType] = libFableServiceBase;
|
|
2188
|
-
}
|
|
2189
|
-
}
|
|
2190
|
-
instantiateServiceProvider(pServiceType, pOptions, pCustomServiceHash) {
|
|
2191
|
-
// Instantiate the service
|
|
2192
|
-
let tmpService = new this.serviceClasses[pServiceType](this.fable, pOptions, pCustomServiceHash);
|
|
2193
|
-
|
|
2194
|
-
// Add the service to the service map
|
|
2195
|
-
this.services[pServiceType][tmpService.Hash] = tmpService;
|
|
2196
|
-
|
|
2197
|
-
// If this is the first service of this type, make it the default
|
|
2198
|
-
if (!this.defaultServices.hasOwnProperty(pServiceType)) {
|
|
2199
|
-
this.defaultServices[pServiceType] = tmpService;
|
|
2200
|
-
}
|
|
2201
|
-
return tmpService;
|
|
2202
|
-
}
|
|
2203
|
-
setDefaultServiceInstantiation(pServiceType, pServiceHash) {
|
|
2204
|
-
if (this.services[pServiceType].hasOwnProperty(pServiceHash)) {
|
|
2205
|
-
this.defaultServices[pServiceType] = this.services[pServiceType][pServiceHash];
|
|
2206
|
-
return true;
|
|
2207
|
-
}
|
|
2208
|
-
return false;
|
|
2209
|
-
}
|
|
2210
|
-
getServiceByHash(pServiceHash) {
|
|
2211
|
-
if (this.services.hasOwnProperty(pServiceHash)) {
|
|
2212
|
-
return this.services[pServiceHash];
|
|
2213
|
-
}
|
|
2214
|
-
return false;
|
|
2215
|
-
}
|
|
2216
|
-
}
|
|
2217
|
-
module.exports = FableService;
|
|
2218
|
-
module.exports.FableServiceBase = libFableServiceBase;
|
|
2219
|
-
}, {
|
|
2220
|
-
"./Fable-ServiceProviderBase.js": 37
|
|
2221
|
-
}],
|
|
2222
|
-
37: [function (require, module, exports) {
|
|
2223
|
-
/**
|
|
2224
|
-
* Fable Service Base
|
|
2225
|
-
* @license MIT
|
|
2226
|
-
* @author <steven@velozo.com>
|
|
2227
|
-
*/
|
|
2228
|
-
|
|
2229
|
-
class FableServiceProviderBase {
|
|
2230
|
-
constructor(pFable, pOptions, pServiceHash) {
|
|
2231
|
-
this.fable = pFable;
|
|
2232
|
-
this.options = pOptions;
|
|
2233
|
-
this.serviceType = 'Unknown';
|
|
2234
|
-
this.UUID = pFable.getUUID();
|
|
2235
|
-
this.Hash = typeof pServiceHash === 'string' ? pServiceHash : `${this.UUID}`;
|
|
2236
|
-
}
|
|
2237
|
-
}
|
|
2238
|
-
module.exports = FableServiceProviderBase;
|
|
2239
|
-
}, {}],
|
|
2240
|
-
38: [function (require, module, exports) {
|
|
2241
|
-
class FableUtility {
|
|
2157
|
+
class FableServiceTemplate extends libFableServiceBase {
|
|
2242
2158
|
// Underscore and lodash have a behavior, _.template, which compiles a
|
|
2243
2159
|
// string-based template with code snippets into simple executable pieces,
|
|
2244
2160
|
// with the added twist of returning a precompiled function ready to go.
|
|
@@ -2248,8 +2164,9 @@
|
|
|
2248
2164
|
//
|
|
2249
2165
|
// This is an implementation of that.
|
|
2250
2166
|
// TODO: Make this use precedent, add configuration, add debugging.
|
|
2251
|
-
constructor(pFable,
|
|
2252
|
-
|
|
2167
|
+
constructor(pFable, pOptions, pServiceHash) {
|
|
2168
|
+
super(pFable, pOptions, pServiceHash);
|
|
2169
|
+
this.serviceType = 'Template';
|
|
2253
2170
|
|
|
2254
2171
|
// These are the exact regex's used in lodash/underscore
|
|
2255
2172
|
// TODO: Switch this to precedent
|
|
@@ -2281,15 +2198,8 @@
|
|
|
2281
2198
|
|
|
2282
2199
|
// This is defined as such to underscore that it is a dynamic programming
|
|
2283
2200
|
// function on this class.
|
|
2284
|
-
this.renderFunction =
|
|
2285
|
-
|
|
2286
|
-
};
|
|
2287
|
-
}
|
|
2288
|
-
|
|
2289
|
-
// Underscore and lodash have a behavior, _.extend, which merges objects.
|
|
2290
|
-
// Now that es6 gives us this, use the native thingy.
|
|
2291
|
-
extend(pDestinationObject, ...pSourceObjects) {
|
|
2292
|
-
return Object.assign(pDestinationObject, ...pSourceObjects);
|
|
2201
|
+
this.renderFunction = false;
|
|
2202
|
+
this.templateString = false;
|
|
2293
2203
|
}
|
|
2294
2204
|
renderTemplate(pData) {
|
|
2295
2205
|
return this.renderFunction(pData);
|
|
@@ -2321,16 +2231,105 @@
|
|
|
2321
2231
|
return this.templateFunction();
|
|
2322
2232
|
}
|
|
2323
2233
|
}
|
|
2324
|
-
module.exports =
|
|
2234
|
+
module.exports = FableServiceTemplate;
|
|
2235
|
+
}, {
|
|
2236
|
+
"./Fable-ServiceProviderBase.js": 38
|
|
2237
|
+
}],
|
|
2238
|
+
37: [function (require, module, exports) {
|
|
2239
|
+
/**
|
|
2240
|
+
* Fable Application Services Management
|
|
2241
|
+
* @license MIT
|
|
2242
|
+
* @author <steven@velozo.com>
|
|
2243
|
+
*/
|
|
2244
|
+
|
|
2245
|
+
const libFableServiceBase = require('./Fable-ServiceProviderBase.js');
|
|
2246
|
+
class FableService {
|
|
2247
|
+
constructor(pFable) {
|
|
2248
|
+
this.fable = pFable;
|
|
2249
|
+
this.serviceTypes = [];
|
|
2250
|
+
|
|
2251
|
+
// A map of instantiated services
|
|
2252
|
+
this.services = {};
|
|
2253
|
+
|
|
2254
|
+
// A map of the default instantiated service by type
|
|
2255
|
+
this.defaultServices = {};
|
|
2256
|
+
|
|
2257
|
+
// A map of class constructors for services
|
|
2258
|
+
this.serviceClasses = {};
|
|
2259
|
+
}
|
|
2260
|
+
addServiceType(pServiceType, pServiceClass) {
|
|
2261
|
+
// Add the type to the list of types
|
|
2262
|
+
this.serviceTypes.push(pServiceType);
|
|
2263
|
+
|
|
2264
|
+
// Add the container for instantiated services to go in
|
|
2265
|
+
this.services[pServiceType] = {};
|
|
2266
|
+
if (typeof pServiceClass == 'function' && pServiceClass.prototype instanceof libFableServiceBase) {
|
|
2267
|
+
// Add the class to the list of classes
|
|
2268
|
+
this.serviceClasses[pServiceType] = pServiceClass;
|
|
2269
|
+
} else {
|
|
2270
|
+
// Add the base class to the list of classes
|
|
2271
|
+
this.serviceClasses[pServiceType] = libFableServiceBase;
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2274
|
+
instantiateServiceProvider(pServiceType, pOptions, pCustomServiceHash) {
|
|
2275
|
+
// Instantiate the service
|
|
2276
|
+
let tmpService = this.instantiateServiceProviderWithoutRegistration(pServiceType, pOptions, pCustomServiceHash);
|
|
2277
|
+
|
|
2278
|
+
// Add the service to the service map
|
|
2279
|
+
this.services[pServiceType][tmpService.Hash] = tmpService;
|
|
2280
|
+
|
|
2281
|
+
// If this is the first service of this type, make it the default
|
|
2282
|
+
if (!this.defaultServices.hasOwnProperty(pServiceType)) {
|
|
2283
|
+
this.defaultServices[pServiceType] = tmpService;
|
|
2284
|
+
}
|
|
2285
|
+
return tmpService;
|
|
2286
|
+
}
|
|
2287
|
+
|
|
2288
|
+
// Create a service provider but don't register it to live forever in fable.services
|
|
2289
|
+
instantiateServiceProviderWithoutRegistration(pServiceType, pOptions, pCustomServiceHash) {
|
|
2290
|
+
// Instantiate the service
|
|
2291
|
+
let tmpService = new this.serviceClasses[pServiceType](this.fable, pOptions, pCustomServiceHash);
|
|
2292
|
+
return tmpService;
|
|
2293
|
+
}
|
|
2294
|
+
setDefaultServiceInstantiation(pServiceType, pServiceHash) {
|
|
2295
|
+
if (this.services[pServiceType].hasOwnProperty(pServiceHash)) {
|
|
2296
|
+
this.defaultServices[pServiceType] = this.services[pServiceType][pServiceHash];
|
|
2297
|
+
return true;
|
|
2298
|
+
}
|
|
2299
|
+
return false;
|
|
2300
|
+
}
|
|
2301
|
+
}
|
|
2302
|
+
module.exports = FableService;
|
|
2303
|
+
module.exports.ServiceProviderBase = libFableServiceBase;
|
|
2304
|
+
}, {
|
|
2305
|
+
"./Fable-ServiceProviderBase.js": 38
|
|
2306
|
+
}],
|
|
2307
|
+
38: [function (require, module, exports) {
|
|
2308
|
+
/**
|
|
2309
|
+
* Fable Service Base
|
|
2310
|
+
* @license MIT
|
|
2311
|
+
* @author <steven@velozo.com>
|
|
2312
|
+
*/
|
|
2313
|
+
|
|
2314
|
+
class FableServiceProviderBase {
|
|
2315
|
+
constructor(pFable, pOptions, pServiceHash) {
|
|
2316
|
+
this.fable = pFable;
|
|
2317
|
+
this.options = typeof pOptions === 'object' ? pOptions : {};
|
|
2318
|
+
this.serviceType = 'Unknown';
|
|
2319
|
+
this.UUID = pFable.getUUID();
|
|
2320
|
+
this.Hash = typeof pServiceHash === 'string' ? pServiceHash : `${this.UUID}`;
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
module.exports = FableServiceProviderBase;
|
|
2325
2324
|
}, {}],
|
|
2326
2325
|
39: [function (require, module, exports) {
|
|
2327
|
-
const libFableUtilityTemplate = require('./Fable-Utility-Template.js');
|
|
2328
2326
|
// TODO: These are still pretty big -- consider the smaller polyfills
|
|
2329
2327
|
const libAsyncWaterfall = require('async.waterfall');
|
|
2330
|
-
const libAsyncEachLimit = require('async.
|
|
2328
|
+
const libAsyncEachLimit = require('async.eachlimit');
|
|
2331
2329
|
class FableUtility {
|
|
2332
2330
|
constructor(pFable) {
|
|
2333
2331
|
this.fable = pFable;
|
|
2332
|
+
this.templates = {};
|
|
2334
2333
|
|
|
2335
2334
|
// These two functions are used extensively throughout
|
|
2336
2335
|
this.waterfall = libAsyncWaterfall;
|
|
@@ -2347,10 +2346,17 @@
|
|
|
2347
2346
|
// string-based template with code snippets into simple executable pieces,
|
|
2348
2347
|
// with the added twist of returning a precompiled function ready to go.
|
|
2349
2348
|
template(pTemplateText, pData) {
|
|
2350
|
-
let tmpTemplate =
|
|
2349
|
+
let tmpTemplate = this.fable.serviceManager.instantiateServiceProviderWithoutRegistration('Template');
|
|
2351
2350
|
return tmpTemplate.buildTemplateFunction(pTemplateText, pData);
|
|
2352
2351
|
}
|
|
2353
2352
|
|
|
2353
|
+
// Build a template function from a template hash, and, register it with the service provider
|
|
2354
|
+
buildHashedTemplate(pTemplateHash, pTemplateText, pData) {
|
|
2355
|
+
let tmpTemplate = this.fable.serviceManager.instantiateServiceProvider('Template', {}, pTemplateHash);
|
|
2356
|
+
this.templates[pTemplateHash] = tmpTemplate.buildTemplateFunction(pTemplateText, pData);
|
|
2357
|
+
return this.templates[pTemplateHash];
|
|
2358
|
+
}
|
|
2359
|
+
|
|
2354
2360
|
// This is a safe, modern version of chunk from underscore
|
|
2355
2361
|
// Algorithm pulled from a mix of these two polyfills:
|
|
2356
2362
|
// https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_chunk
|
|
@@ -2372,8 +2378,7 @@
|
|
|
2372
2378
|
}
|
|
2373
2379
|
module.exports = FableUtility;
|
|
2374
2380
|
}, {
|
|
2375
|
-
"
|
|
2376
|
-
"async.eachLimit": 1,
|
|
2381
|
+
"async.eachlimit": 1,
|
|
2377
2382
|
"async.waterfall": 15
|
|
2378
2383
|
}],
|
|
2379
2384
|
40: [function (require, module, exports) {
|
|
@@ -2387,6 +2392,7 @@
|
|
|
2387
2392
|
const libFableLog = require('fable-log');
|
|
2388
2393
|
const libFableUtility = require('./Fable-Utility.js');
|
|
2389
2394
|
const libFableServiceManager = require('./Fable-ServiceManager.js');
|
|
2395
|
+
const libFableServiceTemplate = require('./Fable-Service-Template.js');
|
|
2390
2396
|
const libFableOperation = require('./Fable-Operation.js');
|
|
2391
2397
|
class Fable {
|
|
2392
2398
|
constructor(pSettings) {
|
|
@@ -2409,6 +2415,9 @@
|
|
|
2409
2415
|
// Location for Operation state
|
|
2410
2416
|
this.Operations = {};
|
|
2411
2417
|
this.serviceManager = new libFableServiceManager(this);
|
|
2418
|
+
this.serviceManager.addServiceType('Template', libFableServiceTemplate);
|
|
2419
|
+
this.services = this.serviceManager.services;
|
|
2420
|
+
this.defaultServices = this.serviceManager.defaultServices;
|
|
2412
2421
|
}
|
|
2413
2422
|
get settings() {
|
|
2414
2423
|
return this.settingsManager.settings;
|
|
@@ -2433,7 +2442,7 @@
|
|
|
2433
2442
|
if (!this.Operations.hasOwnProperty(pOperationHash)) {
|
|
2434
2443
|
return false;
|
|
2435
2444
|
} else {
|
|
2436
|
-
return this.
|
|
2445
|
+
return this.Operations[pOperationHash];
|
|
2437
2446
|
}
|
|
2438
2447
|
}
|
|
2439
2448
|
}
|
|
@@ -2449,7 +2458,8 @@
|
|
|
2449
2458
|
module.exports.precedent = libFableSettings.precedent;
|
|
2450
2459
|
}, {
|
|
2451
2460
|
"./Fable-Operation.js": 35,
|
|
2452
|
-
"./Fable-
|
|
2461
|
+
"./Fable-Service-Template.js": 36,
|
|
2462
|
+
"./Fable-ServiceManager.js": 37,
|
|
2453
2463
|
"./Fable-Utility.js": 39,
|
|
2454
2464
|
"fable-log": 22,
|
|
2455
2465
|
"fable-settings": 25,
|
package/dist/fable.min.js
CHANGED
|
@@ -90,23 +90,23 @@ class{constructor(){}newParserState(t){return{ParseTree:t,Output:"",OutputBuffer
|
|
|
90
90
|
*
|
|
91
91
|
* @description Create a tree (directed graph) of Javascript objects, one character per object.
|
|
92
92
|
*/
|
|
93
|
-
class{constructor(){this.ParseTree={}}addChild(t,e,r){return t.hasOwnProperty(e[r])||(t[e[r]]={}),t[e[r]]}addPattern(t,e,r){if(t.length<1)return!1;if("string"==typeof e&&e.length<1)return!1;let n=this.ParseTree;for(var i=0;i<t.length;i++)n=this.addChild(n,t,i);return n.PatternStart=t,n.PatternEnd="string"==typeof e&&e.length>0?e:t,n.Parse="function"==typeof r?r:"string"==typeof r?()=>r:t=>t,!0}}},{}],32:[function(t,e,r){var n,i,s=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function l(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(t){i=a}}();var u,c=[],h=!1,f=-1;function g(){h&&u&&(h=!1,u.length?c=u.concat(c):f=-1,c.length&&p())}function p(){if(!h){var t=l(g);h=!0;for(var e=c.length;e;){for(u=c,c=[];++f<e;)u&&u[f].run();f=-1,e=c.length}u=null,h=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===a||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{return i(t)}catch(e){try{return i.call(null,t)}catch(e){return i.call(this,t)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function m(){}s.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new d(t,e)),1!==c.length||h||l(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=m,s.addListener=m,s.once=m,s.off=m,s.removeListener=m,s.removeAllListeners=m,s.emit=m,s.prependListener=m,s.prependOnceListener=m,s.listeners=function(t){return[]},s.binding=function(t){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(t){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},{}],33:[function(t,e,r){(function(e,n){(function(){var i=t("process/browser.js").nextTick,s=Function.prototype.apply,o=Array.prototype.slice,a={},l=0;function u(t,e){this._id=t,this._clearFn=e}r.setTimeout=function(){return new u(s.call(setTimeout,window,arguments),clearTimeout)},r.setInterval=function(){return new u(s.call(setInterval,window,arguments),clearInterval)},r.clearTimeout=r.clearInterval=function(t){t.close()},u.prototype.unref=u.prototype.ref=function(){},u.prototype.close=function(){this._clearFn.call(window,this._id)},r.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},r.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},r._unrefActive=r.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r.setImmediate="function"==typeof e?e:function(t){var e=l++,n=!(arguments.length<2)&&o.call(arguments,1);return a[e]=!0,i((function(){a[e]&&(n?t.apply(null,n):t.call(null),r.clearImmediate(e))})),e},r.clearImmediate="function"==typeof n?n:function(t){delete a[t]}}).call(this)}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":32,timers:33}],34:[function(t,e,r){var n=t("./Fable.js");"object"!=typeof window||window.hasOwnProperty("Fable")||(window.Fable=n),e.exports=n},{"./Fable.js":40}],35:[function(t,e,r){const n=JSON.stringify({Metadata:{GUID:!1,Hash:!1,Title:"",Summary:"",Version:0},Status:{Completed:!1,CompletionProgress:0,CompletionTimeElapsed:0,Steps:1,StepsCompleted:0,StartTime:0,EndTime:0},Errors:[],Log:[]});e.exports=class{constructor(t,e,r){this.fable=t,this.state=JSON.parse(n),this.state.Metadata.GUID=this.fable.getUUID(),this.state.Metadata.Hash=this.state.GUID,"string"==typeof r&&(this.state.Metadata.Hash=r)}get GUID(){return this.state.Metadata.GUID}get Hash(){return this.state.Metadata.Hash}get log(){return this}writeOperationLog(t,e,r){this.state.Log.push(`${(new Date).toUTCString()} [${t}]: ${e}`),"object"==typeof r&&this.state.Log.push(JSON.stringify(r))}writeOperationErrors(t,e){this.state.Errors.push(`${t}`),"object"==typeof e&&this.state.Errors.push(JSON.stringify(e))}trace(t,e){this.writeOperationLog("TRACE",t,e),this.fable.log.trace(t,e)}debug(t,e){this.writeOperationLog("DEBUG",t,e),this.fable.log.debug(t,e)}info(t,e){this.writeOperationLog("INFO",t,e),this.fable.log.info(t,e)}warn(t,e){this.writeOperationLog("WARN",t,e),this.fable.log.warn(t,e)}error(t,e){this.writeOperationLog("ERROR",t,e),this.writeOperationErrors(t,e),this.fable.log.error(t,e)}fatal(t,e){this.writeOperationLog("FATAL",t,e),this.writeOperationErrors(t,e),this.fable.log.fatal(t,e)}}},{}],36:[function(t,e,r){
|
|
93
|
+
class{constructor(){this.ParseTree={}}addChild(t,e,r){return t.hasOwnProperty(e[r])||(t[e[r]]={}),t[e[r]]}addPattern(t,e,r){if(t.length<1)return!1;if("string"==typeof e&&e.length<1)return!1;let n=this.ParseTree;for(var i=0;i<t.length;i++)n=this.addChild(n,t,i);return n.PatternStart=t,n.PatternEnd="string"==typeof e&&e.length>0?e:t,n.Parse="function"==typeof r?r:"string"==typeof r?()=>r:t=>t,!0}}},{}],32:[function(t,e,r){var n,i,s=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function l(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(t){i=a}}();var u,c=[],h=!1,f=-1;function g(){h&&u&&(h=!1,u.length?c=u.concat(c):f=-1,c.length&&p())}function p(){if(!h){var t=l(g);h=!0;for(var e=c.length;e;){for(u=c,c=[];++f<e;)u&&u[f].run();f=-1,e=c.length}u=null,h=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===a||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{return i(t)}catch(e){try{return i.call(null,t)}catch(e){return i.call(this,t)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function m(){}s.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new d(t,e)),1!==c.length||h||l(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=m,s.addListener=m,s.once=m,s.off=m,s.removeListener=m,s.removeAllListeners=m,s.emit=m,s.prependListener=m,s.prependOnceListener=m,s.listeners=function(t){return[]},s.binding=function(t){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(t){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},{}],33:[function(t,e,r){(function(e,n){(function(){var i=t("process/browser.js").nextTick,s=Function.prototype.apply,o=Array.prototype.slice,a={},l=0;function u(t,e){this._id=t,this._clearFn=e}r.setTimeout=function(){return new u(s.call(setTimeout,window,arguments),clearTimeout)},r.setInterval=function(){return new u(s.call(setInterval,window,arguments),clearInterval)},r.clearTimeout=r.clearInterval=function(t){t.close()},u.prototype.unref=u.prototype.ref=function(){},u.prototype.close=function(){this._clearFn.call(window,this._id)},r.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},r.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},r._unrefActive=r.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r.setImmediate="function"==typeof e?e:function(t){var e=l++,n=!(arguments.length<2)&&o.call(arguments,1);return a[e]=!0,i((function(){a[e]&&(n?t.apply(null,n):t.call(null),r.clearImmediate(e))})),e},r.clearImmediate="function"==typeof n?n:function(t){delete a[t]}}).call(this)}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":32,timers:33}],34:[function(t,e,r){var n=t("./Fable.js");"object"!=typeof window||window.hasOwnProperty("Fable")||(window.Fable=n),e.exports=n},{"./Fable.js":40}],35:[function(t,e,r){const n=JSON.stringify({Metadata:{GUID:!1,Hash:!1,Title:"",Summary:"",Version:0},Status:{Completed:!1,CompletionProgress:0,CompletionTimeElapsed:0,Steps:1,StepsCompleted:0,StartTime:0,EndTime:0},Errors:[],Log:[]});e.exports=class{constructor(t,e,r){this.fable=t,this.name=e,this.state=JSON.parse(n),this.state.Metadata.GUID=this.fable.getUUID(),this.state.Metadata.Hash=this.state.GUID,"string"==typeof r&&(this.state.Metadata.Hash=r)}get GUID(){return this.state.Metadata.GUID}get Hash(){return this.state.Metadata.Hash}get log(){return this}writeOperationLog(t,e,r){this.state.Log.push(`${(new Date).toUTCString()} [${t}]: ${e}`),"object"==typeof r&&this.state.Log.push(JSON.stringify(r))}writeOperationErrors(t,e){this.state.Errors.push(`${t}`),"object"==typeof e&&this.state.Errors.push(JSON.stringify(e))}trace(t,e){this.writeOperationLog("TRACE",t,e),this.fable.log.trace(t,e)}debug(t,e){this.writeOperationLog("DEBUG",t,e),this.fable.log.debug(t,e)}info(t,e){this.writeOperationLog("INFO",t,e),this.fable.log.info(t,e)}warn(t,e){this.writeOperationLog("WARN",t,e),this.fable.log.warn(t,e)}error(t,e){this.writeOperationLog("ERROR",t,e),this.writeOperationErrors(t,e),this.fable.log.error(t,e)}fatal(t,e){this.writeOperationLog("FATAL",t,e),this.writeOperationErrors(t,e),this.fable.log.fatal(t,e)}}},{}],36:[function(t,e,r){const n=t("./Fable-ServiceProviderBase.js");e.exports=class extends n{constructor(t,e,r){super(t,e,r),this.serviceType="Template",this.Matchers={Evaluate:/<%([\s\S]+?)%>/g,Interpolate:/<%=([\s\S]+?)%>/g,Escaper:/\\|'|\r|\n|\t|\u2028|\u2029/g,Unescaper:/\\(\\|'|r|n|t|u2028|u2029)/g,GuaranteedNonMatch:/.^/},this.templateEscapes={"\\":"\\","'":"'",r:"\r","\r":"r",n:"\n","\n":"n",t:"\t","\t":"t",u2028:"\u2028","\u2028":"u2028",u2029:"\u2029","\u2029":"u2029"},this.renderFunction=!1,this.templateString=!1}renderTemplate(t){return this.renderFunction(t)}templateFunction(t){return this.renderTemplate.bind(this)}buildTemplateFunction(t,e){return this.TemplateSource="__p+='"+t.replace(this.Matchers.Escaper,(t=>`\\${this.templateEscapes[t]}`)).replace(this.Matchers.Interpolate||this.Matchers.GuaranteedNonMatch,((t,e)=>`'+\n(${decodeURIComponent(e)})+\n'`)).replace(this.Matchers.Evaluate||this.Matchers.GuaranteedNonMatch,((t,e)=>`';\n${decodeURIComponent(e)}\n;__p+='`))+"';\n",this.TemplateSource=`with(pTemplateDataObject||{}){\n${this.TemplateSource}}\n`,this.TemplateSource=`var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n${this.TemplateSource}return __p;\n`,this.renderFunction=new Function("pTemplateDataObject",this.TemplateSource),void 0!==e?this.renderFunction(e):(this.TemplateSourceCompiled="function(obj){\n"+this.TemplateSource+"}",this.templateFunction())}}},{"./Fable-ServiceProviderBase.js":38}],37:[function(t,e,r){
|
|
94
94
|
/**
|
|
95
95
|
* Fable Application Services Management
|
|
96
96
|
* @license MIT
|
|
97
97
|
* @author <steven@velozo.com>
|
|
98
98
|
*/
|
|
99
|
-
const n=t("./Fable-ServiceProviderBase.js");e.exports=class{constructor(t){this.fable=t,this.serviceTypes=[],this.services={},this.defaultServices={},this.serviceClasses={}}addServiceType(t,e){this.serviceTypes.push(t),this.services[t]={},"
|
|
99
|
+
const n=t("./Fable-ServiceProviderBase.js");e.exports=class{constructor(t){this.fable=t,this.serviceTypes=[],this.services={},this.defaultServices={},this.serviceClasses={}}addServiceType(t,e){this.serviceTypes.push(t),this.services[t]={},"function"==typeof e&&e.prototype instanceof n?this.serviceClasses[t]=e:this.serviceClasses[t]=n}instantiateServiceProvider(t,e,r){let n=this.instantiateServiceProviderWithoutRegistration(t,e,r);return this.services[t][n.Hash]=n,this.defaultServices.hasOwnProperty(t)||(this.defaultServices[t]=n),n}instantiateServiceProviderWithoutRegistration(t,e,r){return new this.serviceClasses[t](this.fable,e,r)}setDefaultServiceInstantiation(t,e){return!!this.services[t].hasOwnProperty(e)&&(this.defaultServices[t]=this.services[t][e],!0)}},e.exports.ServiceProviderBase=n},{"./Fable-ServiceProviderBase.js":38}],38:[function(t,e,r){e.exports=
|
|
100
100
|
/**
|
|
101
101
|
* Fable Service Base
|
|
102
102
|
* @license MIT
|
|
103
103
|
* @author <steven@velozo.com>
|
|
104
104
|
*/
|
|
105
|
-
class{constructor(t,e,r){this.fable=t,this.options=e,this.serviceType="Unknown",this.UUID=t.getUUID(),this.Hash="string"==typeof r?r:`${this.UUID}`}}},{}],
|
|
105
|
+
class{constructor(t,e,r){this.fable=t,this.options="object"==typeof e?e:{},this.serviceType="Unknown",this.UUID=t.getUUID(),this.Hash="string"==typeof r?r:`${this.UUID}`}}},{}],39:[function(t,e,r){const n=t("async.waterfall"),i=t("async.eachlimit");e.exports=class{constructor(t){this.fable=t,this.templates={},this.waterfall=n,this.eachLimit=i}extend(t,...e){return Object.assign(t,...e)}template(t,e){return this.fable.serviceManager.instantiateServiceProviderWithoutRegistration("Template").buildTemplateFunction(t,e)}buildHashedTemplate(t,e,r){let n=this.fable.serviceManager.instantiateServiceProvider("Template",{},t);return this.templates[t]=n.buildTemplateFunction(e,r),this.templates[t]}chunk(t,e,r){let n=[...t],i="number"==typeof e?e:0,s=void 0!==r?r:[];if(i<=0)return s;for(;n.length;)s.push(n.splice(0,i));return s}}},{"async.eachlimit":1,"async.waterfall":15}],40:[function(t,e,r){
|
|
106
106
|
/**
|
|
107
107
|
* Fable Application Services Support Library
|
|
108
108
|
* @license MIT
|
|
109
109
|
* @author <steven@velozo.com>
|
|
110
110
|
*/
|
|
111
|
-
const n=t("fable-settings"),i=t("fable-uuid"),s=t("fable-log"),o=t("./Fable-Utility.js"),a=t("./Fable-ServiceManager.js"),l=t("./Fable-Operation.js");class
|
|
111
|
+
const n=t("fable-settings"),i=t("fable-uuid"),s=t("fable-log"),o=t("./Fable-Utility.js"),a=t("./Fable-ServiceManager.js"),l=t("./Fable-Service-Template.js"),u=t("./Fable-Operation.js");class c{constructor(t){let e=new n(t);this.settingsManager=e,this.libUUID=new i(this.settingsManager.settings),this.log=new s(this.settingsManager.settings),this.log.initialize(),this.Utility=new o(this),this.Dependencies={precedent:n.precedent},this.Operations={},this.serviceManager=new a(this),this.serviceManager.addServiceType("Template",l),this.services=this.serviceManager.services,this.defaultServices=this.serviceManager.defaultServices}get settings(){return this.settingsManager.settings}get fable(){return this}getUUID(){return this.libUUID.getUUID()}createOperation(t,e){let r=new u(this,t,e);return this.Operations.hasOwnProperty(r.Hash)||(this.Operations[r.Hash]=r),r}getOperation(t){return!!this.Operations.hasOwnProperty(t)&&this.Operations[t]}}e.exports=c,e.exports.new=function(t){return new c(t)},e.exports.LogProviderBase=s.LogProviderBase,e.exports.ServiceProviderBase=a.ServiceProviderBase,e.exports.precedent=n.precedent},{"./Fable-Operation.js":35,"./Fable-Service-Template.js":36,"./Fable-ServiceManager.js":37,"./Fable-Utility.js":39,"fable-log":22,"fable-settings":25,"fable-uuid":27}]},{},[34])(34)}));
|
|
112
112
|
//# sourceMappingURL=fable.min.js.map
|