airfoil 0.1.1 → 0.3.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/dist/index.js +72253 -73199
- package/package.json +6 -7
- package/src/commands/cluster/data-lake/create-iceberg.ts +7 -7
- package/src/commands/cluster/data-lake/create-parquet.ts +7 -7
- package/src/commands/cluster/data-lake/create.ts +1 -1
- package/src/commands/cluster/data-lake/delete.ts +5 -5
- package/src/commands/cluster/data-lake/get.ts +5 -5
- package/src/commands/cluster/data-lake/list.ts +5 -5
- package/src/commands/cluster/index.ts +1 -1
- package/src/commands/cluster/namespace/create.ts +17 -17
- package/src/commands/cluster/namespace/delete.ts +5 -5
- package/src/commands/cluster/namespace/get.ts +5 -5
- package/src/commands/cluster/namespace/list.ts +5 -5
- package/src/commands/cluster/object-store/create-aws.ts +19 -21
- package/src/commands/cluster/object-store/create-azure.ts +16 -16
- package/src/commands/cluster/object-store/create-google.ts +16 -16
- package/src/commands/cluster/object-store/create-s3.ts +22 -21
- package/src/commands/cluster/object-store/create.ts +1 -1
- package/src/commands/cluster/object-store/delete.ts +5 -5
- package/src/commands/cluster/object-store/get.ts +5 -5
- package/src/commands/cluster/object-store/list.ts +5 -5
- package/src/commands/cluster/tenant/create.ts +5 -7
- package/src/commands/cluster/tenant/delete.ts +5 -5
- package/src/commands/cluster/tenant/get.ts +5 -5
- package/src/commands/cluster/tenant/list.ts +3 -3
- package/src/commands/cluster/topic/create.ts +69 -58
- package/src/commands/cluster/topic/delete.ts +8 -8
- package/src/commands/cluster/topic/get.ts +5 -5
- package/src/commands/cluster/topic/list.ts +10 -16
- package/src/commands/dev.ts +23 -23
- package/src/commands/sql.ts +17 -17
- package/src/index.ts +7 -5
- package/src/utils/client.ts +1 -1
- package/src/utils/options.ts +18 -17
package/src/commands/sql.ts
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
|
-
import { ArrowFlightSqlClient } from "@airfoil/flight";
|
|
3
2
|
import * as p from "@clack/prompts";
|
|
4
|
-
import {
|
|
3
|
+
import { ArrowFlightSqlClient } from "@useairfoil/flight";
|
|
5
4
|
import { printTable } from "console-table-printer";
|
|
6
5
|
import { Effect, Option } from "effect";
|
|
6
|
+
import { Argument, Command, Flag } from "effect/unstable/cli";
|
|
7
7
|
import { Metadata } from "nice-grpc-common";
|
|
8
8
|
import { handleCliError } from "../utils/effect.js";
|
|
9
9
|
import { hostOption, portOption } from "../utils/options.js";
|
|
10
10
|
|
|
11
|
-
const queryArg =
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const queryArg = Argument.string("query").pipe(
|
|
12
|
+
Argument.withDescription("SQL query to execute"),
|
|
13
|
+
Argument.optional,
|
|
14
14
|
);
|
|
15
15
|
|
|
16
|
-
const fileOption =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
const fileOption = Flag.string("file").pipe(
|
|
17
|
+
Flag.withAlias("f"),
|
|
18
|
+
Flag.withDescription("Execute SQL from file"),
|
|
19
|
+
Flag.optional,
|
|
20
20
|
);
|
|
21
21
|
|
|
22
|
-
const namespaceOption =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
const namespaceOption = Flag.string("namespace").pipe(
|
|
23
|
+
Flag.withAlias("n"),
|
|
24
|
+
Flag.withDescription("Wings namespace"),
|
|
25
|
+
Flag.withDefault("tenants/default/namespaces/default"),
|
|
26
26
|
);
|
|
27
27
|
|
|
28
|
-
const jsonOption =
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
const jsonOption = Flag.boolean("json").pipe(
|
|
29
|
+
Flag.withDescription("Output results as JSON"),
|
|
30
|
+
Flag.withDefault(false),
|
|
31
31
|
);
|
|
32
32
|
|
|
33
33
|
export const sqlCommand = Command.make(
|
|
@@ -117,5 +117,5 @@ export const sqlCommand = Command.make(
|
|
|
117
117
|
}
|
|
118
118
|
p.outro("✓ Done");
|
|
119
119
|
});
|
|
120
|
-
}).pipe(Effect.
|
|
120
|
+
}).pipe(Effect.catch(handleCliError("Command failed"))),
|
|
121
121
|
).pipe(Command.withDescription("Execute SQL queries using Arrow Flight SQL"));
|
package/src/index.ts
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import {
|
|
3
|
-
import { NodeContext, NodeRuntime } from "@effect/platform-node";
|
|
2
|
+
import { NodeRuntime, NodeServices } from "@effect/platform-node";
|
|
4
3
|
import { Effect } from "effect";
|
|
4
|
+
import { Command } from "effect/unstable/cli";
|
|
5
|
+
import packageJson from "../package.json";
|
|
5
6
|
import { clusterCommand } from "./commands/cluster/index.js";
|
|
6
7
|
import { devCommand } from "./commands/dev.js";
|
|
7
8
|
import { sqlCommand } from "./commands/sql.js";
|
|
8
9
|
|
|
10
|
+
const version = packageJson.version;
|
|
11
|
+
|
|
9
12
|
const program = Command.make("airfoil", {}, () => Effect.void).pipe(
|
|
10
13
|
Command.withSubcommands([devCommand, sqlCommand, clusterCommand]),
|
|
11
14
|
);
|
|
12
15
|
|
|
13
16
|
const cli = Command.run(program, {
|
|
14
|
-
|
|
15
|
-
version: "0.1.0",
|
|
17
|
+
version,
|
|
16
18
|
});
|
|
17
19
|
|
|
18
|
-
cli
|
|
20
|
+
cli.pipe(Effect.provide(NodeServices.layer), NodeRuntime.runMain);
|
package/src/utils/client.ts
CHANGED
package/src/utils/options.ts
CHANGED
|
@@ -1,36 +1,37 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Flag } from "effect/unstable/cli";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Common server connection options
|
|
5
5
|
*/
|
|
6
|
-
export const hostOption =
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
export const hostOption = Flag.string("host").pipe(
|
|
7
|
+
Flag.withDescription("Server host"),
|
|
8
|
+
Flag.withDefault("localhost"),
|
|
9
9
|
);
|
|
10
10
|
|
|
11
|
-
export const portOption =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
export const portOption = Flag.integer("port").pipe(
|
|
12
|
+
Flag.withDescription("Server port"),
|
|
13
|
+
Flag.withAlias("p"),
|
|
14
|
+
Flag.withDefault(7777),
|
|
15
15
|
);
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Common pagination options
|
|
19
19
|
*/
|
|
20
|
-
export const pageSizeOption =
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
export const pageSizeOption = Flag.integer("page-size").pipe(
|
|
21
|
+
Flag.withDescription("Number of items to return (max: 1000)"),
|
|
22
|
+
Flag.withDefault(100),
|
|
23
23
|
);
|
|
24
24
|
|
|
25
|
-
export const pageTokenOption =
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
export const pageTokenOption = Flag.optional(
|
|
26
|
+
Flag.string("page-token").pipe(
|
|
27
|
+
Flag.withDescription("Continuation token for pagination"),
|
|
28
|
+
),
|
|
28
29
|
);
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
* Force flag for destructive operations
|
|
32
33
|
*/
|
|
33
|
-
export const forceOption =
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
export const forceOption = Flag.boolean("force").pipe(
|
|
35
|
+
Flag.withDescription("Skip confirmation prompt"),
|
|
36
|
+
Flag.withDefault(false),
|
|
36
37
|
);
|