jitsu-cli 2.14.0-beta.10 → 2.14.0-beta.101
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/bin/jitsu +3 -0
- package/build.mts +39 -0
- package/compiled/package.json +16 -22
- package/compiled/src/commands/build.js +16 -24
- package/compiled/src/commands/config/handlers.js +292 -0
- package/compiled/src/commands/config/index.js +148 -0
- package/compiled/src/commands/config/resources.js +88 -0
- package/compiled/src/commands/default-workspace.js +39 -0
- package/compiled/src/commands/deploy.js +55 -19
- package/compiled/src/commands/spec.js +31 -0
- package/compiled/src/index.js +21 -2
- package/compiled/src/lib/api-client.js +52 -0
- package/compiled/src/lib/auth-file.js +67 -0
- package/compiled/src/lib/body-builder.js +53 -0
- package/compiled/src/lib/body-fields.js +47 -0
- package/compiled/src/lib/compiled-function.js +23 -21
- package/compiled/src/lib/dotted.js +34 -0
- package/compiled/src/lib/renderer.js +33 -0
- package/compiled/src/lib/spec.js +11 -0
- package/dist/main.js +46422 -92895
- package/dist/main.js.map +7 -1
- package/package.json +37 -43
- package/src/commands/build.ts +21 -26
- package/src/commands/config/handlers.ts +339 -0
- package/src/commands/config/index.ts +171 -0
- package/src/commands/config/resources.ts +110 -0
- package/src/commands/default-workspace.ts +44 -0
- package/src/commands/deploy.ts +96 -20
- package/src/commands/spec.ts +32 -0
- package/src/index.ts +34 -17
- package/src/lib/api-client.ts +64 -0
- package/src/lib/auth-file.ts +83 -0
- package/src/lib/body-builder.ts +68 -0
- package/src/lib/body-fields.ts +61 -0
- package/src/lib/compiled-function.ts +30 -23
- package/src/lib/dotted.ts +43 -0
- package/src/lib/renderer.ts +44 -0
- package/src/lib/spec.ts +32 -0
- package/dist/140.js +0 -452
- package/dist/140.js.map +0 -1
- package/webpack.config.cjs +0 -53
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import yaml from "js-yaml";
|
|
2
|
+
const renderers = {
|
|
3
|
+
yaml: {
|
|
4
|
+
format: "yaml",
|
|
5
|
+
render(value) {
|
|
6
|
+
if (value === undefined)
|
|
7
|
+
return "";
|
|
8
|
+
return yaml.dump(value, { skipInvalid: true, noRefs: true, sortKeys: false, lineWidth: 120 });
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
json: {
|
|
12
|
+
format: "json",
|
|
13
|
+
render(value) {
|
|
14
|
+
return JSON.stringify(value, null, 2) + "\n";
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export const SUPPORTED_OUTPUTS = Object.keys(renderers);
|
|
19
|
+
export const DEFAULT_OUTPUT = "yaml";
|
|
20
|
+
export function getRenderer(format) {
|
|
21
|
+
const key = (format ?? DEFAULT_OUTPUT).toLowerCase();
|
|
22
|
+
const r = renderers[key];
|
|
23
|
+
if (!r) {
|
|
24
|
+
throw new Error(`Unsupported output format '${format}'. Supported: ${SUPPORTED_OUTPUTS.join(", ")}`);
|
|
25
|
+
}
|
|
26
|
+
return r;
|
|
27
|
+
}
|
|
28
|
+
export function registerRenderer(r) {
|
|
29
|
+
renderers[r.format.toLowerCase()] = r;
|
|
30
|
+
}
|
|
31
|
+
export function print(value, format) {
|
|
32
|
+
process.stdout.write(getRenderer(format).render(value));
|
|
33
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ApiClient } from "./api-client";
|
|
2
|
+
export async function fetchSpec(auth) {
|
|
3
|
+
const client = new ApiClient(auth);
|
|
4
|
+
return client.request({ method: "GET", path: "/api/spec" });
|
|
5
|
+
}
|
|
6
|
+
export function findOperation(spec, path, method) {
|
|
7
|
+
const item = spec.paths?.[path];
|
|
8
|
+
if (!item)
|
|
9
|
+
return undefined;
|
|
10
|
+
return item[method.toLowerCase()];
|
|
11
|
+
}
|