@devkong/cli 0.0.25 → 0.0.26

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/index.js CHANGED
@@ -74400,6 +74400,19 @@ var Sqids = class {
74400
74400
  };
74401
74401
 
74402
74402
  // packages/kong-cli/src/common/utils.ts
74403
+ function commandToArray(inputCommand) {
74404
+ const regex4 = /[^\s"]+|"([^"]*)"/g;
74405
+ const result = [];
74406
+ let match2;
74407
+ while ((match2 = regex4.exec(inputCommand)) !== null) {
74408
+ if (match2[1]) {
74409
+ result.push(match2[1]);
74410
+ } else {
74411
+ result.push(match2[0]);
74412
+ }
74413
+ }
74414
+ return result;
74415
+ }
74403
74416
  function optionalEnv(key) {
74404
74417
  return process.env[key];
74405
74418
  }
@@ -74444,11 +74457,14 @@ function generateShortId() {
74444
74457
  return id;
74445
74458
  }
74446
74459
  async function spawnCommand(commandText, logger = null, shell = false) {
74460
+ const commandWithArgs = commandToArray(commandText).filter((s) => s);
74461
+ logger.debug(commandText);
74462
+ const command = commandWithArgs.shift();
74463
+ return spawnCommandWithArgs(command, commandWithArgs, logger, shell);
74464
+ }
74465
+ async function spawnCommandWithArgs(command, commandArgs, logger = null, shell = false) {
74447
74466
  return new Promise((resolve2, reject) => {
74448
- const commandWithArgs = commandText.split(" ").filter((s) => s);
74449
- logger.debug(commandText);
74450
- const command = commandWithArgs.shift();
74451
- const child = (0, import_child_process.spawn)(command, commandWithArgs, {
74467
+ const child = (0, import_child_process.spawn)(command, commandArgs, {
74452
74468
  shell: shell || process.platform !== "win32",
74453
74469
  stdio: ["pipe", "pipe", "pipe"]
74454
74470
  });
@@ -74492,6 +74508,9 @@ function printError(message2, error) {
74492
74508
  console.error(message2, error);
74493
74509
  }
74494
74510
  }
74511
+ function escapePathSpaces(sourcePath) {
74512
+ return sourcePath.indexOf(" ") <= 0 ? sourcePath : `"${sourcePath}"`;
74513
+ }
74495
74514
 
74496
74515
  // packages/kong-cli/src/common/profile.ts
74497
74516
  var KONG_CONFIG_DIR = import_path2.default.join((0, import_os.homedir)(), ".kong");
@@ -77339,8 +77358,9 @@ var InstallCommand = class {
77339
77358
  title: "Installing dependencies with pip",
77340
77359
  task: async (_2, task) => {
77341
77360
  const scriptPath = this.scriptPath();
77342
- await spawnCommand(
77343
- `${scriptPath} ${workspaceDirectory}`,
77361
+ await spawnCommandWithArgs(
77362
+ escapePathSpaces(scriptPath),
77363
+ [escapePathSpaces(workspaceDirectory)],
77344
77364
  new ListrTaskLogger(task, this.verbose ? 3 /* DEBUG */ : 0 /* INFO */),
77345
77365
  true
77346
77366
  );
@@ -77747,7 +77767,7 @@ var PublishVersionCommand = class {
77747
77767
  getPythonSchemaCmdText() {
77748
77768
  const engine = this.isWin ? ".\\.venv\\Scripts\\python.exe" : "./.venv/bin/python";
77749
77769
  const mainPyPath = resolveProjectPath("src/main.py");
77750
- return `${engine} ${mainPyPath} --schema`;
77770
+ return `${engine} ${escapePathSpaces(mainPyPath)} --schema`;
77751
77771
  }
77752
77772
  getKotlinBuildCmdTask() {
77753
77773
  return `${this.wslPrefix} ./gradlew build -Dquarkus.package.main-class=io.kong.sdkkotlin.JsonSchemaGeneratingQuarkusApp`;
@@ -77764,7 +77784,7 @@ var PublicClient = class {
77764
77784
  this.baseUrl = joinUrlAndPath(baseUrl, "/api/public");
77765
77785
  }
77766
77786
  async assignExtensionAlias(extensionId, alias) {
77767
- const url2 = joinUrlAndPath(this.baseUrl, `v1/extensions/${extensionId}/aliases`);
77787
+ const url2 = joinUrlAndPath(this.baseUrl, "v1/extensions/aliases");
77768
77788
  await axios_default.post(url2, alias, await this.headerProvider());
77769
77789
  }
77770
77790
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devkong/cli",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "type": "commonjs",
5
5
  "main": "./index.js",
6
6
  "typings": "./index.d.ts",
@@ -11,4 +11,6 @@ export declare function loadJsonFile<T>(filePath: string): T;
11
11
  export declare function resolveProjectPath(fileName: string): string;
12
12
  export declare function generateShortId(): ShortUUID;
13
13
  export declare function spawnCommand(commandText: string, logger?: ILogger, shell?: boolean): Promise<string>;
14
+ export declare function spawnCommandWithArgs(command: string, commandArgs: string[], logger?: ILogger, shell?: boolean): Promise<string>;
14
15
  export declare function printError(message: string, error: unknown): void;
16
+ export declare function escapePathSpaces(sourcePath: string): string;
@@ -30,7 +30,7 @@ export type { TextBlock } from "./lib/text";
30
30
  export { TextReader } from "./lib/textReader";
31
31
  export { DEFAULT_TIMEZONE } from "./lib/timezone";
32
32
  export type { Timezone } from "./lib/timezone";
33
- export type { Action, DeepPartial, Distinct, Loading, NonFunctionProperties, Optional, Pair, Primitive, PropertyPath, PropertyPathMap, RequiredProperties, Result, StringKeys, UnArray, ValidateKeys, } from "./lib/types";
33
+ export type { Action, DeepPartial, Distinct, Indexed, Loading, NonFunctionProperties, Optional, Pair, PreventDefault, Primitive, PropertyPath, PropertyPathMap, RequiredProperties, Result, StringKeys, UnArray, ValidateKeys, } from "./lib/types";
34
34
  export { joinUrlAndPath, urlText } from "./lib/url";
35
35
  export type { UrlText } from "./lib/url";
36
36
  export type { User } from "./lib/user";
@@ -42,4 +42,9 @@ type NonFunctionKeys<T> = {
42
42
  [K in keyof T]: T[K] extends Function ? never : K;
43
43
  }[keyof T];
44
44
  export type NonFunctionProperties<T> = Pick<T, NonFunctionKeys<T>>;
45
+ export interface Indexed<T> {
46
+ index: number;
47
+ data: T;
48
+ }
49
+ export type PreventDefault = Distinct<boolean, "PreventDefault">;
45
50
  export {};
@@ -1,8 +1,8 @@
1
1
  import { KongSpecHowToInvoke } from "@kong/spec";
2
2
  import { AppAlias } from "./appAlias";
3
- import { AppExtensionAliasUse } from "./appExtensionAliasUse";
3
+ import { AppExtensionAliasUseDetails } from "./appExtensionAliasUseDetails";
4
4
  import { SdkExtensionAlias } from "./sdkExtensionAlias";
5
- export interface AppExtensionAliasDetails extends AppAlias<AppExtensionAliasUse> {
5
+ export interface AppExtensionAliasDetails extends AppAlias<AppExtensionAliasUseDetails> {
6
6
  inputSchema?: NonNullable<SdkExtensionAlias["input"]>["schema"];
7
7
  outputSchema?: NonNullable<SdkExtensionAlias["output"]>["schema"];
8
8
  invoke?: Partial<KongSpecHowToInvoke>;