fable-serviceproviderbase 3.0.15 → 3.0.16
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/package.json +10 -5
- package/source/Fable-ServiceProviderBase.js +25 -5
- package/test/FableServiceProvider_tests.js +17 -2
- package/tsconfig.build.json +15 -0
- package/tsconfig.json +15 -0
- package/types/source/Fable-ServiceProviderBase.d.ts +37 -0
- package/types/source/Fable-ServiceProviderBase.d.ts.map +1 -0
- package/.quackage.json +0 -9
- package/dist/fable-serviceproviderbase.js +0 -163
- package/dist/fable-serviceproviderbase.min.js +0 -2
- package/dist/fable-serviceproviderbase.min.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fable-serviceproviderbase",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.16",
|
|
4
4
|
"description": "Simple base classes for fable services.",
|
|
5
5
|
"main": "source/Fable-ServiceProviderBase.js",
|
|
6
6
|
"scripts": {
|
|
@@ -8,8 +8,11 @@
|
|
|
8
8
|
"test": "npx mocha -u tdd -R spec",
|
|
9
9
|
"tests": "npx mocha -u tdd --exit -R spec --grep",
|
|
10
10
|
"coverage": "npx nyc --reporter=lcov --reporter=text-lcov npx mocha -- -u tdd -R spec",
|
|
11
|
-
"build": "npx quack build"
|
|
11
|
+
"build": "npx quack build",
|
|
12
|
+
"types": "tsc -p ./tsconfig.build.json",
|
|
13
|
+
"check": "tsc -p . --noEmit"
|
|
12
14
|
},
|
|
15
|
+
"types": "types/source/Fable-ServiceProviderBase.d.ts",
|
|
13
16
|
"mocha": {
|
|
14
17
|
"diff": true,
|
|
15
18
|
"extension": [
|
|
@@ -43,7 +46,9 @@
|
|
|
43
46
|
},
|
|
44
47
|
"homepage": "https://github.com/stevenvelozo/fable-serviceproviderbase",
|
|
45
48
|
"devDependencies": {
|
|
46
|
-
"
|
|
47
|
-
"
|
|
49
|
+
"@types/mocha": "^10.0.10",
|
|
50
|
+
"fable": "^3.1.51",
|
|
51
|
+
"quackage": "^1.0.45",
|
|
52
|
+
"typescript": "^5.9.3"
|
|
48
53
|
}
|
|
49
|
-
}
|
|
54
|
+
}
|
|
@@ -7,11 +7,28 @@ const libPackage = require('../package.json');
|
|
|
7
7
|
|
|
8
8
|
class FableServiceProviderBase
|
|
9
9
|
{
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
/**
|
|
11
|
+
* The constructor can be used in two ways:
|
|
12
|
+
* 1) With a fable, options object and service hash (the options object and service hash are optional)a
|
|
13
|
+
* 2) With an object or nothing as the first parameter, where it will be treated as the options object
|
|
14
|
+
*
|
|
15
|
+
* @param {import('fable')|Record<string, any>} [pFable] - (optional) The fable instance, or the options object if there is no fable
|
|
16
|
+
* @param {Record<string, any>|string} [pOptions] - (optional) The options object, or the service hash if there is no fable
|
|
17
|
+
* @param {string} [pServiceHash] - (optional) The service hash to identify this service instance
|
|
18
|
+
*/
|
|
13
19
|
constructor(pFable, pOptions, pServiceHash)
|
|
14
20
|
{
|
|
21
|
+
/** @type {import('fable')} */
|
|
22
|
+
this.fable;
|
|
23
|
+
/** @type {string} */
|
|
24
|
+
this.UUID;
|
|
25
|
+
/** @type {Record<string, any>} */
|
|
26
|
+
this.options;
|
|
27
|
+
/** @type {Record<string, any>} */
|
|
28
|
+
this.services;
|
|
29
|
+
/** @type {Record<string, any>} */
|
|
30
|
+
this.servicesMap;
|
|
31
|
+
|
|
15
32
|
// Check if a fable was passed in; connect it if so
|
|
16
33
|
if ((typeof(pFable) === 'object') && pFable.isFable)
|
|
17
34
|
{
|
|
@@ -23,7 +40,7 @@ class FableServiceProviderBase
|
|
|
23
40
|
}
|
|
24
41
|
|
|
25
42
|
// Initialize the services map if it wasn't passed in
|
|
26
|
-
/** @type {
|
|
43
|
+
/** @type {Record<string, any>} */
|
|
27
44
|
this._PackageFableServiceProvider = libPackage;
|
|
28
45
|
|
|
29
46
|
// initialize options and UUID based on whether the fable was passed in or not.
|
|
@@ -52,6 +69,9 @@ class FableServiceProviderBase
|
|
|
52
69
|
: `${this.UUID}`;
|
|
53
70
|
}
|
|
54
71
|
|
|
72
|
+
/**
|
|
73
|
+
* @param {import('fable')} pFable
|
|
74
|
+
*/
|
|
55
75
|
connectFable(pFable)
|
|
56
76
|
{
|
|
57
77
|
if ((typeof(pFable) !== 'object') || (!pFable.isFable))
|
|
@@ -89,4 +109,4 @@ class FableServiceProviderBase
|
|
|
89
109
|
module.exports = FableServiceProviderBase;
|
|
90
110
|
|
|
91
111
|
// This is left here in case we want to go back to having different code/base class for "core" services
|
|
92
|
-
module.exports.CoreServiceProviderBase = FableServiceProviderBase;
|
|
112
|
+
module.exports.CoreServiceProviderBase = FableServiceProviderBase;
|
|
@@ -9,11 +9,16 @@
|
|
|
9
9
|
const libFable = require('fable');
|
|
10
10
|
const libFableServiceProviderBase = require('../source/Fable-ServiceProviderBase.js');
|
|
11
11
|
|
|
12
|
-
const Chai = require(
|
|
12
|
+
const Chai = require('chai');
|
|
13
13
|
const Expect = Chai.expect;
|
|
14
14
|
|
|
15
15
|
class SimpleService extends libFableServiceProviderBase
|
|
16
16
|
{
|
|
17
|
+
/**
|
|
18
|
+
* @param {import('fable')|Record<string, any>} pFable - The fable instance, or the options object if there is no fable
|
|
19
|
+
* @param {Record<string, any>|string} [pOptions] - (optional) The options object, or the service hash if there is no fable
|
|
20
|
+
* @param {string} [pServiceHash] - (optional) The service hash to identify this service instance
|
|
21
|
+
*/
|
|
17
22
|
constructor(pFable, pOptions, pServiceHash)
|
|
18
23
|
{
|
|
19
24
|
super(pFable, pOptions, pServiceHash);
|
|
@@ -29,6 +34,11 @@ class SimpleService extends libFableServiceProviderBase
|
|
|
29
34
|
|
|
30
35
|
class MockDatabaseService extends libFableServiceProviderBase
|
|
31
36
|
{
|
|
37
|
+
/**
|
|
38
|
+
* @param {import('fable')|Record<string, any>} pFable - The fable instance, or the options object if there is no fable
|
|
39
|
+
* @param {Record<string, any>|string} [pOptions] - (optional) The options object, or the service hash if there is no fable
|
|
40
|
+
* @param {string} [pServiceHash] - (optional) The service hash to identify this service instance
|
|
41
|
+
*/
|
|
32
42
|
constructor(pFable, pOptions, pServiceHash)
|
|
33
43
|
{
|
|
34
44
|
super(pFable, pOptions, pServiceHash);
|
|
@@ -49,6 +59,10 @@ class MockDatabaseService extends libFableServiceProviderBase
|
|
|
49
59
|
|
|
50
60
|
class MockCoreService extends libFableServiceProviderBase.CoreServiceProviderBase
|
|
51
61
|
{
|
|
62
|
+
/**
|
|
63
|
+
* @param {Record<string, any>|string} [pOptions] - (optional) The options object, or the service hash if there is no fable
|
|
64
|
+
* @param {string} [pServiceHash] - (optional) The service hash to identify this service instance
|
|
65
|
+
*/
|
|
52
66
|
constructor(pOptions, pServiceHash)
|
|
53
67
|
{
|
|
54
68
|
super(pOptions, pServiceHash);
|
|
@@ -68,6 +82,7 @@ suite
|
|
|
68
82
|
'Fable Service Manager',
|
|
69
83
|
function()
|
|
70
84
|
{
|
|
85
|
+
/** @type {import('fable')} */
|
|
71
86
|
var testFable = false;
|
|
72
87
|
|
|
73
88
|
setup
|
|
@@ -295,4 +310,4 @@ suite
|
|
|
295
310
|
}
|
|
296
311
|
);
|
|
297
312
|
}
|
|
298
|
-
);
|
|
313
|
+
);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"include": ["source"],
|
|
3
|
+
"compilerOptions":
|
|
4
|
+
{
|
|
5
|
+
"lib": ["es5", "es6", "dom"],
|
|
6
|
+
"module": "commonjs",
|
|
7
|
+
"allowJs": true,
|
|
8
|
+
"checkJs": true,
|
|
9
|
+
"declaration": true,
|
|
10
|
+
"emitDeclarationOnly": true,
|
|
11
|
+
"outDir": "types",
|
|
12
|
+
"declarationMap": true,
|
|
13
|
+
"resolveJsonModule": true
|
|
14
|
+
}
|
|
15
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"include": ["source", "test"],
|
|
3
|
+
"compilerOptions":
|
|
4
|
+
{
|
|
5
|
+
"lib": ["es5", "es6", "dom"],
|
|
6
|
+
"module": "commonjs",
|
|
7
|
+
"allowJs": true,
|
|
8
|
+
"checkJs": true,
|
|
9
|
+
"declaration": true,
|
|
10
|
+
"emitDeclarationOnly": true,
|
|
11
|
+
"outDir": "types",
|
|
12
|
+
"declarationMap": true,
|
|
13
|
+
"resolveJsonModule": true
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export = FableServiceProviderBase;
|
|
2
|
+
declare class FableServiceProviderBase {
|
|
3
|
+
static isFableService: boolean;
|
|
4
|
+
/**
|
|
5
|
+
* The constructor can be used in two ways:
|
|
6
|
+
* 1) With a fable, options object and service hash (the options object and service hash are optional)a
|
|
7
|
+
* 2) With an object or nothing as the first parameter, where it will be treated as the options object
|
|
8
|
+
*
|
|
9
|
+
* @param {import('fable')|Record<string, any>} [pFable] - (optional) The fable instance, or the options object if there is no fable
|
|
10
|
+
* @param {Record<string, any>|string} [pOptions] - (optional) The options object, or the service hash if there is no fable
|
|
11
|
+
* @param {string} [pServiceHash] - (optional) The service hash to identify this service instance
|
|
12
|
+
*/
|
|
13
|
+
constructor(pFable?: any | Record<string, any>, pOptions?: Record<string, any> | string, pServiceHash?: string);
|
|
14
|
+
/** @type {import('fable')} */
|
|
15
|
+
fable: any;
|
|
16
|
+
/** @type {string} */
|
|
17
|
+
UUID: string;
|
|
18
|
+
/** @type {Record<string, any>} */
|
|
19
|
+
options: Record<string, any>;
|
|
20
|
+
/** @type {Record<string, any>} */
|
|
21
|
+
services: Record<string, any>;
|
|
22
|
+
/** @type {Record<string, any>} */
|
|
23
|
+
servicesMap: Record<string, any>;
|
|
24
|
+
/** @type {Record<string, any>} */
|
|
25
|
+
_PackageFableServiceProvider: Record<string, any>;
|
|
26
|
+
serviceType: string;
|
|
27
|
+
Hash: string;
|
|
28
|
+
/**
|
|
29
|
+
* @param {import('fable')} pFable
|
|
30
|
+
*/
|
|
31
|
+
connectFable(pFable: any): true | Error;
|
|
32
|
+
log: any;
|
|
33
|
+
}
|
|
34
|
+
declare namespace FableServiceProviderBase {
|
|
35
|
+
export { FableServiceProviderBase as CoreServiceProviderBase };
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=Fable-ServiceProviderBase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Fable-ServiceProviderBase.d.ts","sourceRoot":"","sources":["../../source/Fable-ServiceProviderBase.js"],"names":[],"mappings":";AAOA;IAkGC,+BAA6B;IAhG7B;;;;;;;;OAQG;IACH,qBAJW,GAAe,GAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,aACnC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAC,MAAM,iBAC1B,MAAM,EAqDhB;IAjDA,8BAA8B;IAC9B,WAAU;IACV,qBAAqB;IACrB,MADW,MAAM,CACR;IACT,kCAAkC;IAClC,SADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAClB;IACZ,kCAAkC;IAClC,UADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CACjB;IACb,kCAAkC;IAClC,aADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CACd;IAahB,kCAAkC;IAClC,8BADW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CACgB;IAoB9C,oBAAyC;IAGzC,aAEmB;IAGpB;;OAEG;IACH,wCA6BC;IAbC,SAA6B;CAgB/B"}
|
package/.quackage.json
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
-
(function (f) {
|
|
7
|
-
if (typeof exports === "object" && typeof module !== "undefined") {
|
|
8
|
-
module.exports = f();
|
|
9
|
-
} else if (typeof define === "function" && define.amd) {
|
|
10
|
-
define([], f);
|
|
11
|
-
} else {
|
|
12
|
-
var g;
|
|
13
|
-
if (typeof window !== "undefined") {
|
|
14
|
-
g = window;
|
|
15
|
-
} else if (typeof global !== "undefined") {
|
|
16
|
-
g = global;
|
|
17
|
-
} else if (typeof self !== "undefined") {
|
|
18
|
-
g = self;
|
|
19
|
-
} else {
|
|
20
|
-
g = this;
|
|
21
|
-
}
|
|
22
|
-
g.FableServiceproviderbase = f();
|
|
23
|
-
}
|
|
24
|
-
})(function () {
|
|
25
|
-
var define, module, exports;
|
|
26
|
-
return function () {
|
|
27
|
-
function r(e, n, t) {
|
|
28
|
-
function o(i, f) {
|
|
29
|
-
if (!n[i]) {
|
|
30
|
-
if (!e[i]) {
|
|
31
|
-
var c = "function" == typeof require && require;
|
|
32
|
-
if (!f && c) return c(i, !0);
|
|
33
|
-
if (u) return u(i, !0);
|
|
34
|
-
var a = new Error("Cannot find module '" + i + "'");
|
|
35
|
-
throw a.code = "MODULE_NOT_FOUND", a;
|
|
36
|
-
}
|
|
37
|
-
var p = n[i] = {
|
|
38
|
-
exports: {}
|
|
39
|
-
};
|
|
40
|
-
e[i][0].call(p.exports, function (r) {
|
|
41
|
-
var n = e[i][1][r];
|
|
42
|
-
return o(n || r);
|
|
43
|
-
}, p, p.exports, r, e, n, t);
|
|
44
|
-
}
|
|
45
|
-
return n[i].exports;
|
|
46
|
-
}
|
|
47
|
-
for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) o(t[i]);
|
|
48
|
-
return o;
|
|
49
|
-
}
|
|
50
|
-
return r;
|
|
51
|
-
}()({
|
|
52
|
-
1: [function (require, module, exports) {
|
|
53
|
-
module.exports = {
|
|
54
|
-
"name": "fable-serviceproviderbase",
|
|
55
|
-
"version": "3.0.15",
|
|
56
|
-
"description": "Simple base classes for fable services.",
|
|
57
|
-
"main": "source/Fable-ServiceProviderBase.js",
|
|
58
|
-
"scripts": {
|
|
59
|
-
"start": "node source/Fable-ServiceProviderBase.js",
|
|
60
|
-
"test": "npx mocha -u tdd -R spec",
|
|
61
|
-
"tests": "npx mocha -u tdd --exit -R spec --grep",
|
|
62
|
-
"coverage": "npx nyc --reporter=lcov --reporter=text-lcov npx mocha -- -u tdd -R spec",
|
|
63
|
-
"build": "npx quack build"
|
|
64
|
-
},
|
|
65
|
-
"mocha": {
|
|
66
|
-
"diff": true,
|
|
67
|
-
"extension": ["js"],
|
|
68
|
-
"package": "./package.json",
|
|
69
|
-
"reporter": "spec",
|
|
70
|
-
"slow": "75",
|
|
71
|
-
"timeout": "5000",
|
|
72
|
-
"ui": "tdd",
|
|
73
|
-
"watch-files": ["source/**/*.js", "test/**/*.js"],
|
|
74
|
-
"watch-ignore": ["lib/vendor"]
|
|
75
|
-
},
|
|
76
|
-
"repository": {
|
|
77
|
-
"type": "git",
|
|
78
|
-
"url": "https://github.com/stevenvelozo/fable-serviceproviderbase.git"
|
|
79
|
-
},
|
|
80
|
-
"keywords": ["entity", "behavior"],
|
|
81
|
-
"author": "Steven Velozo <steven@velozo.com> (http://velozo.com/)",
|
|
82
|
-
"license": "MIT",
|
|
83
|
-
"bugs": {
|
|
84
|
-
"url": "https://github.com/stevenvelozo/fable-serviceproviderbase/issues"
|
|
85
|
-
},
|
|
86
|
-
"homepage": "https://github.com/stevenvelozo/fable-serviceproviderbase",
|
|
87
|
-
"devDependencies": {
|
|
88
|
-
"fable": "^3.0.143",
|
|
89
|
-
"quackage": "^1.0.33"
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
}, {}],
|
|
93
|
-
2: [function (require, module, exports) {
|
|
94
|
-
/**
|
|
95
|
-
* Fable Service Base
|
|
96
|
-
* @author <steven@velozo.com>
|
|
97
|
-
*/
|
|
98
|
-
|
|
99
|
-
const libPackage = require('../package.json');
|
|
100
|
-
class FableServiceProviderBase {
|
|
101
|
-
// The constructor can be used in two ways:
|
|
102
|
-
// 1) With a fable, options object and service hash (the options object and service hash are optional)
|
|
103
|
-
// 2) With an object or nothing as the first parameter, where it will be treated as the options object
|
|
104
|
-
constructor(pFable, pOptions, pServiceHash) {
|
|
105
|
-
// Check if a fable was passed in; connect it if so
|
|
106
|
-
if (typeof pFable === 'object' && pFable.isFable) {
|
|
107
|
-
this.connectFable(pFable);
|
|
108
|
-
} else {
|
|
109
|
-
this.fable = false;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Initialize the services map if it wasn't passed in
|
|
113
|
-
/** @type {Object} */
|
|
114
|
-
this._PackageFableServiceProvider = libPackage;
|
|
115
|
-
|
|
116
|
-
// initialize options and UUID based on whether the fable was passed in or not.
|
|
117
|
-
if (this.fable) {
|
|
118
|
-
this.UUID = pFable.getUUID();
|
|
119
|
-
this.options = typeof pOptions === 'object' ? pOptions : {};
|
|
120
|
-
} else {
|
|
121
|
-
// With no fable, check to see if there was an object passed into either of the first two
|
|
122
|
-
// Parameters, and if so, treat it as the options object
|
|
123
|
-
this.options = typeof pFable === 'object' && !pFable.isFable ? pFable : typeof pOptions === 'object' ? pOptions : {};
|
|
124
|
-
this.UUID = `CORE-SVC-${Math.floor(Math.random() * (99999 - 10000) + 10000)}`;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// It's expected that the deriving class will set this
|
|
128
|
-
this.serviceType = `Unknown-${this.UUID}`;
|
|
129
|
-
|
|
130
|
-
// The service hash is used to identify the specific instantiation of the service in the services map
|
|
131
|
-
this.Hash = typeof pServiceHash === 'string' ? pServiceHash : !this.fable && typeof pOptions === 'string' ? pOptions : `${this.UUID}`;
|
|
132
|
-
}
|
|
133
|
-
connectFable(pFable) {
|
|
134
|
-
if (typeof pFable !== 'object' || !pFable.isFable) {
|
|
135
|
-
let tmpErrorMessage = `Fable Service Provider Base: Cannot connect to Fable, invalid Fable object passed in. The pFable parameter was a [${typeof pFable}].}`;
|
|
136
|
-
console.log(tmpErrorMessage);
|
|
137
|
-
return new Error(tmpErrorMessage);
|
|
138
|
-
}
|
|
139
|
-
if (!this.fable) {
|
|
140
|
-
this.fable = pFable;
|
|
141
|
-
}
|
|
142
|
-
if (!this.log) {
|
|
143
|
-
this.log = this.fable.Logging;
|
|
144
|
-
}
|
|
145
|
-
if (!this.services) {
|
|
146
|
-
this.services = this.fable.services;
|
|
147
|
-
}
|
|
148
|
-
if (!this.servicesMap) {
|
|
149
|
-
this.servicesMap = this.fable.servicesMap;
|
|
150
|
-
}
|
|
151
|
-
return true;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
_defineProperty(FableServiceProviderBase, "isFableService", true);
|
|
155
|
-
module.exports = FableServiceProviderBase;
|
|
156
|
-
|
|
157
|
-
// This is left here in case we want to go back to having different code/base class for "core" services
|
|
158
|
-
module.exports.CoreServiceProviderBase = FableServiceProviderBase;
|
|
159
|
-
}, {
|
|
160
|
-
"../package.json": 1
|
|
161
|
-
}]
|
|
162
|
-
}, {}, [2])(2);
|
|
163
|
-
});
|
|
@@ -1,2 +0,0 @@
|
|
|
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:t+""}function _toPrimitive(e,t){if("object"!=typeof e||!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(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,o){function i(n,a){if(!r[n]){if(!t[n]){var c="function"==typeof require&&require;if(!a&&c)return c(n,!0);if(s)return s(n,!0);var l=new Error("Cannot find module '"+n+"'");throw l.code="MODULE_NOT_FOUND",l}var f=r[n]={exports:{}};t[n][0].call(f.exports,(function(e){return i(t[n][1][e]||e)}),f,f.exports,e,t,r,o)}return r[n].exports}for(var s="function"==typeof require&&require,n=0;n<o.length;n++)i(o[n]);return i}({1:[function(e,t,r){t.exports={name:"fable-serviceproviderbase",version:"3.0.15",description:"Simple base classes for fable services.",main:"source/Fable-ServiceProviderBase.js",scripts:{start:"node source/Fable-ServiceProviderBase.js",test:"npx mocha -u tdd -R spec",tests:"npx mocha -u tdd --exit -R spec --grep",coverage:"npx nyc --reporter=lcov --reporter=text-lcov npx mocha -- -u tdd -R spec",build:"npx quack build"},mocha:{diff:!0,extension:["js"],package:"./package.json",reporter:"spec",slow:"75",timeout:"5000",ui:"tdd","watch-files":["source/**/*.js","test/**/*.js"],"watch-ignore":["lib/vendor"]},repository:{type:"git",url:"https://github.com/stevenvelozo/fable-serviceproviderbase.git"},keywords:["entity","behavior"],author:"Steven Velozo <steven@velozo.com> (http://velozo.com/)",license:"MIT",bugs:{url:"https://github.com/stevenvelozo/fable-serviceproviderbase/issues"},homepage:"https://github.com/stevenvelozo/fable-serviceproviderbase",devDependencies:{fable:"^3.0.143",quackage:"^1.0.33"}}},{}],2:[function(e,t,r){const o=e("../package.json");class i{constructor(e,t,r){"object"==typeof e&&e.isFable?this.connectFable(e):this.fable=!1,this._PackageFableServiceProvider=o,this.fable?(this.UUID=e.getUUID(),this.options="object"==typeof t?t:{}):(this.options="object"!=typeof e||e.isFable?"object"==typeof t?t:{}:e,this.UUID=`CORE-SVC-${Math.floor(89999*Math.random()+1e4)}`),this.serviceType=`Unknown-${this.UUID}`,this.Hash="string"==typeof r?r:this.fable||"string"!=typeof t?`${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 [${typeof e}].}`;return console.log(t),new Error(t)}return this.fable||(this.fable=e),this.log||(this.log=this.fable.Logging),this.services||(this.services=this.fable.services),this.servicesMap||(this.servicesMap=this.fable.servicesMap),!0}}_defineProperty(i,"isFableService",!0),t.exports=i,t.exports.CoreServiceProviderBase=i},{"../package.json":1}]},{},[2])(2)}));
|
|
2
|
-
//# sourceMappingURL=fable-serviceproviderbase.min.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["fable-serviceproviderbase.min.js","node_modules/browser-pack/_prelude.js","package.json","source/Fable-ServiceProviderBase.js"],"names":["_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","f","exports","module","define","amd","window","global","self","this","FableServiceproviderbase","n","o","c","require","u","a","Error","code","p","length","name","version","description","main","scripts","start","test","tests","coverage","build","mocha","diff","extension","package","reporter","slow","timeout","ui","repository","type","url","keywords","author","license","bugs","homepage","devDependencies","fable","quackage","libPackage","FableServiceProviderBase","constructor","pFable","pOptions","pServiceHash","isFable","connectFable","_PackageFableServiceProvider","UUID","getUUID","options","Math","floor","random","serviceType","Hash","tmpErrorMessage","console","log","Logging","services","servicesMap","CoreServiceProviderBase"],"mappings":"AAAA,aAEA,SAASA,gBAAgBC,EAAGC,EAAGC,GAAK,OAAQD,EAAIE,eAAeF,MAAOD,EAAII,OAAOC,eAAeL,EAAGC,EAAG,CAAEK,MAAOJ,EAAGK,YAAY,EAAIC,cAAc,EAAIC,UAAU,IAAQT,EAAEC,GAAKC,EAAGF,CAAG,CACnL,SAASG,eAAeD,GAAK,IAAIQ,EAAIC,aAAaT,EAAG,UAAW,MAAO,iBAAmBQ,EAAIA,EAAIA,E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EA,GAAA,iBAAAA,IAAAA,EAAAG,QACA,CACA,IAAAW,EAAA,6HAAAd,OAEA,OADAe,QAAAC,IAAAF,GACA,IAAAlD,MAAAkD,EACA,CAqBA,OAnBA1D,KAAAuC,QAEAvC,KAAAuC,MAAAK,GAGA5C,KAAA4D,MAEA5D,KAAA4D,IAAA5D,KAAAuC,MAAAsB,SAEA7D,KAAA8D,WAEA9D,KAAA8D,SAAA9D,KAAAuC,MAAAuB,UAGA9D,KAAA+D,cAEA/D,KAAA+D,YAAA/D,KAAAuC,MAAAwB,cAGA,CACA,EAGA1F,gBA/EAqE,EAAA,kBA8EA,GAGAhD,EAAAD,QAAAiD,EAGAhD,EAAAD,QAAAuE,wBAAAtB,CHoDA,EAAE,CAAC,kBAAkB,KAAK,CAAC,EAAE,CAAC,GC/I9B,CD+IkC,EAClC","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){\nmodule.exports={\n \"name\": \"fable-serviceproviderbase\",\n \"version\": \"3.0.15\",\n \"description\": \"Simple base classes for fable services.\",\n \"main\": \"source/Fable-ServiceProviderBase.js\",\n \"scripts\": {\n \"start\": \"node source/Fable-ServiceProviderBase.js\",\n \"test\": \"npx mocha -u tdd -R spec\",\n \"tests\": \"npx mocha -u tdd --exit -R spec --grep\",\n \"coverage\": \"npx nyc --reporter=lcov --reporter=text-lcov npx mocha -- -u tdd -R spec\",\n \"build\": \"npx quack build\"\n },\n \"mocha\": {\n \"diff\": true,\n \"extension\": [\n \"js\"\n ],\n \"package\": \"./package.json\",\n \"reporter\": \"spec\",\n \"slow\": \"75\",\n \"timeout\": \"5000\",\n \"ui\": \"tdd\",\n \"watch-files\": [\n \"source/**/*.js\",\n \"test/**/*.js\"\n ],\n \"watch-ignore\": [\n \"lib/vendor\"\n ]\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/stevenvelozo/fable-serviceproviderbase.git\"\n },\n \"keywords\": [\n \"entity\",\n \"behavior\"\n ],\n \"author\": \"Steven Velozo <steven@velozo.com> (http://velozo.com/)\",\n \"license\": \"MIT\",\n \"bugs\": {\n \"url\": \"https://github.com/stevenvelozo/fable-serviceproviderbase/issues\"\n },\n \"homepage\": \"https://github.com/stevenvelozo/fable-serviceproviderbase\",\n \"devDependencies\": {\n \"fable\": \"^3.0.143\",\n \"quackage\": \"^1.0.33\"\n }\n}\n},{}],2:[function(require,module,exports){\n/**\n* Fable Service Base\n* @author <steven@velozo.com>\n*/\n\nconst libPackage = require('../package.json');\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; connect it if so\n\t\tif ((typeof(pFable) === 'object') && pFable.isFable)\n\t\t{\n\t\t\tthis.connectFable(pFable);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tthis.fable = false;\n\t\t}\n\n\t\t// Initialize the services map if it wasn't passed in\n\t\t/** @type {Object} */\n\t\tthis._PackageFableServiceProvider = libPackage;\n\n\t\t// initialize options and UUID based on whether the fable was passed in or not.\n\t\tif (this.fable)\n\t\t{\n\t\t\tthis.UUID = pFable.getUUID();\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\tthis.UUID = `CORE-SVC-${Math.floor((Math.random() * (99999 - 10000)) + 10000)}`\n\t\t}\n\n\t\t// It's expected that the deriving class will set this\n\t\tthis.serviceType = `Unknown-${this.UUID}`;\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\tif (!this.log)\n\t\t{\n\t\t\tthis.log = this.fable.Logging;\n\t\t}\n\t\tif (!this.services)\n\t\t{\n\t\t\tthis.services = this.fable.services;\n\t\t}\n\n\t\tif (!this.servicesMap)\n\t\t{\n\t\t\tthis.servicesMap = this.fable.servicesMap;\n\t\t}\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/base class for \"core\" services\nmodule.exports.CoreServiceProviderBase = FableServiceProviderBase;\n},{\"../package.json\":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})()","module.exports={\n \"name\": \"fable-serviceproviderbase\",\n \"version\": \"3.0.15\",\n \"description\": \"Simple base classes for fable services.\",\n \"main\": \"source/Fable-ServiceProviderBase.js\",\n \"scripts\": {\n \"start\": \"node source/Fable-ServiceProviderBase.js\",\n \"test\": \"npx mocha -u tdd -R spec\",\n \"tests\": \"npx mocha -u tdd --exit -R spec --grep\",\n \"coverage\": \"npx nyc --reporter=lcov --reporter=text-lcov npx mocha -- -u tdd -R spec\",\n \"build\": \"npx quack build\"\n },\n \"mocha\": {\n \"diff\": true,\n \"extension\": [\n \"js\"\n ],\n \"package\": \"./package.json\",\n \"reporter\": \"spec\",\n \"slow\": \"75\",\n \"timeout\": \"5000\",\n \"ui\": \"tdd\",\n \"watch-files\": [\n \"source/**/*.js\",\n \"test/**/*.js\"\n ],\n \"watch-ignore\": [\n \"lib/vendor\"\n ]\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/stevenvelozo/fable-serviceproviderbase.git\"\n },\n \"keywords\": [\n \"entity\",\n \"behavior\"\n ],\n \"author\": \"Steven Velozo <steven@velozo.com> (http://velozo.com/)\",\n \"license\": \"MIT\",\n \"bugs\": {\n \"url\": \"https://github.com/stevenvelozo/fable-serviceproviderbase/issues\"\n },\n \"homepage\": \"https://github.com/stevenvelozo/fable-serviceproviderbase\",\n \"devDependencies\": {\n \"fable\": \"^3.0.143\",\n \"quackage\": \"^1.0.33\"\n }\n}","/**\n* Fable Service Base\n* @author <steven@velozo.com>\n*/\n\nconst libPackage = require('../package.json');\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; connect it if so\n\t\tif ((typeof(pFable) === 'object') && pFable.isFable)\n\t\t{\n\t\t\tthis.connectFable(pFable);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tthis.fable = false;\n\t\t}\n\n\t\t// Initialize the services map if it wasn't passed in\n\t\t/** @type {Object} */\n\t\tthis._PackageFableServiceProvider = libPackage;\n\n\t\t// initialize options and UUID based on whether the fable was passed in or not.\n\t\tif (this.fable)\n\t\t{\n\t\t\tthis.UUID = pFable.getUUID();\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\tthis.UUID = `CORE-SVC-${Math.floor((Math.random() * (99999 - 10000)) + 10000)}`\n\t\t}\n\n\t\t// It's expected that the deriving class will set this\n\t\tthis.serviceType = `Unknown-${this.UUID}`;\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\tif (!this.log)\n\t\t{\n\t\t\tthis.log = this.fable.Logging;\n\t\t}\n\t\tif (!this.services)\n\t\t{\n\t\t\tthis.services = this.fable.services;\n\t\t}\n\n\t\tif (!this.servicesMap)\n\t\t{\n\t\t\tthis.servicesMap = this.fable.servicesMap;\n\t\t}\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/base class for \"core\" services\nmodule.exports.CoreServiceProviderBase = FableServiceProviderBase;"]}
|