Socket
Socket
Sign inDemoInstall

@adminide-stack/extension-module-browser

Package Overview
Dependencies
160
Maintainers
12
Versions
460
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.0.1-alpha.0 to 7.0.1-alpha.1

9

lib/api/client/client-commads.js

@@ -7,7 +7,10 @@ import { Subscription } from 'rxjs';

class ClientCommands {
registry;
subscriptions = new Subscription();
registrations = new SubscriptionMap();
proxy;
_disposables = new Map();
_generateCommandsDocumentationRegistration;
constructor(connection, registry) {
this.registry = registry;
this.subscriptions = new Subscription();
this.registrations = new SubscriptionMap();
this._disposables = new Map();
this.subscriptions.add(this.registrations);

@@ -14,0 +17,0 @@ this.proxy = createProxyAndHandleRequests('commands', connection, this);

@@ -8,2 +8,7 @@ import { URI } from '@vscode-alt/monaco-editor/esm/vs/base/common/uri.js';

class ClientConfigurationPolicy {
_organizationContextService;
configurationService;
_registry;
subscriptions = new Subscription();
proxy;
constructor(connection, _organizationContextService, configurationService,

@@ -16,3 +21,2 @@ // private readonly _environmentService: IEnvironmentService,

this._registry = _registry;
this.subscriptions = new Subscription();
this.proxy = createProxyAndHandleRequests('configurationPolicy', connection, this);

@@ -19,0 +23,0 @@ this.proxy.$initializeConfiguration(this._getConfigurationData());

@@ -8,2 +8,7 @@ import { URI } from '@vscode-alt/monaco-editor/esm/vs/base/common/uri.js';

class ClientConfigurationRole {
_organizationContextService;
configurationService;
_registry;
subscriptions = new Subscription();
proxy;
constructor(connection, _organizationContextService, configurationService,

@@ -16,3 +21,2 @@ // private readonly _environmentService: IEnvironmentService,

this._registry = _registry;
this.subscriptions = new Subscription();
this.proxy = createProxyAndHandleRequests('configurationRole', connection, this);

@@ -19,0 +23,0 @@ this.proxy.$initializeConfiguration(this._getConfigurationData());

@@ -8,2 +8,7 @@ import { URI } from '@vscode-alt/monaco-editor/esm/vs/base/common/uri.js';

class ClientConfiguration {
_organizationContextService;
configurationService;
_registry;
subscriptions = new Subscription();
proxy;
constructor(connection, _organizationContextService, configurationService,

@@ -16,3 +21,2 @@ // private readonly _environmentService: IEnvironmentService,

this._registry = _registry;
this.subscriptions = new Subscription();
this.proxy = createProxyAndHandleRequests('configuration', connection, this);

@@ -19,0 +23,0 @@ this.proxy.$initializeConfiguration(this._getConfigurationData());

@@ -6,2 +6,4 @@ import { Subscription, from } from 'rxjs';

class ClientExtensions {
subscriptions = new Subscription();
proxy;
/**

@@ -15,3 +17,2 @@ * Implements the client side of extensions API.

constructor(connection, extensionRegistry) {
this.subscriptions = new Subscription();
this.proxy = createProxyAndHandleRequests('extensions', connection, this);

@@ -18,0 +19,0 @@ this.subscriptions.add(from(extensionRegistry.activeExtensions).pipe(startWith([]),

@@ -6,5 +6,7 @@ import { createProxyAndHandleRequests } from '@adminide-stack/extension-api';

class ClientOrganization {
_contextService;
subscriptions = new Subscription();
proxy;
constructor(connection, _contextService) {
this._contextService = _contextService;
this.subscriptions = new Subscription();
this.proxy = createProxyAndHandleRequests('organization', connection, this);

@@ -11,0 +13,0 @@ this._contextService.getCompleteOrganization().then(organization => this.proxy.$acceptOrganizationData(this.getOrganizationData(organization)));

@@ -7,5 +7,3 @@ /**

class SubscriptionMap {
constructor() {
this.map = new Map();
}
map = new Map();
/**

@@ -12,0 +10,0 @@ * Adds a new subscription with the given {@link id}.

import * as React from 'react';
export declare const ExtensionViewSlot: import("react-redux").ConnectedComponent<(props: any) => React.JSX.Element, import("react-redux").Omit<any, "editors" | "dispatch">>;
export declare const ExtensionViewSlot: import("react-redux").ConnectedComponent<(props: any) => React.JSX.Element, {
[x: string]: any;
[x: number]: any;
[x: symbol]: any;
context?: React.Context<import("react-redux").ReactReduxContextValue<any, UnknownAction>>;
store?: import("redux").Store<any, import("redux").AnyAction>;
} | {
[x: string]: any;
[x: number]: any;
[x: symbol]: any;
store?: import("redux").Store<any, import("redux").AnyAction>;
}>;
//# sourceMappingURL=ExtensionViewSlot.d.ts.map
import { IExtensionHostClientConnection } from '@adminide-stack/extension-api';
import { Connection } from '@adminide-stack/extension-api';
import { Services } from '../services/services';
export declare function createExtensionHostClientConnection(connection: Connection, services: Services): IExtensionHostClientConnection;
export declare function createExtensionHostClientConnection(connection: Connection, services: any): IExtensionHostClientConnection;
//# sourceMappingURL=connection.d.ts.map

@@ -9,2 +9,3 @@ import { Subscription } from 'rxjs';

// import { Services } from '../services/services';
function createExtensionHostClientConnection(connection, services) {

@@ -11,0 +12,0 @@ const subscription = new Subscription();

import { Subscription, combineLatest, Subject, from } from 'rxjs';
import { switchMap, share, map, distinctUntilChanged, publishReplay, refCount } from 'rxjs/operators/index.js';
import { createConnection, generateContributionId } from '@adminide-stack/extension-api';
import { Services } from '../services/services.js';
import { createServices } from '../services/services.js';
import { createExtensionHostClient } from './extension-client.js';

@@ -19,4 +19,16 @@ import { isErrorLike } from '../util/errors.js';

const subscriptions = new Subscription();
const services = new Services(context, internalService);
const extensionHostConnection = combineLatest(context.createExtensionHost().pipe(switchMap(async messageTransports => {
// Log context to check if it's correctly passed
if (!context) {
console.error('Error: context is undefined or null!');
return null;
}
// Initialize services, logging potential issues
let services;
try {
services = createServices(context, internalService);
} catch (error) {
console.error('Error initializing Services:', error);
return null;
}
const extensionHostConnection = combineLatest([context.createExtensionHost().pipe(switchMap(async messageTransports => {
const connection = createConnection(messageTransports);

@@ -39,3 +51,3 @@ connection.listen();

return connection;
}), share()), context.traceExtensionHostCommunication).pipe(
}), share()), context.traceExtensionHostCommunication]).pipe(
// tap(([connection, trace]) => connection.trace(trace ? logger : null)),

@@ -42,0 +54,0 @@ map(([connection]) => connection), distinctUntilChanged());

import { Observable } from 'rxjs';
import { Connection } from '@adminide-stack/extension-api';
import { Services } from '../services/services';
import { IExtensionHostClient } from '@adminide-stack/extension-api';

@@ -12,3 +11,3 @@ /**

*/
export declare function createExtensionHostClient(services: Services, extensionHostConnection: Observable<Connection>): IExtensionHostClient;
export declare function createExtensionHostClient(services: any, extensionHostConnection: Observable<Connection>): IExtensionHostClient;
//# sourceMappingURL=extension-client.d.ts.map

@@ -5,3 +5,3 @@ import { from, throwError, of } from 'rxjs';

import { createAggregateError } from '../util/errors.js';
import { asError, isErrorLike } from '@adminide-stack/extension-api';
import { isErrorLike, asError } from '@adminide-stack/extension-api';
import { parseExtensionManifestOrError } from './extension-manifest.js';

@@ -8,0 +8,0 @@ import { isEqual } from 'lodash-es';

@@ -31,2 +31,3 @@ import 'reflect-metadata';

class ExtHostContext {
proxy;
constructor(proxy) {

@@ -41,6 +42,4 @@ this.proxy = proxy;

class WebExtHostExtensionService {
constructor() {
/** Extension's deactivate functions. */
this.extensionDeactivate = new Map();
}
/** Extension's deactivate functions. */
extensionDeactivate = new Map();
/**

@@ -145,2 +144,6 @@ * Proxy method invoked by the client to load an extension and invoke its `activate` function to start running it.

class WebExtHostConfiguration {
_proxy;
_extHostOrganization;
_barrier;
_actual;
constructor(proxy, extHostOrganization) {

@@ -165,8 +168,9 @@ this._proxy = proxy;

class ExtHostConfigProvider {
changed$ = new Subject();
// private readonly _onDidChangeConfiguration = new Emitter<cdeops.ConfigurationChangeEvent>();
_proxy;
_extHostOrganization;
_configurationScopes;
_configuration;
constructor(proxy, extHostOrganization, data) {
this.changed$ = new Subject();
// get onDidChangeConfiguration(): Event<cdeops.ConfigurationChangeEvent> {
// return this._onDidChangeConfiguration && this._onDidChangeConfiguration.event;
// }
this.onDidChangeConfiguration = this.changed$.pipe(filter(getEvents('onDidChangeConfiguration')), map(getEventPayload));
this._proxy = proxy;

@@ -177,2 +181,6 @@ this._extHostOrganization = extHostOrganization;

}
// get onDidChangeConfiguration(): Event<cdeops.ConfigurationChangeEvent> {
// return this._onDidChangeConfiguration && this._onDidChangeConfiguration.event;
// }
onDidChangeConfiguration = this.changed$.pipe(filter(getEvents('onDidChangeConfiguration')), map(getEventPayload));
$acceptConfigurationChanged(data, change) {

@@ -386,2 +394,6 @@ const previous = {

class WebExtHostConfigurationPolicy {
_proxy;
_extHostOrganization;
_barrier;
_actual;
constructor(proxy, extHostOrganization) {

@@ -406,2 +418,6 @@ this._proxy = proxy;

class WebExtHostConfigurationRole {
_proxy;
_extHostOrganization;
_barrier;
_actual;
constructor(proxy, extHostOrganization) {

@@ -443,2 +459,3 @@ this._proxy = proxy;

class ExtHostOrganizationImpl extends OrganizationContext {
_name;
static toExtHostOrganization(data, previousConfirmedOrganization, previousUnconfirmedOrganization) {

@@ -511,7 +528,7 @@ if (!data) {

}
_organizationResources = [];
_structure = TernarySearchTree.forPaths();
constructor(id, _name, folders) {
super(id, folders.map(f => new OrganizationResource(f)));
this._name = _name;
this._organizationResources = [];
this._structure = TernarySearchTree.forPaths();
// setup the organization folder data structure

@@ -541,2 +558,11 @@ folders.forEach(folder => {

class WebExtHostOrganization {
_onDidChangeOrganization = new Emitter();
_proxy;
_logService;
_requestIdProvider;
_barrier;
_confirmedOrganization;
_unconfirmedOrganization;
// private _messageService: MainThreadMessageServiceShape;
onDidChangeOrganization = this._onDidChangeOrganization.event;
// private readonly _activeSearchCallbacks: ((match: IRawFileMatch2) => any)[] = [];

@@ -546,5 +572,2 @@ constructor(

proxy, data, logService, requestIdProvider) {
this._onDidChangeOrganization = new Emitter();
// private _messageService: MainThreadMessageServiceShape;
this.onDidChangeOrganization = this._onDidChangeOrganization.event;
this._logService = logService;

@@ -551,0 +574,0 @@ this._requestIdProvider = requestIdProvider;

@@ -9,2 +9,6 @@ import { createWebWorkerMessageTransports } from '@adminide-stack/extension-api/lib/connections/jsonrpc2/transports/webWorker.js';

class PlatformContext extends Disposable {
client;
_reduxState$;
services;
static _instance;
constructor(client, _reduxState$, services) {

@@ -15,5 +19,2 @@ super();

this.services = services;
this.getScriptURLForExtension = bundleURL => bundleURL;
this.cdeopsURL = 'http://localhost:8080' /*(window.context as any).externalURL,*/;
this.traceExtensionHostCommunication = new LocalStorageSubject('traceExtensionHostCommunication', false);
PlatformContext._instance = this;

@@ -82,5 +83,9 @@ }

}
getScriptURLForExtension = bundleURL => bundleURL;
get sideloadedExtensionURL() {
return new LocalStorageSubject('sideloadedExtensionURL', null);
}
cdeopsURL = 'http://localhost:8080' /*(window.context as any).externalURL,*/;
clientApplication;
traceExtensionHostCommunication = new LocalStorageSubject('traceExtensionHostCommunication', false);
}

@@ -87,0 +92,0 @@

@@ -7,7 +7,3 @@ import { __decorate } from 'tslib';

let CommandRegistry = class CommandRegistry {
constructor() {
this.entries = new BehaviorSubject([]);
/** All commands, emitted whenever the set of registered commands changed. */
this.commands = this.entries;
}
entries = new BehaviorSubject([]);
registerCommand(entryToRegister) {

@@ -34,2 +30,4 @@ // Enforce uniqueness of command IDs.

}
/** All commands, emitted whenever the set of registered commands changed. */
commands = this.entries;
/**

@@ -36,0 +34,0 @@ * The current set of commands. Used by callers that do not need to react to commands being registered or

@@ -11,2 +11,7 @@ import { __decorate, __param, __metadata } from 'tslib';

let ContributionRegistry = class ContributionRegistry {
viewerService;
modelService;
contextKeyService;
/** All entries, including entries that are not enabled in the current context. */
_entries = new BehaviorSubject([]);
constructor(viewerService, modelService, contextKeyService) {

@@ -16,12 +21,2 @@ this.viewerService = viewerService;

this.contextKeyService = contextKeyService;
/** All entries, including entries that are not enabled in the current context. */
this._entries = new BehaviorSubject([]);
/**
* All contribution entries, emitted whenever the set of registered contributions changes.
*
* Most callers should use ContributionsRegistry#getContributions. Only use #entries if the
* caller needs information that is discarded when the contributions are merged (such as the
* extension that registered each set of contributions).
*/
this.entries = this._entries;
}

@@ -123,2 +118,10 @@ /**

}
/**
* All contribution entries, emitted whenever the set of registered contributions changes.
*
* Most callers should use ContributionsRegistry#getContributions. Only use #entries if the
* caller needs information that is discarded when the contributions are merged (such as the
* extension that registered each set of contributions).
*/
entries = this._entries;
};

@@ -125,0 +128,0 @@ ContributionRegistry = __decorate([injectable(), __param(0, inject(ClientTypes.IViewerService)), __param(1, inject(ClientTypes.IModelService)), __param(2, inject(IClientContainerService.IContextKeyService)), __metadata("design:paramtypes", [Object, Object, Object])], ContributionRegistry);

@@ -1,4 +0,1 @@

import 'reflect-metadata';
import { ISettingsCascade } from '@adminide-stack/extension-api';
export declare const EMPTY_SETTINGS_CASCADE: ISettingsCascade;
//# sourceMappingURL=extension-service.test.d.ts.map

@@ -1,50 +0,4 @@

import { IExtensionsService, IExecutableExtension, IConfiguredExtension, IPlatformContext } from '@adminide-stack/extension-api';
import { Subscribable } from 'rxjs';
import { ModelService } from './model-service';
export declare class HTTPStatusError extends Error {
readonly name = "HTTPStatusError";
readonly status: number;
constructor(response: Response);
}
/**
* Checks if a given fetch Response has a HTTP 2xx status code and throws an HTTPStatusError otherwise.
*/
export declare function checkOk(response: Response): Response;
/**
* Manages the set of extensions that are available and activated.
*
* @internal This is an internal implementation detail and is different from the product feature called the
* "extension registry" (where users can search for and enable extensions).
*/
export declare class ExtensionsService implements IExtensionsService {
private platformContext;
private modelService;
private extensionActivationFilter;
private fetchSideloadedExtension;
constructor(platformContext: IPlatformContext, modelService: Pick<ModelService, 'activeLanguages'>, extensionActivationFilter?: typeof extensionsWithMatchedActivationEvent, fetchSideloadedExtension?: (baseUrl: string) => Subscribable<IConfiguredExtension | null>);
protected configuredExtensions: Subscribable<IConfiguredExtension[]>;
/**
* Returns an observable that emits the set of enabled extensions upon subscription and whenever it changes.
*
* Most callers should use {@link ExtensionsService#activeExtensions}.
*/
private get enabledExtensions();
private get sideloadedExtension();
/**
* Returns an observable that emits the set of extensions that should be active, based on the previous and
* current state and each available extenion's activationEvents.
*
* An extension is activated when one or more of its activationEvents is true. After an extension has been
* activated, it remains active for the rest of the sesion (i.e., for as long as the browser tab remains open)
* as long as it remains enabled. If it is disabled, it is deactivated. (i.e., "activationEvents" are
* retrospective/sticky.)
*
* @todo Consider whether extensions should be deactivated if none of their activationEvents are true (or that
* plus a certain period of inactivity).
*/
get activeExtensions(): Subscribable<IExecutableExtension[]>;
private memoizedGetScriptURLForExtension;
}
declare function extensionsWithMatchedActivationEvent(enabledExtensions: IConfiguredExtension[], visibleTextDocumentLanguages: ReadonlySet<string>): IConfiguredExtension[];
export {};
export declare function createExtensionsService(platformContext: any, modelService: any): {
activeExtensions: import("rxjs").Observable<{}[]>;
};
//# sourceMappingURL=extensions-service.d.ts.map

@@ -1,75 +0,46 @@

import { isErrorLike, combineLatestOrDefault } from '@adminide-stack/extension-api';
import { combineLatestOrDefault } from '@adminide-stack/extension-api';
import { combineLatest, from, of } from 'rxjs';
import { map, switchMap, catchError, tap, distinctUntilChanged } from 'rxjs/operators/index.js';
import { fromFetch } from 'rxjs/fetch/index.js';
import { map, distinctUntilChanged, switchMap, catchError } from 'rxjs/operators';
import { fromFetch } from 'rxjs/fetch';
import { isEqual } from 'lodash-es';
import { viewerConfiguredExtensions, isExtensionEnabled, getScriptURLFromExtensionManifest } from '../extensions/extension.js';
import { memoizeObservable } from '../util/memorize-observable.js';
import { getScriptURLFromExtensionManifest, viewerConfiguredExtensions, isExtensionEnabled } from '../extensions/extension.js';
import { isDefined } from '../util/types.js';
import { memoizeObservable } from '../util/memorize-observable.js';
/* eslint-disable import/no-extraneous-dependencies */
/* eslint-disable max-classes-per-file */
/* eslint-disable no-use-before-define */
const EHTTPSTATUS = 'HTTPStatusError';
class HTTPStatusError extends Error {
constructor(response) {
super(`Request to ${response.url} failed with ${response.status} ${response.statusText}`);
this.name = EHTTPSTATUS;
this.status = response.status;
}
// Fetch sideloaded extensions function
function fetchSideloadedExtension(baseUrl) {
return fromFetch(`${baseUrl}/package.json`, {
selector: response => {
if (!response.ok) {
throw new Error(`Request failed with status ${response.status}`);
}
return response.json();
}
}).pipe(map(response => ({
id: response.name,
manifest: {
...response,
url: `${baseUrl}/${response.main.replace('dist/', '')}`
},
rawManifest: null
})), catchError(error => {
console.error('Error fetching sideloaded extension', error);
return of(null);
}));
}
/**
* Checks if a given fetch Response has a HTTP 2xx status code and throws an HTTPStatusError otherwise.
*/
function checkOk(response) {
if (!response.ok) {
throw new HTTPStatusError(response);
}
return response;
}
const getConfiguredSideloadedExtension = baseUrl => fromFetch(`${baseUrl}/package.json`, {
selector: response => checkOk(response).json()
}).pipe(map(response => ({
id: response.name,
manifest: {
...response,
url: `${baseUrl}/${response.main.replace('dist/', '')}`
},
rawManifest: null
})));
/**
* Manages the set of extensions that are available and activated.
*
* @internal This is an internal implementation detail and is different from the product feature called the
* "extension registry" (where users can search for and enable extensions).
*/
class ExtensionsService {
constructor(platformContext, modelService, extensionActivationFilter = extensionsWithMatchedActivationEvent, fetchSideloadedExtension = getConfiguredSideloadedExtension) {
this.platformContext = platformContext;
this.modelService = modelService;
this.extensionActivationFilter = extensionActivationFilter;
this.fetchSideloadedExtension = fetchSideloadedExtension;
this.configuredExtensions = viewerConfiguredExtensions({
settings: this.platformContext.settings,
requestGraphQL: this.platformContext.requestGraphQL
});
this.memoizedGetScriptURLForExtension = memoizeObservable(url => asObservable(this.platformContext.getScriptURLForExtension(url)).pipe(catchError(error => {
console.error(`Error fetching extension script URL ${url}`, error);
return [null];
})), url => url);
}
/**
* Returns an observable that emits the set of enabled extensions upon subscription and whenever it changes.
*
* Most callers should use {@link ExtensionsService#activeExtensions}.
*/
get enabledExtensions() {
return combineLatest([from(this.platformContext.settings), from(this.configuredExtensions), this.sideloadedExtension]).pipe(map(([settings, configuredExtensions, sideloadedExtension]) => {
// Function to create an extensions service object
function createExtensionsService(platformContext, modelService) {
// Memoized function to fetch script URLs
const memoizedGetScriptURLForExtension = memoizeObservable(url => asObservable(platformContext.getScriptURLForExtension(url)).pipe(catchError(error => {
console.error(`Error fetching extension script URL ${url}`, error);
return of(null);
})), url => url);
// Function to get enabled extensions
function getEnabledExtensions() {
return combineLatest([from(platformContext.settings), from(viewerConfiguredExtensions({
settings: platformContext.settings,
requestGraphQL: platformContext.requestGraphQL
})), getSideloadedExtension()]).pipe(map(([settings, configuredExtensions, sideloadedExtension]) => {
let enabled = configuredExtensions.filter(extension => isExtensionEnabled(settings, extension.id));
if (sideloadedExtension) {
if (!isErrorLike(sideloadedExtension.manifest) && sideloadedExtension.manifest?.publisher) {
// Disable extension with the same ID while this extension is sideloaded
const constructedID = `${sideloadedExtension.manifest.publisher}/${sideloadedExtension.id}`;
enabled = enabled.filter(extension => extension.id !== constructedID);
}
enabled.push(sideloadedExtension);

@@ -80,4 +51,5 @@ }

}
get sideloadedExtension() {
return from(this.platformContext.sideloadedExtensionURL).pipe(switchMap(url => url ? this.fetchSideloadedExtension(url) : of(null)), catchError(error => {
// Function to get sideloaded extensions
function getSideloadedExtension() {
return from(platformContext.sideloadedExtensionURL).pipe(switchMap(url => url ? fetchSideloadedExtension(url) : of(null)), catchError(error => {
console.error('Error sideloading extension', error);

@@ -87,36 +59,28 @@ return of(null);

}
/**
* Returns an observable that emits the set of extensions that should be active, based on the previous and
* current state and each available extenion's activationEvents.
*
* An extension is activated when one or more of its activationEvents is true. After an extension has been
* activated, it remains active for the rest of the sesion (i.e., for as long as the browser tab remains open)
* as long as it remains enabled. If it is disabled, it is deactivated. (i.e., "activationEvents" are
* retrospective/sticky.)
*
* @todo Consider whether extensions should be deactivated if none of their activationEvents are true (or that
* plus a certain period of inactivity).
*/
get activeExtensions() {
// Extensions that have been activated (including extensions with zero "activationEvents" that evaluate to
// true currently).
// Function to return active extensions
function getActiveExtensions() {
const activatedExtensionIDs = new Set();
return combineLatest([from(this.modelService.activeLanguages), this.enabledExtensions]).pipe(tap(([activeLanguages, enabledExtensions]) => {
const activeExtensions = this.extensionActivationFilter(enabledExtensions, activeLanguages);
return combineLatest([from(modelService.activeLanguages), getEnabledExtensions()]).pipe(map(([activeLanguages, enabledExtensions]) => {
const activeExtensions = extensionsWithMatchedActivationEvent(enabledExtensions, activeLanguages);
for (const extension of activeExtensions) {
if (!activatedExtensionIDs.has(extension.id)) {
activatedExtensionIDs.add(extension.id);
console.log('---ActivatedExntesionsId', activatedExtensionIDs);
}
}
}), map(([, extensions]) => extensions ? extensions.filter(extension => activatedExtensionIDs.has(extension.id)) : []), distinctUntilChanged((a, b) => isEqual(new Set(a.map(extension => extension.id)), new Set(b.map(extension => extension.id)))), switchMap(extensions => combineLatestOrDefault(extensions.map(extension => this.memoizedGetScriptURLForExtension(getScriptURLFromExtensionManifest(extension)).pipe(map(scriptURL => scriptURL === null ? null : {
return activeExtensions;
}), distinctUntilChanged((a, b) => isEqual(new Set(a.map(ext => ext.id)), new Set(b.map(ext => ext.id)))), switchMap(extensions => combineLatestOrDefault(extensions.map(extension => memoizedGetScriptURLForExtension(getScriptURLFromExtensionManifest(extension)).pipe(map(scriptURL => scriptURL ? {
id: extension.id,
manifest: extension.manifest,
scriptURL
}))))), map(extensions => extensions.filter(isDefined)), distinctUntilChanged((a, b) => isEqual(new Set(a.map(extension => extension.id)), new Set(b.map(extension => extension.id)))));
} : null))))), map(extensions => extensions.filter(isDefined)), distinctUntilChanged((a, b) => isEqual(new Set(a.map(ext => ext.id)), new Set(b.map(ext => ext.id)))));
}
return {
activeExtensions: getActiveExtensions()
};
}
// Helper function to return observables
function asObservable(input) {
return typeof input === 'string' ? of(input) : from(input);
}
// Function to filter extensions with activation events
function extensionsWithMatchedActivationEvent(enabledExtensions, visibleTextDocumentLanguages) {

@@ -126,19 +90,6 @@ const languageActivationEvents = new Set([...visibleTextDocumentLanguages].map(language => `onLanguage:${language}`));

try {
if (!extension.manifest) {
const match = /^cdeops\/lang-(.*)$/.exec(extension.id);
if (match) {
console.warn(`Extension ${extension.id} has been renamed to sourcegraph/${match[1]}. It's safe to remove ${extension.id} from your settings.`);
} else {
console.warn(`Extension ${extension.id} was not found. Remove it from settings to suppress this warning.`);
}
if (!extension.manifest || isEqual(extension.manifest.activationEvents, [])) {
console.warn(`Extension ${extension.id} has no activation events.`);
return false;
}
if (isErrorLike(extension.manifest)) {
console.warn(extension.manifest);
return false;
}
if (!extension.manifest.activationEvents) {
console.warn(`Extension ${extension.id} has no activation events, so it will never be activated.`);
return false;
}
return extension.manifest.activationEvents.some(event => event === '*' || languageActivationEvents.has(event));

@@ -152,3 +103,3 @@ } catch (error) {

export { ExtensionsService, HTTPStatusError, checkOk };
export { createExtensionsService };
//# sourceMappingURL=extensions-service.js.map

@@ -13,70 +13,14 @@ import { __decorate } from 'tslib';

let ModelService = class ModelService {
constructor() {
/** A map of URIs to TextModels */
this._models = new Map();
this._modelUpdates = new Subject();
this._activeLanguages = new BehaviorSubject(new Set());
this._languageReferences = new ReferenceCounter();
this.getModel = uri => {
const model = this.models.get(uri);
if (!model) {
throw new Error(`model does not exist with URI ${uri}`);
}
return model;
};
this.getPartialModel = uri => {
const {
languageId
} = this.getModel(uri);
return {
languageId
};
};
this.observeModel = uri => {
try {
const model = this.getModel(uri);
return this.modelUpdates.pipe(filter(updates => updates.some(update => update.uri === uri)), takeWhile(updates => updates.every(update => update.uri !== uri || update.type !== 'deleted')), map(() => this.getModel(uri)), startWith(model));
} catch (error) {
return throwError(error);
}
};
this.addModel = model => {
if (this.models.has(model.uri)) {
throw new Error(`model already exists with URI ${model.uri}`);
}
this.models.set(model.uri, model);
this.modelUpdates.next([{
type: 'added',
...model
}]);
// Update activeLanguages if no other existing model has the same language.
if (this._languageReferences.increment(model.languageId)) {
this.activeLanguages.next(new Set(this._languageReferences.keys()));
}
};
this.updateModel = (uri, text) => {
const model = this.getModel(uri);
this.models.set(uri, {
...model,
text
});
this.modelUpdates.next([{
type: 'updated',
uri,
text
}]);
};
this.hasModel = uri => this.models.has(uri);
this.removeModel = uri => {
const model = this.getModel(uri);
this.models.delete(uri);
this.modelUpdates.next([{
type: 'deleted',
uri
}]);
if (this._languageReferences.decrement(model.languageId)) {
this.activeLanguages.next(new Set(this._languageReferences.keys()));
}
};
}
/** A map of URIs to TextModels */
_models = new Map();
_modelUpdates = new Subject();
_activeLanguages = new BehaviorSubject(new Set());
_languageReferences = new ReferenceCounter();
getModel = uri => {
const model = this.models.get(uri);
if (!model) {
throw new Error(`model does not exist with URI ${uri}`);
}
return model;
};
get models() {

@@ -91,2 +35,56 @@ return this._models;

}
getPartialModel = uri => {
const {
languageId
} = this.getModel(uri);
return {
languageId
};
};
observeModel = uri => {
try {
const model = this.getModel(uri);
return this.modelUpdates.pipe(filter(updates => updates.some(update => update.uri === uri)), takeWhile(updates => updates.every(update => update.uri !== uri || update.type !== 'deleted')), map(() => this.getModel(uri)), startWith(model));
} catch (error) {
return throwError(error);
}
};
addModel = model => {
if (this.models.has(model.uri)) {
throw new Error(`model already exists with URI ${model.uri}`);
}
this.models.set(model.uri, model);
this.modelUpdates.next([{
type: 'added',
...model
}]);
// Update activeLanguages if no other existing model has the same language.
if (this._languageReferences.increment(model.languageId)) {
this.activeLanguages.next(new Set(this._languageReferences.keys()));
}
};
updateModel = (uri, text) => {
const model = this.getModel(uri);
this.models.set(uri, {
...model,
text
});
this.modelUpdates.next([{
type: 'updated',
uri,
text
}]);
};
hasModel = uri => this.models.has(uri);
removeModel = uri => {
const model = this.getModel(uri);
this.models.delete(uri);
this.modelUpdates.next([{
type: 'deleted',
uri
}]);
if (this._languageReferences.decrement(model.languageId)) {
this.activeLanguages.next(new Set(this._languageReferences.keys()));
}
};
};

@@ -93,0 +91,0 @@ ModelService = __decorate([injectable()], ModelService);

@@ -8,9 +8,3 @@ import { BehaviorSubject, Subscription } from 'rxjs';

class FeatureProviderRegistry {
constructor() {
this.entries = new BehaviorSubject([]);
/** All providers, emitted whenever the set of registered providers changed. */
this.providers = this.entries.pipe(map(entries => entries.map(({
provider
}) => provider)));
}
entries = new BehaviorSubject([]);
registerProvider(registrationOptions, provider) {

@@ -33,2 +27,6 @@ return this.registerProviders([{

}
/** All providers, emitted whenever the set of registered providers changed. */
providers = this.entries.pipe(map(entries => entries.map(({
provider
}) => provider)));
}

@@ -35,0 +33,0 @@

@@ -1,28 +0,26 @@

import { IPlatformContext, IExtServices } from '@adminide-stack/extension-api';
import { IClientService } from '@adminide-stack/core';
import { BehaviorSubject } from 'rxjs';
import { CommandRegistry } from './command-service';
import { ExtensionsService } from './extensions-service';
import { PanelViewProviderRegistry } from './panel-views';
/**
* Services is a container for all services used by the client applicatino.
*/
export declare class Services implements IExtServices, IClientService {
private platformContext;
private internalService;
private environment;
constructor(platformContext: IPlatformContext | any, internalService: IClientService & IExtServices);
readonly windows: import("./windows-service").IEditorWindowsService;
readonly contextKeyService: import("@adminide-stack/core").IContextKeyService;
readonly lifecycleService: import("@adminide-stack/core").ILifecycleService;
readonly model: import("@adminide-stack/extension-api").IModelService;
readonly viewer: import("@adminide-stack/extension-api").IViewerService;
readonly extensions: ExtensionsService;
readonly commands: CommandRegistry;
readonly contribution: import("@adminide-stack/extension-api").IContributionRegistry;
readonly panelView: PanelViewProviderRegistry;
readonly organizationContextService: import("@adminide-stack/core").IOrganizationContextService;
readonly configurationService: import("@adminide-stack/core").IClientConfigurationService;
readonly registry: import("@adminide-stack/core").IRegistry;
readonly preferenceService: import("@adminide-stack/core").IPreferenceClientService;
}
export declare function createServices(platformContext: any, internalService: any): {
environment: BehaviorSubject<import("../api/environment").Environment<any, any>>;
windows: import("./windows-service").IEditorWindowsService;
contextKeyService: any;
lifecycleService: any;
model: any;
viewer: any;
extensions: {
activeExtensions: import("rxjs").Observable<{}[]>;
};
commands: CommandRegistry;
contribution: any;
panelView: PanelViewProviderRegistry;
organizationContextService: any;
configurationService: any;
registry: any;
preferenceService: any;
notificationService: any;
dialogService: any;
statusbarService: any;
keybindingService: any;
};
//# sourceMappingURL=services.d.ts.map
import { BehaviorSubject } from 'rxjs';
import { CommandRegistry } from './command-service.js';
import { ExtensionsService } from './extensions-service.js';
import { createExtensionsService } from './extensions-service.js';
import { EMPTY_ENVIRONMENT } from '../api/environment.js';

@@ -8,29 +8,34 @@ import { editorWindowsService } from './windows-service.js';

/**
* Services is a container for all services used by the client applicatino.
*/
class Services {
constructor(platformContext, internalService) {
this.platformContext = platformContext;
this.internalService = internalService;
this.environment = new BehaviorSubject(EMPTY_ENVIRONMENT);
this.windows = editorWindowsService(this.platformContext);
// not needed as we can use configurationService
this.contextKeyService = this.internalService.contextKeyService;
// public readonly resourceContextKey = this.internalService.resourceContextKey;
this.lifecycleService = this.internalService.lifecycleService;
this.model = this.internalService.model;
this.viewer = this.internalService.viewer;
this.extensions = new ExtensionsService(this.platformContext, this.model);
this.commands = new CommandRegistry();
this.contribution = this.internalService.contribution;
this.panelView = new PanelViewProviderRegistry();
this.organizationContextService = this.internalService.organizationContextService;
this.configurationService = this.internalService.configurationService;
this.registry = this.internalService.registry;
this.preferenceService = this.internalService.preferenceService;
// Function to create the services object
function createServices(platformContext, internalService) {
// Ensure platformContext and internalService are properly defined
if (!platformContext || !internalService) {
throw new Error('platformContext or internalService is missing.');
}
// Initialize and return the services object
return {
environment: new BehaviorSubject(EMPTY_ENVIRONMENT),
windows: editorWindowsService(platformContext),
contextKeyService: internalService.contextKeyService,
lifecycleService: internalService.lifecycleService,
model: internalService.model,
viewer: internalService.viewer,
extensions: createExtensionsService(platformContext, internalService.model),
commands: new CommandRegistry(),
contribution: internalService.contribution,
panelView: new PanelViewProviderRegistry(),
organizationContextService: internalService.organizationContextService,
configurationService: internalService.configurationService,
registry: internalService.registry,
preferenceService: internalService.preferenceService,
// Add any other pending services as needed
notificationService: internalService.notificationService,
dialogService: internalService.dialogService,
statusbarService: internalService.statusbarService,
keybindingService: internalService.keybindingService
// More services here...
};
}
export { Services };
export { createServices };
//# sourceMappingURL=services.js.map

@@ -5,5 +5,3 @@ /**

class ReferenceCounter {
constructor() {
this.refCount = new Map();
}
refCount = new Map();
/**

@@ -10,0 +8,0 @@ * Increment the refCount for the given key.

@@ -10,5 +10,5 @@ import { __decorate, __param, __metadata } from 'tslib';

class ViewerNotFoundError extends Error {
name = VIEWER_NOT_FOUND_ERROR_NAME;
constructor(viewerId) {
super(`Viewer not found: ${viewerId}`);
this.name = VIEWER_NOT_FOUND_ERROR_NAME;
}

@@ -22,53 +22,25 @@ }

let ViewerService = class ViewerService {
modelSerivce;
id = 0;
nextId = () => `viewer#${this.id++}`;
/** A map of viewer ids to code viewers. */
_viewers = new Map();
_viewerUpdates = new Subject();
_activeViewerUpdates = new BehaviorSubject(undefined);
modelReferences;
constructor(modelSerivce) {
this.modelSerivce = modelSerivce;
this.id = 0;
this.nextId = () => `viewer#${this.id++}`;
/** A map of viewer ids to code viewers. */
this._viewers = new Map();
this._viewerUpdates = new Subject();
this._activeViewerUpdates = new BehaviorSubject(undefined);
/**
* Returns the Viewer with teh given viewerId.
* Throws if no viewer exists with the given viewerId.
*/
this.getViewer = viewerId => {
const viewer = this._viewers.get(viewerId);
if (!viewer) {
throw new ViewerNotFoundError(viewerId);
}
return viewer;
};
this.addViewer = viewerData => {
const viewerId = this.nextId();
if (viewerData.type === 'CodeEditor') {
this.modelReferences.increment(viewerData.resource);
}
const viewer = {
...viewerData,
viewerId
};
this._viewers.set(viewerId, viewer);
this._viewerUpdates.next([{
type: 'added',
viewerId,
viewerData
}]);
if (viewerData.isActive) {
this._activeViewerUpdates.next(viewer);
}
return viewer;
};
this.observeViewer = ({
viewerId
}) => {
try {
const viewer = this.getViewer(viewerId);
return this._viewerUpdates.pipe(filter(updates => updates.some(update => update.viewerId === viewerId)), takeWhile(updates => updates.every(update => update.viewerId !== viewerId || update.type !== 'deleted')), map(() => this.getViewer(viewerId)), startWith(viewer));
} catch (error) {
return throwError(error);
}
};
this.modelReferences = new ReferenceCounter();
}
/**
* Returns the Viewer with teh given viewerId.
* Throws if no viewer exists with the given viewerId.
*/
getViewer = viewerId => {
const viewer = this._viewers.get(viewerId);
if (!viewer) {
throw new ViewerNotFoundError(viewerId);
}
return viewer;
};
get viewers() {

@@ -83,2 +55,32 @@ return this._viewers;

}
addViewer = viewerData => {
const viewerId = this.nextId();
if (viewerData.type === 'CodeEditor') {
this.modelReferences.increment(viewerData.resource);
}
const viewer = {
...viewerData,
viewerId
};
this._viewers.set(viewerId, viewer);
this._viewerUpdates.next([{
type: 'added',
viewerId,
viewerData
}]);
if (viewerData.isActive) {
this._activeViewerUpdates.next(viewer);
}
return viewer;
};
observeViewer = ({
viewerId
}) => {
try {
const viewer = this.getViewer(viewerId);
return this._viewerUpdates.pipe(filter(updates => updates.some(update => update.viewerId === viewerId)), takeWhile(updates => updates.every(update => update.viewerId !== viewerId || update.type !== 'deleted')), map(() => this.getViewer(viewerId)), startWith(viewer));
} catch (error) {
return throwError(error);
}
};
setSelections({

@@ -85,0 +87,0 @@ viewerId

@@ -5,2 +5,4 @@ import { Observable, fromEvent } from 'rxjs';

class LocalStorageSubject extends Observable {
key;
defaultValue;
constructor(key, defaultValue) {

@@ -7,0 +9,0 @@ super(subscriber => {

{
"name": "@adminide-stack/extension-module-browser",
"version": "7.0.1-alpha.0",
"version": "7.0.1-alpha.1",
"description": "Sample core for higher packages to depend on",

@@ -43,5 +43,5 @@ "license": "ISC",

"dependencies": {
"@adminide-stack/core": "7.0.1-alpha.0",
"@adminide-stack/extension-api": "7.0.1-alpha.0",
"@adminide-stack/platform-client": "7.0.1-alpha.0",
"@adminide-stack/core": "7.0.1-alpha.1",
"@adminide-stack/extension-api": "7.0.1-alpha.1",
"@adminide-stack/platform-client": "7.0.1-alpha.1",
"@babel/polyfill": "^7.2.5",

@@ -70,3 +70,3 @@ "@workbench-stack/components": "3.5.0",

},
"gitHead": "d442ea8134593562e67475c5a7cf56380edbb492"
"gitHead": "7b1bc714d77dd0156dfe5ff7c56060d5b8fc48e6"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc