@owox/backend 0.37.0 → 0.38.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/dist/src/common/search/search.facade.d.ts +1 -0
- package/dist/src/data-marts/data-destination-types/ee/email/services/email-credentials-validator.js +1 -3
- package/dist/src/data-marts/data-destination-types/ee/google-chat/services/google-chat-credentials-validator.js +1 -3
- package/dist/src/data-marts/data-destination-types/google-sheets/services/google-sheets-credentials-validator.js +1 -3
- package/dist/src/data-marts/data-destination-types/google-sheets/services/google-sheets-report-writer.d.ts +1 -0
- package/dist/src/data-marts/data-destination-types/google-sheets/services/google-sheets-report-writer.js +13 -1
- package/dist/src/data-marts/data-destination-types/interfaces/data-destination-credentials-validator.interface.d.ts +2 -0
- package/dist/src/data-marts/data-destination-types/interfaces/data-destination-credentials-validator.interface.js +7 -0
- package/dist/src/data-marts/data-destination-types/looker-studio-connector/services/looker-studio-connector-credentials-validator.js +1 -3
- package/dist/src/data-marts/data-marts.module.js +4 -0
- package/dist/src/data-marts/data-storage-types/athena/adapters/athena-api.adapter.js +2 -1
- package/dist/src/data-marts/data-storage-types/athena/adapters/s3-api.adapter.js +5 -3
- package/dist/src/data-marts/data-storage-types/athena/services/athena-access.validator.js +2 -4
- package/dist/src/data-marts/data-storage-types/athena/utils/athena-output-location.util.d.ts +5 -0
- package/dist/src/data-marts/data-storage-types/athena/utils/athena-output-location.util.js +13 -0
- package/dist/src/data-marts/data-storage-types/bigquery/services/bigquery-access.validator.js +2 -4
- package/dist/src/data-marts/data-storage-types/bigquery/services/bigquery-resource-location.util.d.ts +3 -0
- package/dist/src/data-marts/data-storage-types/bigquery/services/bigquery-resource-location.util.js +18 -0
- package/dist/src/data-marts/data-storage-types/bigquery/services/bigquery-sharded-tables.util.d.ts +1 -0
- package/dist/src/data-marts/data-storage-types/bigquery/services/bigquery-sharded-tables.util.js +4 -1
- package/dist/src/data-marts/data-storage-types/bigquery/services/bigquery-storage-resource-browser.service.js +12 -5
- package/dist/src/data-marts/data-storage-types/databricks/services/databricks-access.validator.js +2 -4
- package/dist/src/data-marts/data-storage-types/interfaces/data-storage-access-validator.interface.d.ts +3 -0
- package/dist/src/data-marts/data-storage-types/interfaces/data-storage-access-validator.interface.js +7 -0
- package/dist/src/data-marts/data-storage-types/interfaces/storage-resource-browser.interface.d.ts +2 -0
- package/dist/src/data-marts/data-storage-types/redshift/services/redshift-access.validator.js +2 -6
- package/dist/src/data-marts/data-storage-types/snowflake/services/snowflake-access.validator.js +2 -4
- package/dist/src/data-marts/dto/domain/list-data-marts.command.d.ts +2 -1
- package/dist/src/data-marts/dto/domain/list-data-marts.command.js +3 -1
- package/dist/src/data-marts/dto/presentation/sql-dry-run-request-api.dto.js +3 -0
- package/dist/src/data-marts/dto/presentation/storage-resources/list-storage-resources-response.dto.d.ts +2 -0
- package/dist/src/data-marts/dto/presentation/storage-resources/list-storage-resources-response.dto.js +17 -0
- package/dist/src/data-marts/errors/google-sheets-api-call.error.d.ts +6 -0
- package/dist/src/data-marts/errors/google-sheets-api-call.error.js +34 -0
- package/dist/src/data-marts/facades/mcp-contexts.facade.d.ts +13 -0
- package/dist/src/data-marts/facades/mcp-contexts.facade.impl.d.ts +9 -0
- package/dist/src/data-marts/facades/mcp-contexts.facade.impl.js +35 -0
- package/dist/src/data-marts/facades/mcp-contexts.facade.js +5 -0
- package/dist/src/data-marts/facades/mcp-data-marts.facade.d.ts +9 -0
- package/dist/src/data-marts/facades/mcp-data-marts.facade.impl.js +4 -1
- package/dist/src/data-marts/mappers/context.mapper.d.ts +4 -0
- package/dist/src/data-marts/mappers/context.mapper.js +12 -0
- package/dist/src/data-marts/search/engine/advanced-search.service.js +1 -0
- package/dist/src/data-marts/search/engine/in-memory-paginated.search.js +17 -1
- package/dist/src/data-marts/search/engine/vector-search.port.d.ts +1 -0
- package/dist/src/data-marts/services/context/context.service.d.ts +2 -0
- package/dist/src/data-marts/services/context/context.service.js +21 -0
- package/dist/src/data-marts/services/data-mart.service.d.ts +1 -0
- package/dist/src/data-marts/services/data-mart.service.js +3 -0
- package/dist/src/data-marts/use-cases/list-data-marts.service.js +1 -0
- package/dist/src/data-marts/use-cases/stream-http-data.service.d.ts +0 -1
- package/dist/src/data-marts/use-cases/stream-http-data.service.js +2 -6
- package/dist/src/data-marts/use-cases/update-data-storage.service.js +7 -7
- package/dist/src/data-marts/utils/field-errors.utils.d.ts +9 -0
- package/dist/src/data-marts/utils/field-errors.utils.js +51 -0
- package/dist/src/ee/mcp/instructions/mcp-system-instructions.d.ts +1 -1
- package/dist/src/ee/mcp/instructions/mcp-system-instructions.js +3 -0
- package/dist/src/ee/mcp/sdk/mcp-output-schema.d.ts +3 -0
- package/dist/src/ee/mcp/sdk/mcp-output-schema.js +53 -0
- package/dist/src/ee/mcp/sdk/mcp-schema-refresh.d.ts +8 -0
- package/dist/src/ee/mcp/sdk/mcp-schema-refresh.js +44 -0
- package/dist/src/ee/mcp/sdk/mcp-sdk-server.factory.d.ts +8 -1
- package/dist/src/ee/mcp/sdk/mcp-sdk-server.factory.js +35 -4
- package/dist/src/ee/mcp/tools/context-input.d.ts +6 -0
- package/dist/src/ee/mcp/tools/context-input.js +13 -0
- package/dist/src/ee/mcp/tools/data-mart-catalog.tool.d.ts +10 -2
- package/dist/src/ee/mcp/tools/data-mart-catalog.tool.js +17 -5
- package/dist/src/ee/mcp/tools/data-mart-details.tool.d.ts +5 -1
- package/dist/src/ee/mcp/tools/data-mart-details.tool.js +4 -1
- package/dist/src/ee/mcp/tools/list-contexts.tool.d.ts +131 -0
- package/dist/src/ee/mcp/tools/list-contexts.tool.js +50 -0
- package/dist/src/ee/mcp/tools/mcp-tool.providers.js +2 -0
- package/dist/src/ee/mcp/tools/search-data-marts.tool.d.ts +10 -2
- package/dist/src/ee/mcp/tools/search-data-marts.tool.js +17 -3
- package/dist/src/ee/mcp/transport/mcp-http-entry.service.js +1 -1
- package/dist/src/migrations/1790830000000-widen-sql-dry-run-trigger-sql-column.d.ts +6 -0
- package/dist/src/migrations/1790830000000-widen-sql-dry-run-trigger-sql-column.js +21 -0
- package/dist/src/plugin-host/controllers/plugin-gallery.controller.d.ts +5 -1
- package/dist/src/plugin-host/controllers/plugin-gallery.controller.js +25 -1
- package/dist/src/plugin-host/dto/domain/find-plugin-by-repository.command.d.ts +6 -0
- package/dist/src/plugin-host/dto/domain/find-plugin-by-repository.command.js +13 -0
- package/dist/src/plugin-host/dto/presentation/plugin-lookup-api.dto.d.ts +3 -0
- package/dist/src/plugin-host/dto/presentation/plugin-lookup-api.dto.js +22 -0
- package/dist/src/plugin-host/mappers/plugin-presentation.mapper.d.ts +6 -0
- package/dist/src/plugin-host/mappers/plugin-presentation.mapper.js +7 -0
- package/dist/src/plugin-host/plugin-host.module.js +2 -0
- package/dist/src/plugin-host/services/plugin-publication.service.d.ts +2 -0
- package/dist/src/plugin-host/services/plugin-publication.service.js +36 -16
- package/dist/src/plugin-host/use-cases/find-plugin-by-repository.service.d.ts +9 -0
- package/dist/src/plugin-host/use-cases/find-plugin-by-repository.service.js +35 -0
- package/dist/src/plugin-host/use-cases/list-installations.service.d.ts +3 -1
- package/dist/src/plugin-host/use-cases/list-installations.service.js +14 -3
- package/dist/src/plugin-host/utils/github-repo-locator.util.js +1 -1
- package/package.json +4 -4
|
@@ -13,6 +13,8 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.SearchDataMartsTool = void 0;
|
|
16
|
+
const context_input_1 = require("./context-input");
|
|
17
|
+
const mcp_contexts_facade_1 = require("../../../data-marts/facades/mcp-contexts.facade");
|
|
16
18
|
const common_1 = require("@nestjs/common");
|
|
17
19
|
const zod_v4_1 = require("zod-v4");
|
|
18
20
|
const search_facade_1 = require("../../../common/search/search.facade");
|
|
@@ -28,6 +30,7 @@ const DEFAULT_LIMIT = 10;
|
|
|
28
30
|
const MAX_LIMIT = 25;
|
|
29
31
|
const inputSchema = zod_v4_1.z
|
|
30
32
|
.object({
|
|
33
|
+
context_ids: context_input_1.contextIdsSchema,
|
|
31
34
|
prompt: zod_v4_1.z.string().trim().min(2).max(256),
|
|
32
35
|
limit: zod_v4_1.z.number().int().min(1).max(MAX_LIMIT).optional(),
|
|
33
36
|
})
|
|
@@ -37,8 +40,9 @@ let SearchDataMartsTool = class SearchDataMartsTool {
|
|
|
37
40
|
publicOriginService;
|
|
38
41
|
projectContext;
|
|
39
42
|
dataMarts;
|
|
43
|
+
contexts;
|
|
40
44
|
name = 'get_relevant_data_marts_by_prompt';
|
|
41
|
-
description = 'Find relevant non-draft data marts in the current OWOX project from a natural-language prompt, limited to data marts visible to the current MCP user. This is the default discovery step for a concrete analytical question when the data mart has not already been confirmed. Use it when the user asks to find, discover, or search published data marts by title, description, business meaning, schema fields, or metrics. This tool returns only data marts, not data storages or destinations, and it intentionally excludes draft data marts.';
|
|
45
|
+
description = 'Find relevant non-draft data marts in the current OWOX project from a natural-language prompt, limited to data marts visible to the current MCP user. This is the default discovery step for a concrete analytical question when the data mart has not already been confirmed. Use it when the user asks to find, discover, or search published data marts by title, description, business meaning, schema fields, or metrics. This tool returns only data marts, not data storages or destinations, and it intentionally excludes draft data marts. Use get_project_context → list_contexts to discover business goals, then pass context_ids to restrict discovery to any selected context; omission preserves project-wide discovery within your existing access. Responses include all attached context IDs and names.';
|
|
42
46
|
zodSchema = inputSchema.shape;
|
|
43
47
|
outputSchema = {
|
|
44
48
|
project: zod_v4_1.z.object({ id: zod_v4_1.z.string(), title: zod_v4_1.z.string() }).optional(),
|
|
@@ -46,6 +50,7 @@ let SearchDataMartsTool = class SearchDataMartsTool {
|
|
|
46
50
|
id: zod_v4_1.z.string(),
|
|
47
51
|
title: zod_v4_1.z.string(),
|
|
48
52
|
description: zod_v4_1.z.string(),
|
|
53
|
+
contexts: (0, context_input_1.makeContextSummariesSchema)(),
|
|
49
54
|
url: zod_v4_1.z.string(),
|
|
50
55
|
relevance_score: zod_v4_1.z.number(),
|
|
51
56
|
})),
|
|
@@ -60,22 +65,26 @@ let SearchDataMartsTool = class SearchDataMartsTool {
|
|
|
60
65
|
openWorldHint: false,
|
|
61
66
|
};
|
|
62
67
|
requiredScopes = ['mcp:read'];
|
|
63
|
-
constructor(searchFacade, publicOriginService, projectContext, dataMarts) {
|
|
68
|
+
constructor(searchFacade, publicOriginService, projectContext, dataMarts, contexts) {
|
|
64
69
|
this.searchFacade = searchFacade;
|
|
65
70
|
this.publicOriginService = publicOriginService;
|
|
66
71
|
this.projectContext = projectContext;
|
|
67
72
|
this.dataMarts = dataMarts;
|
|
73
|
+
this.contexts = contexts;
|
|
68
74
|
}
|
|
69
75
|
parseInput(input) {
|
|
70
76
|
return inputSchema.parse(input);
|
|
71
77
|
}
|
|
72
78
|
async handler(input, context) {
|
|
73
79
|
const parsed = this.parseInput(input);
|
|
80
|
+
if (parsed.context_ids)
|
|
81
|
+
await this.contexts.validateContextIds(context.projectId, parsed.context_ids);
|
|
74
82
|
const [results, projectContext] = await Promise.all([
|
|
75
83
|
this.searchFacade.search(context.projectId, parsed.prompt, {
|
|
76
84
|
topK: parsed.limit ?? DEFAULT_LIMIT,
|
|
77
85
|
entityTypes: [search_facade_1.SearchableEntityType.DATA_MART],
|
|
78
86
|
excludeDrafts: true,
|
|
87
|
+
...(parsed.context_ids ? { contextIds: parsed.context_ids } : {}),
|
|
79
88
|
accessScope: {
|
|
80
89
|
userId: context.userId,
|
|
81
90
|
roles: context.roles,
|
|
@@ -83,6 +92,9 @@ let SearchDataMartsTool = class SearchDataMartsTool {
|
|
|
83
92
|
}),
|
|
84
93
|
(0, mcp_project_summary_util_1.tryGetMcpProjectSummary)(this.projectContext, context),
|
|
85
94
|
]);
|
|
95
|
+
const attachedContexts = await this.contexts.getDataMartContexts(context.projectId, results
|
|
96
|
+
.filter(result => result.entityType === search_facade_1.SearchableEntityType.DATA_MART)
|
|
97
|
+
.map(result => result.entityId));
|
|
86
98
|
const publicOrigin = this.publicOriginService.getPublicOrigin();
|
|
87
99
|
const dataMarts = results
|
|
88
100
|
.filter(result => result.entityType === search_facade_1.SearchableEntityType.DATA_MART)
|
|
@@ -91,6 +103,7 @@ let SearchDataMartsTool = class SearchDataMartsTool {
|
|
|
91
103
|
title: result.title,
|
|
92
104
|
description: result.description ?? '',
|
|
93
105
|
url: (0, mcp_public_url_util_1.joinPublicOrigin)(publicOrigin, (0, data_mart_ui_path_1.buildDataMartUiPath)(context.projectId, result.entityId)),
|
|
106
|
+
contexts: attachedContexts[result.entityId] ?? [],
|
|
94
107
|
relevance_score: result.finalScore,
|
|
95
108
|
}));
|
|
96
109
|
const gettingStarted = dataMarts.length === 0
|
|
@@ -110,6 +123,7 @@ exports.SearchDataMartsTool = SearchDataMartsTool = __decorate([
|
|
|
110
123
|
__param(0, (0, common_1.Inject)(search_facade_1.SEARCH_FACADE)),
|
|
111
124
|
__param(2, (0, common_1.Inject)(mcp_project_context_facade_1.MCP_PROJECT_CONTEXT_FACADE)),
|
|
112
125
|
__param(3, (0, common_1.Inject)(mcp_data_marts_facade_1.MCP_DATA_MARTS_FACADE)),
|
|
113
|
-
|
|
126
|
+
__param(4, (0, common_1.Inject)(mcp_contexts_facade_1.MCP_CONTEXTS_FACADE)),
|
|
127
|
+
__metadata("design:paramtypes", [Object, public_origin_service_1.PublicOriginService, Object, Object, Object])
|
|
114
128
|
], SearchDataMartsTool);
|
|
115
129
|
//# sourceMappingURL=search-data-marts.tool.js.map
|
|
@@ -49,7 +49,7 @@ let McpHttpEntryService = McpHttpEntryService_1 = class McpHttpEntryService {
|
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
const express = this.adapterHost.httpAdapter.getInstance();
|
|
52
|
-
this.handler = (0, server_1.createMcpHandler)(({ authInfo }) => this.serverFactory.create((0, mcp_auth_middleware_1.toMcpAuthContext)(authInfo), this.instructionsService.getInstructions()), { onerror: error => this.onTransportError(error) });
|
|
52
|
+
this.handler = (0, server_1.createMcpHandler)(({ authInfo, era }) => this.serverFactory.create((0, mcp_auth_middleware_1.toMcpAuthContext)(authInfo), this.instructionsService.getInstructions(), { era, notifyToolsChanged: () => this.handler?.notify.toolsChanged() }), { onerror: error => this.onTransportError(error) });
|
|
53
53
|
const nodeHandler = (0, node_1.toNodeHandler)(this.handler, {
|
|
54
54
|
onerror: error => this.onTransportError(error),
|
|
55
55
|
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
2
|
+
export declare class WidenSqlDryRunTriggerSqlColumn1790830000000 implements MigrationInterface {
|
|
3
|
+
readonly name = "WidenSqlDryRunTriggerSqlColumn1790830000000";
|
|
4
|
+
up(queryRunner: QueryRunner): Promise<void>;
|
|
5
|
+
down(queryRunner: QueryRunner): Promise<void>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WidenSqlDryRunTriggerSqlColumn1790830000000 = void 0;
|
|
4
|
+
class WidenSqlDryRunTriggerSqlColumn1790830000000 {
|
|
5
|
+
name = 'WidenSqlDryRunTriggerSqlColumn1790830000000';
|
|
6
|
+
async up(queryRunner) {
|
|
7
|
+
if (queryRunner.connection.options.type !== 'mysql') {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
await queryRunner.query('ALTER TABLE `sql_dry_run_triggers` MODIFY `sql` MEDIUMTEXT NOT NULL');
|
|
11
|
+
}
|
|
12
|
+
async down(queryRunner) {
|
|
13
|
+
if (queryRunner.connection.options.type !== 'mysql') {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
await queryRunner.query('DELETE FROM `sql_dry_run_triggers` WHERE LENGTH(`sql`) > 65535');
|
|
17
|
+
await queryRunner.query('ALTER TABLE `sql_dry_run_triggers` MODIFY `sql` TEXT NOT NULL');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.WidenSqlDryRunTriggerSqlColumn1790830000000 = WidenSqlDryRunTriggerSqlColumn1790830000000;
|
|
21
|
+
//# sourceMappingURL=1790830000000-widen-sql-dry-run-trigger-sql-column.js.map
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { type AuthorizationContext } from '../../idp';
|
|
2
2
|
import { PluginGalleryEntryApiDto } from '../dto/presentation/plugin-gallery-api.dto';
|
|
3
|
+
import { PluginLookupApiDto } from '../dto/presentation/plugin-lookup-api.dto';
|
|
3
4
|
import { PluginPresentationMapper } from '../mappers/plugin-presentation.mapper';
|
|
5
|
+
import { FindPluginByRepositoryService } from '../use-cases/find-plugin-by-repository.service';
|
|
4
6
|
import { GetPluginDetailsService } from '../use-cases/get-plugin-details.service';
|
|
5
7
|
import { GetPluginGalleryService } from '../use-cases/get-plugin-gallery.service';
|
|
6
8
|
export declare class PluginGalleryController {
|
|
7
9
|
private readonly getPluginGalleryService;
|
|
8
10
|
private readonly getPluginDetailsService;
|
|
11
|
+
private readonly findPluginByRepositoryService;
|
|
9
12
|
private readonly mapper;
|
|
10
|
-
constructor(getPluginGalleryService: GetPluginGalleryService, getPluginDetailsService: GetPluginDetailsService, mapper: PluginPresentationMapper);
|
|
13
|
+
constructor(getPluginGalleryService: GetPluginGalleryService, getPluginDetailsService: GetPluginDetailsService, findPluginByRepositoryService: FindPluginByRepositoryService, mapper: PluginPresentationMapper);
|
|
11
14
|
gallery(context: AuthorizationContext): Promise<PluginGalleryEntryApiDto[]>;
|
|
15
|
+
lookup(context: AuthorizationContext, repository: string): Promise<PluginLookupApiDto>;
|
|
12
16
|
details(context: AuthorizationContext, pluginId: string): Promise<PluginGalleryEntryApiDto>;
|
|
13
17
|
}
|
|
@@ -18,23 +18,31 @@ const swagger_1 = require("@nestjs/swagger");
|
|
|
18
18
|
const idp_1 = require("../../idp");
|
|
19
19
|
const role_config_types_1 = require("../../idp/types/role-config.types");
|
|
20
20
|
const plugin_gallery_api_dto_1 = require("../dto/presentation/plugin-gallery-api.dto");
|
|
21
|
+
const plugin_lookup_api_dto_1 = require("../dto/presentation/plugin-lookup-api.dto");
|
|
21
22
|
const plugin_host_exception_filter_1 = require("../filters/plugin-host-exception.filter");
|
|
22
23
|
const plugin_presentation_mapper_1 = require("../mappers/plugin-presentation.mapper");
|
|
24
|
+
const find_plugin_by_repository_service_1 = require("../use-cases/find-plugin-by-repository.service");
|
|
23
25
|
const get_plugin_details_service_1 = require("../use-cases/get-plugin-details.service");
|
|
24
26
|
const get_plugin_gallery_service_1 = require("../use-cases/get-plugin-gallery.service");
|
|
25
27
|
let PluginGalleryController = class PluginGalleryController {
|
|
26
28
|
getPluginGalleryService;
|
|
27
29
|
getPluginDetailsService;
|
|
30
|
+
findPluginByRepositoryService;
|
|
28
31
|
mapper;
|
|
29
|
-
constructor(getPluginGalleryService, getPluginDetailsService, mapper) {
|
|
32
|
+
constructor(getPluginGalleryService, getPluginDetailsService, findPluginByRepositoryService, mapper) {
|
|
30
33
|
this.getPluginGalleryService = getPluginGalleryService;
|
|
31
34
|
this.getPluginDetailsService = getPluginDetailsService;
|
|
35
|
+
this.findPluginByRepositoryService = findPluginByRepositoryService;
|
|
32
36
|
this.mapper = mapper;
|
|
33
37
|
}
|
|
34
38
|
async gallery(context) {
|
|
35
39
|
const result = await this.getPluginGalleryService.run(this.mapper.toGetPluginGalleryCommand(context));
|
|
36
40
|
return this.mapper.toGalleryEntryResponseList(result);
|
|
37
41
|
}
|
|
42
|
+
async lookup(context, repository) {
|
|
43
|
+
const result = await this.findPluginByRepositoryService.run(this.mapper.toFindPluginByRepositoryCommand(repository ?? '', context));
|
|
44
|
+
return this.mapper.toLookupResponse(result);
|
|
45
|
+
}
|
|
38
46
|
async details(context, pluginId) {
|
|
39
47
|
const result = await this.getPluginDetailsService.run(this.mapper.toGetPluginDetailsCommand(pluginId, context));
|
|
40
48
|
return this.mapper.toGalleryEntryResponse(result);
|
|
@@ -54,6 +62,21 @@ __decorate([
|
|
|
54
62
|
__metadata("design:paramtypes", [Object]),
|
|
55
63
|
__metadata("design:returntype", Promise)
|
|
56
64
|
], PluginGalleryController.prototype, "gallery", null);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, idp_1.Auth)(role_config_types_1.Role.viewer(role_config_types_1.Strategy.PARSE)),
|
|
67
|
+
(0, common_1.Get)('lookup'),
|
|
68
|
+
(0, swagger_1.ApiOperation)({
|
|
69
|
+
summary: 'A public plugin by its GitHub repository',
|
|
70
|
+
description: "Resolves owner/name or a GitHub URL to the id of a public plugin whose deployment publication reaches the caller's project: all projects, or a selected audience that includes it. Any other repository, private, unknown or outside the audience, answers 404 alike.",
|
|
71
|
+
}),
|
|
72
|
+
(0, swagger_1.ApiQuery)({ name: 'repository', required: true, example: 'OWOX/odm-usage-stat' }),
|
|
73
|
+
(0, swagger_1.ApiOkResponse)({ type: plugin_lookup_api_dto_1.PluginLookupApiDto }),
|
|
74
|
+
__param(0, (0, idp_1.AuthContext)()),
|
|
75
|
+
__param(1, (0, common_1.Query)('repository')),
|
|
76
|
+
__metadata("design:type", Function),
|
|
77
|
+
__metadata("design:paramtypes", [Object, String]),
|
|
78
|
+
__metadata("design:returntype", Promise)
|
|
79
|
+
], PluginGalleryController.prototype, "lookup", null);
|
|
57
80
|
__decorate([
|
|
58
81
|
(0, idp_1.Auth)(role_config_types_1.Role.viewer(role_config_types_1.Strategy.PARSE)),
|
|
59
82
|
(0, common_1.Get)(':pluginId'),
|
|
@@ -74,6 +97,7 @@ exports.PluginGalleryController = PluginGalleryController = __decorate([
|
|
|
74
97
|
(0, common_1.UseFilters)(plugin_host_exception_filter_1.PluginHostExceptionFilter),
|
|
75
98
|
__metadata("design:paramtypes", [get_plugin_gallery_service_1.GetPluginGalleryService,
|
|
76
99
|
get_plugin_details_service_1.GetPluginDetailsService,
|
|
100
|
+
find_plugin_by_repository_service_1.FindPluginByRepositoryService,
|
|
77
101
|
plugin_presentation_mapper_1.PluginPresentationMapper])
|
|
78
102
|
], PluginGalleryController);
|
|
79
103
|
//# sourceMappingURL=plugin-gallery.controller.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FindPluginByRepositoryCommand = void 0;
|
|
4
|
+
class FindPluginByRepositoryCommand {
|
|
5
|
+
repository;
|
|
6
|
+
context;
|
|
7
|
+
constructor(repository, context) {
|
|
8
|
+
this.repository = repository;
|
|
9
|
+
this.context = context;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.FindPluginByRepositoryCommand = FindPluginByRepositoryCommand;
|
|
13
|
+
//# sourceMappingURL=find-plugin-by-repository.command.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PluginLookupApiDto = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
class PluginLookupApiDto {
|
|
15
|
+
pluginId;
|
|
16
|
+
}
|
|
17
|
+
exports.PluginLookupApiDto = PluginLookupApiDto;
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, swagger_1.ApiProperty)({ description: 'The plugin id in this deployment.' }),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], PluginLookupApiDto.prototype, "pluginId", void 0);
|
|
22
|
+
//# sourceMappingURL=plugin-lookup-api.dto.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AuthorizationContext } from '../../idp';
|
|
2
|
+
import { FindPluginByRepositoryCommand } from '../dto/domain/find-plugin-by-repository.command';
|
|
2
3
|
import { GetPluginDetailsCommand } from '../dto/domain/get-plugin-details.command';
|
|
3
4
|
import { GetPluginGalleryCommand } from '../dto/domain/get-plugin-gallery.command';
|
|
4
5
|
import { GetPluginInstallationEntryCommand } from '../dto/domain/get-plugin-installation-entry.command';
|
|
@@ -14,6 +15,7 @@ import { UninstallPluginCommand } from '../dto/domain/uninstall-plugin.command';
|
|
|
14
15
|
import { PluginUpdateResultDto, UpdatePluginCommand } from '../dto/domain/update-plugin.command';
|
|
15
16
|
import { InstalledPluginApiDto, InstallPluginApiDto, PluginEntryApiDto, PluginInstallationApiDto, PluginUpdateResultApiDto } from '../dto/presentation/plugin-installation-api.dto';
|
|
16
17
|
import { PluginGalleryEntryApiDto } from '../dto/presentation/plugin-gallery-api.dto';
|
|
18
|
+
import { PluginLookupApiDto } from '../dto/presentation/plugin-lookup-api.dto';
|
|
17
19
|
import { PluginSuspensionResponseApiDto, SuspendPluginApiDto } from '../dto/presentation/plugin-suspension-api.dto';
|
|
18
20
|
import { PluginPublisherDiagnosticsApiDto, PublicationResponseApiDto, PublishPluginApiDto, UpdatePluginByRepositoryApiDto } from '../dto/presentation/publication-api.dto';
|
|
19
21
|
import { PluginVersion } from '../entities/plugin-version.entity';
|
|
@@ -31,6 +33,7 @@ export declare class PluginPresentationMapper {
|
|
|
31
33
|
toGetPluginGalleryCommand(context: AuthorizationContext): GetPluginGalleryCommand;
|
|
32
34
|
toGetPluginDetailsCommand(pluginId: string, context: AuthorizationContext): GetPluginDetailsCommand;
|
|
33
35
|
toListInstallationsCommand(context: AuthorizationContext, includeUninstalled: boolean): ListInstallationsCommand;
|
|
36
|
+
toFindPluginByRepositoryCommand(repository: string, context: AuthorizationContext): FindPluginByRepositoryCommand;
|
|
34
37
|
toGetPluginInstallationEntryCommand(installationId: string, context: AuthorizationContext): GetPluginInstallationEntryCommand;
|
|
35
38
|
toInstallCommand(pluginId: string, context: AuthorizationContext, dto: InstallPluginApiDto): InstallPluginCommand;
|
|
36
39
|
toUpdateCommand(pluginId: string, context: AuthorizationContext): UpdatePluginCommand;
|
|
@@ -39,6 +42,9 @@ export declare class PluginPresentationMapper {
|
|
|
39
42
|
toSuspendCommand(context: AuthorizationContext, dto: SuspendPluginApiDto): SuspendPluginCommand;
|
|
40
43
|
toResumeCommand(context: AuthorizationContext, dto: SuspendPluginApiDto): ResumePluginCommand;
|
|
41
44
|
toMemberDto(plugin: Plugin, version: PluginVersion | null, context: PluginViewContext): PluginGalleryEntryDto;
|
|
45
|
+
toLookupResponse(result: {
|
|
46
|
+
pluginId: string;
|
|
47
|
+
}): PluginLookupApiDto;
|
|
42
48
|
toGalleryEntryResponse(dto: PluginGalleryEntryDto): PluginGalleryEntryApiDto;
|
|
43
49
|
toGalleryEntryResponseList(dtos: PluginGalleryEntryDto[]): PluginGalleryEntryApiDto[];
|
|
44
50
|
toPublicationResponse(dto: PluginPublicationDto): PublicationResponseApiDto;
|
|
@@ -8,6 +8,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.PluginPresentationMapper = void 0;
|
|
10
10
|
const common_1 = require("@nestjs/common");
|
|
11
|
+
const find_plugin_by_repository_command_1 = require("../dto/domain/find-plugin-by-repository.command");
|
|
11
12
|
const get_plugin_details_command_1 = require("../dto/domain/get-plugin-details.command");
|
|
12
13
|
const get_plugin_gallery_command_1 = require("../dto/domain/get-plugin-gallery.command");
|
|
13
14
|
const get_plugin_installation_entry_command_1 = require("../dto/domain/get-plugin-installation-entry.command");
|
|
@@ -44,6 +45,9 @@ let PluginPresentationMapper = class PluginPresentationMapper {
|
|
|
44
45
|
toListInstallationsCommand(context, includeUninstalled) {
|
|
45
46
|
return new list_installations_command_1.ListInstallationsCommand(context, includeUninstalled);
|
|
46
47
|
}
|
|
48
|
+
toFindPluginByRepositoryCommand(repository, context) {
|
|
49
|
+
return new find_plugin_by_repository_command_1.FindPluginByRepositoryCommand(repository, context);
|
|
50
|
+
}
|
|
47
51
|
toGetPluginInstallationEntryCommand(installationId, context) {
|
|
48
52
|
return new get_plugin_installation_entry_command_1.GetPluginInstallationEntryCommand(installationId, context);
|
|
49
53
|
}
|
|
@@ -81,6 +85,9 @@ let PluginPresentationMapper = class PluginPresentationMapper {
|
|
|
81
85
|
credentialRequirements: version?.credentialRequirements ?? [],
|
|
82
86
|
};
|
|
83
87
|
}
|
|
88
|
+
toLookupResponse(result) {
|
|
89
|
+
return { pluginId: result.pluginId };
|
|
90
|
+
}
|
|
84
91
|
toGalleryEntryResponse(dto) {
|
|
85
92
|
return {
|
|
86
93
|
pluginId: dto.pluginId,
|
|
@@ -43,6 +43,7 @@ const publication_authorization_service_1 = require("./services/publication-auth
|
|
|
43
43
|
const plugin_runtime_authorizer_service_1 = require("./services/plugin-runtime-authorizer.service");
|
|
44
44
|
const remote_url_validator_service_1 = require("./services/remote-url-validator.service");
|
|
45
45
|
const plugin_presentation_mapper_1 = require("./mappers/plugin-presentation.mapper");
|
|
46
|
+
const find_plugin_by_repository_service_1 = require("./use-cases/find-plugin-by-repository.service");
|
|
46
47
|
const get_plugin_details_service_1 = require("./use-cases/get-plugin-details.service");
|
|
47
48
|
const get_plugin_installation_entry_service_1 = require("./use-cases/get-plugin-installation-entry.service");
|
|
48
49
|
const install_plugin_service_1 = require("./use-cases/install-plugin.service");
|
|
@@ -132,6 +133,7 @@ exports.PluginHostModule = PluginHostModule = __decorate([
|
|
|
132
133
|
plugin_presentation_mapper_1.PluginPresentationMapper,
|
|
133
134
|
get_plugin_gallery_service_1.GetPluginGalleryService,
|
|
134
135
|
get_plugin_details_service_1.GetPluginDetailsService,
|
|
136
|
+
find_plugin_by_repository_service_1.FindPluginByRepositoryService,
|
|
135
137
|
suspend_plugin_service_1.SuspendPluginService,
|
|
136
138
|
resume_plugin_service_1.ResumePluginService,
|
|
137
139
|
plugin_installation_service_1.PluginInstallationService,
|
|
@@ -22,8 +22,10 @@ export declare class PluginPublicationService {
|
|
|
22
22
|
addToAudience(publicationId: string, projectIds: string[]): Promise<void>;
|
|
23
23
|
removeFromAudience(publicationId: string, projectIds?: string[]): Promise<void>;
|
|
24
24
|
findVisibleTo(projectId: string, userId: string): Promise<PluginPublication[]>;
|
|
25
|
+
findDeploymentPluginIdByRepo(projectId: string, owner: string, name: string): Promise<string | null>;
|
|
25
26
|
listManageable(scope: PluginPublicationScope, filters: {
|
|
26
27
|
projectId?: string;
|
|
27
28
|
userId?: string;
|
|
28
29
|
}): Promise<PluginPublication[]>;
|
|
30
|
+
private deploymentVisibleToProject;
|
|
29
31
|
}
|
|
@@ -18,6 +18,7 @@ const typeorm_1 = require("@nestjs/typeorm");
|
|
|
18
18
|
const typeorm_2 = require("typeorm");
|
|
19
19
|
const plugin_publication_project_entity_1 = require("../entities/plugin-publication-project.entity");
|
|
20
20
|
const plugin_publication_entity_1 = require("../entities/plugin-publication.entity");
|
|
21
|
+
const plugin_entity_1 = require("../entities/plugin.entity");
|
|
21
22
|
const plugin_publication_scope_enum_1 = require("../enums/plugin-publication-scope.enum");
|
|
22
23
|
let PluginPublicationService = class PluginPublicationService {
|
|
23
24
|
publications;
|
|
@@ -69,22 +70,7 @@ let PluginPublicationService = class PluginPublicationService {
|
|
|
69
70
|
.where('publication.isActive = :isActive', { isActive: true })
|
|
70
71
|
.andWhere(new typeorm_2.Brackets(scopes => {
|
|
71
72
|
scopes
|
|
72
|
-
.where(
|
|
73
|
-
deployment
|
|
74
|
-
.where('publication.scope = :deploymentScope', {
|
|
75
|
-
deploymentScope: plugin_publication_scope_enum_1.PluginPublicationScope.DEPLOYMENT,
|
|
76
|
-
})
|
|
77
|
-
.andWhere(new typeorm_2.Brackets(audience => {
|
|
78
|
-
audience
|
|
79
|
-
.where('publication.allProjects = :isActive', { isActive: true })
|
|
80
|
-
.orWhere(`EXISTS (
|
|
81
|
-
SELECT 1 FROM plugin_publication_project audience_row
|
|
82
|
-
WHERE audience_row.publicationId = publication.id
|
|
83
|
-
AND audience_row.projectId = :projectId
|
|
84
|
-
AND audience_row.isActive = :isActive
|
|
85
|
-
)`);
|
|
86
|
-
}));
|
|
87
|
-
}))
|
|
73
|
+
.where(this.deploymentVisibleToProject(projectId))
|
|
88
74
|
.orWhere(new typeorm_2.Brackets(project => {
|
|
89
75
|
project
|
|
90
76
|
.where('publication.scope = :projectScope', {
|
|
@@ -104,6 +90,20 @@ let PluginPublicationService = class PluginPublicationService {
|
|
|
104
90
|
.setParameters({ projectId, userId })
|
|
105
91
|
.getMany();
|
|
106
92
|
}
|
|
93
|
+
async findDeploymentPluginIdByRepo(projectId, owner, name) {
|
|
94
|
+
const publication = await this.publications
|
|
95
|
+
.createQueryBuilder('publication')
|
|
96
|
+
.innerJoin(plugin_entity_1.Plugin, 'plugin', 'plugin.id = publication.pluginId')
|
|
97
|
+
.where('publication.isActive = :isActive', { isActive: true })
|
|
98
|
+
.andWhere(this.deploymentVisibleToProject(projectId))
|
|
99
|
+
.andWhere('LOWER(plugin.repoOwner) = :owner', { owner: owner.toLowerCase() })
|
|
100
|
+
.andWhere('LOWER(plugin.repoName) = :name', { name: name.toLowerCase() })
|
|
101
|
+
.andWhere('plugin.isPrivateRepo = :isPrivate', { isPrivate: false })
|
|
102
|
+
.orderBy('plugin.modifiedAt', 'DESC')
|
|
103
|
+
.addOrderBy('plugin.id', 'ASC')
|
|
104
|
+
.getOne();
|
|
105
|
+
return publication?.pluginId ?? null;
|
|
106
|
+
}
|
|
107
107
|
listManageable(scope, filters) {
|
|
108
108
|
return this.publications.findBy({
|
|
109
109
|
scope,
|
|
@@ -111,6 +111,26 @@ let PluginPublicationService = class PluginPublicationService {
|
|
|
111
111
|
...(filters.userId ? { userId: filters.userId } : {}),
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
|
+
deploymentVisibleToProject(projectId) {
|
|
115
|
+
return new typeorm_2.Brackets(deployment => {
|
|
116
|
+
deployment
|
|
117
|
+
.where('publication.scope = :deploymentScope', {
|
|
118
|
+
deploymentScope: plugin_publication_scope_enum_1.PluginPublicationScope.DEPLOYMENT,
|
|
119
|
+
})
|
|
120
|
+
.andWhere(new typeorm_2.Brackets(audience => {
|
|
121
|
+
audience
|
|
122
|
+
.where('publication.allProjects = :deploymentAllProjects', {
|
|
123
|
+
deploymentAllProjects: true,
|
|
124
|
+
})
|
|
125
|
+
.orWhere(`EXISTS (
|
|
126
|
+
SELECT 1 FROM plugin_publication_project audience_row
|
|
127
|
+
WHERE audience_row.publicationId = publication.id
|
|
128
|
+
AND audience_row.projectId = :deploymentProjectId
|
|
129
|
+
AND audience_row.isActive = :deploymentAudienceActive
|
|
130
|
+
)`, { deploymentProjectId: projectId, deploymentAudienceActive: true });
|
|
131
|
+
}));
|
|
132
|
+
});
|
|
133
|
+
}
|
|
114
134
|
};
|
|
115
135
|
exports.PluginPublicationService = PluginPublicationService;
|
|
116
136
|
exports.PluginPublicationService = PluginPublicationService = __decorate([
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FindPluginByRepositoryCommand } from '../dto/domain/find-plugin-by-repository.command';
|
|
2
|
+
import { PluginPublicationService } from '../services/plugin-publication.service';
|
|
3
|
+
export declare class FindPluginByRepositoryService {
|
|
4
|
+
private readonly publications;
|
|
5
|
+
constructor(publications: PluginPublicationService);
|
|
6
|
+
run(command: FindPluginByRepositoryCommand): Promise<{
|
|
7
|
+
pluginId: string;
|
|
8
|
+
}>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.FindPluginByRepositoryService = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const plugin_publication_service_1 = require("../services/plugin-publication.service");
|
|
15
|
+
const github_repo_locator_util_1 = require("../utils/github-repo-locator.util");
|
|
16
|
+
let FindPluginByRepositoryService = class FindPluginByRepositoryService {
|
|
17
|
+
publications;
|
|
18
|
+
constructor(publications) {
|
|
19
|
+
this.publications = publications;
|
|
20
|
+
}
|
|
21
|
+
async run(command) {
|
|
22
|
+
const { owner, name } = (0, github_repo_locator_util_1.parseGithubRepoLocator)(command.repository);
|
|
23
|
+
const pluginId = await this.publications.findDeploymentPluginIdByRepo(command.context.projectId, owner, name);
|
|
24
|
+
if (!pluginId) {
|
|
25
|
+
throw new common_1.NotFoundException('No public plugin is published from this repository');
|
|
26
|
+
}
|
|
27
|
+
return { pluginId };
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
exports.FindPluginByRepositoryService = FindPluginByRepositoryService;
|
|
31
|
+
exports.FindPluginByRepositoryService = FindPluginByRepositoryService = __decorate([
|
|
32
|
+
(0, common_1.Injectable)(),
|
|
33
|
+
__metadata("design:paramtypes", [plugin_publication_service_1.PluginPublicationService])
|
|
34
|
+
], FindPluginByRepositoryService);
|
|
35
|
+
//# sourceMappingURL=find-plugin-by-repository.service.js.map
|
|
@@ -2,6 +2,7 @@ import { ListInstallationsCommand } from '../dto/domain/list-installations.comma
|
|
|
2
2
|
import { InstalledPluginDto } from '../dto/domain/plugin-installation.dto';
|
|
3
3
|
import { PluginPresentationMapper } from '../mappers/plugin-presentation.mapper';
|
|
4
4
|
import { PluginInstallationService } from '../services/plugin-installation.service';
|
|
5
|
+
import { PluginPublicationService } from '../services/plugin-publication.service';
|
|
5
6
|
import { PluginVersionService } from '../services/plugin-version.service';
|
|
6
7
|
import { PluginService } from '../services/plugin.service';
|
|
7
8
|
export declare class ListInstallationsService {
|
|
@@ -9,6 +10,7 @@ export declare class ListInstallationsService {
|
|
|
9
10
|
private readonly pluginService;
|
|
10
11
|
private readonly versionService;
|
|
11
12
|
private readonly mapper;
|
|
12
|
-
|
|
13
|
+
private readonly publications;
|
|
14
|
+
constructor(installations: PluginInstallationService, pluginService: PluginService, versionService: PluginVersionService, mapper: PluginPresentationMapper, publications: PluginPublicationService);
|
|
13
15
|
run(command: ListInstallationsCommand): Promise<InstalledPluginDto[]>;
|
|
14
16
|
}
|
|
@@ -13,6 +13,7 @@ exports.ListInstallationsService = void 0;
|
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
14
|
const plugin_presentation_mapper_1 = require("../mappers/plugin-presentation.mapper");
|
|
15
15
|
const plugin_installation_service_1 = require("../services/plugin-installation.service");
|
|
16
|
+
const plugin_publication_service_1 = require("../services/plugin-publication.service");
|
|
16
17
|
const plugin_version_service_1 = require("../services/plugin-version.service");
|
|
17
18
|
const plugin_service_1 = require("../services/plugin.service");
|
|
18
19
|
let ListInstallationsService = class ListInstallationsService {
|
|
@@ -20,11 +21,13 @@ let ListInstallationsService = class ListInstallationsService {
|
|
|
20
21
|
pluginService;
|
|
21
22
|
versionService;
|
|
22
23
|
mapper;
|
|
23
|
-
|
|
24
|
+
publications;
|
|
25
|
+
constructor(installations, pluginService, versionService, mapper, publications) {
|
|
24
26
|
this.installations = installations;
|
|
25
27
|
this.pluginService = pluginService;
|
|
26
28
|
this.versionService = versionService;
|
|
27
29
|
this.mapper = mapper;
|
|
30
|
+
this.publications = publications;
|
|
28
31
|
}
|
|
29
32
|
async run(command) {
|
|
30
33
|
const rows = await this.installations.findByMember(command.context.projectId, command.context.userId);
|
|
@@ -35,6 +38,13 @@ let ListInstallationsService = class ListInstallationsService {
|
|
|
35
38
|
const pluginById = new Map(plugins.map(plugin => [plugin.id, plugin]));
|
|
36
39
|
const versions = await this.versionService.findByIds(plugins.map(plugin => plugin.currentVersionId).filter(id => id !== null));
|
|
37
40
|
const versionById = new Map(versions.map(version => [version.id, version]));
|
|
41
|
+
const listed = await this.publications.findVisibleTo(command.context.projectId, command.context.userId);
|
|
42
|
+
const scopesByPlugin = new Map();
|
|
43
|
+
for (const publication of listed) {
|
|
44
|
+
const scopes = scopesByPlugin.get(publication.pluginId) ?? new Set();
|
|
45
|
+
scopes.add(publication.scope);
|
|
46
|
+
scopesByPlugin.set(publication.pluginId, scopes);
|
|
47
|
+
}
|
|
38
48
|
const entries = [];
|
|
39
49
|
for (const row of visible) {
|
|
40
50
|
const plugin = pluginById.get(row.pluginId);
|
|
@@ -43,7 +53,7 @@ let ListInstallationsService = class ListInstallationsService {
|
|
|
43
53
|
}
|
|
44
54
|
entries.push({
|
|
45
55
|
...this.mapper.toMemberDto(plugin, plugin.currentVersionId ? (versionById.get(plugin.currentVersionId) ?? null) : null, {
|
|
46
|
-
scopes: [],
|
|
56
|
+
scopes: [...(scopesByPlugin.get(plugin.id) ?? [])],
|
|
47
57
|
installationState: row.uninstalledAt === null ? 'installed' : 'uninstalled',
|
|
48
58
|
}),
|
|
49
59
|
installationId: row.id,
|
|
@@ -60,6 +70,7 @@ exports.ListInstallationsService = ListInstallationsService = __decorate([
|
|
|
60
70
|
__metadata("design:paramtypes", [plugin_installation_service_1.PluginInstallationService,
|
|
61
71
|
plugin_service_1.PluginService,
|
|
62
72
|
plugin_version_service_1.PluginVersionService,
|
|
63
|
-
plugin_presentation_mapper_1.PluginPresentationMapper
|
|
73
|
+
plugin_presentation_mapper_1.PluginPresentationMapper,
|
|
74
|
+
plugin_publication_service_1.PluginPublicationService])
|
|
64
75
|
], ListInstallationsService);
|
|
65
76
|
//# sourceMappingURL=list-installations.service.js.map
|
|
@@ -6,7 +6,7 @@ const GITHUB_HOSTS = new Set(['github.com', 'www.github.com']);
|
|
|
6
6
|
const SEGMENT = /^[A-Za-z0-9._-]+$/;
|
|
7
7
|
const SCP_SYNTAX = /^git@([^:]+):(.+)$/;
|
|
8
8
|
function parseGithubRepoLocator(locator) {
|
|
9
|
-
const trimmed = locator
|
|
9
|
+
const trimmed = typeof locator === 'string' ? locator.trim() : '';
|
|
10
10
|
if (!trimmed) {
|
|
11
11
|
throw new plugin_host_errors_1.InvalidRepoLocatorError(locator);
|
|
12
12
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owox/backend",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.0",
|
|
4
4
|
"description": "OWOX Data Marts Backend - Full-stack data orchestration platform",
|
|
5
5
|
"author": "OWOX",
|
|
6
6
|
"license": "ELv2",
|
|
@@ -92,9 +92,9 @@
|
|
|
92
92
|
"@opentelemetry/exporter-trace-otlp-http": "^0.220.0",
|
|
93
93
|
"@opentelemetry/sdk-trace-base": "^2.9.0",
|
|
94
94
|
"@opentelemetry/sdk-trace-node": "^2.9.0",
|
|
95
|
-
"@owox/connectors": "0.
|
|
96
|
-
"@owox/idp-protocol": "0.
|
|
97
|
-
"@owox/internal-helpers": "0.
|
|
95
|
+
"@owox/connectors": "0.38.0",
|
|
96
|
+
"@owox/idp-protocol": "0.38.0",
|
|
97
|
+
"@owox/internal-helpers": "0.38.0",
|
|
98
98
|
"better-sqlite3": "^12.2.0",
|
|
99
99
|
"class-transformer": "^0.5.1",
|
|
100
100
|
"class-validator": "^0.14.2",
|