keycloakify 11.5.4 → 11.6.1
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/bin/153.index.js +81 -28
- package/bin/{805.index.js → 174.index.js} +111 -2
- package/bin/{356.index.js → 300.index.js} +67 -29
- package/bin/{33.index.js → 568.index.js} +2 -113
- package/bin/615.index.js +1009 -0
- package/bin/653.index.js +53 -135
- package/bin/735.index.js +53 -24
- package/bin/854.index.js +1 -1
- package/bin/{573.index.js → 880.index.js} +155 -9
- package/bin/921.index.js +1 -1
- package/bin/initialize-admin-theme.d.ts +4 -0
- package/bin/main.js +22 -9
- package/bin/shared/addPostinstallScriptIfNotPresent.d.ts +10 -0
- package/bin/shared/customHandler.d.ts +1 -1
- package/bin/shared/customHandler.js.map +1 -1
- package/bin/tools/createObjectThatThrowsIfAccessed.d.ts +21 -0
- package/bin/tools/npmInstall.d.ts +1 -1
- package/package.json +13 -5
- package/src/bin/initialize-account-theme/initializeAccountTheme_singlePage.ts +3 -1
- package/src/bin/initialize-admin-theme.ts +146 -0
- package/src/bin/keycloakify/generateResources/generateResources.ts +162 -6
- package/src/bin/main.ts +19 -4
- package/src/bin/postinstall/getUiModuleFileSourceCodeReadyToBeCopied.ts +63 -24
- package/src/bin/postinstall/installUiModulesPeerDependencies.ts +1 -1
- package/src/bin/postinstall/uiModuleMeta.ts +7 -1
- package/src/bin/shared/addPostinstallScriptIfNotPresent.ts +70 -0
- package/src/bin/shared/customHandler.ts +1 -0
- package/src/bin/start-keycloak/realmConfig/defaultConfig/realm-kc-22.json +2201 -0
- package/src/bin/start-keycloak/start-keycloak.ts +131 -36
- package/src/bin/tools/createObjectThatThrowsIfAccessed.ts +90 -0
- package/src/bin/tools/npmInstall.ts +46 -9
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
|
-
exports.id =
|
3
|
-
exports.ids = [
|
2
|
+
exports.id = 880;
|
3
|
+
exports.ids = [880];
|
4
4
|
exports.modules = {
|
5
5
|
|
6
6
|
/***/ 73817:
|
@@ -314,7 +314,7 @@ function recastParseTs(filePath) {
|
|
314
314
|
|
315
315
|
/***/ }),
|
316
316
|
|
317
|
-
/***/
|
317
|
+
/***/ 59880:
|
318
318
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
319
319
|
|
320
320
|
// ESM COMPAT FLAG
|
@@ -788,6 +788,66 @@ var external_child_process_default = /*#__PURE__*/__webpack_require__.n(external
|
|
788
788
|
// EXTERNAL MODULE: ./node_modules/properties-parser/index.js
|
789
789
|
var properties_parser = __webpack_require__(44414);
|
790
790
|
var properties_parser_default = /*#__PURE__*/__webpack_require__.n(properties_parser);
|
791
|
+
;// CONCATENATED MODULE: ./dist/bin/tools/createObjectThatThrowsIfAccessed.js
|
792
|
+
const keyIsTrapped = "isTrapped_zSskDe9d";
|
793
|
+
class AccessError extends Error {
|
794
|
+
constructor(message) {
|
795
|
+
super(message);
|
796
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
797
|
+
}
|
798
|
+
}
|
799
|
+
function createObjectThatThrowsIfAccessed(params) {
|
800
|
+
const { debugMessage = "", isPropertyWhitelisted = () => false } = params !== null && params !== void 0 ? params : {};
|
801
|
+
const get = (...args) => {
|
802
|
+
const [, prop] = args;
|
803
|
+
if (isPropertyWhitelisted(prop)) {
|
804
|
+
return Reflect.get(...args);
|
805
|
+
}
|
806
|
+
if (prop === keyIsTrapped) {
|
807
|
+
return true;
|
808
|
+
}
|
809
|
+
throw new AccessError(`Cannot access ${String(prop)} yet ${debugMessage}`);
|
810
|
+
};
|
811
|
+
const trappedObject = new Proxy({}, {
|
812
|
+
get,
|
813
|
+
set: get
|
814
|
+
});
|
815
|
+
return trappedObject;
|
816
|
+
}
|
817
|
+
function createObjectThatThrowsIfAccessedFactory(params) {
|
818
|
+
const { isPropertyWhitelisted } = params;
|
819
|
+
return {
|
820
|
+
createObjectThatThrowsIfAccessed: (params) => {
|
821
|
+
const { debugMessage } = params !== null && params !== void 0 ? params : {};
|
822
|
+
return createObjectThatThrowsIfAccessed({
|
823
|
+
debugMessage,
|
824
|
+
isPropertyWhitelisted
|
825
|
+
});
|
826
|
+
}
|
827
|
+
};
|
828
|
+
}
|
829
|
+
function isObjectThatThrowIfAccessed(obj) {
|
830
|
+
return obj[keyIsTrapped] === true;
|
831
|
+
}
|
832
|
+
const THROW_IF_ACCESSED = {
|
833
|
+
__brand: "THROW_IF_ACCESSED"
|
834
|
+
};
|
835
|
+
function createObjectWithSomePropertiesThatThrowIfAccessed(obj, debugMessage) {
|
836
|
+
return Object.defineProperties(obj, Object.fromEntries(Object.entries(obj)
|
837
|
+
.filter(([, value]) => value === THROW_IF_ACCESSED)
|
838
|
+
.map(([key]) => {
|
839
|
+
const getAndSet = () => {
|
840
|
+
throw new AccessError(`Cannot access ${key} yet ${debugMessage !== null && debugMessage !== void 0 ? debugMessage : ""}`);
|
841
|
+
};
|
842
|
+
const pd = {
|
843
|
+
get: getAndSet,
|
844
|
+
set: getAndSet,
|
845
|
+
enumerable: true
|
846
|
+
};
|
847
|
+
return [key, pd];
|
848
|
+
})));
|
849
|
+
}
|
850
|
+
//# sourceMappingURL=createObjectThatThrowsIfAccessed.js.map
|
791
851
|
;// CONCATENATED MODULE: ./dist/bin/keycloakify/generateResources/generateResources.js
|
792
852
|
|
793
853
|
|
@@ -808,6 +868,7 @@ var properties_parser_default = /*#__PURE__*/__webpack_require__.n(properties_pa
|
|
808
868
|
|
809
869
|
|
810
870
|
|
871
|
+
|
811
872
|
(0,assert/* assert */.h)();
|
812
873
|
async function generateResources(params) {
|
813
874
|
var _a;
|
@@ -950,12 +1011,14 @@ async function generateResources(params) {
|
|
950
1011
|
writeMessagePropertiesFilesByThemeType[themeType] =
|
951
1012
|
writeMessagePropertiesFiles;
|
952
1013
|
}
|
953
|
-
|
1014
|
+
bring_in_account_spa_messages: {
|
954
1015
|
if (!isSpa) {
|
955
|
-
break
|
1016
|
+
break bring_in_account_spa_messages;
|
1017
|
+
}
|
1018
|
+
if (themeType !== "account") {
|
1019
|
+
break bring_in_account_spa_messages;
|
956
1020
|
}
|
957
|
-
|
958
|
-
const accountUiDirPath = external_child_process_.execSync(`npm list @keycloakify/keycloak-${themeType}-ui --parseable`, {
|
1021
|
+
const accountUiDirPath = external_child_process_.execSync(`npm list @keycloakify/keycloak-account-ui --parseable`, {
|
959
1022
|
cwd: (0,external_path_.dirname)(buildContext.packageJsonFilePath)
|
960
1023
|
})
|
961
1024
|
.toString("utf8")
|
@@ -964,13 +1027,13 @@ async function generateResources(params) {
|
|
964
1027
|
if (!external_fs_default().existsSync(messageDirPath_defaults)) {
|
965
1028
|
throw new Error(`Please update @keycloakify/keycloak-account-ui to 25.0.4-rc.5 or later.`);
|
966
1029
|
}
|
967
|
-
const messagesDirPath_dest = (0,external_path_.join)(getThemeTypeDirPath({ themeName, themeType }), "messages");
|
1030
|
+
const messagesDirPath_dest = (0,external_path_.join)(getThemeTypeDirPath({ themeName, themeType: "account" }), "messages");
|
968
1031
|
(0,transformCodebase/* transformCodebase */.N)({
|
969
1032
|
srcDirPath: messageDirPath_defaults,
|
970
1033
|
destDirPath: messagesDirPath_dest
|
971
1034
|
});
|
972
1035
|
apply_theme_changes: {
|
973
|
-
const messagesDirPath_theme = (0,external_path_.join)(buildContext.themeSrcDirPath,
|
1036
|
+
const messagesDirPath_theme = (0,external_path_.join)(buildContext.themeSrcDirPath, "account", "messages");
|
974
1037
|
if (!external_fs_default().existsSync(messagesDirPath_theme)) {
|
975
1038
|
break apply_theme_changes;
|
976
1039
|
}
|
@@ -993,6 +1056,89 @@ async function generateResources(params) {
|
|
993
1056
|
languageTags = external_fs_default().readdirSync(messagesDirPath_dest)
|
994
1057
|
.map(basename => basename.replace(/^messages_/, "").replace(/\.properties$/, ""));
|
995
1058
|
}
|
1059
|
+
bring_in_admin_messages: {
|
1060
|
+
if (themeType !== "admin") {
|
1061
|
+
break bring_in_admin_messages;
|
1062
|
+
}
|
1063
|
+
const messagesDirPath_theme = (0,external_path_.join)(buildContext.themeSrcDirPath, "admin", "i18n");
|
1064
|
+
(0,assert/* assert */.h)(external_fs_default().existsSync(messagesDirPath_theme), `${messagesDirPath_theme} is supposed to exist`);
|
1065
|
+
const propertiesByLang = {};
|
1066
|
+
external_fs_default().readdirSync(messagesDirPath_theme).forEach(basename => {
|
1067
|
+
var _a;
|
1068
|
+
var _b;
|
1069
|
+
const parsedBasename = (() => {
|
1070
|
+
const match = basename.match(/^messages_([^.]+)\.properties$/);
|
1071
|
+
if (match === null) {
|
1072
|
+
return undefined;
|
1073
|
+
}
|
1074
|
+
const discriminator = match[1];
|
1075
|
+
const split = discriminator.split("_override");
|
1076
|
+
if (split.length === 1) {
|
1077
|
+
return {
|
1078
|
+
lang: discriminator,
|
1079
|
+
isOverride: false
|
1080
|
+
};
|
1081
|
+
}
|
1082
|
+
(0,assert/* assert */.h)(split.length === 2);
|
1083
|
+
if (split[1] === "") {
|
1084
|
+
return {
|
1085
|
+
lang: split[0],
|
1086
|
+
isOverride: true,
|
1087
|
+
themeName: undefined
|
1088
|
+
};
|
1089
|
+
}
|
1090
|
+
const match2 = split[1].match(/^_(.+)$/);
|
1091
|
+
(0,assert/* assert */.h)(match2 !== null);
|
1092
|
+
return {
|
1093
|
+
lang: split[0],
|
1094
|
+
isOverride: true,
|
1095
|
+
themeName: match2[1]
|
1096
|
+
};
|
1097
|
+
})();
|
1098
|
+
if (parsedBasename === undefined) {
|
1099
|
+
return;
|
1100
|
+
}
|
1101
|
+
(_a = propertiesByLang[_b = parsedBasename.lang]) !== null && _a !== void 0 ? _a : (propertiesByLang[_b] = {
|
1102
|
+
base: createObjectThatThrowsIfAccessed({
|
1103
|
+
debugMessage: `No base ${parsedBasename.lang} translation for admin theme`
|
1104
|
+
}),
|
1105
|
+
override: undefined,
|
1106
|
+
overrideByThemeName: {}
|
1107
|
+
});
|
1108
|
+
const buffer = external_fs_default().readFileSync((0,external_path_.join)(messagesDirPath_theme, basename));
|
1109
|
+
if (parsedBasename.isOverride === false) {
|
1110
|
+
propertiesByLang[parsedBasename.lang].base = buffer;
|
1111
|
+
return;
|
1112
|
+
}
|
1113
|
+
if (parsedBasename.themeName === undefined) {
|
1114
|
+
propertiesByLang[parsedBasename.lang].override = buffer;
|
1115
|
+
return;
|
1116
|
+
}
|
1117
|
+
propertiesByLang[parsedBasename.lang].overrideByThemeName[parsedBasename.themeName] = buffer;
|
1118
|
+
});
|
1119
|
+
writeMessagePropertiesFilesByThemeType.admin = ({ messageDirPath, themeName }) => {
|
1120
|
+
if (!external_fs_default().existsSync(messageDirPath)) {
|
1121
|
+
external_fs_default().mkdirSync(messageDirPath, { recursive: true });
|
1122
|
+
}
|
1123
|
+
Object.entries(propertiesByLang).forEach(([lang, { base, override, overrideByThemeName }]) => {
|
1124
|
+
(languageTags !== null && languageTags !== void 0 ? languageTags : (languageTags = [])).push(lang);
|
1125
|
+
const messages = properties_parser_default().parse(base.toString("utf8"));
|
1126
|
+
if (override !== undefined) {
|
1127
|
+
const overrideMessages = properties_parser_default().parse(override.toString("utf8"));
|
1128
|
+
Object.entries(overrideMessages).forEach(([key, value]) => (messages[key] = value));
|
1129
|
+
}
|
1130
|
+
if (themeName in overrideByThemeName) {
|
1131
|
+
const overrideMessages = properties_parser_default().parse(overrideByThemeName[themeName].toString("utf8"));
|
1132
|
+
Object.entries(overrideMessages).forEach(([key, value]) => (messages[key] = value));
|
1133
|
+
}
|
1134
|
+
const editor = properties_parser_default().createEditor();
|
1135
|
+
Object.entries(messages).forEach(([key, value]) => {
|
1136
|
+
editor.set(key, value);
|
1137
|
+
});
|
1138
|
+
external_fs_default().writeFileSync((0,external_path_.join)(messageDirPath, `messages_${lang}.properties`), Buffer.from(editor.toString(), "utf8"));
|
1139
|
+
});
|
1140
|
+
};
|
1141
|
+
}
|
996
1142
|
keycloak_static_resources: {
|
997
1143
|
if (isSpa) {
|
998
1144
|
break keycloak_static_resources;
|
package/bin/921.index.js
CHANGED
@@ -160,7 +160,7 @@ async function command(params) {
|
|
160
160
|
break;
|
161
161
|
case "Single-Page":
|
162
162
|
{
|
163
|
-
const { initializeAccountTheme_singlePage } = await Promise.all(/* import() */[__webpack_require__.e(
|
163
|
+
const { initializeAccountTheme_singlePage } = await Promise.all(/* import() */[__webpack_require__.e(174), __webpack_require__.e(525), __webpack_require__.e(375), __webpack_require__.e(735)]).then(__webpack_require__.bind(__webpack_require__, 84735));
|
164
164
|
await initializeAccountTheme_singlePage({
|
165
165
|
accountThemeSrcDirPath,
|
166
166
|
buildContext
|
package/bin/main.js
CHANGED
@@ -16153,7 +16153,7 @@ program
|
|
16153
16153
|
.task({
|
16154
16154
|
skip,
|
16155
16155
|
handler: async ({ projectDirPath }) => {
|
16156
|
-
const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(783), __nccwpck_require__.e(
|
16156
|
+
const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(783), __nccwpck_require__.e(880)]).then(__nccwpck_require__.bind(__nccwpck_require__, 59880));
|
16157
16157
|
await command({ buildContext: getBuildContext({ projectDirPath }) });
|
16158
16158
|
}
|
16159
16159
|
});
|
@@ -16201,7 +16201,7 @@ program
|
|
16201
16201
|
.task({
|
16202
16202
|
skip,
|
16203
16203
|
handler: async ({ projectDirPath, keycloakVersion, port, realmJsonFilePath }) => {
|
16204
|
-
const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(
|
16204
|
+
const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(174), __nccwpck_require__.e(525), __nccwpck_require__.e(568), __nccwpck_require__.e(503), __nccwpck_require__.e(153)]).then(__nccwpck_require__.bind(__nccwpck_require__, 43153));
|
16205
16205
|
await command({
|
16206
16206
|
buildContext: getBuildContext({ projectDirPath }),
|
16207
16207
|
cliCommandOptions: {
|
@@ -16244,14 +16244,14 @@ program
|
|
16244
16244
|
.task({
|
16245
16245
|
skip,
|
16246
16246
|
handler: async ({ projectDirPath }) => {
|
16247
|
-
const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(
|
16247
|
+
const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(174), __nccwpck_require__.e(525), __nccwpck_require__.e(375), __nccwpck_require__.e(568), __nccwpck_require__.e(490)]).then(__nccwpck_require__.bind(__nccwpck_require__, 23490));
|
16248
16248
|
await command({ buildContext: getBuildContext({ projectDirPath }) });
|
16249
16249
|
}
|
16250
16250
|
});
|
16251
16251
|
program
|
16252
16252
|
.command({
|
16253
16253
|
name: "initialize-account-theme",
|
16254
|
-
description: "Initialize
|
16254
|
+
description: "Initialize an Account Single-Page or Multi-Page custom Account UI."
|
16255
16255
|
})
|
16256
16256
|
.task({
|
16257
16257
|
skip,
|
@@ -16260,6 +16260,18 @@ program
|
|
16260
16260
|
await command({ buildContext: getBuildContext({ projectDirPath }) });
|
16261
16261
|
}
|
16262
16262
|
});
|
16263
|
+
program
|
16264
|
+
.command({
|
16265
|
+
name: "initialize-admin-theme",
|
16266
|
+
description: "Initialize an Admin Console custom UI."
|
16267
|
+
})
|
16268
|
+
.task({
|
16269
|
+
skip,
|
16270
|
+
handler: async ({ projectDirPath }) => {
|
16271
|
+
const { command } = await __nccwpck_require__.e(/* import() */ 615).then(__nccwpck_require__.bind(__nccwpck_require__, 61615));
|
16272
|
+
await command({ buildContext: getBuildContext({ projectDirPath }) });
|
16273
|
+
}
|
16274
|
+
});
|
16263
16275
|
program
|
16264
16276
|
.command({
|
16265
16277
|
name: "copy-keycloak-resources-to-public",
|
@@ -16292,7 +16304,7 @@ program
|
|
16292
16304
|
.task({
|
16293
16305
|
skip,
|
16294
16306
|
handler: async ({ projectDirPath }) => {
|
16295
|
-
const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(
|
16307
|
+
const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(174), __nccwpck_require__.e(300), __nccwpck_require__.e(653)]).then(__nccwpck_require__.bind(__nccwpck_require__, 2653));
|
16296
16308
|
await command({ buildContext: getBuildContext({ projectDirPath }) });
|
16297
16309
|
}
|
16298
16310
|
});
|
@@ -16307,9 +16319,10 @@ program
|
|
16307
16319
|
.option({
|
16308
16320
|
key: "file",
|
16309
16321
|
name: (() => {
|
16310
|
-
const
|
16311
|
-
|
16312
|
-
|
16322
|
+
const long = "file";
|
16323
|
+
const short = "f";
|
16324
|
+
optionsKeys.push(long, short);
|
16325
|
+
return { long, short };
|
16313
16326
|
})(),
|
16314
16327
|
description: [
|
16315
16328
|
"Relative path of the file relative to the directory of your keycloak theme source",
|
@@ -16319,7 +16332,7 @@ program
|
|
16319
16332
|
.task({
|
16320
16333
|
skip,
|
16321
16334
|
handler: async ({ projectDirPath, file }) => {
|
16322
|
-
const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(
|
16335
|
+
const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(300), __nccwpck_require__.e(854)]).then(__nccwpck_require__.bind(__nccwpck_require__, 85854));
|
16323
16336
|
await command({
|
16324
16337
|
buildContext: getBuildContext({ projectDirPath }),
|
16325
16338
|
cliCommandOptions: { file }
|
@@ -0,0 +1,10 @@
|
|
1
|
+
export type BuildContextLike = {
|
2
|
+
projectDirPath: string;
|
3
|
+
packageJsonFilePath: string;
|
4
|
+
};
|
5
|
+
export declare function addPostinstallScriptIfNotPresent(params: {
|
6
|
+
parsedPackageJson: {
|
7
|
+
scripts?: Record<string, string | undefined>;
|
8
|
+
};
|
9
|
+
buildContext: BuildContextLike;
|
10
|
+
}): void;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { BuildContext } from "./buildContext";
|
2
2
|
export declare const BIN_NAME = "_keycloakify-custom-handler";
|
3
3
|
export declare const NOT_IMPLEMENTED_EXIT_CODE = 78;
|
4
|
-
export type CommandName = "update-kc-gen" | "eject-page" | "add-story" | "initialize-account-theme" | "initialize-admin-theme" | "initialize-email-theme" | "copy-keycloak-resources-to-public";
|
4
|
+
export type CommandName = "update-kc-gen" | "eject-page" | "add-story" | "initialize-account-theme" | "initialize-admin-theme" | "initialize-admin-theme" | "initialize-email-theme" | "copy-keycloak-resources-to-public";
|
5
5
|
export type ApiVersion = "v1";
|
6
6
|
export declare function readParams(params: {
|
7
7
|
apiVersion: ApiVersion;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"customHandler.js","sourceRoot":"","sources":["../../src/bin/shared/customHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,CAAC,MAAM,QAAQ,GAAG,6BAA6B,CAAC;AAEtD,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAC;
|
1
|
+
{"version":3,"file":"customHandler.js","sourceRoot":"","sources":["../../src/bin/shared/customHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEvD,MAAM,CAAC,MAAM,QAAQ,GAAG,6BAA6B,CAAC;AAEtD,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAc5C,MAAM,UAAU,UAAU,CAAC,MAAkC;IACzD,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IAE9B,MAAM,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC;IAE5B,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE;QACtB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,YAAY,CAAC,CAAC;QAEpE,MAAM,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC;QAE/B,OAAO,QAAuB,CAAC;IACnC,CAAC,CAAC,EAAE,CAAC;IAEL,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,aAAa,CAAC,CAAC;QAErE,MAAM,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC;QAE/B,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAiB,CAAC;IAChD,CAAC,CAAC,EAAE,CAAC;IAEL,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC;AACzC,CAAC"}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
export declare class AccessError extends Error {
|
2
|
+
constructor(message: string);
|
3
|
+
}
|
4
|
+
export declare function createObjectThatThrowsIfAccessed<T extends object>(params?: {
|
5
|
+
debugMessage?: string;
|
6
|
+
isPropertyWhitelisted?: (prop: string | number | symbol) => boolean;
|
7
|
+
}): T;
|
8
|
+
export declare function createObjectThatThrowsIfAccessedFactory(params: {
|
9
|
+
isPropertyWhitelisted?: (prop: string | number | symbol) => boolean;
|
10
|
+
}): {
|
11
|
+
createObjectThatThrowsIfAccessed: <T extends object>(params?: {
|
12
|
+
debugMessage?: string;
|
13
|
+
}) => T;
|
14
|
+
};
|
15
|
+
export declare function isObjectThatThrowIfAccessed(obj: object): boolean;
|
16
|
+
export declare const THROW_IF_ACCESSED: {
|
17
|
+
__brand: string;
|
18
|
+
};
|
19
|
+
export declare function createObjectWithSomePropertiesThatThrowIfAccessed<T extends Record<string, unknown>>(obj: {
|
20
|
+
[K in keyof T]: T[K] | typeof THROW_IF_ACCESSED;
|
21
|
+
}, debugMessage?: string): T;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "keycloakify",
|
3
|
-
"version": "11.
|
3
|
+
"version": "11.6.1",
|
4
4
|
"description": "Framework to create custom Keycloak UIs",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -661,6 +661,7 @@
|
|
661
661
|
"src/bin/initialize-account-theme/src/single-page/KcContext.ts",
|
662
662
|
"src/bin/initialize-account-theme/src/single-page/KcPage.tsx",
|
663
663
|
"src/bin/initialize-account-theme/updateAccountThemeImplementationInConfig.ts",
|
664
|
+
"src/bin/initialize-admin-theme.ts",
|
664
665
|
"src/bin/initialize-email-theme.ts",
|
665
666
|
"src/bin/keycloakify/buildJars/buildJar.ts",
|
666
667
|
"src/bin/keycloakify/buildJars/buildJars.ts",
|
@@ -691,6 +692,7 @@
|
|
691
692
|
"src/bin/postinstall/postinstall.ts",
|
692
693
|
"src/bin/postinstall/uiModuleMeta.ts",
|
693
694
|
"src/bin/shared/KeycloakVersionRange.ts",
|
695
|
+
"src/bin/shared/addPostinstallScriptIfNotPresent.ts",
|
694
696
|
"src/bin/shared/buildContext.ts",
|
695
697
|
"src/bin/shared/constants.ts",
|
696
698
|
"src/bin/shared/customHandler.ts",
|
@@ -714,6 +716,7 @@
|
|
714
716
|
"src/bin/start-keycloak/realmConfig/defaultConfig/realm-kc-19.json",
|
715
717
|
"src/bin/start-keycloak/realmConfig/defaultConfig/realm-kc-20.json",
|
716
718
|
"src/bin/start-keycloak/realmConfig/defaultConfig/realm-kc-21.json",
|
719
|
+
"src/bin/start-keycloak/realmConfig/defaultConfig/realm-kc-22.json",
|
717
720
|
"src/bin/start-keycloak/realmConfig/defaultConfig/realm-kc-23.json",
|
718
721
|
"src/bin/start-keycloak/realmConfig/defaultConfig/realm-kc-24.json",
|
719
722
|
"src/bin/start-keycloak/realmConfig/defaultConfig/realm-kc-25.json",
|
@@ -733,6 +736,7 @@
|
|
733
736
|
"src/bin/tools/crawl.ts",
|
734
737
|
"src/bin/tools/crawlAsync.ts",
|
735
738
|
"src/bin/tools/crc32.ts",
|
739
|
+
"src/bin/tools/createObjectThatThrowsIfAccessed.ts",
|
736
740
|
"src/bin/tools/deflate.ts",
|
737
741
|
"src/bin/tools/downloadAndExtractArchive.ts",
|
738
742
|
"src/bin/tools/escapeStringForPropertiesFile.ts",
|
@@ -1040,6 +1044,7 @@
|
|
1040
1044
|
"bin/initialize-account-theme/initializeAccountTheme_multiPage.d.ts",
|
1041
1045
|
"bin/initialize-account-theme/initializeAccountTheme_singlePage.d.ts",
|
1042
1046
|
"bin/initialize-account-theme/updateAccountThemeImplementationInConfig.d.ts",
|
1047
|
+
"bin/initialize-admin-theme.d.ts",
|
1043
1048
|
"bin/initialize-email-theme.d.ts",
|
1044
1049
|
"bin/keycloakify/buildJars/buildJar.d.ts",
|
1045
1050
|
"bin/keycloakify/buildJars/buildJars.d.ts",
|
@@ -1068,6 +1073,7 @@
|
|
1068
1073
|
"bin/postinstall/managedGitignoreFile.d.ts",
|
1069
1074
|
"bin/postinstall/postinstall.d.ts",
|
1070
1075
|
"bin/postinstall/uiModuleMeta.d.ts",
|
1076
|
+
"bin/shared/addPostinstallScriptIfNotPresent.d.ts",
|
1071
1077
|
"bin/shared/buildContext.d.ts",
|
1072
1078
|
"bin/shared/constants.d.ts",
|
1073
1079
|
"bin/shared/customHandler_delegate.d.ts",
|
@@ -1098,6 +1104,7 @@
|
|
1098
1104
|
"bin/tools/crawl.d.ts",
|
1099
1105
|
"bin/tools/crawlAsync.d.ts",
|
1100
1106
|
"bin/tools/crc32.d.ts",
|
1107
|
+
"bin/tools/createObjectThatThrowsIfAccessed.d.ts",
|
1101
1108
|
"bin/tools/deflate.d.ts",
|
1102
1109
|
"bin/tools/downloadAndExtractArchive.d.ts",
|
1103
1110
|
"bin/tools/escapeStringForPropertiesFile.d.ts",
|
@@ -1131,17 +1138,18 @@
|
|
1131
1138
|
"bin/update-kc-gen.d.ts",
|
1132
1139
|
"bin/main.js",
|
1133
1140
|
"bin/153.index.js",
|
1141
|
+
"bin/174.index.js",
|
1134
1142
|
"bin/266.index.js",
|
1143
|
+
"bin/300.index.js",
|
1135
1144
|
"bin/304.index.js",
|
1136
|
-
"bin/33.index.js",
|
1137
|
-
"bin/356.index.js",
|
1138
1145
|
"bin/375.index.js",
|
1139
1146
|
"bin/40.index.js",
|
1140
1147
|
"bin/453.index.js",
|
1141
1148
|
"bin/490.index.js",
|
1142
1149
|
"bin/503.index.js",
|
1143
1150
|
"bin/525.index.js",
|
1144
|
-
"bin/
|
1151
|
+
"bin/568.index.js",
|
1152
|
+
"bin/615.index.js",
|
1145
1153
|
"bin/653.index.js",
|
1146
1154
|
"bin/658.index.js",
|
1147
1155
|
"bin/720.index.js",
|
@@ -1149,9 +1157,9 @@
|
|
1149
1157
|
"bin/743.index.js",
|
1150
1158
|
"bin/783.index.js",
|
1151
1159
|
"bin/786.index.js",
|
1152
|
-
"bin/805.index.js",
|
1153
1160
|
"bin/854.index.js",
|
1154
1161
|
"bin/877.index.js",
|
1162
|
+
"bin/880.index.js",
|
1155
1163
|
"bin/921.index.js",
|
1156
1164
|
"bin/97.index.js",
|
1157
1165
|
"bin/shared/constants.js",
|
@@ -119,7 +119,9 @@ export async function initializeAccountTheme_singlePage(params: {
|
|
119
119
|
JSON.stringify(parsedPackageJson, undefined, 4)
|
120
120
|
);
|
121
121
|
|
122
|
-
npmInstall({
|
122
|
+
await npmInstall({
|
123
|
+
packageJsonDirPath: pathDirname(buildContext.packageJsonFilePath)
|
124
|
+
});
|
123
125
|
|
124
126
|
copyBoilerplate({
|
125
127
|
accountThemeType: "Single-Page",
|
@@ -0,0 +1,146 @@
|
|
1
|
+
import { dirname as pathDirname, join as pathJoin, relative as pathRelative } from "path";
|
2
|
+
import type { BuildContext } from "./shared/buildContext";
|
3
|
+
import * as fs from "fs";
|
4
|
+
import { maybeDelegateCommandToCustomHandler } from "./shared/customHandler_delegate";
|
5
|
+
import { assert, is, type Equals } from "tsafe/assert";
|
6
|
+
import { id } from "tsafe/id";
|
7
|
+
import { addPostinstallScriptIfNotPresent } from "./shared/addPostinstallScriptIfNotPresent";
|
8
|
+
import { getIsPrettierAvailable, runPrettier } from "./tools/runPrettier";
|
9
|
+
import { npmInstall } from "./tools/npmInstall";
|
10
|
+
import * as child_process from "child_process";
|
11
|
+
import { z } from "zod";
|
12
|
+
import chalk from "chalk";
|
13
|
+
|
14
|
+
export async function command(params: { buildContext: BuildContext }) {
|
15
|
+
const { buildContext } = params;
|
16
|
+
|
17
|
+
const { hasBeenHandled } = maybeDelegateCommandToCustomHandler({
|
18
|
+
commandName: "initialize-admin-theme",
|
19
|
+
buildContext
|
20
|
+
});
|
21
|
+
|
22
|
+
if (hasBeenHandled) {
|
23
|
+
return;
|
24
|
+
}
|
25
|
+
|
26
|
+
{
|
27
|
+
const adminThemeSrcDirPath = pathJoin(buildContext.themeSrcDirPath, "admin");
|
28
|
+
|
29
|
+
if (
|
30
|
+
fs.existsSync(adminThemeSrcDirPath) &&
|
31
|
+
fs.readdirSync(adminThemeSrcDirPath).length > 0
|
32
|
+
) {
|
33
|
+
console.warn(
|
34
|
+
chalk.red(
|
35
|
+
`There is already a ${pathRelative(
|
36
|
+
process.cwd(),
|
37
|
+
adminThemeSrcDirPath
|
38
|
+
)} directory in your project. Aborting.`
|
39
|
+
)
|
40
|
+
);
|
41
|
+
|
42
|
+
process.exit(-1);
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
const parsedPackageJson = (() => {
|
47
|
+
type ParsedPackageJson = {
|
48
|
+
scripts?: Record<string, string | undefined>;
|
49
|
+
dependencies?: Record<string, string | undefined>;
|
50
|
+
devDependencies?: Record<string, string | undefined>;
|
51
|
+
};
|
52
|
+
|
53
|
+
const zParsedPackageJson = (() => {
|
54
|
+
type TargetType = ParsedPackageJson;
|
55
|
+
|
56
|
+
const zTargetType = z.object({
|
57
|
+
scripts: z.record(z.union([z.string(), z.undefined()])).optional(),
|
58
|
+
dependencies: z.record(z.union([z.string(), z.undefined()])).optional(),
|
59
|
+
devDependencies: z.record(z.union([z.string(), z.undefined()])).optional()
|
60
|
+
});
|
61
|
+
|
62
|
+
assert<Equals<z.infer<typeof zTargetType>, TargetType>>;
|
63
|
+
|
64
|
+
return id<z.ZodType<TargetType>>(zTargetType);
|
65
|
+
})();
|
66
|
+
const parsedPackageJson = JSON.parse(
|
67
|
+
fs.readFileSync(buildContext.packageJsonFilePath).toString("utf8")
|
68
|
+
);
|
69
|
+
|
70
|
+
zParsedPackageJson.parse(parsedPackageJson);
|
71
|
+
|
72
|
+
assert(is<ParsedPackageJson>(parsedPackageJson));
|
73
|
+
|
74
|
+
return parsedPackageJson;
|
75
|
+
})();
|
76
|
+
|
77
|
+
addPostinstallScriptIfNotPresent({
|
78
|
+
parsedPackageJson,
|
79
|
+
buildContext
|
80
|
+
});
|
81
|
+
|
82
|
+
const uiSharedMajor = (() => {
|
83
|
+
const dependencies = {
|
84
|
+
...parsedPackageJson.devDependencies,
|
85
|
+
...parsedPackageJson.dependencies
|
86
|
+
};
|
87
|
+
|
88
|
+
const version = dependencies["@keycloakify/keycloak-ui-shared"];
|
89
|
+
|
90
|
+
if (version === undefined) {
|
91
|
+
return undefined;
|
92
|
+
}
|
93
|
+
|
94
|
+
const match = version.match(/^[^~]?(\d+)\./);
|
95
|
+
|
96
|
+
if (match === null) {
|
97
|
+
return undefined;
|
98
|
+
}
|
99
|
+
|
100
|
+
return match[1];
|
101
|
+
})();
|
102
|
+
|
103
|
+
const moduleName = "@keycloakify/keycloak-admin-ui";
|
104
|
+
|
105
|
+
const version = (
|
106
|
+
JSON.parse(
|
107
|
+
child_process
|
108
|
+
.execSync(`npm show ${moduleName} versions --json`)
|
109
|
+
.toString("utf8")
|
110
|
+
.trim()
|
111
|
+
) as string[]
|
112
|
+
)
|
113
|
+
.reverse()
|
114
|
+
.filter(version => !version.includes("-"))
|
115
|
+
.find(version =>
|
116
|
+
uiSharedMajor === undefined ? true : version.startsWith(`${uiSharedMajor}.`)
|
117
|
+
);
|
118
|
+
|
119
|
+
assert(version !== undefined);
|
120
|
+
|
121
|
+
(parsedPackageJson.dependencies ??= {})[moduleName] = `~${version}`;
|
122
|
+
|
123
|
+
if (parsedPackageJson.devDependencies !== undefined) {
|
124
|
+
delete parsedPackageJson.devDependencies[moduleName];
|
125
|
+
}
|
126
|
+
|
127
|
+
{
|
128
|
+
let sourceCode = JSON.stringify(parsedPackageJson, undefined, 2);
|
129
|
+
|
130
|
+
if (await getIsPrettierAvailable()) {
|
131
|
+
sourceCode = await runPrettier({
|
132
|
+
sourceCode,
|
133
|
+
filePath: buildContext.packageJsonFilePath
|
134
|
+
});
|
135
|
+
}
|
136
|
+
|
137
|
+
fs.writeFileSync(
|
138
|
+
buildContext.packageJsonFilePath,
|
139
|
+
Buffer.from(sourceCode, "utf8")
|
140
|
+
);
|
141
|
+
}
|
142
|
+
|
143
|
+
await npmInstall({
|
144
|
+
packageJsonDirPath: pathDirname(buildContext.packageJsonFilePath)
|
145
|
+
});
|
146
|
+
}
|