@devkong/cli 0.0.1
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 +21 -0
- package/assets/kong-json-schema.json +136 -0
- package/index.js +68347 -0
- package/package.json +10 -0
- package/packages/kong-cli/src/commands/configureCommand.d.ts +5 -0
- package/packages/kong-cli/src/commands/generateCommand.d.ts +3 -0
- package/packages/kong-cli/src/commands/installCommand.d.ts +4 -0
- package/packages/kong-cli/src/commands/listExtensionSnapshotCommand.d.ts +6 -0
- package/packages/kong-cli/src/commands/publishCommand.d.ts +14 -0
- package/packages/kong-cli/src/commands/setExtensionAliasCommand.d.ts +7 -0
- package/packages/kong-cli/src/common/cli.d.ts +7 -0
- package/packages/kong-cli/src/common/kongJson.d.ts +10 -0
- package/packages/kong-cli/src/common/kongJsonSchema.d.ts +2 -0
- package/packages/kong-cli/src/common/profile.d.ts +9 -0
- package/packages/kong-cli/src/common/utils.d.ts +6 -0
- package/packages/kong-cli/src/index.d.ts +2 -0
- package/packages/kong-cli/src/services/api.d.ts +5 -0
- package/packages/kong-cli/src/services/managementClient.d.ts +9 -0
- package/packages/kong-cli/src/services/publicClient.d.ts +7 -0
- package/packages/kong-cli/src/services/registryClient.d.ts +14 -0
- package/packages/kong-spec/src/index.d.ts +17 -0
- package/packages/kong-spec/src/lib/kongServerless.d.ts +11 -0
- package/packages/kong-spec/src/lib/kongSession.d.ts +31 -0
- package/packages/kong-spec/src/lib/kongSpec.d.ts +199 -0
- package/packages/kong-spec/src/lib/kongSpecBuild.d.ts +38 -0
- package/packages/kong-spec/src/lib/kongSpecDoc.d.ts +14 -0
- package/packages/kong-spec/src/lib/kongSpecEnv.d.ts +4 -0
- package/packages/kong-spec/src/lib/kongSpecFile.d.ts +25 -0
- package/packages/kong-spec/src/lib/kongSpecLayout.d.ts +4 -0
- package/packages/kong-spec/src/lib/kongSpecName.d.ts +3 -0
- package/packages/kong-spec/src/lib/kongSpecNormalize.d.ts +2 -0
- package/packages/kong-spec/src/lib/kongSpecRef.d.ts +16 -0
- package/packages/kong-spec/src/lib/kongSpecSchema.d.ts +2 -0
- package/packages/kong-spec/src/lib/kongSpecToServerless.d.ts +10 -0
- package/packages/kong-spec/src/lib/kongSpecUtils.d.ts +11 -0
- package/packages/kong-spec/src/lib/kongSpecValidate.d.ts +13 -0
- package/packages/kong-ts/src/index.d.ts +37 -0
- package/packages/kong-ts/src/lib/accessor.d.ts +12 -0
- package/packages/kong-ts/src/lib/businessKey.d.ts +3 -0
- package/packages/kong-ts/src/lib/cloudEvent.d.ts +28 -0
- package/packages/kong-ts/src/lib/color.d.ts +1 -0
- package/packages/kong-ts/src/lib/compare.d.ts +5 -0
- package/packages/kong-ts/src/lib/duration.d.ts +3 -0
- package/packages/kong-ts/src/lib/entity.d.ts +4 -0
- package/packages/kong-ts/src/lib/error.d.ts +7 -0
- package/packages/kong-ts/src/lib/guard.d.ts +5 -0
- package/packages/kong-ts/src/lib/id.d.ts +12 -0
- package/packages/kong-ts/src/lib/interval.d.ts +1 -0
- package/packages/kong-ts/src/lib/jq.d.ts +23 -0
- package/packages/kong-ts/src/lib/json.d.ts +11 -0
- package/packages/kong-ts/src/lib/keyGenerator.d.ts +6 -0
- package/packages/kong-ts/src/lib/list.d.ts +3 -0
- package/packages/kong-ts/src/lib/merge.d.ts +19 -0
- package/packages/kong-ts/src/lib/normalize.d.ts +1 -0
- package/packages/kong-ts/src/lib/retry.d.ts +8 -0
- package/packages/kong-ts/src/lib/telemetry.d.ts +8 -0
- package/packages/kong-ts/src/lib/text.d.ts +18 -0
- package/packages/kong-ts/src/lib/textReader.d.ts +8 -0
- package/packages/kong-ts/src/lib/timezone.d.ts +5 -0
- package/packages/kong-ts/src/lib/types.d.ts +45 -0
- package/packages/kong-ts/src/lib/url.d.ts +4 -0
- package/packages/kong-ts/src/lib/user.d.ts +3 -0
- package/packages/kong-ts/src/lib/utc.d.ts +24 -0
- package/packages/kong-ts/src/lib/utils.d.ts +15 -0
- package/packages/kong-ts-contract/src/index.d.ts +22 -0
- package/packages/kong-ts-contract/src/lib/appAlias.d.ts +11 -0
- package/packages/kong-ts-contract/src/lib/appCheckpoint.d.ts +11 -0
- package/packages/kong-ts-contract/src/lib/appDocument.d.ts +14 -0
- package/packages/kong-ts-contract/src/lib/appDocumentBuild.d.ts +5 -0
- package/packages/kong-ts-contract/src/lib/appDocumentSnapshot.d.ts +10 -0
- package/packages/kong-ts-contract/src/lib/appExtension.d.ts +10 -0
- package/packages/kong-ts-contract/src/lib/appExtensionAlias.d.ts +3 -0
- package/packages/kong-ts-contract/src/lib/appExtensionAliasDetails.d.ts +9 -0
- package/packages/kong-ts-contract/src/lib/appExtensionAliasUse.d.ts +5 -0
- package/packages/kong-ts-contract/src/lib/appExtensionAliasUseDetails.d.ts +10 -0
- package/packages/kong-ts-contract/src/lib/appExtensionSnapshot.d.ts +2 -0
- package/packages/kong-ts-contract/src/lib/appExtensionSnapshotDetails.d.ts +9 -0
- package/packages/kong-ts-contract/src/lib/appPresignedUrl.d.ts +5 -0
- package/packages/kong-ts-contract/src/lib/appProcessAlias.d.ts +3 -0
- package/packages/kong-ts-contract/src/lib/appProcessAliasUse.d.ts +7 -0
- package/packages/kong-ts-contract/src/lib/appProcessInstanceId.d.ts +2 -0
- package/packages/kong-ts-contract/src/lib/appProcessTest.d.ts +6 -0
- package/packages/kong-ts-contract/src/lib/appProject.d.ts +11 -0
- package/packages/kong-ts-contract/src/lib/appSnapshot.d.ts +7 -0
- package/packages/kong-ts-contract/src/lib/appTestCase.d.ts +10 -0
- package/packages/kong-ts-contract/src/lib/appTestCaseDetails.d.ts +8 -0
- package/packages/kong-ts-contract/src/lib/appTestCaseMatchFeature.d.ts +19 -0
- package/packages/kong-ts-contract/src/lib/appWorkspace.d.ts +9 -0
- package/packages/kong-ts-contract/src/lib/sdkExtensionAlias.d.ts +18 -0
package/package.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Profile } from "../common/profile";
|
|
2
|
+
export declare class PublishCommand {
|
|
3
|
+
private readonly isWin;
|
|
4
|
+
private registryClient;
|
|
5
|
+
private managementClient;
|
|
6
|
+
private get wslPrefix();
|
|
7
|
+
constructor(profile: Profile);
|
|
8
|
+
execute(repoName: string): Promise<void>;
|
|
9
|
+
private resolveRegistryUrl;
|
|
10
|
+
private dockerBuildCmdText;
|
|
11
|
+
private dockerPushCmdText;
|
|
12
|
+
private dockerLoginCmdText;
|
|
13
|
+
private getSchemaCmdText;
|
|
14
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AppExtension, AppExtensionSnapshotDetails, SdkExtensionAlias } from "@kong/contract";
|
|
2
|
+
import { User } from "@kong/ts";
|
|
3
|
+
export interface KongJson {
|
|
4
|
+
id: AppExtension["id"];
|
|
5
|
+
sdk: AppExtensionSnapshotDetails["sdk"];
|
|
6
|
+
name: AppExtension["name"];
|
|
7
|
+
ownership: [User["name"], ...Array<User["name"]>];
|
|
8
|
+
alias?: SdkExtensionAlias;
|
|
9
|
+
}
|
|
10
|
+
export declare function getKongJson(): KongJson;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UrlText } from "@kong/ts";
|
|
2
|
+
export interface Profile {
|
|
3
|
+
kongBaseUrl: UrlText;
|
|
4
|
+
}
|
|
5
|
+
export type ProfileName = "default" | string;
|
|
6
|
+
export type ConfigProfiles = Record<ProfileName, Profile>;
|
|
7
|
+
export declare function loadProfiles(): ConfigProfiles;
|
|
8
|
+
export declare function saveProfiles(profiles: ConfigProfiles): void;
|
|
9
|
+
export declare function getProfile(profileName?: string): Profile;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function env(key: string): string;
|
|
2
|
+
export declare function optionalEnv(key: string): string;
|
|
3
|
+
export declare function resolveProjectPath(fileName: string): string;
|
|
4
|
+
export declare function generateShortId(): string;
|
|
5
|
+
export declare function spawnCommand(name: string, commandText: string, inheritStdout?: boolean): Promise<string>;
|
|
6
|
+
export declare function printError(message: string, error: unknown): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AppExtension, AppExtensionSnapshot, AppExtensionSnapshotDetails } from "@kong/contract";
|
|
2
|
+
import { Optional, UrlText } from "@kong/ts";
|
|
3
|
+
export declare class ManagementClient {
|
|
4
|
+
private readonly baseUrl;
|
|
5
|
+
constructor(baseUrl: UrlText);
|
|
6
|
+
createExtensionSnapshot(extensionId: AppExtension["id"], extensionName: AppExtension["name"], snapshot: Omit<AppExtensionSnapshotDetails, "id">): Promise<void>;
|
|
7
|
+
getExtensionSnapshot(extensionName: AppExtension["name"], extensionSnapshotVersion: AppExtensionSnapshot["version"]): Promise<Optional<AppExtensionSnapshotDetails>>;
|
|
8
|
+
getExtensionSnapshotVersions(extensionId: AppExtension["id"]): Promise<AppExtensionSnapshot[]>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AppExtensionAliasDetails } from "@kong/contract";
|
|
2
|
+
import { UrlText } from "@kong/ts";
|
|
3
|
+
export declare class PublicClient {
|
|
4
|
+
private readonly baseUrl;
|
|
5
|
+
constructor(baseUrl: UrlText);
|
|
6
|
+
assignExtensionAlias(alias: Omit<AppExtensionAliasDetails, "id">): Promise<void>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { UrlText, User } from "@kong/ts";
|
|
2
|
+
interface PublishDetails {
|
|
3
|
+
repoName: string;
|
|
4
|
+
imageName: string;
|
|
5
|
+
imageVersion: string;
|
|
6
|
+
userName: User["name"];
|
|
7
|
+
token: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class RegistryClient {
|
|
10
|
+
private readonly baseUrl;
|
|
11
|
+
constructor(baseUrl: UrlText);
|
|
12
|
+
getPublishDetails(repoName: string): Promise<PublishDetails>;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { makeServerlessJavaAppProps, serverlessFlowBuilder, stringifyServerlessFlow, } from "./lib/kongServerless";
|
|
2
|
+
export type { FloweyServerlessBuilder } from "./lib/kongServerless";
|
|
3
|
+
export type { KongSpecJobSession } from "./lib/kongSession";
|
|
4
|
+
export type { KongSpecAction, KongSpecActionCallFunction, KongSpecActionCallProcess, KongSpecActionSendEvent, KongSpecAppend, KongSpecBranch, KongSpecCache, KongSpecCallModel, KongSpecCircuitBreaker, KongSpecCondition, KongSpecError, KongSpecEventBroker, KongSpecEventConnection, KongSpecFeatureCompensation, KongSpecFlow, KongSpecFunctionRef, KongSpecHowToInvoke, KongSpecHowToOutput, KongSpecProcessRef, KongSpecRateLimiter, KongSpecRecord, KongSpecRecordHeader, KongSpecRetry, KongSpecState, KongSpecStateCallFunction, KongSpecStateCallProcess, KongSpecStateCompensate, KongSpecStateExit, KongSpecStateFail, KongSpecStateForeach, KongSpecStateInject, KongSpecStateParallel, KongSpecStateSendEvent, KongSpecStateStart, KongSpecStateSucceed, KongSpecStateSwitch, KongSpecStateWaitEvent, KongSpecSupportsActions, KongSpecSupportsErrors, KongSpecSupportsTransition, } from "./lib/kongSpec";
|
|
5
|
+
export { KongSpecBuild } from "./lib/kongSpecBuild";
|
|
6
|
+
export { KongSpecDoc } from "./lib/kongSpecDoc";
|
|
7
|
+
export { KongSpecEnv } from "./lib/kongSpecEnv";
|
|
8
|
+
export type { KongSpecFile } from "./lib/kongSpecFile";
|
|
9
|
+
export type { KongSpecLayout, KongSpecLayoutPosition, KongSpecLayoutPositionKey, } from "./lib/kongSpecLayout";
|
|
10
|
+
export { nameGenerator } from "./lib/kongSpecName";
|
|
11
|
+
export { normalizeName } from "./lib/kongSpecNormalize";
|
|
12
|
+
export { KongSpecRef } from "./lib/kongSpecRef";
|
|
13
|
+
export type { KongSpecActionPath, KongSpecStatePath } from "./lib/kongSpecRef";
|
|
14
|
+
export { convertSpecToServerless } from "./lib/kongSpecToServerless";
|
|
15
|
+
export { findSourceState, getActions, outputAggregator, traverseFlowUp } from "./lib/kongSpecUtils";
|
|
16
|
+
export { validate } from "./lib/kongSpecValidate";
|
|
17
|
+
export type { KongSpecValidationIssue, KongSpecValidators } from "./lib/kongSpecValidate";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Specification, workflowBuilder } from "@severlessworkflow/sdk-typescript";
|
|
2
|
+
export type FloweyServerlessBuilder = ReturnType<typeof workflowBuilder>;
|
|
3
|
+
export declare function serverlessFlowBuilder(): FloweyServerlessBuilder;
|
|
4
|
+
export declare const copyServerlessFlow: (workflow: Specification.Workflow) => Specification.Workflow;
|
|
5
|
+
export declare function stringifyServerlessFlow(workflow: Specification.Workflow): string;
|
|
6
|
+
interface ServerlessJavaAppPropsGenerator {
|
|
7
|
+
processId: string;
|
|
8
|
+
events: Specification.Eventdef[];
|
|
9
|
+
}
|
|
10
|
+
export declare function makeServerlessJavaAppProps({ processId, events }: ServerlessJavaAppPropsGenerator): string;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BusinessKey, Distinct, UtcDateTime } from "@kong/ts";
|
|
2
|
+
export declare enum KongSpecSessionAgent {
|
|
3
|
+
JOB = "JOB"
|
|
4
|
+
}
|
|
5
|
+
interface KongSpecSession {
|
|
6
|
+
agent: KongSpecSessionAgent;
|
|
7
|
+
id: Distinct<number, "KongSpecSessionId">;
|
|
8
|
+
businessKey: BusinessKey;
|
|
9
|
+
deadline: UtcDateTime;
|
|
10
|
+
created: UtcDateTime;
|
|
11
|
+
}
|
|
12
|
+
export declare enum KongSpecJobSessionExecutionMode {
|
|
13
|
+
ASYNC = "ASYNC",
|
|
14
|
+
SYNC = "SYNC"
|
|
15
|
+
}
|
|
16
|
+
export declare enum KongSpecJobSessionPriority {
|
|
17
|
+
HIGHEST = "HIGHEST",
|
|
18
|
+
HIGH = "HIGH",
|
|
19
|
+
MEDIUM = "MEDIUM",
|
|
20
|
+
LOW = "LOW",
|
|
21
|
+
LOWEST = "LOWEST"
|
|
22
|
+
}
|
|
23
|
+
export interface KongSpecJobSession extends KongSpecSession {
|
|
24
|
+
source: string;
|
|
25
|
+
namespace: string;
|
|
26
|
+
topic: string;
|
|
27
|
+
partition: number;
|
|
28
|
+
priority: KongSpecJobSessionPriority;
|
|
29
|
+
executionMode: KongSpecJobSessionExecutionMode;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { Distinct, Duration8601, JqFilter, JqObject, JqText, JsonArray, JsonObject, Optional, ShortUUID } from "@kong/ts";
|
|
2
|
+
import { JSONSchema7 } from "json-schema";
|
|
3
|
+
export type KongSpecFunctionRef = Distinct<string, "KongSpecFunctionRef">;
|
|
4
|
+
export type KongSpecProcessRef = Distinct<string, "KongSpecProcessRef">;
|
|
5
|
+
export type KongSpecAppend = "list" | "last";
|
|
6
|
+
interface KongSpecStateBase {
|
|
7
|
+
id: Distinct<string, "KongSpecStateId">;
|
|
8
|
+
name: string;
|
|
9
|
+
type: "start" | "succeed" | "fail" | "inject" | "compensate" | "foreach" | "callFunction" | "parallel" | "switch" | "sendEvent" | "waitEvent" | "callProcess";
|
|
10
|
+
}
|
|
11
|
+
export interface KongSpecSupportsTransition {
|
|
12
|
+
next: KongSpecStateBase["id"] | null;
|
|
13
|
+
}
|
|
14
|
+
export interface KongSpecError extends KongSpecSupportsTransition {
|
|
15
|
+
id: Distinct<string, "KongSpecErrorId">;
|
|
16
|
+
description: string;
|
|
17
|
+
code: string;
|
|
18
|
+
}
|
|
19
|
+
export interface KongSpecCache {
|
|
20
|
+
enabled: boolean;
|
|
21
|
+
key: JqFilter;
|
|
22
|
+
ttl: Duration8601;
|
|
23
|
+
onFailure: "RETRY" | "SKIP";
|
|
24
|
+
}
|
|
25
|
+
export interface KongSpecRetry {
|
|
26
|
+
maxAttempts: number;
|
|
27
|
+
attemptDelay: Duration8601;
|
|
28
|
+
attemptTimeout: Duration8601;
|
|
29
|
+
}
|
|
30
|
+
export interface KongSpecCircuitBreaker {
|
|
31
|
+
enabled: boolean;
|
|
32
|
+
delay: Duration8601;
|
|
33
|
+
requestVolumeThreshold: number;
|
|
34
|
+
failureRatio: number;
|
|
35
|
+
successThreshold: number;
|
|
36
|
+
}
|
|
37
|
+
export interface KongSpecRateLimiter {
|
|
38
|
+
enabled: boolean;
|
|
39
|
+
value: number;
|
|
40
|
+
window: Duration8601;
|
|
41
|
+
minSpacing: Duration8601;
|
|
42
|
+
}
|
|
43
|
+
export interface KongSpecHowToInvoke {
|
|
44
|
+
prefix: string;
|
|
45
|
+
retry: KongSpecRetry;
|
|
46
|
+
cache: KongSpecCache;
|
|
47
|
+
circuitBreaker: KongSpecCircuitBreaker;
|
|
48
|
+
rateLimiter: KongSpecRateLimiter;
|
|
49
|
+
}
|
|
50
|
+
export interface KongSpecSupportsInvoke {
|
|
51
|
+
invoke: KongSpecHowToInvoke;
|
|
52
|
+
}
|
|
53
|
+
export interface KongSpecSupportsInput {
|
|
54
|
+
inputPayload: JqObject;
|
|
55
|
+
}
|
|
56
|
+
export interface KongSpecEffectProducer {
|
|
57
|
+
id: string;
|
|
58
|
+
type: string;
|
|
59
|
+
}
|
|
60
|
+
export interface KongSpecEffectAck {
|
|
61
|
+
producer: KongSpecEffectProducer;
|
|
62
|
+
seqNum: number;
|
|
63
|
+
}
|
|
64
|
+
export interface KongSpecHowToOutput {
|
|
65
|
+
ack: KongSpecEffectAck;
|
|
66
|
+
filter: JqFilter;
|
|
67
|
+
destinations: string[];
|
|
68
|
+
}
|
|
69
|
+
export interface KongSpecSupportsOutputFilter {
|
|
70
|
+
outputFilter: JqFilter;
|
|
71
|
+
}
|
|
72
|
+
export interface KongSpecSupportsOutputAppend {
|
|
73
|
+
outputAppend: Array<KongSpecAppend>;
|
|
74
|
+
}
|
|
75
|
+
export interface KongSpecSupportsOutputSample {
|
|
76
|
+
outputSample: Optional<JsonObject | JsonArray>;
|
|
77
|
+
}
|
|
78
|
+
export interface KongSpecCallModel extends KongSpecSupportsInput, KongSpecSupportsOutputFilter, KongSpecSupportsOutputAppend, KongSpecSupportsOutputSample, KongSpecSupportsInvoke {
|
|
79
|
+
}
|
|
80
|
+
export interface KongSpecSupportsErrors {
|
|
81
|
+
errors: KongSpecError[];
|
|
82
|
+
}
|
|
83
|
+
export interface KongSpecSupportsTimeout {
|
|
84
|
+
timeout: Duration8601;
|
|
85
|
+
}
|
|
86
|
+
export interface KongSpecSupportsCompensatedBy {
|
|
87
|
+
compensatedBy: KongSpecStateBase["id"] | null;
|
|
88
|
+
}
|
|
89
|
+
export interface KongSpecFeatureCompensation {
|
|
90
|
+
featureCompensation: "on" | "off";
|
|
91
|
+
}
|
|
92
|
+
export interface KongSpecCanBeUsedForCompensation {
|
|
93
|
+
usedForCompensation: boolean;
|
|
94
|
+
}
|
|
95
|
+
export interface KongSpecStateStart extends KongSpecStateBase, KongSpecSupportsTransition, KongSpecSupportsTimeout {
|
|
96
|
+
type: "start";
|
|
97
|
+
inputSchema: JSONSchema7;
|
|
98
|
+
inputSample: JsonObject;
|
|
99
|
+
}
|
|
100
|
+
export interface KongSpecStateSucceed extends KongSpecStateBase, KongSpecSupportsOutputFilter {
|
|
101
|
+
type: "succeed";
|
|
102
|
+
}
|
|
103
|
+
export interface KongSpecStateFail extends KongSpecStateBase, KongSpecSupportsOutputFilter {
|
|
104
|
+
type: "fail";
|
|
105
|
+
}
|
|
106
|
+
export interface KongSpecStateInject extends KongSpecStateBase, KongSpecSupportsOutputFilter, KongSpecSupportsOutputAppend, KongSpecSupportsTransition {
|
|
107
|
+
type: "inject";
|
|
108
|
+
}
|
|
109
|
+
export interface KongSpecStateCompensate extends KongSpecStateBase, KongSpecSupportsTransition {
|
|
110
|
+
type: "compensate";
|
|
111
|
+
}
|
|
112
|
+
export interface KongSpecCondition extends KongSpecSupportsTransition, KongSpecSupportsTransition {
|
|
113
|
+
id: Distinct<string, "KongSpecConditionId">;
|
|
114
|
+
match: JqFilter;
|
|
115
|
+
}
|
|
116
|
+
export interface KongSpecStateSwitch extends KongSpecStateBase, KongSpecCanBeUsedForCompensation, KongSpecSupportsTransition {
|
|
117
|
+
type: "switch";
|
|
118
|
+
conditions: KongSpecCondition[];
|
|
119
|
+
}
|
|
120
|
+
export interface KongSpecEventBroker {
|
|
121
|
+
host: string;
|
|
122
|
+
port: number;
|
|
123
|
+
}
|
|
124
|
+
export interface KongSpecEventConnection {
|
|
125
|
+
brokers: KongSpecEventBroker[];
|
|
126
|
+
topic: string;
|
|
127
|
+
securityProtocol: "PLAINTEXT" | "SSL";
|
|
128
|
+
}
|
|
129
|
+
export interface KongSpecRecordHeader extends JqObject {
|
|
130
|
+
key: JqText;
|
|
131
|
+
value: JqText;
|
|
132
|
+
}
|
|
133
|
+
export interface KongSpecRecord extends JqObject {
|
|
134
|
+
headers: KongSpecRecordHeader[];
|
|
135
|
+
key: JqText;
|
|
136
|
+
value: JqText;
|
|
137
|
+
}
|
|
138
|
+
export interface KongSpecStateSendEvent extends KongSpecStateBase, KongSpecSupportsTransition, KongSpecCanBeUsedForCompensation, KongSpecSupportsErrors, KongSpecFeatureCompensation, KongSpecSupportsCompensatedBy {
|
|
139
|
+
type: "sendEvent";
|
|
140
|
+
connection: KongSpecEventConnection;
|
|
141
|
+
record: KongSpecRecord;
|
|
142
|
+
}
|
|
143
|
+
export interface KongSpecStateWaitEvent extends KongSpecStateBase, KongSpecSupportsTransition, KongSpecSupportsErrors, KongSpecFeatureCompensation, KongSpecSupportsTimeout, KongSpecSupportsCompensatedBy, KongSpecSupportsOutputFilter, KongSpecSupportsOutputAppend, KongSpecSupportsOutputSample {
|
|
144
|
+
type: "waitEvent";
|
|
145
|
+
connection: KongSpecEventConnection;
|
|
146
|
+
}
|
|
147
|
+
export interface KongSpecStateCallProcess extends KongSpecStateBase, KongSpecSupportsTransition, KongSpecCanBeUsedForCompensation, KongSpecSupportsErrors, KongSpecFeatureCompensation, KongSpecSupportsCompensatedBy, KongSpecCallModel {
|
|
148
|
+
type: "callProcess";
|
|
149
|
+
ref: KongSpecProcessRef;
|
|
150
|
+
}
|
|
151
|
+
export interface KongSpecStateCallFunction extends KongSpecStateBase, KongSpecSupportsTransition, KongSpecSupportsErrors, KongSpecFeatureCompensation, KongSpecCanBeUsedForCompensation, KongSpecSupportsCompensatedBy, KongSpecCallModel {
|
|
152
|
+
type: "callFunction";
|
|
153
|
+
ref: KongSpecFunctionRef;
|
|
154
|
+
}
|
|
155
|
+
export interface KongSpecActionBase {
|
|
156
|
+
id: Distinct<string, "KongSpecActionId">;
|
|
157
|
+
type: "callFunction" | "sendEvent" | "callProcess";
|
|
158
|
+
name: string;
|
|
159
|
+
}
|
|
160
|
+
export interface KongSpecActionCallFunction extends KongSpecActionBase, KongSpecCallModel {
|
|
161
|
+
type: "callFunction";
|
|
162
|
+
ref: KongSpecFunctionRef;
|
|
163
|
+
}
|
|
164
|
+
export interface KongSpecActionCallProcess extends KongSpecActionBase, KongSpecCallModel {
|
|
165
|
+
type: "callProcess";
|
|
166
|
+
}
|
|
167
|
+
export interface KongSpecActionSendEvent extends KongSpecActionBase {
|
|
168
|
+
type: "sendEvent";
|
|
169
|
+
connection: KongSpecEventConnection;
|
|
170
|
+
record: KongSpecRecord;
|
|
171
|
+
}
|
|
172
|
+
export type KongSpecAction = KongSpecActionCallFunction | KongSpecActionCallProcess | KongSpecActionSendEvent;
|
|
173
|
+
export interface KongSpecSupportsActions {
|
|
174
|
+
actions: KongSpecAction[];
|
|
175
|
+
}
|
|
176
|
+
export interface KongSpecBranch {
|
|
177
|
+
id: Distinct<string, "KongSpecBranchId">;
|
|
178
|
+
actions: KongSpecAction[];
|
|
179
|
+
}
|
|
180
|
+
export interface KongSpecStateForeach extends KongSpecStateBase, KongSpecSupportsTransition, KongSpecCanBeUsedForCompensation, KongSpecFeatureCompensation, KongSpecSupportsCompensatedBy, KongSpecSupportsErrors {
|
|
181
|
+
type: "foreach";
|
|
182
|
+
inputCollection: JqFilter;
|
|
183
|
+
iterationParam: JqFilter;
|
|
184
|
+
outputCollection: JqFilter;
|
|
185
|
+
actions: KongSpecAction[];
|
|
186
|
+
}
|
|
187
|
+
export interface KongSpecStateParallel extends KongSpecStateBase, KongSpecSupportsTransition, KongSpecCanBeUsedForCompensation, KongSpecFeatureCompensation, KongSpecSupportsCompensatedBy, KongSpecSupportsErrors {
|
|
188
|
+
type: "parallel";
|
|
189
|
+
branches: KongSpecBranch[];
|
|
190
|
+
completionType: "allOf" | "atLeast";
|
|
191
|
+
}
|
|
192
|
+
export type KongSpecState = KongSpecStateStart | KongSpecStateSucceed | KongSpecStateFail | KongSpecStateInject | KongSpecStateCompensate | KongSpecStateForeach | KongSpecStateCallFunction | KongSpecStateCallProcess | KongSpecStateSwitch | KongSpecStateSendEvent | KongSpecStateWaitEvent | KongSpecStateParallel;
|
|
193
|
+
export type KongSpecStateExit = KongSpecStateFail | KongSpecStateSucceed;
|
|
194
|
+
export interface KongSpecFlow {
|
|
195
|
+
id: Distinct<ShortUUID, "KongSpecFlowId">;
|
|
196
|
+
version: "1.0";
|
|
197
|
+
states: KongSpecState[];
|
|
198
|
+
}
|
|
199
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Duration8601, JqObject, Timezone } from "@kong/ts";
|
|
2
|
+
import { KongSpecJobSession } from "./kongSession";
|
|
3
|
+
import { KongSpecActionCallFunction, KongSpecActionSendEvent, KongSpecBranch, KongSpecCallModel, KongSpecCondition, KongSpecError, KongSpecEventBroker, KongSpecFlow, KongSpecFunctionRef, KongSpecHowToInvoke, KongSpecHowToOutput, KongSpecProcessRef, KongSpecRecordHeader, KongSpecStateCallFunction, KongSpecStateCallProcess, KongSpecStateCompensate, KongSpecStateFail, KongSpecStateForeach, KongSpecStateInject, KongSpecStateParallel, KongSpecStateSendEvent, KongSpecStateStart, KongSpecStateSucceed, KongSpecStateSwitch, KongSpecStateWaitEvent } from "./kongSpec";
|
|
4
|
+
export declare class KongSpecBuild {
|
|
5
|
+
flow(id: KongSpecFlow["id"]): KongSpecFlow;
|
|
6
|
+
startState(overrides?: Partial<KongSpecStateStart>): KongSpecStateStart;
|
|
7
|
+
foreachState(overrides?: Partial<KongSpecStateForeach>): KongSpecStateForeach;
|
|
8
|
+
parallelState(overrides?: Partial<KongSpecStateParallel>): KongSpecStateParallel;
|
|
9
|
+
callFunctionState(ref: KongSpecFunctionRef, overrides?: Partial<KongSpecStateCallFunction>): KongSpecStateCallFunction;
|
|
10
|
+
callFunctionAction(ref: KongSpecFunctionRef, overrides?: Partial<KongSpecActionCallFunction>): KongSpecActionCallFunction;
|
|
11
|
+
callProcessState(ref: KongSpecProcessRef, overrides?: Partial<KongSpecStateCallProcess>): KongSpecStateCallProcess;
|
|
12
|
+
compensateState(overrides?: Partial<KongSpecStateCompensate>): KongSpecStateCompensate;
|
|
13
|
+
failState(overrides?: Partial<KongSpecStateFail>): KongSpecStateFail;
|
|
14
|
+
injectState(overrides?: Partial<KongSpecStateInject>): KongSpecStateInject;
|
|
15
|
+
succeedState(overrides?: Partial<KongSpecStateSucceed>): KongSpecStateSucceed;
|
|
16
|
+
sendEventState(overrides?: Partial<KongSpecStateSendEvent>): KongSpecStateSendEvent;
|
|
17
|
+
sendEventAction(overrides?: Partial<KongSpecActionSendEvent>): KongSpecActionSendEvent;
|
|
18
|
+
waitEventState(overrides?: Partial<KongSpecStateWaitEvent>): KongSpecStateWaitEvent;
|
|
19
|
+
switchState(overrides?: Partial<KongSpecStateSwitch>): KongSpecStateSwitch;
|
|
20
|
+
condition(overrides?: Partial<KongSpecCondition>): KongSpecCondition;
|
|
21
|
+
branch(id: KongSpecBranch["id"], overrides?: Partial<KongSpecBranch>): KongSpecBranch;
|
|
22
|
+
broker(overrides?: Partial<KongSpecEventBroker>): KongSpecEventBroker;
|
|
23
|
+
recordHeader(overrides?: Partial<KongSpecRecordHeader>): KongSpecRecordHeader;
|
|
24
|
+
error(overrides?: Partial<KongSpecError>): KongSpecError;
|
|
25
|
+
output(overrides?: Partial<KongSpecHowToOutput>): KongSpecHowToOutput;
|
|
26
|
+
invoke(overrides?: Partial<KongSpecHowToInvoke>): KongSpecHowToInvoke;
|
|
27
|
+
retry(overrides?: Partial<KongSpecHowToInvoke["retry"]>): KongSpecHowToInvoke["retry"];
|
|
28
|
+
circuitBreaker(overrides?: Partial<KongSpecHowToInvoke["circuitBreaker"]>): KongSpecHowToInvoke["circuitBreaker"];
|
|
29
|
+
rateLimiter(overrides?: Partial<KongSpecHowToInvoke["rateLimiter"]>): {
|
|
30
|
+
enabled: boolean;
|
|
31
|
+
value: number;
|
|
32
|
+
window: Duration8601;
|
|
33
|
+
minSpacing: Duration8601;
|
|
34
|
+
};
|
|
35
|
+
cache(overrides?: Partial<KongSpecHowToInvoke["cache"]>): KongSpecHowToInvoke["cache"];
|
|
36
|
+
callModel(payload: JqObject): KongSpecCallModel;
|
|
37
|
+
session(timezone: Timezone, overrides?: Partial<KongSpecJobSession>): KongSpecJobSession;
|
|
38
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class KongSpecDoc {
|
|
2
|
+
static aboutCompensation: string;
|
|
3
|
+
static aboutProcessTimeout: string;
|
|
4
|
+
static aboutCallbackTimeout: string;
|
|
5
|
+
static aboutActionDataFilterOfOutput: string;
|
|
6
|
+
static aboutStateDataFilterOfInput: string;
|
|
7
|
+
static aboutErrorHandling: string;
|
|
8
|
+
static aboutCache: string;
|
|
9
|
+
static aboutRetry: string;
|
|
10
|
+
static aboutConditions: string;
|
|
11
|
+
static aboutResilience: string;
|
|
12
|
+
static aboutLimits: string;
|
|
13
|
+
static aboutIdentify: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Distinct, Timezone, UrlText, UtcDateTime } from "@kong/ts";
|
|
2
|
+
import { KongSpecFlow } from "./kongSpec";
|
|
3
|
+
import { KongSpecLayout } from "./kongSpecLayout";
|
|
4
|
+
export interface KongSpecFile {
|
|
5
|
+
version: "1";
|
|
6
|
+
checkpoint: {
|
|
7
|
+
id: Distinct<UrlText, "CheckpointId">;
|
|
8
|
+
documentId: KongSpecFlow["id"];
|
|
9
|
+
type: "SAVE" | "SNAPSHOT";
|
|
10
|
+
created: UtcDateTime;
|
|
11
|
+
createdBy: string;
|
|
12
|
+
};
|
|
13
|
+
requestId: {
|
|
14
|
+
traceId: string;
|
|
15
|
+
spanId: string;
|
|
16
|
+
};
|
|
17
|
+
metadata: {
|
|
18
|
+
userAgent: string;
|
|
19
|
+
thumbnail: string;
|
|
20
|
+
timezone: Timezone;
|
|
21
|
+
origin: "LOCAL" | "REMOTE";
|
|
22
|
+
};
|
|
23
|
+
layout: KongSpecLayout;
|
|
24
|
+
flow: KongSpecFlow;
|
|
25
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { KongSpecAction, KongSpecState } from "./kongSpec";
|
|
2
|
+
export type KongSpecLayoutPositionKey = KongSpecState["id"] | KongSpecAction["id"];
|
|
3
|
+
export type KongSpecLayoutPosition = [number, number];
|
|
4
|
+
export type KongSpecLayout = Record<KongSpecLayoutPositionKey, KongSpecLayoutPosition>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Optional } from "@kong/ts";
|
|
2
|
+
import { KongSpecAction, KongSpecBranch, KongSpecCondition, KongSpecError, KongSpecState } from "./kongSpec";
|
|
3
|
+
export declare class KongSpecRef {
|
|
4
|
+
static newStateId(): KongSpecState["id"];
|
|
5
|
+
static newConditionId(): KongSpecCondition["id"];
|
|
6
|
+
static newBranchId(): KongSpecBranch["id"];
|
|
7
|
+
static newErrorId(): KongSpecError["id"];
|
|
8
|
+
static newActionId(): KongSpecAction["id"];
|
|
9
|
+
}
|
|
10
|
+
export interface KongSpecStatePath {
|
|
11
|
+
stateRef: KongSpecState["id"];
|
|
12
|
+
}
|
|
13
|
+
export interface KongSpecActionPath extends KongSpecStatePath {
|
|
14
|
+
branchRef: Optional<KongSpecBranch["id"]>;
|
|
15
|
+
actionRef: KongSpecAction["id"];
|
|
16
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Specification } from "@severlessworkflow/sdk-typescript";
|
|
2
|
+
import { JSONSchema7 } from "json-schema";
|
|
3
|
+
import { KongSpecFlow } from "./kongSpec";
|
|
4
|
+
import { KongSpecEnv } from "./kongSpecEnv";
|
|
5
|
+
interface ConvertSpecToServerlessResult {
|
|
6
|
+
workflow: Specification.Workflow;
|
|
7
|
+
inputSchema: JSONSchema7;
|
|
8
|
+
}
|
|
9
|
+
export declare function convertSpecToServerless(type: "main", specFlow: KongSpecFlow, env: KongSpecEnv): ConvertSpecToServerlessResult;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { JqFilter, JsonObject } from "@kong/ts";
|
|
2
|
+
import { KongSpecAction, KongSpecFlow, KongSpecState } from "./kongSpec";
|
|
3
|
+
interface FloweyTraverseStateTestItem {
|
|
4
|
+
id: KongSpecState["id"] | KongSpecAction["id"];
|
|
5
|
+
source: "initial" | "errors" | "transition" | "conditions" | "compensateBy" | "actions" | "branches";
|
|
6
|
+
}
|
|
7
|
+
export declare function traverseFlowUp(id: KongSpecState["id"] | KongSpecAction["id"], states: KongSpecFlow["states"], test: (current: FloweyTraverseStateTestItem) => boolean): boolean;
|
|
8
|
+
export declare function outputAggregator(jq: (sample: JsonObject, filter: JqFilter) => Promise<string>): (flow: KongSpecFlow, targetRef: KongSpecState["id"] | KongSpecAction["id"], includeTarget?: boolean) => Promise<JsonObject>;
|
|
9
|
+
export declare function getActions(state: KongSpecState): KongSpecAction[];
|
|
10
|
+
export declare function findSourceState(states: KongSpecState[], targetRef: KongSpecState["id"]): import("@kong/ts").Distinct<string, "KongSpecStateId">;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { KongSpecAction, KongSpecFlow, KongSpecState } from "./kongSpec";
|
|
2
|
+
import { KongSpecActionPath, KongSpecStatePath } from "./kongSpecRef";
|
|
3
|
+
export interface KongSpecValidationIssue {
|
|
4
|
+
path: KongSpecStatePath | KongSpecActionPath;
|
|
5
|
+
severity: "error" | "warning";
|
|
6
|
+
message: string;
|
|
7
|
+
fix: string;
|
|
8
|
+
}
|
|
9
|
+
export interface KongSpecValidators {
|
|
10
|
+
state: Array<(target: KongSpecState, path: KongSpecStatePath) => Promise<KongSpecValidationIssue[]>>;
|
|
11
|
+
action: Array<(target: KongSpecAction, path: KongSpecActionPath) => Promise<KongSpecValidationIssue[]>>;
|
|
12
|
+
}
|
|
13
|
+
export declare function validate(flow: KongSpecFlow, validators: KongSpecValidators): Promise<KongSpecValidationIssue[]>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export { compileGet, compileSet } from "./lib/accessor";
|
|
2
|
+
export { generateBusinessKey } from "./lib/businessKey";
|
|
3
|
+
export type { BusinessKey } from "./lib/businessKey";
|
|
4
|
+
export { CloudEvent } from "./lib/cloudEvent";
|
|
5
|
+
export { textToColor } from "./lib/color";
|
|
6
|
+
export { deepEquals, prepareTextForComparison, sameText, shadowEquals } from "./lib/compare";
|
|
7
|
+
export { isDuration } from "./lib/duration";
|
|
8
|
+
export type { Duration8601 } from "./lib/duration";
|
|
9
|
+
export type { Entity } from "./lib/entity";
|
|
10
|
+
export { AppError, DataError, errorToPrettyString } from "./lib/error";
|
|
11
|
+
export { ensureIsDuration, nonNegative, nonRecursiveCall, notBlank, notNull } from "./lib/guard";
|
|
12
|
+
export { guid, stableUUID, uuidStableSequence, uuidc16, uuidc32 } from "./lib/id";
|
|
13
|
+
export type { CompactUUID16, CompactUUID32, GUID, ShortUUID } from "./lib/id";
|
|
14
|
+
export { intervalToString } from "./lib/interval";
|
|
15
|
+
export { JqObjectSerializer, applyJqFilterReplacements, applyJqObjectReplacements, applyJqTextReplacements, extractJqTextContent, jqFilter, jqText, wrapWithJqTextMarkers, } from "./lib/jq";
|
|
16
|
+
export type { JqArray, JqFilter, JqObject, JqSerializer, JqText, RefactorReplacement, } from "./lib/jq";
|
|
17
|
+
export { generateFakeJsonObject, jsonToHumanReadable, prettyJson, safeJsonParse } from "./lib/json";
|
|
18
|
+
export type { JsonArray, JsonObject, JsonSchemaUrl, JsonText } from "./lib/json";
|
|
19
|
+
export { KeyGenerator } from "./lib/keyGenerator";
|
|
20
|
+
export { insertItem, moveItem, unique } from "./lib/list";
|
|
21
|
+
export { deepMerge, deepMergeAll } from "./lib/merge";
|
|
22
|
+
export { deepDeleteKeys } from "./lib/normalize";
|
|
23
|
+
export { retry } from "./lib/retry";
|
|
24
|
+
export { fromRequestId, newRequestId } from "./lib/telemetry";
|
|
25
|
+
export type { RequestId } from "./lib/telemetry";
|
|
26
|
+
export { byteCount, camelize, escapeLikeText, escapeQuotes, escapeRegex, hashString, quote, removeOuterQuotes, replaceFirstOccurrence, splitToBlocks, trim, upperFirst, words, } from "./lib/text";
|
|
27
|
+
export type { TextBlock } from "./lib/text";
|
|
28
|
+
export { TextReader } from "./lib/textReader";
|
|
29
|
+
export { DEFAULT_TIMEZONE } from "./lib/timezone";
|
|
30
|
+
export type { Timezone } from "./lib/timezone";
|
|
31
|
+
export type { Action, DeepPartial, Distinct, Loading, NonFunctionProperties, Optional, Pair, Primitive, PropertyPath, PropertyPathMap, RequiredProperties, Result, StringKeys, UnArray, ValidateKeys, } from "./lib/types";
|
|
32
|
+
export { joinUrlAndPath, urlText } from "./lib/url";
|
|
33
|
+
export type { UrlText } from "./lib/url";
|
|
34
|
+
export type { User } from "./lib/user";
|
|
35
|
+
export { dateToUtc, utcNow, utcToZonedDate, utcToZonedText } from "./lib/utc";
|
|
36
|
+
export type { UtcDateTime } from "./lib/utc";
|
|
37
|
+
export { assignDefined, clone, coalesce, getFirstObjectValue, isEmpty, isFunction, isNumber, isString, jitter, no, noop, reinterpret, safeCall, yes, } from "./lib/utils";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { JsonObject, Optional, PropertyPath } from "./types";
|
|
2
|
+
export type Getter<T, V> = (entry: T) => V;
|
|
3
|
+
export type Setter<T, V> = (entry: T, value: V) => void;
|
|
4
|
+
export interface Accessor<T, V> {
|
|
5
|
+
key: PropertyPath<T>;
|
|
6
|
+
getValue: Optional<Getter<T, V>>;
|
|
7
|
+
setValue: Optional<Setter<T, V>>;
|
|
8
|
+
}
|
|
9
|
+
export declare function compileGet<T extends JsonObject, V>(path: PropertyPath<T>): Getter<T, V>;
|
|
10
|
+
export declare function compileSet<T extends JsonObject, V>(path: PropertyPath<T>): Setter<T, V>;
|
|
11
|
+
export declare function getValueFactory<T extends JsonObject, V>(accessor: Accessor<T, V>): Getter<T, V>;
|
|
12
|
+
export declare function setValueFactory<T extends JsonObject, V>(accessor: Accessor<T, V>): Setter<T, V>;
|