@theia/scanoss 1.67.0-next.56 → 1.67.0-next.59
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/browser/scanoss-frontend-module.d.ts +4 -0
- package/lib/browser/scanoss-frontend-module.d.ts.map +1 -0
- package/lib/browser/scanoss-frontend-module.js +30 -0
- package/lib/browser/scanoss-frontend-module.js.map +1 -0
- package/lib/common/index.d.ts +2 -0
- package/lib/common/index.d.ts.map +1 -0
- package/lib/common/index.js +20 -0
- package/lib/common/index.js.map +1 -0
- package/lib/common/scanoss-preferences.d.ts +4 -0
- package/lib/common/scanoss-preferences.d.ts.map +1 -0
- package/lib/common/scanoss-preferences.js +30 -0
- package/lib/common/scanoss-preferences.js.map +1 -0
- package/lib/common/scanoss-service.d.ts +22 -0
- package/lib/common/scanoss-service.d.ts.map +1 -0
- package/lib/common/scanoss-service.js +21 -0
- package/lib/common/scanoss-service.js.map +1 -0
- package/lib/node/scanoss-backend-module.d.ts +4 -0
- package/lib/node/scanoss-backend-module.d.ts.map +1 -0
- package/lib/node/scanoss-backend-module.js +29 -0
- package/lib/node/scanoss-backend-module.js.map +1 -0
- package/lib/node/scanoss-service-impl.d.ts +7 -0
- package/lib/node/scanoss-service-impl.d.ts.map +1 -0
- package/lib/node/scanoss-service-impl.js +117 -0
- package/lib/node/scanoss-service-impl.js.map +1 -0
- package/lib/package.spec.d.ts +1 -0
- package/lib/package.spec.d.ts.map +1 -0
- package/lib/package.spec.js +26 -0
- package/lib/package.spec.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanoss-frontend-module.d.ts","sourceRoot":"","sources":["../../src/browser/scanoss-frontend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AAM/D,wBAMG"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2024 EclipseSource GmbH.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
19
|
+
const scanoss_preferences_1 = require("../common/scanoss-preferences");
|
|
20
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
21
|
+
const common_1 = require("../common");
|
|
22
|
+
const preference_schema_1 = require("@theia/core/lib/common/preferences/preference-schema");
|
|
23
|
+
exports.default = new inversify_1.ContainerModule(bind => {
|
|
24
|
+
bind(preference_schema_1.PreferenceContribution).toConstantValue({ schema: scanoss_preferences_1.ScanOSSPreferencesSchema });
|
|
25
|
+
bind(common_1.ScanOSSService).toDynamicValue(ctx => {
|
|
26
|
+
const provider = ctx.container.get(browser_1.RemoteConnectionProvider);
|
|
27
|
+
return provider.createProxy(common_1.SCANOSS_SERVICE_PATH);
|
|
28
|
+
}).inSingletonScope();
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=scanoss-frontend-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanoss-frontend-module.js","sourceRoot":"","sources":["../../src/browser/scanoss-frontend-module.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,4DAA+D;AAC/D,uEAAyE;AACzE,qDAA8F;AAC9F,sCAAiE;AACjE,4FAA8F;AAE9F,kBAAe,IAAI,2BAAe,CAAC,IAAI,CAAC,EAAE;IACtC,IAAI,CAAC,0CAAsB,CAAC,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,8CAAwB,EAAE,CAAC,CAAC;IACnF,IAAI,CAAC,uBAAc,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;QACtC,MAAM,QAAQ,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,CAA4B,kCAAwB,CAAC,CAAC;QACxF,OAAO,QAAQ,CAAC,WAAW,CAAiB,6BAAoB,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC;AAC1B,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAeA,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
// *****************************************************************************
|
|
5
|
+
// Copyright (C) 2024 EclipseSource GmbH.
|
|
6
|
+
//
|
|
7
|
+
// This program and the accompanying materials are made available under the
|
|
8
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
9
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
10
|
+
//
|
|
11
|
+
// This Source Code may also be made available under the following Secondary
|
|
12
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
13
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
14
|
+
// with the GNU Classpath Exception which is available at
|
|
15
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
16
|
+
//
|
|
17
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
18
|
+
// *****************************************************************************
|
|
19
|
+
tslib_1.__exportStar(require("./scanoss-service"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";;;AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,4DAAkC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { PreferenceSchema } from '@theia/core/lib/common/preferences/preference-schema';
|
|
2
|
+
export declare const SCAN_OSS_API_KEY_PREF = "ai-features.SCANOSS.apiKey";
|
|
3
|
+
export declare const ScanOSSPreferencesSchema: PreferenceSchema;
|
|
4
|
+
//# sourceMappingURL=scanoss-preferences.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanoss-preferences.d.ts","sourceRoot":"","sources":["../../src/common/scanoss-preferences.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sDAAsD,CAAC;AAExF,eAAO,MAAM,qBAAqB,+BAA+B,CAAC;AAElE,eAAO,MAAM,wBAAwB,EAAE,gBAStC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2024 EclipseSource GmbH.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.ScanOSSPreferencesSchema = exports.SCAN_OSS_API_KEY_PREF = void 0;
|
|
19
|
+
exports.SCAN_OSS_API_KEY_PREF = 'ai-features.SCANOSS.apiKey';
|
|
20
|
+
exports.ScanOSSPreferencesSchema = {
|
|
21
|
+
properties: {
|
|
22
|
+
[exports.SCAN_OSS_API_KEY_PREF]: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
markdownDescription: 'Enter an API Key of your SCANOSS Account. **Please note:** By using this preference the key will be stored in clear text\
|
|
25
|
+
on the machine running Theia. Use the environment variable `SCANOSS_API_KEY` to set the key securely.',
|
|
26
|
+
title: 'SCANOSS API Key'
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=scanoss-preferences.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanoss-preferences.js","sourceRoot":"","sources":["../../src/common/scanoss-preferences.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAInE,QAAA,qBAAqB,GAAG,4BAA4B,CAAC;AAErD,QAAA,wBAAwB,GAAqB;IACtD,UAAU,EAAE;QACR,CAAC,6BAAqB,CAAC,EAAE;YACrB,IAAI,EAAE,QAAQ;YACd,mBAAmB,EAAE;kHACiF;YACtG,KAAK,EAAE,iBAAiB;SAC3B;KACJ;CACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ScannerComponent } from 'scanoss';
|
|
2
|
+
export declare const SCANOSS_SERVICE_PATH = "/services/scanoss/service";
|
|
3
|
+
export declare const ScanOSSService: unique symbol;
|
|
4
|
+
export interface ScanOSSResultClean {
|
|
5
|
+
type: 'clean';
|
|
6
|
+
}
|
|
7
|
+
export interface ScanOSSResultMatch {
|
|
8
|
+
type: 'match';
|
|
9
|
+
matched: string;
|
|
10
|
+
url: string;
|
|
11
|
+
raw: ScannerComponent;
|
|
12
|
+
file?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ScanOSSResultError {
|
|
15
|
+
type: 'error';
|
|
16
|
+
message: string;
|
|
17
|
+
}
|
|
18
|
+
export type ScanOSSResult = ScanOSSResultClean | ScanOSSResultMatch | ScanOSSResultError;
|
|
19
|
+
export interface ScanOSSService {
|
|
20
|
+
scanContent(content: string, apiKey?: string): Promise<ScanOSSResult>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=scanoss-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanoss-service.d.ts","sourceRoot":"","sources":["../../src/common/scanoss-service.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,eAAO,MAAM,oBAAoB,8BAA8B,CAAC;AAChE,eAAO,MAAM,cAAc,eAA2B,CAAC;AACvD,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,OAAO,CAAC;CACjB;AACD,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,gBAAgB,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AACD,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACnB;AACD,MAAM,MAAM,aAAa,GAAG,kBAAkB,GAAG,kBAAkB,GAAG,kBAAkB,CAAC;AACzF,MAAM,WAAW,cAAc;IAC3B,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CACzE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2024 EclipseSource GmbH.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.ScanOSSService = exports.SCANOSS_SERVICE_PATH = void 0;
|
|
19
|
+
exports.SCANOSS_SERVICE_PATH = '/services/scanoss/service';
|
|
20
|
+
exports.ScanOSSService = Symbol('ScanOSSService');
|
|
21
|
+
//# sourceMappingURL=scanoss-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanoss-service.js","sourceRoot":"","sources":["../../src/common/scanoss-service.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAInE,QAAA,oBAAoB,GAAG,2BAA2B,CAAC;AACnD,QAAA,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanoss-backend-module.d.ts","sourceRoot":"","sources":["../../src/node/scanoss-backend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AAM/D,wBAOG"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2024 EclipseSource GmbH.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
19
|
+
const core_1 = require("@theia/core");
|
|
20
|
+
const common_1 = require("../common");
|
|
21
|
+
const scanoss_service_impl_1 = require("./scanoss-service-impl");
|
|
22
|
+
const scanoss_preferences_1 = require("../common/scanoss-preferences");
|
|
23
|
+
exports.default = new inversify_1.ContainerModule(bind => {
|
|
24
|
+
bind(core_1.PreferenceContribution).toConstantValue({ schema: scanoss_preferences_1.ScanOSSPreferencesSchema });
|
|
25
|
+
bind(scanoss_service_impl_1.ScanOSSServiceImpl).toSelf().inSingletonScope();
|
|
26
|
+
bind(common_1.ScanOSSService).toService(scanoss_service_impl_1.ScanOSSServiceImpl);
|
|
27
|
+
bind(core_1.ConnectionHandler).toDynamicValue(ctx => new core_1.RpcConnectionHandler(common_1.SCANOSS_SERVICE_PATH, () => ctx.container.get(common_1.ScanOSSService))).inSingletonScope();
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=scanoss-backend-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanoss-backend-module.js","sourceRoot":"","sources":["../../src/node/scanoss-backend-module.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,4DAA+D;AAC/D,sCAA8F;AAC9F,sCAAiE;AACjE,iEAA4D;AAC5D,uEAAyE;AAEzE,kBAAe,IAAI,2BAAe,CAAC,IAAI,CAAC,EAAE;IACtC,IAAI,CAAC,6BAAsB,CAAC,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,8CAAwB,EAAE,CAAC,CAAC;IACnF,IAAI,CAAC,yCAAkB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACrD,IAAI,CAAC,uBAAc,CAAC,CAAC,SAAS,CAAC,yCAAkB,CAAC,CAAC;IACnD,IAAI,CAAC,wBAAiB,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CACzC,IAAI,2BAAoB,CAAC,6BAAoB,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,uBAAc,CAAC,CAAC,CAC1F,CAAC,gBAAgB,EAAE,CAAC;AACzB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ScanOSSResult, ScanOSSService } from '../common';
|
|
2
|
+
export declare class ScanOSSServiceImpl implements ScanOSSService {
|
|
3
|
+
private readonly processor;
|
|
4
|
+
scanContent(content: string, apiKey?: string): Promise<ScanOSSResult>;
|
|
5
|
+
doScanContent(content: string, apiKey?: string): Promise<ScanOSSResult>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=scanoss-service-impl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanoss-service-impl.d.ts","sourceRoot":"","sources":["../../src/node/scanoss-service-impl.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAkB1D,qBACa,kBAAmB,YAAW,cAAc;IAErD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA4C;IAEhE,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAIrE,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;CA4EhF"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2024 EclipseSource GmbH.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.ScanOSSServiceImpl = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
20
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
+
const scanoss_1 = require("scanoss");
|
|
22
|
+
// Helper class to perform scans sequentially
|
|
23
|
+
class SequentialProcessor {
|
|
24
|
+
constructor() {
|
|
25
|
+
this.queue = Promise.resolve();
|
|
26
|
+
}
|
|
27
|
+
async processTask(task) {
|
|
28
|
+
this.queue = this.queue.then(() => task());
|
|
29
|
+
return this.queue;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
let ScanOSSServiceImpl = class ScanOSSServiceImpl {
|
|
33
|
+
constructor() {
|
|
34
|
+
this.processor = new SequentialProcessor();
|
|
35
|
+
}
|
|
36
|
+
async scanContent(content, apiKey) {
|
|
37
|
+
return this.processor.processTask(async () => this.doScanContent(content, apiKey));
|
|
38
|
+
}
|
|
39
|
+
async doScanContent(content, apiKey) {
|
|
40
|
+
var _a, _b, _c;
|
|
41
|
+
const config = new scanoss_1.ScannerCfg();
|
|
42
|
+
const apiKeyToUse = apiKey || process.env.SCANOSS_API_KEY || undefined;
|
|
43
|
+
if (apiKeyToUse) {
|
|
44
|
+
config.API_KEY = apiKeyToUse;
|
|
45
|
+
}
|
|
46
|
+
const scanner = new scanoss_1.Scanner(config);
|
|
47
|
+
let results = undefined;
|
|
48
|
+
try {
|
|
49
|
+
results = await scanner.scanContents({
|
|
50
|
+
content,
|
|
51
|
+
key: 'content_scanning',
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
catch (e) {
|
|
55
|
+
console.debug('SCANOSS error', e);
|
|
56
|
+
// map known errors to a more user-friendly message
|
|
57
|
+
// Invalid API key message
|
|
58
|
+
if ((_a = e.message) === null || _a === void 0 ? void 0 : _a.includes('Forbidden')) {
|
|
59
|
+
return {
|
|
60
|
+
type: 'error',
|
|
61
|
+
message: 'Forbidden: Please check your API key'
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
// Rate limit message
|
|
65
|
+
// HTTP:
|
|
66
|
+
// HTTP Status code: 503
|
|
67
|
+
// Server Response:
|
|
68
|
+
// 503 Unavailable. Check https://osskb.org/limit
|
|
69
|
+
if ((_b = e.message) === null || _b === void 0 ? void 0 : _b.includes('https://osskb.org/limit')) {
|
|
70
|
+
return {
|
|
71
|
+
type: 'error',
|
|
72
|
+
message: 'You have reached the limit of the free data subscription, for a commercial subscription please contact support@scanoss.com'
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
type: 'error',
|
|
77
|
+
message: e.message
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
if (!results) {
|
|
81
|
+
return {
|
|
82
|
+
type: 'error',
|
|
83
|
+
message: 'Scan request unsuccessful'
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
console.debug('SCANOSS results', JSON.stringify(results, undefined, 2));
|
|
87
|
+
let contentScanning = results['/content_scanning'];
|
|
88
|
+
if (!contentScanning) {
|
|
89
|
+
// #14648: The scanoss library prefixes the property with the path of a temporary file on Windows, so we need to search for it
|
|
90
|
+
contentScanning = (_c = Object.entries(results).find(([key]) => key.endsWith('content_scanning'))) === null || _c === void 0 ? void 0 : _c[1];
|
|
91
|
+
}
|
|
92
|
+
if (!contentScanning || contentScanning.length === 0) {
|
|
93
|
+
return {
|
|
94
|
+
type: 'error',
|
|
95
|
+
message: 'Scan request unsuccessful'
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
// first result is the best result
|
|
99
|
+
const firstEntry = contentScanning[0];
|
|
100
|
+
if (firstEntry.id === 'none') {
|
|
101
|
+
return {
|
|
102
|
+
type: 'clean'
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
type: 'match',
|
|
107
|
+
matched: firstEntry.matched,
|
|
108
|
+
url: firstEntry.url,
|
|
109
|
+
raw: firstEntry
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
exports.ScanOSSServiceImpl = ScanOSSServiceImpl;
|
|
114
|
+
exports.ScanOSSServiceImpl = ScanOSSServiceImpl = tslib_1.__decorate([
|
|
115
|
+
(0, inversify_1.injectable)()
|
|
116
|
+
], ScanOSSServiceImpl);
|
|
117
|
+
//# sourceMappingURL=scanoss-service-impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanoss-service-impl.js","sourceRoot":"","sources":["../../src/node/scanoss-service-impl.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,4DAA0D;AAG1D,qCAAgE;AAOhE,6CAA6C;AAC7C,MAAM,mBAAmB;IAAzB;QACY,UAAK,GAAe,OAAO,CAAC,OAAO,EAAgB,CAAC;IAKhE,CAAC;IAJU,KAAK,CAAC,WAAW,CAAC,IAAsB;QAC3C,IAAI,CAAC,KAAK,GAAG,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EAAE,OAAO;YACb,OAAO,EAAE,UAAU,CAAC,OAAO;YAC3B,GAAG,EAAE,UAAU,CAAC,GAAG;YACnB,GAAG,EAAE,UAAU;SAClB,CAAC;IACN,CAAC;CACJ,CAAA;AApFY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,sBAAU,GAAE;GACA,kBAAkB,CAoF9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=package.spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.spec.d.ts","sourceRoot":"","sources":["../src/package.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2024 EclipseSource GmbH and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
/* note: this bogus test file is required so that
|
|
17
|
+
we are able to run mocha unit tests on this
|
|
18
|
+
package, without having any actual unit tests in it.
|
|
19
|
+
This way a coverage report will be generated,
|
|
20
|
+
showing 0% coverage, instead of no report.
|
|
21
|
+
This file can be removed once we have real unit
|
|
22
|
+
tests in place. */
|
|
23
|
+
describe('ai-scanoss package', () => {
|
|
24
|
+
it('support code coverage statistics', () => true);
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=package.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package.spec.js","sourceRoot":"","sources":["../src/package.spec.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,oDAAoD;AACpD,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAEhF;;;;;;qBAMqB;AAErB,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAEhC,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;AACvD,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/scanoss",
|
|
3
|
-
"version": "1.67.0-next.
|
|
3
|
+
"version": "1.67.0-next.59+3f14297ea",
|
|
4
4
|
"description": "Theia - SCANOSS Integration",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/core": "1.67.0-next.
|
|
6
|
+
"@theia/core": "1.67.0-next.59+3f14297ea",
|
|
7
7
|
"scanoss": "^0.15.2"
|
|
8
8
|
},
|
|
9
9
|
"publishConfig": {
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"nyc": {
|
|
47
47
|
"extends": "../../configs/nyc.json"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "3f14297ea2edcdb1fffd74afee0613e70b43e125"
|
|
50
50
|
}
|