keycloakify 10.0.0-rc.137 → 10.0.0-rc.138

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.
@@ -161,7 +161,7 @@ function ensureSingleOrNone(arg0) {
161
161
 
162
162
  (0,assert.assert)();
163
163
  function getBuildContext(params) {
164
- var _a, _b, _c, _d, _e, _f;
164
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
165
165
  const { cliCommandOptions } = params;
166
166
  const projectDirPath = cliCommandOptions.projectDirPath !== undefined
167
167
  ? getAbsoluteAndInOsFormatPath({
@@ -279,6 +279,17 @@ function getBuildContext(params) {
279
279
  (0,assert.assert)();
280
280
  return (0,id.id)(zTargetType);
281
281
  })();
282
+ const zStartKeycloakOptions = (() => {
283
+ const zTargetType = lib.z.object({
284
+ dockerImage: lib.z.string().optional(),
285
+ extensionJars: lib.z.array(lib.z.string()).optional(),
286
+ realmJsonFilePath: lib.z.string().optional(),
287
+ dockerExtraArgs: lib.z.array(lib.z.string()).optional(),
288
+ keycloakExtraArgs: lib.z.array(lib.z.string()).optional()
289
+ });
290
+ (0,assert.assert)();
291
+ return (0,id.id)(zTargetType);
292
+ })();
282
293
  const zBuildOptions = (() => {
283
294
  const zTargetType = lib.z.intersection(lib.z.object({
284
295
  themeName: lib.z.union([lib.z.string(), lib.z.array(lib.z.string())]).optional(),
@@ -293,7 +304,8 @@ function getBuildContext(params) {
293
304
  groupId: lib.z.string().optional(),
294
305
  loginThemeResourcesFromKeycloakVersion: lib.z.string().optional(),
295
306
  keycloakifyBuildDirPath: lib.z.string().optional(),
296
- kcContextExclusionsFtl: lib.z.string().optional()
307
+ kcContextExclusionsFtl: lib.z.string().optional(),
308
+ startKeycloakOptions: zStartKeycloakOptions.optional()
297
309
  }), zAccountThemeImplAndKeycloakVersionTargets);
298
310
  (0,assert.assert)();
299
311
  return (0,id.id)(zTargetType);
@@ -679,7 +691,38 @@ function getBuildContext(params) {
679
691
  process.exit(1);
680
692
  }
681
693
  return jarTargets;
682
- })()
694
+ })(),
695
+ startKeycloakOptions: {
696
+ dockerImage: (() => {
697
+ var _a;
698
+ if (((_a = buildOptions.startKeycloakOptions) === null || _a === void 0 ? void 0 : _a.dockerImage) === undefined) {
699
+ return undefined;
700
+ }
701
+ const [reference, tag, ...rest] = buildOptions.startKeycloakOptions.dockerImage.split(":");
702
+ (0,assert.assert)(reference !== undefined && tag !== undefined && rest.length === 0, `Invalid docker image: ${buildOptions.startKeycloakOptions.dockerImage}`);
703
+ return { reference, tag };
704
+ })(),
705
+ dockerExtraArgs: (_h = (_g = buildOptions.startKeycloakOptions) === null || _g === void 0 ? void 0 : _g.dockerExtraArgs) !== null && _h !== void 0 ? _h : [],
706
+ keycloakExtraArgs: (_k = (_j = buildOptions.startKeycloakOptions) === null || _j === void 0 ? void 0 : _j.keycloakExtraArgs) !== null && _k !== void 0 ? _k : [],
707
+ extensionJars: ((_m = (_l = buildOptions.startKeycloakOptions) === null || _l === void 0 ? void 0 : _l.extensionJars) !== null && _m !== void 0 ? _m : []).map(urlOrPath => {
708
+ if (/^https?:\/\//.test(urlOrPath)) {
709
+ return { type: "url", url: urlOrPath };
710
+ }
711
+ return {
712
+ type: "path",
713
+ path: getAbsoluteAndInOsFormatPath({
714
+ pathIsh: urlOrPath,
715
+ cwd: projectDirPath
716
+ })
717
+ };
718
+ }),
719
+ realmJsonFilePath: ((_o = buildOptions.startKeycloakOptions) === null || _o === void 0 ? void 0 : _o.realmJsonFilePath) === undefined
720
+ ? undefined
721
+ : getAbsoluteAndInOsFormatPath({
722
+ pathIsh: buildOptions.startKeycloakOptions.realmJsonFilePath,
723
+ cwd: projectDirPath
724
+ })
725
+ }
683
726
  };
684
727
  }
