@devkong/cli 0.0.40 → 0.0.43

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
@@ -58633,28 +58633,6 @@ var require__ = __commonJS({
58633
58633
  }
58634
58634
  });
58635
58635
 
58636
- // node_modules/commander/esm.mjs
58637
- var import_index = __toESM(require_commander(), 1);
58638
- var {
58639
- program,
58640
- createCommand,
58641
- createArgument,
58642
- createOption,
58643
- CommanderError,
58644
- InvalidArgumentError,
58645
- InvalidOptionArgumentError,
58646
- // deprecated old name
58647
- Command,
58648
- Argument,
58649
- Option,
58650
- Help
58651
- } = import_index.default;
58652
-
58653
- // packages/kong-cli/src/index.ts
58654
- var import_dotenv = __toESM(require_main());
58655
- var import_dotenv_expand = __toESM(require_main2());
58656
- var import_path5 = __toESM(require("path"));
58657
-
58658
58636
  // packages/kong-ts/src/lib/text.ts
58659
58637
  function trimSlashes(text) {
58660
58638
  return text.replace(/^\/+|\/+$/g, "");
@@ -72302,6 +72280,28 @@ function joinUrlAndPath(baseUrl, ...pathSegments) {
72302
72280
  return urlText([trimmedBaseUrl, ...trimmedPathSegments].join("/"));
72303
72281
  }
72304
72282
 
72283
+ // node_modules/commander/esm.mjs
72284
+ var import_index = __toESM(require_commander(), 1);
72285
+ var {
72286
+ program,
72287
+ createCommand,
72288
+ createArgument,
72289
+ createOption,
72290
+ CommanderError,
72291
+ InvalidArgumentError,
72292
+ InvalidOptionArgumentError,
72293
+ // deprecated old name
72294
+ Command,
72295
+ Argument,
72296
+ Option,
72297
+ Help
72298
+ } = import_index.default;
72299
+
72300
+ // packages/kong-cli/src/index.ts
72301
+ var import_dotenv = __toESM(require_main());
72302
+ var import_dotenv_expand = __toESM(require_main2());
72303
+ var import_path5 = __toESM(require("path"));
72304
+
72305
72305
  // packages/kong-cli/src/commands/configureCommand.ts
72306
72306
  var import_keyring = __toESM(require_keyring());
72307
72307
 
@@ -81939,8 +81939,8 @@ var RegistryClient = class {
81939
81939
  this.headerProvider = headerProvider2;
81940
81940
  this.baseUrl = joinUrlAndPath(baseUrl, "/api/registry");
81941
81941
  }
81942
- async getPublishDetails(repoName) {
81943
- const url2 = joinUrlAndPath(this.baseUrl, "v1/repository", repoName, "publish/details");
81942
+ async getPublishDetails(appName) {
81943
+ const url2 = joinUrlAndPath(this.baseUrl, "v1/repository", appName, "publish/details");
81944
81944
  return (await axios_default.post(url2, {}, await this.headerProvider())).data;
81945
81945
  }
81946
81946
  };
@@ -81948,6 +81948,7 @@ var RegistryClient = class {
81948
81948
  // packages/kong-cli/src/commands/publishVersionCommand.ts
81949
81949
  var PublishVersionCommand = class {
81950
81950
  constructor(profile, verbose = false, contractPath = null) {
81951
+ this.profile = profile;
81951
81952
  this.verbose = verbose;
81952
81953
  this.contractPath = contractPath;
81953
81954
  this.isWin = process.platform === "win32";
@@ -81964,8 +81965,8 @@ var PublishVersionCommand = class {
81964
81965
  get wslPrefix() {
81965
81966
  return this.isWin && !this.hasDocker ? "wsl" : "";
81966
81967
  }
81967
- async execute(repoName, notes) {
81968
- await new Listr([...this.flowFactory(repoName, notes)], {
81968
+ async execute(appName, notes) {
81969
+ await new Listr([...this.flowFactory(appName, notes)], {
81969
81970
  renderer: "default",
81970
81971
  rendererOptions: {
81971
81972
  logger: new ListrLogger({
@@ -81974,7 +81975,7 @@ var PublishVersionCommand = class {
81974
81975
  }
81975
81976
  }).run();
81976
81977
  }
81977
- *flowFactory(repoName, notes) {
81978
+ *flowFactory(appName, notes) {
81978
81979
  const kongJson = getKongJson();
81979
81980
  if (kongJson.sdk === "kotlin" && !this.contractPath) {
81980
81981
  yield {
@@ -82005,15 +82006,16 @@ var PublishVersionCommand = class {
82005
82006
  yield {
82006
82007
  title: "Get publish details",
82007
82008
  task: async (ctx) => {
82008
- ctx.publishDetails = await this.registryClient.getPublishDetails(repoName);
82009
+ ctx.publishDetails = await this.registryClient.getPublishDetails(appName);
82009
82010
  }
82010
82011
  };
82011
82012
  yield {
82012
82013
  title: "Docker login",
82013
82014
  task: async (ctx, task) => {
82014
- const regUrl = this.resolveRegistryUrl(ctx.publishDetails.repoName);
82015
+ const publishDetails = ctx.publishDetails;
82016
+ const regUrl = this.resolveRegistryUrl(publishDetails.repoName);
82015
82017
  await spawnCommand(
82016
- this.dockerLoginCmdText(ctx.publishDetails.userName, ctx.publishDetails.token, regUrl),
82018
+ this.dockerLoginCmdText(publishDetails.userName, publishDetails.token, regUrl),
82017
82019
  new ListrTaskLogger(task, this.verbose ? 3 /* DEBUG */ : 0 /* INFO */)
82018
82020
  );
82019
82021
  },
@@ -82022,9 +82024,9 @@ var PublishVersionCommand = class {
82022
82024
  yield {
82023
82025
  title: "Docker build",
82024
82026
  task: async (ctx, task) => {
82025
- const details = ctx.publishDetails;
82026
- const regUrl = this.resolveRegistryUrl(details.repoName);
82027
- ctx.fullImageName = `${regUrl}/${details.imageName}:${details.imageVersion}`;
82027
+ const publishDetails = ctx.publishDetails;
82028
+ const regUrl = this.resolveRegistryUrl(publishDetails.repoName);
82029
+ ctx.fullImageName = `${regUrl}/${publishDetails.imageName}:${publishDetails.imageVersion}`;
82028
82030
  await spawnCommand(
82029
82031
  this.dockerBuildCmdText(ctx.fullImageName),
82030
82032
  new ListrTaskLogger(task, this.verbose ? 3 /* DEBUG */ : 0 /* INFO */)
@@ -82046,6 +82048,7 @@ var PublishVersionCommand = class {
82046
82048
  yield {
82047
82049
  title: "Save publish details",
82048
82050
  task: async (ctx, task) => {
82051
+ const publishDetails = ctx.publishDetails;
82049
82052
  const jsonSchemas = JSON.parse(ctx.contractText);
82050
82053
  const snapshot = {
82051
82054
  extensionId: kongJson.id,
@@ -82054,14 +82057,15 @@ var PublishVersionCommand = class {
82054
82057
  inputSchema: jsonSchemas.input,
82055
82058
  outputSchema: jsonSchemas.output,
82056
82059
  metadata: kongJson,
82057
- version: Number(ctx.publishDetails.imageVersion),
82060
+ version: Number(publishDetails.imageVersion),
82058
82061
  notes,
82059
82062
  checkpoint: "",
82060
82063
  created: utcNow(DEFAULT_TIMEZONE),
82061
82064
  createdBy: ""
82062
82065
  };
82063
82066
  await this.managementClient.createExtensionSnapshot(kongJson.id, kongJson.name, snapshot);
82064
- task.output = `The version ${ctx.publishDetails.imageVersion} has been successfully published!`;
82067
+ task.output = `The version ${publishDetails.imageVersion} has been successfully published!
82068
+ ${joinUrlAndPath(this.profile.kongBaseUrl, "/extensions/aliases")}`;
82065
82069
  },
82066
82070
  rendererOptions: this.defaultRendererOptions
82067
82071
  };
@@ -82116,6 +82120,7 @@ function validateName(value) {
82116
82120
  }
82117
82121
  var SetAliasCommand = class {
82118
82122
  constructor(profile) {
82123
+ this.profile = profile;
82119
82124
  const clientHeaderProvider = headerProvider(profile);
82120
82125
  this.publicClient = new PublicClient(profile.kongBaseUrl, clientHeaderProvider);
82121
82126
  this.managementClient = new ManagementClient(profile.kongBaseUrl, clientHeaderProvider);
@@ -82168,7 +82173,8 @@ var SetAliasCommand = class {
82168
82173
  updatedBy: ""
82169
82174
  };
82170
82175
  await this.publicClient.assignExtensionAlias(ctx.kongJson.id, alias);
82171
- task.output = "Please wait a moment for it to appear in the UI.";
82176
+ task.output = `Please wait a moment for it to appear in the UI.
82177
+ ${joinUrlAndPath(this.profile.kongBaseUrl, "/extensions/aliases")}`;
82172
82178
  },
82173
82179
  rendererOptions: { persistentOutput: true }
82174
82180
  }
@@ -82226,12 +82232,13 @@ async function main() {
82226
82232
  ).addOption(new Option("--profile <name>", "Configured Kong profile to use").default("default")).addOption(new Option("--verbose", "Show full logs during command execution")).addOption(new Option("--notes [text]", "Optional version notes").default("")).addOption(new Option("--schema <path>", "Schema file to use").default(null)).action(async (options) => {
82227
82233
  try {
82228
82234
  printProfile(options.profile);
82235
+ const profile = getProfile(options.profile);
82229
82236
  const kongJson = getKongJson();
82230
82237
  await new PublishVersionCommand(
82231
82238
  getProfile(options.profile),
82232
82239
  options.verbose,
82233
82240
  options.schema
82234
- ).execute(kongJson.name, options.notes);
82241
+ ).execute(`${parseTenant(profile.kongBaseUrl)}-k-extension-${kongJson.id}`, options.notes);
82235
82242
  } catch (ex) {
82236
82243
  printError("publish-version command failed", ex);
82237
82244
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devkong/cli",
3
- "version": "0.0.40",
3
+ "version": "0.0.43",
4
4
  "type": "commonjs",
5
5
  "main": "./index.js",
6
6
  "typings": "./index.d.ts",
@@ -1,6 +1,7 @@
1
1
  import { ListrTask } from "listr2";
2
2
  import { Profile } from "../common/profile";
3
3
  export declare class PublishVersionCommand {
4
+ private profile;
4
5
  private verbose;
5
6
  private contractPath;
6
7
  private readonly isWin;
@@ -10,8 +11,8 @@ export declare class PublishVersionCommand {
10
11
  private defaultRendererOptions;
11
12
  private get wslPrefix();
12
13
  constructor(profile: Profile, verbose?: boolean, contractPath?: string);
13
- execute(repoName: string, notes: string): Promise<void>;
14
- flowFactory(repoName: string, notes: string): Generator<ListrTask>;
14
+ execute(appName: string, notes: string): Promise<void>;
15
+ flowFactory(appName: string, notes: string): Generator<ListrTask>;
15
16
  private resolveRegistryUrl;
16
17
  private dockerBuildCmdText;
17
18
  private dockerPushCmdText;
@@ -1,5 +1,6 @@
1
1
  import { Profile } from "../common/profile";
2
2
  export declare class SetAliasCommand {
3
+ private profile;
3
4
  private publicClient;
4
5
  private managementClient;
5
6
  constructor(profile: Profile);
@@ -1,6 +1,6 @@
1
1
  import { UrlText, User } from "@kong/ts";
2
2
  import { HeaderProvider } from "./api";
3
- interface PublishDetails {
3
+ export interface PublishDetails {
4
4
  repoName: string;
5
5
  imageName: string;
6
6
  imageVersion: string;
@@ -11,6 +11,5 @@ export declare class RegistryClient {
11
11
  private headerProvider;
12
12
  private readonly baseUrl;
13
13
  constructor(baseUrl: UrlText, headerProvider: HeaderProvider);
14
- getPublishDetails(repoName: string): Promise<PublishDetails>;
14
+ getPublishDetails(appName: string): Promise<PublishDetails>;
15
15
  }
16
- export {};