@malloydata/malloyyo 0.2.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/README.md +83 -0
- package/dist/index.js +1895 -0
- package/package.json +47 -0
package/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# malloyyo
|
|
2
|
+
|
|
3
|
+
CLI to publish Malloy models to a [Malloyyo](https://github.com/malloydata) instance.
|
|
4
|
+
|
|
5
|
+
It bundles up the `.malloy` files in a directory plus `malloy-config.json`, records the git
|
|
6
|
+
commit they came from, and pushes them to a Malloyyo deployment. The server compiles and
|
|
7
|
+
introspects the model — the CLI needs no database connection.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
The package is published as `@malloydata/malloyyo`; the command it installs is `malloyyo`.
|
|
12
|
+
Needs Node ≥ 20.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm i -g @malloydata/malloyyo # then: malloyyo --help
|
|
16
|
+
# …or run without installing:
|
|
17
|
+
npx @malloydata/malloyyo --help
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### From source
|
|
21
|
+
|
|
22
|
+
It lives in the `malloyyo` monorepo as `packages/cli`.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# from the repo root
|
|
26
|
+
pnpm install
|
|
27
|
+
pnpm --filter @malloydata/malloyyo build # → packages/cli/dist/index.js
|
|
28
|
+
|
|
29
|
+
# put `malloyyo` on your PATH (symlink to the built CLI)
|
|
30
|
+
cd packages/cli && npm link # then: malloyyo --help
|
|
31
|
+
|
|
32
|
+
# …or just run it directly, no link
|
|
33
|
+
node packages/cli/dist/index.js --help
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Configure
|
|
37
|
+
|
|
38
|
+
Add a `malloyyo` block to your `malloy-config.json` (or a standalone `malloyyo.json`). One
|
|
39
|
+
entry per deployment. **Only the env-var name is committed — never the token value.**
|
|
40
|
+
|
|
41
|
+
```jsonc
|
|
42
|
+
{
|
|
43
|
+
"connections": { /* … */ },
|
|
44
|
+
"malloyyo": {
|
|
45
|
+
"main": { "url": "https://malloyyo.example.com", "dataset": "mdw",
|
|
46
|
+
"malloyyo_token": { "env": "malloyyo_main_token" } },
|
|
47
|
+
"staging": { "url": "https://malloyyo-staging.example.com", "dataset": "mdw_staging",
|
|
48
|
+
"malloyyo_token": { "env": "malloyyo_staging_token" } }
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Sign in
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
malloyyo login main # a named target from the config
|
|
57
|
+
malloyyo login https://malloyyo.example.com # a raw URL (no config needed)
|
|
58
|
+
malloyyo login # omit it if the config has one target
|
|
59
|
+
malloyyo logout main
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Login is **per-instance** (it authenticates you to a URL, for all datasets on it), so the
|
|
63
|
+
argument is a *target or URL*, not a dataset — and it's optional when the config is
|
|
64
|
+
unambiguous. It uses the instance's OAuth flow (Authorization Code + PKCE, loopback redirect)
|
|
65
|
+
and stores a refreshable token in `~/.config/malloyyo/credentials.json` (mode 0600), keyed by
|
|
66
|
+
instance URL — so you can be logged in to several instances at once. Tokens auto-refresh.
|
|
67
|
+
|
|
68
|
+
## Use
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
malloyyo publish main # push the model in . to the "main" target
|
|
72
|
+
malloyyo publish staging ./model
|
|
73
|
+
malloyyo publish main --dry-run # show what would be sent
|
|
74
|
+
malloyyo status main # what's live: version, commit, compile state
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
`publish` exits non-zero on a server-side compile failure, so it's safe to gate CI on.
|
|
78
|
+
|
|
79
|
+
**Token precedence:** `--token` flag → the `malloyyo_token` env var from config (for CI) →
|
|
80
|
+
your `malloyyo login` session. So interactively you just `login` once; in CI you set the env
|
|
81
|
+
var and never touch the browser.
|
|
82
|
+
|
|
83
|
+
See `docs/model-publishing-design.md` in the repo for the full design.
|