685
728
  //# sourceMappingURL=buildContext.js.map
@@ -1002,12 +1045,22 @@ var fs_rm = __nccwpck_require__(8699);
1002
1045
 
1003
1046
 
1004
1047
 
1048
+
1005
1049
  async function downloadAndExtractArchive(params) {
1006
1050
  var _a;
1007
- const { url, uniqueIdOfOnArchiveFile, onArchiveFile, cacheDirPath, fetchOptions } = params;
1008
- const archiveFileBasename = url.split("?")[0].split("/").reverse()[0];
1051
+ const { urlOrPath, uniqueIdOfOnArchiveFile, onArchiveFile, cacheDirPath, fetchOptions } = params;
1052
+ const isUrl = /^https?:\/\//.test(urlOrPath);
1053
+ const archiveFileBasename = isUrl
1054
+ ? urlOrPath.split("?")[0].split("/").reverse()[0]
1055
+ : (0,external_path_.basename)(urlOrPath);
1009
1056
  const archiveFilePath = (0,external_path_.join)(cacheDirPath, archiveFileBasename);
1010
1057
  download: {
1058
+ await (0,promises_.mkdir)((0,external_path_.dirname)(archiveFilePath), { recursive: true });
1059
+ if (!isUrl) {
1060
+ await promises_.copyFile(urlOrPath, archiveFilePath);
1061
+ break download;
1062
+ }
1063
+ const url = urlOrPath;
1011
1064
  if (await (0,fs_existsAsync/* existsAsync */.o)(archiveFilePath)) {
1012
1065
  const isDownloaded = await SuccessTracker.getIsDownloaded({
1013
1066
  cacheDirPath,
@@ -1022,7 +1075,6 @@ async function downloadAndExtractArchive(params) {
1022
1075
  archiveFileBasename
1023
1076
  });
1024
1077
  }
1025
- await (0,promises_.mkdir)((0,external_path_.dirname)(archiveFilePath), { recursive: true });
1026
1078
  const response = await lib_default()(url, fetchOptions);
1027
1079
  (_a = response.body) === null || _a === void 0 ? void 0 : _a.setMaxListeners(Number.MAX_VALUE);
1028
1080
  (0,assert.assert)(typeof response.body !== "undefined" && response.body != null);
@@ -1087,7 +1139,7 @@ async function downloadAndExtractArchive(params) {
1087
1139
  extractDirBasename
1088
1140
  });
1089
1141
  }
1090
- return { extractedDirPath };
1142
+ return { extractedDirPath, archiveFilePath };
1091
1143
  }
1092
1144
  var SuccessTracker;
1093
1145
  (function (SuccessTracker) {
@@ -1163,7 +1215,7 @@ async function downloadKeycloakDefaultTheme(params) {
1163
1215
  let kcNodeModulesKeepFilePaths = undefined;
1164
1216
  let kcNodeModulesKeepFilePaths_lastAccountV1 = undefined;
1165
1217
  const { extractedDirPath } = await downloadAndExtractArchive({
1166
- url: `https://repo1.maven.org/maven2/org/keycloak/keycloak-themes/${keycloakVersion}/keycloak-themes-${keycloakVersion}.jar`,
1218
+ urlOrPath: `https://repo1.maven.org/maven2/org/keycloak/keycloak-themes/${keycloakVersion}/keycloak-themes-${keycloakVersion}.jar`,
1167
1219
  cacheDirPath: buildContext.cacheDirPath,
1168
1220
  fetchOptions: buildContext.fetchOptions,
1169
1221
  uniqueIdOfOnArchiveFile: "downloadKeycloakDefaultTheme",