@devkong/cli 0.0.67-alpha.3 → 0.0.67-alpha.30
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/README.md +0 -11
- package/assets/python-install.bat +11 -11
- package/assets/python-install.sh +10 -10
- package/index.js +11475 -2966
- package/package.json +4 -3
- package/packages/kong-cli/src/commands/connectCommand.d.ts +49 -0
- package/packages/kong-cli/src/commands/generateCommand.d.ts +3 -1
- package/packages/kong-cli/src/commands/listAliasesCommand.d.ts +1 -1
- package/packages/kong-cli/src/commands/listVersionsCommand.d.ts +1 -1
- package/packages/kong-cli/src/commands/publishVersionCommand.d.ts +9 -2
- package/packages/kong-cli/src/commands/setAliasCommand.d.ts +20 -1
- package/packages/kong-cli/src/common/deployment.d.ts +2 -0
- package/packages/kong-cli/src/common/utils.d.ts +2 -3
- package/packages/kong-cli/src/services/managementClient.d.ts +4 -2
- package/packages/kong-spec/src/index.d.ts +4 -2
- package/packages/kong-spec/src/lib/kongSpec.d.ts +6 -3
- package/packages/kong-spec/src/lib/kongSpecDoc.d.ts +1 -0
- package/packages/kong-spec/src/lib/kongSpecFunctionContract.d.ts +26 -0
- package/packages/kong-spec/src/lib/kongSpecUtils.d.ts +2 -10
- package/packages/kong-ts/src/index.d.ts +4 -4
- package/packages/kong-ts/src/lib/id.d.ts +1 -0
- package/packages/kong-ts/src/lib/jq.d.ts +1 -0
- package/packages/kong-ts/src/lib/jsonSchema.d.ts +25 -0
- package/packages/kong-ts/src/lib/url.d.ts +1 -0
- package/packages/kong-ts/src/lib/user.d.ts +1 -0
- package/packages/kong-ts-contract/src/index.d.ts +8 -2
- package/packages/kong-ts-contract/src/lib/appAliasUse.d.ts +1 -1
- package/packages/kong-ts-contract/src/lib/appAliasUseDetails.d.ts +1 -1
- package/packages/kong-ts-contract/src/lib/appArtifact.d.ts +19 -0
- package/packages/kong-ts-contract/src/lib/appAuditLog.d.ts +2 -1
- package/packages/kong-ts-contract/src/lib/appConnect.d.ts +45 -0
- package/packages/kong-ts-contract/src/lib/appDependency.d.ts +9 -0
- package/packages/kong-ts-contract/src/lib/appDocument.d.ts +1 -0
- package/packages/kong-ts-contract/src/lib/appExtension.d.ts +3 -0
- package/packages/kong-ts-contract/src/lib/appOrganizationItem.d.ts +7 -0
- package/packages/kong-ts-contract/src/lib/appProject.d.ts +1 -0
- package/packages/kong-ts-contract/src/lib/appSecretDetails.d.ts +2 -0
- package/packages/kong-ts-contract/src/lib/appSecretPermission.d.ts +5 -0
- package/packages/kong-ts-contract/src/lib/appSecretType.d.ts +1 -1
- package/packages/kong-ts-contract/src/lib/appWorkspace.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devkong/cli",
|
|
3
|
-
"version": "0.0.67-alpha.
|
|
3
|
+
"version": "0.0.67-alpha.30",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"typings": "./index.d.ts",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@napi-rs/keyring": "1.1.6",
|
|
12
|
-
"create-nx-workspace": "23.0.1"
|
|
12
|
+
"create-nx-workspace": "23.0.1",
|
|
13
|
+
"jszip": "3.10.1"
|
|
13
14
|
}
|
|
14
|
-
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Profile, ProfileName } from "../common/profile";
|
|
2
|
+
export declare class ConnectCommand {
|
|
3
|
+
private profileName;
|
|
4
|
+
private profile;
|
|
5
|
+
private readonly isWin;
|
|
6
|
+
private readonly deployments;
|
|
7
|
+
private readonly templates;
|
|
8
|
+
private lock;
|
|
9
|
+
constructor(profileName: ProfileName, profile: Profile);
|
|
10
|
+
execute(): Promise<void>;
|
|
11
|
+
private handle;
|
|
12
|
+
private profileInfo;
|
|
13
|
+
/** Scaffolds the template, installs its deps and runs src/main_test.py. */
|
|
14
|
+
private runTests;
|
|
15
|
+
/**
|
|
16
|
+
* Deployments are asynchronous: the ui polls GET /v1/deployments/{id} and
|
|
17
|
+
* renders the steps in the same progress dialog as the kong-build path.
|
|
18
|
+
*/
|
|
19
|
+
private startDeployment;
|
|
20
|
+
/**
|
|
21
|
+
* Scaffolds the cli template, swaps in the bundle and reuses kong install +
|
|
22
|
+
* kong publish-version (docker build/push + schema + snapshot save), mirroring
|
|
23
|
+
* their progress into the deployment status the ui polls.
|
|
24
|
+
*/
|
|
25
|
+
private deploy;
|
|
26
|
+
/**
|
|
27
|
+
* Returns the (cached) scaffolded template for the extension, generating it
|
|
28
|
+
* once with `kong generate` and only swapping in the ui bundle's src folder
|
|
29
|
+
* and requirements.txt on subsequent calls. kong.json is patched so the
|
|
30
|
+
* publish saves the snapshot under the real extension.
|
|
31
|
+
*/
|
|
32
|
+
private prepareTemplate;
|
|
33
|
+
/**
|
|
34
|
+
* Downloads the zip bundle from the kong-fs presigned url and unpacks it into
|
|
35
|
+
* the connect file list; the `id` entry (image name for kong-build) is not a
|
|
36
|
+
* source file, so it is dropped here.
|
|
37
|
+
*/
|
|
38
|
+
private downloadBundle;
|
|
39
|
+
/** Runs `kong generate` into a fresh temp workspace and locates its root. */
|
|
40
|
+
private scaffold;
|
|
41
|
+
private cleanupTemplates;
|
|
42
|
+
private setStep;
|
|
43
|
+
private runExclusive;
|
|
44
|
+
private pythonBin;
|
|
45
|
+
private venvPython;
|
|
46
|
+
private run;
|
|
47
|
+
private readBody;
|
|
48
|
+
private json;
|
|
49
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { AppExtension } from "@kong/contract";
|
|
2
|
+
export type ExtensionTemplate = "basic" | "with-secret" | "with-s3";
|
|
2
3
|
export declare class GenerateCommand {
|
|
3
|
-
execute(extensionName: AppExtension["name"], sdk: "kotlin" | "python", presetVersion: string): Promise<void>;
|
|
4
|
+
execute(extensionName: AppExtension["name"], sdk: "kotlin" | "python", presetVersion: string, template?: ExtensionTemplate): Promise<void>;
|
|
5
|
+
private promptTemplate;
|
|
4
6
|
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { ListrTask } from "listr2";
|
|
2
2
|
import { Profile } from "../common/profile";
|
|
3
|
+
import { PublishDetails } from "../services/registryClient";
|
|
4
|
+
interface PublishContext {
|
|
5
|
+
contractText: string;
|
|
6
|
+
publishDetails?: PublishDetails;
|
|
7
|
+
fullImageName?: string;
|
|
8
|
+
}
|
|
3
9
|
export declare class PublishVersionCommand {
|
|
4
10
|
private profile;
|
|
5
11
|
private verbose;
|
|
@@ -11,8 +17,8 @@ export declare class PublishVersionCommand {
|
|
|
11
17
|
private defaultRendererOptions;
|
|
12
18
|
private get wslPrefix();
|
|
13
19
|
constructor(profile: Profile, verbose?: boolean, contractPath?: string | null);
|
|
14
|
-
execute(appName: string, notes: string): Promise<
|
|
15
|
-
flowFactory(appName: string, notes: string): Generator<ListrTask
|
|
20
|
+
execute(appName: string, notes: string, checkpoint?: string, onStep?: (step: string, status: "pending" | "succeeded" | "failed") => void): Promise<number>;
|
|
21
|
+
flowFactory(appName: string, notes: string, checkpoint?: string): Generator<ListrTask<PublishContext>>;
|
|
16
22
|
private resolveRegistryUrl;
|
|
17
23
|
private dockerBuildCmdText;
|
|
18
24
|
private dockerPushCmdText;
|
|
@@ -21,3 +27,4 @@ export declare class PublishVersionCommand {
|
|
|
21
27
|
private getKotlinBuildCmdTask;
|
|
22
28
|
private getKotlinSchemaCmdTask;
|
|
23
29
|
}
|
|
30
|
+
export {};
|
|
@@ -1,8 +1,27 @@
|
|
|
1
1
|
import { Profile } from "../common/profile";
|
|
2
|
+
/** A single version→weight assignment parsed from the command line. */
|
|
3
|
+
export interface AppAliasVersionWeight {
|
|
4
|
+
version: number;
|
|
5
|
+
/** Traffic percentage, or `null` for a "shadow" version (mirrored, no live traffic). */
|
|
6
|
+
balance: number | null;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Parse and validate all version configs. Live (non-shadow) weights must be > 0 and
|
|
10
|
+
* sum to exactly 100%; shadow versions are excluded from that total. Versions may
|
|
11
|
+
* not repeat and no more than {@link MAX_USES} versions can share an alias.
|
|
12
|
+
*/
|
|
13
|
+
export declare function parseVersionWeightList(list: string[]): AppAliasVersionWeight[];
|
|
2
14
|
export declare class SetAliasCommand {
|
|
3
15
|
private profile;
|
|
4
16
|
private publicClient;
|
|
5
17
|
private managementClient;
|
|
6
18
|
constructor(profile: Profile);
|
|
7
|
-
execute(aliasName: string,
|
|
19
|
+
execute(aliasName: string, weights: AppAliasVersionWeight[], timeoutSeconds: number): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Poll the deployment audit log and settle one step per matching event. Runs
|
|
22
|
+
* detached from the task list; it settles a step as its event arrives and
|
|
23
|
+
* fails the rest on a failed/timed-out deployment, stopping on the failed or
|
|
24
|
+
* "deployment completed" event (poll terminal).
|
|
25
|
+
*/
|
|
26
|
+
private pollDeploymentSteps;
|
|
8
27
|
}
|
|
@@ -12,6 +12,8 @@ export interface DeploymentQuery {
|
|
|
12
12
|
objectType: DeployObjectType;
|
|
13
13
|
basedOnId: string;
|
|
14
14
|
aliasName: string;
|
|
15
|
+
/** Only fetch audit events created at/after this UTC timestamp (ISO-8601). */
|
|
16
|
+
createdAfter?: string;
|
|
15
17
|
}
|
|
16
18
|
export interface DeploymentResult {
|
|
17
19
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Optional
|
|
1
|
+
import { Optional } from "@kong/ts";
|
|
2
2
|
export interface ILogger {
|
|
3
3
|
info(message: string): void;
|
|
4
4
|
debug(message: string): void;
|
|
@@ -9,8 +9,7 @@ export declare function env(key: string): string;
|
|
|
9
9
|
export declare function optionalEnv(key: string): Optional<string>;
|
|
10
10
|
export declare function loadJsonFile<T>(filePath: string): T;
|
|
11
11
|
export declare function resolveProjectPath(fileName: string): string;
|
|
12
|
-
export declare function generateShortId(): ShortUUID;
|
|
13
12
|
export declare function spawnCommand(commandText: string, logger?: ILogger | null, shell?: boolean): Promise<string>;
|
|
14
13
|
export declare function spawnCommandWithArgs(command: string, commandArgs: string[], logger?: ILogger | null, shell?: boolean): Promise<string>;
|
|
15
|
-
export declare function printError(
|
|
14
|
+
export declare function printError(label: string, error: unknown): void;
|
|
16
15
|
export declare function escapePathSpaces(sourcePath: string): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppAuditLog, AppExtension, AppExtensionAlias, AppSnapshot, AppSnapshotDetails } from "@kong/contract";
|
|
1
|
+
import { AppAliasDetails, AppAuditLog, AppDocument, AppExtension, AppExtensionAlias, AppSnapshot, AppSnapshotDetails } from "@kong/contract";
|
|
2
2
|
import { Optional, UrlText } from "@kong/ts";
|
|
3
3
|
import { DeployObjectType } from "../common/deployment";
|
|
4
4
|
import { RequestConfigProvider } from "./api";
|
|
@@ -11,5 +11,7 @@ export declare class ManagementClient {
|
|
|
11
11
|
getExtensionSnapshot(extensionId: AppExtension["id"], extensionSnapshotVersion: AppSnapshot["version"]): Promise<Optional<AppSnapshotDetails>>;
|
|
12
12
|
getExtensionSnapshotVersions(extensionId: AppExtension["id"]): Promise<AppSnapshot[]>;
|
|
13
13
|
getExtensionSnapshotAliases(extensionId: AppExtension["id"]): Promise<AppExtensionAlias[]>;
|
|
14
|
-
|
|
14
|
+
getDocumentSnapshotVersions(documentId: AppDocument["id"]): Promise<AppSnapshot[]>;
|
|
15
|
+
getProcessAliases(documentId: AppDocument["id"]): Promise<AppAliasDetails[]>;
|
|
16
|
+
getAuditLog(objectType: DeployObjectType, objectId: string, createdAfter?: string): Promise<AppAuditLog[]>;
|
|
15
17
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
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";
|
|
8
8
|
export type { KongSpecFile } from "./lib/kongSpecFile";
|
|
9
|
+
export { getKongFunctionOperations, getKongFunctionOperationSchema, getKongSpecXUI, getKongSpecXUIComponentConfig, isKongFunctionContractSchema, } from "./lib/kongSpecFunctionContract";
|
|
10
|
+
export type { KongSpecXUIComponentConfig, KongSpecXUIConfig, KongSpecXUIFormConfig, KongSpecXUISecretConfig, } from "./lib/kongSpecFunctionContract";
|
|
9
11
|
export type { KongSpecLayout, KongSpecLayoutPosition, KongSpecLayoutPositionKey, } from "./lib/kongSpecLayout";
|
|
10
12
|
export { migrate } from "./lib/kongSpecMigrate";
|
|
11
13
|
export { nameGenerator } from "./lib/kongSpecName";
|
|
@@ -13,6 +15,6 @@ export { normalizeName } from "./lib/kongSpecNormalize";
|
|
|
13
15
|
export { KongSpecRef } from "./lib/kongSpecRef";
|
|
14
16
|
export type { KongSpecActionPath, KongSpecStatePath } from "./lib/kongSpecRef";
|
|
15
17
|
export { convertSpecToServerless } from "./lib/kongSpecToServerless";
|
|
16
|
-
export { findSourceState, getActions, getConnectedExitStates,
|
|
18
|
+
export { findSourceState, getActions, getConnectedExitStates, outputAggregator, outputAggregatorUnsafe, parallelStateOutputAggregator, parallelStateOutputAggregatorUnsafe, quoteSecretReferences, traverseFlowUp, } from "./lib/kongSpecUtils";
|
|
17
19
|
export { validate } from "./lib/kongSpecValidate";
|
|
18
20
|
export type { KongSpecValidationIssue, KongSpecValidators } from "./lib/kongSpecValidate";
|
|
@@ -10,8 +10,8 @@ export interface KongSpecProcessRef {
|
|
|
10
10
|
basedOn: KongSpecFlow["id"];
|
|
11
11
|
aliasName: Distinct<string, "KongSpecProcessRefAliasName">;
|
|
12
12
|
}
|
|
13
|
-
export type KongSpecSecretRef = Distinct<string, "KongSpecSecretRef">;
|
|
14
13
|
export type KongSpecSecretType = Distinct<string, "KongSpecSecretType">;
|
|
14
|
+
export type KongSpecSecretRef = Distinct<string, "KongSpecSecretRef">;
|
|
15
15
|
interface KongSpecStateBase {
|
|
16
16
|
id: Distinct<string, "KongSpecStateId">;
|
|
17
17
|
name: string;
|
|
@@ -46,7 +46,7 @@ export interface KongSpecCircuitBreaker {
|
|
|
46
46
|
}
|
|
47
47
|
export interface KongSpecHowToInvoke {
|
|
48
48
|
prefix: string;
|
|
49
|
-
secretRefs: Record<string,
|
|
49
|
+
secretRefs: Record<string, JqFilter | null>;
|
|
50
50
|
retry: KongSpecRetry;
|
|
51
51
|
cache: KongSpecCache;
|
|
52
52
|
circuitBreaker: KongSpecCircuitBreaker;
|
|
@@ -106,7 +106,10 @@ export interface KongSpecSupportsDataGuards {
|
|
|
106
106
|
export interface KongSpecSupportsOutputSample {
|
|
107
107
|
outputSample: Optional<JsonText>;
|
|
108
108
|
}
|
|
109
|
-
export interface
|
|
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>;
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
import { JqFilter, JsonObject, JsonText, Optional
|
|
2
|
-
import { KongSpecAction, KongSpecFlow,
|
|
1
|
+
import { JqFilter, JsonObject, JsonText, Optional } from "@kong/ts";
|
|
2
|
+
import { KongSpecAction, KongSpecFlow, KongSpecState, KongSpecStateExit, KongSpecStateParallel, KongSpecSupportsTransition } from "./kongSpec";
|
|
3
3
|
import { KongSpecActionPath, KongSpecStatePath } from "./kongSpecRef";
|
|
4
4
|
interface TestItem {
|
|
5
5
|
id: KongSpecState["id"] | KongSpecAction["id"];
|
|
6
6
|
source: "initial" | "errors" | "transition" | "noMatchedRule" | "conditions" | "compensateBy" | "actions" | "branches";
|
|
7
7
|
}
|
|
8
|
-
interface Dependency {
|
|
9
|
-
type: "function" | "process";
|
|
10
|
-
tenant: SessionTenant;
|
|
11
|
-
basedOn: KongSpecFunctionRef["basedOn"] | KongSpecFunctionRef["basedOn"];
|
|
12
|
-
aliasName: KongSpecFunctionRef["aliasName"] | KongSpecProcessRef["aliasName"];
|
|
13
|
-
usage: Array<KongSpecAction["name"] | KongSpecState["name"]>;
|
|
14
|
-
}
|
|
15
8
|
export declare function quoteSecretReferences(filter: JqFilter): JqFilter;
|
|
16
9
|
export declare function traverseFlowUp(id: KongSpecState["id"] | KongSpecAction["id"], states: KongSpecFlow["states"], test: (current: TestItem) => boolean): boolean;
|
|
17
10
|
export declare function getConnectedExitStates(states: KongSpecFlow["states"], stateRef: KongSpecState["id"]): KongSpecStateExit[];
|
|
@@ -22,5 +15,4 @@ export declare function findSourceState(states: KongSpecState[], targetRef: Kong
|
|
|
22
15
|
export declare function convertActionToState(action: KongSpecAction): KongSpecState & KongSpecSupportsTransition;
|
|
23
16
|
export declare function parallelStateOutputAggregatorUnsafe(jq: (sample: string, filter: JqFilter) => Promise<string>): (state: KongSpecStateParallel, flow: KongSpecFlow) => Promise<JsonObject>;
|
|
24
17
|
export declare function parallelStateOutputAggregator(jq: (sample: string, filter: JqFilter) => Promise<string>): (state: KongSpecStateParallel, flow: KongSpecFlow) => Promise<JsonObject>;
|
|
25
|
-
export declare function getDependencies(flow: KongSpecFlow): Dependency[];
|
|
26
18
|
export {};
|
|
@@ -13,14 +13,14 @@ export type { Duration8601 } from "./lib/duration";
|
|
|
13
13
|
export type { Entity } from "./lib/entity";
|
|
14
14
|
export { AppError, DataError, errorToPrettyString } from "./lib/error";
|
|
15
15
|
export { ensureIsDuration, ensureIsDurationOrCron, ensureMinLength, nonNegative, nonRecursiveCall, notBlank, notNull, } from "./lib/guard";
|
|
16
|
-
export { guid, stableUUID, uuidc16, uuidc32, uuidStableSequence } from "./lib/id";
|
|
16
|
+
export { generateShortId, guid, stableUUID, uuidc16, uuidc32, uuidStableSequence } from "./lib/id";
|
|
17
17
|
export type { CompactUUID16, CompactUUID32, GUID, ShortUUID } from "./lib/id";
|
|
18
18
|
export { intervalToString, millisToShortString } from "./lib/interval";
|
|
19
|
-
export { applyJqFilterReplacements, applyJqObjectReplacements, applyJqTextReplacements, convertToJqFilter, extractJqTextContent, jqFilter, JqObjectSerializer, jqText, sanitizeJqFilter, wrapWithJqTextMarkers, } from "./lib/jq";
|
|
19
|
+
export { applyJqFilterReplacements, applyJqObjectReplacements, applyJqTextReplacements, containsJqExpression, convertToJqFilter, extractJqTextContent, jqFilter, JqObjectSerializer, jqText, sanitizeJqFilter, wrapWithJqTextMarkers, } from "./lib/jq";
|
|
20
20
|
export type { JqArray, JqFilter, JqObject, JqSerializer, JqText, RefactorReplacement, } from "./lib/jq";
|
|
21
21
|
export { generateFakeJsonObject, jsonToHumanReadable, prettyJsonObject, prettyJsonText, safeJsonParse, } from "./lib/json";
|
|
22
22
|
export type { JsonArray, JsonObject, JsonSchemaUrl, JsonText } from "./lib/json";
|
|
23
|
-
export { buildExampleObject, buildJSONSchemaType, createEmptyJsonSchema, getNestedValue, getPropertyType, hasJSONSchemaType, isRequired, updateNestedValue, } from "./lib/jsonSchema";
|
|
23
|
+
export { buildExampleObject, buildJSONSchemaType, createEmptyJsonSchema, getNestedValue, getPropertyType, hasJSONSchemaType, inferJsonSchema, isLikelyJsonSchema, isRequired, normalizeNullableUnions, updateNestedValue, } from "./lib/jsonSchema";
|
|
24
24
|
export { KeyGenerator } from "./lib/keyGenerator";
|
|
25
25
|
export { findLastIndex, insertItem, moveItem, unique } from "./lib/list";
|
|
26
26
|
export { deepMerge, deepMergeAll } from "./lib/merge";
|
|
@@ -36,7 +36,7 @@ export { TextReader } from "./lib/textReader";
|
|
|
36
36
|
export { DEFAULT_TIMEZONE, getTimezoneLabel } from "./lib/timezone";
|
|
37
37
|
export type { Timezone } from "./lib/timezone";
|
|
38
38
|
export type { Action, DeepPartial, Distinct, Indexed, Loading, NonFunctionProperties, Optional, Pair, PreventDefault, Primitive, PropertyPath, PropertyPathMap, RequiredProperties, Result, StringKeys, UnArray, ValidateKeys, } from "./lib/types";
|
|
39
|
-
export { joinUrlAndPath, urlText } from "./lib/url";
|
|
39
|
+
export { joinUrlAndFetch, joinUrlAndPath, urlText } from "./lib/url";
|
|
40
40
|
export type { UrlText } from "./lib/url";
|
|
41
41
|
export type { User } from "./lib/user";
|
|
42
42
|
export { dateToUtc, utcNow, utcToZonedDate, utcToZonedText } from "./lib/utc";
|
|
@@ -8,5 +8,6 @@ export declare function guid(): GUID;
|
|
|
8
8
|
export declare function uuidc32(): CompactUUID32;
|
|
9
9
|
export declare function uuidc16(): CompactUUID16;
|
|
10
10
|
export declare function uuidc8(): CompactUUID8;
|
|
11
|
+
export declare function generateShortId(): ShortUUID;
|
|
11
12
|
export declare function stableUUID<T extends string>(based: T): T;
|
|
12
13
|
export declare function uuidStableSequence<T extends string>(based: T): () => T;
|
|
@@ -11,6 +11,7 @@ export interface JqSerializer<T = JqObject | JqArray | JqText> {
|
|
|
11
11
|
}
|
|
12
12
|
export declare function jqFilter(value: Primitive): JqFilter;
|
|
13
13
|
export declare function jqText(value: string): JqText;
|
|
14
|
+
export declare function containsJqExpression(value: unknown): value is JqText;
|
|
14
15
|
export declare function sanitizeJqFilter(value: JqFilter): JqFilter;
|
|
15
16
|
export declare function convertToJqFilter(value: JqText): JqFilter;
|
|
16
17
|
export declare function applyJqFilterReplacements(value: JqFilter, replacements: RefactorReplacement[]): JqFilter;
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { JSONSchema7, JSONSchema7TypeName } from "json-schema";
|
|
2
2
|
import { JsonObject, Optional } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Collapses Pydantic's optional idiom `anyOf: [X, { "type": "null" }]` (and the `oneOf` form) down
|
|
5
|
+
* to `X`, recursively, and drops the now-dead `$defs`/`definitions`.
|
|
6
|
+
*
|
|
7
|
+
* Pydantic encodes every optional/nullable field as such a union instead of a nullable type, and
|
|
8
|
+
* `$ref` dereferencing inlines the branch but leaves the union in place. A form that reads
|
|
9
|
+
* `properties`/`type` straight off the node then sees an `anyOf` wrapper with no `properties` and
|
|
10
|
+
* renders nothing. When a single non-null branch remains it is merged with the union's sibling
|
|
11
|
+
* keywords (`default`, `description`, `title`, ...); genuine multi-branch unions keep their non-null
|
|
12
|
+
* branches. Run this right after dereferencing, before the schema reaches the form.
|
|
13
|
+
*/
|
|
14
|
+
export declare function normalizeNullableUnions<T = JSONSchema7>(schema: T): T;
|
|
3
15
|
export declare function hasJSONSchemaType(type: JSONSchema7["type"], name: JSONSchema7TypeName): boolean;
|
|
4
16
|
export declare function getPropertyType(schema: Optional<JSONSchema7> | null): string;
|
|
5
17
|
export declare function isRequired(schema: Optional<JSONSchema7> | null, propertyKey: string): boolean;
|
|
@@ -7,4 +19,17 @@ export declare function getNestedValue(obj: any, path: string[]): any;
|
|
|
7
19
|
export declare function updateNestedValue(obj: any, path: string[], value: any): any;
|
|
8
20
|
export declare function buildJSONSchemaType(type: JSONSchema7["type"], nullable: boolean): JSONSchema7["type"];
|
|
9
21
|
export declare function buildExampleObject(schema: JSONSchema7): Optional<JsonObject>;
|
|
22
|
+
/**
|
|
23
|
+
* Heuristically decides whether a parsed JSON object is itself a JSON Schema rather than a plain
|
|
24
|
+
* data sample. A `properties` key alone is ambiguous (data can have one too), so it only counts
|
|
25
|
+
* when every property value is an object — i.e. could be a subschema.
|
|
26
|
+
*/
|
|
27
|
+
export declare function isLikelyJsonSchema(value: unknown): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Derives a draft-07 schema from a plain JSON sample. Primitives keep the sampled value as
|
|
30
|
+
* `examples`, nulls become nullable strings (the sample carries no type information), array
|
|
31
|
+
* item schemas are inferred from the first element, and object properties with a non-null
|
|
32
|
+
* sampled value are marked required.
|
|
33
|
+
*/
|
|
34
|
+
export declare function inferJsonSchema(value: unknown): JSONSchema7;
|
|
10
35
|
export declare function createEmptyJsonSchema(): JSONSchema7;
|
|
@@ -2,3 +2,4 @@ import { Distinct } from "./types";
|
|
|
2
2
|
export type UrlText = Distinct<string, "UrlText">;
|
|
3
3
|
export declare function urlText(value: string): UrlText;
|
|
4
4
|
export declare function joinUrlAndPath(baseUrl: UrlText, ...pathSegments: Array<string | number>): UrlText;
|
|
5
|
+
export declare function joinUrlAndFetch(baseUrl: UrlText, path: string | number, init?: RequestInit): Promise<Response>;
|
|
@@ -3,17 +3,23 @@ export type { AppAliasDetails } from "./lib/appAliasDetails";
|
|
|
3
3
|
export type { AppAliasListItem } from "./lib/appAliasListItem";
|
|
4
4
|
export type { AppAliasUse } from "./lib/appAliasUse";
|
|
5
5
|
export type { AppAliasUseDetails } from "./lib/appAliasUseDetails";
|
|
6
|
+
export type { AppArtifact, AppArtifactDetails, AppCodeTemplateData, AppCodeTemplateFile, } from "./lib/appArtifact";
|
|
6
7
|
export { AuditObjectType } from "./lib/appAuditLog";
|
|
7
8
|
export type { AppAuditLog } from "./lib/appAuditLog";
|
|
8
9
|
export type { AppBroadcastData } from "./lib/appBroadcastData";
|
|
9
10
|
export type { AppCheckpoint } from "./lib/appCheckpoint";
|
|
11
|
+
export type { AppOrganizationItem } from "./lib/appOrganizationItem";
|
|
10
12
|
export type { AppComponentStartRequest } from "./lib/appComponentStartRequest";
|
|
13
|
+
export { APP_CONNECT_PORT, CLI_CONNECT_BASE_URL } from "./lib/appConnect";
|
|
14
|
+
export type { AppConnectDeployRequest, AppConnectDeployStart, AppConnectDeployStatus, AppConnectDeployStep, AppConnectFile, AppConnectProfile, AppConnectTestRequest, AppConnectTestResult, } from "./lib/appConnect";
|
|
15
|
+
export type { AppDependency } from "./lib/appDependency";
|
|
11
16
|
export type { AppDocument } from "./lib/appDocument";
|
|
12
17
|
export type { AppDocumentPublish } from "./lib/appDocumentPublish";
|
|
13
18
|
export type { AppDocumentSnapshot } from "./lib/appDocumentSnapshot";
|
|
14
19
|
export type { AppDocumentSnapshotDetails } from "./lib/appDocumentSnapshotDetails";
|
|
15
|
-
export type { AppExtension } from "./lib/appExtension";
|
|
20
|
+
export type { AppExtension, AppExtensionOrigin } from "./lib/appExtension";
|
|
16
21
|
export type { AppExtensionAlias } from "./lib/appExtensionAlias";
|
|
22
|
+
export type { AppLabelledRole, AppMember, AppMemberGroup, AppMemberPermission, AppMemberPrincipal, AppPrincipalType, } from "./lib/appMember";
|
|
17
23
|
export type { AppPresignedUrl } from "./lib/appPresignedUrl";
|
|
18
24
|
export type { AppProcessAlias } from "./lib/appProcessAlias";
|
|
19
25
|
export type { AppProcessData } from "./lib/appProcessData";
|
|
@@ -22,6 +28,7 @@ export type { AppProcessStats, AppProcessStatsBucket, AppProcessStatsSeries, } f
|
|
|
22
28
|
export type { AppProject } from "./lib/appProject";
|
|
23
29
|
export type { AppSecret } from "./lib/appSecret";
|
|
24
30
|
export type { AppSecretDetails } from "./lib/appSecretDetails";
|
|
31
|
+
export type { AppSecretPermission, AppSecretPermissionSubjectType, } from "./lib/appSecretPermission";
|
|
25
32
|
export type { AppSecretType } from "./lib/appSecretType";
|
|
26
33
|
export type { AppSnapshot } from "./lib/appSnapshot";
|
|
27
34
|
export type { AppSnapshotDetails } from "./lib/appSnapshotDetails";
|
|
@@ -32,7 +39,6 @@ export type { AppTestCaseMatchFeature } from "./lib/appTestCaseMatchFeature";
|
|
|
32
39
|
export type { AppTestResult } from "./lib/appTestResult";
|
|
33
40
|
export type { AppTrigger } from "./lib/appTrigger";
|
|
34
41
|
export type { AppWorkspace } from "./lib/appWorkspace";
|
|
35
|
-
export type { AppLabelledRole, AppMember, AppMemberGroup, AppMemberPermission, AppMemberPrincipal, AppPrincipalType, } from "./lib/appMember";
|
|
36
42
|
export type { AppWorkspaceAccess } from "./lib/appWorkspaceAccess";
|
|
37
43
|
export type { SdkKongJson } from "./lib/sdkKongJson";
|
|
38
44
|
export type { SdkConcurrencyQuota, SdkQuotaName, SdkRateLimiterQuota } from "./lib/sdkQuota";
|
|
@@ -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
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { JsonObject } from "@kong/ts";
|
|
2
|
+
export interface AppArtifact {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
category: "code-template";
|
|
6
|
+
type: string;
|
|
7
|
+
description: string;
|
|
8
|
+
}
|
|
9
|
+
export interface AppArtifactDetails extends AppArtifact {
|
|
10
|
+
data: JsonObject;
|
|
11
|
+
}
|
|
12
|
+
export interface AppCodeTemplateFile {
|
|
13
|
+
name: string;
|
|
14
|
+
content: string;
|
|
15
|
+
binary?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface AppCodeTemplateData {
|
|
18
|
+
files: AppCodeTemplateFile[];
|
|
19
|
+
}
|
|
@@ -5,7 +5,8 @@ export declare enum AuditObjectType {
|
|
|
5
5
|
EXTENSION_ALIAS = "extension_alias",
|
|
6
6
|
EXTENSION_SNAPSHOT = "extension_snapshot",
|
|
7
7
|
DOCUMENT_SNAPSHOT = "document_snapshot",
|
|
8
|
-
EXTENSION = "extension"
|
|
8
|
+
EXTENSION = "extension",
|
|
9
|
+
SECRET = "secret"
|
|
9
10
|
}
|
|
10
11
|
export interface AppAuditLog {
|
|
11
12
|
objectType: AuditObjectType;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Loading, UrlText } from "@kong/ts";
|
|
2
|
+
export declare const APP_CONNECT_PORT = 41321;
|
|
3
|
+
export declare const CLI_CONNECT_BASE_URL: UrlText;
|
|
4
|
+
export interface AppConnectProfile {
|
|
5
|
+
profile: string;
|
|
6
|
+
baseUrl: string;
|
|
7
|
+
userName: string;
|
|
8
|
+
docker: boolean;
|
|
9
|
+
python: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface AppConnectFile {
|
|
12
|
+
name: string;
|
|
13
|
+
content: string;
|
|
14
|
+
binary?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface AppConnectTestRequest {
|
|
17
|
+
extensionId: string;
|
|
18
|
+
extensionName: string;
|
|
19
|
+
bundleUrl: string;
|
|
20
|
+
}
|
|
21
|
+
export interface AppConnectTestResult {
|
|
22
|
+
passed: boolean;
|
|
23
|
+
output: string;
|
|
24
|
+
}
|
|
25
|
+
export interface AppConnectDeployRequest {
|
|
26
|
+
extensionId: string;
|
|
27
|
+
extensionName: string;
|
|
28
|
+
checkpoint: string;
|
|
29
|
+
bundleUrl: string;
|
|
30
|
+
notes?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface AppConnectDeployStart {
|
|
33
|
+
deploymentId: string;
|
|
34
|
+
}
|
|
35
|
+
export interface AppConnectDeployStep {
|
|
36
|
+
name: string;
|
|
37
|
+
status: Loading;
|
|
38
|
+
}
|
|
39
|
+
export interface AppConnectDeployStatus {
|
|
40
|
+
status: "pending" | "succeeded" | "failed";
|
|
41
|
+
steps: AppConnectDeployStep[];
|
|
42
|
+
output: string;
|
|
43
|
+
version?: number;
|
|
44
|
+
error?: string;
|
|
45
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { KongSpecAction, KongSpecFunctionRef, KongSpecProcessRef, KongSpecSecretRef, KongSpecState } from "@kong/spec";
|
|
2
|
+
import { SessionTenant } from "@kong/ts";
|
|
3
|
+
export interface AppDependency {
|
|
4
|
+
type: "function" | "process" | "secret";
|
|
5
|
+
tenant: SessionTenant;
|
|
6
|
+
basedOn: KongSpecFunctionRef["basedOn"] | KongSpecProcessRef["basedOn"] | undefined;
|
|
7
|
+
name: KongSpecFunctionRef["aliasName"] | KongSpecProcessRef["aliasName"] | KongSpecSecretRef;
|
|
8
|
+
usage: Array<KongSpecAction["name"] | KongSpecState["name"]>;
|
|
9
|
+
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { Entity, Optional, ShortUUID, User, UtcDateTime } from "@kong/ts";
|
|
2
|
+
export type AppExtensionOrigin = "ui" | "cli";
|
|
2
3
|
export interface AppExtension extends Entity {
|
|
3
4
|
id: ShortUUID;
|
|
4
5
|
name: string;
|
|
5
6
|
category: Optional<string>;
|
|
6
7
|
deprecated: boolean;
|
|
8
|
+
origin: AppExtensionOrigin;
|
|
9
|
+
checkpoint: Optional<string>;
|
|
7
10
|
created: UtcDateTime;
|
|
8
11
|
updated: UtcDateTime;
|
|
9
12
|
createdBy: User["name"];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { KongSpecSecretType } from "@kong/spec";
|
|
1
2
|
import { Entity, Optional, ShortUUID, User, UtcDateTime } from "@kong/ts";
|
|
2
3
|
import { JSONSchema7 } from "json-schema";
|
|
3
|
-
import { KongSpecSecretType } from "packages/kong-spec/src";
|
|
4
4
|
export interface AppSecretType extends Entity {
|
|
5
5
|
id: ShortUUID;
|
|
6
6
|
category: "api" | "database" | "storage" | "custom";
|