@adminide-stack/marketplace-module-server 12.0.4-alpha.91 → 12.0.4-alpha.95
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/constants/extension-events.d.ts +136 -0
- package/lib/constants/extension-events.d.ts.map +1 -0
- package/lib/containers/module.d.ts +8 -0
- package/lib/containers/module.d.ts.map +1 -1
- package/lib/containers/module.js +9 -3
- package/lib/containers/module.js.map +1 -1
- package/lib/dataloaders/index.d.ts +2 -0
- package/lib/dataloaders/index.d.ts.map +1 -0
- package/lib/dataloaders/registry-extension-data-loader.d.ts +6 -0
- package/lib/dataloaders/registry-extension-data-loader.d.ts.map +1 -0
- package/lib/dataloaders/registry-extension-data-loader.js +6 -0
- package/lib/dataloaders/registry-extension-data-loader.js.map +1 -0
- package/lib/graphql/resolvers/index.d.ts +1 -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 +183 -0
- package/lib/graphql/resolvers/installed-extension-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/{resolvers.js → registry-extension-resolver.js} +59 -47
- package/lib/graphql/resolvers/registry-extension-resolver.js.map +1 -0
- package/lib/graphql/schemas/extension-registry.graphql +74 -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/index.d.ts.map +1 -1
- package/lib/graphql/schemas/index.js +1 -4
- package/lib/graphql/schemas/index.js.map +1 -1
- package/lib/graphql/schemas/installed-extension.graphql +294 -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/service.graphql +181 -0
- package/lib/graphql/schemas/service.graphql.js +1 -0
- package/lib/graphql/schemas/service.graphql.js.map +1 -0
- package/lib/index.d.ts +2 -0
- 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.map +1 -1
- package/lib/module.js +6 -4
- 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-service.d.ts +35 -47
- package/lib/services/extension-service.d.ts.map +1 -1
- package/lib/services/extension-service.js +33 -15
- package/lib/services/extension-service.js.map +1 -1
- package/lib/services/index.d.ts +2 -0
- package/lib/services/index.d.ts.map +1 -1
- package/lib/services/installed-extension-service-ext.d.ts +13 -0
- package/lib/services/installed-extension-service-ext.d.ts.map +1 -0
- package/lib/services/installed-extension-service-ext.js +271 -0
- package/lib/services/installed-extension-service-ext.js.map +1 -0
- package/lib/services/installed-extension-service.d.ts +93 -0
- package/lib/services/installed-extension-service.d.ts.map +1 -0
- package/lib/services/installed-extension-service.js +400 -0
- package/lib/services/installed-extension-service.js.map +1 -0
- package/lib/services/installed-extension-service.test.d.ts +2 -0
- package/lib/services/installed-extension-service.test.d.ts.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 +1 -0
- 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 +297 -0
- package/lib/store/models/installed-extension-model.js.map +1 -0
- package/lib/store/models/registry-extension-model.d.ts +2 -7
- package/lib/store/models/registry-extension-model.d.ts.map +1 -1
- package/lib/store/models/registry-extension-model.js +40 -19
- package/lib/store/models/registry-extension-model.js.map +1 -1
- 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 +71 -0
- package/lib/store/repositories/installed-extension-repository.d.ts.map +1 -0
- package/lib/store/repositories/installed-extension-repository.js +414 -0
- package/lib/store/repositories/installed-extension-repository.js.map +1 -0
- package/lib/store/repositories/registry-extension-repository.d.ts +54 -0
- package/lib/store/repositories/registry-extension-repository.d.ts.map +1 -0
- package/lib/store/{repository → repositories}/registry-extension-repository.js +44 -42
- package/lib/store/repositories/registry-extension-repository.js.map +1 -0
- package/lib/templates/constants/DB_COLL_NAMES.ts.template +5 -0
- package/lib/templates/constants/SERVER_TYPES.ts.template +3 -0
- package/lib/templates/repositories/InstalledExtensionRepository.ts.template +94 -0
- package/lib/templates/repositories/RegistryExtensionRepository.ts.template +10 -15
- package/lib/templates/services/InstalledExtensionDataLoader.ts.template +2 -0
- package/lib/templates/services/InstalledExtensionService.ts.template +168 -0
- package/lib/templates/services/RegistryExtensionDataLoader.ts.template +2 -0
- package/lib/templates/services/RegistryExtensionService.ts.template +10 -10
- package/lib/tests/extension-integration.test.d.ts +2 -0
- package/lib/tests/extension-integration.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/package.json +12 -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.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/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.map +0 -1
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import {DB_COLL_NAMES}from'common/server';import {Schema}from'mongoose';// Schema for extension lifecycle management
|
|
2
|
+
const ExtensionLifecycleSchema = new Schema({
|
|
3
|
+
registryStatus: {
|
|
4
|
+
type: String,
|
|
5
|
+
enum: ['active', 'deprecated', 'suspended', 'removed', 'emergency-removed'],
|
|
6
|
+
required: true,
|
|
7
|
+
default: 'active'
|
|
8
|
+
},
|
|
9
|
+
isOrphaned: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: false
|
|
12
|
+
},
|
|
13
|
+
deprecationWarningShown: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: false
|
|
16
|
+
},
|
|
17
|
+
autoUpdateBlocked: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: false
|
|
20
|
+
},
|
|
21
|
+
lastRegistryCheck: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: () => new Date().toISOString()
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
// Schema for extension policies
|
|
27
|
+
const ExtensionPoliciesSchema = new Schema({
|
|
28
|
+
allowOrphanedExecution: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false
|
|
31
|
+
},
|
|
32
|
+
requireSecurityUpdates: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: true
|
|
35
|
+
},
|
|
36
|
+
autoRemoveDeprecated: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: false
|
|
39
|
+
},
|
|
40
|
+
deprecationGracePeriod: {
|
|
41
|
+
type: Number,
|
|
42
|
+
default: 30 // days
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
// Schema for extension settings
|
|
46
|
+
const ExtensionSettingsSchema = new Schema({
|
|
47
|
+
userEnabled: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: true
|
|
50
|
+
},
|
|
51
|
+
systemEnabled: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: true
|
|
54
|
+
},
|
|
55
|
+
effectiveEnabled: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: true
|
|
58
|
+
},
|
|
59
|
+
userConfig: {
|
|
60
|
+
type: Schema.Types.Mixed,
|
|
61
|
+
default: () => ({})
|
|
62
|
+
},
|
|
63
|
+
systemConfig: {
|
|
64
|
+
type: Schema.Types.Mixed,
|
|
65
|
+
default: () => ({})
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
// Schema for activation error
|
|
69
|
+
const ActivationErrorSchema = new Schema({
|
|
70
|
+
message: {
|
|
71
|
+
type: String,
|
|
72
|
+
required: true
|
|
73
|
+
},
|
|
74
|
+
code: {
|
|
75
|
+
type: String,
|
|
76
|
+
required: true
|
|
77
|
+
},
|
|
78
|
+
timestamp: {
|
|
79
|
+
type: String,
|
|
80
|
+
required: true
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
// Schema for metrics
|
|
84
|
+
const MetricsSchema = new Schema({
|
|
85
|
+
activationTime: {
|
|
86
|
+
type: Number,
|
|
87
|
+
required: true
|
|
88
|
+
},
|
|
89
|
+
// milliseconds
|
|
90
|
+
memoryUsage: {
|
|
91
|
+
type: Number,
|
|
92
|
+
required: true
|
|
93
|
+
},
|
|
94
|
+
// bytes
|
|
95
|
+
lastMeasured: {
|
|
96
|
+
type: String,
|
|
97
|
+
required: true
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
// Schema for extension runtime information
|
|
101
|
+
const ExtensionRuntimeSchema = new Schema({
|
|
102
|
+
activationState: {
|
|
103
|
+
type: String,
|
|
104
|
+
enum: ['enabled', 'disabled', 'disabled-by-user', 'disabled-by-admin', 'disabled-by-policy'],
|
|
105
|
+
default: 'enabled'
|
|
106
|
+
},
|
|
107
|
+
lastActivated: {
|
|
108
|
+
type: Date
|
|
109
|
+
},
|
|
110
|
+
lastDeactivated: {
|
|
111
|
+
type: Date
|
|
112
|
+
},
|
|
113
|
+
activationError: ActivationErrorSchema,
|
|
114
|
+
metrics: MetricsSchema
|
|
115
|
+
});
|
|
116
|
+
// Schema for audit log entries
|
|
117
|
+
const AuditLogSchema = new Schema({
|
|
118
|
+
action: {
|
|
119
|
+
type: String,
|
|
120
|
+
enum: ['installed', 'updated', 'enabled', 'disabled', 'configured'],
|
|
121
|
+
required: true
|
|
122
|
+
},
|
|
123
|
+
timestamp: {
|
|
124
|
+
type: Date,
|
|
125
|
+
default: Date.now
|
|
126
|
+
},
|
|
127
|
+
user: {
|
|
128
|
+
type: Schema.Types.ObjectId,
|
|
129
|
+
ref: DB_COLL_NAMES.Accounts,
|
|
130
|
+
required: true
|
|
131
|
+
},
|
|
132
|
+
details: {
|
|
133
|
+
type: Schema.Types.Mixed
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
// Main installed extension schema
|
|
137
|
+
const InstalledExtensionSchema = new Schema({
|
|
138
|
+
tenantId: {
|
|
139
|
+
type: String,
|
|
140
|
+
required: true,
|
|
141
|
+
index: true
|
|
142
|
+
},
|
|
143
|
+
extension: {
|
|
144
|
+
type: Schema.Types.ObjectId,
|
|
145
|
+
ref: DB_COLL_NAMES.ExtensionRegistries,
|
|
146
|
+
required: true,
|
|
147
|
+
index: true
|
|
148
|
+
},
|
|
149
|
+
installedVersion: {
|
|
150
|
+
type: String,
|
|
151
|
+
required: true,
|
|
152
|
+
index: true
|
|
153
|
+
},
|
|
154
|
+
status: {
|
|
155
|
+
type: String,
|
|
156
|
+
enum: ['installed', 'deprecated-installed', 'suspended', 'orphaned', 'force-disabled'],
|
|
157
|
+
default: 'installed',
|
|
158
|
+
index: true
|
|
159
|
+
},
|
|
160
|
+
lifecycle: {
|
|
161
|
+
type: ExtensionLifecycleSchema,
|
|
162
|
+
default: () => ({})
|
|
163
|
+
},
|
|
164
|
+
policies: {
|
|
165
|
+
type: ExtensionPoliciesSchema,
|
|
166
|
+
default: () => ({})
|
|
167
|
+
},
|
|
168
|
+
settings: {
|
|
169
|
+
type: ExtensionSettingsSchema,
|
|
170
|
+
default: () => ({})
|
|
171
|
+
},
|
|
172
|
+
runtime: {
|
|
173
|
+
type: ExtensionRuntimeSchema,
|
|
174
|
+
default: () => ({})
|
|
175
|
+
},
|
|
176
|
+
installedAt: {
|
|
177
|
+
type: Date,
|
|
178
|
+
default: Date.now,
|
|
179
|
+
index: true
|
|
180
|
+
},
|
|
181
|
+
installedBy: {
|
|
182
|
+
type: Schema.Types.ObjectId,
|
|
183
|
+
ref: DB_COLL_NAMES.Accounts,
|
|
184
|
+
required: true,
|
|
185
|
+
index: true
|
|
186
|
+
},
|
|
187
|
+
lastUpdated: {
|
|
188
|
+
type: Date
|
|
189
|
+
},
|
|
190
|
+
lastUpdatedBy: {
|
|
191
|
+
type: Schema.Types.ObjectId,
|
|
192
|
+
ref: DB_COLL_NAMES.Accounts
|
|
193
|
+
},
|
|
194
|
+
availableVersion: {
|
|
195
|
+
type: String
|
|
196
|
+
},
|
|
197
|
+
dependencies: {
|
|
198
|
+
type: [String],
|
|
199
|
+
default: []
|
|
200
|
+
},
|
|
201
|
+
dependents: {
|
|
202
|
+
type: [String],
|
|
203
|
+
default: []
|
|
204
|
+
},
|
|
205
|
+
auditLog: {
|
|
206
|
+
type: [AuditLogSchema],
|
|
207
|
+
default: []
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
// Create virtual for id
|
|
211
|
+
InstalledExtensionSchema.virtual('id').get(function () {
|
|
212
|
+
return this._id.toHexString();
|
|
213
|
+
});
|
|
214
|
+
// Create compound indexes for efficient queries
|
|
215
|
+
InstalledExtensionSchema.index({
|
|
216
|
+
tenantId: 1,
|
|
217
|
+
extension: 1
|
|
218
|
+
}, {
|
|
219
|
+
unique: true
|
|
220
|
+
});
|
|
221
|
+
InstalledExtensionSchema.index({
|
|
222
|
+
tenantId: 1,
|
|
223
|
+
status: 1
|
|
224
|
+
});
|
|
225
|
+
InstalledExtensionSchema.index({
|
|
226
|
+
tenantId: 1,
|
|
227
|
+
'settings.effectiveEnabled': 1
|
|
228
|
+
});
|
|
229
|
+
InstalledExtensionSchema.index({
|
|
230
|
+
'lifecycle.registryStatus': 1
|
|
231
|
+
});
|
|
232
|
+
InstalledExtensionSchema.index({
|
|
233
|
+
'lifecycle.isOrphaned': 1
|
|
234
|
+
});
|
|
235
|
+
InstalledExtensionSchema.index({
|
|
236
|
+
installedAt: 1
|
|
237
|
+
});
|
|
238
|
+
InstalledExtensionSchema.index({
|
|
239
|
+
lastUpdated: 1
|
|
240
|
+
});
|
|
241
|
+
// Configure toJSON transformation
|
|
242
|
+
InstalledExtensionSchema.set('toJSON', {
|
|
243
|
+
virtuals: true,
|
|
244
|
+
transform: (doc, ret) => {
|
|
245
|
+
ret.id = ret._id.toString();
|
|
246
|
+
delete ret._id;
|
|
247
|
+
delete ret.__v;
|
|
248
|
+
if (ret.extension) {
|
|
249
|
+
ret.extension = ret.extension.toString();
|
|
250
|
+
}
|
|
251
|
+
if (ret.installedBy) {
|
|
252
|
+
ret.installedBy = ret.installedBy.toString();
|
|
253
|
+
}
|
|
254
|
+
if (ret.lastUpdatedBy) {
|
|
255
|
+
ret.lastUpdatedBy = ret.lastUpdatedBy.toString();
|
|
256
|
+
}
|
|
257
|
+
// Transform audit log ObjectIds to strings
|
|
258
|
+
if (ret.auditLog && Array.isArray(ret.auditLog)) {
|
|
259
|
+
ret.auditLog = ret.auditLog.map(entry => ({
|
|
260
|
+
...entry,
|
|
261
|
+
id: entry._id?.toString(),
|
|
262
|
+
_id: undefined,
|
|
263
|
+
user: entry.user?.toString()
|
|
264
|
+
}));
|
|
265
|
+
}
|
|
266
|
+
return ret;
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
// Configure toObject transformation
|
|
270
|
+
InstalledExtensionSchema.set('toObject', {
|
|
271
|
+
virtuals: true,
|
|
272
|
+
transform: (doc, ret) => {
|
|
273
|
+
ret.id = ret._id.toString();
|
|
274
|
+
delete ret._id;
|
|
275
|
+
delete ret.__v;
|
|
276
|
+
if (ret.extension) {
|
|
277
|
+
ret.extension = ret.extension.toString();
|
|
278
|
+
}
|
|
279
|
+
if (ret.installedBy) {
|
|
280
|
+
ret.installedBy = ret.installedBy.toString();
|
|
281
|
+
}
|
|
282
|
+
if (ret.lastUpdatedBy) {
|
|
283
|
+
ret.lastUpdatedBy = ret.lastUpdatedBy.toString();
|
|
284
|
+
}
|
|
285
|
+
// Transform audit log ObjectIds to strings
|
|
286
|
+
if (ret.auditLog && Array.isArray(ret.auditLog)) {
|
|
287
|
+
ret.auditLog = ret.auditLog.map(entry => ({
|
|
288
|
+
...entry,
|
|
289
|
+
id: entry._id?.toString(),
|
|
290
|
+
_id: undefined,
|
|
291
|
+
user: entry.user?.toString()
|
|
292
|
+
}));
|
|
293
|
+
}
|
|
294
|
+
return ret;
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
const InstalledExtensionModelFunc = db => db.model(DB_COLL_NAMES.InstalledExtensions, InstalledExtensionSchema);export{InstalledExtensionModelFunc};//# sourceMappingURL=installed-extension-model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installed-extension-model.js","sources":["../../../src/store/models/installed-extension-model.ts"],"sourcesContent":[null],"names":[],"mappings":"wEAoSA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import { Model,
|
|
2
|
-
import {
|
|
3
|
-
export interface IRegistryExtensionModel extends Document, IRegistryExtensionRecord {
|
|
4
|
-
id: any;
|
|
5
|
-
type: string;
|
|
6
|
-
publisherId: string;
|
|
7
|
-
}
|
|
1
|
+
import { Model, Connection } from 'mongoose';
|
|
2
|
+
import { IRegistryExtensionModel } from 'common/server';
|
|
8
3
|
export type RegistryExtensionModelType = Model<IRegistryExtensionModel>;
|
|
9
4
|
export declare const RegistryExtensionModelFunc: (db: Connection) => RegistryExtensionModelType;
|
|
10
5
|
//# sourceMappingURL=registry-extension-model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry-extension-model.d.ts","sourceRoot":"","sources":["../../../src/store/models/registry-extension-model.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"registry-extension-model.d.ts","sourceRoot":"","sources":["../../../src/store/models/registry-extension-model.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAyC,MAAM,eAAe,CAAC;AAmF/F,MAAM,MAAM,0BAA0B,GAAG,KAAK,CAAC,uBAAuB,CAAC,CAAC;AACxE,eAAO,MAAM,0BAA0B,EAAE,CAAC,EAAE,EAAE,UAAU,KAAK,0BACoC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {find}from'lodash-es';import {Schema}from'mongoose';import {customAlphabet}from'nanoid';const createRandom = customAlphabet('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 15);
|
|
1
|
+
import {find}from'lodash-es';import {Schema}from'mongoose';import {DB_COLL_NAMES}from'common/server';import {customAlphabet}from'nanoid';const createRandom = customAlphabet('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 15);
|
|
2
|
+
// Define the actual release schema structure that matches MongoDB document
|
|
2
3
|
const RegistryExtensionReleaseSchema = new Schema({
|
|
3
4
|
creatorUserId: {
|
|
4
5
|
type: String
|
|
@@ -6,9 +7,7 @@ const RegistryExtensionReleaseSchema = new Schema({
|
|
|
6
7
|
releaseVersion: {
|
|
7
8
|
type: String
|
|
8
9
|
},
|
|
9
|
-
|
|
10
|
-
activationEvents: [String],
|
|
11
|
-
type: String,
|
|
10
|
+
extensionSlug: String,
|
|
12
11
|
manifest: {
|
|
13
12
|
type: String
|
|
14
13
|
},
|
|
@@ -20,35 +19,57 @@ const RegistryExtensionReleaseSchema = new Schema({
|
|
|
20
19
|
},
|
|
21
20
|
sourceMap: {
|
|
22
21
|
type: String
|
|
23
|
-
}
|
|
22
|
+
},
|
|
23
|
+
// activationEvents: [String],
|
|
24
|
+
bundleURL: String
|
|
24
25
|
}, {
|
|
25
|
-
strict:
|
|
26
|
+
strict: true
|
|
26
27
|
});
|
|
27
28
|
const RegistryExtensionSchema = new Schema({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
activationEvents: [String],
|
|
33
|
-
uuid: {
|
|
29
|
+
extensionSlug: String,
|
|
30
|
+
extensionIDWithoutRegistry: String,
|
|
31
|
+
isLocal: Boolean,
|
|
32
|
+
name: {
|
|
34
33
|
type: String,
|
|
34
|
+
required: true,
|
|
35
35
|
default: () => createRandom()
|
|
36
36
|
},
|
|
37
|
-
|
|
37
|
+
releases: [RegistryExtensionReleaseSchema],
|
|
38
|
+
remoteURL: String,
|
|
39
|
+
updatedAt: Date,
|
|
40
|
+
url: String,
|
|
41
|
+
uuid: {
|
|
38
42
|
type: String,
|
|
43
|
+
required: true,
|
|
39
44
|
default: () => createRandom()
|
|
40
45
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}]
|
|
46
|
+
version: String,
|
|
47
|
+
viewerCanAdminister: Boolean
|
|
44
48
|
}, {
|
|
45
|
-
strict:
|
|
49
|
+
strict: true,
|
|
50
|
+
timestamps: true
|
|
46
51
|
});
|
|
47
52
|
RegistryExtensionSchema.virtual('manifest').get(function () {
|
|
48
53
|
const release = find(this.releases, {
|
|
49
54
|
version: this.version
|
|
50
55
|
});
|
|
51
|
-
|
|
56
|
+
if (!release || !release.manifest) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
// Parse the JSON string manifest to create a proper ExtensionManifest object
|
|
61
|
+
const parsedManifest = JSON.parse(release.manifest);
|
|
62
|
+
return {
|
|
63
|
+
...parsedManifest,
|
|
64
|
+
raw: release.manifest // Keep the original raw JSON for backwards compatibility
|
|
65
|
+
};
|
|
66
|
+
} catch (error) {
|
|
67
|
+
console.warn('Failed to parse extension manifest for', this.extensionSlug, ':', error);
|
|
68
|
+
// Fallback to raw string format for backwards compatibility
|
|
69
|
+
return {
|
|
70
|
+
raw: release.manifest
|
|
71
|
+
};
|
|
72
|
+
}
|
|
52
73
|
});
|
|
53
74
|
RegistryExtensionSchema.virtual('id').get(function () {
|
|
54
75
|
return this._id.toHexString();
|
|
@@ -59,4 +80,4 @@ RegistryExtensionSchema.set('toJSON', {
|
|
|
59
80
|
RegistryExtensionSchema.set('toObject', {
|
|
60
81
|
virtuals: true
|
|
61
82
|
});
|
|
62
|
-
const RegistryExtensionModelFunc = db => db.model(
|
|
83
|
+
const RegistryExtensionModelFunc = db => db.model(DB_COLL_NAMES.ExtensionRegistries, RegistryExtensionSchema);export{RegistryExtensionModelFunc};//# sourceMappingURL=registry-extension-model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry-extension-model.js","sources":[
|
|
1
|
+
{"version":3,"file":"registry-extension-model.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/store/repositories/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { CdmLogger } from '@cdm-logger/core';
|
|
2
|
+
import { IInstalledExtensionModel, ICreateInstalledExtensionInput, IUpdateInstalledExtensionInput, IInstalledExtensionFilter, IInstalledExtensionRepository, AsDomainType } from 'common/server';
|
|
3
|
+
import { BaseMongoRepository } from '@common-stack/store-mongo';
|
|
4
|
+
import * as mongoose from 'mongoose';
|
|
5
|
+
export declare class InstalledExtensionRepository extends BaseMongoRepository<IInstalledExtensionModel> implements IInstalledExtensionRepository {
|
|
6
|
+
constructor(db: mongoose.Connection, logger: CdmLogger.ILogger, options?: any);
|
|
7
|
+
findByTenantAndId(tenantId: string, extensionSlug: string): Promise<AsDomainType<IInstalledExtensionModel> | null>;
|
|
8
|
+
countExtensions(filter: IInstalledExtensionFilter): Promise<number>;
|
|
9
|
+
/**
|
|
10
|
+
* Create a new installed extension record
|
|
11
|
+
*/
|
|
12
|
+
createExtension(input: ICreateInstalledExtensionInput): Promise<AsDomainType<IInstalledExtensionModel>>;
|
|
13
|
+
/**
|
|
14
|
+
* Update an existing installed extension
|
|
15
|
+
*/
|
|
16
|
+
updateExtension(tenantId: string, extensionSlug: string, update: IUpdateInstalledExtensionInput): Promise<AsDomainType<IInstalledExtensionModel> | null>;
|
|
17
|
+
/**
|
|
18
|
+
* Find a specific installed extension
|
|
19
|
+
*/
|
|
20
|
+
findOne(tenantId: string, extensionSlug: string): Promise<AsDomainType<IInstalledExtensionModel> | null>;
|
|
21
|
+
/**
|
|
22
|
+
* Find installed extensions with optional filtering
|
|
23
|
+
*/
|
|
24
|
+
findExtensions(query: IInstalledExtensionFilter): Promise<AsDomainType<IInstalledExtensionModel>[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Delete an installed extension
|
|
27
|
+
*/
|
|
28
|
+
deleteExtension(tenantId: string, extensionSlug: string): Promise<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* Get installed extensions joined with registry information
|
|
31
|
+
*/
|
|
32
|
+
findWithRegistryInfo(query: IInstalledExtensionFilter): Promise<any[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Check if extension exists for tenant
|
|
35
|
+
*/
|
|
36
|
+
exists(tenantId: string, extensionSlug: string): Promise<boolean>;
|
|
37
|
+
/**
|
|
38
|
+
* Bulk update multiple extensions
|
|
39
|
+
*/
|
|
40
|
+
bulkUpdateExtensions(tenantId: string, filter: Partial<IInstalledExtensionFilter>, update: Partial<IUpdateInstalledExtensionInput>): Promise<number>;
|
|
41
|
+
/**
|
|
42
|
+
* Get extension dependency graph for a tenant
|
|
43
|
+
*/
|
|
44
|
+
getDependencyGraph(tenantId: string): Promise<{
|
|
45
|
+
extensions: AsDomainType<IInstalledExtensionModel>[];
|
|
46
|
+
dependencies: Array<{
|
|
47
|
+
extensionSlug: string;
|
|
48
|
+
dependsOn: string[];
|
|
49
|
+
dependents: string[];
|
|
50
|
+
}>;
|
|
51
|
+
}>;
|
|
52
|
+
/**
|
|
53
|
+
* Count installed extensions matching query
|
|
54
|
+
*/
|
|
55
|
+
count(query: IInstalledExtensionFilter): Promise<number>;
|
|
56
|
+
/**
|
|
57
|
+
* Find extensions that need registry sync
|
|
58
|
+
*/
|
|
59
|
+
findStaleExtensions(tenantId: string, maxAge: number): Promise<AsDomainType<IInstalledExtensionModel>[]>;
|
|
60
|
+
/**
|
|
61
|
+
* Update registry status for multiple extensions
|
|
62
|
+
*/
|
|
63
|
+
syncRegistryStatus(updates: Array<{
|
|
64
|
+
tenantId: string;
|
|
65
|
+
extensionSlug: string;
|
|
66
|
+
registryStatus: string;
|
|
67
|
+
latestVersion?: string;
|
|
68
|
+
isOrphaned: boolean;
|
|
69
|
+
}>): Promise<void>;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=installed-extension-repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installed-extension-repository.d.ts","sourceRoot":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