@extrahorizon/exh-cli 1.13.0-dev-165-dcc70f3 → 1.13.0-dev-170-ebde5f5
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/build/commands/settings/sync.d.ts +5 -0
- package/build/commands/settings/sync.js +15 -0
- package/build/commands/settings.d.ts +5 -0
- package/build/commands/settings.js +10 -0
- package/build/commands/sync.d.ts +8 -1
- package/build/commands/sync.js +7 -1
- package/build/config-json-schemas/SettingsConfig.json +123 -0
- package/build/repositories/files.d.ts +2 -0
- package/build/repositories/files.js +8 -0
- package/build/repositories/user.d.ts +4 -1
- package/build/repositories/user.js +13 -1
- package/build/services/settings/index.d.ts +1 -0
- package/build/services/settings/index.js +5 -0
- package/build/services/settings/sync.d.ts +1 -0
- package/build/services/settings/sync.js +88 -0
- package/build/services/settings/util/readServiceSettingsFile.d.ts +19 -0
- package/build/services/settings/util/readServiceSettingsFile.js +19 -0
- package/build/services/sync.d.ts +2 -1
- package/build/services/sync.js +14 -2
- package/package.json +2 -2
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Argv } from 'yargs';
|
|
2
|
+
export declare const command = "sync";
|
|
3
|
+
export declare const desc = "Synchronize Service Settings";
|
|
4
|
+
export declare const builder: (yargs: Argv) => Argv<import("yargs").Omit<{}, never> & import("yargs").InferredOptionTypes<{}>>;
|
|
5
|
+
export declare const handler: () => Promise<void>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handler = exports.builder = exports.desc = exports.command = void 0;
|
|
4
|
+
const path = require("node:path");
|
|
5
|
+
const util_1 = require("../../helpers/util");
|
|
6
|
+
const serviceSettingService = require("../../services/settings");
|
|
7
|
+
exports.command = 'sync';
|
|
8
|
+
exports.desc = 'Synchronize Service Settings';
|
|
9
|
+
const builder = (yargs) => (0, util_1.epilogue)(yargs).options({});
|
|
10
|
+
exports.builder = builder;
|
|
11
|
+
const handler = async () => {
|
|
12
|
+
const filePath = path.join(process.cwd(), 'service-settings.json');
|
|
13
|
+
await serviceSettingService.sync(filePath);
|
|
14
|
+
};
|
|
15
|
+
exports.handler = handler;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handler = exports.builder = exports.desc = exports.command = void 0;
|
|
4
|
+
const util_1 = require("../helpers/util");
|
|
5
|
+
exports.command = 'settings <command>';
|
|
6
|
+
exports.desc = 'Manage Service Settings within Extra Horizon';
|
|
7
|
+
const builder = (yargs) => (0, util_1.epilogue)(yargs).commandDir('settings');
|
|
8
|
+
exports.builder = builder;
|
|
9
|
+
const handler = () => { };
|
|
10
|
+
exports.handler = handler;
|
package/build/commands/sync.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="yargs" />
|
|
2
2
|
export declare const command = "sync";
|
|
3
3
|
export declare const desc = "Sync your ExH configuration to the cloud environment";
|
|
4
|
-
export declare const builder: (yargs: any) => import("yargs").Argv<import("yargs").Omit<{}, "path" | "schemas" | "dispatchers" | "tasks" | "templates" | "localizations" | "cleanDispatchers" | "ignoreSchemaVerificationErrors"> & import("yargs").InferredOptionTypes<{
|
|
4
|
+
export declare const builder: (yargs: any) => import("yargs").Argv<import("yargs").Omit<{}, "path" | "settings" | "schemas" | "dispatchers" | "tasks" | "templates" | "localizations" | "cleanDispatchers" | "ignoreSchemaVerificationErrors"> & import("yargs").InferredOptionTypes<{
|
|
5
5
|
path: {
|
|
6
6
|
demandOption: false;
|
|
7
7
|
describe: string;
|
|
@@ -42,6 +42,12 @@ export declare const builder: (yargs: any) => import("yargs").Argv<import("yargs
|
|
|
42
42
|
type: "boolean";
|
|
43
43
|
default: boolean;
|
|
44
44
|
};
|
|
45
|
+
settings: {
|
|
46
|
+
demandOption: false;
|
|
47
|
+
describe: string;
|
|
48
|
+
type: "boolean";
|
|
49
|
+
default: boolean;
|
|
50
|
+
};
|
|
45
51
|
ignoreSchemaVerificationErrors: {
|
|
46
52
|
demandOption: false;
|
|
47
53
|
describe: string;
|
|
@@ -57,5 +63,6 @@ export declare const handler: (options: {
|
|
|
57
63
|
dispatchers?: boolean;
|
|
58
64
|
cleanDispatchers?: boolean;
|
|
59
65
|
localizations?: boolean;
|
|
66
|
+
settings?: boolean;
|
|
60
67
|
ignoreSchemaVerificationErrors?: boolean;
|
|
61
68
|
}) => Promise<void>;
|
package/build/commands/sync.js
CHANGED
|
@@ -12,7 +12,7 @@ const builder = (yargs) => (0, util_1.epilogue)(yargs)
|
|
|
12
12
|
.options({
|
|
13
13
|
path: {
|
|
14
14
|
demandOption: false,
|
|
15
|
-
describe: `Path to folder which needs to be synchronized. The target folder should contain a ${repoConfig_1.REPO_CONFIG_FILE} file.
|
|
15
|
+
describe: `Path to folder which needs to be synchronized. The target folder should contain a ${repoConfig_1.REPO_CONFIG_FILE} file.
|
|
16
16
|
If not, the local directory is assumed with a default configuration which assumes tasks are in a 'tasks' folder, schemas in a 'schemas' folder, etc...`,
|
|
17
17
|
type: 'string',
|
|
18
18
|
},
|
|
@@ -51,6 +51,12 @@ If not, the local directory is assumed with a default configuration which assume
|
|
|
51
51
|
type: 'boolean',
|
|
52
52
|
default: false,
|
|
53
53
|
},
|
|
54
|
+
settings: {
|
|
55
|
+
demandOption: false,
|
|
56
|
+
describe: 'Sync service settings only',
|
|
57
|
+
type: 'boolean',
|
|
58
|
+
default: false,
|
|
59
|
+
},
|
|
54
60
|
ignoreSchemaVerificationErrors: {
|
|
55
61
|
demandOption: false,
|
|
56
62
|
describe: 'Allow schema synchronization to proceed with validation errors.',
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"additionalProperties": false,
|
|
5
|
+
"properties": {
|
|
6
|
+
"$schema": {
|
|
7
|
+
"type": "string"
|
|
8
|
+
},
|
|
9
|
+
"users": {
|
|
10
|
+
"type": "object",
|
|
11
|
+
"additionalProperties": false,
|
|
12
|
+
"properties": {
|
|
13
|
+
"passwordPolicy": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"additionalProperties": false,
|
|
16
|
+
"properties": {
|
|
17
|
+
"minimumLength": {
|
|
18
|
+
"description": "The minimum number of characters required in a password.",
|
|
19
|
+
"type": "integer",
|
|
20
|
+
"minimum": 3
|
|
21
|
+
},
|
|
22
|
+
"maximumLength": {
|
|
23
|
+
"description": "The maximum number of characters allowed in a password.",
|
|
24
|
+
"type": "integer",
|
|
25
|
+
"minimum": 3
|
|
26
|
+
},
|
|
27
|
+
"numberRequired": {
|
|
28
|
+
"description": "A password must contain at least one numeric character (0-9).",
|
|
29
|
+
"type": "boolean"
|
|
30
|
+
},
|
|
31
|
+
"symbolRequired": {
|
|
32
|
+
"description": "A password must contain at least one symbol (~`!@#$%^&*()_-+={[}]|\\:;\"'<,>.?/).",
|
|
33
|
+
"type": "boolean"
|
|
34
|
+
},
|
|
35
|
+
"upperCaseRequired": {
|
|
36
|
+
"description": "A password must contain at least one uppercase letter (A-Z).",
|
|
37
|
+
"type": "boolean"
|
|
38
|
+
},
|
|
39
|
+
"lowerCaseRequired": {
|
|
40
|
+
"description": "A password must contain at least one lowercase letter (a-z).",
|
|
41
|
+
"type": "boolean"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"emailTemplates": {
|
|
46
|
+
"type": "object",
|
|
47
|
+
"additionalProperties": false,
|
|
48
|
+
"properties": {
|
|
49
|
+
"activationEmailTemplateName": {
|
|
50
|
+
"description": "The name of the email template used for account activation emails.",
|
|
51
|
+
"type": "string",
|
|
52
|
+
"minLength": 1
|
|
53
|
+
},
|
|
54
|
+
"reactivationEmailTemplateName": {
|
|
55
|
+
"description": "The name of the email template used for account reactivation emails.",
|
|
56
|
+
"type": "string",
|
|
57
|
+
"minLength": 1
|
|
58
|
+
},
|
|
59
|
+
"passwordResetEmailTemplateName": {
|
|
60
|
+
"description": "The name of the email template used for password reset emails.",
|
|
61
|
+
"type": "string",
|
|
62
|
+
"minLength": 1
|
|
63
|
+
},
|
|
64
|
+
"oidcUnlinkEmailTemplateName": {
|
|
65
|
+
"description": "The name of the email template used for OIDC unlinking emails.",
|
|
66
|
+
"type": "string",
|
|
67
|
+
"minLength": 1
|
|
68
|
+
},
|
|
69
|
+
"oidcUnlinkPinEmailTemplateName": {
|
|
70
|
+
"description": "The name of the email template used for OIDC unlinking PIN emails.",
|
|
71
|
+
"type": "string",
|
|
72
|
+
"minLength": 1
|
|
73
|
+
},
|
|
74
|
+
"activationPinEmailTemplateName": {
|
|
75
|
+
"description": "The name of the email template used for account activation PIN emails.",
|
|
76
|
+
"type": "string",
|
|
77
|
+
"minLength": 1
|
|
78
|
+
},
|
|
79
|
+
"reactivationPinEmailTemplateName": {
|
|
80
|
+
"description": "The name of the email template used for account reactivation PIN emails.",
|
|
81
|
+
"type": "string",
|
|
82
|
+
"minLength": 1
|
|
83
|
+
},
|
|
84
|
+
"passwordResetPinEmailTemplateName": {
|
|
85
|
+
"description": "The name of the email template used for password reset PIN emails.",
|
|
86
|
+
"type": "string",
|
|
87
|
+
"minLength": 1
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"verification": {
|
|
92
|
+
"type": "object",
|
|
93
|
+
"additionalProperties": false,
|
|
94
|
+
"properties": {
|
|
95
|
+
"enablePinCodeActivationRequests": {
|
|
96
|
+
"description": "A PIN code can be used for account activation instead of an activation link.",
|
|
97
|
+
"type": "boolean"
|
|
98
|
+
},
|
|
99
|
+
"enablePinCodeForgotPasswordRequests": {
|
|
100
|
+
"description": "A PIN code can be used for password reset requests instead of a password reset link.",
|
|
101
|
+
"type": "boolean"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"files": {
|
|
108
|
+
"type": "object",
|
|
109
|
+
"additionalProperties": false,
|
|
110
|
+
"properties": {
|
|
111
|
+
"disableForceDownloadForMimeTypes": {
|
|
112
|
+
"description": "All files will have a Content-Disposition header with the Attachment value when fetched, unless their MIME type matches a type in this array exactly. The Attachment value ensures files are downloaded rather than displayed directly in the browser, enhancing protection against potential XSS vulnerabilities. The value */* can be used to allow any file to be displayed by browsers, use at your own discretion.",
|
|
113
|
+
"type": "array",
|
|
114
|
+
"items": {
|
|
115
|
+
"type": "string",
|
|
116
|
+
"minLength": 3,
|
|
117
|
+
"maxLength": 255
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateFileServiceSettings = void 0;
|
|
4
|
+
const exh_1 = require("../exh");
|
|
5
|
+
async function updateFileServiceSettings(settings) {
|
|
6
|
+
return await (0, exh_1.getSdk)().files.settings.update(settings);
|
|
7
|
+
}
|
|
8
|
+
exports.updateFileServiceSettings = updateFileServiceSettings;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RegisterUserData } from '@extrahorizon/javascript-sdk';
|
|
1
|
+
import { EmailTemplates, PasswordPolicy, RegisterUserData, VerificationSettings } from '@extrahorizon/javascript-sdk';
|
|
2
2
|
export declare function findUserByEmail(email: string): Promise<import("@extrahorizon/javascript-sdk").UserData>;
|
|
3
3
|
export declare function isEmailAvailable(email: string): Promise<boolean>;
|
|
4
4
|
export declare function createUser(data: RegisterUserData): Promise<import("@extrahorizon/javascript-sdk").UserData>;
|
|
@@ -7,3 +7,6 @@ export declare function createGlobalRole(name: string, description: string): Pro
|
|
|
7
7
|
export declare function addPermissionsToGlobalRole(name: string, permissions: string[]): Promise<import("@extrahorizon/javascript-sdk").AffectedRecords>;
|
|
8
8
|
export declare function removePermissionsFromGlobalRole(name: string, permissions: string[]): Promise<import("@extrahorizon/javascript-sdk").AffectedRecords>;
|
|
9
9
|
export declare function addGlobalRoleToUser(userId: string, roleId: string): Promise<import("@extrahorizon/javascript-sdk").AffectedRecords>;
|
|
10
|
+
export declare function updateVerificationSettings(settings: Partial<VerificationSettings>): Promise<VerificationSettings>;
|
|
11
|
+
export declare function updateEmailTemplates(emailTemplates: Partial<EmailTemplates>): Promise<EmailTemplates>;
|
|
12
|
+
export declare function updatePasswordPolicy(passwordPolicy: Partial<PasswordPolicy>): Promise<PasswordPolicy>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addGlobalRoleToUser = exports.removePermissionsFromGlobalRole = exports.addPermissionsToGlobalRole = exports.createGlobalRole = exports.findGlobalRoleByName = exports.createUser = exports.isEmailAvailable = exports.findUserByEmail = void 0;
|
|
3
|
+
exports.updatePasswordPolicy = exports.updateEmailTemplates = exports.updateVerificationSettings = exports.addGlobalRoleToUser = exports.removePermissionsFromGlobalRole = exports.addPermissionsToGlobalRole = exports.createGlobalRole = exports.findGlobalRoleByName = exports.createUser = exports.isEmailAvailable = exports.findUserByEmail = void 0;
|
|
4
4
|
const javascript_sdk_1 = require("@extrahorizon/javascript-sdk");
|
|
5
5
|
const exh_1 = require("../exh");
|
|
6
6
|
async function findUserByEmail(email) {
|
|
@@ -37,3 +37,15 @@ async function addGlobalRoleToUser(userId, roleId) {
|
|
|
37
37
|
return await (0, exh_1.getSdk)().users.globalRoles.addToUsers((0, javascript_sdk_1.rqlBuilder)().eq('id', userId).build(), { roles: [roleId] });
|
|
38
38
|
}
|
|
39
39
|
exports.addGlobalRoleToUser = addGlobalRoleToUser;
|
|
40
|
+
async function updateVerificationSettings(settings) {
|
|
41
|
+
return await (0, exh_1.getSdk)().users.settings.updateVerificationSettings(settings);
|
|
42
|
+
}
|
|
43
|
+
exports.updateVerificationSettings = updateVerificationSettings;
|
|
44
|
+
async function updateEmailTemplates(emailTemplates) {
|
|
45
|
+
return await (0, exh_1.getSdk)().users.setEmailTemplates(emailTemplates);
|
|
46
|
+
}
|
|
47
|
+
exports.updateEmailTemplates = updateEmailTemplates;
|
|
48
|
+
async function updatePasswordPolicy(passwordPolicy) {
|
|
49
|
+
return await (0, exh_1.getSdk)().users.updatePasswordPolicy(passwordPolicy);
|
|
50
|
+
}
|
|
51
|
+
exports.updatePasswordPolicy = updatePasswordPolicy;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { sync } from './sync';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sync(path: string): Promise<void>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sync = void 0;
|
|
4
|
+
const chalk_1 = require("chalk");
|
|
5
|
+
const files_1 = require("../../repositories/files");
|
|
6
|
+
const templateV2Repository = require("../../repositories/templatesV2");
|
|
7
|
+
const user_1 = require("../../repositories/user");
|
|
8
|
+
const readServiceSettingsFile_1 = require("./util/readServiceSettingsFile");
|
|
9
|
+
async function sync(path) {
|
|
10
|
+
console.log((0, chalk_1.yellow)('Syncing service settings'));
|
|
11
|
+
const serviceSettings = await (0, readServiceSettingsFile_1.readAndValidateServiceSettingsConfig)(path);
|
|
12
|
+
await syncUserSettings(serviceSettings?.users);
|
|
13
|
+
await syncFileServiceSettings(serviceSettings?.files);
|
|
14
|
+
console.log((0, chalk_1.green)('✓ Synced service settings'));
|
|
15
|
+
}
|
|
16
|
+
exports.sync = sync;
|
|
17
|
+
async function syncUserSettings(userServiceSettings) {
|
|
18
|
+
if (!userServiceSettings) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
console.group((0, chalk_1.blue)('Syncing user service settings:'));
|
|
22
|
+
await syncPasswordPolicy(userServiceSettings.passwordPolicy);
|
|
23
|
+
await syncEmailTemplates(userServiceSettings.emailTemplates);
|
|
24
|
+
await syncVerificationSettings(userServiceSettings.verification);
|
|
25
|
+
console.groupEnd();
|
|
26
|
+
console.log((0, chalk_1.green)('✓ Synced user service settings'));
|
|
27
|
+
}
|
|
28
|
+
async function syncFileServiceSettings(fileServiceSettings) {
|
|
29
|
+
if (!fileServiceSettings || Object.keys(fileServiceSettings).length === 0) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
console.group((0, chalk_1.blue)('Syncing file service Settings:'));
|
|
33
|
+
await (0, files_1.updateFileServiceSettings)(fileServiceSettings);
|
|
34
|
+
console.groupEnd();
|
|
35
|
+
console.log((0, chalk_1.green)('✓ Synced file service settings'));
|
|
36
|
+
}
|
|
37
|
+
async function syncPasswordPolicy(passwordPolicy) {
|
|
38
|
+
if (!passwordPolicy || Object.keys(passwordPolicy).length === 0) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
console.log((0, chalk_1.blue)('Syncing password policy'));
|
|
42
|
+
await (0, user_1.updatePasswordPolicy)(passwordPolicy);
|
|
43
|
+
console.log((0, chalk_1.green)('✓ Synced password policy'));
|
|
44
|
+
}
|
|
45
|
+
async function syncEmailTemplates(emailTemplateNames) {
|
|
46
|
+
if (!emailTemplateNames || Object.keys(emailTemplateNames).length === 0) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const emailTemplates = await convertEmailTemplateNamesToIds(emailTemplateNames);
|
|
50
|
+
if (Object.keys(emailTemplates).length === 0) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
console.log((0, chalk_1.blue)('Syncing email templates'));
|
|
54
|
+
await (0, user_1.updateEmailTemplates)(emailTemplates);
|
|
55
|
+
console.log((0, chalk_1.green)('✓ Synced email templates'));
|
|
56
|
+
}
|
|
57
|
+
async function syncVerificationSettings(verificationSettings) {
|
|
58
|
+
if (!verificationSettings || Object.keys(verificationSettings).length === 0) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
console.log((0, chalk_1.blue)('Syncing verification settings'));
|
|
62
|
+
await (0, user_1.updateVerificationSettings)(verificationSettings);
|
|
63
|
+
console.log((0, chalk_1.green)('✓ Synced verification settings'));
|
|
64
|
+
}
|
|
65
|
+
async function convertEmailTemplateNamesToIds(emailTemplateNames) {
|
|
66
|
+
const emailTemplates = {};
|
|
67
|
+
const templateNameIdMap = {
|
|
68
|
+
activationEmailTemplateName: 'activationEmailTemplateId',
|
|
69
|
+
reactivationEmailTemplateName: 'reactivationEmailTemplateId',
|
|
70
|
+
passwordResetEmailTemplateName: 'passwordResetEmailTemplateId',
|
|
71
|
+
oidcUnlinkEmailTemplateName: 'oidcUnlinkEmailTemplateId',
|
|
72
|
+
oidcUnlinkPinEmailTemplateName: 'oidcUnlinkPinEmailTemplateId',
|
|
73
|
+
activationPinEmailTemplateName: 'activationPinEmailTemplateId',
|
|
74
|
+
reactivationPinEmailTemplateName: 'reactivationPinEmailTemplateId',
|
|
75
|
+
passwordResetPinEmailTemplateName: 'passwordResetPinEmailTemplateId',
|
|
76
|
+
};
|
|
77
|
+
for (const [nameProperty, idProperty] of Object.entries(templateNameIdMap)) {
|
|
78
|
+
if (emailTemplateNames[nameProperty]) {
|
|
79
|
+
const template = await templateV2Repository.findByName(emailTemplateNames[nameProperty]);
|
|
80
|
+
if (!template) {
|
|
81
|
+
console.log((0, chalk_1.yellow)(`⚠️ Template with name "${emailTemplateNames[nameProperty]}" not found. Skipping ${idProperty}.`));
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
emailTemplates[idProperty] = template.id;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return emailTemplates;
|
|
88
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FileServiceSettingsUpdate, PasswordPolicy, VerificationSettings } from '@extrahorizon/javascript-sdk';
|
|
2
|
+
export interface ServiceSettingsFile {
|
|
3
|
+
users?: {
|
|
4
|
+
passwordPolicy?: Partial<PasswordPolicy>;
|
|
5
|
+
verification?: Partial<Pick<VerificationSettings, 'enablePinCodeActivationRequests' | 'enablePinCodeForgotPasswordRequests'>>;
|
|
6
|
+
emailTemplates?: Partial<{
|
|
7
|
+
activationEmailTemplateName: string;
|
|
8
|
+
reactivationEmailTemplateName: string;
|
|
9
|
+
passwordResetEmailTemplateName: string;
|
|
10
|
+
oidcUnlinkEmailTemplateName: string;
|
|
11
|
+
oidcUnlinkPinEmailTemplateName: string;
|
|
12
|
+
activationPinEmailTemplateName: string;
|
|
13
|
+
reactivationPinEmailTemplateName: string;
|
|
14
|
+
passwordResetPinEmailTemplateName: string;
|
|
15
|
+
}>;
|
|
16
|
+
};
|
|
17
|
+
files?: FileServiceSettingsUpdate;
|
|
18
|
+
}
|
|
19
|
+
export declare function readAndValidateServiceSettingsConfig(path: string): Promise<ServiceSettingsFile>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readAndValidateServiceSettingsConfig = void 0;
|
|
4
|
+
const promises_1 = require("fs/promises");
|
|
5
|
+
const serviceSettingsSchema = require("../../../config-json-schemas/SettingsConfig.json");
|
|
6
|
+
const util_1 = require("../../../helpers/util");
|
|
7
|
+
async function readAndValidateServiceSettingsConfig(path) {
|
|
8
|
+
let config;
|
|
9
|
+
try {
|
|
10
|
+
const buffer = await (0, promises_1.readFile)(path);
|
|
11
|
+
config = JSON.parse(buffer.toString());
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
throw new Error(`Failed to read Service Settings from ${path}: ${error.message}`);
|
|
15
|
+
}
|
|
16
|
+
(0, util_1.ajvValidate)(serviceSettingsSchema, config);
|
|
17
|
+
return config;
|
|
18
|
+
}
|
|
19
|
+
exports.readAndValidateServiceSettingsConfig = readAndValidateServiceSettingsConfig;
|
package/build/services/sync.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function sync({ path, schemas, tasks, templates, dispatchers, cleanDispatchers, localizations, ignoreSchemaVerificationErrors, }: {
|
|
1
|
+
export declare function sync({ path, schemas, tasks, templates, dispatchers, cleanDispatchers, localizations, settings, ignoreSchemaVerificationErrors, }: {
|
|
2
2
|
path?: string;
|
|
3
3
|
schemas?: boolean;
|
|
4
4
|
tasks?: boolean;
|
|
@@ -6,5 +6,6 @@ export declare function sync({ path, schemas, tasks, templates, dispatchers, cle
|
|
|
6
6
|
dispatchers?: boolean;
|
|
7
7
|
cleanDispatchers?: boolean;
|
|
8
8
|
localizations?: boolean;
|
|
9
|
+
settings?: boolean;
|
|
9
10
|
ignoreSchemaVerificationErrors?: boolean;
|
|
10
11
|
}): Promise<void>;
|
package/build/services/sync.js
CHANGED
|
@@ -8,12 +8,13 @@ const repoConfig_1 = require("../helpers/repoConfig");
|
|
|
8
8
|
const dispatcherService = require("../services/dispatchers");
|
|
9
9
|
const localizationService = require("../services/localizations");
|
|
10
10
|
const schemaService = require("../services/schemas");
|
|
11
|
+
const settingsService = require("../services/settings");
|
|
11
12
|
const taskService = require("../services/tasks");
|
|
12
13
|
const templateService = require("../services/templates");
|
|
13
|
-
async function sync({ path, schemas, tasks, templates, dispatchers, cleanDispatchers, localizations, ignoreSchemaVerificationErrors, }) {
|
|
14
|
+
async function sync({ path, schemas, tasks, templates, dispatchers, cleanDispatchers, localizations, settings, ignoreSchemaVerificationErrors, }) {
|
|
14
15
|
const targetPath = path || '.';
|
|
15
16
|
const cfg = await (0, repoConfig_1.getRepoConfig)(targetPath);
|
|
16
|
-
const syncAll = !(schemas || tasks || templates || dispatchers || localizations);
|
|
17
|
+
const syncAll = !(schemas || tasks || templates || dispatchers || localizations || settings);
|
|
17
18
|
if ((syncAll || schemas) && cfg.schemas) {
|
|
18
19
|
console.log(chalk.green('\n ⚙️ Syncing schemas ...'));
|
|
19
20
|
for (const schema of cfg.schemas) {
|
|
@@ -49,5 +50,16 @@ async function sync({ path, schemas, tasks, templates, dispatchers, cleanDispatc
|
|
|
49
50
|
console.log(chalk.yellow('Warning: dispatchers.json not found'));
|
|
50
51
|
}
|
|
51
52
|
}
|
|
53
|
+
if (syncAll || settings) {
|
|
54
|
+
const serviceSettingsPath = ospath.join(targetPath, 'service-settings.json');
|
|
55
|
+
const isValidPath = (0, fs_1.existsSync)(serviceSettingsPath);
|
|
56
|
+
if (isValidPath) {
|
|
57
|
+
console.log(chalk.green('\n ⚙️ Syncing service settings...'));
|
|
58
|
+
await settingsService.sync(serviceSettingsPath);
|
|
59
|
+
}
|
|
60
|
+
else if (settings) {
|
|
61
|
+
console.log(chalk.yellow('Warning: service-settings.json not found'));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
52
64
|
}
|
|
53
65
|
exports.sync = sync;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@extrahorizon/exh-cli",
|
|
3
|
-
"version": "1.13.0-dev-
|
|
3
|
+
"version": "1.13.0-dev-170-ebde5f5",
|
|
4
4
|
"main": "build/index.js",
|
|
5
5
|
"exports": "./build/index.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"typescript": "4.5.5"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@extrahorizon/javascript-sdk": "8.9.
|
|
44
|
+
"@extrahorizon/javascript-sdk": "8.9.1-dev-152-3f69109",
|
|
45
45
|
"ajv": "8.18.0",
|
|
46
46
|
"archiver": "^7.0.1",
|
|
47
47
|
"chalk": "^4.0.0",
|