@mistweaverco/kulala-core 0.1.0
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/LICENSE +21 -0
- package/README.md +80 -0
- package/dist/curl-1ra9mcaj. +0 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14823 -0
- package/dist/index.js.map +59 -0
- package/dist/lib/auth/oauth2/acquisition.d.ts +39 -0
- package/dist/lib/auth/oauth2/acquisition.d.ts.map +1 -0
- package/dist/lib/auth/oauth2/browser-flow.d.ts +62 -0
- package/dist/lib/auth/oauth2/browser-flow.d.ts.map +1 -0
- package/dist/lib/auth/oauth2/config.d.ts +17 -0
- package/dist/lib/auth/oauth2/config.d.ts.map +1 -0
- package/dist/lib/auth/oauth2/continuation.d.ts +10 -0
- package/dist/lib/auth/oauth2/continuation.d.ts.map +1 -0
- package/dist/lib/auth/oauth2/manager.d.ts +21 -0
- package/dist/lib/auth/oauth2/manager.d.ts.map +1 -0
- package/dist/lib/auth/oauth2/prompt-error.d.ts +10 -0
- package/dist/lib/auth/oauth2/prompt-error.d.ts.map +1 -0
- package/dist/lib/auth/oauth2/prompt-helper.d.ts +16 -0
- package/dist/lib/auth/oauth2/prompt-helper.d.ts.map +1 -0
- package/dist/lib/auth/oauth2/types.d.ts +60 -0
- package/dist/lib/auth/oauth2/types.d.ts.map +1 -0
- package/dist/lib/helpers/index.d.ts +2 -0
- package/dist/lib/helpers/index.d.ts.map +1 -0
- package/dist/lib/parser/at-variables.d.ts +17 -0
- package/dist/lib/parser/at-variables.d.ts.map +1 -0
- package/dist/lib/parser/body.d.ts +5 -0
- package/dist/lib/parser/body.d.ts.map +1 -0
- package/dist/lib/parser/comment.d.ts +3 -0
- package/dist/lib/parser/comment.d.ts.map +1 -0
- package/dist/lib/parser/directive.d.ts +15 -0
- package/dist/lib/parser/directive.d.ts.map +1 -0
- package/dist/lib/parser/header.d.ts +4 -0
- package/dist/lib/parser/header.d.ts.map +1 -0
- package/dist/lib/parser/index.d.ts +6 -0
- package/dist/lib/parser/index.d.ts.map +1 -0
- package/dist/lib/parser/lib/helpers/index.d.ts +10 -0
- package/dist/lib/parser/lib/helpers/index.d.ts.map +1 -0
- package/dist/lib/parser/operator.d.ts +4 -0
- package/dist/lib/parser/operator.d.ts.map +1 -0
- package/dist/lib/parser/parser.d.ts +3 -0
- package/dist/lib/parser/parser.d.ts.map +1 -0
- package/dist/lib/parser/request.d.ts +10 -0
- package/dist/lib/parser/request.d.ts.map +1 -0
- package/dist/lib/parser/script.d.ts +8 -0
- package/dist/lib/parser/script.d.ts.map +1 -0
- package/dist/lib/parser/types/block.d.ts +31 -0
- package/dist/lib/parser/types/block.d.ts.map +1 -0
- package/dist/lib/parser/types/body.d.ts +41 -0
- package/dist/lib/parser/types/body.d.ts.map +1 -0
- package/dist/lib/parser/types/comment.d.ts +6 -0
- package/dist/lib/parser/types/comment.d.ts.map +1 -0
- package/dist/lib/parser/types/directive.d.ts +13 -0
- package/dist/lib/parser/types/directive.d.ts.map +1 -0
- package/dist/lib/parser/types/document.d.ts +17 -0
- package/dist/lib/parser/types/document.d.ts.map +1 -0
- package/dist/lib/parser/types/error.d.ts +7 -0
- package/dist/lib/parser/types/error.d.ts.map +1 -0
- package/dist/lib/parser/types/header.d.ts +5 -0
- package/dist/lib/parser/types/header.d.ts.map +1 -0
- package/dist/lib/parser/types/index.d.ts +4 -0
- package/dist/lib/parser/types/index.d.ts.map +1 -0
- package/dist/lib/parser/types/operator.d.ts +10 -0
- package/dist/lib/parser/types/operator.d.ts.map +1 -0
- package/dist/lib/parser/types/parser.d.ts +6 -0
- package/dist/lib/parser/types/parser.d.ts.map +1 -0
- package/dist/lib/parser/types/request.d.ts +44 -0
- package/dist/lib/parser/types/request.d.ts.map +1 -0
- package/dist/lib/parser/types/script.d.ts +13 -0
- package/dist/lib/parser/types/script.d.ts.map +1 -0
- package/dist/lib/parser/types/session.d.ts +27 -0
- package/dist/lib/parser/types/session.d.ts.map +1 -0
- package/dist/lib/parser/types/stdinparsed.d.ts +31 -0
- package/dist/lib/parser/types/stdinparsed.d.ts.map +1 -0
- package/dist/lib/parser/types/variable.d.ts +4 -0
- package/dist/lib/parser/types/variable.d.ts.map +1 -0
- package/dist/lib/persistence/cookie-store.d.ts +13 -0
- package/dist/lib/persistence/cookie-store.d.ts.map +1 -0
- package/dist/lib/persistence/data-dir.d.ts +12 -0
- package/dist/lib/persistence/data-dir.d.ts.map +1 -0
- package/dist/lib/persistence/db.d.ts +44 -0
- package/dist/lib/persistence/db.d.ts.map +1 -0
- package/dist/lib/persistence/document-store.d.ts +15 -0
- package/dist/lib/persistence/document-store.d.ts.map +1 -0
- package/dist/lib/persistence/encrypted-store.d.ts +17 -0
- package/dist/lib/persistence/encrypted-store.d.ts.map +1 -0
- package/dist/lib/persistence/history-store.d.ts +26 -0
- package/dist/lib/persistence/history-store.d.ts.map +1 -0
- package/dist/lib/persistence/index.d.ts +26 -0
- package/dist/lib/persistence/index.d.ts.map +1 -0
- package/dist/lib/persistence/keychain.d.ts +24 -0
- package/dist/lib/persistence/keychain.d.ts.map +1 -0
- package/dist/lib/persistence/prompt-store.d.ts +31 -0
- package/dist/lib/persistence/prompt-store.d.ts.map +1 -0
- package/dist/lib/persistence/replay-store.d.ts +19 -0
- package/dist/lib/persistence/replay-store.d.ts.map +1 -0
- package/dist/lib/persistence/variable-store.d.ts +34 -0
- package/dist/lib/persistence/variable-store.d.ts.map +1 -0
- package/dist/lib/runner/block.d.ts +7 -0
- package/dist/lib/runner/block.d.ts.map +1 -0
- package/dist/lib/runner/body.d.ts +30 -0
- package/dist/lib/runner/body.d.ts.map +1 -0
- package/dist/lib/runner/curl-transport.d.ts +3 -0
- package/dist/lib/runner/curl-transport.d.ts.map +1 -0
- package/dist/lib/runner/doRequest.d.ts +5 -0
- package/dist/lib/runner/doRequest.d.ts.map +1 -0
- package/dist/lib/runner/embedded-curl.d.ts +2 -0
- package/dist/lib/runner/embedded-curl.d.ts.map +1 -0
- package/dist/lib/runner/headers.d.ts +14 -0
- package/dist/lib/runner/headers.d.ts.map +1 -0
- package/dist/lib/runner/http-client.d.ts +61 -0
- package/dist/lib/runner/http-client.d.ts.map +1 -0
- package/dist/lib/runner/http-transport.d.ts +5 -0
- package/dist/lib/runner/http-transport.d.ts.map +1 -0
- package/dist/lib/runner/index.d.ts +10 -0
- package/dist/lib/runner/index.d.ts.map +1 -0
- package/dist/lib/runner/scripts.d.ts +14 -0
- package/dist/lib/runner/scripts.d.ts.map +1 -0
- package/dist/lib/runner/types.d.ts +91 -0
- package/dist/lib/runner/types.d.ts.map +1 -0
- package/dist/lib/runner/vendored-curl.generated.d.ts +5 -0
- package/dist/lib/runner/vendored-curl.generated.d.ts.map +1 -0
- package/dist/lib/variables/env-files.d.ts +17 -0
- package/dist/lib/variables/env-files.d.ts.map +1 -0
- package/dist/lib/variables/flatten-json.d.ts +7 -0
- package/dist/lib/variables/flatten-json.d.ts.map +1 -0
- package/dist/lib/variables/index.d.ts +22 -0
- package/dist/lib/variables/index.d.ts.map +1 -0
- package/dist/lib/variables/kuba.d.ts +15 -0
- package/dist/lib/variables/kuba.d.ts.map +1 -0
- package/dist/lib/variables/magic.d.ts +7 -0
- package/dist/lib/variables/magic.d.ts.map +1 -0
- package/dist/lib/variables/request-vars.d.ts +25 -0
- package/dist/lib/variables/request-vars.d.ts.map +1 -0
- package/dist/lib/variables/resolve.d.ts +16 -0
- package/dist/lib/variables/resolve.d.ts.map +1 -0
- package/dist/lib/variables/stable-id.d.ts +6 -0
- package/dist/lib/variables/stable-id.d.ts.map +1 -0
- package/dist/lib/variables/substitute.d.ts +28 -0
- package/dist/lib/variables/substitute.d.ts.map +1 -0
- package/package.json +47 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP client using node:http, node:https, and node:http2 with timing instrumentation
|
|
3
|
+
* to match the timings shape previously provided by got (dns, tcp, tls, request, firstByte, total).
|
|
4
|
+
*/
|
|
5
|
+
export type NodeHttpClientTimings = {
|
|
6
|
+
phases: {
|
|
7
|
+
dns: number;
|
|
8
|
+
tcp: number;
|
|
9
|
+
tls: number;
|
|
10
|
+
request: number;
|
|
11
|
+
/** Time from request sent to first byte (server TTFB). */
|
|
12
|
+
firstByte: number;
|
|
13
|
+
/** Time from start (t0) to first byte; matches curl time_starttransfer. */
|
|
14
|
+
startTransfer: number;
|
|
15
|
+
/** Total time spent on redirect steps (curl time_redirect). 0 if no redirects. */
|
|
16
|
+
redirect: number;
|
|
17
|
+
total: number;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export type NodeHttpClientResponse = {
|
|
21
|
+
statusCode: number;
|
|
22
|
+
headers: Record<string, string>;
|
|
23
|
+
body: string | Buffer;
|
|
24
|
+
timings: NodeHttpClientTimings;
|
|
25
|
+
/** Final resolved URL (after redirects). */
|
|
26
|
+
url: string;
|
|
27
|
+
/** performance.now() when first byte of this response was received (for startTransfer from wall start). */
|
|
28
|
+
firstByteTime: number;
|
|
29
|
+
/** Present only when at least one redirect occurred (ordered hops, including the final response). */
|
|
30
|
+
redirectChain?: Array<{
|
|
31
|
+
statusCode: number;
|
|
32
|
+
headers: Record<string, string>;
|
|
33
|
+
body: string | Buffer;
|
|
34
|
+
timings: NodeHttpClientTimings;
|
|
35
|
+
url: string;
|
|
36
|
+
}>;
|
|
37
|
+
};
|
|
38
|
+
export type NodeHttpClientOptions = {
|
|
39
|
+
url: string;
|
|
40
|
+
method: string;
|
|
41
|
+
headers: Record<string, string>;
|
|
42
|
+
/** Body: string, Buffer, or FormData (multipart). For FormData we encode with form-data-encoder. */
|
|
43
|
+
body?: string | Buffer | FormData;
|
|
44
|
+
/** When "HTTP/2", use http2 for https URLs. Otherwise use http/https. */
|
|
45
|
+
httpVersion?: "HTTP/1.0" | "HTTP/1.1" | "HTTP/2";
|
|
46
|
+
/** If true, allow insecure TLS (curl --insecure). */
|
|
47
|
+
insecure?: boolean;
|
|
48
|
+
/** Request timeout in milliseconds (best-effort; curl --max-time). */
|
|
49
|
+
timeoutMs?: number;
|
|
50
|
+
/** Connection timeout in milliseconds (best-effort; curl --connect-timeout). */
|
|
51
|
+
connectionTimeoutMs?: number;
|
|
52
|
+
/** Whether to follow redirects (default true). */
|
|
53
|
+
followRedirects?: boolean;
|
|
54
|
+
/** Whether to propagate Set-Cookie -> Cookie across redirect hops (default true). */
|
|
55
|
+
propagateCookiesOnRedirect?: boolean;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Perform an HTTP request via cURL (spawned), with timing instrumentation.
|
|
59
|
+
*/
|
|
60
|
+
export declare function nodeHttpRequest(options: NodeHttpClientOptions): Promise<NodeHttpClientResponse>;
|
|
61
|
+
//# sourceMappingURL=http-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../../src/lib/runner/http-client.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,OAAO,EAAE,MAAM,CAAC;QAChB,0DAA0D;QAC1D,SAAS,EAAE,MAAM,CAAC;QAClB,2EAA2E;QAC3E,aAAa,EAAE,MAAM,CAAC;QACtB,kFAAkF;QAClF,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,OAAO,EAAE,qBAAqB,CAAC;IAC/B,4CAA4C;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,2GAA2G;I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,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;CAC1E,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { KulalaDocument } from "../parser/types";
|
|
2
|
+
import type { KulalaStdinActionRunLimit } from "../parser/types/stdinparsed";
|
|
3
|
+
import type { KulalaRunOptions, KulalaResponseWrapper } from "./types";
|
|
4
|
+
export type { KulalaRunOptions } from "./types";
|
|
5
|
+
export type { KulalaRequestErrorResponse, KulalaRequestSuccessResponse, KulalaResponseWrapper, } from "./types";
|
|
6
|
+
export declare function runDocument(doc: KulalaDocument, limit?: KulalaStdinActionRunLimit[], options?: KulalaRunOptions): Promise<KulalaResponseWrapper>;
|
|
7
|
+
export declare const KulalaRunner: () => {
|
|
8
|
+
run: (doc: KulalaDocument, limit?: KulalaStdinActionRunLimit[], options?: KulalaRunOptions) => Promise<void>;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/runner/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAa7E,OAAO,KAAK,EAIV,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAGjB,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,YAAY,EACV,0BAA0B,EAC1B,4BAA4B,EAC5B,qBAAqB,GACtB,MAAM,SAAS,CAAC;AAEjB,wBAAsB,WAAW,CAC/B,GAAG,EAAE,cAAc,EACnB,KAAK,CAAC,EAAE,yBAAyB,EAAE,EACnC,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,qBAAqB,CAAC,CA6GhC;AAED,eAAO,MAAM,YAAY;eAGd,cAAc,UACX,yBAAyB,EAAE,YACzB,gBAAgB,KACzB,OAAO,CAAC,IAAI,CAAC;CASnB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { KulalaBlock } from "./../parser/types/block";
|
|
2
|
+
import type { RunnerResponseLike } from "./types";
|
|
3
|
+
import { type KulalaScript, type KulalaScriptType } from "./../parser/types/script";
|
|
4
|
+
export type ScriptFlowContext = {
|
|
5
|
+
/** "Execution flow" local headers (not persisted). */
|
|
6
|
+
globalHeaders: Record<string, string>;
|
|
7
|
+
};
|
|
8
|
+
/** Mirrors JetBrains ContentType (Content-Type header). */
|
|
9
|
+
export type ScriptContentType = {
|
|
10
|
+
mimeType: string;
|
|
11
|
+
charset: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const runScripts: (scripts: KulalaScript[], type: KulalaScriptType, block: KulalaBlock, filePath?: string, response?: RunnerResponseLike, vars?: Record<string, string>, flow?: ScriptFlowContext) => Promise<void>;
|
|
14
|
+
//# sourceMappingURL=scripts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scripts.d.ts","sourceRoot":"","sources":["../../../src/lib/runner/scripts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACtB,MAAM,0BAA0B,CAAC;AAmBlC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,sDAAsD;IACtD,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC,CAAC;AAQF,2DAA2D;AAC3D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAuWF,eAAO,MAAM,UAAU,GACrB,SAAS,YAAY,EAAE,EACvB,MAAM,gBAAgB,EACtB,OAAO,WAAW,EAClB,WAAW,MAAM,EACjB,WAAW,kBAAkB,EAC7B,OAAO,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC7B,OAAO,iBAAiB,KACvB,OAAO,CAAC,IAAI,CAiId,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export type KulalaRequestSuccessResponse = {
|
|
2
|
+
success: true;
|
|
3
|
+
status: number;
|
|
4
|
+
headers: Record<string, string>;
|
|
5
|
+
/** Final resolved URL (after redirects). */
|
|
6
|
+
url: string;
|
|
7
|
+
/** Present only when at least one redirect occurred (ordered hops, including the final response). */
|
|
8
|
+
redirectChain?: Array<{
|
|
9
|
+
status: number;
|
|
10
|
+
headers: Record<string, string>;
|
|
11
|
+
url: string;
|
|
12
|
+
body: {
|
|
13
|
+
type: "text";
|
|
14
|
+
content: string;
|
|
15
|
+
} | {
|
|
16
|
+
type: "json";
|
|
17
|
+
content: Record<string, unknown>;
|
|
18
|
+
};
|
|
19
|
+
timings: {
|
|
20
|
+
dns: number;
|
|
21
|
+
tcp: number;
|
|
22
|
+
tls: number;
|
|
23
|
+
request: number;
|
|
24
|
+
redirect: number;
|
|
25
|
+
firstByte: number;
|
|
26
|
+
startTransfer: number;
|
|
27
|
+
total: number;
|
|
28
|
+
};
|
|
29
|
+
}>;
|
|
30
|
+
timings: {
|
|
31
|
+
dns: number;
|
|
32
|
+
tcp: number;
|
|
33
|
+
tls: number;
|
|
34
|
+
request: number;
|
|
35
|
+
redirect: number;
|
|
36
|
+
/** Time from request sent to first byte (server TTFB). */
|
|
37
|
+
firstByte: number;
|
|
38
|
+
/** Time from start to first byte; matches curl time_starttransfer. */
|
|
39
|
+
startTransfer: number;
|
|
40
|
+
total: number;
|
|
41
|
+
};
|
|
42
|
+
body: {
|
|
43
|
+
type: "text";
|
|
44
|
+
content: string;
|
|
45
|
+
} | {
|
|
46
|
+
type: "json";
|
|
47
|
+
content: Record<string, unknown>;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export type KulalaRequestErrorResponse = {
|
|
51
|
+
success: false;
|
|
52
|
+
error: string;
|
|
53
|
+
};
|
|
54
|
+
export type KulalaPromptResponse = {
|
|
55
|
+
success: false;
|
|
56
|
+
prompt: true;
|
|
57
|
+
promptId: string;
|
|
58
|
+
promptType: string;
|
|
59
|
+
message: string;
|
|
60
|
+
inputs: Array<{
|
|
61
|
+
id: string;
|
|
62
|
+
label: string;
|
|
63
|
+
type: "text" | "password" | "url";
|
|
64
|
+
required?: boolean;
|
|
65
|
+
}>;
|
|
66
|
+
};
|
|
67
|
+
export type KulalaResponseWrapper = {
|
|
68
|
+
type: "responses";
|
|
69
|
+
data: Array<KulalaRequestSuccessResponse | KulalaRequestErrorResponse | KulalaPromptResponse>;
|
|
70
|
+
} | {
|
|
71
|
+
type: "error";
|
|
72
|
+
data: Array<KulalaRequestErrorResponse>;
|
|
73
|
+
};
|
|
74
|
+
export type RequestHeaderType = "json" | "form-data" | "form-urlencoded" | "invalid";
|
|
75
|
+
export type VariableResolver = (name: string) => string | undefined;
|
|
76
|
+
export type KulalaRunOptions = {
|
|
77
|
+
/** Raw document content (for stable ID when filepath is absent). */
|
|
78
|
+
content?: string;
|
|
79
|
+
/** Environment name for variable resolution (kuba, etc.). Defaults to "default". */
|
|
80
|
+
env?: string;
|
|
81
|
+
};
|
|
82
|
+
/** Response-like value passed to scripts (fetch Response or compatible). */
|
|
83
|
+
export type RunnerResponseLike = {
|
|
84
|
+
body: unknown;
|
|
85
|
+
statusCode: number;
|
|
86
|
+
headers: Record<string, string>;
|
|
87
|
+
timings: {
|
|
88
|
+
phases: Record<string, number>;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/runner/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,4BAA4B,GAAG;IACzC,OAAO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,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC;CAC7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vendored-curl.generated.d.ts","sourceRoot":"","sources":["../../../src/lib/runner/vendored-curl.generated.ts"],"names":[],"mappings":"AAOA,wBAAsB,eAAe,IAAI,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAG3F"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collect directory paths from startDir upward to root.
|
|
3
|
+
*/
|
|
4
|
+
export declare function dirsUpward(startDir: string): string[];
|
|
5
|
+
/**
|
|
6
|
+
* Load raw JSON section from http-client.env.json or http-client.private.env.json.
|
|
7
|
+
* Returns the raw object (not flattened) for the given env key.
|
|
8
|
+
*/
|
|
9
|
+
export declare function loadHttpClientEnvJsonRaw(filePath: string, env: string): Record<string, unknown> | null;
|
|
10
|
+
/**
|
|
11
|
+
* Load environment variables from system, http-client.env.json, and .env.
|
|
12
|
+
* Order (later overrides earlier): system env → http-client.env.json (merged from dirs upward, closest wins) → http-client.private.env.json → .env.
|
|
13
|
+
* Also exposes system env as {{$env.VAR_NAME}} per JetBrains HTTP Client spec.
|
|
14
|
+
* See https://www.jetbrains.com/help/idea/http-client-variables.html
|
|
15
|
+
*/
|
|
16
|
+
export declare function loadEnvVars(env: string, startDir: string): Record<string, string>;
|
|
17
|
+
//# sourceMappingURL=env-files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-files.d.ts","sourceRoot":"","sources":["../../../src/lib/variables/env-files.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAUrD;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,GACV,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAWhC;AA2CD;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,GACf,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA4CxB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flatten nested JSON into dotted path keys (JetBrains-style JSONPath in variables).
|
|
3
|
+
* - client.host.url from { client: { host: { url: "example.org" } } }
|
|
4
|
+
* - client.['host.url'] for keys that contain a dot: { client: { "host.url": "example.org" } }
|
|
5
|
+
*/
|
|
6
|
+
export declare function flattenToDotPaths(obj: unknown, prefix: string, out: Record<string, string>): void;
|
|
7
|
+
//# sourceMappingURL=flatten-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flatten-json.d.ts","sourceRoot":"","sources":["../../../src/lib/variables/flatten-json.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC1B,IAAI,CAwBN"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Variable resolution and substitution for HTTP requests.
|
|
3
|
+
* - Stable document ID (filepath or content hash) so variables don't leak between documents.
|
|
4
|
+
* - Kuba: traverse up for kuba.yaml, run `kuba show --env <env> --output json`.
|
|
5
|
+
* - Env files: system env, http-client.env.json, http-client.private.env.json, .env (by env name).
|
|
6
|
+
* - Persistence: global, document-scoped, and request-scoped variables from SQLite.
|
|
7
|
+
* - System env as {{$env.VAR}}: JetBrains-style (https://www.jetbrains.com/help/idea/http-client-variables.html).
|
|
8
|
+
* - Dynamic variables: $uuid, $random.uuid, $timestamp, $isoTimestamp, $date, $randomInt (0..1000).
|
|
9
|
+
* - Request variables: {{REQUEST_NAME.response.body.$.field}}, {{REQUEST_NAME.response.headers.Name}}.
|
|
10
|
+
* - JSONPath-style in env/kuba: nested JSON flattened to dotted paths (client.host.url, client.['host.url']).
|
|
11
|
+
* - Substitution: {{variableName}} or compound paths; optional spaces {{ var }} in URL, headers, body.
|
|
12
|
+
* - In-file @ variables: @name=value before the first ### or in a block preamble (JetBrains).
|
|
13
|
+
*/
|
|
14
|
+
export { getStableDocumentId } from "./stable-id";
|
|
15
|
+
export { findKubaYamlDir, getKubaEnv, isKubaInPath } from "./kuba";
|
|
16
|
+
export { loadEnvVars } from "./env-files";
|
|
17
|
+
export { getMagicVariables } from "./magic";
|
|
18
|
+
export { resolveVariables, type HttpFileVariableSources } from "./resolve";
|
|
19
|
+
export { substituteInString, substituteInStringAsync, substituteInObject, substituteInObjectAsync, } from "./substitute";
|
|
20
|
+
export { resolveRequestVariable, isRequestVariableKey, type PreviousResponse, } from "./request-vars";
|
|
21
|
+
export { OAuth2Manager } from "../auth/oauth2/manager";
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/variables/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,KAAK,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAC3E,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,KAAK,gBAAgB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Traverse upward from startDir to find a directory containing kuba.yaml.
|
|
3
|
+
*/
|
|
4
|
+
export declare function findKubaYamlDir(startDir: string): string | null;
|
|
5
|
+
/**
|
|
6
|
+
* Check if `kuba` is available in PATH
|
|
7
|
+
*/
|
|
8
|
+
export declare function isKubaInPath(): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Run `kuba show --env <env> --output json` in dir and return parsed env vars.
|
|
11
|
+
* Returns null if kuba.yaml not in dir, kuba not in PATH, or command fails.
|
|
12
|
+
* If kuba.yaml exists but kuba is not in PATH, writes a message to stderr.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getKubaEnv(env: string, dir: string): Promise<Record<string, string> | null>;
|
|
15
|
+
//# sourceMappingURL=kuba.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kuba.d.ts","sourceRoot":"","sources":["../../../src/lib/variables/kuba.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAW/D;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAEtC;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAC9B,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,CAoCxC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dynamic variables per JetBrains HTTP Client spec.
|
|
3
|
+
* https://www.jetbrains.com/help/idea/http-client-variables.html#dynamic-variables
|
|
4
|
+
* Generated fresh per request. Optional spaces around braces kept: {{ $uuid }}.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getMagicVariables(): Record<string, string>;
|
|
7
|
+
//# sourceMappingURL=magic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"magic.d.ts","sourceRoot":"","sources":["../../../src/lib/variables/magic.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAW1D"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request variable resolution: {{REQUEST_NAME.response.body.$.path}} and {{REQUEST_NAME.response.headers.HeaderName}}.
|
|
3
|
+
* See https://neovim.getkulala.net/docs/usage/request-variables
|
|
4
|
+
*/
|
|
5
|
+
export type PreviousResponse = {
|
|
6
|
+
body: {
|
|
7
|
+
type: "text";
|
|
8
|
+
content: string;
|
|
9
|
+
} | {
|
|
10
|
+
type: "json";
|
|
11
|
+
content: Record<string, unknown>;
|
|
12
|
+
};
|
|
13
|
+
headers: Record<string, string>;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Resolve a request variable key against previous run results.
|
|
17
|
+
* Key forms: REQUEST_NAME.response.body.$.path (JSON fields on the parsed body), REQUEST_NAME.response.headers.HeaderName, REQUEST_NAME.response.headers['Header Name'].
|
|
18
|
+
* Returns string value or undefined if not found / not a request var.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveRequestVariable(key: string, previousResults: Map<string, PreviousResponse>): string | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Check if a variable key looks like a request variable reference.
|
|
23
|
+
*/
|
|
24
|
+
export declare function isRequestVariableKey(key: string): boolean;
|
|
25
|
+
//# sourceMappingURL=request-vars.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-vars.d.ts","sourceRoot":"","sources":["../../../src/lib/variables/request-vars.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EACA;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GACjC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;IACvD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC,CAAC;AAgBF;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,MAAM,EACX,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,GAC7C,MAAM,GAAG,SAAS,CAqCpB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAGzD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type HttpFileVariableSources = {
|
|
2
|
+
/** @name=value lines before the first ### in the .http file (or imported file). */
|
|
3
|
+
fileHeader?: Record<string, string>;
|
|
4
|
+
/** @name=value lines in the current block preamble before the request line. */
|
|
5
|
+
blockPreamble?: Record<string, string>;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Resolve all variables for a request.
|
|
9
|
+
* Order (later overrides earlier): kuba → @-lines from .http (file header + block preamble) →
|
|
10
|
+
* system/env files (http-client.env.json, .env) → persistence (global → document → request) →
|
|
11
|
+
* magic variables ($uuid, $timestamp, etc.).
|
|
12
|
+
* See https://neovim.getkulala.net/docs/usage/magic-variables and
|
|
13
|
+
* https://neovim.getkulala.net/docs/usage/dotenv-and-http-client.env.json-support
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveVariables(env: string, stableDocId: string, blockName: string, startDir: string, httpFileVars?: HttpFileVariableSources): Promise<Record<string, string>>;
|
|
16
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/lib/variables/resolve.ts"],"names":[],"mappings":"AAgBA,MAAM,MAAM,uBAAuB,GAAG;IACpC,mFAAmF;IACnF,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,+EAA+E;IAC/E,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,YAAY,CAAC,EAAE,uBAAuB,GACrC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAqDjC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build a stable document ID so variables from one HTTP document don't leak into another.
|
|
3
|
+
* When there is no physical file, we can't rely on filepath; use a hash of the content instead.
|
|
4
|
+
*/
|
|
5
|
+
export declare function getStableDocumentId(filepath?: string, content?: string): string;
|
|
6
|
+
//# sourceMappingURL=stable-id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stable-id.d.ts","sourceRoot":"","sources":["../../../src/lib/variables/stable-id.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CASR"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replace {{variableName}} or {{ variableName }} in a string with values from vars.
|
|
3
|
+
* Supports simple names (e.g. API_KEY) and compound request vars (e.g. REQUEST_ONE.response.body.$.token).
|
|
4
|
+
* Optional whitespace around the variable name is allowed.
|
|
5
|
+
* Unknown variables are replaced with empty string.
|
|
6
|
+
* If resolver is provided, it is used for missing keys (e.g. request variables).
|
|
7
|
+
*
|
|
8
|
+
* Note: For $auth.token() and $auth.idToken() calls, use substituteInStringAsync instead.
|
|
9
|
+
*/
|
|
10
|
+
export declare function substituteInString(template: string, vars: Record<string, string>, resolver?: (name: string) => string | undefined): string;
|
|
11
|
+
/**
|
|
12
|
+
* Async version that handles $auth.token() and $auth.idToken() calls.
|
|
13
|
+
* Also supports all regular variable substitution.
|
|
14
|
+
*
|
|
15
|
+
* This function properly handles multiple occurrences of the same variable.
|
|
16
|
+
*/
|
|
17
|
+
export declare function substituteInStringAsync(template: string, vars: Record<string, string>, resolver?: (name: string) => string | undefined, authResolver?: (func: "token" | "idToken", authId: string) => Promise<string | undefined>): Promise<string>;
|
|
18
|
+
/**
|
|
19
|
+
* Recursively substitute {{var}} in any string values in obj (for request body).
|
|
20
|
+
*
|
|
21
|
+
* Note: For $auth.token() and $auth.idToken() calls, use substituteInObjectAsync instead.
|
|
22
|
+
*/
|
|
23
|
+
export declare function substituteInObject(obj: unknown, vars: Record<string, string>, resolver?: (name: string) => string | undefined): unknown;
|
|
24
|
+
/**
|
|
25
|
+
* Async version that handles $auth.token() and $auth.idToken() calls.
|
|
26
|
+
*/
|
|
27
|
+
export declare function substituteInObjectAsync(obj: unknown, vars: Record<string, string>, resolver?: (name: string) => string | undefined, authResolver?: (func: "token" | "idToken", authId: string) => Promise<string | undefined>): Promise<unknown>;
|
|
28
|
+
//# sourceMappingURL=substitute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"substitute.d.ts","sourceRoot":"","sources":["../../../src/lib/variables/substitute.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GAC9C,MAAM,CAmBR;AAED;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,EAC/C,YAAY,CAAC,EAAE,CACb,IAAI,EAAE,OAAO,GAAG,SAAS,EACzB,MAAM,EAAE,MAAM,KACX,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,GAC/B,OAAO,CAAC,MAAM,CAAC,CA6CjB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GAC9C,OAAO,CAeT;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,EAC/C,YAAY,CAAC,EAAE,CACb,IAAI,EAAE,OAAO,GAAG,SAAS,EACzB,MAAM,EAAE,MAAM,KACX,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,GAC/B,OAAO,CAAC,OAAO,CAAC,CAmBlB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mistweaverco/kulala-core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"private": false,
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/mistweaverco/kulala-core.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/mistweaverco/kulala-core#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/mistweaverco/kulala-core/issues"
|
|
14
|
+
},
|
|
15
|
+
"engines": {
|
|
16
|
+
"bun": ">=1.0.0"
|
|
17
|
+
},
|
|
18
|
+
"main": "./dist/index.js",
|
|
19
|
+
"module": "./dist/index.js",
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"default": "./dist/index.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"format": "prettier --write .",
|
|
32
|
+
"lint": "prettier --check . && eslint .",
|
|
33
|
+
"test": "bun test",
|
|
34
|
+
"build": "bun run build:js && bun run build:types",
|
|
35
|
+
"build:js": "bun build src/index.ts --outdir dist --format esm --target bun --sourcemap",
|
|
36
|
+
"build:types": "tsc -p tsconfig.build.json",
|
|
37
|
+
"prepack": "cp ./../../README.md . && cp ./../../LICENSE . && bun run build"
|
|
38
|
+
},
|
|
39
|
+
"pkg": {
|
|
40
|
+
"assets": [
|
|
41
|
+
"../../vendor/curl/**/*"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
}
|
|
47
|
+
}
|