@owox/backend 0.38.0 → 0.39.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/helpers/read-bounded-body.helper.d.ts +1 -0
- package/dist/src/common/helpers/read-bounded-body.helper.js +28 -0
- package/dist/src/common/scheduler/system-tasks/system-trigger-type.d.ts +3 -1
- package/dist/src/common/scheduler/system-tasks/system-trigger-type.js +2 -0
- package/dist/src/config/data-source-options.config.d.ts +4 -3
- package/dist/src/config/data-source-options.config.js +10 -3
- package/dist/src/config/plugin-collections-body-parser.config.js +3 -0
- package/dist/src/data-marts/credentials/credential.types.d.ts +26 -2
- package/dist/src/data-marts/credentials/credential.types.js +18 -6
- package/dist/src/data-marts/credentials/dto/credential-api.dto.d.ts +5 -1
- package/dist/src/data-marts/credentials/dto/credential-api.dto.js +21 -0
- package/dist/src/data-marts/credentials/dto/credential.dto.d.ts +2 -1
- package/dist/src/data-marts/credentials/entities/credential.entity.d.ts +2 -1
- package/dist/src/data-marts/credentials/entities/credential.entity.js +5 -0
- package/dist/src/data-marts/credentials/facades/credential-consumer-binding.facade.impl.js +6 -1
- package/dist/src/data-marts/credentials/mappers/credential.mapper.js +2 -0
- package/dist/src/data-marts/credentials/services/builtin-credential-definitions.js +8 -0
- package/dist/src/data-marts/credentials/services/credential-external-definition-registry.service.d.ts +4 -0
- package/dist/src/data-marts/credentials/services/credential-external-definition-registry.service.js +36 -17
- package/dist/src/data-marts/credentials/services/credential-fetch.service.d.ts +8 -0
- package/dist/src/data-marts/credentials/services/credential-fetch.service.js +115 -46
- package/dist/src/data-marts/credentials/services/credential-validation-probe.service.d.ts +3 -1
- package/dist/src/data-marts/credentials/services/credential-validation-probe.service.js +10 -2
- package/dist/src/data-marts/credentials/services/credential.service.d.ts +4 -0
- package/dist/src/data-marts/credentials/services/credential.service.js +36 -0
- package/dist/src/data-marts/credentials/services/google-service-account-key.d.ts +6 -0
- package/dist/src/data-marts/credentials/services/google-service-account-key.js +46 -0
- package/dist/src/data-marts/credentials/services/google-service-account-token.service.d.ts +25 -0
- package/dist/src/data-marts/credentials/services/google-service-account-token.service.js +177 -0
- package/dist/src/data-marts/credentials/use-cases/create-credential.service.d.ts +1 -0
- package/dist/src/data-marts/credentials/use-cases/create-credential.service.js +10 -2
- package/dist/src/data-marts/credentials/use-cases/update-credential.service.d.ts +1 -0
- package/dist/src/data-marts/credentials/use-cases/update-credential.service.js +28 -4
- package/dist/src/data-marts/credentials/use-cases/validate-credential.service.js +2 -5
- package/dist/src/data-marts/data-marts.module.js +4 -0
- package/dist/src/data-marts/data-storage-types/snowflake/adapters/snowflake-api.adapter.js +1 -0
- package/dist/src/data-marts/dto/presentation/run-data-mart-request-api.dto.js +4 -2
- package/dist/src/data-marts/services/connector/backfill-segment.d.ts +22 -0
- package/dist/src/data-marts/services/connector/backfill-segment.js +91 -0
- package/dist/src/data-marts/services/connector/connector-execution.service.d.ts +1 -0
- package/dist/src/data-marts/services/connector/connector-execution.service.js +3 -0
- package/dist/src/data-marts/services/connector/connector-executor.service.d.ts +4 -1
- package/dist/src/data-marts/services/connector/connector-executor.service.js +107 -23
- package/dist/src/data-marts/services/connector/connector-run.service.d.ts +3 -0
- package/dist/src/data-marts/services/connector/connector-run.service.js +98 -4
- package/dist/src/data-marts/services/data-mart-run.service.d.ts +1 -0
- package/dist/src/data-marts/services/data-mart-run.service.js +9 -0
- package/dist/src/data-marts/system-triggers/processors/repair-backfill-chains-processor.d.ts +14 -0
- package/dist/src/data-marts/system-triggers/processors/repair-backfill-chains-processor.js +45 -0
- package/dist/src/data-marts/use-cases/cancel-data-mart-run.service.d.ts +4 -0
- package/dist/src/data-marts/use-cases/cancel-data-mart-run.service.js +46 -1
- package/dist/src/data-marts/utils/manual-backfill-range.d.ts +52 -0
- package/dist/src/data-marts/utils/manual-backfill-range.js +110 -8
- package/dist/src/ee/mcp/instructions/mcp-system-instructions.d.ts +1 -1
- package/dist/src/ee/mcp/instructions/mcp-system-instructions.js +1 -0
- package/dist/src/idp/decorators/auth-context.decorator.js +1 -0
- package/dist/src/idp/guards/idp.guard.d.ts +3 -0
- package/dist/src/idp/guards/idp.guard.js +38 -8
- package/dist/src/idp/oauth/controllers/oauth-authorization.controller.js +8 -6
- package/dist/src/idp/oauth/mcp-client-integration.d.ts +1 -0
- package/dist/src/idp/oauth/mcp-client-integration.js +15 -0
- package/dist/src/idp/ports/plugin-runtime-authorizer.port.d.ts +6 -0
- package/dist/src/idp/types/auth.types.d.ts +1 -0
- package/dist/src/migrations/1790900000000-add-plugin-version-backend.d.ts +6 -0
- package/dist/src/migrations/1790900000000-add-plugin-version-backend.js +21 -0
- package/dist/src/migrations/1790900000001-create-plugin-action-execution.d.ts +6 -0
- package/dist/src/migrations/1790900000001-create-plugin-action-execution.js +77 -0
- package/dist/src/migrations/1791000000000-add-credential-public-metadata.d.ts +6 -0
- package/dist/src/migrations/1791000000000-add-credential-public-metadata.js +23 -0
- package/dist/src/plugin-host/collections/dto/domain/plugin-collection.types.d.ts +1 -0
- package/dist/src/plugin-host/collections/errors/plugin-collection.errors.d.ts +6 -0
- package/dist/src/plugin-host/collections/errors/plugin-collection.errors.js +19 -1
- package/dist/src/plugin-host/collections/services/plugin-collection-declaration.service.js +3 -3
- package/dist/src/plugin-host/collections/use-cases/put-plugin-collection-document.service.js +7 -0
- package/dist/src/plugin-host/constants/plugin-action-limits.d.ts +34 -0
- package/dist/src/plugin-host/constants/plugin-action-limits.js +51 -0
- package/dist/src/plugin-host/controllers/plugin-action-runtime.controller.d.ts +20 -0
- package/dist/src/plugin-host/controllers/plugin-action-runtime.controller.js +123 -0
- package/dist/src/plugin-host/controllers/plugin-credential-runtime.controller.js +11 -19
- package/dist/src/plugin-host/controllers/plugin-history.controller.d.ts +10 -0
- package/dist/src/plugin-host/controllers/plugin-history.controller.js +57 -0
- package/dist/src/plugin-host/controllers/plugin-release-check.controller.d.ts +10 -0
- package/dist/src/plugin-host/controllers/plugin-release-check.controller.js +58 -0
- package/dist/src/plugin-host/dto/domain/check-plugin-release.command.d.ts +22 -0
- package/dist/src/plugin-host/dto/domain/check-plugin-release.command.js +17 -0
- package/dist/src/plugin-host/dto/domain/list-plugin-history.command.d.ts +10 -0
- package/dist/src/plugin-host/dto/domain/list-plugin-history.command.js +18 -0
- package/dist/src/plugin-host/dto/domain/plugin-action-execution.command.d.ts +23 -0
- package/dist/src/plugin-host/dto/domain/plugin-action-execution.command.js +44 -0
- package/dist/src/plugin-host/dto/domain/plugin-action-execution.dto.d.ts +36 -0
- package/dist/src/plugin-host/dto/domain/plugin-action-execution.dto.js +3 -0
- package/dist/src/plugin-host/dto/domain/plugin-history.dto.d.ts +29 -0
- package/dist/src/plugin-host/dto/domain/plugin-history.dto.js +3 -0
- package/dist/src/plugin-host/dto/domain/plugin-view.dto.d.ts +1 -0
- package/dist/src/plugin-host/dto/presentation/plugin-action-api.dto.d.ts +44 -0
- package/dist/src/plugin-host/dto/presentation/plugin-action-api.dto.js +208 -0
- package/dist/src/plugin-host/dto/presentation/plugin-gallery-api.dto.d.ts +2 -0
- package/dist/src/plugin-host/dto/presentation/plugin-gallery-api.dto.js +7 -0
- package/dist/src/plugin-host/dto/presentation/plugin-history-api.dto.d.ts +29 -0
- package/dist/src/plugin-host/dto/presentation/plugin-history-api.dto.js +148 -0
- package/dist/src/plugin-host/dto/presentation/publication-api.dto.d.ts +17 -0
- package/dist/src/plugin-host/dto/presentation/publication-api.dto.js +95 -1
- package/dist/src/plugin-host/entities/plugin-action-execution.entity.d.ts +24 -0
- package/dist/src/plugin-host/entities/plugin-action-execution.entity.js +136 -0
- package/dist/src/plugin-host/entities/plugin-version.entity.d.ts +2 -1
- package/dist/src/plugin-host/entities/plugin-version.entity.js +5 -0
- package/dist/src/plugin-host/enums/plugin-action-execution-status.enum.d.ts +9 -0
- package/dist/src/plugin-host/enums/plugin-action-execution-status.enum.js +22 -0
- package/dist/src/plugin-host/enums/release-rejection-code.enum.d.ts +3 -0
- package/dist/src/plugin-host/enums/release-rejection-code.enum.js +6 -0
- package/dist/src/plugin-host/errors/plugin-action.errors.d.ts +45 -0
- package/dist/src/plugin-host/errors/plugin-action.errors.js +70 -0
- package/dist/src/plugin-host/errors/plugin-host.errors.d.ts +6 -0
- package/dist/src/plugin-host/errors/plugin-host.errors.js +10 -1
- package/dist/src/plugin-host/filters/plugin-host-exception.filter.js +2 -2
- package/dist/src/plugin-host/mappers/plugin-action-execution.mapper.d.ts +3 -0
- package/dist/src/plugin-host/mappers/plugin-action-execution.mapper.js +22 -0
- package/dist/src/plugin-host/mappers/plugin-presentation.mapper.d.ts +16 -1
- package/dist/src/plugin-host/mappers/plugin-presentation.mapper.js +80 -1
- package/dist/src/plugin-host/plugin-host.module.js +32 -0
- package/dist/src/plugin-host/services/action-input-validator.service.d.ts +23 -0
- package/dist/src/plugin-host/services/action-input-validator.service.js +277 -0
- package/dist/src/plugin-host/services/external-credential-definition-sync.service.d.ts +3 -0
- package/dist/src/plugin-host/services/external-credential-definition-sync.service.js +47 -15
- package/dist/src/plugin-host/services/plugin-action-dispatcher.service.d.ts +13 -0
- package/dist/src/plugin-host/services/plugin-action-dispatcher.service.js +140 -0
- package/dist/src/plugin-host/services/plugin-action-execution.service.d.ts +69 -0
- package/dist/src/plugin-host/services/plugin-action-execution.service.js +239 -0
- package/dist/src/plugin-host/services/plugin-action-starter.service.d.ts +22 -0
- package/dist/src/plugin-host/services/plugin-action-starter.service.js +81 -0
- package/dist/src/plugin-host/services/plugin-audit.service.d.ts +13 -0
- package/dist/src/plugin-host/services/plugin-audit.service.js +78 -0
- package/dist/src/plugin-host/services/plugin-publication.service.d.ts +2 -0
- package/dist/src/plugin-host/services/plugin-publication.service.js +18 -10
- package/dist/src/plugin-host/services/plugin-runtime-authorizer.service.d.ts +5 -2
- package/dist/src/plugin-host/services/plugin-runtime-authorizer.service.js +31 -3
- package/dist/src/plugin-host/services/plugin-version.service.d.ts +2 -1
- package/dist/src/plugin-host/services/release-candidate-rules.service.d.ts +51 -0
- package/dist/src/plugin-host/services/release-candidate-rules.service.js +198 -0
- package/dist/src/plugin-host/services/remote-url-validator.service.d.ts +7 -0
- package/dist/src/plugin-host/services/remote-url-validator.service.js +4 -0
- package/dist/src/plugin-host/system-triggers/plugin-action-execution-sweep.processor.d.ts +14 -0
- package/dist/src/plugin-host/system-triggers/plugin-action-execution-sweep.processor.js +50 -0
- package/dist/src/plugin-host/use-cases/cancel-plugin-action-execution.service.d.ts +8 -0
- package/dist/src/plugin-host/use-cases/cancel-plugin-action-execution.service.js +39 -0
- package/dist/src/plugin-host/use-cases/check-plugin-release.service.d.ts +22 -0
- package/dist/src/plugin-host/use-cases/check-plugin-release.service.js +152 -0
- package/dist/src/plugin-host/use-cases/get-current-plugin-action-execution.service.d.ts +14 -0
- package/dist/src/plugin-host/use-cases/get-current-plugin-action-execution.service.js +85 -0
- package/dist/src/plugin-host/use-cases/get-plugin-action-execution.service.d.ts +9 -0
- package/dist/src/plugin-host/use-cases/get-plugin-action-execution.service.js +67 -0
- package/dist/src/plugin-host/use-cases/get-plugin-installation-entry.service.js +2 -7
- package/dist/src/plugin-host/use-cases/install-plugin.service.js +4 -0
- package/dist/src/plugin-host/use-cases/list-plugin-history.service.d.ts +25 -0
- package/dist/src/plugin-host/use-cases/list-plugin-history.service.js +147 -0
- package/dist/src/plugin-host/use-cases/plugin-publisher-access.d.ts +5 -0
- package/dist/src/plugin-host/use-cases/plugin-publisher-access.js +28 -0
- package/dist/src/plugin-host/use-cases/start-plugin-action-execution.service.d.ts +12 -0
- package/dist/src/plugin-host/use-cases/start-plugin-action-execution.service.js +64 -0
- package/dist/src/plugin-host/use-cases/sync-plugin-releases.service.d.ts +3 -5
- package/dist/src/plugin-host/use-cases/sync-plugin-releases.service.js +15 -59
- package/dist/src/plugin-host/use-cases/uninstall-plugin.service.js +3 -1
- package/dist/src/plugin-host/use-cases/update-plugin.service.d.ts +0 -1
- package/dist/src/plugin-host/use-cases/update-plugin.service.js +3 -25
- package/dist/src/plugin-host/utils/action-input-schema.util.d.ts +14 -0
- package/dist/src/plugin-host/utils/action-input-schema.util.js +133 -0
- package/dist/src/plugin-host/utils/credential-handles.util.d.ts +3 -0
- package/dist/src/plugin-host/utils/credential-handles.util.js +13 -0
- package/dist/src/plugin-host/utils/execution-token.util.d.ts +5 -0
- package/dist/src/plugin-host/utils/execution-token.util.js +13 -0
- package/dist/src/plugin-host/utils/json-shape.util.d.ts +1 -0
- package/dist/src/plugin-host/utils/json-shape.util.js +21 -0
- package/dist/src/plugin-host/utils/plugin-action-outcome.util.d.ts +10 -0
- package/dist/src/plugin-host/utils/plugin-action-outcome.util.js +67 -0
- package/dist/src/plugin-host/utils/plugin-manifest.util.d.ts +121 -0
- package/dist/src/plugin-host/utils/plugin-manifest.util.js +111 -1
- package/dist/src/plugin-host/utils/request-abort-signal.util.d.ts +5 -0
- package/dist/src/plugin-host/utils/request-abort-signal.util.js +19 -0
- package/package.json +10 -8
|
@@ -19,6 +19,7 @@ export interface AuthenticatedRequest extends Request {
|
|
|
19
19
|
pluginId?: string;
|
|
20
20
|
installationId?: string;
|
|
21
21
|
viewOnly?: boolean;
|
|
22
|
+
executionId?: string;
|
|
22
23
|
};
|
|
23
24
|
}
|
|
24
25
|
export declare const AUTH_CONTEXT = "AuthContext";
|
|
@@ -31,10 +32,12 @@ export declare class IdpGuard implements CanActivate {
|
|
|
31
32
|
constructor(reflector: Reflector, idpProviderService: IdpProviderService, cls: ClsService, idpProjectionsService: IdpProjectionsService, moduleRef: ModuleRef);
|
|
32
33
|
canActivate(context: ExecutionContext): Promise<boolean>;
|
|
33
34
|
private authenticateUser;
|
|
35
|
+
private authenticateExecution;
|
|
34
36
|
private checkViewOnlyRestrictions;
|
|
35
37
|
private checkApiKeyHeaderBinding;
|
|
36
38
|
private checkApiKeyUsageRestrictions;
|
|
37
39
|
private checkPluginRuntimeAuthorization;
|
|
40
|
+
private runtimeAuthorizer;
|
|
38
41
|
private isNonEmptyString;
|
|
39
42
|
private static readonly ROLE_DISPLAY_NAMES;
|
|
40
43
|
private checkRoleAuthorization;
|
|
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
exports.IdpGuard = exports.AUTH_CONTEXT = void 0;
|
|
14
14
|
const common_1 = require("@nestjs/common");
|
|
15
15
|
const idp_protocol_1 = require("@owox/idp-protocol");
|
|
16
|
+
const business_violation_exception_1 = require("../../common/exceptions/business-violation.exception");
|
|
16
17
|
const idp_projections_service_1 = require("../services/idp-projections.service");
|
|
17
18
|
const types_1 = require("../types");
|
|
18
19
|
const core_1 = require("@nestjs/core");
|
|
@@ -78,6 +79,7 @@ let IdpGuard = class IdpGuard {
|
|
|
78
79
|
pluginId: tokenPayload.pluginId,
|
|
79
80
|
installationId: tokenPayload.installationId,
|
|
80
81
|
viewOnly,
|
|
82
|
+
executionId: tokenPayload.executionId,
|
|
81
83
|
};
|
|
82
84
|
this.cls.set(exports.AUTH_CONTEXT, {
|
|
83
85
|
userId: tokenPayload.userId,
|
|
@@ -88,13 +90,16 @@ let IdpGuard = class IdpGuard {
|
|
|
88
90
|
pluginId: tokenPayload.pluginId,
|
|
89
91
|
installationId: tokenPayload.installationId,
|
|
90
92
|
viewOnly,
|
|
93
|
+
executionId: tokenPayload.executionId,
|
|
91
94
|
});
|
|
92
95
|
if (request && STATE_CHANGING_METHODS.includes(request.method)) {
|
|
93
96
|
void this.idpProjectionsService.updateProjectionsFromIdpPayload(tokenPayload);
|
|
94
97
|
}
|
|
95
98
|
}
|
|
96
99
|
catch (error) {
|
|
97
|
-
if (error instanceof common_1.UnauthorizedException ||
|
|
100
|
+
if (error instanceof common_1.UnauthorizedException ||
|
|
101
|
+
error instanceof idp_protocol_1.AuthorizationError ||
|
|
102
|
+
(error instanceof business_violation_exception_1.BusinessViolationException && error.code === 'PLUGIN_SUSPENDED')) {
|
|
98
103
|
throw error;
|
|
99
104
|
}
|
|
100
105
|
throw new idp_protocol_1.AuthenticationError('Authentication failed');
|
|
@@ -105,6 +110,10 @@ let IdpGuard = class IdpGuard {
|
|
|
105
110
|
return true;
|
|
106
111
|
}
|
|
107
112
|
async authenticateUser(request, strategy) {
|
|
113
|
+
const executionToken = request.headers['x-owox-execution-token'];
|
|
114
|
+
if (executionToken !== undefined) {
|
|
115
|
+
return this.authenticateExecution(request, executionToken);
|
|
116
|
+
}
|
|
108
117
|
const idpProvider = this.idpProviderService.getProvider(request);
|
|
109
118
|
const token = request.headers['x-owox-authorization'] ?? '';
|
|
110
119
|
const tokenPayload = strategy === types_1.Strategy.PARSE
|
|
@@ -113,7 +122,25 @@ let IdpGuard = class IdpGuard {
|
|
|
113
122
|
if (!tokenPayload) {
|
|
114
123
|
throw new idp_protocol_1.AuthenticationError('Invalid authorization');
|
|
115
124
|
}
|
|
116
|
-
return tokenPayload;
|
|
125
|
+
return { ...tokenPayload, executionId: undefined };
|
|
126
|
+
}
|
|
127
|
+
async authenticateExecution(request, executionToken) {
|
|
128
|
+
if (Array.isArray(executionToken) || request.headers['x-owox-authorization'] !== undefined) {
|
|
129
|
+
throw new idp_protocol_1.AuthenticationError('Send one authorization header');
|
|
130
|
+
}
|
|
131
|
+
const identity = await this.runtimeAuthorizer().resolveExecutionToken(executionToken);
|
|
132
|
+
if (!identity) {
|
|
133
|
+
throw new idp_protocol_1.AuthenticationError('Invalid execution token');
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
userId: identity.userId,
|
|
137
|
+
projectId: identity.projectId,
|
|
138
|
+
roles: [identity.role],
|
|
139
|
+
authFlow: 'plugin',
|
|
140
|
+
pluginId: identity.pluginId,
|
|
141
|
+
installationId: identity.installationId,
|
|
142
|
+
executionId: identity.executionId,
|
|
143
|
+
};
|
|
117
144
|
}
|
|
118
145
|
checkViewOnlyRestrictions(request, tokenPayload, viewOnlySafe) {
|
|
119
146
|
if (!(0, idp_protocol_1.isViewOnlyPayload)(tokenPayload)) {
|
|
@@ -161,6 +188,14 @@ let IdpGuard = class IdpGuard {
|
|
|
161
188
|
!this.isNonEmptyString(tokenPayload.userId)) {
|
|
162
189
|
throw new idp_protocol_1.AuthorizationError('Invalid plugin runtime identity');
|
|
163
190
|
}
|
|
191
|
+
await this.runtimeAuthorizer().assertActiveInstallation({
|
|
192
|
+
pluginId: tokenPayload.pluginId,
|
|
193
|
+
installationId: tokenPayload.installationId,
|
|
194
|
+
projectId: tokenPayload.projectId,
|
|
195
|
+
userId: tokenPayload.userId,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
runtimeAuthorizer() {
|
|
164
199
|
let authorizer;
|
|
165
200
|
try {
|
|
166
201
|
authorizer = this.moduleRef.get(plugin_runtime_authorizer_port_1.PLUGIN_RUNTIME_AUTHORIZER, {
|
|
@@ -173,12 +208,7 @@ let IdpGuard = class IdpGuard {
|
|
|
173
208
|
if (!authorizer) {
|
|
174
209
|
throw new idp_protocol_1.AuthorizationError('Plugin runtime authorization is unavailable');
|
|
175
210
|
}
|
|
176
|
-
|
|
177
|
-
pluginId: tokenPayload.pluginId,
|
|
178
|
-
installationId: tokenPayload.installationId,
|
|
179
|
-
projectId: tokenPayload.projectId,
|
|
180
|
-
userId: tokenPayload.userId,
|
|
181
|
-
});
|
|
211
|
+
return authorizer;
|
|
182
212
|
}
|
|
183
213
|
isNonEmptyString(value) {
|
|
184
214
|
return typeof value === 'string' && value.trim().length > 0;
|
|
@@ -19,6 +19,7 @@ const internal_helpers_1 = require("@owox/internal-helpers");
|
|
|
19
19
|
const idp_protocol_1 = require("@owox/idp-protocol");
|
|
20
20
|
const idp_provider_service_1 = require("../../services/idp-provider.service");
|
|
21
21
|
const oauth_client_registry_1 = require("../oauth-client.registry");
|
|
22
|
+
const mcp_client_integration_1 = require("../mcp-client-integration");
|
|
22
23
|
const oauth_idp_port_1 = require("../oauth-idp.port");
|
|
23
24
|
const oauth_project_selection_service_1 = require("../oauth-project-selection.service");
|
|
24
25
|
const oauth_project_member_resolver_1 = require("../oauth-project-member.resolver");
|
|
@@ -66,7 +67,7 @@ let OAuthAuthorizationController = OAuthAuthorizationController_1 = class OAuthA
|
|
|
66
67
|
const authorizationRequest = validated.request;
|
|
67
68
|
const resourceContext = validated.resourceContext;
|
|
68
69
|
const provider = this.idpProviderService.getProvider(request);
|
|
69
|
-
const authorization = await this.resolveAuthorizationContext(provider, request, response);
|
|
70
|
+
const authorization = await this.resolveAuthorizationContext(provider, request, response, (0, mcp_client_integration_1.getMcpClientIntegration)(authorizationRequest.redirectUri));
|
|
70
71
|
if (!authorization) {
|
|
71
72
|
return;
|
|
72
73
|
}
|
|
@@ -160,7 +161,7 @@ let OAuthAuthorizationController = OAuthAuthorizationController_1 = class OAuthA
|
|
|
160
161
|
? this.projectSelectionService.resolveSelectedProjectMember(provider, context, projects, selectedProjectId)
|
|
161
162
|
: this.projectMemberResolver.resolve(context);
|
|
162
163
|
}
|
|
163
|
-
async resolveAuthorizationContext(provider, request, response) {
|
|
164
|
+
async resolveAuthorizationContext(provider, request, response, integration) {
|
|
164
165
|
const accessToken = this.getHeaderValue(request, 'x-owox-authorization');
|
|
165
166
|
if (accessToken) {
|
|
166
167
|
const payload = await provider.parseToken(accessToken);
|
|
@@ -170,7 +171,7 @@ let OAuthAuthorizationController = OAuthAuthorizationController_1 = class OAuthA
|
|
|
170
171
|
}
|
|
171
172
|
const refreshToken = this.getCookieValue(request, 'refreshToken');
|
|
172
173
|
if (!refreshToken) {
|
|
173
|
-
this.redirectToSignIn(request, response);
|
|
174
|
+
this.redirectToSignIn(request, response, integration);
|
|
174
175
|
return null;
|
|
175
176
|
}
|
|
176
177
|
try {
|
|
@@ -178,13 +179,13 @@ let OAuthAuthorizationController = OAuthAuthorizationController_1 = class OAuthA
|
|
|
178
179
|
this.persistRefreshTokenIfReturned(request, response, auth);
|
|
179
180
|
const payload = await provider.parseToken(auth.accessToken);
|
|
180
181
|
if (!payload) {
|
|
181
|
-
this.redirectToSignIn(request, response);
|
|
182
|
+
this.redirectToSignIn(request, response, integration);
|
|
182
183
|
return null;
|
|
183
184
|
}
|
|
184
185
|
return { context: this.toAuthorizationContext(payload), accessToken: auth.accessToken };
|
|
185
186
|
}
|
|
186
187
|
catch {
|
|
187
|
-
this.redirectToSignIn(request, response);
|
|
188
|
+
this.redirectToSignIn(request, response, integration);
|
|
188
189
|
return null;
|
|
189
190
|
}
|
|
190
191
|
}
|
|
@@ -221,13 +222,14 @@ let OAuthAuthorizationController = OAuthAuthorizationController_1 = class OAuthA
|
|
|
221
222
|
maxAge: auth.refreshTokenExpiresIn * 1000,
|
|
222
223
|
});
|
|
223
224
|
}
|
|
224
|
-
redirectToSignIn(request, response) {
|
|
225
|
+
redirectToSignIn(request, response, integration) {
|
|
225
226
|
const currentUrl = request.originalUrl || request.url;
|
|
226
227
|
const host = request.get('host') ?? 'localhost';
|
|
227
228
|
const signInUrl = new URL('/auth/sign-in', `${request.protocol}://${host}`);
|
|
228
229
|
signInUrl.searchParams.set('redirect', currentUrl);
|
|
229
230
|
signInUrl.searchParams.set('redirect-to', currentUrl);
|
|
230
231
|
signInUrl.searchParams.set('app-redirect-to', currentUrl);
|
|
232
|
+
signInUrl.searchParams.set('integration', integration);
|
|
231
233
|
this.logger.log('Redirecting OAuth authorize request to sign-in', {
|
|
232
234
|
clientId: this.extractClientId(currentUrl, request, host),
|
|
233
235
|
host,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getMcpClientIntegration(redirectUri: string): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMcpClientIntegration = getMcpClientIntegration;
|
|
4
|
+
function getMcpClientIntegration(redirectUri) {
|
|
5
|
+
const origin = new URL(redirectUri).origin;
|
|
6
|
+
switch (origin) {
|
|
7
|
+
case 'https://claude.ai':
|
|
8
|
+
return 'claude';
|
|
9
|
+
case 'https://chatgpt.com':
|
|
10
|
+
return 'chatgpt';
|
|
11
|
+
default:
|
|
12
|
+
return 'owox-data-marts';
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=mcp-client-integration.js.map
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
import type { Role } from '@owox/idp-protocol';
|
|
1
2
|
export interface PluginRuntimeIdentity {
|
|
2
3
|
readonly pluginId: string;
|
|
3
4
|
readonly installationId: string;
|
|
4
5
|
readonly projectId: string;
|
|
5
6
|
readonly userId: string;
|
|
6
7
|
}
|
|
8
|
+
export interface PluginExecutionIdentity extends PluginRuntimeIdentity {
|
|
9
|
+
readonly executionId: string;
|
|
10
|
+
readonly role: Role;
|
|
11
|
+
}
|
|
7
12
|
export declare const PLUGIN_RUNTIME_AUTHORIZER: unique symbol;
|
|
8
13
|
export interface PluginRuntimeAuthorizerPort {
|
|
9
14
|
assertActiveInstallation(identity: PluginRuntimeIdentity): Promise<void>;
|
|
15
|
+
resolveExecutionToken(token: string): Promise<PluginExecutionIdentity | null>;
|
|
10
16
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
2
|
+
export declare class AddPluginVersionBackend1790900000000 implements MigrationInterface {
|
|
3
|
+
readonly name = "AddPluginVersionBackend1790900000000";
|
|
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.AddPluginVersionBackend1790900000000 = void 0;
|
|
4
|
+
const typeorm_1 = require("typeorm");
|
|
5
|
+
const TABLE = 'plugin_version';
|
|
6
|
+
const COLUMN = 'backend';
|
|
7
|
+
class AddPluginVersionBackend1790900000000 {
|
|
8
|
+
name = 'AddPluginVersionBackend1790900000000';
|
|
9
|
+
async up(queryRunner) {
|
|
10
|
+
if (!(await queryRunner.hasColumn(TABLE, COLUMN))) {
|
|
11
|
+
await queryRunner.addColumn(TABLE, new typeorm_1.TableColumn({ name: COLUMN, type: 'json', isNullable: true }));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
async down(queryRunner) {
|
|
15
|
+
if (await queryRunner.hasColumn(TABLE, COLUMN)) {
|
|
16
|
+
await queryRunner.dropColumn(TABLE, COLUMN);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.AddPluginVersionBackend1790900000000 = AddPluginVersionBackend1790900000000;
|
|
21
|
+
//# sourceMappingURL=1790900000000-add-plugin-version-backend.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
2
|
+
export declare class CreatePluginActionExecution1790900000001 implements MigrationInterface {
|
|
3
|
+
readonly name = "CreatePluginActionExecution1790900000001";
|
|
4
|
+
up(queryRunner: QueryRunner): Promise<void>;
|
|
5
|
+
down(queryRunner: QueryRunner): Promise<void>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreatePluginActionExecution1790900000001 = void 0;
|
|
4
|
+
const typeorm_1 = require("typeorm");
|
|
5
|
+
const migration_utils_1 = require("./migration-utils");
|
|
6
|
+
const TABLE = 'plugin_action_execution';
|
|
7
|
+
class CreatePluginActionExecution1790900000001 {
|
|
8
|
+
name = 'CreatePluginActionExecution1790900000001';
|
|
9
|
+
async up(queryRunner) {
|
|
10
|
+
if (await queryRunner.hasTable(TABLE)) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const payloadType = queryRunner.connection.options.type === 'mysql' ? 'mediumtext' : 'text';
|
|
14
|
+
await queryRunner.createTable(new typeorm_1.Table({
|
|
15
|
+
name: TABLE,
|
|
16
|
+
columns: [
|
|
17
|
+
{ name: 'id', type: 'varchar', length: '36', isPrimary: true },
|
|
18
|
+
{ name: 'pluginId', type: 'varchar', length: '36', isNullable: false },
|
|
19
|
+
{ name: 'pluginVersionId', type: 'varchar', length: '36', isNullable: false },
|
|
20
|
+
{ name: 'installationId', type: 'varchar', length: '36', isNullable: false },
|
|
21
|
+
{ name: 'projectId', type: 'varchar', length: '255', isNullable: false },
|
|
22
|
+
{ name: 'userId', type: 'varchar', length: '255', isNullable: false },
|
|
23
|
+
{ name: 'action', type: 'varchar', length: '64', isNullable: false },
|
|
24
|
+
{ name: 'input', type: payloadType, isNullable: true },
|
|
25
|
+
{ name: 'trigger', type: 'varchar', length: '16', isNullable: false },
|
|
26
|
+
{ name: 'status', type: 'varchar', length: '16', isNullable: false },
|
|
27
|
+
{ name: 'role', type: 'varchar', length: '16', isNullable: false },
|
|
28
|
+
{ name: 'tokenHash', type: 'varchar', length: '64', isNullable: true },
|
|
29
|
+
{ name: 'deadlineAt', type: 'datetime', isNullable: true, default: null },
|
|
30
|
+
{ name: 'createdAt', type: 'datetime', default: 'CURRENT_TIMESTAMP' },
|
|
31
|
+
{ name: 'startedAt', type: 'datetime', isNullable: true, default: null },
|
|
32
|
+
{ name: 'finishedAt', type: 'datetime', isNullable: true, default: null },
|
|
33
|
+
{ name: 'errorCode', type: 'varchar', length: '64', isNullable: true },
|
|
34
|
+
{ name: 'errorMessage', type: 'varchar', length: '1000', isNullable: true },
|
|
35
|
+
{ name: 'result', type: payloadType, isNullable: true },
|
|
36
|
+
{ name: 'payloadsClearedAt', type: 'datetime', isNullable: true, default: null },
|
|
37
|
+
{ name: 'payloadBytes', type: 'int', isNullable: false, default: 0 },
|
|
38
|
+
],
|
|
39
|
+
}));
|
|
40
|
+
for (const index of [
|
|
41
|
+
new typeorm_1.TableIndex({
|
|
42
|
+
name: 'UQ_plugin_action_execution_token',
|
|
43
|
+
columnNames: ['tokenHash'],
|
|
44
|
+
isUnique: true,
|
|
45
|
+
}),
|
|
46
|
+
new typeorm_1.TableIndex({
|
|
47
|
+
name: 'idx_plugin_action_execution_running',
|
|
48
|
+
columnNames: ['installationId', 'status'],
|
|
49
|
+
}),
|
|
50
|
+
new typeorm_1.TableIndex({
|
|
51
|
+
name: 'idx_plugin_action_execution_deadline',
|
|
52
|
+
columnNames: ['status', 'deadlineAt'],
|
|
53
|
+
}),
|
|
54
|
+
new typeorm_1.TableIndex({
|
|
55
|
+
name: 'idx_plugin_action_execution_starts',
|
|
56
|
+
columnNames: ['installationId', 'startedAt', 'payloadBytes'],
|
|
57
|
+
}),
|
|
58
|
+
new typeorm_1.TableIndex({
|
|
59
|
+
name: 'idx_plugin_action_execution_finished',
|
|
60
|
+
columnNames: ['finishedAt'],
|
|
61
|
+
}),
|
|
62
|
+
new typeorm_1.TableIndex({
|
|
63
|
+
name: 'idx_plugin_action_execution_payloads',
|
|
64
|
+
columnNames: ['payloadsClearedAt', 'finishedAt'],
|
|
65
|
+
}),
|
|
66
|
+
]) {
|
|
67
|
+
await queryRunner.createIndex(TABLE, index);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async down(queryRunner) {
|
|
71
|
+
if (await queryRunner.hasTable(TABLE)) {
|
|
72
|
+
await (0, migration_utils_1.softDropTable)(queryRunner, TABLE);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.CreatePluginActionExecution1790900000001 = CreatePluginActionExecution1790900000001;
|
|
77
|
+
//# sourceMappingURL=1790900000001-create-plugin-action-execution.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
2
|
+
export declare class AddCredentialPublicMetadata1791000000000 implements MigrationInterface {
|
|
3
|
+
readonly name = "AddCredentialPublicMetadata1791000000000";
|
|
4
|
+
up(queryRunner: QueryRunner): Promise<void>;
|
|
5
|
+
down(queryRunner: QueryRunner): Promise<void>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddCredentialPublicMetadata1791000000000 = void 0;
|
|
4
|
+
const typeorm_1 = require("typeorm");
|
|
5
|
+
const CREDENTIAL = 'credential';
|
|
6
|
+
const COLUMN = 'publicMetadata';
|
|
7
|
+
class AddCredentialPublicMetadata1791000000000 {
|
|
8
|
+
name = 'AddCredentialPublicMetadata1791000000000';
|
|
9
|
+
async up(queryRunner) {
|
|
10
|
+
if ((await queryRunner.hasTable(CREDENTIAL)) &&
|
|
11
|
+
!(await queryRunner.hasColumn(CREDENTIAL, COLUMN))) {
|
|
12
|
+
await queryRunner.addColumn(CREDENTIAL, new typeorm_1.TableColumn({ name: COLUMN, type: 'json', isNullable: true }));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
async down(queryRunner) {
|
|
16
|
+
if ((await queryRunner.hasTable(CREDENTIAL)) &&
|
|
17
|
+
(await queryRunner.hasColumn(CREDENTIAL, COLUMN))) {
|
|
18
|
+
await queryRunner.dropColumn(CREDENTIAL, COLUMN);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.AddCredentialPublicMetadata1791000000000 = AddCredentialPublicMetadata1791000000000;
|
|
23
|
+
//# sourceMappingURL=1791000000000-add-credential-public-metadata.js.map
|
|
@@ -7,6 +7,12 @@ export declare class PluginCollectionAuthorizationDeniedError extends ForbiddenE
|
|
|
7
7
|
}
|
|
8
8
|
export declare class PluginCollectionValidationError extends BadRequestException {
|
|
9
9
|
}
|
|
10
|
+
export declare class PluginCollectionNotEntityBoundError extends PluginCollectionValidationError {
|
|
11
|
+
constructor(collectionName: string, semver: string);
|
|
12
|
+
}
|
|
13
|
+
export declare class PluginCollectionParentIdRequiredError extends PluginCollectionValidationError {
|
|
14
|
+
constructor(collectionName: string, entityType: string, semver: string);
|
|
15
|
+
}
|
|
10
16
|
export declare class PluginCollectionQuotaExceededError extends PayloadTooLargeException {
|
|
11
17
|
constructor(limit: string);
|
|
12
18
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PluginCollectionQuotaExceededError = exports.PluginCollectionValidationError = exports.PluginCollectionAuthorizationDeniedError = exports.PluginCollectionNotFoundError = void 0;
|
|
3
|
+
exports.PluginCollectionQuotaExceededError = exports.PluginCollectionParentIdRequiredError = exports.PluginCollectionNotEntityBoundError = exports.PluginCollectionValidationError = exports.PluginCollectionAuthorizationDeniedError = exports.PluginCollectionNotFoundError = void 0;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
5
|
class PluginCollectionNotFoundError extends common_1.NotFoundException {
|
|
6
6
|
constructor() {
|
|
@@ -17,6 +17,24 @@ exports.PluginCollectionAuthorizationDeniedError = PluginCollectionAuthorization
|
|
|
17
17
|
class PluginCollectionValidationError extends common_1.BadRequestException {
|
|
18
18
|
}
|
|
19
19
|
exports.PluginCollectionValidationError = PluginCollectionValidationError;
|
|
20
|
+
class PluginCollectionNotEntityBoundError extends PluginCollectionValidationError {
|
|
21
|
+
constructor(collectionName, semver) {
|
|
22
|
+
super({
|
|
23
|
+
code: 'PLUGIN_COLLECTION_NOT_ENTITY_BOUND',
|
|
24
|
+
message: `Collection "${collectionName}" has no entityBinding in plugin.json of the current version ${semver}, so put does not accept parentId`,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.PluginCollectionNotEntityBoundError = PluginCollectionNotEntityBoundError;
|
|
29
|
+
class PluginCollectionParentIdRequiredError extends PluginCollectionValidationError {
|
|
30
|
+
constructor(collectionName, entityType, semver) {
|
|
31
|
+
super({
|
|
32
|
+
code: 'PLUGIN_COLLECTION_PARENT_ID_REQUIRED',
|
|
33
|
+
message: `Collection "${collectionName}" has an entityBinding to ${entityType} in plugin.json of the current version ${semver}, so put requires parentId`,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.PluginCollectionParentIdRequiredError = PluginCollectionParentIdRequiredError;
|
|
20
38
|
class PluginCollectionQuotaExceededError extends common_1.PayloadTooLargeException {
|
|
21
39
|
constructor(limit) {
|
|
22
40
|
super(`Plugin collection limit exceeded: ${limit}`);
|
|
@@ -27,8 +27,8 @@ let PluginCollectionDeclarationService = class PluginCollectionDeclarationServic
|
|
|
27
27
|
if (!plugin?.currentVersionId)
|
|
28
28
|
throw new plugin_collection_errors_1.PluginCollectionNotFoundError();
|
|
29
29
|
const version = await this.versions.findById(plugin.currentVersionId);
|
|
30
|
-
const declaration =
|
|
31
|
-
if (!declaration)
|
|
30
|
+
const declaration = version?.collections?.find(item => item.name === collectionName);
|
|
31
|
+
if (!version || !declaration)
|
|
32
32
|
throw new plugin_collection_errors_1.PluginCollectionNotFoundError();
|
|
33
33
|
const memberId = declaration.scope === 'member' ? context.userId : null;
|
|
34
34
|
const namespaceKey = (0, node_crypto_1.createHash)('sha256')
|
|
@@ -40,7 +40,7 @@ let PluginCollectionDeclarationService = class PluginCollectionDeclarationServic
|
|
|
40
40
|
collectionName,
|
|
41
41
|
]))
|
|
42
42
|
.digest('hex');
|
|
43
|
-
return { declaration, namespaceKey, memberId };
|
|
43
|
+
return { declaration, semver: version.semver, namespaceKey, memberId };
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
46
|
exports.PluginCollectionDeclarationService = PluginCollectionDeclarationService;
|
package/dist/src/plugin-host/collections/use-cases/put-plugin-collection-document.service.js
CHANGED
|
@@ -27,6 +27,13 @@ let PutPluginCollectionDocumentService = class PutPluginCollectionDocumentServic
|
|
|
27
27
|
async run(command) {
|
|
28
28
|
const resolved = await this.declarations.resolve(command.collectionName, command.context);
|
|
29
29
|
try {
|
|
30
|
+
const { entityBinding } = resolved.declaration;
|
|
31
|
+
if (command.parentId !== null && !entityBinding) {
|
|
32
|
+
throw new plugin_collection_errors_1.PluginCollectionNotEntityBoundError(command.collectionName, resolved.semver);
|
|
33
|
+
}
|
|
34
|
+
if (command.parentId === null && entityBinding) {
|
|
35
|
+
throw new plugin_collection_errors_1.PluginCollectionParentIdRequiredError(command.collectionName, entityBinding.type, resolved.semver);
|
|
36
|
+
}
|
|
30
37
|
return await this.persistence.put(resolved, command);
|
|
31
38
|
}
|
|
32
39
|
catch (error) {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const PLUGIN_ACTION_LIMITS: {
|
|
2
|
+
readonly maxActions: 50;
|
|
3
|
+
readonly maxInputSchemaBytes: number;
|
|
4
|
+
readonly maxInputSchemaNodes: 2000;
|
|
5
|
+
readonly maxInputBytes: number;
|
|
6
|
+
readonly maxJsonDepth: 100;
|
|
7
|
+
readonly routeBodyLimit: "512kb";
|
|
8
|
+
readonly maxResultBytes: number;
|
|
9
|
+
readonly maxErrorMessageChars: 1000;
|
|
10
|
+
readonly maxReportedInputErrors: 20;
|
|
11
|
+
readonly maxRunningPerInstallation: 5;
|
|
12
|
+
readonly maxStartsPerInstallationPerMinute: 60;
|
|
13
|
+
readonly maxStartsPerInstallationPerDay: 5000;
|
|
14
|
+
readonly maxPayloadBytesPerInstallation: number;
|
|
15
|
+
readonly maxWaitSeconds: 20;
|
|
16
|
+
readonly waitPollMs: 1000;
|
|
17
|
+
readonly cancelPollMs: 5000;
|
|
18
|
+
readonly orphanGraceMs: 60000;
|
|
19
|
+
readonly payloadRetentionHours: 24;
|
|
20
|
+
readonly rowRetentionDays: 90;
|
|
21
|
+
readonly sweepBatchSize: 500;
|
|
22
|
+
readonly validationWorkers: 2;
|
|
23
|
+
readonly validationBudgetMs: 500;
|
|
24
|
+
readonly inputSchemaCompileBudgetMs: 2000;
|
|
25
|
+
readonly validationBootMs: 5000;
|
|
26
|
+
readonly validationWorkerHeapMb: 64;
|
|
27
|
+
readonly validationWorkerCacheSize: 50;
|
|
28
|
+
readonly maxValidationsPerVersion: 4;
|
|
29
|
+
readonly maxQueuedValidations: 64;
|
|
30
|
+
};
|
|
31
|
+
export declare const PLUGIN_ACTION_ERROR_CODE_PATTERN: RegExp;
|
|
32
|
+
export declare const PLUGIN_ACTION_RESERVED_ERROR_CODES: ReadonlySet<string>;
|
|
33
|
+
export declare const PLUGIN_ACTION_RESERVED_ERROR_CODE_PREFIX = "BACKEND_";
|
|
34
|
+
export declare function isPluginOwnedErrorCode(code: unknown): code is string;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PLUGIN_ACTION_RESERVED_ERROR_CODE_PREFIX = exports.PLUGIN_ACTION_RESERVED_ERROR_CODES = exports.PLUGIN_ACTION_ERROR_CODE_PATTERN = exports.PLUGIN_ACTION_LIMITS = void 0;
|
|
4
|
+
exports.isPluginOwnedErrorCode = isPluginOwnedErrorCode;
|
|
5
|
+
exports.PLUGIN_ACTION_LIMITS = {
|
|
6
|
+
maxActions: 50,
|
|
7
|
+
maxInputSchemaBytes: 32 * 1024,
|
|
8
|
+
maxInputSchemaNodes: 2000,
|
|
9
|
+
maxInputBytes: 256 * 1024,
|
|
10
|
+
maxJsonDepth: 100,
|
|
11
|
+
routeBodyLimit: '512kb',
|
|
12
|
+
maxResultBytes: 1024 * 1024,
|
|
13
|
+
maxErrorMessageChars: 1000,
|
|
14
|
+
maxReportedInputErrors: 20,
|
|
15
|
+
maxRunningPerInstallation: 5,
|
|
16
|
+
maxStartsPerInstallationPerMinute: 60,
|
|
17
|
+
maxStartsPerInstallationPerDay: 5000,
|
|
18
|
+
maxPayloadBytesPerInstallation: 100 * 1024 * 1024,
|
|
19
|
+
maxWaitSeconds: 20,
|
|
20
|
+
waitPollMs: 1000,
|
|
21
|
+
cancelPollMs: 5000,
|
|
22
|
+
orphanGraceMs: 60_000,
|
|
23
|
+
payloadRetentionHours: 24,
|
|
24
|
+
rowRetentionDays: 90,
|
|
25
|
+
sweepBatchSize: 500,
|
|
26
|
+
validationWorkers: 2,
|
|
27
|
+
validationBudgetMs: 500,
|
|
28
|
+
inputSchemaCompileBudgetMs: 2000,
|
|
29
|
+
validationBootMs: 5000,
|
|
30
|
+
validationWorkerHeapMb: 64,
|
|
31
|
+
validationWorkerCacheSize: 50,
|
|
32
|
+
maxValidationsPerVersion: 4,
|
|
33
|
+
maxQueuedValidations: 64,
|
|
34
|
+
};
|
|
35
|
+
exports.PLUGIN_ACTION_ERROR_CODE_PATTERN = /^[A-Z][A-Z0-9_]{0,63}$/;
|
|
36
|
+
exports.PLUGIN_ACTION_RESERVED_ERROR_CODES = new Set([
|
|
37
|
+
'TIMED_OUT',
|
|
38
|
+
'CANCELLED',
|
|
39
|
+
'ACTION_NOT_DECLARED',
|
|
40
|
+
'INVALID_INPUT',
|
|
41
|
+
'INSTALLATION_INACTIVE',
|
|
42
|
+
'PLUGIN_SUSPENDED',
|
|
43
|
+
]);
|
|
44
|
+
exports.PLUGIN_ACTION_RESERVED_ERROR_CODE_PREFIX = 'BACKEND_';
|
|
45
|
+
function isPluginOwnedErrorCode(code) {
|
|
46
|
+
return (typeof code === 'string' &&
|
|
47
|
+
exports.PLUGIN_ACTION_ERROR_CODE_PATTERN.test(code) &&
|
|
48
|
+
!code.startsWith(exports.PLUGIN_ACTION_RESERVED_ERROR_CODE_PREFIX) &&
|
|
49
|
+
!exports.PLUGIN_ACTION_RESERVED_ERROR_CODES.has(code));
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=plugin-action-limits.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Request } from 'express';
|
|
2
|
+
import { type AuthorizationContext } from '../../idp';
|
|
3
|
+
import { PluginActionExecutionApiDto, PluginActionExecutionQueryApiDto, PluginActionWorkerContextApiDto, StartedPluginActionExecutionApiDto } from '../dto/presentation/plugin-action-api.dto';
|
|
4
|
+
import { PluginPresentationMapper } from '../mappers/plugin-presentation.mapper';
|
|
5
|
+
import { CancelPluginActionExecutionService } from '../use-cases/cancel-plugin-action-execution.service';
|
|
6
|
+
import { GetCurrentPluginActionExecutionService } from '../use-cases/get-current-plugin-action-execution.service';
|
|
7
|
+
import { GetPluginActionExecutionService } from '../use-cases/get-plugin-action-execution.service';
|
|
8
|
+
import { StartPluginActionExecutionService } from '../use-cases/start-plugin-action-execution.service';
|
|
9
|
+
export declare class PluginActionRuntimeController {
|
|
10
|
+
private readonly startExecution;
|
|
11
|
+
private readonly getExecution;
|
|
12
|
+
private readonly cancelExecution;
|
|
13
|
+
private readonly getCurrentExecution;
|
|
14
|
+
private readonly mapper;
|
|
15
|
+
constructor(startExecution: StartPluginActionExecutionService, getExecution: GetPluginActionExecutionService, cancelExecution: CancelPluginActionExecutionService, getCurrentExecution: GetCurrentPluginActionExecutionService, mapper: PluginPresentationMapper);
|
|
16
|
+
start(action: string, body: Record<string, unknown> | undefined, context: AuthorizationContext): Promise<StartedPluginActionExecutionApiDto>;
|
|
17
|
+
current(context: AuthorizationContext): Promise<PluginActionWorkerContextApiDto>;
|
|
18
|
+
get(id: string, query: PluginActionExecutionQueryApiDto, context: AuthorizationContext, request: Request): Promise<PluginActionExecutionApiDto>;
|
|
19
|
+
cancel(id: string, context: AuthorizationContext): Promise<PluginActionExecutionApiDto>;
|
|
20
|
+
}
|