@devkong/cli 0.0.17 → 0.0.19

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.
Files changed (2) hide show
  1. package/index.js +11 -5
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -73307,11 +73307,17 @@ function uuidToJavaHashCode(uuid) {
73307
73307
  }
73308
73308
  function generateShortId() {
73309
73309
  const sqids = new Sqids({
73310
- minLength: 12
73310
+ minLength: 12,
73311
+ alphabet: "abcdefghijklmnopqrstuvwxyz0123456789"
73311
73312
  });
73312
73313
  const uuidHash = [];
73313
73314
  uuidHash.push(uuidToJavaHashCode(guid()) & 2147483647);
73314
- return sqids.encode(uuidHash);
73315
+ let id = sqids.encode(uuidHash).toLowerCase().substring(0, 12);
73316
+ if (!/^[a-z]/.test(id)) {
73317
+ const randomLetter = String.fromCharCode(Math.floor(Math.random() * 26) + 97);
73318
+ id = randomLetter + id.slice(1, 11);
73319
+ }
73320
+ return id;
73315
73321
  }
73316
73322
  async function spawnCommand(commandText, logger = null, shell = false) {
73317
73323
  return new Promise((resolve2, reject) => {
@@ -73450,6 +73456,7 @@ var ConfigureCommand = class {
73450
73456
  var import_create_nx_workspace = __toESM(require_create_nx_workspace());
73451
73457
 
73452
73458
  // packages/kong-cli/src/common/kongJson.ts
73459
+ var import_ajv = __toESM(require_ajv());
73453
73460
  var import_fs3 = __toESM(require("fs"));
73454
73461
 
73455
73462
  // packages/kong-cli/src/common/kongJsonSchema.ts
@@ -73591,7 +73598,6 @@ var KONG_JSON_SCHEMA = {
73591
73598
  };
73592
73599
 
73593
73600
  // packages/kong-cli/src/common/kongJson.ts
73594
- var import_ajv = __toESM(require_ajv());
73595
73601
  var ajv = new import_ajv.default();
73596
73602
  var validate2 = ajv.compile(KONG_JSON_SCHEMA);
73597
73603
  var SUPPORTED_SDK = ["kotlin", "python"];
@@ -73601,9 +73607,9 @@ function validateKongJson(kongJson) {
73601
73607
  "The `id` field should not be empty. Please provide a valid identifier in kong.json."
73602
73608
  );
73603
73609
  }
73604
- if (!/^[a-zA-Z0-9]{12}$/.test(kongJson.id)) {
73610
+ if (!/^[a-z][a-z0-9]{11}$/.test(kongJson.id)) {
73605
73611
  throw new AppError(
73606
- "The `id` should contain exactly 12 alphanumeric characters (letters and digits). Ensure the ID is not longer than 12 characters and does not include any special characters.Please provide a valid identifier in kong.json."
73612
+ "The id must be exactly 12 characters long and consist of alphanumeric characters (lowercase letters and digits). It must start with a letter. Ensure the ID does not exceed 12 characters. Please provide a valid identifier in kong.json"
73607
73613
  );
73608
73614
  }
73609
73615
  if (!SUPPORTED_SDK.includes(kongJson.sdk)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devkong/cli",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "type": "commonjs",
5
5
  "main": "./index.js",
6
6
  "typings": "./index.d.ts",