@adminide-stack/extension-api 9.1.1-alpha.52 → 9.1.1-alpha.62
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 +11 -11
- package/lib/connections/remote-rpc/browser-remote-rpc.js +1 -1
- package/lib/react/components/view-component/ViewComponent.js +1 -1
- package/lib/utils/abortable-rx.js +9 -9
- package/lib/utils/rxjs/combineLatestOrDefault.js +20 -17
- package/package.json +3 -3
@@ -1,4 +1,4 @@
|
|
1
|
-
import*as abortableRx from'../../utils/abortable-rx.js';import {Subject,Observable,isObservable,from}from'rxjs';import {isPromise}from'../../utils/util.js';import'rxjs-compat/observable/fromArray.js';import'rxjs-compat/
|
1
|
+
import*as abortableRx from'../../utils/abortable-rx.js';import {Subject,Observable,isObservable,from}from'rxjs';import {isPromise}from'../../utils/util.js';import'rxjs-compat/observable/fromArray.js';import'rxjs-compat/scheduler/asap.js';import'@vscode-alt/monaco-editor/esm/vs/base/common/path.js';import {Emitter}from'./events.js';import {LinkedMap}from'./linkedMap.js';import AbortController from'abort-controller';import {isNotificationMessage,isRequestMessage,ErrorCodes,ResponseError,isResponseMessage}from'./messages.js';import {noopTracer}from'./trace.js';const { toPromise } = abortableRx; // to support vite esm
|
2
2
|
const NullLogger = Object.freeze({
|
3
3
|
error: () => {
|
4
4
|
/* noop */
|
@@ -155,7 +155,7 @@ function _createConnection(transports, logger) {
|
|
155
155
|
}
|
156
156
|
}
|
157
157
|
const callback = (message) => {
|
158
|
-
console.log(
|
158
|
+
console.log('[callback.ON_MESSAGE]: ', { transports, message });
|
159
159
|
try {
|
160
160
|
// We have received an abort signal. Check if the message is still in the queue and abort it if allowed
|
161
161
|
// to do so.
|
@@ -237,7 +237,8 @@ function _createConnection(transports, logger) {
|
|
237
237
|
transports.writer.write(message);
|
238
238
|
}
|
239
239
|
tracer.requestReceived(requestMessage);
|
240
|
-
const element = requestHandlers[requestMessage.method] ||
|
240
|
+
const element = requestHandlers[requestMessage.method] ||
|
241
|
+
requestHandlers[matchedStartActor(Object.keys(requestHandlers), requestMessage.method)];
|
241
242
|
const requestHandler = element && element.handler;
|
242
243
|
if (requestHandler || starRequestHandler) {
|
243
244
|
const abortController = new AbortController();
|
@@ -256,7 +257,7 @@ function _createConnection(transports, logger) {
|
|
256
257
|
const onComplete = () => {
|
257
258
|
delete requestAbortControllers[signalKey];
|
258
259
|
};
|
259
|
-
from(handlerResult).subscribe(value => reply(value, false), error => {
|
260
|
+
from(handlerResult).subscribe((value) => reply(value, false), (error) => {
|
260
261
|
onComplete();
|
261
262
|
if (error instanceof ResponseError) {
|
262
263
|
replyError(error);
|
@@ -470,15 +471,14 @@ function _createConnection(transports, logger) {
|
|
470
471
|
catch (e) {
|
471
472
|
responseObserver.observer.error(new ResponseError(ErrorCodes.MessageWriteError, e.message ? e.message : 'Unknown reason'));
|
472
473
|
}
|
473
|
-
return new Observable(observer => {
|
474
|
-
subject.subscribe(observer)
|
475
|
-
|
476
|
-
|
477
|
-
!responseObserver.complete &&
|
478
|
-
!responseObserver.observer.closed) {
|
474
|
+
return new Observable((observer) => {
|
475
|
+
const subscription = subject.subscribe(observer);
|
476
|
+
subscription.add(() => {
|
477
|
+
if (!isUnsubscribed() && responseObserver && !responseObserver.complete && !subscription.closed) {
|
479
478
|
sendNotification(ABORT_REQUEST_METHOD, [id]);
|
480
479
|
}
|
481
480
|
});
|
481
|
+
return subscription;
|
482
482
|
});
|
483
483
|
};
|
484
484
|
const connection = {
|
@@ -557,7 +557,7 @@ function setImmediateCompat(f) {
|
|
557
557
|
}
|
558
558
|
function matchedStartActor(requestHandlersKeys, method) {
|
559
559
|
try {
|
560
|
-
return requestHandlersKeys.filter(name => {
|
560
|
+
return requestHandlersKeys.filter((name) => {
|
561
561
|
let methodName = method.split('/')[0];
|
562
562
|
return `${methodName}/*` === name;
|
563
563
|
})[0];
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {QueueingSubject}from'queueing-subject';import {VSBuffer}from'@vscode-alt/monaco-editor/esm/vs/base/common/buffer.js';import {Emitter}from'@vscode-alt/monaco-editor/esm/vs/base/common/event.js';import makeWebSocketObservable,{normalClosureMessage}from'./rxjs-websockets.js';import {switchMap,share}from'rxjs
|
1
|
+
import {QueueingSubject}from'queueing-subject';import {VSBuffer}from'@vscode-alt/monaco-editor/esm/vs/base/common/buffer.js';import {Emitter}from'@vscode-alt/monaco-editor/esm/vs/base/common/event.js';import makeWebSocketObservable,{normalClosureMessage}from'./rxjs-websockets.js';import {switchMap,share}from'rxjs';class BrowserRemoteRPC {
|
2
2
|
// this subject queues as necessary to ensure every message is delivered
|
3
3
|
input$;
|
4
4
|
_localHostId;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React__default,{useState,useEffect}from'react';import {Subscription
|
1
|
+
import React__default,{useState,useEffect}from'react';import {Subscription,map}from'rxjs';import {useExtensionController}from'../../useExtensionController.js';import {ContributableViewContainer}from'../../../interfaces/contributions/contribution.js';const ViewComponent = (props) => {
|
2
2
|
const [panelView, setPanelView] = useState(null);
|
3
3
|
const controller = useExtensionController();
|
4
4
|
const subscriptions = new Subscription();
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {Observable,Subscription,from
|
1
|
+
import {Observable,Subscription,from,switchMap as switchMap$1,concatMap as concatMap$1,mergeMap as mergeMap$1}from'rxjs';/**
|
2
2
|
* Copied from https://github.com/felixfbecker/abortable-rx/blob/master/src/index.ts
|
3
3
|
* To support esm
|
4
4
|
* @returns
|
@@ -12,7 +12,7 @@ const createAbortError = () => {
|
|
12
12
|
/**
|
13
13
|
* Creates an Observable just like RxJS `create`, but exposes an AbortSignal in addition to the subscriber
|
14
14
|
*/
|
15
|
-
const create = (subscribe) => new Observable(subscriber => {
|
15
|
+
const create = (subscribe) => new Observable((subscriber) => {
|
16
16
|
const abortController = new AbortController();
|
17
17
|
const subscription = new Subscription();
|
18
18
|
const teardown = subscribe && subscribe(subscriber, abortController.signal);
|
@@ -45,9 +45,9 @@ const toPromise = (observable, signal) => new Promise((resolve, reject) => {
|
|
45
45
|
}
|
46
46
|
};
|
47
47
|
let value;
|
48
|
-
subscription = observable.subscribe(val => {
|
48
|
+
subscription = observable.subscribe((val) => {
|
49
49
|
value = val;
|
50
|
-
}, err => {
|
50
|
+
}, (err) => {
|
51
51
|
cleanup();
|
52
52
|
reject(err);
|
53
53
|
}, () => {
|
@@ -77,7 +77,7 @@ const forEach = (source, next, signal) => new Promise((resolve, reject) => {
|
|
77
77
|
signal.removeEventListener('abort', listener);
|
78
78
|
}
|
79
79
|
};
|
80
|
-
subscription = source.subscribe(value => {
|
80
|
+
subscription = source.subscribe((value) => {
|
81
81
|
try {
|
82
82
|
next(value);
|
83
83
|
}
|
@@ -87,7 +87,7 @@ const forEach = (source, next, signal) => new Promise((resolve, reject) => {
|
|
87
87
|
subscription.unsubscribe();
|
88
88
|
}
|
89
89
|
}
|
90
|
-
}, err => {
|
90
|
+
}, (err) => {
|
91
91
|
cleanup();
|
92
92
|
reject(err);
|
93
93
|
}, () => {
|
@@ -101,12 +101,12 @@ const forEach = (source, next, signal) => new Promise((resolve, reject) => {
|
|
101
101
|
/**
|
102
102
|
* Like RxJS `switchMap`, but passes an AbortSignal that is aborted when the source emits another element.
|
103
103
|
*/
|
104
|
-
const switchMap = (project) => source => source.pipe(switchMap$1((value, index) => defer(abortSignal => project(value, index, abortSignal))));
|
104
|
+
const switchMap = (project) => (source) => source.pipe(switchMap$1((value, index) => defer((abortSignal) => project(value, index, abortSignal))));
|
105
105
|
/**
|
106
106
|
* Like RxJS `concatMap`, but passes an AbortSignal that is aborted when the returned Observable is unsubscribed from.
|
107
107
|
*/
|
108
|
-
const concatMap = (project) => source => source.pipe(concatMap$1((value, index) => defer(abortSignal => project(value, index, abortSignal))));
|
108
|
+
const concatMap = (project) => (source) => source.pipe(concatMap$1((value, index) => defer((abortSignal) => project(value, index, abortSignal))));
|
109
109
|
/**
|
110
110
|
* Like RxJS `mergeMap`, but passes an AbortSignal that is aborted when the returned Observable is unsubscribed from.
|
111
111
|
*/
|
112
|
-
const mergeMap = (project) => source => source.pipe(mergeMap$1((value, index) => defer(abortSignal => project(value, index, abortSignal))));export{concatMap,create,defer,forEach,mergeMap,switchMap,toPromise};
|
112
|
+
const mergeMap = (project) => (source) => source.pipe(mergeMap$1((value, index) => defer((abortSignal) => project(value, index, abortSignal))));export{concatMap,create,defer,forEach,mergeMap,switchMap,toPromise};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {zip,of}from'rxjs';import {fromArray}from'rxjs-compat/observable/fromArray.js';import {
|
1
|
+
import {zip,of,Subscriber,Subscription}from'rxjs';import {fromArray}from'rxjs-compat/observable/fromArray.js';import {asap}from'rxjs-compat/scheduler/asap.js';// tslint:disable no-use-before-declare
|
2
2
|
/**
|
3
3
|
* Like {@link combineLatest}, except that it does not wait for all Observables to emit before emitting an initial
|
4
4
|
* value. It emits whenever any of the source Observables emit.
|
@@ -46,15 +46,19 @@ class CombineLatestOperator {
|
|
46
46
|
return source.subscribe(new CombineLatestSubscriber(subscriber, this.defaultValue));
|
47
47
|
}
|
48
48
|
}
|
49
|
-
class CombineLatestSubscriber extends
|
49
|
+
class CombineLatestSubscriber extends Subscriber {
|
50
50
|
defaultValue;
|
51
51
|
activeObservables = 0;
|
52
52
|
values = [];
|
53
53
|
observables = [];
|
54
54
|
scheduled = false;
|
55
|
-
|
56
|
-
|
55
|
+
subscriptions = new Subscription();
|
56
|
+
constructor(destination, defaultValue) {
|
57
|
+
super(destination);
|
57
58
|
this.defaultValue = defaultValue;
|
59
|
+
if (!destination) {
|
60
|
+
throw new Error('Destination is required');
|
61
|
+
}
|
58
62
|
}
|
59
63
|
_next(observable) {
|
60
64
|
if (this.defaultValue !== undefined) {
|
@@ -64,35 +68,34 @@ class CombineLatestSubscriber extends OuterSubscriber {
|
|
64
68
|
}
|
65
69
|
_complete() {
|
66
70
|
this.activeObservables = this.observables.length;
|
71
|
+
// Use Observable's subscribe method directly
|
67
72
|
for (let i = 0; i < this.observables.length; i++) {
|
68
|
-
|
73
|
+
const observable = this.observables[i];
|
74
|
+
const subscription = observable.subscribe({
|
75
|
+
next: (value) => this.notifyNext(value, i),
|
76
|
+
complete: () => this.notifyComplete(),
|
77
|
+
});
|
78
|
+
this.subscriptions.add(subscription);
|
69
79
|
}
|
70
80
|
}
|
71
81
|
notifyComplete() {
|
72
82
|
this.activeObservables--;
|
73
|
-
if (this.activeObservables === 0 && this.destination
|
83
|
+
if (this.activeObservables === 0 && this.destination) {
|
74
84
|
this.destination.complete();
|
75
85
|
}
|
76
86
|
}
|
77
|
-
notifyNext(
|
78
|
-
|
79
|
-
values[outerIndex] = innerValue;
|
87
|
+
notifyNext(value, index) {
|
88
|
+
this.values[index] = value;
|
80
89
|
if (this.activeObservables === 1) {
|
81
|
-
|
82
|
-
//
|
83
|
-
// This makes it possible to use RxJS's `of` in tests without specifying an explicit scheduler.
|
84
|
-
if (this.destination.next) {
|
90
|
+
if (this.destination && this.destination.next) {
|
85
91
|
this.destination.next(this.values.slice());
|
86
92
|
}
|
87
93
|
return;
|
88
94
|
}
|
89
|
-
// Buffer all next values that are emitted at the same time into one emission.
|
90
|
-
//
|
91
|
-
// This makes tests (using expectObservable) easier to write.
|
92
95
|
if (!this.scheduled) {
|
93
96
|
this.scheduled = true;
|
94
97
|
asap.schedule(() => {
|
95
|
-
if (this.scheduled && this.destination.next) {
|
98
|
+
if (this.scheduled && this.destination && this.destination.next) {
|
96
99
|
this.destination.next(this.values.slice());
|
97
100
|
}
|
98
101
|
this.scheduled = false;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@adminide-stack/extension-api",
|
3
|
-
"version": "9.1.1-alpha.
|
3
|
+
"version": "9.1.1-alpha.62",
|
4
4
|
"description": "Workbench core for higher packages to depend on",
|
5
5
|
"license": "ISC",
|
6
6
|
"author": "CDMBase LLC",
|
@@ -52,7 +52,7 @@
|
|
52
52
|
},
|
53
53
|
"peerDependencies": {
|
54
54
|
"@vscode-alt/monaco-editor": ">=0.17.1",
|
55
|
-
"rxjs": "^
|
55
|
+
"rxjs": "^7.8.1"
|
56
56
|
},
|
57
57
|
"publishConfig": {
|
58
58
|
"access": "public"
|
@@ -60,5 +60,5 @@
|
|
60
60
|
"typescript": {
|
61
61
|
"definition": "lib/index.d.ts"
|
62
62
|
},
|
63
|
-
"gitHead": "
|
63
|
+
"gitHead": "009822bc9c2a3879520e8d8c4137ec5b9b3abaac"
|
64
64
|
}
|