fable-serviceproviderbase 3.0.10 → 3.0.11
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-serviceproviderbase.compatible.js +51 -50
- package/dist/fable-serviceproviderbase.compatible.min.js +1 -1
- package/dist/fable-serviceproviderbase.compatible.min.js.map +1 -1
- package/dist/fable-serviceproviderbase.js +40 -40
- package/dist/fable-serviceproviderbase.min.js +1 -1
- package/dist/fable-serviceproviderbase.min.js.map +1 -1
- package/package.json +3 -5
- package/source/Fable-ServiceProviderBase.js +53 -9
- package/source/Fable-ServiceProviderBase-Preinit.js +0 -38
|
@@ -6,7 +6,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
6
6
|
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; }
|
|
7
7
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
8
|
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); }
|
|
9
|
-
function _typeof(
|
|
9
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
10
10
|
(function (f) {
|
|
11
11
|
if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === "object" && typeof module !== "undefined") {
|
|
12
12
|
module.exports = f();
|
|
@@ -55,65 +55,66 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
55
55
|
}()({
|
|
56
56
|
1: [function (require, module, exports) {
|
|
57
57
|
/**
|
|
58
|
-
* Fable
|
|
59
|
-
*
|
|
60
|
-
* For a couple services, we need to be able to instantiate them before the Fable object is fully initialized.
|
|
61
|
-
* This is a base class for those services.
|
|
62
|
-
*
|
|
58
|
+
* Fable Service Base
|
|
63
59
|
* @author <steven@velozo.com>
|
|
64
60
|
*/
|
|
65
|
-
var
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
var FableServiceProviderBase = /*#__PURE__*/function () {
|
|
62
|
+
// The constructor can be used in two ways:
|
|
63
|
+
// 1) With a fable, options object and service hash (the options object and service hash are optional)
|
|
64
|
+
// 2) With an object or nothing as the first parameter, where it will be treated as the options object
|
|
65
|
+
function FableServiceProviderBase(pFable, pOptions, pServiceHash) {
|
|
66
|
+
_classCallCheck(this, FableServiceProviderBase);
|
|
67
|
+
// Check if a fable was passed in
|
|
68
|
+
if (_typeof(pFable) === 'object' && pFable.isFable) {
|
|
69
|
+
this.fable = pFable;
|
|
70
|
+
} else {
|
|
71
|
+
this.fable = false;
|
|
72
|
+
}
|
|
73
|
+
if (this.fable) {
|
|
74
|
+
this.connectFable(this.fable);
|
|
75
|
+
this.options = _typeof(pOptions) === 'object' ? pOptions : {};
|
|
76
|
+
} else {
|
|
77
|
+
// With no fable, check to see if there was an object passed into either of the first two
|
|
78
|
+
// Parameters, and if so, treat it as the options object
|
|
79
|
+
this.options = _typeof(pFable) === 'object' && !pFable.isFable ? pFable : _typeof(pOptions) === 'object' ? pOptions : {};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// It's expected that the deriving class will set this
|
|
70
83
|
this.serviceType = 'Unknown';
|
|
84
|
+
if (this.fable) {
|
|
85
|
+
this.UUID = pFable.getUUID();
|
|
86
|
+
} else {
|
|
87
|
+
// Without any dependencies, get a decently random UUID for the service
|
|
88
|
+
this.UUID = "CORE-SVC-".concat(Math.floor(Math.random() * (99999 - 10000) + 10000));
|
|
89
|
+
}
|
|
71
90
|
|
|
72
|
-
// The hash
|
|
73
|
-
this.
|
|
74
|
-
this.Hash = typeof pServiceHash === 'string' ? pServiceHash : "".concat(this.UUID);
|
|
91
|
+
// The service hash is used to identify the specific instantiation of the service in the services map
|
|
92
|
+
this.Hash = typeof pServiceHash === 'string' ? pServiceHash : !this.fable && typeof pOptions === 'string' ? pOptions : "".concat(this.UUID);
|
|
75
93
|
}
|
|
76
|
-
_createClass(
|
|
94
|
+
_createClass(FableServiceProviderBase, [{
|
|
77
95
|
key: "connectFable",
|
|
78
|
-
value:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
96
|
+
value: function connectFable(pFable) {
|
|
97
|
+
if (_typeof(pFable) !== 'object' || !pFable.isFable) {
|
|
98
|
+
var tmpErrorMessage = "Fable Service Provider Base: Cannot connect to Fable, invalid Fable object passed in. The pFable parameter was a [".concat(_typeof(pFable), "].}");
|
|
99
|
+
console.log(tmpErrorMessage);
|
|
100
|
+
return new Error(tmpErrorMessage);
|
|
101
|
+
}
|
|
102
|
+
if (!this.fable) {
|
|
103
|
+
this.fable = pFable;
|
|
104
|
+
}
|
|
105
|
+
this.log = this.fable.log;
|
|
106
|
+
this.servicesMap = this.fable.servicesMap;
|
|
107
|
+
this.services = this.fable.services;
|
|
82
108
|
return true;
|
|
83
109
|
}
|
|
84
110
|
}]);
|
|
85
|
-
return
|
|
111
|
+
return FableServiceProviderBase;
|
|
86
112
|
}();
|
|
87
|
-
_defineProperty(FableCoreServiceProviderBase, "isFableService", true);
|
|
88
|
-
module.exports = FableCoreServiceProviderBase;
|
|
89
|
-
}, {}],
|
|
90
|
-
2: [function (require, module, exports) {
|
|
91
|
-
/**
|
|
92
|
-
* Fable Service Base
|
|
93
|
-
* @author <steven@velozo.com>
|
|
94
|
-
*/
|
|
95
|
-
var FableServiceProviderBase = /*#__PURE__*/_createClass(function FableServiceProviderBase(pFable, pOptions, pServiceHash) {
|
|
96
|
-
_classCallCheck(this, FableServiceProviderBase);
|
|
97
|
-
this.fable = pFable;
|
|
98
|
-
this.options = _typeof(pOptions) === 'object' ? pOptions : _typeof(pFable) === 'object' && !pFable.isFable ? pFable : {};
|
|
99
|
-
this.serviceType = 'Unknown';
|
|
100
|
-
if (typeof pFable.getUUID == 'function') {
|
|
101
|
-
this.UUID = pFable.getUUID();
|
|
102
|
-
} else {
|
|
103
|
-
this.UUID = "NoFABLESVC-".concat(Math.floor(Math.random() * (99999 - 10000) + 10000));
|
|
104
|
-
}
|
|
105
|
-
this.Hash = typeof pServiceHash === 'string' ? pServiceHash : "".concat(this.UUID);
|
|
106
|
-
|
|
107
|
-
// Pull back a few things
|
|
108
|
-
this.log = this.fable.log;
|
|
109
|
-
this.servicesMap = this.fable.servicesMap;
|
|
110
|
-
this.services = this.fable.services;
|
|
111
|
-
});
|
|
112
113
|
_defineProperty(FableServiceProviderBase, "isFableService", true);
|
|
113
114
|
module.exports = FableServiceProviderBase;
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}]
|
|
118
|
-
}, {}, [
|
|
115
|
+
|
|
116
|
+
// This is left here in case we want to go back to having different code for "core" services
|
|
117
|
+
module.exports.CoreServiceProviderBase = FableServiceProviderBase;
|
|
118
|
+
}, {}]
|
|
119
|
+
}, {}, [1])(1);
|
|
119
120
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"===_typeof(t)?t:String(t)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!==_typeof(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}!function(e){if("object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).FableServiceproviderbase=e()}}((function(){return function e(t,r,o){function
|
|
1
|
+
"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"===_typeof(t)?t:String(t)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!==_typeof(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}!function(e){if("object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).FableServiceproviderbase=e()}}((function(){return function e(t,r,o){function n(f,a){if(!r[f]){if(!t[f]){var s="function"==typeof require&&require;if(!a&&s)return s(f,!0);if(i)return i(f,!0);var l=new Error("Cannot find module '"+f+"'");throw l.code="MODULE_NOT_FOUND",l}var c=r[f]={exports:{}};t[f][0].call(c.exports,(function(e){return n(t[f][1][e]||e)}),c,c.exports,e,t,r,o)}return r[f].exports}for(var i="function"==typeof require&&require,f=0;f<o.length;f++)n(o[f]);return n}({1:[function(e,t,r){var o=function(){function e(t,r,o){_classCallCheck(this,e),"object"===_typeof(t)&&t.isFable?this.fable=t:this.fable=!1,this.fable?(this.connectFable(this.fable),this.options="object"===_typeof(r)?r:{}):this.options="object"!==_typeof(t)||t.isFable?"object"===_typeof(r)?r:{}:t,this.serviceType="Unknown",this.fable?this.UUID=t.getUUID():this.UUID="CORE-SVC-".concat(Math.floor(89999*Math.random()+1e4)),this.Hash="string"==typeof o?o:this.fable||"string"!=typeof r?"".concat(this.UUID):r}return _createClass(e,[{key:"connectFable",value:function(e){if("object"!==_typeof(e)||!e.isFable){var t="Fable Service Provider Base: Cannot connect to Fable, invalid Fable object passed in. The pFable parameter was a [".concat(_typeof(e),"].}");return console.log(t),new Error(t)}return this.fable||(this.fable=e),this.log=this.fable.log,this.servicesMap=this.fable.servicesMap,this.services=this.fable.services,!0}}]),e}();_defineProperty(o,"isFableService",!0),t.exports=o,t.exports.CoreServiceProviderBase=o},{}]},{},[1])(1)}));
|
|
2
2
|
//# sourceMappingURL=fable-serviceproviderbase.compatible.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["fable-serviceproviderbase.compatible.min.js","node_modules/browser-pack/_prelude.js","source/Fable-ServiceProviderBase-Preinit.js","source/Fable-ServiceProviderBase.js"],"names":["_classCallCheck","instance","Constructor","TypeError","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","_toPropertyKey","key","_createClass","protoProps","staticProps","prototype","_defineProperty","obj","value","arg","_toPrimitive","_typeof","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","Number","iterator","constructor","f","exports","module","define","amd","window","global","self","this","FableServiceproviderbase","r","e","n","t","o","c","require","u","a","Error","code","p","FableCoreServiceProviderBase","pOptions","pServiceHash","fable","options","serviceType","UUID","concat","Math","floor","random","Hash","pFable","FableServiceProviderBase","isFable","getUUID","log","servicesMap","services","CoreServiceProviderBase"],"mappings":"AAAA,aAEA,SAASA,gBAAgBC,EAAUC,GAAe,KAAMD,aAAoBC,GAAgB,MAAM,IAAIC,UAAU,oCAAwC,CACxJ,SAASC,kBAAkBC,EAAQC,GAAS,IAAK,IAAIC,EAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CAAE,IAAIE,EAAaH,EAAMC,GAAIE,EAAWC,WAAaD,EAAWC,aAAc,EAAOD,EAAWE,cAAe,EAAU,UAAWF,IAAYA,EAAWG,UAAW,GAAMC,OAAOC,eAAeT,EAAQU,eAAeN,EAAWO,KAAMP,EAAa,CAAE,CAC5U,SAASQ,aAAaf,EAAagB,EAAYC,GAAyN,OAAtMD,GAAYd,kBAAkBF,EAAYkB,UAAWF,GAAiBC,GAAaf,kBAAkBF,EAAaiB,GAAcN,OAAOC,eAAeZ,EAAa,YAAa,CAAEU,UAAU,IAAiBV,CAAa,CAC5R,SAASmB,gBAAgBC,EAAKN,EAAKO,GAA4L,OAAnLP,EAAMD,eAAeC,MAAiBM,EAAOT,OAAOC,eAAeQ,EAAKN,EAAK,CAAEO,MAAOA,EAAOb,YAAY,EAAMC,cAAc,EAAMC,UAAU,IAAkBU,EAAIN,GAAOO,EAAgBD,CAA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,EACA,WAAApC,QAAA+C,IAAAA,EAAAE,QACA,CAAA,EADAF,EAGA1B,KAAAmB,YAAA,UAEA,mBAAAO,EAAAG,QAEA7B,KAAAoB,KAAAM,EAAAG,UAIA7B,KAAAoB,KAAA,cAAAC,OAAAC,KAAAC,MAAA,MAAAD,KAAAE,SAAA,MAGAxB,KAAAyB,KAAA,iBAAAT,EAAAA,EAAA,GAAAK,OAAArB,KAAAoB,MAGApB,KAAA8B,IAAA9B,KAAAiB,MAAAa,IACA9B,KAAA+B,YAAA/B,KAAAiB,MAAAc,YACA/B,KAAAgC,SAAAhC,KAAAiB,MAAAe,QACA,IAAA1D,gBA3BAqD,EAAA,kBA6BA,GAGAjC,EAAAD,QAAAkC,EAEAjC,EAAAD,QAAAwC,wBAAAzB,EAAA,yCH0CA,EAAE,CAAC,yCAAyC,KAAK,CAAC,EAAE,CAAC,GCjFrD,CDiFyD,EACzD","file":"fable-serviceproviderbase.compatible.min.js","sourcesContent":["(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define([],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.FableServiceproviderbase = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){\n/**\n* Fable Core Pre-initialization Service Base\n*\n* For a couple services, we need to be able to instantiate them before the Fable object is fully initialized.\n* This is a base class for those services.\n*\n* @author <steven@velozo.com>\n*/\n\nclass FableCoreServiceProviderBase\n{\n\tconstructor(pOptions, pServiceHash)\n\t{\n\t\tthis.fable = false;\n\n\t\tthis.options = (typeof(pOptions) === 'object') ? pOptions : {};\n\n\t\tthis.serviceType = 'Unknown';\n\n\t\t// The hash will be a non-standard UUID ... the UUID service uses this base class!\n\t\tthis.UUID = `CORESVC-${Math.floor((Math.random() * (99999 - 10000)) + 10000)}`;\n\n\t\tthis.Hash = (typeof(pServiceHash) === 'string') ? pServiceHash : `${this.UUID}`;\n\t}\n\n\n\tstatic isFableService = true;\n\n\t// After fable is initialized, it would be expected to be wired in as a normal service.\n\tconnectFable(pFable)\n\t{\n\t\tthis.fable = pFable;\n\n\t\treturn true;\n\t}\n}\n\nmodule.exports = FableCoreServiceProviderBase;\n\n},{}],2:[function(require,module,exports){\n/**\n* Fable Service Base\n* @author <steven@velozo.com>\n*/\n\nclass FableServiceProviderBase\n{\n\tconstructor(pFable, pOptions, pServiceHash)\n\t{\n\t\tthis.fable = pFable;\n\n\t\tthis.options = (typeof(pOptions) === 'object') ? pOptions\n\t\t\t\t\t\t: ((typeof(pFable) === 'object') && !pFable.isFable) ? pFable\n\t\t\t\t\t\t: {};\n\n\t\tthis.serviceType = 'Unknown';\n\n\t\tif (typeof(pFable.getUUID) == 'function')\n\t\t{\n\t\t\tthis.UUID = pFable.getUUID();\n\t\t}\n\t\telse\n\t\t{\n\t\t\tthis.UUID = `NoFABLESVC-${Math.floor((Math.random() * (99999 - 10000)) + 10000)}`\n\t\t}\n\n\t\tthis.Hash = (typeof(pServiceHash) === 'string') ? pServiceHash : `${this.UUID}`;\n\n\t\t// Pull back a few things\n\t\tthis.log = this.fable.log;\n\t\tthis.servicesMap = this.fable.servicesMap;\n\t\tthis.services = this.fable.services;\n\t}\n\n\tstatic isFableService = true;\n}\n\nmodule.exports = FableServiceProviderBase;\n\nmodule.exports.CoreServiceProviderBase = require('./Fable-ServiceProviderBase-Preinit.js');\n},{\"./Fable-ServiceProviderBase-Preinit.js\":1}]},{},[2])(2)\n});\n\n","(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()","/**\n* Fable Core Pre-initialization Service Base\n*\n* For a couple services, we need to be able to instantiate them before the Fable object is fully initialized.\n* This is a base class for those services.\n*\n* @author <steven@velozo.com>\n*/\n\nclass FableCoreServiceProviderBase\n{\n\tconstructor(pOptions, pServiceHash)\n\t{\n\t\tthis.fable = false;\n\n\t\tthis.options = (typeof(pOptions) === 'object') ? pOptions : {};\n\n\t\tthis.serviceType = 'Unknown';\n\n\t\t// The hash will be a non-standard UUID ... the UUID service uses this base class!\n\t\tthis.UUID = `CORESVC-${Math.floor((Math.random() * (99999 - 10000)) + 10000)}`;\n\n\t\tthis.Hash = (typeof(pServiceHash) === 'string') ? pServiceHash : `${this.UUID}`;\n\t}\n\n\n\tstatic isFableService = true;\n\n\t// After fable is initialized, it would be expected to be wired in as a normal service.\n\tconnectFable(pFable)\n\t{\n\t\tthis.fable = pFable;\n\n\t\treturn true;\n\t}\n}\n\nmodule.exports = FableCoreServiceProviderBase;\n","/**\n* Fable Service Base\n* @author <steven@velozo.com>\n*/\n\nclass FableServiceProviderBase\n{\n\tconstructor(pFable, pOptions, pServiceHash)\n\t{\n\t\tthis.fable = pFable;\n\n\t\tthis.options = (typeof(pOptions) === 'object') ? pOptions\n\t\t\t\t\t\t: ((typeof(pFable) === 'object') && !pFable.isFable) ? pFable\n\t\t\t\t\t\t: {};\n\n\t\tthis.serviceType = 'Unknown';\n\n\t\tif (typeof(pFable.getUUID) == 'function')\n\t\t{\n\t\t\tthis.UUID = pFable.getUUID();\n\t\t}\n\t\telse\n\t\t{\n\t\t\tthis.UUID = `NoFABLESVC-${Math.floor((Math.random() * (99999 - 10000)) + 10000)}`\n\t\t}\n\n\t\tthis.Hash = (typeof(pServiceHash) === 'string') ? pServiceHash : `${this.UUID}`;\n\n\t\t// Pull back a few things\n\t\tthis.log = this.fable.log;\n\t\tthis.servicesMap = this.fable.servicesMap;\n\t\tthis.services = this.fable.services;\n\t}\n\n\tstatic isFableService = true;\n}\n\nmodule.exports = FableServiceProviderBase;\n\nmodule.exports.CoreServiceProviderBase = require('./Fable-ServiceProviderBase-Preinit.js');"]}
|
|
1
|
+
{"version":3,"sources":["fable-serviceproviderbase.compatible.min.js","node_modules/browser-pack/_prelude.js","source/Fable-ServiceProviderBase.js"],"names":["_classCallCheck","instance","Constructor","TypeError","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","_toPropertyKey","key","_createClass","protoProps","staticProps","prototype","_defineProperty","obj","value","arg","_toPrimitive","_typeof","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","Number","o","iterator","constructor","f","exports","module","define","amd","window","global","self","this","FableServiceproviderbase","r","e","n","t","c","require","u","a","Error","code","p","FableServiceProviderBase","pFable","pOptions","pServiceHash","isFable","fable","connectFable","options","serviceType","UUID","getUUID","concat","Math","floor","random","Hash","tmpErrorMessage","console","log","servicesMap","services","CoreServiceProviderBase"],"mappings":"AAAA,aAEA,SAASA,gBAAgBC,EAAUC,GAAe,KAAMD,aAAoBC,GAAgB,MAAM,IAAIC,UAAU,oCAAwC,CACxJ,SAASC,kBAAkBC,EAAQC,GAAS,IAAK,IAAIC,EAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CAAE,IAAIE,EAAaH,EAAMC,GAAIE,EAAWC,WAAaD,EAAWC,aAAc,EAAOD,EAAWE,cAAe,EAAU,UAAWF,IAAYA,EAAWG,UAAW,GAAMC,OAAOC,eAAeT,EAAQU,eAAeN,EAAWO,KAAMP,EAA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,WAAAvC,QAAAqC,GAAAA,EACA,CAAA,EAFAD,EAMAd,KAAAqB,YAAA,UAEArB,KAAAkB,MAEAlB,KAAAsB,KAAAR,EAAAS,UAKAvB,KAAAsB,KAAA,YAAAE,OAAAC,KAAAC,MAAA,MAAAD,KAAAE,SAAA,MAIA3B,KAAA4B,KAAA,iBAAAZ,EAAAA,EACAhB,KAAAkB,OAAA,iBAAAH,EAAA,GAAAS,OACAxB,KAAAsB,MADAP,CAEA,CAqBA,OArBA9C,aAAA4C,EAAA,CAAA,CAAA7C,IAAA,eAAAO,MAEA,SAAAuC,GAEA,GAAA,WAAApC,QAAAoC,KAAAA,EAAAG,QACA,CACA,IAAAY,EAAA,sHAAAL,OAAA9C,QAAAoC,GAAA,OAEA,OADAgB,QAAAC,IAAAF,GACA,IAAAnB,MAAAmB,EACA,CAWA,OATA7B,KAAAkB,QAEAlB,KAAAkB,MAAAJ,GAGAd,KAAA+B,IAAA/B,KAAAkB,MAAAa,IACA/B,KAAAgC,YAAAhC,KAAAkB,MAAAc,YACAhC,KAAAiC,SAAAjC,KAAAkB,MAAAe,UAEA,CACA,KAAApB,CAAA,CAtEA,GAsEAxC,gBAtEAwC,EAAA,kBAwEA,GAGAnB,EAAAD,QAAAoB,EAGAnB,EAAAD,QAAAyC,wBAAArB,CFEA,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,GCrFX,CDqFe,EACf","file":"fable-serviceproviderbase.compatible.min.js","sourcesContent":["(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define([],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.FableServiceproviderbase = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){\n/**\n* Fable Service Base\n* @author <steven@velozo.com>\n*/\n\nclass FableServiceProviderBase\n{\n\t// The constructor can be used in two ways:\n\t// 1) With a fable, options object and service hash (the options object and service hash are optional)\n\t// 2) With an object or nothing as the first parameter, where it will be treated as the options object\n\tconstructor(pFable, pOptions, pServiceHash)\n\t{\n\t\t// Check if a fable was passed in\n\t\tif ((typeof(pFable) === 'object') && pFable.isFable)\n\t\t{\n\t\t\tthis.fable = pFable;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tthis.fable = false;\n\t\t}\n\n\t\tif (this.fable)\n\t\t{\n\t\t\tthis.connectFable(this.fable);\n\t\t\tthis.options = (typeof(pOptions) === 'object') ? pOptions\n\t\t\t\t\t\t\t: {};\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// With no fable, check to see if there was an object passed into either of the first two\n\t\t\t// Parameters, and if so, treat it as the options object\n\t\t\tthis.options = ((typeof(pFable) === 'object') && !pFable.isFable) ? pFable\n\t\t\t\t\t\t\t: (typeof(pOptions) === 'object') ? pOptions\n\t\t\t\t\t\t\t: {};\n\t\t}\n\n\t\t// It's expected that the deriving class will set this\n\t\tthis.serviceType = 'Unknown';\n\n\t\tif (this.fable)\n\t\t{\n\t\t\tthis.UUID = pFable.getUUID();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// Without any dependencies, get a decently random UUID for the service\n\t\t\tthis.UUID = `CORE-SVC-${Math.floor((Math.random() * (99999 - 10000)) + 10000)}`\n\t\t}\n\n\t\t// The service hash is used to identify the specific instantiation of the service in the services map\n\t\tthis.Hash = (typeof(pServiceHash) === 'string') ? pServiceHash \n\t\t\t\t\t: (!this.fable && (typeof(pOptions) === 'string')) ? pOptions\n\t\t\t\t\t: `${this.UUID}`;\n\t}\n\n\tconnectFable(pFable)\n\t{\n\t\tif ((typeof(pFable) !== 'object') || (!pFable.isFable))\n\t\t{\n\t\t\tlet tmpErrorMessage = `Fable Service Provider Base: Cannot connect to Fable, invalid Fable object passed in. The pFable parameter was a [${typeof(pFable)}].}`;\n\t\t\tconsole.log(tmpErrorMessage);\n\t\t\treturn new Error(tmpErrorMessage);\n\t\t}\n\n\t\tif (!this.fable)\n\t\t{\n\t\t\tthis.fable = pFable;\n\t\t}\n\n\t\tthis.log = this.fable.log;\n\t\tthis.servicesMap = this.fable.servicesMap;\n\t\tthis.services = this.fable.services;\n\n\t\treturn true;\n\t}\n\n\tstatic isFableService = true;\n}\n\nmodule.exports = FableServiceProviderBase;\n\n// This is left here in case we want to go back to having different code for \"core\" services\nmodule.exports.CoreServiceProviderBase = FableServiceProviderBase;\n},{}]},{},[1])(1)\n});\n\n","(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()","/**\n* Fable Service Base\n* @author <steven@velozo.com>\n*/\n\nclass FableServiceProviderBase\n{\n\t// The constructor can be used in two ways:\n\t// 1) With a fable, options object and service hash (the options object and service hash are optional)\n\t// 2) With an object or nothing as the first parameter, where it will be treated as the options object\n\tconstructor(pFable, pOptions, pServiceHash)\n\t{\n\t\t// Check if a fable was passed in\n\t\tif ((typeof(pFable) === 'object') && pFable.isFable)\n\t\t{\n\t\t\tthis.fable = pFable;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tthis.fable = false;\n\t\t}\n\n\t\tif (this.fable)\n\t\t{\n\t\t\tthis.connectFable(this.fable);\n\t\t\tthis.options = (typeof(pOptions) === 'object') ? pOptions\n\t\t\t\t\t\t\t: {};\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// With no fable, check to see if there was an object passed into either of the first two\n\t\t\t// Parameters, and if so, treat it as the options object\n\t\t\tthis.options = ((typeof(pFable) === 'object') && !pFable.isFable) ? pFable\n\t\t\t\t\t\t\t: (typeof(pOptions) === 'object') ? pOptions\n\t\t\t\t\t\t\t: {};\n\t\t}\n\n\t\t// It's expected that the deriving class will set this\n\t\tthis.serviceType = 'Unknown';\n\n\t\tif (this.fable)\n\t\t{\n\t\t\tthis.UUID = pFable.getUUID();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// Without any dependencies, get a decently random UUID for the service\n\t\t\tthis.UUID = `CORE-SVC-${Math.floor((Math.random() * (99999 - 10000)) + 10000)}`\n\t\t}\n\n\t\t// The service hash is used to identify the specific instantiation of the service in the services map\n\t\tthis.Hash = (typeof(pServiceHash) === 'string') ? pServiceHash \n\t\t\t\t\t: (!this.fable && (typeof(pOptions) === 'string')) ? pOptions\n\t\t\t\t\t: `${this.UUID}`;\n\t}\n\n\tconnectFable(pFable)\n\t{\n\t\tif ((typeof(pFable) !== 'object') || (!pFable.isFable))\n\t\t{\n\t\t\tlet tmpErrorMessage = `Fable Service Provider Base: Cannot connect to Fable, invalid Fable object passed in. The pFable parameter was a [${typeof(pFable)}].}`;\n\t\t\tconsole.log(tmpErrorMessage);\n\t\t\treturn new Error(tmpErrorMessage);\n\t\t}\n\n\t\tif (!this.fable)\n\t\t{\n\t\t\tthis.fable = pFable;\n\t\t}\n\n\t\tthis.log = this.fable.log;\n\t\tthis.servicesMap = this.fable.servicesMap;\n\t\tthis.services = this.fable.services;\n\n\t\treturn true;\n\t}\n\n\tstatic isFableService = true;\n}\n\nmodule.exports = FableServiceProviderBase;\n\n// This is left here in case we want to go back to having different code for \"core\" services\nmodule.exports.CoreServiceProviderBase = FableServiceProviderBase;"]}
|
|
@@ -50,63 +50,63 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
50
50
|
return r;
|
|
51
51
|
}()({
|
|
52
52
|
1: [function (require, module, exports) {
|
|
53
|
-
/**
|
|
54
|
-
* Fable Core Pre-initialization Service Base
|
|
55
|
-
*
|
|
56
|
-
* For a couple services, we need to be able to instantiate them before the Fable object is fully initialized.
|
|
57
|
-
* This is a base class for those services.
|
|
58
|
-
*
|
|
59
|
-
* @author <steven@velozo.com>
|
|
60
|
-
*/
|
|
61
|
-
|
|
62
|
-
class FableCoreServiceProviderBase {
|
|
63
|
-
constructor(pOptions, pServiceHash) {
|
|
64
|
-
this.fable = false;
|
|
65
|
-
this.options = typeof pOptions === 'object' ? pOptions : {};
|
|
66
|
-
this.serviceType = 'Unknown';
|
|
67
|
-
|
|
68
|
-
// The hash will be a non-standard UUID ... the UUID service uses this base class!
|
|
69
|
-
this.UUID = "CORESVC-".concat(Math.floor(Math.random() * (99999 - 10000) + 10000));
|
|
70
|
-
this.Hash = typeof pServiceHash === 'string' ? pServiceHash : "".concat(this.UUID);
|
|
71
|
-
}
|
|
72
|
-
// After fable is initialized, it would be expected to be wired in as a normal service.
|
|
73
|
-
connectFable(pFable) {
|
|
74
|
-
this.fable = pFable;
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
_defineProperty(FableCoreServiceProviderBase, "isFableService", true);
|
|
79
|
-
module.exports = FableCoreServiceProviderBase;
|
|
80
|
-
}, {}],
|
|
81
|
-
2: [function (require, module, exports) {
|
|
82
53
|
/**
|
|
83
54
|
* Fable Service Base
|
|
84
55
|
* @author <steven@velozo.com>
|
|
85
56
|
*/
|
|
86
57
|
|
|
87
58
|
class FableServiceProviderBase {
|
|
59
|
+
// The constructor can be used in two ways:
|
|
60
|
+
// 1) With a fable, options object and service hash (the options object and service hash are optional)
|
|
61
|
+
// 2) With an object or nothing as the first parameter, where it will be treated as the options object
|
|
88
62
|
constructor(pFable, pOptions, pServiceHash) {
|
|
89
|
-
|
|
90
|
-
|
|
63
|
+
// Check if a fable was passed in
|
|
64
|
+
if (typeof pFable === 'object' && pFable.isFable) {
|
|
65
|
+
this.fable = pFable;
|
|
66
|
+
} else {
|
|
67
|
+
this.fable = false;
|
|
68
|
+
}
|
|
69
|
+
if (this.fable) {
|
|
70
|
+
this.connectFable(this.fable);
|
|
71
|
+
this.options = typeof pOptions === 'object' ? pOptions : {};
|
|
72
|
+
} else {
|
|
73
|
+
// With no fable, check to see if there was an object passed into either of the first two
|
|
74
|
+
// Parameters, and if so, treat it as the options object
|
|
75
|
+
this.options = typeof pFable === 'object' && !pFable.isFable ? pFable : typeof pOptions === 'object' ? pOptions : {};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// It's expected that the deriving class will set this
|
|
91
79
|
this.serviceType = 'Unknown';
|
|
92
|
-
if (
|
|
80
|
+
if (this.fable) {
|
|
93
81
|
this.UUID = pFable.getUUID();
|
|
94
82
|
} else {
|
|
95
|
-
|
|
83
|
+
// Without any dependencies, get a decently random UUID for the service
|
|
84
|
+
this.UUID = "CORE-SVC-".concat(Math.floor(Math.random() * (99999 - 10000) + 10000));
|
|
96
85
|
}
|
|
97
|
-
this.Hash = typeof pServiceHash === 'string' ? pServiceHash : "".concat(this.UUID);
|
|
98
86
|
|
|
99
|
-
//
|
|
87
|
+
// The service hash is used to identify the specific instantiation of the service in the services map
|
|
88
|
+
this.Hash = typeof pServiceHash === 'string' ? pServiceHash : !this.fable && typeof pOptions === 'string' ? pOptions : "".concat(this.UUID);
|
|
89
|
+
}
|
|
90
|
+
connectFable(pFable) {
|
|
91
|
+
if (typeof pFable !== 'object' || !pFable.isFable) {
|
|
92
|
+
let tmpErrorMessage = "Fable Service Provider Base: Cannot connect to Fable, invalid Fable object passed in. The pFable parameter was a [".concat(typeof pFable, "].}");
|
|
93
|
+
console.log(tmpErrorMessage);
|
|
94
|
+
return new Error(tmpErrorMessage);
|
|
95
|
+
}
|
|
96
|
+
if (!this.fable) {
|
|
97
|
+
this.fable = pFable;
|
|
98
|
+
}
|
|
100
99
|
this.log = this.fable.log;
|
|
101
100
|
this.servicesMap = this.fable.servicesMap;
|
|
102
101
|
this.services = this.fable.services;
|
|
102
|
+
return true;
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
_defineProperty(FableServiceProviderBase, "isFableService", true);
|
|
106
106
|
module.exports = FableServiceProviderBase;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}]
|
|
111
|
-
}, {}, [
|
|
107
|
+
|
|
108
|
+
// This is left here in case we want to go back to having different code for "core" services
|
|
109
|
+
module.exports.CoreServiceProviderBase = FableServiceProviderBase;
|
|
110
|
+
}, {}]
|
|
111
|
+
}, {}, [1])(1);
|
|
112
112
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==typeof t?t:String(t)}function _toPrimitive(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).FableServiceproviderbase=e()}}((function(){return function e(t,r,i){function o(s
|
|
1
|
+
"use strict";function _defineProperty(e,t,r){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"==typeof t?t:String(t)}function _toPrimitive(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).FableServiceproviderbase=e()}}((function(){return function e(t,r,i){function o(f,s){if(!r[f]){if(!t[f]){var a="function"==typeof require&&require;if(!s&&a)return a(f,!0);if(n)return n(f,!0);var l=new Error("Cannot find module '"+f+"'");throw l.code="MODULE_NOT_FOUND",l}var c=r[f]={exports:{}};t[f][0].call(c.exports,(function(e){return o(t[f][1][e]||e)}),c,c.exports,e,t,r,i)}return r[f].exports}for(var n="function"==typeof require&&require,f=0;f<i.length;f++)o(i[f]);return o}({1:[function(e,t,r){class i{constructor(e,t,r){"object"==typeof e&&e.isFable?this.fable=e:this.fable=!1,this.fable?(this.connectFable(this.fable),this.options="object"==typeof t?t:{}):this.options="object"!=typeof e||e.isFable?"object"==typeof t?t:{}:e,this.serviceType="Unknown",this.fable?this.UUID=e.getUUID():this.UUID="CORE-SVC-".concat(Math.floor(89999*Math.random()+1e4)),this.Hash="string"==typeof r?r:this.fable||"string"!=typeof t?"".concat(this.UUID):t}connectFable(e){if("object"!=typeof e||!e.isFable){let t="Fable Service Provider Base: Cannot connect to Fable, invalid Fable object passed in. The pFable parameter was a [".concat(typeof e,"].}");return console.log(t),new Error(t)}return this.fable||(this.fable=e),this.log=this.fable.log,this.servicesMap=this.fable.servicesMap,this.services=this.fable.services,!0}}_defineProperty(i,"isFableService",!0),t.exports=i,t.exports.CoreServiceProviderBase=i},{}]},{},[1])(1)}));
|
|
2
2
|
//# sourceMappingURL=fable-serviceproviderbase.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["fable-serviceproviderbase.min.js","node_modules/browser-pack/_prelude.js","source/Fable-ServiceProviderBase
|
|
1
|
+
{"version":3,"sources":["fable-serviceproviderbase.min.js","node_modules/browser-pack/_prelude.js","source/Fable-ServiceProviderBase.js"],"names":["_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","f","exports","module","define","amd","window","global","self","this","FableServiceproviderbase","r","e","n","t","o","i","c","require","u","a","Error","code","p","length","FableServiceProviderBase","constructor","pFable","pOptions","pServiceHash","isFable","fable","connectFable","options","serviceType","UUID","getUUID","concat","Math","floor","random","Hash","tmpErrorMessage","console","log","servicesMap","services","CoreServiceProviderBase"],"mappings":"AAAA,aAEA,SAASA,gBAAgBC,EAAKC,EAAKC,GAA4L,OAAnLD,EAAME,eAAeF,MAAiBD,EAAOI,OAAOC,eAAeL,EAAKC,EAAK,CAAEC,MAAOA,EAAOI,YAAY,EAAMC,cAAc,EAAMC,UAAU,IAAkBR,EAAIC,GAAOC,EAAgBF,CAAK,CAC3O,SAASG,eAAeM,GAAO,IAAIR,EAAMS,aAAaD,EAAK,UAAW,MAAsB,iBAARR,EAAmBA,EAAMU,OAAOV,EAAM,CAC1H,SAASS,aAAaE,EAAOC,GAAQ,GAAqB,iBAAVD,GAAgC,OAAVA,EAAgB,OAAOA,EAAO,IAAIE,EAAOF,EAAMG,OAAOC,aAAc,QAAaC,IAATH,EAAoB,CAAE,IAAII,EAAMJ,EAAKK,KAAKP,EAAOC,GAAQ,WAAY,GAAmB,iBAARK,EAAkB,OAAOA,EAAK,MAAM,IAAIE,UAAU,+CAAiD,CAAE,OAAiB,WAATP,EAAoBF,OAASU,QAAQT,EAAQ,ECJxX,SAAAU,GAAA,GAAA,iBAAAC,SAAA,oBAAAC,OAAAA,OAAAD,QAAAD,SAAA,GAAA,mBAAAG,QAAAA,OAAAC,IAAAD,OAAA,GAAAH,OAAA,EAAA,oBAAAK,OAAAA,OAAA,oBAAAC,OAAAA,OAAA,oBAA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E,OAAAC,KAAAC,MAAA,MAAAD,KAAAE,SAAA,MAIA/B,KAAAgC,KAAA,iBAAAZ,EAAAA,EACApB,KAAAsB,OAAA,iBAAAH,EAAA,GAAAS,OACA5B,KAAA0B,MADAP,CAEA,CAEAI,YAAAA,CAAAL,GAEA,GAAA,iBAAAA,IAAAA,EAAAG,QACA,CACA,IAAAY,EAAA,sHAAAL,cAAAV,EAAA,OAEA,OADAgB,QAAAC,IAAAF,GACA,IAAArB,MAAAqB,EACA,CAWA,OATAjC,KAAAsB,QAEAtB,KAAAsB,MAAAJ,GAGAlB,KAAAmC,IAAAnC,KAAAsB,MAAAa,IACAnC,KAAAoC,YAAApC,KAAAsB,MAAAc,YACApC,KAAAqC,SAAArC,KAAAsB,MAAAe,UAEA,CACA,EAGApE,gBAzEA+C,EAAA,kBAwEA,GAGAtB,EAAAD,QAAAuB,EAGAtB,EAAAD,QAAA6C,wBAAAtB,CFEA,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,GCrFX,CDqFe,EACf","file":"fable-serviceproviderbase.min.js","sourcesContent":["(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define([],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.FableServiceproviderbase = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){\n/**\n* Fable Service Base\n* @author <steven@velozo.com>\n*/\n\nclass FableServiceProviderBase\n{\n\t// The constructor can be used in two ways:\n\t// 1) With a fable, options object and service hash (the options object and service hash are optional)\n\t// 2) With an object or nothing as the first parameter, where it will be treated as the options object\n\tconstructor(pFable, pOptions, pServiceHash)\n\t{\n\t\t// Check if a fable was passed in\n\t\tif ((typeof(pFable) === 'object') && pFable.isFable)\n\t\t{\n\t\t\tthis.fable = pFable;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tthis.fable = false;\n\t\t}\n\n\t\tif (this.fable)\n\t\t{\n\t\t\tthis.connectFable(this.fable);\n\t\t\tthis.options = (typeof(pOptions) === 'object') ? pOptions\n\t\t\t\t\t\t\t: {};\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// With no fable, check to see if there was an object passed into either of the first two\n\t\t\t// Parameters, and if so, treat it as the options object\n\t\t\tthis.options = ((typeof(pFable) === 'object') && !pFable.isFable) ? pFable\n\t\t\t\t\t\t\t: (typeof(pOptions) === 'object') ? pOptions\n\t\t\t\t\t\t\t: {};\n\t\t}\n\n\t\t// It's expected that the deriving class will set this\n\t\tthis.serviceType = 'Unknown';\n\n\t\tif (this.fable)\n\t\t{\n\t\t\tthis.UUID = pFable.getUUID();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// Without any dependencies, get a decently random UUID for the service\n\t\t\tthis.UUID = `CORE-SVC-${Math.floor((Math.random() * (99999 - 10000)) + 10000)}`\n\t\t}\n\n\t\t// The service hash is used to identify the specific instantiation of the service in the services map\n\t\tthis.Hash = (typeof(pServiceHash) === 'string') ? pServiceHash \n\t\t\t\t\t: (!this.fable && (typeof(pOptions) === 'string')) ? pOptions\n\t\t\t\t\t: `${this.UUID}`;\n\t}\n\n\tconnectFable(pFable)\n\t{\n\t\tif ((typeof(pFable) !== 'object') || (!pFable.isFable))\n\t\t{\n\t\t\tlet tmpErrorMessage = `Fable Service Provider Base: Cannot connect to Fable, invalid Fable object passed in. The pFable parameter was a [${typeof(pFable)}].}`;\n\t\t\tconsole.log(tmpErrorMessage);\n\t\t\treturn new Error(tmpErrorMessage);\n\t\t}\n\n\t\tif (!this.fable)\n\t\t{\n\t\t\tthis.fable = pFable;\n\t\t}\n\n\t\tthis.log = this.fable.log;\n\t\tthis.servicesMap = this.fable.servicesMap;\n\t\tthis.services = this.fable.services;\n\n\t\treturn true;\n\t}\n\n\tstatic isFableService = true;\n}\n\nmodule.exports = FableServiceProviderBase;\n\n// This is left here in case we want to go back to having different code for \"core\" services\nmodule.exports.CoreServiceProviderBase = FableServiceProviderBase;\n},{}]},{},[1])(1)\n});\n\n","(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()","/**\n* Fable Service Base\n* @author <steven@velozo.com>\n*/\n\nclass FableServiceProviderBase\n{\n\t// The constructor can be used in two ways:\n\t// 1) With a fable, options object and service hash (the options object and service hash are optional)\n\t// 2) With an object or nothing as the first parameter, where it will be treated as the options object\n\tconstructor(pFable, pOptions, pServiceHash)\n\t{\n\t\t// Check if a fable was passed in\n\t\tif ((typeof(pFable) === 'object') && pFable.isFable)\n\t\t{\n\t\t\tthis.fable = pFable;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tthis.fable = false;\n\t\t}\n\n\t\tif (this.fable)\n\t\t{\n\t\t\tthis.connectFable(this.fable);\n\t\t\tthis.options = (typeof(pOptions) === 'object') ? pOptions\n\t\t\t\t\t\t\t: {};\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// With no fable, check to see if there was an object passed into either of the first two\n\t\t\t// Parameters, and if so, treat it as the options object\n\t\t\tthis.options = ((typeof(pFable) === 'object') && !pFable.isFable) ? pFable\n\t\t\t\t\t\t\t: (typeof(pOptions) === 'object') ? pOptions\n\t\t\t\t\t\t\t: {};\n\t\t}\n\n\t\t// It's expected that the deriving class will set this\n\t\tthis.serviceType = 'Unknown';\n\n\t\tif (this.fable)\n\t\t{\n\t\t\tthis.UUID = pFable.getUUID();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// Without any dependencies, get a decently random UUID for the service\n\t\t\tthis.UUID = `CORE-SVC-${Math.floor((Math.random() * (99999 - 10000)) + 10000)}`\n\t\t}\n\n\t\t// The service hash is used to identify the specific instantiation of the service in the services map\n\t\tthis.Hash = (typeof(pServiceHash) === 'string') ? pServiceHash \n\t\t\t\t\t: (!this.fable && (typeof(pOptions) === 'string')) ? pOptions\n\t\t\t\t\t: `${this.UUID}`;\n\t}\n\n\tconnectFable(pFable)\n\t{\n\t\tif ((typeof(pFable) !== 'object') || (!pFable.isFable))\n\t\t{\n\t\t\tlet tmpErrorMessage = `Fable Service Provider Base: Cannot connect to Fable, invalid Fable object passed in. The pFable parameter was a [${typeof(pFable)}].}`;\n\t\t\tconsole.log(tmpErrorMessage);\n\t\t\treturn new Error(tmpErrorMessage);\n\t\t}\n\n\t\tif (!this.fable)\n\t\t{\n\t\t\tthis.fable = pFable;\n\t\t}\n\n\t\tthis.log = this.fable.log;\n\t\tthis.servicesMap = this.fable.servicesMap;\n\t\tthis.services = this.fable.services;\n\n\t\treturn true;\n\t}\n\n\tstatic isFableService = true;\n}\n\nmodule.exports = FableServiceProviderBase;\n\n// This is left here in case we want to go back to having different code for \"core\" services\nmodule.exports.CoreServiceProviderBase = FableServiceProviderBase;"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fable-serviceproviderbase",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.11",
|
|
4
4
|
"description": "Simple base classes for fable services.",
|
|
5
5
|
"main": "source/Fable-ServiceProviderBase.js",
|
|
6
6
|
"scripts": {
|
|
@@ -41,9 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"homepage": "https://github.com/stevenvelozo/fable-serviceproviderbase",
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"fable": "^3.0.
|
|
45
|
-
|
|
46
|
-
"dependencies": {
|
|
47
|
-
"quackage": "^1.0.14"
|
|
44
|
+
"fable": "^3.0.86",
|
|
45
|
+
"quackage": "^1.0.19"
|
|
48
46
|
}
|
|
49
47
|
}
|
|
@@ -5,31 +5,74 @@
|
|
|
5
5
|
|
|
6
6
|
class FableServiceProviderBase
|
|
7
7
|
{
|
|
8
|
+
// The constructor can be used in two ways:
|
|
9
|
+
// 1) With a fable, options object and service hash (the options object and service hash are optional)
|
|
10
|
+
// 2) With an object or nothing as the first parameter, where it will be treated as the options object
|
|
8
11
|
constructor(pFable, pOptions, pServiceHash)
|
|
9
12
|
{
|
|
10
|
-
|
|
13
|
+
// Check if a fable was passed in
|
|
14
|
+
if ((typeof(pFable) === 'object') && pFable.isFable)
|
|
15
|
+
{
|
|
16
|
+
this.fable = pFable;
|
|
17
|
+
}
|
|
18
|
+
else
|
|
19
|
+
{
|
|
20
|
+
this.fable = false;
|
|
21
|
+
}
|
|
11
22
|
|
|
12
|
-
this.
|
|
13
|
-
|
|
14
|
-
|
|
23
|
+
if (this.fable)
|
|
24
|
+
{
|
|
25
|
+
this.connectFable(this.fable);
|
|
26
|
+
this.options = (typeof(pOptions) === 'object') ? pOptions
|
|
27
|
+
: {};
|
|
28
|
+
}
|
|
29
|
+
else
|
|
30
|
+
{
|
|
31
|
+
// With no fable, check to see if there was an object passed into either of the first two
|
|
32
|
+
// Parameters, and if so, treat it as the options object
|
|
33
|
+
this.options = ((typeof(pFable) === 'object') && !pFable.isFable) ? pFable
|
|
34
|
+
: (typeof(pOptions) === 'object') ? pOptions
|
|
35
|
+
: {};
|
|
36
|
+
}
|
|
15
37
|
|
|
38
|
+
// It's expected that the deriving class will set this
|
|
16
39
|
this.serviceType = 'Unknown';
|
|
17
40
|
|
|
18
|
-
if (
|
|
41
|
+
if (this.fable)
|
|
19
42
|
{
|
|
20
43
|
this.UUID = pFable.getUUID();
|
|
21
44
|
}
|
|
22
45
|
else
|
|
23
46
|
{
|
|
24
|
-
|
|
47
|
+
// Without any dependencies, get a decently random UUID for the service
|
|
48
|
+
this.UUID = `CORE-SVC-${Math.floor((Math.random() * (99999 - 10000)) + 10000)}`
|
|
25
49
|
}
|
|
26
50
|
|
|
27
|
-
|
|
51
|
+
// The service hash is used to identify the specific instantiation of the service in the services map
|
|
52
|
+
this.Hash = (typeof(pServiceHash) === 'string') ? pServiceHash
|
|
53
|
+
: (!this.fable && (typeof(pOptions) === 'string')) ? pOptions
|
|
54
|
+
: `${this.UUID}`;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
connectFable(pFable)
|
|
58
|
+
{
|
|
59
|
+
if ((typeof(pFable) !== 'object') || (!pFable.isFable))
|
|
60
|
+
{
|
|
61
|
+
let tmpErrorMessage = `Fable Service Provider Base: Cannot connect to Fable, invalid Fable object passed in. The pFable parameter was a [${typeof(pFable)}].}`;
|
|
62
|
+
console.log(tmpErrorMessage);
|
|
63
|
+
return new Error(tmpErrorMessage);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (!this.fable)
|
|
67
|
+
{
|
|
68
|
+
this.fable = pFable;
|
|
69
|
+
}
|
|
28
70
|
|
|
29
|
-
// Pull back a few things
|
|
30
71
|
this.log = this.fable.log;
|
|
31
72
|
this.servicesMap = this.fable.servicesMap;
|
|
32
73
|
this.services = this.fable.services;
|
|
74
|
+
|
|
75
|
+
return true;
|
|
33
76
|
}
|
|
34
77
|
|
|
35
78
|
static isFableService = true;
|
|
@@ -37,4 +80,5 @@ class FableServiceProviderBase
|
|
|
37
80
|
|
|
38
81
|
module.exports = FableServiceProviderBase;
|
|
39
82
|
|
|
40
|
-
|
|
83
|
+
// This is left here in case we want to go back to having different code for "core" services
|
|
84
|
+
module.exports.CoreServiceProviderBase = FableServiceProviderBase;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Fable Core Pre-initialization Service Base
|
|
3
|
-
*
|
|
4
|
-
* For a couple services, we need to be able to instantiate them before the Fable object is fully initialized.
|
|
5
|
-
* This is a base class for those services.
|
|
6
|
-
*
|
|
7
|
-
* @author <steven@velozo.com>
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
class FableCoreServiceProviderBase
|
|
11
|
-
{
|
|
12
|
-
constructor(pOptions, pServiceHash)
|
|
13
|
-
{
|
|
14
|
-
this.fable = false;
|
|
15
|
-
|
|
16
|
-
this.options = (typeof(pOptions) === 'object') ? pOptions : {};
|
|
17
|
-
|
|
18
|
-
this.serviceType = 'Unknown';
|
|
19
|
-
|
|
20
|
-
// The hash will be a non-standard UUID ... the UUID service uses this base class!
|
|
21
|
-
this.UUID = `CORESVC-${Math.floor((Math.random() * (99999 - 10000)) + 10000)}`;
|
|
22
|
-
|
|
23
|
-
this.Hash = (typeof(pServiceHash) === 'string') ? pServiceHash : `${this.UUID}`;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
static isFableService = true;
|
|
28
|
-
|
|
29
|
-
// After fable is initialized, it would be expected to be wired in as a normal service.
|
|
30
|
-
connectFable(pFable)
|
|
31
|
-
{
|
|
32
|
-
this.fable = pFable;
|
|
33
|
-
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
module.exports = FableCoreServiceProviderBase;
|