@adminide-stack/extension-api 11.0.1-alpha.7 → 12.0.1-alpha.0
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/lib/connections/jsonrpc2/connection.js +507 -525
- package/lib/connections/jsonrpc2/connection.js.map +1 -0
- package/lib/connections/jsonrpc2/events.js +100 -100
- package/lib/connections/jsonrpc2/events.js.map +1 -0
- package/lib/connections/jsonrpc2/linkedMap.js +248 -246
- package/lib/connections/jsonrpc2/linkedMap.js.map +1 -0
- package/lib/connections/jsonrpc2/messages.js +36 -40
- package/lib/connections/jsonrpc2/messages.js.map +1 -0
- package/lib/connections/jsonrpc2/test-helper.js +35 -21
- package/lib/connections/jsonrpc2/test-helper.js.map +1 -0
- package/lib/connections/jsonrpc2/trace.js +70 -82
- package/lib/connections/jsonrpc2/trace.js.map +1 -0
- package/lib/connections/jsonrpc2/transport.js +56 -56
- package/lib/connections/jsonrpc2/transport.js.map +1 -0
- package/lib/connections/jsonrpc2/transports/webWorker.js +80 -88
- package/lib/connections/jsonrpc2/transports/webWorker.js.map +1 -0
- package/lib/connections/proxy/proxy.js +46 -47
- package/lib/connections/proxy/proxy.js.map +1 -0
- package/lib/connections/remote-rpc/browser-remote-rpc.js +55 -54
- package/lib/connections/remote-rpc/browser-remote-rpc.js.map +1 -0
- package/lib/connections/remote-rpc/rxjs-websockets.js +68 -68
- package/lib/connections/remote-rpc/rxjs-websockets.js.map +1 -0
- package/lib/constants/action-types.js +27 -27
- package/lib/constants/action-types.js.map +1 -0
- package/lib/constants/types.js +7 -7
- package/lib/constants/types.js.map +1 -0
- package/lib/core/expr/evaluator.js +103 -104
- package/lib/core/expr/evaluator.js.map +1 -0
- package/lib/core/expr/lexer.js +366 -361
- package/lib/core/expr/lexer.js.map +1 -0
- package/lib/core/expr/parser.js +228 -217
- package/lib/core/expr/parser.js.map +1 -0
- package/lib/core/types/ext-host-types.js +53 -54
- package/lib/core/types/ext-host-types.js.map +1 -0
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -0
- package/lib/interfaces/contributions/contribution.js +40 -40
- package/lib/interfaces/contributions/contribution.js.map +1 -0
- package/lib/interfaces/ext-services/ext-services.d.ts +2 -2
- package/lib/interfaces/extension-manifest.d.ts +1 -1
- package/lib/interfaces/graphql.js +1 -1
- package/lib/interfaces/graphql.js.map +1 -0
- package/lib/interfaces/model.js +3 -3
- package/lib/interfaces/model.js.map +1 -0
- package/lib/interfaces/text-document.js +76 -77
- package/lib/interfaces/text-document.js.map +1 -0
- package/lib/interfaces/webview/webview.d.ts +1 -1
- package/lib/interfaces/webview/webview.js +3 -3
- package/lib/interfaces/webview/webview.js.map +1 -0
- package/lib/middlewares/extensionController.js +9 -5
- package/lib/middlewares/extensionController.js.map +1 -0
- package/lib/protocol/client.protocol.js +2 -2
- package/lib/protocol/client.protocol.js.map +1 -0
- package/lib/protocol/common.protocol.d.ts +1 -2
- package/lib/protocol/common.protocol.js +50 -48
- package/lib/protocol/common.protocol.js.map +1 -0
- package/lib/protocol/editor-missing-types.js +4 -4
- package/lib/protocol/editor-missing-types.js.map +1 -0
- package/lib/protocol/proxy-identifier.js +39 -39
- package/lib/protocol/proxy-identifier.js.map +1 -0
- package/lib/protocol/rpc-logger.js +39 -43
- package/lib/protocol/rpc-logger.js.map +1 -0
- package/lib/protocol/rpc-protocol.js +736 -724
- package/lib/protocol/rpc-protocol.js.map +1 -0
- package/lib/protocol/server.protocol.js +22 -22
- package/lib/protocol/server.protocol.js.map +1 -0
- package/lib/protocol/shared/editor.js +17 -17
- package/lib/protocol/shared/editor.js.map +1 -0
- package/lib/protocol/temporary-types.js +16 -16
- package/lib/protocol/temporary-types.js.map +1 -0
- package/lib/protocol/utils/lazy-promise.js +60 -61
- package/lib/protocol/utils/lazy-promise.js.map +1 -0
- package/lib/react/components/view-component/ViewComponent.js +31 -26
- package/lib/react/components/view-component/ViewComponent.js.map +1 -0
- package/lib/react/index.js +1 -1
- package/lib/react/index.js.map +1 -0
- package/lib/react/useExtensionController.js +13 -11
- package/lib/react/useExtensionController.js.map +1 -0
- package/lib/utils/abortable-rx.js +73 -70
- package/lib/utils/abortable-rx.js.map +1 -0
- package/lib/utils/errors.js +10 -10
- package/lib/utils/errors.js.map +1 -0
- package/lib/utils/extensions.js +11 -11
- package/lib/utils/extensions.js.map +1 -0
- package/lib/utils/helper.test.js +7 -4
- package/lib/utils/helper.test.js.map +1 -0
- package/lib/utils/paths-util.js +79 -82
- package/lib/utils/paths-util.js.map +1 -0
- package/lib/utils/rxjs/combineLatestOrDefault.js +72 -70
- package/lib/utils/rxjs/combineLatestOrDefault.js.map +1 -0
- package/lib/utils/util.js +24 -25
- package/lib/utils/util.js.map +1 -0
- package/package.json +6 -6
package/lib/utils/errors.js
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
const isErrorLike =
|
1
|
+
const isErrorLike = val => !!val && typeof val === 'object' && (!!val.stack || 'message' in val || 'code' in val) && !('__typename' in val);
|
2
2
|
/**
|
3
3
|
* Ensures a value is a proper Error, copying all properties if needed
|
4
4
|
*/
|
5
|
-
const asError =
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
};export{asError,isErrorLike}
|
5
|
+
const asError = err => {
|
6
|
+
if (err instanceof Error) {
|
7
|
+
return err;
|
8
|
+
}
|
9
|
+
if (typeof err === 'object' && err !== null) {
|
10
|
+
return Object.assign(new Error(err.message), err);
|
11
|
+
}
|
12
|
+
return new Error(err);
|
13
|
+
};export{asError,isErrorLike};//# sourceMappingURL=errors.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"errors.js","sources":["../../src/utils/errors.ts"],"sourcesContent":[null],"names":[],"mappings":"AAGa,MAAA,WAAW,GAAG,GAAC,IAA8B,CAAA,CACtD,GAAE,WAAc,GAAA,aAAgB,KAAA,CAAI,CAAC,GAAK,CAAA,SAAU,aAAc,GAAA,UAAa,IAAA,GAAI,KAAK,kBAAkB,GAAI;AAElH;;AAEG;AACU,MAAA,OAAO,GAAG,GAAC,IAAmB;AACvC,EAAA,IAAA,GAAO,YAAA,KAAiB,EAAA;AACpB,IAAA,OAAA,GAAA;;MAEA,OAAA,QAAe,QAAA,OAAe,KAAA,IAAS,EAAA;AACvC,IAAA,OAAA,MAAa,CAAA,MAAO,CAAA,IAAC,KAAS,CAAA,GAAA,CAAC,OAAW,CAAA,EAAA,GAAG,CAAA;;AAEjD,EAAA,OAAA,IAAW,KAAA,CAAA,GAAM,CAAA;AACrB"}
|
package/lib/utils/extensions.js
CHANGED
@@ -6,14 +6,14 @@ import {isErrorLike}from'./errors.js';/**
|
|
6
6
|
* @returns The extension's script URL.
|
7
7
|
*/
|
8
8
|
function getScriptURLFromExtensionManifest(extension) {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
}export{getScriptURLFromExtensionManifest}
|
9
|
+
if (!extension.manifest) {
|
10
|
+
throw new Error(`extension ${JSON.stringify(extension.id)}: no mainfest found`);
|
11
|
+
}
|
12
|
+
if (isErrorLike(extension.manifest)) {
|
13
|
+
throw new Error(`extension ${JSON.stringify(extension.id)}: invalid manifest: ${extension.manifest.message}`);
|
14
|
+
}
|
15
|
+
if (!extension.manifest.bundleURL) {
|
16
|
+
throw new Error(`extension ${JSON.stringify(extension.id)}: no "url" property in manifest`);
|
17
|
+
}
|
18
|
+
return extension.manifest.bundleURL;
|
19
|
+
}export{getScriptURLFromExtensionManifest};//# sourceMappingURL=extensions.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"extensions.js","sources":["../../src/utils/extensions.ts"],"sourcesContent":[null],"names":[],"mappings":"sCAGA;;;;;;AAMG;AACG,SAAU,iCAAiC,CAAC,SAA+B,EAAA;AAC7E,EAAA,IAAA,CAAA,SAAK,CAAA,QAAU,EAAQ;AACnB,IAAA,MAAA,IAAM,KAAI,CAAA,CAAA,UAAM,EAAA,IAAa,UAAK,CAAA,SAAU,CAAA,EAAA,CAAS,CAAC,mBAAG,CAAA,CAAA;;AAE7D,EAAA,IAAA,qBAAgB,CAAA,QAAkB,CAAA,EAAC;UACzB,IAAA,iBAAU,EAAA,IAAa,UAAK,CAAA,SAAmB,CAAA,EAAA,CAAA,CAAC,oBAAG,EAAA,kBAAiC,CAAA,OAAgB,CAAA,CAAA,CAAA;;AAE9G,EAAA,IAAA,CAAA,SAAc,CAAA,kBAAU,EAAS;AAC7B,IAAA,MAAA,IAAM,KAAI,CAAA,CAAA,UAAM,EAAA,IAAa,UAAK,CAAA,SAAU,CAAA,EAAA,CAAS,CAAC,+BAAG,CAAA,CAAA;;AAE7D,EAAA,OAAA,SAAgB,CAAA,QAAS,CAAA;AAC7B"}
|
package/lib/utils/helper.test.js
CHANGED
@@ -4,7 +4,10 @@
|
|
4
4
|
* @internal
|
5
5
|
*/
|
6
6
|
function createBarrier() {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
let done;
|
8
|
+
const wait = new Promise(resolve => done = resolve);
|
9
|
+
return {
|
10
|
+
wait,
|
11
|
+
done
|
12
|
+
};
|
13
|
+
}export{createBarrier};//# sourceMappingURL=helper.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"helper.test.js","sources":["../../src/utils/helper.test.ts"],"sourcesContent":[null],"names":[],"mappings":"AAEA;;;;AAIG;SACa,aAAa,GAAA;AACzB,EAAA,IAAA;AACA,EAAA,MAAA,IAAU,GAAA,IAAO,OAAA,CAAA,OAAqB,IAAG,IAAM,GAAA,OAAU,CAAA;AACzD,EAAA,OAAA;AACJ,IAAC,IAAA;;;"}
|
package/lib/utils/paths-util.js
CHANGED
@@ -24,96 +24,93 @@ SOFTWARE.
|
|
24
24
|
*/
|
25
25
|
const replaceRegex = new RegExp('//+', 'g');
|
26
26
|
function resolve(...paths) {
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
processed.push(p);
|
37
|
-
}
|
27
|
+
let processed = [];
|
28
|
+
for (const p of paths) {
|
29
|
+
if (typeof p !== 'string') {
|
30
|
+
throw new TypeError('Invalid argument type to path.join: ' + typeof p);
|
31
|
+
} else if (p !== '') {
|
32
|
+
if (p.charAt(0) === sep) {
|
33
|
+
processed = [];
|
34
|
+
}
|
35
|
+
processed.push(p);
|
38
36
|
}
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
37
|
+
}
|
38
|
+
const resolved = normalize(processed.join(sep));
|
39
|
+
if (resolved.length > 1 && resolved.charAt(resolved.length - 1) === sep) {
|
40
|
+
return resolved.substr(0, resolved.length - 1);
|
41
|
+
}
|
42
|
+
return resolved;
|
44
43
|
}
|
45
44
|
function relative(from, to) {
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
}
|
60
|
-
upCount = fromSegments.length - i;
|
61
|
-
break;
|
62
|
-
}
|
63
|
-
downSegments = toSegments.slice(i);
|
64
|
-
if (fromSegments.length === 1 && fromSegments[0] === '') {
|
65
|
-
upCount = 0;
|
66
|
-
}
|
67
|
-
if (upCount > fromSegments.length) {
|
68
|
-
upCount = fromSegments.length;
|
69
|
-
}
|
70
|
-
let rv = '';
|
71
|
-
for (i = 0; i < upCount; i++) {
|
72
|
-
rv += '../';
|
45
|
+
let i;
|
46
|
+
from = resolve(from);
|
47
|
+
to = resolve(to);
|
48
|
+
const fromSegments = from.split(sep);
|
49
|
+
const toSegments = to.split(sep);
|
50
|
+
toSegments.shift();
|
51
|
+
fromSegments.shift();
|
52
|
+
let upCount = 0;
|
53
|
+
let downSegments = [];
|
54
|
+
for (i = 0; i < fromSegments.length; i++) {
|
55
|
+
const seg = fromSegments[i];
|
56
|
+
if (seg === toSegments[i]) {
|
57
|
+
continue;
|
73
58
|
}
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
59
|
+
upCount = fromSegments.length - i;
|
60
|
+
break;
|
61
|
+
}
|
62
|
+
downSegments = toSegments.slice(i);
|
63
|
+
if (fromSegments.length === 1 && fromSegments[0] === '') {
|
64
|
+
upCount = 0;
|
65
|
+
}
|
66
|
+
if (upCount > fromSegments.length) {
|
67
|
+
upCount = fromSegments.length;
|
68
|
+
}
|
69
|
+
let rv = '';
|
70
|
+
for (i = 0; i < upCount; i++) {
|
71
|
+
rv += '../';
|
72
|
+
}
|
73
|
+
rv += downSegments.join(sep);
|
74
|
+
if (rv.length > 1 && rv.charAt(rv.length - 1) === sep) {
|
75
|
+
rv = rv.substr(0, rv.length - 1);
|
76
|
+
}
|
77
|
+
return rv;
|
79
78
|
}
|
80
79
|
function normalize(p) {
|
81
|
-
|
82
|
-
|
80
|
+
if (p === '') {
|
81
|
+
p = '.';
|
82
|
+
}
|
83
|
+
const absolute = p.charAt(0) === sep;
|
84
|
+
p = removeDuplicateSeparators(p);
|
85
|
+
const components = p.split(sep);
|
86
|
+
const goodComponents = [];
|
87
|
+
for (const c of components) {
|
88
|
+
if (c === '.') {
|
89
|
+
continue;
|
90
|
+
} else if (c === '..' && (absolute || !absolute && goodComponents.length > 0 && goodComponents[0] !== '..')) {
|
91
|
+
goodComponents.pop();
|
92
|
+
} else {
|
93
|
+
goodComponents.push(c);
|
83
94
|
}
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
continue;
|
91
|
-
}
|
92
|
-
else if (c === '..' && (absolute || (!absolute && goodComponents.length > 0 && goodComponents[0] !== '..'))) {
|
93
|
-
goodComponents.pop();
|
95
|
+
}
|
96
|
+
if (!absolute && goodComponents.length < 2) {
|
97
|
+
switch (goodComponents.length) {
|
98
|
+
case 1:
|
99
|
+
if (goodComponents[0] === '') {
|
100
|
+
goodComponents.unshift('.');
|
94
101
|
}
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
}
|
99
|
-
if (!absolute && goodComponents.length < 2) {
|
100
|
-
switch (goodComponents.length) {
|
101
|
-
case 1:
|
102
|
-
if (goodComponents[0] === '') {
|
103
|
-
goodComponents.unshift('.');
|
104
|
-
}
|
105
|
-
break;
|
106
|
-
default:
|
107
|
-
goodComponents.push('.');
|
108
|
-
}
|
109
|
-
}
|
110
|
-
p = goodComponents.join(sep);
|
111
|
-
if (absolute && p.charAt(0) !== sep) {
|
112
|
-
p = sep + p;
|
102
|
+
break;
|
103
|
+
default:
|
104
|
+
goodComponents.push('.');
|
113
105
|
}
|
114
|
-
|
106
|
+
}
|
107
|
+
p = goodComponents.join(sep);
|
108
|
+
if (absolute && p.charAt(0) !== sep) {
|
109
|
+
p = sep + p;
|
110
|
+
}
|
111
|
+
return p;
|
115
112
|
}
|
116
113
|
function removeDuplicateSeparators(p) {
|
117
|
-
|
118
|
-
|
119
|
-
}export{normalize,relative,resolve}
|
114
|
+
p = p.replace(replaceRegex, sep);
|
115
|
+
return p;
|
116
|
+
}export{normalize,relative,resolve};//# sourceMappingURL=paths-util.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"paths-util.js","sources":["../../src/utils/paths-util.ts"],"sourcesContent":[null],"names":[],"mappings":"uEAAA;;;;;;;;;;;;;;;;;;;;;;;AAuBE;AAIF,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC;AAE3B,SAAA,OAAO,CAAC,GAAG,KAAe,EAAA;MAClC,SAAA,GAAsB,EAAA;AAC1B,EAAA,KAAA,MAAW,CAAA,IAAK,KAAA,EAAK;AACjB,IAAA,IAAA,OAAW,CAAA,KAAM,QAAA,EAAA;YACb,IAAM,SAAa,CAAA,sCAAuC,GAAA,OAAI,CAAO,CAAA;WACxE,IAAA,CAAA,KAAA,EAAA,EAAA;AAAM,MAAA,IAAA,CAAA,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AA;AACI,MAAA;sBACH,CAAA,IAAA,CAAA,GAAA,CAAA;;AAEL;AACI,EAAA,CAAA,GAAA,cAAA,CAAA,IAAA,CAAA,GAAA,CAAc;cACrB,IAAA,CAAA,CAAA,MAAA,CAAA,CAAA,CAAA,KAAA,GAAA,EAAA;IACL,CAAC,GAAA,GAAA,GAAA,CAAA;AACD;SACI,CAAA;AACA;SACH,yBAAA,CAAA,CAAA,EAAA;AACD,EAAA,CAAA,GAAA,CAAA,CAAA,OAAS,CAAA,YAAA,EAAA,GAAA,CAAA;AACb,EAAC,OAAA,CAAA;AAED"}
|
@@ -25,74 +25,76 @@ import {Observable,from,asapScheduler,zip,of}from'rxjs';/**
|
|
25
25
|
* {@link defaultValue}).
|
26
26
|
*/
|
27
27
|
function combineLatestOrDefault(observables, defaultValue) {
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
error: (error) => subscriber.error(error),
|
83
|
-
complete: () => {
|
84
|
-
activeObservables--;
|
85
|
-
if (activeObservables === 0 && !scheduled) {
|
86
|
-
subscriber.complete();
|
87
|
-
}
|
88
|
-
},
|
89
|
-
}));
|
28
|
+
switch (observables.length) {
|
29
|
+
case 0:
|
30
|
+
{
|
31
|
+
// No source observables: emit an empty array and complete
|
32
|
+
return of([]);
|
33
|
+
}
|
34
|
+
case 1:
|
35
|
+
{
|
36
|
+
// Only one source observable: no need to handle emission accumulation or default values
|
37
|
+
return zip(...observables);
|
38
|
+
}
|
39
|
+
default:
|
40
|
+
{
|
41
|
+
return new Observable(subscriber => {
|
42
|
+
// The array of the most recent values from each input Observable.
|
43
|
+
// If a source Observable has not yet emitted a value, it will be represented by the
|
44
|
+
// defaultValue (if provided) or not at all (if not provided).
|
45
|
+
const values = defaultValue !== undefined ? observables.map(() => defaultValue) : [];
|
46
|
+
// Whether the emission of the values array has been scheduled
|
47
|
+
let scheduled = false;
|
48
|
+
let scheduledWork;
|
49
|
+
// The number of source Observables that have not yet completed
|
50
|
+
// (so that we know when to complete the output Observable)
|
51
|
+
let activeObservables = observables.length;
|
52
|
+
// When everything is done, clean up the values array
|
53
|
+
subscriber.add(() => {
|
54
|
+
values.length = 0;
|
55
|
+
});
|
56
|
+
// Subscribe to each source Observable. The index of the source Observable is used to
|
57
|
+
// keep track of the most recent value from that Observable in the values array.
|
58
|
+
for (let index = 0; index < observables.length; index++) {
|
59
|
+
subscriber.add(from(observables[index]).subscribe({
|
60
|
+
next: value => {
|
61
|
+
values[index] = value;
|
62
|
+
if (activeObservables === 1) {
|
63
|
+
// If only one source Observable is active, emit the values array immediately
|
64
|
+
// Abort any scheduled emission
|
65
|
+
scheduledWork?.unsubscribe();
|
66
|
+
scheduled = false;
|
67
|
+
subscriber.next(values.slice());
|
68
|
+
} else if (!scheduled) {
|
69
|
+
scheduled = true;
|
70
|
+
// Use asapScheduler to emit the values array, so that all
|
71
|
+
// next values that are emitted at the same time are emitted together.
|
72
|
+
// This makes tests (using expectObservable) easier to write.
|
73
|
+
scheduledWork = asapScheduler.schedule(() => {
|
74
|
+
if (!subscriber.closed) {
|
75
|
+
subscriber.next(values.slice());
|
76
|
+
scheduled = false;
|
77
|
+
if (activeObservables === 0) {
|
78
|
+
subscriber.complete();
|
79
|
+
}
|
80
|
+
}
|
81
|
+
});
|
90
82
|
}
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
}
|
83
|
+
},
|
84
|
+
error: error => subscriber.error(error),
|
85
|
+
complete: () => {
|
86
|
+
activeObservables--;
|
87
|
+
if (activeObservables === 0 && !scheduled) {
|
88
|
+
subscriber.complete();
|
89
|
+
}
|
90
|
+
}
|
91
|
+
}));
|
92
|
+
}
|
93
|
+
// When everything is done, clean up the values array
|
94
|
+
return () => {
|
95
|
+
values.length = 0;
|
96
|
+
};
|
97
|
+
});
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}export{combineLatestOrDefault};//# sourceMappingURL=combineLatestOrDefault.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"combineLatestOrDefault.js","sources":["../../../src/utils/rxjs/combineLatestOrDefault.ts"],"sourcesContent":[null],"names":[],"mappings":"wDAEA;;;;;;;;;;;;;;;;;;;;;;;;;AAyBG;AACa,SAAA,sBAAsB,CAAI,WAAiC,EAAE,YAAgB,EAAA;AACzF,EAAA,QAAA,WAAmB,CAAA,MAAO;SACjB,CAAA;;AAED;QACJ,OAAC,EAAA,CAAA,EAAA,CAAA;;;AAGG,MAAA;;QAEJ,OAAO,GAAG,CAAA,GAAA,WAAA,CAAA;AACN;;;mBAGkE,UAAA,CAAA,UAAA,IAAA;;;;AAK9D,UAAA,MAAA,qBAA4C,KAAA,SAAA,GAAA,WAAA,CAAA,GAAA,CAAA,MAAA,YAAA,CAAA,GAAA,EAAA;;uBAEe,GAAA,KAAA;AAC3D,UAAA,IAAA,aAAqB;;AAGrB;AACI,UAAA,IAAA,iBAAO,GAAS,WAAE,CAAA,MAAA;AACtB;oBAEqF,CAAA,GAAA,CAAA,MAAA;kBACL,CAAA,MAAA,GAAA,CAAA;AAChF,WAAA,CAAA;AACI;AAEQ;AACI,UAAA,KAAA,IAAA,KAAA,GAAA,CAAA,EAAA,KAAO,GAAA,WAAc,CAAC,MAAA,EAAA,KAAA,EAAA,EAAA;AACtB,YAAA,UAAA,CAAA,GAAA,CAAA,IAAA,CAAI,WAAiB,CAAA,KAAA,CAAA,CAAA,CAAA,SAAS,CAAA;;gCAE1B,KAA+B;qCAClB,KAAA,CAAA,EAAA;;;+BAGhB,EAAA,WAAA,EAAA;mCAAU;iCACE,CAAA,MAAA,CAAA,OAAO,CAAC;qCACyC,EAAA;kCACY;;AAEtE;AACI;+CACc,CAAA,QAAM,CAAA,MAAO;0CACd,EAAA;AACT,sBAAA,UAAA,CAAA,IAAA,CAAA,MAAI,CAAiB,KAAA,EAAA,CAAA;;2CAEpB,KAAA,CAAA,EAAA;2CACJ,EAAA;AACL;;;;;AAKJ,cAAA,KAAA,EAAA,KAAA,IAAA,UAAA,CAAA,MAAmB,KAAC,CAAA;AACpB,cAAA,QAAA,EAAA,MAAA;iCACc,EAAA;qCACb,KAAA,CAAA,IAAA,CAAA,SAAA,EAAA;4BACJ,CAAA,QAAA,EAAA;AACJ;;;AAKT;AACI;AACJ,UAAA,OAAC,MAAC;AACN,YAAA,MAAG,CAAA,MAAA,GAAA,CAAA;WACN;SACJ,CAAA;AACL;;"}
|
package/lib/utils/util.js
CHANGED
@@ -4,44 +4,43 @@ import {flatten,compact}from'lodash-es';/**
|
|
4
4
|
* @param f
|
5
5
|
*/
|
6
6
|
function tryCatchPromise(f) {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
}
|
7
|
+
try {
|
8
|
+
return Promise.resolve(f());
|
9
|
+
} catch (err) {
|
10
|
+
return Promise.reject(err);
|
11
|
+
}
|
13
12
|
}
|
14
13
|
/**
|
15
14
|
* Reports whether value is a Promise.
|
16
15
|
*/
|
17
16
|
function isPromise(value) {
|
18
|
-
|
17
|
+
return typeof value.then === 'function';
|
19
18
|
}
|
20
19
|
/**
|
21
20
|
* Reports whether value is a {@link cdeops.Subscribable}.
|
22
21
|
*/
|
23
22
|
function isSubscribable(value) {
|
24
|
-
|
23
|
+
return typeof value.subscribe === 'function';
|
25
24
|
}
|
26
25
|
/** Flattens and compacts the argument. If it is null or if the result is empty, it returns null. */
|
27
26
|
function flattenAndCompact(value) {
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
if (value === null) {
|
28
|
+
return null;
|
29
|
+
}
|
30
|
+
const merged = flatten(compact(value));
|
31
|
+
return merged.length === 0 ? null : merged;
|
33
32
|
}
|
34
33
|
/** generate unique id for contributions */
|
35
34
|
function generateContributionId() {
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
}export{flattenAndCompact,generateContributionId,isPromise,isSubscribable,tryCatchPromise}
|
35
|
+
// always start with a letter (for DOM friendlyness)
|
36
|
+
let idStr = String.fromCharCode(Math.floor(Math.random() * 25 + 65));
|
37
|
+
do {
|
38
|
+
// between numbers and characters (48 is 0 and 90 is Z (42-48 = 90)
|
39
|
+
const asciCode = Math.floor(Math.random() * 42 + 48);
|
40
|
+
if (asciCode < 58 || asciCode > 64) {
|
41
|
+
// exclude all chars between : (58) and @ (64)
|
42
|
+
idStr += String.fromCharCode(asciCode);
|
43
|
+
}
|
44
|
+
} while (idStr.length < 32);
|
45
|
+
return idStr;
|
46
|
+
}export{flattenAndCompact,generateContributionId,isPromise,isSubscribable,tryCatchPromise};//# sourceMappingURL=util.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"util.js","sources":["../../src/utils/util.ts"],"sourcesContent":[null],"names":[],"mappings":"wCAEA;;;;AAIG;AACG,SAAU,eAAe,CAAI,CAAuB,EAAA;AACtD,EAAA,IAAA;AACI,IAAA,OAAA,eAAe,CAAA,CAAA,EAAO,CAAC;IAC3B,OAAC,GAAA,EAAA;IAAC,OAAO,OAAM,CAAA,MAAA,CAAA,GAAA,CAAA;AACX;;AAER;AAGA;;AAEG,SAAA,SAAA,CAAA,KAAA,EAAA;AACH,EAAM,OAAA,OAAU,KAAS,CAAA,IAAC,KAAU,UAAA;AAChC;AACJ;AAEA;;AAEG,SAAA,cAAA,CAAA,KAAA,EAAA;AACH,EAAM,OAAA,OAAU,KAAc,CAAA,SAAC,KAAU,UAAA;AACrC;AACJ;AAGoG,SAAA,iBAAA,CAAA,KAAA,EAAA;AACpG,EAAM,IAAA,KAAA,KAAU,IAAiB,EAAA;AAC7B,IAAA,OAAS,IAAA;AACL;QACH,MAAA,GAAA,OAAA,CAAA,OAAA,CAAA,KAAA,CAAA,CAAA;SACK,MAAA,CAAM,MAAU,KAAC,QAAQ,GAAA,MAAQ;AACvC;AACJ;AAE2C,SAAA,sBAAA,GAAA;AAC3C;MACwD,KAAA,GAAA,MAAA,CAAA,YAAA,CAAA,IAAA,CAAA,KAAA,CAAA,IAAA,CAAA,MAAA,EAAA,GAAA,EAAA,GAAA,EAAA,CAAA,CAAA;KAChD;AACJ;UACuE,QAAA,GAAA,IAAA,CAAA,KAAA,CAAA,IAAA,CAAA,MAAA,EAAA,GAAA,EAAA,GAAA,EAAA,CAAA;AACnE,IAAA,IAAA,iBAAiB,QAAK,GAAM,EAAC,EAAA;;eAEqB,MAAA,CAAA,YAAA,CAAA,QAAA,CAAA;AAC9C;WACH,KAAA,CAAA,MAAA,GAAA,EAAA;AACL,EAAA,YAAc;"}
|
package/package.json
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
{
|
2
2
|
"name": "@adminide-stack/extension-api",
|
3
|
-
"version": "
|
3
|
+
"version": "12.0.1-alpha.0",
|
4
4
|
"description": "Workbench core for higher packages to depend on",
|
5
|
-
"license": "
|
5
|
+
"license": "UNLICENSED",
|
6
6
|
"author": "CDMBase LLC",
|
7
7
|
"type": "module",
|
8
8
|
"main": "lib/index.js",
|
@@ -21,17 +21,17 @@
|
|
21
21
|
"watch": "npm run build:lib:watch"
|
22
22
|
},
|
23
23
|
"dependencies": {
|
24
|
-
"@adminide-stack/core": "
|
24
|
+
"@adminide-stack/core": "12.0.1-alpha.0",
|
25
25
|
"@workbench-stack/core": "3.9.7",
|
26
26
|
"abort-controller": "^3.0.0",
|
27
|
-
"cdeops": "
|
28
|
-
"common": "11.0.1-alpha.7",
|
27
|
+
"cdeops": "12.0.1-alpha.0",
|
29
28
|
"minimatch": "^10.0.0",
|
30
29
|
"queueing-subject": "0.3.4",
|
31
30
|
"utility-types": "^3.10.0",
|
32
31
|
"valid-url": "1.0.9"
|
33
32
|
},
|
34
33
|
"devDependencies": {
|
34
|
+
"common": "12.0.1-alpha.0",
|
35
35
|
"mock-socket": "^9.0.8"
|
36
36
|
},
|
37
37
|
"peerDependencies": {
|
@@ -44,5 +44,5 @@
|
|
44
44
|
"typescript": {
|
45
45
|
"definition": "lib/index.d.ts"
|
46
46
|
},
|
47
|
-
"gitHead": "
|
47
|
+
"gitHead": "c7e4f1418a4adb6f83f71b362c1828f71bd39c02"
|
48
48
|
}
|