@omnia/tooling-composers 8.0.347-dev → 8.0.349-dev
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/internal-do-not-import-from-here/Composer.d.ts +2 -1
- package/internal-do-not-import-from-here/Composer.js +2 -2
- package/internal-do-not-import-from-here/ServiceFeatureComposer.d.ts +24 -7
- package/internal-do-not-import-from-here/ServiceFeatureComposer.js +87 -0
- package/internal-do-not-import-from-here/ServiceFeatureRegistry.d.ts +4 -2
- package/internal-do-not-import-from-here/ServiceFeatureRegistry.js +9 -20
- package/internal-do-not-import-from-here/models/ServerManifests.d.ts +5 -0
- package/package.json +3 -3
|
@@ -6,6 +6,7 @@ import { IManifestGroupComposer } from "./ManifestGroupComposer";
|
|
|
6
6
|
import { IRegisterService } from './ServiceComposer';
|
|
7
7
|
import { guid } from '../../fx-models';
|
|
8
8
|
import { IClientServiceConfigurator } from '.';
|
|
9
|
+
import { IServiceFeatureComposer } from "./ServiceFeatureComposer";
|
|
9
10
|
export interface IComposerDone<T> {
|
|
10
11
|
done: () => T;
|
|
11
12
|
}
|
|
@@ -41,7 +42,7 @@ export interface INewManifestComposer extends IRegisterService {
|
|
|
41
42
|
* @param lcid the language..
|
|
42
43
|
*/
|
|
43
44
|
registerLocalization: (localizationOptions?: LocalizationOptions) => ILocalizationComposer;
|
|
44
|
-
registerFeature: (options: ServiceFeatureOption) =>
|
|
45
|
+
registerFeature: (options: ServiceFeatureOption) => IServiceFeatureComposer;
|
|
45
46
|
registerAppDefinition: (options: ServiceAppDefinitionOption) => void;
|
|
46
47
|
registerRoleDefinition: (option: ServiceRoleDefinitionOption) => void;
|
|
47
48
|
}
|
|
@@ -8,11 +8,11 @@ const LocalizationComposer_1 = require("./LocalizationComposer");
|
|
|
8
8
|
const Utils_1 = require("./Utils");
|
|
9
9
|
const ManifestGroupComposer_1 = require("./ManifestGroupComposer");
|
|
10
10
|
const ServiceComposer_1 = require("./ServiceComposer");
|
|
11
|
-
const ServiceFeatureRegistry_1 = require("./ServiceFeatureRegistry");
|
|
12
11
|
const ServiceAppRegistry_1 = require("./ServiceAppRegistry");
|
|
13
12
|
const ServiceRoleRegistry_1 = require("./ServiceRoleRegistry");
|
|
14
13
|
const ImportManifestRegistry_1 = require("./ImportManifestRegistry");
|
|
15
14
|
const _1 = require(".");
|
|
15
|
+
const ServiceFeatureComposer_1 = require("./ServiceFeatureComposer");
|
|
16
16
|
class NewManifestComposer {
|
|
17
17
|
constructor(manifestId, manifestName) {
|
|
18
18
|
this.manifestId = manifestId;
|
|
@@ -30,7 +30,7 @@ class NewManifestComposer {
|
|
|
30
30
|
return new LocalizationComposer_1.Localization(localizationOptions, this.manifestId);
|
|
31
31
|
};
|
|
32
32
|
this.registerFeature = (options) => {
|
|
33
|
-
|
|
33
|
+
return new ServiceFeatureComposer_1.ServiceFeatureComposer(this.manifestId, options);
|
|
34
34
|
};
|
|
35
35
|
this.registerAppDefinition = (options) => {
|
|
36
36
|
ServiceAppRegistry_1.ServiceAppRegistry.AddAppDefinition(this.manifestId, options);
|
|
@@ -1,9 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { guid } from '@omnia/fx-models';
|
|
2
|
+
import { IServiceManifestComposer } from './ServiceManifestComposer';
|
|
3
|
+
import { OnTheFlyServiceRequest, PersistentDiskResourceOption, ServiceFeatureOption, SqlElasticPoolResourceOption, SqlResourceOption } from './models/index';
|
|
4
|
+
export interface IServiceFeatureComposer extends Omit<IServiceManifestComposer<IServiceFeatureComposer>, "requireAzureAdAppPermissions" | "isOnTheFlyService"> {
|
|
5
|
+
requestOnTheFlyService: (onTheFlyService: OnTheFlyServiceRequest) => IServiceFeatureComposer;
|
|
6
|
+
}
|
|
7
|
+
export declare class ServiceFeatureComposer implements IServiceFeatureComposer {
|
|
8
|
+
private featureId;
|
|
9
|
+
private option;
|
|
10
|
+
constructor(featureId: guid, option: ServiceFeatureOption);
|
|
11
|
+
private AddFeature;
|
|
12
|
+
/**
|
|
13
|
+
* Request an SQL database when feature activated
|
|
14
|
+
*/
|
|
15
|
+
requestSqlDatabase: (options: SqlResourceOption) => this;
|
|
16
|
+
/**
|
|
17
|
+
* Request a Persistent Disk for storing files when feature activated
|
|
18
|
+
*/
|
|
19
|
+
requestPersistentDisk: (options: PersistentDiskResourceOption) => this;
|
|
3
20
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
21
|
+
* Request an SQL database using shared Elastic Pool when feature activated
|
|
22
|
+
*/
|
|
23
|
+
requestSqlElasticPoolDatabase: (options: SqlElasticPoolResourceOption) => this;
|
|
24
|
+
requestOnTheFlyService: (onTheFlyService: OnTheFlyServiceRequest) => this;
|
|
25
|
+
private addRequestedResource;
|
|
9
26
|
}
|
|
@@ -1,2 +1,89 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ServiceFeatureComposer = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const fx_models_1 = require("@omnia/fx-models");
|
|
6
|
+
const AzureAdAppPermissionHelper_1 = require("./AzureAdAppPermissionHelper");
|
|
7
|
+
const ManifestRegistry_1 = require("./ManifestRegistry");
|
|
8
|
+
const ServiceFeatureRegistry_1 = require("./ServiceFeatureRegistry");
|
|
9
|
+
const index_1 = require("./models/index");
|
|
10
|
+
const deep_extend_1 = tslib_1.__importDefault(require("deep-extend"));
|
|
11
|
+
class ServiceFeatureComposer {
|
|
12
|
+
constructor(featureId, option) {
|
|
13
|
+
this.featureId = featureId;
|
|
14
|
+
this.option = option;
|
|
15
|
+
this.AddFeature = (featureId, option) => {
|
|
16
|
+
let manifest = {
|
|
17
|
+
manifestType: index_1.ServerManifestTypes.ServiceFeature
|
|
18
|
+
};
|
|
19
|
+
let featureManifest = (0, deep_extend_1.default)(manifest, option);
|
|
20
|
+
featureManifest.uniqueId = featureId;
|
|
21
|
+
featureManifest.requiresAzureAdAppPermissions = AzureAdAppPermissionHelper_1.AzureAdAppPermissionHelper.getAzureAdAppPermissions(option.requiresAzureAdAppPermissions);
|
|
22
|
+
ServiceFeatureRegistry_1.ServiceFeatureRegistry.AddFeatureManifest(featureManifest);
|
|
23
|
+
return this;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Request an SQL database when feature activated
|
|
27
|
+
*/
|
|
28
|
+
this.requestSqlDatabase = (options) => {
|
|
29
|
+
let manifest = {
|
|
30
|
+
manifestType: index_1.ServerManifestTypes.ResourceRequest,
|
|
31
|
+
resourceType: index_1.RequestedResourceTypes.SqlDatabase
|
|
32
|
+
};
|
|
33
|
+
const sqlResourceManifest = (0, deep_extend_1.default)(manifest, options);
|
|
34
|
+
this.addRequestedResource(sqlResourceManifest, this.featureId);
|
|
35
|
+
return this;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Request a Persistent Disk for storing files when feature activated
|
|
39
|
+
*/
|
|
40
|
+
this.requestPersistentDisk = (options) => {
|
|
41
|
+
const manifest = {
|
|
42
|
+
manifestType: index_1.ServerManifestTypes.ResourceRequest,
|
|
43
|
+
resourceType: index_1.RequestedResourceTypes.PersistentDisk
|
|
44
|
+
};
|
|
45
|
+
const persistentDiskResourceManifest = (0, deep_extend_1.default)(manifest, options);
|
|
46
|
+
this.addRequestedResource(persistentDiskResourceManifest, this.featureId);
|
|
47
|
+
return this;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Request an SQL database using shared Elastic Pool when feature activated
|
|
51
|
+
*/
|
|
52
|
+
this.requestSqlElasticPoolDatabase = (options) => {
|
|
53
|
+
const manifest = {
|
|
54
|
+
manifestType: index_1.ServerManifestTypes.ResourceRequest,
|
|
55
|
+
resourceType: index_1.RequestedResourceTypes.SqlElasticPoolDatabase
|
|
56
|
+
};
|
|
57
|
+
const sqlElasticPoolResourceManifest = (0, deep_extend_1.default)(manifest, options);
|
|
58
|
+
this.addRequestedResource(sqlElasticPoolResourceManifest, this.featureId);
|
|
59
|
+
return this;
|
|
60
|
+
};
|
|
61
|
+
this.requestOnTheFlyService = (onTheFlyService) => {
|
|
62
|
+
const featureManifest = ServiceFeatureRegistry_1.ServiceFeatureRegistry.GetFeatureManifest(this.featureId);
|
|
63
|
+
if (!Array.isArray(featureManifest.requestedOnTheFlyServices)) {
|
|
64
|
+
featureManifest.requestedOnTheFlyServices = [];
|
|
65
|
+
}
|
|
66
|
+
const existed = featureManifest.requestedOnTheFlyServices.find(x => x.serviceId.toString() === onTheFlyService.serviceId.toString());
|
|
67
|
+
if (existed) {
|
|
68
|
+
throw new Error(`On the fly service with id ${onTheFlyService.serviceId} has already been added to the feature.`);
|
|
69
|
+
}
|
|
70
|
+
featureManifest.requestedOnTheFlyServices.push(onTheFlyService);
|
|
71
|
+
return this;
|
|
72
|
+
};
|
|
73
|
+
if (featureId == fx_models_1.emptyGuid) {
|
|
74
|
+
throw new Error("Can't add feature with id: Guid.empty. See manifest file: " + ManifestRegistry_1.ManifestRegistry.getCurrentManifestPath());
|
|
75
|
+
}
|
|
76
|
+
if (ServiceFeatureRegistry_1.ServiceFeatureRegistry.FeatureExisted[featureId.toString()]) {
|
|
77
|
+
throw new Error("Can't add feature id " + featureId + ", a feature with the same id has already been added. See manifest file: " + ManifestRegistry_1.ManifestRegistry.getCurrentManifestPath());
|
|
78
|
+
}
|
|
79
|
+
this.AddFeature(featureId, option);
|
|
80
|
+
}
|
|
81
|
+
addRequestedResource(requestedResourceManifest, featureId) {
|
|
82
|
+
const featureManifest = ServiceFeatureRegistry_1.ServiceFeatureRegistry.GetFeatureManifest(featureId);
|
|
83
|
+
if (!Array.isArray(featureManifest.requestedResources)) {
|
|
84
|
+
featureManifest.requestedResources = [];
|
|
85
|
+
}
|
|
86
|
+
featureManifest.requestedResources.push(requestedResourceManifest);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.ServiceFeatureComposer = ServiceFeatureComposer;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ServiceFeatureManifest } from './models/index';
|
|
2
2
|
import { guid } from '../../fx-models';
|
|
3
3
|
export declare class ServiceFeatureRegistry {
|
|
4
4
|
private static AddedFeatures;
|
|
5
|
-
static
|
|
5
|
+
static FeatureExisted(featureId: guid): boolean;
|
|
6
|
+
static AddFeatureManifest(featureManifest: ServiceFeatureManifest): void;
|
|
7
|
+
static GetFeatureManifest(featureId: guid): ServiceFeatureManifest;
|
|
6
8
|
private static getServerManifests;
|
|
7
9
|
private static clearState;
|
|
8
10
|
private static ServerSubscription;
|
|
@@ -1,29 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ServiceFeatureRegistry = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const index_1 = require("./models/index");
|
|
6
4
|
const ManifestRegistry_1 = require("./ManifestRegistry");
|
|
7
|
-
const deep_extend_1 = tslib_1.__importDefault(require("deep-extend"));
|
|
8
|
-
const models_1 = require("../../fx-models");
|
|
9
|
-
const AzureAdAppPermissionHelper_1 = require("./AzureAdAppPermissionHelper");
|
|
10
5
|
class ServiceFeatureRegistry {
|
|
11
6
|
static { this.AddedFeatures = {}; }
|
|
12
|
-
static
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
let featureManifest = (0, deep_extend_1.default)(manifest, option);
|
|
23
|
-
featureManifest.uniqueId = featureId;
|
|
24
|
-
featureManifest.requiresAzureAdAppPermissions = AzureAdAppPermissionHelper_1.AzureAdAppPermissionHelper.getAzureAdAppPermissions(option.requiresAzureAdAppPermissions);
|
|
25
|
-
ServiceFeatureRegistry.AddedFeatures[featureId.toString()] = featureManifest;
|
|
26
|
-
}; }
|
|
7
|
+
static FeatureExisted(featureId) {
|
|
8
|
+
return ServiceFeatureRegistry.AddedFeatures[featureId.toString()] != null;
|
|
9
|
+
}
|
|
10
|
+
static AddFeatureManifest(featureManifest) {
|
|
11
|
+
ServiceFeatureRegistry.AddedFeatures[featureManifest.uniqueId.toString()] = featureManifest;
|
|
12
|
+
}
|
|
13
|
+
static GetFeatureManifest(featureId) {
|
|
14
|
+
return ServiceFeatureRegistry.AddedFeatures[featureId.toString()];
|
|
15
|
+
}
|
|
27
16
|
static { this.getServerManifests = (currentServiceId) => {
|
|
28
17
|
let serverManifests = new Array();
|
|
29
18
|
for (let key in ServiceFeatureRegistry.AddedFeatures) {
|
|
@@ -88,9 +88,14 @@ export interface ServiceFeatureOption {
|
|
|
88
88
|
*/
|
|
89
89
|
configuration?: IFeatureConfiguration;
|
|
90
90
|
}
|
|
91
|
+
export interface OnTheFlyServiceRequest {
|
|
92
|
+
serviceId: guid;
|
|
93
|
+
}
|
|
91
94
|
export interface ServiceFeatureManifest extends Omit<ServiceFeatureOption, 'requiresAzureAdAppPermissions'>, ServerManifest {
|
|
92
95
|
uniqueId: guid;
|
|
93
96
|
requiresAzureAdAppPermissions?: AzureAdAppPermissionInfo[];
|
|
97
|
+
requestedResources?: RequestedResourceManifest[];
|
|
98
|
+
requestedOnTheFlyServices?: OnTheFlyServiceRequest[];
|
|
94
99
|
}
|
|
95
100
|
export interface AppResourceType {
|
|
96
101
|
id: guid;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omnia/tooling-composers",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "8.0.
|
|
4
|
+
"version": "8.0.349-dev",
|
|
5
5
|
"description": "Provide tooling to work with manifest things.",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
],
|
|
20
20
|
"author": "Omnia Digital Workplace AB",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@omnia/fx-models": "8.0.
|
|
23
|
-
"@omnia/tooling": "8.0.
|
|
22
|
+
"@omnia/fx-models": "8.0.349-dev",
|
|
23
|
+
"@omnia/tooling": "8.0.349-dev",
|
|
24
24
|
"deep-extend": "0.6.0",
|
|
25
25
|
"fs-extra": "11.1.0",
|
|
26
26
|
"del": "6.0.0",
|