@adminide-stack/marketplace-module-server 12.0.4-alpha.41 → 12.0.4-alpha.412
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/Readme.md +321 -0
- package/lib/containers/module.d.ts +8 -0
- package/lib/containers/module.d.ts.map +1 -1
- package/lib/containers/module.js +15 -5
- package/lib/containers/module.js.map +1 -1
- package/lib/dataloaders/index.d.ts +1 -0
- package/lib/dataloaders/index.d.ts.map +1 -0
- package/lib/demo/test-graphql-examples.d.ts +73 -0
- package/lib/demo/test-graphql-examples.d.ts.map +1 -0
- package/lib/graphql/resolvers/form-templates-resolver.d.ts +220 -0
- package/lib/graphql/resolvers/form-templates-resolver.d.ts.map +1 -0
- package/lib/graphql/resolvers/form-templates-resolver.js +170 -0
- package/lib/graphql/resolvers/form-templates-resolver.js.map +1 -0
- package/lib/graphql/resolvers/gallery-resolver.d.ts +15 -0
- package/lib/graphql/resolvers/gallery-resolver.d.ts.map +1 -0
- package/lib/graphql/resolvers/gallery-resolver.js +35 -0
- package/lib/graphql/resolvers/gallery-resolver.js.map +1 -0
- package/lib/graphql/resolvers/index.d.ts +247 -1
- package/lib/graphql/resolvers/index.d.ts.map +1 -1
- package/lib/graphql/resolvers/index.js +1 -0
- package/lib/graphql/resolvers/index.js.map +1 -0
- package/lib/graphql/resolvers/installed-extension-resolver.d.ts +5 -0
- package/lib/graphql/resolvers/installed-extension-resolver.d.ts.map +1 -0
- package/lib/graphql/resolvers/installed-extension-resolver.js +289 -0
- package/lib/graphql/resolvers/installed-extension-resolver.js.map +1 -0
- package/lib/graphql/resolvers/marketplace-form-resolver.d.ts +13 -0
- package/lib/graphql/resolvers/marketplace-form-resolver.d.ts.map +1 -0
- package/lib/graphql/resolvers/marketplace-form-resolver.js +90 -0
- package/lib/graphql/resolvers/marketplace-form-resolver.js.map +1 -0
- package/lib/graphql/resolvers/publisher-analytics-resolver.d.ts +14 -0
- package/lib/graphql/resolvers/publisher-analytics-resolver.d.ts.map +1 -0
- package/lib/graphql/resolvers/publisher-analytics-resolver.js +221 -0
- package/lib/graphql/resolvers/publisher-analytics-resolver.js.map +1 -0
- package/lib/graphql/resolvers/publisher-resolver.d.ts +5 -0
- package/lib/graphql/resolvers/publisher-resolver.d.ts.map +1 -0
- package/lib/graphql/resolvers/publisher-resolver.js +176 -0
- package/lib/graphql/resolvers/publisher-resolver.js.map +1 -0
- package/lib/graphql/resolvers/registry-extension-resolver.d.ts +5 -0
- package/lib/graphql/resolvers/registry-extension-resolver.d.ts.map +1 -0
- package/lib/graphql/resolvers/registry-extension-resolver.js +46 -0
- package/lib/graphql/resolvers/registry-extension-resolver.js.map +1 -0
- package/lib/graphql/schemas/extension-pricing.graphql +546 -0
- package/lib/graphql/schemas/extension-pricing.graphql.js +1 -0
- package/lib/graphql/schemas/extension-pricing.graphql.js.map +1 -0
- package/lib/graphql/schemas/extension-registry.graphql +107 -0
- package/lib/graphql/schemas/extension-registry.graphql.js +1 -0
- package/lib/graphql/schemas/extension-registry.graphql.js.map +1 -0
- package/lib/graphql/schemas/form-templates.graphql +269 -0
- package/lib/graphql/schemas/form-templates.graphql.js +1 -0
- package/lib/graphql/schemas/form-templates.graphql.js.map +1 -0
- package/lib/graphql/schemas/gallery-schema.graphql +247 -0
- package/lib/graphql/schemas/gallery-schema.graphql.js +1 -0
- package/lib/graphql/schemas/gallery-schema.graphql.js.map +1 -0
- package/lib/graphql/schemas/index.d.ts.map +1 -1
- package/lib/graphql/schemas/index.js +3 -4
- package/lib/graphql/schemas/index.js.map +1 -1
- package/lib/graphql/schemas/installed-extension.graphql +309 -0
- package/lib/graphql/schemas/installed-extension.graphql.js +1 -0
- package/lib/graphql/schemas/installed-extension.graphql.js.map +1 -0
- package/lib/graphql/schemas/publisher-analytics.graphql +305 -0
- package/lib/graphql/schemas/publisher-analytics.graphql.js +1 -0
- package/lib/graphql/schemas/publisher-analytics.graphql.js.map +1 -0
- package/lib/graphql/schemas/publisher.graphql +376 -0
- package/lib/graphql/schemas/publisher.graphql.js +1 -0
- package/lib/graphql/schemas/publisher.graphql.js.map +1 -0
- package/lib/graphql/schemas/service.graphql +196 -0
- package/lib/index.d.ts +3 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/module.d.ts +1 -1
- package/lib/module.d.ts.map +1 -1
- package/lib/module.js +10 -23
- package/lib/module.js.map +1 -1
- package/lib/plugins/extension-moleculer-service.d.ts +86 -0
- package/lib/plugins/extension-moleculer-service.d.ts.map +1 -0
- package/lib/plugins/index.d.ts +2 -0
- package/lib/plugins/index.d.ts.map +1 -0
- package/lib/services/extension-gallery-repository.d.ts +17 -0
- package/lib/services/extension-gallery-repository.d.ts.map +1 -0
- package/lib/services/extension-gallery-repository.js +192 -0
- package/lib/services/extension-gallery-repository.js.map +1 -0
- package/lib/services/extension-gallery-service-new.d.ts +39 -0
- package/lib/services/extension-gallery-service-new.d.ts.map +1 -0
- package/lib/services/extension-gallery-service.d.ts +30 -0
- package/lib/services/extension-gallery-service.d.ts.map +1 -0
- package/lib/services/extension-gallery-service.js +311 -0
- package/lib/services/extension-gallery-service.js.map +1 -0
- package/lib/services/index.d.ts +6 -1
- package/lib/services/index.d.ts.map +1 -1
- package/lib/services/installed-extension-service-ext.d.ts +16 -0
- package/lib/services/installed-extension-service-ext.d.ts.map +1 -0
- package/lib/services/installed-extension-service-ext.js +485 -0
- package/lib/services/installed-extension-service-ext.js.map +1 -0
- package/lib/services/installed-extension-service.d.ts +96 -0
- package/lib/services/installed-extension-service.d.ts.map +1 -0
- package/lib/services/installed-extension-service.js +521 -0
- package/lib/services/installed-extension-service.js.map +1 -0
- package/lib/services/installed-extension-service.test.d.ts +1 -0
- package/lib/services/installed-extension-service.test.d.ts.map +1 -0
- package/lib/services/publisher-analytics-service.d.ts +128 -0
- package/lib/services/publisher-analytics-service.d.ts.map +1 -0
- package/lib/services/publisher-event-service.d.ts +48 -0
- package/lib/services/publisher-event-service.d.ts.map +1 -0
- package/lib/services/publisher-event-service.js +296 -0
- package/lib/services/publisher-event-service.js.map +1 -0
- package/lib/services/publisher-service-context.d.ts +1 -0
- package/lib/services/publisher-service-context.d.ts.map +1 -0
- package/lib/services/publisher-service.d.ts +60 -0
- package/lib/services/publisher-service.d.ts.map +1 -0
- package/lib/services/publisher-service.js +134 -0
- package/lib/services/publisher-service.js.map +1 -0
- package/lib/store/index.d.ts +1 -1
- package/lib/store/index.d.ts.map +1 -1
- package/lib/store/models/index.d.ts +2 -1
- package/lib/store/models/index.d.ts.map +1 -1
- package/lib/store/models/installed-extension-model.d.ts +4 -0
- package/lib/store/models/installed-extension-model.d.ts.map +1 -0
- package/lib/store/models/installed-extension-model.js +269 -0
- package/lib/store/models/installed-extension-model.js.map +1 -0
- package/lib/store/models/publisher-event-model.d.ts +11 -0
- package/lib/store/models/publisher-event-model.d.ts.map +1 -0
- package/lib/store/models/publisher-model.d.ts +5 -0
- package/lib/store/models/publisher-model.d.ts.map +1 -0
- package/lib/store/models/publisher-model.js +103 -0
- package/lib/store/models/publisher-model.js.map +1 -0
- package/lib/store/models/publisher-stats-model.d.ts +1 -0
- package/lib/store/models/publisher-stats-model.d.ts.map +1 -0
- package/lib/store/repositories/index.d.ts +3 -0
- package/lib/store/repositories/index.d.ts.map +1 -0
- package/lib/store/repositories/installed-extension-repository.d.ts +73 -0
- package/lib/store/repositories/installed-extension-repository.d.ts.map +1 -0
- package/lib/store/repositories/installed-extension-repository.js +442 -0
- package/lib/store/repositories/installed-extension-repository.js.map +1 -0
- package/lib/store/repositories/publisher-analytics-repository.d.ts +1 -0
- package/lib/store/repositories/publisher-analytics-repository.d.ts.map +1 -0
- package/lib/store/repositories/publisher-repository.d.ts +19 -0
- package/lib/store/repositories/publisher-repository.d.ts.map +1 -0
- package/lib/store/repositories/publisher-repository.js +87 -0
- package/lib/store/repositories/publisher-repository.js.map +1 -0
- package/lib/templates/constants/DB_COLL_NAMES.ts.template +5 -0
- package/lib/templates/constants/SERVER_TYPES.ts.template +10 -4
- package/lib/templates/repositories/ExtensionGalleryRepository.ts.template +44 -0
- package/lib/templates/repositories/InstalledExtensionRepository.ts.template +94 -0
- package/lib/templates/repositories/MarketplacePublisherRepository.ts.template +24 -0
- package/lib/templates/repositories/RegistryExtensionRepository.ts.template +10 -15
- package/lib/templates/services/ExtensionGalleryDataLoader.ts.template +2 -0
- package/lib/templates/services/ExtensionGalleryService.ts.template +79 -0
- package/lib/templates/services/InstalledExtensionDataLoader.ts.template +2 -0
- package/lib/templates/services/InstalledExtensionService.ts.template +181 -0
- package/lib/templates/services/MarketplacePublisherService.ts.template +49 -0
- package/lib/templates/services/PublisherEventService.ts.template +56 -0
- package/lib/templates/services/RegistryExtensionService.ts.template +62 -18
- package/lib/tests/extension-integration.test.d.ts +1 -0
- package/lib/tests/extension-integration.test.d.ts.map +1 -0
- package/lib/tests/install-extension-graphql.test.d.ts +2 -0
- package/lib/tests/install-extension-graphql.test.d.ts.map +1 -0
- package/lib/tests/test-extension-services.d.ts +1 -0
- package/lib/tests/test-extension-services.d.ts.map +1 -0
- package/lib/utils/publisherValidation.d.ts +23 -0
- package/lib/utils/publisherValidation.d.ts.map +1 -0
- package/lib/utils/publisherValidation.js +144 -0
- package/lib/utils/publisherValidation.js.map +1 -0
- package/package.json +15 -7
- package/lib/graphql/resolvers/resolvers.d.ts +0 -2
- package/lib/graphql/resolvers/resolvers.d.ts.map +0 -1
- package/lib/graphql/resolvers/resolvers.js +0 -167
- package/lib/graphql/resolvers/resolvers.js.map +0 -1
- package/lib/graphql/schemas/extension.graphql +0 -57
- package/lib/graphql/schemas/extension.graphql.js +0 -1
- package/lib/graphql/schemas/extension.graphql.js.map +0 -1
- package/lib/services/extension-service.d.ts +0 -54
- package/lib/services/extension-service.d.ts.map +0 -1
- package/lib/services/extension-service.js +0 -42
- package/lib/services/extension-service.js.map +0 -1
- package/lib/store/models/registry-extension-model.d.ts +0 -10
- package/lib/store/models/registry-extension-model.d.ts.map +0 -1
- package/lib/store/models/registry-extension-model.js +0 -62
- package/lib/store/models/registry-extension-model.js.map +0 -1
- package/lib/store/repository/index.d.ts +0 -2
- package/lib/store/repository/index.d.ts.map +0 -1
- package/lib/store/repository/registry-extension-repository.d.ts +0 -31
- package/lib/store/repository/registry-extension-repository.d.ts.map +0 -1
- package/lib/store/repository/registry-extension-repository.js +0 -135
- package/lib/store/repository/registry-extension-repository.js.map +0 -1
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
import {__decorate,__param,__metadata}from'tslib';import {injectable,inject}from'inversify';import {ServiceBroker}from'moleculer';import {CommonType}from'@common-stack/core';import'@cdm-logger/core';import {SERVER_TYPES,ContributionFragmentName,ConfigurationSchemaId,SystemContributionExtensionNames,ExtensionServiceAction,MoleculerServiceName}from'common/server';import {InstalledExtensionService}from'./installed-extension-service.js';/**
|
|
2
|
+
* Convert scope string values from package.json to ConfigurationScope enum numbers
|
|
3
|
+
* Maps: "application" -> 1, "machine" -> 2, "window" -> 3, "resource" -> 4
|
|
4
|
+
*/
|
|
5
|
+
function convertScopeStringToNumber(scope) {
|
|
6
|
+
if (typeof scope === 'number') {
|
|
7
|
+
return scope; // Already a number
|
|
8
|
+
}
|
|
9
|
+
if (typeof scope === 'string') {
|
|
10
|
+
const scopeMap = {
|
|
11
|
+
application: 1 /* ConfigurationScope.APPLICATION */,
|
|
12
|
+
machine: 2 /* ConfigurationScope.MACHINE */,
|
|
13
|
+
window: 3 /* ConfigurationScope.WINDOW */,
|
|
14
|
+
resource: 4 /* ConfigurationScope.RESOURCE */
|
|
15
|
+
};
|
|
16
|
+
const normalizedScope = scope.toLowerCase();
|
|
17
|
+
if (normalizedScope in scopeMap) {
|
|
18
|
+
return scopeMap[normalizedScope];
|
|
19
|
+
}
|
|
20
|
+
console.warn(`Unknown scope string: "${scope}", defaulting to WINDOW`);
|
|
21
|
+
}
|
|
22
|
+
// Default to WINDOW scope if undefined or unknown
|
|
23
|
+
return 3 /* ConfigurationScope.WINDOW */;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Recursively process configuration properties to convert scope strings to numbers
|
|
27
|
+
*/
|
|
28
|
+
function processConfigurationProperties(properties) {
|
|
29
|
+
if (!properties || typeof properties !== 'object') {
|
|
30
|
+
return properties;
|
|
31
|
+
}
|
|
32
|
+
const processedProperties = {
|
|
33
|
+
...properties
|
|
34
|
+
};
|
|
35
|
+
for (const [key, value] of Object.entries(processedProperties)) {
|
|
36
|
+
if (value && typeof value === 'object') {
|
|
37
|
+
const objectValue = value;
|
|
38
|
+
// If this property has a scope, convert it
|
|
39
|
+
if ('scope' in objectValue) {
|
|
40
|
+
objectValue.scope = convertScopeStringToNumber(objectValue.scope);
|
|
41
|
+
}
|
|
42
|
+
// Recursively process nested properties
|
|
43
|
+
processedProperties[key] = processConfigurationProperties(objectValue);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return processedProperties;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Extended InstalledExtensionService that handles Moleculer event broadcasting
|
|
50
|
+
* Follows the pattern of AccountService/AccountServiceExt
|
|
51
|
+
*/
|
|
52
|
+
let InstalledExtensionServiceExt = class InstalledExtensionServiceExt extends InstalledExtensionService {
|
|
53
|
+
slugService;
|
|
54
|
+
redisCacheManager;
|
|
55
|
+
constructor(repository, registryService, slugService, redisCacheManager, broker, logger) {
|
|
56
|
+
super(repository, registryService, slugService, broker, logger);
|
|
57
|
+
this.slugService = slugService;
|
|
58
|
+
this.redisCacheManager = redisCacheManager;
|
|
59
|
+
this.setupEventListeners();
|
|
60
|
+
}
|
|
61
|
+
setupEventListeners() {
|
|
62
|
+
// Listen to extension installed events
|
|
63
|
+
this.onExtensionInstalled.event(async event => {
|
|
64
|
+
console.log('_____>>>>>>> EXTENSION INSTALLLED EVENT IS GETTIN CALLED');
|
|
65
|
+
try {
|
|
66
|
+
// Get full extension data with metadata to extract contributions
|
|
67
|
+
const registryExtension = await this.registryExtensionService.findExtension(event.extensionSlug);
|
|
68
|
+
let configurationNodes = [];
|
|
69
|
+
let configurationDefaults = [];
|
|
70
|
+
if (registryExtension) {
|
|
71
|
+
console.log('Extension found:', event.extensionSlug);
|
|
72
|
+
// Get the current release to access the manifest
|
|
73
|
+
// The manifest is stored in the release, not directly in the registry extension
|
|
74
|
+
const currentRelease = registryExtension.releases?.find(release => release.version === registryExtension.version);
|
|
75
|
+
if (currentRelease && currentRelease.manifest) {
|
|
76
|
+
console.log('Found current release with manifest:', registryExtension.version);
|
|
77
|
+
let contributes = null;
|
|
78
|
+
let parsedManifest = null;
|
|
79
|
+
try {
|
|
80
|
+
// Parse the manifest from the release (stored as JSON string)
|
|
81
|
+
parsedManifest = typeof currentRelease.manifest === 'string' ? JSON.parse(currentRelease.manifest) : currentRelease.manifest;
|
|
82
|
+
console.log('Parsed manifest keys:', Object.keys(parsedManifest));
|
|
83
|
+
contributes = parsedManifest.contributes;
|
|
84
|
+
if (contributes) {
|
|
85
|
+
console.log('Contributes keys:', Object.keys(contributes));
|
|
86
|
+
console.log('Configuration exists:', !!contributes.configuration);
|
|
87
|
+
if (contributes.configuration) {
|
|
88
|
+
console.log('Configuration data:', JSON.stringify(contributes.configuration, null, 2));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
} catch (error) {
|
|
92
|
+
console.warn('Failed to parse release manifest:', error);
|
|
93
|
+
}
|
|
94
|
+
// Extract configuration contributions if they exist
|
|
95
|
+
if (contributes && contributes.configuration) {
|
|
96
|
+
console.log('Configuration contributions found, processing...');
|
|
97
|
+
const configurations = Array.isArray(contributes.configuration) ? contributes.configuration : [contributes.configuration];
|
|
98
|
+
// Format contributions for configuration registry
|
|
99
|
+
configurationNodes = configurations.map(config => {
|
|
100
|
+
// Process properties to convert scope strings to numbers
|
|
101
|
+
const processedProperties = processConfigurationProperties(config.properties || {});
|
|
102
|
+
return {
|
|
103
|
+
id: ContributionFragmentName.Settings,
|
|
104
|
+
title: config.title || registryExtension.name,
|
|
105
|
+
description: config.description,
|
|
106
|
+
properties: processedProperties,
|
|
107
|
+
type: config.type || ['object']
|
|
108
|
+
};
|
|
109
|
+
});
|
|
110
|
+
// Create configuration defaults
|
|
111
|
+
configurationDefaults = [{
|
|
112
|
+
source: {
|
|
113
|
+
id: event.extensionSlug,
|
|
114
|
+
displayName: registryExtension.name
|
|
115
|
+
},
|
|
116
|
+
overrides: {} // Default empty overrides
|
|
117
|
+
}];
|
|
118
|
+
console.log(`Processed ${configurationNodes.length} configuration nodes`);
|
|
119
|
+
} else {
|
|
120
|
+
console.log('No configuration contributions found in manifest');
|
|
121
|
+
}
|
|
122
|
+
// Extract UILayout contributions if they exist (same structure as configuration)
|
|
123
|
+
if (contributes && contributes.uiLayout) {
|
|
124
|
+
console.log('UILayout contributions found, processing...');
|
|
125
|
+
const uiLayoutContributions = Array.isArray(contributes.uiLayout) ? contributes.uiLayout : [contributes.uiLayout];
|
|
126
|
+
console.log(`Found ${uiLayoutContributions.length} UILayout contribution(s) in manifest`);
|
|
127
|
+
// Format UILayout contributions (same structure as configuration)
|
|
128
|
+
const uiLayoutNodes = uiLayoutContributions.map(uiLayout => {
|
|
129
|
+
// Process properties to convert scope strings to numbers (same as configuration)
|
|
130
|
+
const processedProperties = processConfigurationProperties(uiLayout.properties || {});
|
|
131
|
+
return {
|
|
132
|
+
id: ContributionFragmentName.Settings,
|
|
133
|
+
title: uiLayout.title || registryExtension.name,
|
|
134
|
+
description: uiLayout.description,
|
|
135
|
+
properties: processedProperties,
|
|
136
|
+
type: uiLayout.type || ['object']
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
if (uiLayoutNodes.length > 0) {
|
|
140
|
+
console.log(`Registering ${uiLayoutNodes.length} UILayout configuration nodes`);
|
|
141
|
+
try {
|
|
142
|
+
// Register UILayout contributions (exact same as configuration, just different schema)
|
|
143
|
+
await this.broker.call('ConfigurationRegistryService.registerUILayoutContributions', {
|
|
144
|
+
tenantId: event.tenantId,
|
|
145
|
+
extensionID: event.extensionSlug,
|
|
146
|
+
uiLayoutNodes
|
|
147
|
+
});
|
|
148
|
+
console.log(`✅ UILayout contributions registered successfully for ${event.extensionSlug}`);
|
|
149
|
+
} catch (uiLayoutError) {
|
|
150
|
+
console.error('❌ Failed to register UILayout contributions:', uiLayoutError);
|
|
151
|
+
// This is not fatal, log and continue
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
} else {
|
|
155
|
+
console.log('No UILayout contributions found in manifest');
|
|
156
|
+
}
|
|
157
|
+
} else {
|
|
158
|
+
console.log('No current release or manifest found for version:', registryExtension.version);
|
|
159
|
+
}
|
|
160
|
+
} else {
|
|
161
|
+
console.log('No extension found for:', event.extensionSlug);
|
|
162
|
+
}
|
|
163
|
+
// Add the extension's enabled/disabled state to configuration nodes
|
|
164
|
+
// This tracks the extension status regardless of whether it has configuration contributions
|
|
165
|
+
const extensionStatusNode = {
|
|
166
|
+
id: ContributionFragmentName.Settings,
|
|
167
|
+
title: `${registryExtension?.name || event.extensionSlug} Status`,
|
|
168
|
+
description: `Extension enabled/disabled status for ${event.extensionSlug}`,
|
|
169
|
+
properties: {
|
|
170
|
+
[`extensions.${event.extensionSlug}`]: {
|
|
171
|
+
type: 'boolean',
|
|
172
|
+
default: true,
|
|
173
|
+
// Default to enabled when installed
|
|
174
|
+
description: `Enable/disable ${event.extensionSlug} extension`,
|
|
175
|
+
scope: 3 /* ConfigurationScope.WINDOW */
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
type: ['object'],
|
|
179
|
+
extensionInfo: {
|
|
180
|
+
id: event.extensionSlug,
|
|
181
|
+
displayName: registryExtension?.name || event.extensionSlug
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
// Add the extension status node to configurationNodes
|
|
185
|
+
// configurationNodes.push(extensionStatusNode);
|
|
186
|
+
// Create the configuration node data that configuration registry expects
|
|
187
|
+
const configurationNode = {
|
|
188
|
+
schemaId: ConfigurationSchemaId.Configuration,
|
|
189
|
+
tenantId: event.tenantId,
|
|
190
|
+
extensionName: event.extensionSlug,
|
|
191
|
+
policyConfigs: event.policies || null,
|
|
192
|
+
configurationNodes,
|
|
193
|
+
configurationDefaults
|
|
194
|
+
};
|
|
195
|
+
const context = {
|
|
196
|
+
schemaId: ConfigurationSchemaId.Configuration,
|
|
197
|
+
tenantId: event.tenantId,
|
|
198
|
+
extensionName: event.extensionSlug,
|
|
199
|
+
accountId: event.installedBy
|
|
200
|
+
// Add other context fields as needed
|
|
201
|
+
};
|
|
202
|
+
console.log('Broadcasting configuration registry event with data:', {
|
|
203
|
+
configurationNode: {
|
|
204
|
+
...configurationNode,
|
|
205
|
+
configurationNodes: `${configurationNodes.length} nodes`
|
|
206
|
+
},
|
|
207
|
+
context
|
|
208
|
+
});
|
|
209
|
+
// STEP 1: MANDATORY - Register extension in system_extension FIRST (REQUIRED FOR ALL EXTENSIONS)
|
|
210
|
+
console.log('\n🔧 STEP 1: Registering extension in SYSTEM_EXTENSION (MANDATORY)');
|
|
211
|
+
// Create separate configuration node for system extension status
|
|
212
|
+
const systemExtensionNode = {
|
|
213
|
+
schemaId: ConfigurationSchemaId.Configuration,
|
|
214
|
+
tenantId: event.tenantId,
|
|
215
|
+
extensionName: SystemContributionExtensionNames.SystemExtension,
|
|
216
|
+
policyConfigs: null,
|
|
217
|
+
configurationNodes: [extensionStatusNode]
|
|
218
|
+
};
|
|
219
|
+
const systemContext = {
|
|
220
|
+
schemaId: ConfigurationSchemaId.Configuration,
|
|
221
|
+
tenantId: event.tenantId,
|
|
222
|
+
extensionName: SystemContributionExtensionNames.SystemExtension,
|
|
223
|
+
accountId: event.installedBy
|
|
224
|
+
};
|
|
225
|
+
let systemExtensionRegistered = false;
|
|
226
|
+
try {
|
|
227
|
+
console.log('Broadcasting SYSTEM extension registry (MANDATORY)...');
|
|
228
|
+
await this.broker.call('ConfigurationRegistryService.createConfigurationNodeRegistry', {
|
|
229
|
+
data: systemExtensionNode,
|
|
230
|
+
context: systemContext
|
|
231
|
+
});
|
|
232
|
+
systemExtensionRegistered = true;
|
|
233
|
+
console.log('✅ STEP 1 SUCCESS: Extension registered in system_extension');
|
|
234
|
+
} catch (systemError) {
|
|
235
|
+
console.error('❌ STEP 1 FAILED: System extension registration failed:', systemError);
|
|
236
|
+
throw new Error(`Extension installation failed: Could not register in system (${systemError.message})`);
|
|
237
|
+
}
|
|
238
|
+
// STEP 2: CONDITIONAL - Create extension configuration ONLY IF CONTRIBUTIONS EXIST
|
|
239
|
+
let extensionConfigCreated = false;
|
|
240
|
+
if (configurationNodes.length > 0) {
|
|
241
|
+
console.log('\n📝 STEP 2: Creating extension configuration (contributions exist)');
|
|
242
|
+
try {
|
|
243
|
+
console.log('Broadcasting extension configuration registry...');
|
|
244
|
+
await this.broker.call('ConfigurationRegistryService.createConfigurationNodeRegistry', {
|
|
245
|
+
data: configurationNode,
|
|
246
|
+
context
|
|
247
|
+
});
|
|
248
|
+
extensionConfigCreated = true;
|
|
249
|
+
console.log('✅ STEP 2 SUCCESS: Extension configuration created');
|
|
250
|
+
} catch (configError) {
|
|
251
|
+
console.error('❌ STEP 2 FAILED: Extension configuration creation failed:', configError);
|
|
252
|
+
// This is not fatal since system extension is already registered
|
|
253
|
+
console.warn('⚠️ Extension is registered in system but configuration creation failed');
|
|
254
|
+
}
|
|
255
|
+
} else {
|
|
256
|
+
console.log('\nℹ️ STEP 2: Skipping extension configuration (no contributions found)');
|
|
257
|
+
}
|
|
258
|
+
await this.dropCache();
|
|
259
|
+
console.log('\n=== EXTENSION INSTALLATION COMPLETED ===');
|
|
260
|
+
console.log('System Extension Registered:', systemExtensionRegistered ? '✅' : '❌');
|
|
261
|
+
console.log('Extension Config Created:', extensionConfigCreated ? '✅' : 'ℹ️ Not needed');
|
|
262
|
+
console.log('Overall Installation:', systemExtensionRegistered ? '✅ SUCCESS' : '❌ FAILED');
|
|
263
|
+
} catch (error) {
|
|
264
|
+
console.error('Error processing extension installed event:', error);
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
// Listen to extension uninstalled events
|
|
268
|
+
this.onExtensionUninstalled.event(async event => {
|
|
269
|
+
console.log('=== EXTENSION UNINSTALLATION STARTED ===');
|
|
270
|
+
console.log('Extension slug:', event.extensionSlug);
|
|
271
|
+
console.log('Tenant:', event.tenantId);
|
|
272
|
+
let uninstallationSuccessful = false;
|
|
273
|
+
let extensionConfigRemoved = false;
|
|
274
|
+
let systemExtensionUpdated = false;
|
|
275
|
+
try {
|
|
276
|
+
// STEP 1: Remove the extension's own configuration registry entry (if it exists)
|
|
277
|
+
console.log('\n🗑️ STEP 1: Removing extension configuration registry');
|
|
278
|
+
const context = {
|
|
279
|
+
schemaId: ConfigurationSchemaId.Configuration,
|
|
280
|
+
tenantId: event.tenantId,
|
|
281
|
+
extensionName: event.extensionSlug,
|
|
282
|
+
accountId: event.uninstalledBy
|
|
283
|
+
};
|
|
284
|
+
try {
|
|
285
|
+
console.log('Removing extension configuration document...');
|
|
286
|
+
await this.broker.call('ConfigurationRegistryService.removeConfigurationNodeRegistry', {
|
|
287
|
+
context
|
|
288
|
+
});
|
|
289
|
+
extensionConfigRemoved = true;
|
|
290
|
+
console.log('✅ STEP 1 SUCCESS: Extension configuration removed');
|
|
291
|
+
} catch (configError) {
|
|
292
|
+
console.warn('⚠️ STEP 1 WARNING: Extension configuration removal failed (may not exist):', configError);
|
|
293
|
+
// This is not fatal - extension might not have had configuration
|
|
294
|
+
}
|
|
295
|
+
// STEP 1.5: Remove UILayout contributions (if any exist)
|
|
296
|
+
console.log('\n🗑️ STEP 1.5: Removing UILayout contributions (if exist)');
|
|
297
|
+
try {
|
|
298
|
+
console.log('Attempting to remove UILayout contributions...');
|
|
299
|
+
await this.broker.call('ConfigurationRegistryService.removeUILayoutContributions', {
|
|
300
|
+
tenantId: event.tenantId,
|
|
301
|
+
extensionID: event.extensionSlug
|
|
302
|
+
});
|
|
303
|
+
console.log('✅ STEP 1.5 SUCCESS: UILayout contributions removed');
|
|
304
|
+
} catch (uiLayoutError) {
|
|
305
|
+
console.warn('⚠️ STEP 1.5 WARNING: UILayout contributions removal failed (may not exist):', uiLayoutError);
|
|
306
|
+
// This is not fatal - extension might not have had UILayout contributions
|
|
307
|
+
}
|
|
308
|
+
// STEP 2: MANDATORY - Remove extension node from system_extension document
|
|
309
|
+
console.log('\n🔧 STEP 2: Unregistering extension from SYSTEM_EXTENSION (MANDATORY)');
|
|
310
|
+
try {
|
|
311
|
+
// First, get the current system_extension document
|
|
312
|
+
const systemContext = {
|
|
313
|
+
schemaId: ConfigurationSchemaId.Configuration,
|
|
314
|
+
tenantId: event.tenantId,
|
|
315
|
+
extensionName: SystemContributionExtensionNames.SystemExtension,
|
|
316
|
+
accountId: event.uninstalledBy
|
|
317
|
+
};
|
|
318
|
+
console.log('Fetching current system_extension document...');
|
|
319
|
+
const currentSystemDoc = await this.broker.call('ConfigurationRegistryService.getConfigurationNodeRegistry', {
|
|
320
|
+
context: systemContext
|
|
321
|
+
});
|
|
322
|
+
if (currentSystemDoc && currentSystemDoc.configurationNodes) {
|
|
323
|
+
const systemDoc = currentSystemDoc;
|
|
324
|
+
// Filter out the specific extension's status node
|
|
325
|
+
const configurationNodes = systemDoc.configurationNodes;
|
|
326
|
+
const updatedConfigurationNodes = configurationNodes.filter(node => node.id !== ContributionFragmentName.Settings);
|
|
327
|
+
console.log('Removing extension status node:', ContributionFragmentName.Settings);
|
|
328
|
+
console.log(`Original nodes: ${configurationNodes.length}, After removal: ${updatedConfigurationNodes.length}`);
|
|
329
|
+
// Update the system_extension document with the filtered nodes
|
|
330
|
+
const updatedSystemExtensionNode = {
|
|
331
|
+
schemaId: ConfigurationSchemaId.Configuration,
|
|
332
|
+
tenantId: event.tenantId,
|
|
333
|
+
extensionName: SystemContributionExtensionNames.SystemExtension,
|
|
334
|
+
policyConfigs: systemDoc.policyConfigs || null,
|
|
335
|
+
configurationNodes: updatedConfigurationNodes,
|
|
336
|
+
configurationDefaults: systemDoc.configurationDefaults || []
|
|
337
|
+
};
|
|
338
|
+
console.log('Updating system_extension document...');
|
|
339
|
+
await this.broker.call('ConfigurationRegistryService.updateConfigurationNodeRegistry', {
|
|
340
|
+
data: updatedSystemExtensionNode,
|
|
341
|
+
context: systemContext
|
|
342
|
+
});
|
|
343
|
+
systemExtensionUpdated = true;
|
|
344
|
+
console.log('✅ STEP 2 SUCCESS: Extension unregistered from system_extension');
|
|
345
|
+
} else {
|
|
346
|
+
console.warn('⚠️ STEP 2 WARNING: No system_extension document found or no configuration nodes');
|
|
347
|
+
systemExtensionUpdated = true; // Consider it successful if document doesn't exist
|
|
348
|
+
}
|
|
349
|
+
} catch (systemError) {
|
|
350
|
+
console.error('❌ STEP 2 FAILED: System extension unregistration failed:', systemError);
|
|
351
|
+
throw new Error(`Extension uninstallation failed: Could not unregister from system (${systemError.message})`);
|
|
352
|
+
}
|
|
353
|
+
// Uninstallation is successful if system extension is updated
|
|
354
|
+
uninstallationSuccessful = systemExtensionUpdated;
|
|
355
|
+
await this.dropCache();
|
|
356
|
+
console.log('\n=== EXTENSION UNINSTALLATION COMPLETED ===');
|
|
357
|
+
console.log('Extension Config Removed:', extensionConfigRemoved ? '✅' : 'ℹ️ Not found');
|
|
358
|
+
console.log('System Extension Updated:', systemExtensionUpdated ? '✅' : '❌');
|
|
359
|
+
console.log('Overall Uninstallation:', uninstallationSuccessful ? '✅ SUCCESS' : '❌ FAILED');
|
|
360
|
+
} catch (error) {
|
|
361
|
+
console.error('❌ EXTENSION UNINSTALLATION FAILED:', error);
|
|
362
|
+
console.error('Error details:', {
|
|
363
|
+
message: error.message,
|
|
364
|
+
stack: error.stack,
|
|
365
|
+
extensionSlug: event.extensionSlug,
|
|
366
|
+
tenantId: event.tenantId,
|
|
367
|
+
extensionConfigRemoved,
|
|
368
|
+
systemExtensionUpdated
|
|
369
|
+
});
|
|
370
|
+
throw error; // Re-throw to ensure calling code knows uninstallation failed
|
|
371
|
+
}
|
|
372
|
+
// Notify other services about the uninstallation
|
|
373
|
+
this.broker.broadcast(ExtensionServiceAction.OnExtensionUninstalled, {
|
|
374
|
+
event
|
|
375
|
+
}, [MoleculerServiceName.ConfigurationService, 'WorkbenchService',
|
|
376
|
+
// Using string literal as MoleculerServiceName.WorkbenchService doesn't exist
|
|
377
|
+
MoleculerServiceName.MailService // Using MailService instead of NotificationService
|
|
378
|
+
]);
|
|
379
|
+
});
|
|
380
|
+
// Listen to extension enabled events
|
|
381
|
+
this.onExtensionEnabled.event(event => {
|
|
382
|
+
this.broker.broadcast(ExtensionServiceAction.OnExtensionEnabled, {
|
|
383
|
+
event
|
|
384
|
+
}, [MoleculerServiceName.ConfigurationService, 'WorkbenchService' // Using string literal as MoleculerServiceName.WorkbenchService doesn't exist
|
|
385
|
+
]);
|
|
386
|
+
});
|
|
387
|
+
// Listen to extension disabled events
|
|
388
|
+
this.onExtensionDisabled.event(event => {
|
|
389
|
+
this.broker.broadcast(ExtensionServiceAction.OnExtensionDisabled, {
|
|
390
|
+
event
|
|
391
|
+
}, [MoleculerServiceName.ConfigurationService, 'WorkbenchService' // Using string literal as MoleculerServiceName.WorkbenchService doesn't exist
|
|
392
|
+
]);
|
|
393
|
+
});
|
|
394
|
+
// Listen to extension updated events
|
|
395
|
+
this.onExtensionUpdated.event(event => {
|
|
396
|
+
this.broker.broadcast(ExtensionServiceAction.OnExtensionUpdated, {
|
|
397
|
+
event
|
|
398
|
+
}, [MoleculerServiceName.ConfigurationService]);
|
|
399
|
+
});
|
|
400
|
+
// Listen to extension version updated events
|
|
401
|
+
this.onExtensionVersionUpdated.event(event => {
|
|
402
|
+
this.broker.broadcast(ExtensionServiceAction.OnExtensionVersionUpdated, {
|
|
403
|
+
event
|
|
404
|
+
}, [MoleculerServiceName.ConfigurationService, 'WorkbenchService',
|
|
405
|
+
// Using string literal as MoleculerServiceName.WorkbenchService doesn't exist
|
|
406
|
+
MoleculerServiceName.MailService // Using MailService instead of NotificationService
|
|
407
|
+
]);
|
|
408
|
+
});
|
|
409
|
+
// Listen to extension configuration updated events
|
|
410
|
+
this.onExtensionConfigurationUpdated.event(event => {
|
|
411
|
+
this.broker.broadcast(ExtensionServiceAction.OnExtensionConfigurationUpdated, {
|
|
412
|
+
event
|
|
413
|
+
}, [MoleculerServiceName.ConfigurationService, 'WorkbenchService' // Using string literal as MoleculerServiceName.WorkbenchService doesn't exist
|
|
414
|
+
]);
|
|
415
|
+
});
|
|
416
|
+
// Listen to extension sync completed events
|
|
417
|
+
this.onExtensionSyncCompleted.event(event => {
|
|
418
|
+
this.broker.broadcast(ExtensionServiceAction.OnExtensionSyncCompleted, {
|
|
419
|
+
event
|
|
420
|
+
}, [MoleculerServiceName.MailService // Using MailService instead of NotificationService
|
|
421
|
+
]);
|
|
422
|
+
});
|
|
423
|
+
// Listen to extension cleanup completed events
|
|
424
|
+
this.onExtensionCleanupCompleted.event(e => {
|
|
425
|
+
this.broker.broadcast(ExtensionServiceAction.OnExtensionCleanupCompleted, {
|
|
426
|
+
event: e
|
|
427
|
+
}, [MoleculerServiceName.MailService // Using MailService instead of NotificationService
|
|
428
|
+
]);
|
|
429
|
+
});
|
|
430
|
+
// Listen to extension activation failed events
|
|
431
|
+
this.onExtensionActivationFailed.event(event => {
|
|
432
|
+
this.broker.broadcast(ExtensionServiceAction.OnExtensionActivationFailed, {
|
|
433
|
+
event
|
|
434
|
+
}, [MoleculerServiceName.MailService // Using MailService instead of NotificationService
|
|
435
|
+
]);
|
|
436
|
+
});
|
|
437
|
+
// Listen to extension deprecated events
|
|
438
|
+
this.onExtensionDeprecated.event(event => {
|
|
439
|
+
this.broker.broadcast(ExtensionServiceAction.OnExtensionDeprecated, {
|
|
440
|
+
event
|
|
441
|
+
}, [MoleculerServiceName.MailService // Using MailService instead of NotificationService
|
|
442
|
+
]);
|
|
443
|
+
});
|
|
444
|
+
// Listen to extension orphaned events
|
|
445
|
+
this.onExtensionOrphaned.event(event => {
|
|
446
|
+
this.broker.broadcast(ExtensionServiceAction.OnExtensionOrphaned, {
|
|
447
|
+
event
|
|
448
|
+
}, [MoleculerServiceName.MailService // Using MailService instead of NotificationService
|
|
449
|
+
]);
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
async dropCache() {
|
|
453
|
+
console.log('Start dropping GraphQL query cache keys');
|
|
454
|
+
try {
|
|
455
|
+
// Get Redis client from redisCacheManager
|
|
456
|
+
const {
|
|
457
|
+
redisClient
|
|
458
|
+
} = this.redisCacheManager;
|
|
459
|
+
if (!redisClient) {
|
|
460
|
+
console.error('❌ Redis client not found in redisCacheManager');
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
const appName = process.env.APP_NAME || 'adminide-stack';
|
|
464
|
+
// Only delete GraphQL query caches, not session/auth data
|
|
465
|
+
// These are the specific queries we want to invalidate
|
|
466
|
+
const queryPatterns = [`${appName}*pageSettings*`, `${appName}*GetPageSettings*`, `${appName}*CurrentPagePermissions*`, `${appName}*IntegrationConfigurations*`, `${appName}*ContributionRoles*`];
|
|
467
|
+
let totalDeleted = 0;
|
|
468
|
+
for (const pattern of queryPatterns) {
|
|
469
|
+
console.log(`🔍 Searching for keys matching: ${pattern}`);
|
|
470
|
+
const keys = await redisClient.keys(pattern);
|
|
471
|
+
if (keys.length > 0) {
|
|
472
|
+
console.log(`📋 Found ${keys.length} keys for pattern: ${pattern}`);
|
|
473
|
+
console.log(`📝 Sample keys:`, keys.slice(0, 3));
|
|
474
|
+
await redisClient.del(...keys);
|
|
475
|
+
totalDeleted += keys.length;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
console.log(`✅ Successfully deleted ${totalDeleted} query cache keys`);
|
|
479
|
+
} catch (error) {
|
|
480
|
+
console.error('❌ Failed to drop cache:', error);
|
|
481
|
+
// Don't throw - cache clearing failure shouldn't break extension installation
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
InstalledExtensionServiceExt = __decorate([injectable(), __param(0, inject(SERVER_TYPES.IInstalledExtensionRepository)), __param(1, inject(SERVER_TYPES.IRegistryExtensionService)), __param(2, inject(SERVER_TYPES.SlugService)), __param(3, inject(SERVER_TYPES.IRedisCacheManager)), __param(4, inject(CommonType.MOLECULER_BROKER)), __param(5, inject(CommonType.LOGGER)), __metadata("design:paramtypes", [Object, Object, Object, Object, ServiceBroker, Object])], InstalledExtensionServiceExt);export{InstalledExtensionServiceExt};//# sourceMappingURL=installed-extension-service-ext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installed-extension-service-ext.js","sources":["../../src/services/installed-extension-service-ext.ts"],"sourcesContent":[null],"names":[],"mappings":"qbAmGG;AACH;;AAQQ;;AAQJ,EAAA,IAAA,OAAQ,KAAA,KAAA,QAAmB,EAAA;gBAoeb,CAAA;AA6CjB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { CdmLogger } from '@cdm-logger/core';
|
|
2
|
+
import { ServiceBroker } from 'moleculer';
|
|
3
|
+
import { Disposable, DisposableCollection, Emitter } from '@adminide-stack/core';
|
|
4
|
+
import { BaseService2 } from '@common-stack/store-mongo';
|
|
5
|
+
import { IInstalledExtensionModel, ICreateInstalledExtensionInput, IUpdateInstalledExtensionInput, IRegistryExtensionService, IInstalledExtensionFilter, IInstalledExtensionService, IInstalledExtensionRepository, IExtensionInstalledEvent, IExtensionUninstalledEvent, IExtensionEnabledEvent, IExtensionDisabledEvent, IExtensionUpdatedEvent, IExtensionVersionUpdatedEvent, IExtensionStatusChangedEvent, IExtensionActivationFailedEvent, IExtensionDeprecatedEvent, IExtensionOrphanedEvent, IExtensionConfigurationUpdatedEvent, IExtensionSyncCompletedEvent, IExtensionCleanupCompletedEvent, AsDomainType, ISlugService } from 'common/server';
|
|
6
|
+
export declare class InstalledExtensionService extends BaseService2<IInstalledExtensionModel> implements IInstalledExtensionService, Disposable {
|
|
7
|
+
private installedExtensionRepository;
|
|
8
|
+
protected registryExtensionService: IRegistryExtensionService;
|
|
9
|
+
protected slugService: ISlugService;
|
|
10
|
+
protected broker: ServiceBroker;
|
|
11
|
+
protected readonly onExtensionInstalled: Emitter<IExtensionInstalledEvent>;
|
|
12
|
+
protected readonly onExtensionUninstalled: Emitter<IExtensionUninstalledEvent>;
|
|
13
|
+
protected readonly onExtensionEnabled: Emitter<IExtensionEnabledEvent>;
|
|
14
|
+
protected readonly onExtensionDisabled: Emitter<IExtensionDisabledEvent>;
|
|
15
|
+
protected readonly onExtensionUpdated: Emitter<IExtensionUpdatedEvent>;
|
|
16
|
+
protected readonly onExtensionVersionUpdated: Emitter<IExtensionVersionUpdatedEvent>;
|
|
17
|
+
protected readonly onExtensionConfigurationUpdated: Emitter<IExtensionConfigurationUpdatedEvent>;
|
|
18
|
+
protected readonly onExtensionSyncCompleted: Emitter<IExtensionSyncCompletedEvent>;
|
|
19
|
+
protected readonly onExtensionCleanupCompleted: Emitter<IExtensionCleanupCompletedEvent>;
|
|
20
|
+
protected readonly onExtensionStatusChanged: Emitter<IExtensionStatusChangedEvent>;
|
|
21
|
+
protected readonly onExtensionActivationFailed: Emitter<IExtensionActivationFailedEvent>;
|
|
22
|
+
protected readonly onExtensionDeprecated: Emitter<IExtensionDeprecatedEvent>;
|
|
23
|
+
protected readonly onExtensionOrphaned: Emitter<IExtensionOrphanedEvent>;
|
|
24
|
+
protected readonly toDispose: DisposableCollection;
|
|
25
|
+
private logger;
|
|
26
|
+
constructor(installedExtensionRepository: IInstalledExtensionRepository, registryExtensionService: IRegistryExtensionService, slugService: ISlugService, broker: ServiceBroker, logger: CdmLogger.ILogger);
|
|
27
|
+
dispose(): void;
|
|
28
|
+
private resolveExtensionSlug;
|
|
29
|
+
/**
|
|
30
|
+
* Install a new extension from the registry
|
|
31
|
+
*/
|
|
32
|
+
installExtension(input: ICreateInstalledExtensionInput, tenantId: string): Promise<AsDomainType<IInstalledExtensionModel>>;
|
|
33
|
+
/**
|
|
34
|
+
* Internal method to perform the actual installation after validation
|
|
35
|
+
*/
|
|
36
|
+
private doInstallExtension;
|
|
37
|
+
/**
|
|
38
|
+
* Uninstall an extension
|
|
39
|
+
*/
|
|
40
|
+
uninstallExtension(orgId: string, extensionSlug: string, uninstalledBy: string, tenantId: any): Promise<boolean>;
|
|
41
|
+
/**
|
|
42
|
+
* Update an installed extension's configuration or status
|
|
43
|
+
*/
|
|
44
|
+
updateInstalledExtension(orgId: string, extensionSlug: string, update: IUpdateInstalledExtensionInput, tenantId: string): Promise<AsDomainType<IInstalledExtensionModel>>;
|
|
45
|
+
/**
|
|
46
|
+
* Get a specific installed extension
|
|
47
|
+
*/
|
|
48
|
+
getInstalledExtension(orgId: string, extensionSlug: string): Promise<AsDomainType<IInstalledExtensionModel> | null>;
|
|
49
|
+
/**
|
|
50
|
+
* Get all installed extensions for a tenant with optional filtering
|
|
51
|
+
*/
|
|
52
|
+
getInstalledExtensions(filter: IInstalledExtensionFilter): Promise<AsDomainType<IInstalledExtensionModel>[]>;
|
|
53
|
+
/**
|
|
54
|
+
* Enable/disable an installed extension
|
|
55
|
+
*/
|
|
56
|
+
toggleExtension(orgId: string, extensionSlug: string, enabled: boolean, toggledBy: string, tenantId: string): Promise<AsDomainType<IInstalledExtensionModel>>;
|
|
57
|
+
/**
|
|
58
|
+
* Update extension settings/configuration
|
|
59
|
+
*/
|
|
60
|
+
updateExtensionSettings(orgId: string, extensionSlug: string, userConfig: Record<string, unknown>, updatedBy: string, tenantId: string): Promise<AsDomainType<IInstalledExtensionModel>>;
|
|
61
|
+
/**
|
|
62
|
+
* Check for extension updates and return available updates
|
|
63
|
+
*/
|
|
64
|
+
checkForUpdates(orgId: string, extensionSlug?: string): Promise<Array<{
|
|
65
|
+
extensionId: string;
|
|
66
|
+
extensionSlug: string;
|
|
67
|
+
currentVersion: string;
|
|
68
|
+
availableVersion: string;
|
|
69
|
+
isSecurityUpdate: boolean;
|
|
70
|
+
}>>;
|
|
71
|
+
/**
|
|
72
|
+
* Update an extension to a newer version
|
|
73
|
+
*/
|
|
74
|
+
updateExtensionVersion(orgId: string, extensionSlug: string, targetVersion: string, updatedBy: string, tenantId: any): Promise<AsDomainType<IInstalledExtensionModel>>;
|
|
75
|
+
/**
|
|
76
|
+
* Sync installed extensions with registry status
|
|
77
|
+
*/
|
|
78
|
+
syncWithRegistry(orgId: string, tenantId: string): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Get extensions that need attention
|
|
81
|
+
*/
|
|
82
|
+
getExtensionsNeedingAttention(orgId: string): Promise<AsDomainType<IInstalledExtensionModel>[]>;
|
|
83
|
+
/**
|
|
84
|
+
* Clean up deprecated or removed extensions based on policies
|
|
85
|
+
*/
|
|
86
|
+
cleanupExtensions(orgId: string, tenantId: string, dryRun?: boolean): Promise<{
|
|
87
|
+
removed: string[];
|
|
88
|
+
deprecated: string[];
|
|
89
|
+
warnings: string[];
|
|
90
|
+
}>;
|
|
91
|
+
/**
|
|
92
|
+
* Check if update is a security update (simplified logic)
|
|
93
|
+
*/
|
|
94
|
+
private isSecurityUpdate;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=installed-extension-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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