@devkong/cli 0.0.67-alpha.8 → 0.0.67-alpha.9

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.
@@ -1,28 +1,28 @@
1
- @echo off
2
-
3
- set EXTENSION_DIR=%1
4
- echo %EXTENSION_DIR%
5
-
6
- where python >nul 2>&1
7
- if %errorlevel% equ 0 (
8
- set PYTHON_CMD=python
9
- ) else (
10
- set PYTHON_CMD=python3
11
- )
12
-
13
- where pip >nul 2>&1
14
- if %errorlevel% equ 0 (
15
- set PIP_CMD=pip
16
- ) else (
17
- set PIP_CMD=pip3
18
- )
19
-
20
- cd %EXTENSION_DIR%
21
-
22
- %PYTHON_CMD% -m venv .venv
23
-
24
- call .venv\Scripts\activate.bat
25
-
26
- %PIP_CMD% freeze > requirements-lock.txt
27
- %PIP_CMD% install --default-timeout=120 -r requirements.txt -r requirements-dev.txt
28
- %PIP_CMD% freeze > requirements-lock.txt
1
+ @echo off
2
+
3
+ set EXTENSION_DIR=%1
4
+ echo %EXTENSION_DIR%
5
+
6
+ where python >nul 2>&1
7
+ if %errorlevel% equ 0 (
8
+ set PYTHON_CMD=python
9
+ ) else (
10
+ set PYTHON_CMD=python3
11
+ )
12
+
13
+ cd %EXTENSION_DIR%
14
+
15
+ REM Recreate the venv from scratch so a stale interpreter path (e.g. left over
16
+ REM after a Python upgrade or a moved/copied project) can't leave pip pointing
17
+ REM at a missing binary.
18
+ %PYTHON_CMD% -m venv --clear .venv
19
+ if errorlevel 1 exit /b 1
20
+
21
+ call .venv\Scripts\activate.bat
22
+
23
+ REM Invoke pip via `python -m pip` rather than the pip/pip3 wrapper so we don't
24
+ REM depend on the wrapper script's (possibly stale) shebang.
25
+ python -m pip freeze > requirements-lock.txt
26
+ python -m pip install --default-timeout=120 -r requirements.txt -r requirements-dev.txt
27
+ if errorlevel 1 exit /b 1
28
+ python -m pip freeze > requirements-lock.txt
package/index.js CHANGED
@@ -60845,14 +60845,14 @@ var ConfigureCommand = class {
60845
60845
  const { profileName } = await dist_default14.prompt({
60846
60846
  type: "select",
60847
60847
  name: "profileName",
60848
- message: "Select a profile to configure:",
60848
+ message: "select a profile to configure:",
60849
60849
  choices: [...profileNames, "Create a new profile"]
60850
60850
  });
60851
60851
  if (profileName === "Create a new profile") {
60852
60852
  const { newProfileName } = await dist_default14.prompt({
60853
60853
  type: "input",
60854
60854
  name: "newProfileName",
60855
- message: "Enter name for the new profile:",
60855
+ message: "enter name for the new profile:",
60856
60856
  validate: (input) => profileNames.includes(input) ? "Profile already exists!" : true
60857
60857
  });
60858
60858
  return [newProfileName, createEmptyProfile()];
@@ -60863,20 +60863,20 @@ var ConfigureCommand = class {
60863
60863
  const answerUrl = await dist_default14.prompt({
60864
60864
  type: "input",
60865
60865
  name: "kongUrl",
60866
- message: `Enter URL for profile "${name}":`,
60866
+ message: `enter URL for profile "${name}":`,
60867
60867
  default: profile.kongBaseUrl
60868
60868
  });
60869
60869
  const answerUserName = await dist_default14.prompt({
60870
60870
  type: "input",
60871
60871
  name: "userName",
60872
- message: `Enter user name for profile "${name}":`,
60872
+ message: `enter user name for profile "${name}":`,
60873
60873
  default: profile.userName
60874
60874
  });
60875
60875
  const answerPassword = await dist_default14.prompt({
60876
60876
  type: "password",
60877
60877
  name: "password",
60878
60878
  mask: "*",
60879
- message: `Enter password for user "${answerUserName.userName}":`,
60879
+ message: `enter password for user "${answerUserName.userName}":`,
60880
60880
  default: ""
60881
60881
  });
60882
60882
  const updated = {
@@ -60888,7 +60888,7 @@ var ConfigureCommand = class {
60888
60888
  const entry = new import_keyring.Entry(updated.kongBaseUrl, updated.userName);
60889
60889
  entry.setPassword(answerPassword.password);
60890
60890
  }
60891
- console.log(`Configuration for profile "${name}" has been updated`);
60891
+ console.log(`configuration for profile "${name}" has been updated`);
60892
60892
  return updated;
60893
60893
  }
60894
60894
  };
@@ -62923,7 +62923,7 @@ var InstallCommand = class {
62923
62923
  async execute(workspaceDirectory) {
62924
62924
  await new Listr([
62925
62925
  {
62926
- title: "Installing dependencies with pip",
62926
+ title: "installing dependencies with pip",
62927
62927
  task: async (_2, task) => {
62928
62928
  const scriptPath = this.scriptPath();
62929
62929
  await spawnCommandWithArgs(
@@ -63119,17 +63119,19 @@ var ListAliasesCommand = class {
63119
63119
  await new Listr(
63120
63120
  [
63121
63121
  {
63122
- title: "List extension aliases",
63122
+ title: "list extension aliases",
63123
63123
  task: async (ctx, task) => {
63124
63124
  const kongJson = getKongJson();
63125
63125
  const aliases = await this.managementClient.getExtensionSnapshotAliases(kongJson.id);
63126
63126
  if (aliases.length === 0) {
63127
- task.output = "No aliases available";
63127
+ task.output = "no aliases available";
63128
63128
  } else {
63129
63129
  const result = [];
63130
63130
  for (const alias of aliases) {
63131
63131
  for (const item of alias.use) {
63132
- result.push(`${alias.name}, ${item.snapshot.version}, ${item.balance}%`);
63132
+ result.push(
63133
+ `${alias.name}, ${item.snapshot.version}, ${item.balance ? `${item.balance}%` : "shadow"}`
63134
+ );
63133
63135
  }
63134
63136
  }
63135
63137
  task.output = result.join("\n");
@@ -63165,12 +63167,12 @@ var ListVersionsCommand = class {
63165
63167
  await new Listr(
63166
63168
  [
63167
63169
  {
63168
- title: "List extension snapshot versions",
63170
+ title: "list extension snapshot versions",
63169
63171
  task: async (ctx, task) => {
63170
63172
  const kongJson = getKongJson();
63171
63173
  const versions = await this.managementClient.getExtensionSnapshotVersions(kongJson.id);
63172
63174
  if (versions.length === 0) {
63173
- task.output = "No versions available";
63175
+ task.output = "no versions available";
63174
63176
  } else {
63175
63177
  const result = [];
63176
63178
  for (const ver of versions) {
@@ -63261,7 +63263,7 @@ var PublishVersionCommand = class {
63261
63263
  const kongJson = getKongJson();
63262
63264
  if (kongJson.sdk === "kotlin" && !this.contractPath) {
63263
63265
  yield {
63264
- title: "Build extension",
63266
+ title: "build extension",
63265
63267
  task: async (ctx, task) => {
63266
63268
  const logger = new ListrTaskLogger(task, this.verbose ? 3 /* DEBUG */ : 0 /* INFO */);
63267
63269
  const cmdText = this.getKotlinBuildCmdTask();
@@ -63272,7 +63274,7 @@ var PublishVersionCommand = class {
63272
63274
  };
63273
63275
  }
63274
63276
  yield {
63275
- title: "Generate schema",
63277
+ title: "generate schema",
63276
63278
  task: async (ctx, task) => {
63277
63279
  const logger = new ListrTaskLogger(task, this.verbose ? 3 /* DEBUG */ : 0 /* INFO */);
63278
63280
  if (this.contractPath) {
@@ -63287,13 +63289,13 @@ var PublishVersionCommand = class {
63287
63289
  rendererOptions: this.defaultRendererOptions
63288
63290
  };
63289
63291
  yield {
63290
- title: "Get publish details",
63292
+ title: "get publish details",
63291
63293
  task: async (ctx) => {
63292
63294
  ctx.publishDetails = await this.registryClient.getPublishDetails(appName);
63293
63295
  }
63294
63296
  };
63295
63297
  yield {
63296
- title: "Docker login",
63298
+ title: "docker login",
63297
63299
  task: async (ctx, task) => {
63298
63300
  const publishDetails = ctx.publishDetails;
63299
63301
  const regUrl = this.resolveRegistryUrl(publishDetails.repoName);
@@ -63305,7 +63307,7 @@ var PublishVersionCommand = class {
63305
63307
  rendererOptions: this.defaultRendererOptions
63306
63308
  };
63307
63309
  yield {
63308
- title: "Docker build",
63310
+ title: "docker build",
63309
63311
  task: async (ctx, task) => {
63310
63312
  const publishDetails = ctx.publishDetails;
63311
63313
  const regUrl = this.resolveRegistryUrl(publishDetails.repoName);
@@ -63318,7 +63320,7 @@ var PublishVersionCommand = class {
63318
63320
  rendererOptions: this.defaultRendererOptions
63319
63321
  };
63320
63322
  yield {
63321
- title: "Docker push",
63323
+ title: "docker push",
63322
63324
  task: async (ctx, task) => {
63323
63325
  const cmd = this.dockerPushCmdText(ctx.fullImageName);
63324
63326
  await spawnCommand(
@@ -63329,7 +63331,7 @@ var PublishVersionCommand = class {
63329
63331
  rendererOptions: this.defaultRendererOptions
63330
63332
  };
63331
63333
  yield {
63332
- title: "Save publish details",
63334
+ title: "save publish details",
63333
63335
  task: async (ctx, task) => {
63334
63336
  const publishDetails = ctx.publishDetails;
63335
63337
  let autoGeneratedContract;
@@ -63398,7 +63400,7 @@ var PublishVersionCommand = class {
63398
63400
  });
63399
63401
  await this.managementClient.createExtensionSnapshot(kongJson.id, snapshot);
63400
63402
  task.output = [
63401
- `The version ${publishDetails.imageVersion} has been successfully published!`,
63403
+ `the version ${publishDetails.imageVersion} has been successfully published!`,
63402
63404
  joinUrlAndPath(this.profile.kongBaseUrl, "/extensions/aliases")
63403
63405
  ].join("\n");
63404
63406
  },
@@ -63552,7 +63554,7 @@ var SetAliasCommand = class {
63552
63554
  await new Listr(
63553
63555
  [
63554
63556
  {
63555
- title: "Get snapshot details",
63557
+ title: "get snapshot details",
63556
63558
  task: async (ctx, task) => {
63557
63559
  ctx.kongJson = getKongJson();
63558
63560
  ctx.snapshot = await this.managementClient.getExtensionSnapshot(
@@ -63565,7 +63567,7 @@ var SetAliasCommand = class {
63565
63567
  }
63566
63568
  },
63567
63569
  {
63568
- title: "Assign extension alias",
63570
+ title: "assign extension alias",
63569
63571
  task: async (ctx, task) => {
63570
63572
  const now = utcNow(DEFAULT_TIMEZONE);
63571
63573
  const aliasUse = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devkong/cli",
3
- "version": "0.0.67-alpha.8",
3
+ "version": "0.0.67-alpha.9",
4
4
  "type": "commonjs",
5
5
  "main": "./index.js",
6
6
  "typings": "./index.d.ts",
@@ -1,7 +1,7 @@
1
1
  export { makeServerlessJavaAppProps, serverlessFlowBuilder, stringifyServerlessFlow, } from "./lib/kongServerless";
2
2
  export type { FloweyServerlessBuilder } from "./lib/kongServerless";
3
3
  export type { KongSpecJobSession } from "./lib/kongSession";
4
- export type { KongSpecAction, KongSpecActionCallFunction, KongSpecActionCallProcess, KongSpecActionDelay, KongSpecActionInject, KongSpecActionSendEvent, KongSpecAnnotation, KongSpecBranch, KongSpecCache, KongSpecCallModel, KongSpecCircuitBreaker, KongSpecCondition, KongSpecEffect, KongSpecEffectStatus, KongSpecError, KongSpecEventBroker, KongSpecEventConnection, KongSpecFeatureCompensation, KongSpecFlow, KongSpecFunctionRef, KongSpecHowToInvoke, KongSpecHowToOutput, KongSpecHowToStore, KongSpecOutputAppend, KongSpecProcessRef, KongSpecRecord, KongSpecRecordHeader, KongSpecRetry, KongSpecRule, KongSpecSecretRef, KongSpecSecretType, KongSpecState, KongSpecStateCallFunction, KongSpecStateCallProcess, KongSpecStateCompensate, KongSpecStateDelay, KongSpecStateExit, KongSpecStateFail, KongSpecStateForeach, KongSpecStateInject, KongSpecStateParallel, KongSpecStateResult, KongSpecStateRule, KongSpecStateSendEvent, KongSpecStateStart, KongSpecStateSucceed, KongSpecStateSwitch, KongSpecStateWaitEvent, KongSpecStoreRetryControl, KongSpecSupportsActions, KongSpecSupportsErrors, KongSpecSupportsInvoke, KongSpecSupportsOutputSample, KongSpecSupportsOutputStore, KongSpecSupportsTransition, } from "./lib/kongSpec";
4
+ export type { KongSpecAction, KongSpecActionCallFunction, KongSpecActionCallProcess, KongSpecActionDelay, KongSpecActionInject, KongSpecActionSendEvent, KongSpecAnnotation, KongSpecBranch, KongSpecCache, KongSpecCallModel, KongSpecCircuitBreaker, KongSpecCondition, KongSpecEffect, KongSpecEffectStatus, KongSpecError, KongSpecEventBroker, KongSpecEventConnection, KongSpecFeatureCompensation, KongSpecFlow, KongSpecFunctionRef, KongSpecHowToInvoke, KongSpecHowToOutput, KongSpecHowToStore, KongSpecOutputAppend, KongSpecProcessRef, KongSpecRecord, KongSpecRecordHeader, KongSpecRetry, KongSpecRule, KongSpecSecretRef, KongSpecSecretType, KongSpecState, KongSpecStateCallFunction, KongSpecStateCallProcess, KongSpecStateCompensate, KongSpecStateDelay, KongSpecStateExit, KongSpecStateFail, KongSpecStateForeach, KongSpecStateInject, KongSpecStateParallel, KongSpecStateResult, KongSpecStateRule, KongSpecStateSendEvent, KongSpecStateStart, KongSpecStateSucceed, KongSpecStateSwitch, KongSpecStateWaitEvent, KongSpecStoreRetryControl, KongSpecSupportsActions, KongSpecSupportsErrors, KongSpecSupportsInvoke, KongSpecSupportsOutputSample, KongSpecSupportsOutputStore, KongSpecSupportsTaskMode, KongSpecSupportsTransition, } from "./lib/kongSpec";
5
5
  export { KongSpecBuild } from "./lib/kongSpecBuild";
6
6
  export { KongSpecDoc } from "./lib/kongSpecDoc";
7
7
  export { KongSpecEnv } from "./lib/kongSpecEnv";
@@ -14,5 +14,7 @@ export { KongSpecRef } from "./lib/kongSpecRef";
14
14
  export type { KongSpecActionPath, KongSpecStatePath } from "./lib/kongSpecRef";
15
15
  export { convertSpecToServerless } from "./lib/kongSpecToServerless";
16
16
  export { findSourceState, getActions, getConnectedExitStates, getDependencies, outputAggregator, outputAggregatorUnsafe, parallelStateOutputAggregator, parallelStateOutputAggregatorUnsafe, quoteSecretReferences, traverseFlowUp, } from "./lib/kongSpecUtils";
17
+ export { getKongFunctionOperations, getKongFunctionOperationSchema, getKongSpecXUI, getKongSpecXUIComponentConfig, isKongFunctionContractSchema, } from "./lib/kongSpecFunctionContract";
18
+ export type { KongSpecXUIComponentConfig, KongSpecXUIConfig, KongSpecXUIFormConfig, KongSpecXUISecretConfig, } from "./lib/kongSpecFunctionContract";
17
19
  export { validate } from "./lib/kongSpecValidate";
18
20
  export type { KongSpecValidationIssue, KongSpecValidators } from "./lib/kongSpecValidate";
@@ -106,7 +106,10 @@ export interface KongSpecSupportsDataGuards {
106
106
  export interface KongSpecSupportsOutputSample {
107
107
  outputSample: Optional<JsonText>;
108
108
  }
109
- export interface KongSpecCallModel extends KongSpecSupportsInput, KongSpecSupportsOutputFilter, KongSpecSupportsOutputStore, KongSpecSupportsOutputAppend, KongSpecSupportsOutputSample, KongSpecSupportsDataGuards, KongSpecSupportsInvoke {
109
+ export interface KongSpecSupportsTaskMode {
110
+ mode: "blocking" | "non-blocking";
111
+ }
112
+ export interface KongSpecCallModel extends KongSpecSupportsInput, KongSpecSupportsOutputFilter, KongSpecSupportsOutputStore, KongSpecSupportsOutputAppend, KongSpecSupportsOutputSample, KongSpecSupportsDataGuards, KongSpecSupportsTaskMode, KongSpecSupportsInvoke {
110
113
  }
111
114
  export interface KongSpecSupportsErrors {
112
115
  errors: KongSpecError[];
@@ -15,6 +15,7 @@ export declare class KongSpecDoc {
15
15
  static aboutIdentify: string;
16
16
  static aboutSizeLimit: (bytes: string) => string;
17
17
  static aboutCallFunction: string;
18
+ static aboutMode: string;
18
19
  static aboutCallProcess: string;
19
20
  static aboutCompensate: string;
20
21
  static aboutFail: string;
@@ -0,0 +1,26 @@
1
+ import { Optional } from "@kong/ts";
2
+ import { JSONSchema7 } from "json-schema";
3
+ import { KongSpecSecretType } from "./kongSpec";
4
+ export interface KongSpecXUISecretConfig {
5
+ purpose: string;
6
+ types: Array<KongSpecSecretType>;
7
+ }
8
+ export interface KongSpecXUIComponentConfig {
9
+ type: "TEXT_AREA";
10
+ }
11
+ export type KongSpecXUIFormConfig = Record<string, KongSpecXUIComponentConfig>;
12
+ export interface KongSpecXUIConfig {
13
+ version?: number;
14
+ secrets: Array<KongSpecXUISecretConfig>;
15
+ form: KongSpecXUIFormConfig;
16
+ }
17
+ /** Reads the `x-ui` block of a schema, if present. */
18
+ export declare function getKongSpecXUI(schema: Optional<JSONSchema7> | null): Optional<KongSpecXUIConfig>;
19
+ /** Reads the `x-ui.form` component config for a property path (e.g. `[".notes"]`). */
20
+ export declare function getKongSpecXUIComponentConfig(schema: Optional<JSONSchema7> | null, path: string[]): Optional<KongSpecXUIComponentConfig>;
21
+ /** True when the schema describes a KongFunctionContract (i.e. it exposes a `request` envelope). */
22
+ export declare function isKongFunctionContractSchema(schema: Optional<JSONSchema7> | null): boolean;
23
+ /** The operation names of a contract schema — all object properties except `request`. */
24
+ export declare function getKongFunctionOperations(schema: Optional<JSONSchema7> | null): string[];
25
+ /** The sub-schema describing the payload of a single operation. */
26
+ export declare function getKongFunctionOperationSchema(schema: Optional<JSONSchema7> | null, operation: string): Optional<JSONSchema7>;
@@ -8,7 +8,7 @@ interface TestItem {
8
8
  interface Dependency {
9
9
  type: "function" | "process";
10
10
  tenant: SessionTenant;
11
- basedOn: KongSpecFunctionRef["basedOn"] | KongSpecFunctionRef["basedOn"];
11
+ basedOn: KongSpecFunctionRef["basedOn"] | KongSpecProcessRef["basedOn"];
12
12
  aliasName: KongSpecFunctionRef["aliasName"] | KongSpecProcessRef["aliasName"];
13
13
  usage: Array<KongSpecAction["name"] | KongSpecState["name"]>;
14
14
  }
@@ -1,5 +1,5 @@
1
1
  import { AppSnapshot } from "./appSnapshot";
2
2
  export interface AppAliasUse {
3
3
  snapshot: AppSnapshot;
4
- balance: number;
4
+ balance: number | null;
5
5
  }
@@ -3,7 +3,7 @@ import { AppAliasUse } from "./appAliasUse";
3
3
  import { AppSnapshotDetails } from "./appSnapshotDetails";
4
4
  export interface AppAliasUseDetails extends AppAliasUse {
5
5
  snapshot: AppSnapshotDetails;
6
- balance: number;
6
+ balance: number | null;
7
7
  inputFilter?: JqFilter;
8
8
  outputFilter?: JqFilter;
9
9
  }