keycloakify 11.5.0 → 11.5.2

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/682.index.js CHANGED
@@ -311,7 +311,15 @@ const zParsedRealmJson = (() => {
311
311
  })
312
312
  .optional(),
313
313
  protocol: lib.z.string().optional(),
314
- protocolMappers: lib.z.array(lib.z.unknown()).optional()
314
+ protocolMappers: lib.z.array(lib.z.object({
315
+ id: lib.z.string(),
316
+ name: lib.z.string(),
317
+ protocol: lib.z.string(),
318
+ protocolMapper: lib.z.string(),
319
+ consentRequired: lib.z.boolean(),
320
+ config: lib.z.record(lib.z.string()).optional()
321
+ }))
322
+ .optional()
315
323
  }))
316
324
  });
317
325
  assert/* assert */.h;
@@ -399,12 +407,12 @@ async function getSupportedDockerImageTags(params) {
399
407
  return result;
400
408
  }
401
409
  }
402
- const tags = [];
410
+ const tags_queryResponse = [];
403
411
  await (async function callee(url) {
404
412
  const r = await lib_default()(url, buildContext.fetchOptions);
405
413
  await Promise.all([
406
414
  (async () => {
407
- tags.push(...lib.z.object({
415
+ tags_queryResponse.push(...lib.z.object({
408
416
  tags: lib.z.array(lib.z.string())
409
417
  })
410
418
  .parse(await r.json()).tags);
@@ -424,7 +432,8 @@ async function getSupportedDockerImageTags(params) {
424
432
  })()
425
433
  ]);
426
434
  })("https://quay.io/v2/keycloak/keycloak/tags/list");
427
- const arr = tags
435
+ const supportedKeycloakMajorVersions = getSupportedKeycloakMajorVersions();
436
+ const allSupportedTags_withVersion = tags_queryResponse
428
437
  .map(tag => ({
429
438
  tag,
430
439
  version: (() => {
@@ -438,21 +447,27 @@ async function getSupportedDockerImageTags(params) {
438
447
  catch (_a) {
439
448
  return undefined;
440
449
  }
450
+ if (tag.split(".").length !== 3) {
451
+ return undefined;
452
+ }
453
+ if (!supportedKeycloakMajorVersions.includes(version.major)) {
454
+ return undefined;
455
+ }
441
456
  return version;
442
457
  })()
443
458
  }))
444
459
  .map(({ tag, version }) => (version === undefined ? undefined : { tag, version }))
445
- .filter((0,exclude/* exclude */.D)(undefined));
446
- const versionByMajor = {};
447
- for (const { version } of arr) {
448
- const version_current = versionByMajor[version.major];
460
+ .filter((0,exclude/* exclude */.D)(undefined))
461
+ .sort(({ version: a }, { version: b }) => SemVer/* SemVer.compare */.h.compare(b, a));
462
+ const latestTagByMajor = {};
463
+ for (const { version } of allSupportedTags_withVersion) {
464
+ const version_current = latestTagByMajor[version.major];
449
465
  if (version_current === undefined ||
450
466
  SemVer/* SemVer.compare */.h.compare(version_current, version) === -1) {
451
- versionByMajor[version.major] = version;
467
+ latestTagByMajor[version.major] = version;
452
468
  }
453
469
  }
454
- const supportedKeycloakMajorVersions = getSupportedKeycloakMajorVersions();
455
- const result = Object.entries(versionByMajor)
470
+ const latestMajorTags = Object.entries(latestTagByMajor)
456
471
  .sort(([a], [b]) => parseInt(b) - parseInt(a))
457
472
  .map(([, version]) => version)
458
473
  .map(version => {
@@ -463,15 +478,28 @@ async function getSupportedDockerImageTags(params) {
463
478
  return SemVer/* SemVer.stringify */.h.stringify(version);
464
479
  })
465
480
  .filter((0,exclude/* exclude */.D)(undefined));
481
+ const allSupportedTags = allSupportedTags_withVersion.map(({ tag }) => tag);
482
+ const result = {
483
+ latestMajorTags,
484
+ allSupportedTags
485
+ };
466
486
  await setCachedValue({ cacheDirPath: buildContext.cacheDirPath, result });
467
487
  return result;
468
488
  }
469
489
  const { getCachedValue, setCachedValue } = (() => {
490
+ const zResult = (() => {
491
+ const zTargetType = lib.z.object({
492
+ allSupportedTags: lib.z.array(lib.z.string()),
493
+ latestMajorTags: lib.z.array(lib.z.string())
494
+ });
495
+ assert/* assert */.h;
496
+ return (0,id.id)(zTargetType);
497
+ })();
470
498
  const zCache = (() => {
471
499
  const zTargetType = lib.z.object({
472
500
  keycloakifyVersion: lib.z.string(),
473
501
  time: lib.z.number(),
474
- result: lib.z.array(lib.z.string())
502
+ result: zResult
475
503
  });
476
504
  assert/* assert */.h;
477
505
  return (0,id.id)(zTargetType);
@@ -705,7 +733,7 @@ function addOrEditClient(params) {
705
733
  return { clientId: testClient.clientId };
706
734
  }
707
735
  function editAccountConsoleAndSecurityAdminConsole(params) {
708
- var _a, _b, _c;
736
+ var _a, _b, _c, _d, _e;
709
737
  const { parsedRealmJson } = params;
710
738
  for (const clientId of ["account-console", "security-admin-console"]) {
711
739
  const client = parsedRealmJson.clients.find(client => client.clientId === clientId);
@@ -721,6 +749,56 @@ function editAccountConsoleAndSecurityAdminConsole(params) {
721
749
  }
722
750
  ((_c = client.attributes) !== null && _c !== void 0 ? _c : (client.attributes = {}))["post.logout.redirect.uris"] = "+";
723
751
  client.webOrigins = ["*"];
752
+ admin_specific: {
753
+ if (clientId !== "security-admin-console") {
754
+ break admin_specific;
755
+ }
756
+ const protocolMapper_preexisting = (_d = client.protocolMappers) === null || _d === void 0 ? void 0 : _d.find(protocolMapper => {
757
+ if (protocolMapper.protocolMapper !== "oidc-hardcoded-claim-mapper") {
758
+ return false;
759
+ }
760
+ if (protocolMapper.protocol !== "openid-connect") {
761
+ return false;
762
+ }
763
+ if (protocolMapper.config === undefined) {
764
+ return false;
765
+ }
766
+ if (protocolMapper.config["claim.name"] !== "allowed-origins") {
767
+ return false;
768
+ }
769
+ return true;
770
+ });
771
+ let protocolMapper;
772
+ const config = {
773
+ "introspection.token.claim": "true",
774
+ "claim.value": '["*"]',
775
+ "userinfo.token.claim": "true",
776
+ "id.token.claim": "false",
777
+ "lightweight.claim": "false",
778
+ "access.token.claim": "true",
779
+ "claim.name": "allowed-origins",
780
+ "jsonType.label": "JSON",
781
+ "access.tokenResponse.claim": "false"
782
+ };
783
+ if (protocolMapper_preexisting !== undefined) {
784
+ protocolMapper = protocolMapper_preexisting;
785
+ }
786
+ else {
787
+ protocolMapper = {
788
+ id: "8fd0d584-7052-4d04-a615-d18a71050873",
789
+ name: "allowed-origins",
790
+ protocol: "openid-connect",
791
+ protocolMapper: "oidc-hardcoded-claim-mapper",
792
+ consentRequired: false,
793
+ config
794
+ };
795
+ ((_e = client.protocolMappers) !== null && _e !== void 0 ? _e : (client.protocolMappers = [])).push(protocolMapper);
796
+ }
797
+ (0,assert/* assert */.h)(protocolMapper.config !== undefined);
798
+ if (config !== protocolMapper.config) {
799
+ Object.assign(protocolMapper.config, config);
800
+ }
801
+ }
724
802
  }
725
803
  }
726
804
  //# sourceMappingURL=prepareRealmConfig.js.map
@@ -735,12 +813,29 @@ function editAccountConsoleAndSecurityAdminConsole(params) {
735
813
  (0,assert/* assert */.h)();
736
814
  async function dumpContainerConfig(params) {
737
815
  const { realmName, keycloakMajorVersionNumber, buildContext } = params;
738
- {
739
- // https://github.com/keycloak/keycloak/issues/33800
740
- const doesUseLockedH2Database = keycloakMajorVersionNumber >= 25;
741
- if (doesUseLockedH2Database) {
742
- external_child_process_default().execSync(`docker exec ${constants/* CONTAINER_NAME */.sv} sh -c "cp -rp /opt/keycloak/data/h2 /tmp"`);
816
+ // https://github.com/keycloak/keycloak/issues/33800
817
+ const doesUseLockedH2Database = keycloakMajorVersionNumber >= 25;
818
+ if (doesUseLockedH2Database) {
819
+ const dCompleted = new Deferred.Deferred();
820
+ const cmd = `docker exec ${constants/* CONTAINER_NAME */.sv} sh -c "cp -rp /opt/keycloak/data/h2 /tmp"`;
821
+ external_child_process_default().exec(cmd, error => {
822
+ if (error !== null) {
823
+ dCompleted.reject(error);
824
+ return;
825
+ }
826
+ dCompleted.resolve();
827
+ });
828
+ try {
829
+ await dCompleted.pr;
830
+ }
831
+ catch (error) {
832
+ (0,assert/* assert */.h)((0,assert.is)(error));
833
+ console.log(source_default().red(`Docker command failed: ${cmd}`));
834
+ console.log(source_default().red(error.message));
835
+ throw error;
743
836
  }
837
+ }
838
+ {
744
839
  const dCompleted = new Deferred.Deferred();
745
840
  const child = external_child_process_default().spawn("docker", [
746
841
  ...["exec", constants/* CONTAINER_NAME */.sv],
@@ -760,7 +855,7 @@ async function dumpContainerConfig(params) {
760
855
  ], { shell: true });
761
856
  let output = "";
762
857
  const onExit = (code) => {
763
- dCompleted.reject(new Error(`Exited with code ${code}`));
858
+ dCompleted.reject(new Error(`docker exec kc.sh export command failed with code ${code}`));
764
859
  };
765
860
  child.once("exit", onExit);
766
861
  child.stdout.on("data", data => {
@@ -789,31 +884,51 @@ async function dumpContainerConfig(params) {
789
884
  (0,assert/* assert */.h)((0,assert.is)(error));
790
885
  console.log(source_default().red(error.message));
791
886
  console.log(output);
792
- process.exit(1);
887
+ throw error;
793
888
  }
794
- if (doesUseLockedH2Database) {
795
- const dCompleted = new Deferred.Deferred();
796
- external_child_process_default().exec(`docker exec ${constants/* CONTAINER_NAME */.sv} sh -c "rm -rf /tmp/h2"`, error => {
797
- if (error !== null) {
798
- dCompleted.reject(error);
799
- return;
800
- }
801
- dCompleted.resolve();
802
- });
889
+ }
890
+ if (doesUseLockedH2Database) {
891
+ const dCompleted = new Deferred.Deferred();
892
+ const cmd = `docker exec ${constants/* CONTAINER_NAME */.sv} sh -c "rm -rf /tmp/h2"`;
893
+ external_child_process_default().exec(cmd, error => {
894
+ if (error !== null) {
895
+ dCompleted.reject(error);
896
+ return;
897
+ }
898
+ dCompleted.resolve();
899
+ });
900
+ try {
803
901
  await dCompleted.pr;
804
902
  }
903
+ catch (error) {
904
+ (0,assert/* assert */.h)((0,assert.is)(error));
905
+ console.log(source_default().red(`Docker command failed: ${cmd}`));
906
+ console.log(source_default().red(error.message));
907
+ throw error;
908
+ }
805
909
  }
806
910
  const targetRealmConfigJsonFilePath_tmp = (0,external_path_.join)(buildContext.cacheDirPath, "realm.json");
807
911
  {
808
912
  const dCompleted = new Deferred.Deferred();
809
- external_child_process_default().exec(`docker cp ${constants/* CONTAINER_NAME */.sv}:/tmp/${realmName}-realm.json ${targetRealmConfigJsonFilePath_tmp}`, error => {
913
+ const cmd = `docker cp ${constants/* CONTAINER_NAME */.sv}:/tmp/${realmName}-realm.json ${(0,external_path_.basename)(targetRealmConfigJsonFilePath_tmp)}`;
914
+ external_child_process_default().exec(cmd, {
915
+ cwd: (0,external_path_.dirname)(targetRealmConfigJsonFilePath_tmp)
916
+ }, error => {
810
917
  if (error !== null) {
811
918
  dCompleted.reject(error);
812
919
  return;
813
920
  }
814
921
  dCompleted.resolve();
815
922
  });
816
- await dCompleted.pr;
923
+ try {
924
+ await dCompleted.pr;
925
+ }
926
+ catch (error) {
927
+ (0,assert/* assert */.h)((0,assert.is)(error));
928
+ console.log(source_default().red(`Docker command failed: ${cmd}`));
929
+ console.log(source_default().red(error.message));
930
+ throw error;
931
+ }
817
932
  }
818
933
  return readRealmJsonFile({
819
934
  realmJsonFilePath: targetRealmConfigJsonFilePath_tmp
@@ -877,11 +992,18 @@ async function getRealmConfig(params) {
877
992
  const run = runExclusive.build(async () => {
878
993
  const start = Date.now();
879
994
  console.log(source_default().grey(`Changes detected to the '${realmName}' config, backing up...`));
880
- const parsedRealmJson = await dumpContainerConfig({
881
- buildContext,
882
- realmName,
883
- keycloakMajorVersionNumber
884
- });
995
+ let parsedRealmJson;
996
+ try {
997
+ parsedRealmJson = await dumpContainerConfig({
998
+ buildContext,
999
+ realmName,
1000
+ keycloakMajorVersionNumber
1001
+ });
1002
+ }
1003
+ catch (error) {
1004
+ console.log(source_default().red(`Failed to backup '${realmName}' config:`));
1005
+ return;
1006
+ }
885
1007
  await writeRealmJsonFile({ parsedRealmJson });
886
1008
  console.log([
887
1009
  source_default().grey(`Save changed to \`.${external_path_.sep}${(0,external_path_.relative)(buildContext.projectDirPath, realmJsonFilePath)}\``),
@@ -975,13 +1097,13 @@ async function command(params) {
975
1097
  process.exit(1);
976
1098
  }
977
1099
  const { cliCommandOptions, buildContext } = params;
978
- const availableTags = await getSupportedDockerImageTags({
1100
+ const { allSupportedTags, latestMajorTags } = await getSupportedDockerImageTags({
979
1101
  buildContext
980
1102
  });
981
1103
  const { dockerImageTag } = await (async () => {
982
1104
  if (cliCommandOptions.keycloakVersion !== undefined) {
983
1105
  const cliCommandOptions_keycloakVersion = cliCommandOptions.keycloakVersion;
984
- const tag = availableTags.find(tag => tag.startsWith(cliCommandOptions_keycloakVersion));
1106
+ const tag = allSupportedTags.find(tag => tag.startsWith(cliCommandOptions_keycloakVersion));
985
1107
  if (tag === undefined) {
986
1108
  console.log(source_default().red([
987
1109
  `We could not find a Keycloak Docker image for ${cliCommandOptions_keycloakVersion}`,
@@ -1001,7 +1123,7 @@ async function command(params) {
1001
1123
  source_default().gray("You can also explicitly provide the version with `npx keycloakify start-keycloak --keycloak-version 26` (or any other version)")
1002
1124
  ].join("\n"));
1003
1125
  const { value: tag } = await dist_default()({
1004
- values: availableTags
1126
+ values: latestMajorTags
1005
1127
  }).catch(() => {
1006
1128
  process.exit(-1);
1007
1129
  });
@@ -1356,6 +1478,91 @@ async function command(params) {
1356
1478
 
1357
1479
  /***/ }),
1358
1480
 
1481
+ /***/ 12171:
1482
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1483
+
1484
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1485
+ /* harmony export */ "h": () => (/* binding */ SemVer)
1486
+ /* harmony export */ });
1487
+ var SemVer;
1488
+ (function (SemVer) {
1489
+ const bumpTypes = ["major", "minor", "patch", "rc", "no bump"];
1490
+ function parse(versionStr) {
1491
+ const match = versionStr.match(/^v?([0-9]+)\.([0-9]+)(?:\.([0-9]+))?(?:-rc.([0-9]+))?$/);
1492
+ if (!match) {
1493
+ throw new Error(`${versionStr} is not a valid semantic version`);
1494
+ }
1495
+ const semVer = Object.assign({ major: parseInt(match[1]), minor: parseInt(match[2]), patch: (() => {
1496
+ const str = match[3];
1497
+ return str === undefined ? 0 : parseInt(str);
1498
+ })() }, (() => {
1499
+ const str = match[4];
1500
+ return str === undefined ? {} : { rc: parseInt(str) };
1501
+ })());
1502
+ const initialStr = stringify(semVer);
1503
+ Object.defineProperty(semVer, "parsedFrom", {
1504
+ enumerable: true,
1505
+ get: function () {
1506
+ const currentStr = stringify(this);
1507
+ if (currentStr !== initialStr) {
1508
+ throw new Error(`SemVer.parsedFrom can't be read anymore, the version have been modified from ${initialStr} to ${currentStr}`);
1509
+ }
1510
+ return versionStr;
1511
+ }
1512
+ });
1513
+ return semVer;
1514
+ }
1515
+ SemVer.parse = parse;
1516
+ function stringify(v) {
1517
+ return `${v.major}.${v.minor}.${v.patch}${v.rc === undefined ? "" : `-rc.${v.rc}`}`;
1518
+ }
1519
+ SemVer.stringify = stringify;
1520
+ /**
1521
+ *
1522
+ * v1 < v2 => -1
1523
+ * v1 === v2 => 0
1524
+ * v1 > v2 => 1
1525
+ *
1526
+ */
1527
+ function compare(v1, v2) {
1528
+ const sign = (diff) => (diff === 0 ? 0 : diff < 0 ? -1 : 1);
1529
+ const noUndefined = (n) => n !== null && n !== void 0 ? n : Infinity;
1530
+ for (const level of ["major", "minor", "patch", "rc"]) {
1531
+ if (noUndefined(v1[level]) !== noUndefined(v2[level])) {
1532
+ return sign(noUndefined(v1[level]) - noUndefined(v2[level]));
1533
+ }
1534
+ }
1535
+ return 0;
1536
+ }
1537
+ SemVer.compare = compare;
1538
+ /*
1539
+ console.log(compare(parse("3.0.0-rc.3"), parse("3.0.0")) === -1 )
1540
+ console.log(compare(parse("3.0.0-rc.3"), parse("3.0.0-rc.4")) === -1 )
1541
+ console.log(compare(parse("3.0.0-rc.3"), parse("4.0.0")) === -1 )
1542
+ */
1543
+ function bumpType(params) {
1544
+ const versionAhead = typeof params.versionAhead === "string"
1545
+ ? parse(params.versionAhead)
1546
+ : params.versionAhead;
1547
+ const versionBehind = typeof params.versionBehind === "string"
1548
+ ? parse(params.versionBehind)
1549
+ : params.versionBehind;
1550
+ if (compare(versionBehind, versionAhead) === 1) {
1551
+ throw new Error(`Version regression ${stringify(versionBehind)} -> ${stringify(versionAhead)}`);
1552
+ }
1553
+ for (const level of ["major", "minor", "patch", "rc"]) {
1554
+ if (versionBehind[level] !== versionAhead[level]) {
1555
+ return level;
1556
+ }
1557
+ }
1558
+ return "no bump";
1559
+ }
1560
+ SemVer.bumpType = bumpType;
1561
+ })(SemVer || (SemVer = {}));
1562
+ //# sourceMappingURL=SemVer.js.map
1563
+
1564
+ /***/ }),
1565
+
1359
1566
  /***/ 38367:
1360
1567
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
1361
1568
 
package/bin/735.index.js CHANGED
@@ -402,6 +402,91 @@ async function getLatestsSemVersionedTag(_a) {
402
402
 
403
403
  /***/ }),
404
404
 
405
+ /***/ 12171:
406
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
407
+
408
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
409
+ /* harmony export */ "h": () => (/* binding */ SemVer)
410
+ /* harmony export */ });
411
+ var SemVer;
412
+ (function (SemVer) {
413
+ const bumpTypes = ["major", "minor", "patch", "rc", "no bump"];
414
+ function parse(versionStr) {
415
+ const match = versionStr.match(/^v?([0-9]+)\.([0-9]+)(?:\.([0-9]+))?(?:-rc.([0-9]+))?$/);
416
+ if (!match) {
417
+ throw new Error(`${versionStr} is not a valid semantic version`);
418
+ }
419
+ const semVer = Object.assign({ major: parseInt(match[1]), minor: parseInt(match[2]), patch: (() => {
420
+ const str = match[3];
421
+ return str === undefined ? 0 : parseInt(str);
422
+ })() }, (() => {
423
+ const str = match[4];
424
+ return str === undefined ? {} : { rc: parseInt(str) };
425
+ })());
426
+ const initialStr = stringify(semVer);
427
+ Object.defineProperty(semVer, "parsedFrom", {
428
+ enumerable: true,
429
+ get: function () {
430
+ const currentStr = stringify(this);
431
+ if (currentStr !== initialStr) {
432
+ throw new Error(`SemVer.parsedFrom can't be read anymore, the version have been modified from ${initialStr} to ${currentStr}`);
433
+ }
434
+ return versionStr;
435
+ }
436
+ });
437
+ return semVer;
438
+ }
439
+ SemVer.parse = parse;
440
+ function stringify(v) {
441
+ return `${v.major}.${v.minor}.${v.patch}${v.rc === undefined ? "" : `-rc.${v.rc}`}`;
442
+ }
443
+ SemVer.stringify = stringify;
444
+ /**
445
+ *
446
+ * v1 < v2 => -1
447
+ * v1 === v2 => 0
448
+ * v1 > v2 => 1
449
+ *
450
+ */
451
+ function compare(v1, v2) {
452
+ const sign = (diff) => (diff === 0 ? 0 : diff < 0 ? -1 : 1);
453
+ const noUndefined = (n) => n !== null && n !== void 0 ? n : Infinity;
454
+ for (const level of ["major", "minor", "patch", "rc"]) {
455
+ if (noUndefined(v1[level]) !== noUndefined(v2[level])) {
456
+ return sign(noUndefined(v1[level]) - noUndefined(v2[level]));
457
+ }
458
+ }
459
+ return 0;
460
+ }
461
+ SemVer.compare = compare;
462
+ /*
463
+ console.log(compare(parse("3.0.0-rc.3"), parse("3.0.0")) === -1 )
464
+ console.log(compare(parse("3.0.0-rc.3"), parse("3.0.0-rc.4")) === -1 )
465
+ console.log(compare(parse("3.0.0-rc.3"), parse("4.0.0")) === -1 )
466
+ */
467
+ function bumpType(params) {
468
+ const versionAhead = typeof params.versionAhead === "string"
469
+ ? parse(params.versionAhead)
470
+ : params.versionAhead;
471
+ const versionBehind = typeof params.versionBehind === "string"
472
+ ? parse(params.versionBehind)
473
+ : params.versionBehind;
474
+ if (compare(versionBehind, versionAhead) === 1) {
475
+ throw new Error(`Version regression ${stringify(versionBehind)} -> ${stringify(versionAhead)}`);
476
+ }
477
+ for (const level of ["major", "minor", "patch", "rc"]) {
478
+ if (versionBehind[level] !== versionAhead[level]) {
479
+ return level;
480
+ }
481
+ }
482
+ return "no bump";
483
+ }
484
+ SemVer.bumpType = bumpType;
485
+ })(SemVer || (SemVer = {}));
486
+ //# sourceMappingURL=SemVer.js.map
487
+
488
+ /***/ }),
489
+
405
490
  /***/ 89693:
406
491
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
407
492
 
package/bin/main.js CHANGED
@@ -96,92 +96,6 @@ const TEST_APP_URL = "https://my-theme.keycloakify.dev";
96
96
 
97
97
  /***/ }),
98
98
 
99
- /***/ 12171:
100
- /***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
101
-
102
- "use strict";
103
- /* harmony export */ __nccwpck_require__.d(__webpack_exports__, {
104
- /* harmony export */ "h": () => (/* binding */ SemVer)
105
- /* harmony export */ });
106
- var SemVer;
107
- (function (SemVer) {
108
- const bumpTypes = ["major", "minor", "patch", "rc", "no bump"];
109
- function parse(versionStr) {
110
- const match = versionStr.match(/^v?([0-9]+)\.([0-9]+)(?:\.([0-9]+))?(?:-rc.([0-9]+))?$/);
111
- if (!match) {
112
- throw new Error(`${versionStr} is not a valid semantic version`);
113
- }
114
- const semVer = Object.assign({ major: parseInt(match[1]), minor: parseInt(match[2]), patch: (() => {
115
- const str = match[3];
116
- return str === undefined ? 0 : parseInt(str);
117
- })() }, (() => {
118
- const str = match[4];
119
- return str === undefined ? {} : { rc: parseInt(str) };
120
- })());
121
- const initialStr = stringify(semVer);
122
- Object.defineProperty(semVer, "parsedFrom", {
123
- enumerable: true,
124
- get: function () {
125
- const currentStr = stringify(this);
126
- if (currentStr !== initialStr) {
127
- throw new Error(`SemVer.parsedFrom can't be read anymore, the version have been modified from ${initialStr} to ${currentStr}`);
128
- }
129
- return versionStr;
130
- }
131
- });
132
- return semVer;
133
- }
134
- SemVer.parse = parse;
135
- function stringify(v) {
136
- return `${v.major}.${v.minor}.${v.patch}${v.rc === undefined ? "" : `-rc.${v.rc}`}`;
137
- }
138
- SemVer.stringify = stringify;
139
- /**
140
- *
141
- * v1 < v2 => -1
142
- * v1 === v2 => 0
143
- * v1 > v2 => 1
144
- *
145
- */
146
- function compare(v1, v2) {
147
- const sign = (diff) => (diff === 0 ? 0 : diff < 0 ? -1 : 1);
148
- const noUndefined = (n) => n !== null && n !== void 0 ? n : Infinity;
149
- for (const level of ["major", "minor", "patch", "rc"]) {
150
- if (noUndefined(v1[level]) !== noUndefined(v2[level])) {
151
- return sign(noUndefined(v1[level]) - noUndefined(v2[level]));
152
- }
153
- }
154
- return 0;
155
- }
156
- SemVer.compare = compare;
157
- /*
158
- console.log(compare(parse("3.0.0-rc.3"), parse("3.0.0")) === -1 )
159
- console.log(compare(parse("3.0.0-rc.3"), parse("3.0.0-rc.4")) === -1 )
160
- console.log(compare(parse("3.0.0-rc.3"), parse("4.0.0")) === -1 )
161
- */
162
- function bumpType(params) {
163
- const versionAhead = typeof params.versionAhead === "string"
164
- ? parse(params.versionAhead)
165
- : params.versionAhead;
166
- const versionBehind = typeof params.versionBehind === "string"
167
- ? parse(params.versionBehind)
168
- : params.versionBehind;
169
- if (compare(versionBehind, versionAhead) === 1) {
170
- throw new Error(`Version regression ${stringify(versionBehind)} -> ${stringify(versionAhead)}`);
171
- }
172
- for (const level of ["major", "minor", "patch", "rc"]) {
173
- if (versionBehind[level] !== versionAhead[level]) {
174
- return level;
175
- }
176
- }
177
- return "no bump";
178
- }
179
- SemVer.bumpType = bumpType;
180
- })(SemVer || (SemVer = {}));
181
- //# sourceMappingURL=SemVer.js.map
182
-
183
- /***/ }),
184
-
185
99
  /***/ 73036:
186
100
  /***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
187
101
 
@@ -16190,17 +16104,12 @@ function getBuildContext(params) {
16190
16104
  };
16191
16105
  }
16192
16106
  //# sourceMappingURL=buildContext.js.map
16193
- // EXTERNAL MODULE: ./dist/bin/tools/SemVer.js
16194
- var SemVer = __nccwpck_require__(12171);
16195
16107
  ;// CONCATENATED MODULE: ./dist/bin/main.js
16196
16108
 
16197
16109
 
16198
16110
 
16199
16111
 
16200
16112
 
16201
-
16202
-
16203
-
16204
16113
  assertNoPnpmDlx();
16205
16114
  const program = Z({
16206
16115
  name: "keycloakify",
@@ -16293,36 +16202,10 @@ program
16293
16202
  skip,
16294
16203
  handler: async ({ projectDirPath, keycloakVersion, port, realmJsonFilePath }) => {
16295
16204
  const { command } = await Promise.all(/* import() */[__nccwpck_require__.e(805), __nccwpck_require__.e(525), __nccwpck_require__.e(33), __nccwpck_require__.e(503), __nccwpck_require__.e(682)]).then(__nccwpck_require__.bind(__nccwpck_require__, 6682));
16296
- validate_keycloak_version: {
16297
- if (keycloakVersion === undefined) {
16298
- break validate_keycloak_version;
16299
- }
16300
- const isValidVersion = (() => {
16301
- if (typeof keycloakVersion === "number") {
16302
- return false;
16303
- }
16304
- try {
16305
- SemVer/* SemVer.parse */.h.parse(keycloakVersion);
16306
- }
16307
- catch (_a) {
16308
- return false;
16309
- }
16310
- return;
16311
- })();
16312
- if (isValidVersion) {
16313
- break validate_keycloak_version;
16314
- }
16315
- console.log(source_default().red([
16316
- `Invalid Keycloak version: ${keycloakVersion}`,
16317
- "It should be a valid semver version example: 26.0.4"
16318
- ].join(" ")));
16319
- process.exit(1);
16320
- }
16321
- (0,assert/* assert */.h)((0,assert.is)(keycloakVersion));
16322
16205
  await command({
16323
16206
  buildContext: getBuildContext({ projectDirPath }),
16324
16207
  cliCommandOptions: {
16325
- keycloakVersion,
16208
+ keycloakVersion: keycloakVersion === undefined ? undefined : `${keycloakVersion}`,
16326
16209
  port,
16327
16210
  realmJsonFilePath
16328
16211
  }
@@ -5,4 +5,7 @@ export type BuildContextLike = {
5
5
  };
6
6
  export declare function getSupportedDockerImageTags(params: {
7
7
  buildContext: BuildContextLike;
8
- }): Promise<string[]>;
8
+ }): Promise<{
9
+ allSupportedTags: string[];
10
+ latestMajorTags: string[];
11
+ }>;
@@ -30,7 +30,14 @@ export type ParsedRealmJson = {
30
30
  "post.logout.redirect.uris"?: string;
31
31
  };
32
32
  protocol?: string;
33
- protocolMappers?: unknown[];
33
+ protocolMappers?: {
34
+ id: string;
35
+ name: string;
36
+ protocol: string;
37
+ protocolMapper: string;
38
+ consentRequired: boolean;
39
+ config?: Record<string, string>;
40
+ }[];
34
41
  }[];
35
42
  };
36
43
  export declare function readRealmJsonFile(params: {