revisium 2.0.1 → 2.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/.github/workflows/ci.yml +32 -0
- package/README.md +23 -3
- package/dist/e2e/setup/global-setup.js +2 -3
- package/dist/e2e/setup/global-setup.js.map +1 -1
- package/dist/e2e/setup/global-teardown.js +0 -2
- package/dist/e2e/setup/global-teardown.js.map +1 -1
- package/dist/e2e/utils/constants.d.ts +0 -2
- package/dist/e2e/utils/constants.js +0 -2
- package/dist/e2e/utils/constants.js.map +1 -1
- package/dist/e2e/utils/docker-helper.d.ts +0 -2
- package/dist/e2e/utils/docker-helper.js +0 -13
- package/dist/e2e/utils/docker-helper.js.map +1 -1
- package/dist/package.json +27 -14
- package/dist/src/commands/migration/apply-migrations.command.d.ts +1 -1
- package/dist/src/commands/migration/apply-migrations.command.js +4 -5
- package/dist/src/commands/migration/apply-migrations.command.js.map +1 -1
- package/dist/src/commands/migration/save-migrations.command.d.ts +1 -1
- package/dist/src/commands/migration/save-migrations.command.js +6 -6
- package/dist/src/commands/migration/save-migrations.command.js.map +1 -1
- package/dist/src/commands/rows/save-rows.command.d.ts +1 -1
- package/dist/src/commands/rows/save-rows.command.js +12 -10
- package/dist/src/commands/rows/save-rows.command.js.map +1 -1
- package/dist/src/commands/rows/upload-rows.command.d.ts +1 -1
- package/dist/src/commands/rows/upload-rows.command.js +12 -15
- package/dist/src/commands/rows/upload-rows.command.js.map +1 -1
- package/dist/src/commands/schema/create-migrations.command.js.map +1 -1
- package/dist/src/commands/schema/save-schema.command.d.ts +1 -1
- package/dist/src/commands/schema/save-schema.command.js +7 -7
- package/dist/src/commands/schema/save-schema.command.js.map +1 -1
- package/dist/src/config/meta-schema.d.ts +3 -0
- package/dist/src/config/meta-schema.js +43 -1
- package/dist/src/config/meta-schema.js.map +1 -1
- package/dist/src/services/connection/api-client-adapter.d.ts +2 -4
- package/dist/src/services/connection/api-client-adapter.js +40 -36
- package/dist/src/services/connection/api-client-adapter.js.map +1 -1
- package/dist/src/services/connection/api-client.d.ts +3 -4
- package/dist/src/services/connection/api-client.js +11 -33
- package/dist/src/services/connection/api-client.js.map +1 -1
- package/dist/src/services/connection/connection-factory.service.d.ts +4 -6
- package/dist/src/services/connection/connection-factory.service.js +18 -39
- package/dist/src/services/connection/connection-factory.service.js.map +1 -1
- package/dist/src/services/connection/connection.service.d.ts +2 -73
- package/dist/src/services/connection/connection.service.js +2 -11
- package/dist/src/services/connection/connection.service.js.map +1 -1
- package/dist/src/services/sync/commit-revision.service.js +6 -28
- package/dist/src/services/sync/commit-revision.service.js.map +1 -1
- package/dist/src/services/sync/row-sync.service.d.ts +5 -5
- package/dist/src/services/sync/row-sync.service.js +10 -10
- package/dist/src/services/sync/row-sync.service.js.map +1 -1
- package/dist/src/services/sync/sync-data.service.d.ts +1 -0
- package/dist/src/services/sync/sync-data.service.js +21 -21
- package/dist/src/services/sync/sync-data.service.js.map +1 -1
- package/dist/src/services/sync/sync-schema.service.d.ts +1 -0
- package/dist/src/services/sync/sync-schema.service.js +11 -10
- package/dist/src/services/sync/sync-schema.service.js.map +1 -1
- package/dist/src/services/url/auth-prompt.service.js +1 -1
- package/dist/src/services/url/auth-prompt.service.js.map +1 -1
- package/dist/src/types/migration.types.d.ts +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/docs/authentication.md +3 -3
- package/docs/configuration.md +58 -9
- package/docs/docker-deployment.md +48 -13
- package/docs/migrate-commands.md +35 -10
- package/docs/rows-commands.md +30 -7
- package/docs/schema-commands.md +21 -5
- package/docs/sync-commands.md +44 -12
- package/docs/url-format.md +2 -2
- package/e2e/setup/global-setup.ts +3 -9
- package/e2e/setup/global-teardown.ts +0 -6
- package/e2e/utils/constants.ts +0 -2
- package/e2e/utils/docker-helper.ts +0 -23
- package/package.json +27 -14
- package/src/commands/migration/apply-migrations.command.ts +5 -6
- package/src/commands/migration/save-migrations.command.ts +7 -6
- package/src/commands/rows/save-rows.command.ts +14 -28
- package/src/commands/rows/upload-rows.command.ts +7 -15
- package/src/commands/schema/create-migrations.command.ts +1 -1
- package/src/commands/schema/save-schema.command.ts +9 -14
- package/src/config/meta-schema.ts +47 -0
- package/src/services/connection/__tests__/connection-factory.service.spec.ts +117 -0
- package/src/services/connection/__tests__/connection.service.spec.ts +27 -117
- package/src/services/connection/api-client-adapter.ts +41 -45
- package/src/services/connection/api-client.ts +11 -50
- package/src/services/connection/connection-factory.service.ts +35 -65
- package/src/services/connection/connection.service.ts +3 -14
- package/src/services/sync/__tests__/row-sync.service.spec.ts +3 -6
- package/src/services/sync/commit-revision.service.ts +7 -51
- package/src/services/sync/row-sync.service.ts +4 -18
- package/src/services/sync/sync-data.service.ts +32 -45
- package/src/services/sync/sync-schema.service.ts +14 -22
- package/src/services/url/auth-prompt.service.ts +1 -1
- package/src/types/migration.types.ts +2 -2
- package/dist/src/__generated__/api.d.ts +0 -688
- package/dist/src/__generated__/api.js +0 -698
- package/dist/src/__generated__/api.js.map +0 -1
- package/e2e/docker-compose.e2e.yml +0 -31
- package/src/__generated__/api.ts +0 -2598
package/docs/authentication.md
CHANGED
|
@@ -8,8 +8,8 @@ JWT token from Revisium UI. Best for interactive use.
|
|
|
8
8
|
|
|
9
9
|
### Get Your Token
|
|
10
10
|
|
|
11
|
-
- **Cloud:** <https://cloud.revisium.io/get-
|
|
12
|
-
- **Self-hosted:** `https://your-host/get-
|
|
11
|
+
- **Cloud:** <https://cloud.revisium.io/get-token>
|
|
12
|
+
- **Self-hosted:** `https://your-host/get-token`
|
|
13
13
|
|
|
14
14
|
### Usage
|
|
15
15
|
|
|
@@ -57,7 +57,7 @@ If no credentials are provided, you'll be prompted:
|
|
|
57
57
|
|
|
58
58
|
```text
|
|
59
59
|
Choose authentication method:
|
|
60
|
-
> Token (copy from https://cloud.revisium.io/get-
|
|
60
|
+
> Token (copy from https://cloud.revisium.io/get-token)
|
|
61
61
|
API Key (for automated access)
|
|
62
62
|
Username & Password
|
|
63
63
|
|
package/docs/configuration.md
CHANGED
|
@@ -2,16 +2,50 @@
|
|
|
2
2
|
|
|
3
3
|
## Environment Variables
|
|
4
4
|
|
|
5
|
-
All commands support configuration via environment variables
|
|
5
|
+
All commands support configuration via environment variables.
|
|
6
|
+
|
|
7
|
+
### Single-Endpoint Commands (schema, migrate, rows)
|
|
6
8
|
|
|
7
9
|
| Variable | Description | Example |
|
|
8
10
|
|----------|-------------|---------|
|
|
9
|
-
| `REVISIUM_URL` | Revisium URL
|
|
10
|
-
| `REVISIUM_TOKEN` | JWT authentication token |
|
|
11
|
-
| `
|
|
12
|
-
| `
|
|
11
|
+
| `REVISIUM_URL` | Revisium URL (see [URL Format](./url-format.md)) | `revisium://cloud.revisium.io/org/proj/main` |
|
|
12
|
+
| `REVISIUM_TOKEN` | JWT authentication token | `eyJhbGciOiJIUzI1NiIs...` |
|
|
13
|
+
| `REVISIUM_API_KEY` | API key (for automated access) | `ak_xxxxxxxxxxxxx` |
|
|
14
|
+
| `REVISIUM_USERNAME` | Username (for password auth) | `admin` |
|
|
15
|
+
| `REVISIUM_PASSWORD` | Password (for password auth) | `secret` |
|
|
16
|
+
|
|
17
|
+
### Sync Commands (source/target)
|
|
18
|
+
|
|
19
|
+
| Variable | Description |
|
|
20
|
+
|----------|-------------|
|
|
21
|
+
| `REVISIUM_SOURCE_URL` | Source project URL |
|
|
22
|
+
| `REVISIUM_SOURCE_TOKEN` | Source JWT token |
|
|
23
|
+
| `REVISIUM_SOURCE_API_KEY` | Source API key |
|
|
24
|
+
| `REVISIUM_SOURCE_USERNAME` | Source username |
|
|
25
|
+
| `REVISIUM_SOURCE_PASSWORD` | Source password |
|
|
26
|
+
| `REVISIUM_TARGET_URL` | Target project URL |
|
|
27
|
+
| `REVISIUM_TARGET_TOKEN` | Target JWT token |
|
|
28
|
+
| `REVISIUM_TARGET_API_KEY` | Target API key |
|
|
29
|
+
| `REVISIUM_TARGET_USERNAME` | Target username |
|
|
30
|
+
| `REVISIUM_TARGET_PASSWORD` | Target password |
|
|
31
|
+
|
|
32
|
+
### Authentication Priority
|
|
33
|
+
|
|
34
|
+
When using `--url`, authentication is resolved in this order:
|
|
35
|
+
|
|
36
|
+
1. **URL query parameter** - `?token=...` or `?apikey=...`
|
|
37
|
+
2. **URL credentials** - `user:pass@host`
|
|
38
|
+
3. **Environment variable** - `REVISIUM_TOKEN` > `REVISIUM_API_KEY` > `REVISIUM_USERNAME/PASSWORD`
|
|
39
|
+
4. **Interactive prompt** - if running in terminal
|
|
40
|
+
|
|
41
|
+
**Important:** You can use `--url` to specify host/org/project/branch and provide credentials via environment:
|
|
13
42
|
|
|
14
|
-
|
|
43
|
+
```bash
|
|
44
|
+
# URL specifies target, credentials from environment
|
|
45
|
+
export REVISIUM_TOKEN=$MY_TOKEN
|
|
46
|
+
revisium migrate apply --file ./migrations.json \
|
|
47
|
+
--url revisium://cloud.revisium.io/myorg/myproject/master
|
|
48
|
+
```
|
|
15
49
|
|
|
16
50
|
## .env File
|
|
17
51
|
|
|
@@ -47,8 +81,18 @@ revisium migrate apply --file ./migrations.json
|
|
|
47
81
|
Override environment variables with CLI options:
|
|
48
82
|
|
|
49
83
|
```bash
|
|
84
|
+
# Full URL with token in query parameter
|
|
85
|
+
revisium schema save --folder ./schemas \
|
|
86
|
+
--url revisium://cloud.revisium.io/my-org/my-project/develop?token=$TOKEN
|
|
87
|
+
|
|
88
|
+
# URL without credentials (uses REVISIUM_TOKEN from environment)
|
|
89
|
+
export REVISIUM_TOKEN=$MY_TOKEN
|
|
90
|
+
revisium schema save --folder ./schemas \
|
|
91
|
+
--url revisium://cloud.revisium.io/my-org/my-project/develop
|
|
92
|
+
|
|
93
|
+
# URL with credentials in URL
|
|
50
94
|
revisium schema save --folder ./schemas \
|
|
51
|
-
--url revisium://
|
|
95
|
+
--url revisium://admin:secret@localhost:8080/my-org/my-project/develop
|
|
52
96
|
```
|
|
53
97
|
|
|
54
98
|
## Priority
|
|
@@ -67,9 +111,14 @@ Configuration is resolved in this order (highest to lowest):
|
|
|
67
111
|
# Development (uses .env defaults)
|
|
68
112
|
revisium rows upload --folder ./data
|
|
69
113
|
|
|
70
|
-
# Production
|
|
71
|
-
revisium rows upload --folder ./data \
|
|
114
|
+
# Production with token in URL
|
|
115
|
+
revisium rows upload --folder ./data --commit \
|
|
72
116
|
--url revisium://prod.example.com/prod-org/main-app/master?token=$PROD_TOKEN
|
|
117
|
+
|
|
118
|
+
# Production with token in environment (recommended for CI/CD)
|
|
119
|
+
export REVISIUM_TOKEN=$PROD_TOKEN
|
|
120
|
+
revisium rows upload --folder ./data --commit \
|
|
121
|
+
--url revisium://prod.example.com/prod-org/main-app/master
|
|
73
122
|
```
|
|
74
123
|
|
|
75
124
|
### Multiple Environments
|
|
@@ -9,7 +9,7 @@ The CLI is available as a Docker image for CI/CD pipelines and containerized env
|
|
|
9
9
|
docker pull revisium/revisium-cli
|
|
10
10
|
|
|
11
11
|
# Or specific version
|
|
12
|
-
docker pull revisium/revisium-cli:
|
|
12
|
+
docker pull revisium/revisium-cli:2.0.0
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Environment Variables
|
|
@@ -17,13 +17,14 @@ docker pull revisium/revisium-cli:1.1.1
|
|
|
17
17
|
| Variable | Description | Required |
|
|
18
18
|
|----------|-------------|----------|
|
|
19
19
|
| `REVISIUM_URL` | Revisium URL (see [URL Format](./url-format.md)) | Yes |
|
|
20
|
-
| `REVISIUM_TOKEN` | JWT authentication token | Yes* |
|
|
21
|
-
| `
|
|
22
|
-
| `
|
|
23
|
-
| `
|
|
24
|
-
| `DATA_DIR` | Path to data directory | No |
|
|
20
|
+
| `REVISIUM_TOKEN` | JWT authentication token (recommended) | Yes* |
|
|
21
|
+
| `REVISIUM_API_KEY` | API key (for automated access) | Yes* |
|
|
22
|
+
| `REVISIUM_USERNAME` | Username (for password auth) | Yes* |
|
|
23
|
+
| `REVISIUM_PASSWORD` | Password (for password auth) | Yes* |
|
|
25
24
|
|
|
26
|
-
*
|
|
25
|
+
*One authentication method is required: `REVISIUM_TOKEN`, `REVISIUM_API_KEY`, or `REVISIUM_USERNAME`/`REVISIUM_PASSWORD`.
|
|
26
|
+
|
|
27
|
+
**Note:** The `--url` parameter can specify host/org/project/branch while credentials come from environment variables. This is the recommended approach for CI/CD.
|
|
27
28
|
|
|
28
29
|
## CI/CD Workflow (Prisma-like)
|
|
29
30
|
|
|
@@ -97,7 +98,7 @@ Use migrations in Kubernetes with init container for schema deployment:
|
|
|
97
98
|
### Build Custom Image with Migrations
|
|
98
99
|
|
|
99
100
|
```dockerfile
|
|
100
|
-
FROM revisium/revisium-cli:
|
|
101
|
+
FROM revisium/revisium-cli:2.0.0
|
|
101
102
|
|
|
102
103
|
# Copy migrations
|
|
103
104
|
COPY revisium/migrations.json /app/migrations.json
|
|
@@ -150,7 +151,7 @@ For initial data seeding, include data files in your Docker image:
|
|
|
150
151
|
### Dockerfile with Data
|
|
151
152
|
|
|
152
153
|
```dockerfile
|
|
153
|
-
FROM revisium/revisium-cli:
|
|
154
|
+
FROM revisium/revisium-cli:2.0.0
|
|
154
155
|
|
|
155
156
|
# Copy migrations
|
|
156
157
|
COPY revisium/migrations.json /app/migrations.json
|
|
@@ -195,7 +196,34 @@ spec:
|
|
|
195
196
|
|
|
196
197
|
## GitHub Actions Examples
|
|
197
198
|
|
|
198
|
-
### Basic Migration Apply
|
|
199
|
+
### Basic Migration Apply (Token - Recommended)
|
|
200
|
+
|
|
201
|
+
```yaml
|
|
202
|
+
name: Deploy
|
|
203
|
+
|
|
204
|
+
on:
|
|
205
|
+
push:
|
|
206
|
+
branches: [main]
|
|
207
|
+
|
|
208
|
+
jobs:
|
|
209
|
+
deploy:
|
|
210
|
+
runs-on: ubuntu-latest
|
|
211
|
+
steps:
|
|
212
|
+
- uses: actions/checkout@v4
|
|
213
|
+
|
|
214
|
+
- name: Setup Node.js
|
|
215
|
+
uses: actions/setup-node@v4
|
|
216
|
+
with:
|
|
217
|
+
node-version: '20'
|
|
218
|
+
|
|
219
|
+
- name: Apply Revisium Migrations
|
|
220
|
+
run: npx revisium migrate apply --file ./revisium/migrations.json --commit
|
|
221
|
+
env:
|
|
222
|
+
REVISIUM_URL: revisium://cloud.revisium.io/${{ vars.ORG }}/${{ vars.PROJECT }}/main
|
|
223
|
+
REVISIUM_TOKEN: ${{ secrets.REVISIUM_TOKEN }}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Basic Migration Apply (Username/Password)
|
|
199
227
|
|
|
200
228
|
```yaml
|
|
201
229
|
name: Deploy
|
|
@@ -296,7 +324,15 @@ jobs:
|
|
|
296
324
|
Run CLI commands directly with Docker:
|
|
297
325
|
|
|
298
326
|
```bash
|
|
299
|
-
# Apply migrations
|
|
327
|
+
# Apply migrations (with token - recommended)
|
|
328
|
+
docker run --rm \
|
|
329
|
+
-e REVISIUM_URL=revisium://cloud.revisium.io/myorg/myproject/main \
|
|
330
|
+
-e REVISIUM_TOKEN=$REVISIUM_TOKEN \
|
|
331
|
+
-v ./revisium/migrations.json:/app/migrations.json \
|
|
332
|
+
revisium/revisium-cli \
|
|
333
|
+
revisium migrate apply --file /app/migrations.json --commit
|
|
334
|
+
|
|
335
|
+
# Apply migrations (with username/password)
|
|
300
336
|
docker run --rm \
|
|
301
337
|
-e REVISIUM_URL=revisium://cloud.revisium.io/myorg/myproject/main \
|
|
302
338
|
-e REVISIUM_USERNAME=admin \
|
|
@@ -308,8 +344,7 @@ docker run --rm \
|
|
|
308
344
|
# Upload data
|
|
309
345
|
docker run --rm \
|
|
310
346
|
-e REVISIUM_URL=revisium://cloud.revisium.io/myorg/myproject/main \
|
|
311
|
-
-e
|
|
312
|
-
-e REVISIUM_PASSWORD=secret \
|
|
347
|
+
-e REVISIUM_TOKEN=$REVISIUM_TOKEN \
|
|
313
348
|
-v ./data:/app/data \
|
|
314
349
|
revisium/revisium-cli \
|
|
315
350
|
revisium rows upload --folder /app/data --commit
|
package/docs/migrate-commands.md
CHANGED
|
@@ -15,15 +15,23 @@ revisium migrate save --file <path>
|
|
|
15
15
|
| Option | Description | Required |
|
|
16
16
|
|--------|-------------|----------|
|
|
17
17
|
| `-f, --file <path>` | Output file path | Yes |
|
|
18
|
+
| `--url <url>` | Revisium URL (see [URL Format](./url-format.md)) | No* |
|
|
19
|
+
|
|
20
|
+
*If `--url` is not provided, uses `REVISIUM_URL` environment variable or prompts interactively.
|
|
18
21
|
|
|
19
22
|
### Examples
|
|
20
23
|
|
|
21
24
|
```bash
|
|
22
|
-
# Save migrations
|
|
25
|
+
# Save migrations (using REVISIUM_URL from environment)
|
|
23
26
|
revisium migrate save --file ./migrations.json
|
|
24
27
|
|
|
25
|
-
# Save
|
|
26
|
-
revisium migrate save --file ./migrations.json
|
|
28
|
+
# Save with explicit URL and token
|
|
29
|
+
revisium migrate save --file ./migrations.json \
|
|
30
|
+
--url revisium://cloud.revisium.io/myorg/myproject/master?token=$TOKEN
|
|
31
|
+
|
|
32
|
+
# Save from head revision
|
|
33
|
+
revisium migrate save --file ./migrations.json \
|
|
34
|
+
--url revisium://cloud.revisium.io/myorg/myproject/master:head?token=$TOKEN
|
|
27
35
|
```
|
|
28
36
|
|
|
29
37
|
## migrate apply
|
|
@@ -40,18 +48,28 @@ revisium migrate apply --file <path> [--commit]
|
|
|
40
48
|
|--------|-------------|----------|
|
|
41
49
|
| `-f, --file <path>` | Migrations file path | Yes |
|
|
42
50
|
| `-c, --commit` | Create revision after applying | No |
|
|
51
|
+
| `--url <url>` | Revisium URL (see [URL Format](./url-format.md)) | No* |
|
|
52
|
+
|
|
53
|
+
*If `--url` is not provided, uses `REVISIUM_URL` environment variable or prompts interactively.
|
|
43
54
|
|
|
44
55
|
### Examples
|
|
45
56
|
|
|
46
57
|
```bash
|
|
47
|
-
# Apply migrations
|
|
58
|
+
# Apply migrations (using REVISIUM_URL from environment)
|
|
48
59
|
revisium migrate apply --file ./migrations.json
|
|
49
60
|
|
|
50
61
|
# Apply and create revision
|
|
51
62
|
revisium migrate apply --file ./migrations.json --commit
|
|
52
63
|
|
|
53
|
-
# Apply to
|
|
54
|
-
revisium migrate apply --file ./migrations.json --
|
|
64
|
+
# Apply to specific environment with token
|
|
65
|
+
revisium migrate apply --file ./migrations.json --commit \
|
|
66
|
+
--url revisium://staging.example.com/myorg/myproject/master?token=$TOKEN
|
|
67
|
+
|
|
68
|
+
# Apply with credentials via environment variables
|
|
69
|
+
export REVISIUM_USERNAME=admin
|
|
70
|
+
export REVISIUM_PASSWORD=secret
|
|
71
|
+
revisium migrate apply --file ./migrations.json --commit \
|
|
72
|
+
--url revisium://cloud.revisium.io/myorg/myproject/master
|
|
55
73
|
```
|
|
56
74
|
|
|
57
75
|
## Migration Format
|
|
@@ -126,20 +144,27 @@ Deletes a table:
|
|
|
126
144
|
|
|
127
145
|
```bash
|
|
128
146
|
# Export from source
|
|
129
|
-
revisium migrate save --file ./migrations.json
|
|
147
|
+
revisium migrate save --file ./migrations.json \
|
|
148
|
+
--url revisium://source.example.com/myorg/myproject/master:head?token=$SOURCE_TOKEN
|
|
130
149
|
|
|
131
150
|
# Apply to target
|
|
132
|
-
revisium migrate apply --file ./migrations.json --
|
|
151
|
+
revisium migrate apply --file ./migrations.json --commit \
|
|
152
|
+
--url revisium://target.example.com/myorg/myproject/master?token=$TARGET_TOKEN
|
|
133
153
|
```
|
|
134
154
|
|
|
135
155
|
### Version Control
|
|
136
156
|
|
|
137
157
|
```bash
|
|
138
158
|
# Save migrations to git
|
|
139
|
-
revisium migrate save --file ./migrations.json
|
|
159
|
+
revisium migrate save --file ./migrations.json \
|
|
160
|
+
--url revisium://cloud.revisium.io/myorg/myproject/master?token=$TOKEN
|
|
140
161
|
git add migrations.json
|
|
141
162
|
git commit -m "Add user phone field migration"
|
|
142
163
|
|
|
143
|
-
# Apply in CI/CD
|
|
164
|
+
# Apply in CI/CD (credentials via environment)
|
|
165
|
+
export REVISIUM_URL=revisium://cloud.revisium.io/myorg/myproject/master
|
|
166
|
+
export REVISIUM_TOKEN=$DEPLOY_TOKEN
|
|
144
167
|
revisium migrate apply --file ./migrations.json --commit
|
|
145
168
|
```
|
|
169
|
+
|
|
170
|
+
See [URL Format](./url-format.md) for complete URL syntax and [Authentication](./authentication.md) for auth options.
|
package/docs/rows-commands.md
CHANGED
|
@@ -16,18 +16,26 @@ revisium rows save --folder <path> [--tables <list>]
|
|
|
16
16
|
|--------|-------------|----------|
|
|
17
17
|
| `-f, --folder <path>` | Output folder for row files | Yes |
|
|
18
18
|
| `-t, --tables <list>` | Comma-separated table IDs | No (all tables) |
|
|
19
|
+
| `--url <url>` | Revisium URL (see [URL Format](./url-format.md)) | No* |
|
|
20
|
+
|
|
21
|
+
*If `--url` is not provided, uses `REVISIUM_URL` environment variable or prompts interactively.
|
|
19
22
|
|
|
20
23
|
### Examples
|
|
21
24
|
|
|
22
25
|
```bash
|
|
23
|
-
# Export all tables
|
|
26
|
+
# Export all tables (using REVISIUM_URL from environment)
|
|
24
27
|
revisium rows save --folder ./data
|
|
25
28
|
|
|
26
29
|
# Export specific tables
|
|
27
30
|
revisium rows save --folder ./data --tables users,posts
|
|
28
31
|
|
|
29
|
-
# Export
|
|
30
|
-
revisium rows save --folder ./data
|
|
32
|
+
# Export with explicit URL and token
|
|
33
|
+
revisium rows save --folder ./data \
|
|
34
|
+
--url revisium://cloud.revisium.io/myorg/myproject/master?token=$TOKEN
|
|
35
|
+
|
|
36
|
+
# Export from head revision
|
|
37
|
+
revisium rows save --folder ./data \
|
|
38
|
+
--url revisium://cloud.revisium.io/myorg/myproject/master:head?token=$TOKEN
|
|
31
39
|
```
|
|
32
40
|
|
|
33
41
|
### Output Format
|
|
@@ -69,11 +77,12 @@ revisium rows upload --folder <path> [options]
|
|
|
69
77
|
| `-t, --tables <list>` | Comma-separated table IDs | All tables |
|
|
70
78
|
| `--batch-size <n>` | Rows per batch | 100 |
|
|
71
79
|
| `-c, --commit` | Create revision after upload | false |
|
|
80
|
+
| `--url <url>` | Revisium URL (see [URL Format](./url-format.md)) | Environment |
|
|
72
81
|
|
|
73
82
|
### Examples
|
|
74
83
|
|
|
75
84
|
```bash
|
|
76
|
-
# Basic upload
|
|
85
|
+
# Basic upload (using REVISIUM_URL from environment)
|
|
77
86
|
revisium rows upload --folder ./data
|
|
78
87
|
|
|
79
88
|
# Upload specific tables
|
|
@@ -84,6 +93,16 @@ revisium rows upload --folder ./data --batch-size 500
|
|
|
84
93
|
|
|
85
94
|
# Upload and create revision
|
|
86
95
|
revisium rows upload --folder ./data --commit
|
|
96
|
+
|
|
97
|
+
# Upload with explicit URL and token
|
|
98
|
+
revisium rows upload --folder ./data --commit \
|
|
99
|
+
--url revisium://cloud.revisium.io/myorg/myproject/master?token=$TOKEN
|
|
100
|
+
|
|
101
|
+
# Upload with credentials via environment variables
|
|
102
|
+
export REVISIUM_USERNAME=admin
|
|
103
|
+
export REVISIUM_PASSWORD=secret
|
|
104
|
+
revisium rows upload --folder ./data --commit \
|
|
105
|
+
--url revisium://cloud.revisium.io/myorg/myproject/master
|
|
87
106
|
```
|
|
88
107
|
|
|
89
108
|
## Features
|
|
@@ -145,16 +164,20 @@ revisium rows upload --folder ./data --tables users --commit
|
|
|
145
164
|
|
|
146
165
|
```bash
|
|
147
166
|
# Export from source
|
|
148
|
-
revisium rows save --folder ./data
|
|
167
|
+
revisium rows save --folder ./data \
|
|
168
|
+
--url revisium://source.example.com/myorg/myproject/master:head?token=$SOURCE_TOKEN
|
|
149
169
|
|
|
150
170
|
# Import to target
|
|
151
|
-
revisium rows upload --folder ./data --
|
|
171
|
+
revisium rows upload --folder ./data --commit \
|
|
172
|
+
--url revisium://target.example.com/myorg/myproject/master?token=$TARGET_TOKEN
|
|
152
173
|
```
|
|
153
174
|
|
|
154
175
|
### Incremental Updates
|
|
155
176
|
|
|
156
177
|
```bash
|
|
157
178
|
# Edit local JSON files
|
|
158
|
-
# Then upload changes
|
|
179
|
+
# Then upload changes (using REVISIUM_URL from environment)
|
|
159
180
|
revisium rows upload --folder ./data --commit
|
|
160
181
|
```
|
|
182
|
+
|
|
183
|
+
See [URL Format](./url-format.md) for complete URL syntax and [Authentication](./authentication.md) for auth options.
|
package/docs/schema-commands.md
CHANGED
|
@@ -15,15 +15,27 @@ revisium schema save --folder <path>
|
|
|
15
15
|
| Option | Description | Required |
|
|
16
16
|
|--------|-------------|----------|
|
|
17
17
|
| `-f, --folder <path>` | Output folder for schema files | Yes |
|
|
18
|
+
| `--url <url>` | Revisium URL (see [URL Format](./url-format.md)) | No* |
|
|
19
|
+
|
|
20
|
+
*If `--url` is not provided, uses `REVISIUM_URL` environment variable or prompts interactively.
|
|
18
21
|
|
|
19
22
|
### Examples
|
|
20
23
|
|
|
21
24
|
```bash
|
|
22
|
-
# Export all schemas
|
|
25
|
+
# Export all schemas (using REVISIUM_URL from environment)
|
|
23
26
|
revisium schema save --folder ./schemas
|
|
24
27
|
|
|
25
|
-
# Export
|
|
26
|
-
revisium schema save --folder ./schemas
|
|
28
|
+
# Export with explicit URL and token
|
|
29
|
+
revisium schema save --folder ./schemas \
|
|
30
|
+
--url revisium://cloud.revisium.io/myorg/myproject/master?token=$TOKEN
|
|
31
|
+
|
|
32
|
+
# Export from head revision
|
|
33
|
+
revisium schema save --folder ./schemas \
|
|
34
|
+
--url revisium://cloud.revisium.io/myorg/myproject/master:head?token=$TOKEN
|
|
35
|
+
|
|
36
|
+
# Local development
|
|
37
|
+
revisium schema save --folder ./schemas \
|
|
38
|
+
--url revisium://localhost:8080/admin/demo/master?token=$TOKEN
|
|
27
39
|
```
|
|
28
40
|
|
|
29
41
|
### Output Format
|
|
@@ -111,11 +123,15 @@ Typical workflow for schema management:
|
|
|
111
123
|
|
|
112
124
|
```bash
|
|
113
125
|
# 1. Export schemas from source environment
|
|
114
|
-
revisium schema save --folder ./schemas
|
|
126
|
+
revisium schema save --folder ./schemas \
|
|
127
|
+
--url revisium://source.example.com/myorg/myproject/master:head?token=$SOURCE_TOKEN
|
|
115
128
|
|
|
116
129
|
# 2. Convert to migrations
|
|
117
130
|
revisium schema create-migrations --schemas-folder ./schemas --file ./migrations.json
|
|
118
131
|
|
|
119
132
|
# 3. Apply to target environment
|
|
120
|
-
revisium migrate apply --file ./migrations.json --
|
|
133
|
+
revisium migrate apply --file ./migrations.json --commit \
|
|
134
|
+
--url revisium://target.example.com/myorg/myproject/master?token=$TARGET_TOKEN
|
|
121
135
|
```
|
|
136
|
+
|
|
137
|
+
See [URL Format](./url-format.md) for complete URL syntax and authentication options.
|
package/docs/sync-commands.md
CHANGED
|
@@ -114,7 +114,14 @@ revisium sync all --source <url> --target <url> [options]
|
|
|
114
114
|
|
|
115
115
|
### Options
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
| Option | Description | Default |
|
|
118
|
+
|--------|-------------|---------|
|
|
119
|
+
| `-s, --source <url>` | Source project URL | Required |
|
|
120
|
+
| `-t, --target <url>` | Target project URL | Required |
|
|
121
|
+
| `--tables <list>` | Comma-separated tables | All tables |
|
|
122
|
+
| `--batch-size <n>` | Rows per batch | 100 |
|
|
123
|
+
| `-c, --commit` | Create revision after sync | false |
|
|
124
|
+
| `-d, --dry-run` | Preview without applying | false |
|
|
118
125
|
|
|
119
126
|
### Examples
|
|
120
127
|
|
|
@@ -133,24 +140,49 @@ revisium sync all \
|
|
|
133
140
|
--commit
|
|
134
141
|
```
|
|
135
142
|
|
|
136
|
-
##
|
|
143
|
+
## Authentication
|
|
144
|
+
|
|
145
|
+
Sync commands support separate authentication for source and target.
|
|
146
|
+
|
|
147
|
+
### Environment Variables
|
|
137
148
|
|
|
138
|
-
|
|
149
|
+
| Variable | Description |
|
|
150
|
+
|----------|-------------|
|
|
151
|
+
| `REVISIUM_SOURCE_URL` | Source project URL |
|
|
152
|
+
| `REVISIUM_SOURCE_TOKEN` | Source JWT token |
|
|
153
|
+
| `REVISIUM_SOURCE_API_KEY` | Source API key |
|
|
154
|
+
| `REVISIUM_SOURCE_USERNAME` | Source username |
|
|
155
|
+
| `REVISIUM_SOURCE_PASSWORD` | Source password |
|
|
156
|
+
| `REVISIUM_TARGET_URL` | Target project URL |
|
|
157
|
+
| `REVISIUM_TARGET_TOKEN` | Target JWT token |
|
|
158
|
+
| `REVISIUM_TARGET_API_KEY` | Target API key |
|
|
159
|
+
| `REVISIUM_TARGET_USERNAME` | Target username |
|
|
160
|
+
| `REVISIUM_TARGET_PASSWORD` | Target password |
|
|
161
|
+
|
|
162
|
+
### Non-Interactive Usage
|
|
139
163
|
|
|
140
164
|
```bash
|
|
141
|
-
#
|
|
142
|
-
|
|
143
|
-
|
|
165
|
+
# Using tokens
|
|
166
|
+
export REVISIUM_SOURCE_TOKEN=<YOUR_SOURCE_TOKEN>
|
|
167
|
+
export REVISIUM_TARGET_TOKEN=<YOUR_TARGET_TOKEN>
|
|
144
168
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
169
|
+
revisium sync all \
|
|
170
|
+
--source revisium://cloud.revisium.io/org/proj/master:head \
|
|
171
|
+
--target revisium://localhost:8080/org/proj/master \
|
|
172
|
+
--commit
|
|
148
173
|
```
|
|
149
174
|
|
|
150
|
-
Then run without URL arguments:
|
|
151
|
-
|
|
152
175
|
```bash
|
|
153
|
-
|
|
176
|
+
# Using username/password
|
|
177
|
+
export REVISIUM_SOURCE_USERNAME=admin
|
|
178
|
+
export REVISIUM_SOURCE_PASSWORD=source_secret
|
|
179
|
+
export REVISIUM_TARGET_USERNAME=admin
|
|
180
|
+
export REVISIUM_TARGET_PASSWORD=target_secret
|
|
181
|
+
|
|
182
|
+
revisium sync all \
|
|
183
|
+
--source revisium://source.example.com/org/proj/master:head \
|
|
184
|
+
--target revisium://target.example.com/org/proj/master \
|
|
185
|
+
--commit
|
|
154
186
|
```
|
|
155
187
|
|
|
156
188
|
## Examples
|
package/docs/url-format.md
CHANGED
|
@@ -63,8 +63,8 @@ revisium migrate apply --file ./migrations.json \
|
|
|
63
63
|
```
|
|
64
64
|
|
|
65
65
|
Get your token:
|
|
66
|
-
- **Cloud:** https://cloud.revisium.io/get-
|
|
67
|
-
- **Self-hosted:** https://your-host/get-
|
|
66
|
+
- **Cloud:** https://cloud.revisium.io/get-token
|
|
67
|
+
- **Self-hosted:** https://your-host/get-token
|
|
68
68
|
|
|
69
69
|
### API Key Authentication
|
|
70
70
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
2
|
import * as path from 'path';
|
|
3
|
-
import {
|
|
3
|
+
import { waitForHealthy } from '../utils/docker-helper';
|
|
4
4
|
import { api } from '../utils/api-client';
|
|
5
5
|
import { E2E_CONFIG } from '../utils/constants';
|
|
6
6
|
|
|
@@ -11,19 +11,13 @@ export default async function globalSetup(): Promise<void> {
|
|
|
11
11
|
console.log('E2E Global Setup');
|
|
12
12
|
console.log('========================================\n');
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
console.log('Waiting for Revisium to be ready...');
|
|
15
|
+
await waitForHealthy(`${E2E_CONFIG.API_URL}/health/readiness`);
|
|
16
16
|
|
|
17
|
-
// 2. Wait for Revisium to be healthy
|
|
18
|
-
console.log('\nWaiting for Revisium to be ready...');
|
|
19
|
-
await waitForHealthy(`${E2E_CONFIG.API_URL}/health`);
|
|
20
|
-
|
|
21
|
-
// 3. Login and get token
|
|
22
17
|
console.log('\nLogging in as admin...');
|
|
23
18
|
const token = await api.login();
|
|
24
19
|
console.log('Login successful');
|
|
25
20
|
|
|
26
|
-
// 4. Save environment for test workers
|
|
27
21
|
const envData = {
|
|
28
22
|
E2E_API_URL: E2E_CONFIG.API_URL,
|
|
29
23
|
E2E_ADMIN_TOKEN: token,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
2
|
import * as path from 'path';
|
|
3
3
|
import { execSync } from 'child_process';
|
|
4
|
-
import { stopDocker } from '../utils/docker-helper';
|
|
5
4
|
|
|
6
5
|
const ENV_FILE = path.join(process.cwd(), '.e2e-env.json');
|
|
7
6
|
|
|
@@ -10,10 +9,6 @@ export default function globalTeardown(): void {
|
|
|
10
9
|
console.log('E2E Global Teardown');
|
|
11
10
|
console.log('========================================\n');
|
|
12
11
|
|
|
13
|
-
// 1. Stop Docker containers
|
|
14
|
-
stopDocker();
|
|
15
|
-
|
|
16
|
-
// 2. Merge coverage if E2E coverage exists
|
|
17
12
|
const nycOutputDir = path.join(process.cwd(), '.nyc_output');
|
|
18
13
|
if (fs.existsSync(nycOutputDir)) {
|
|
19
14
|
const files = fs
|
|
@@ -32,7 +27,6 @@ export default function globalTeardown(): void {
|
|
|
32
27
|
}
|
|
33
28
|
}
|
|
34
29
|
|
|
35
|
-
// 3. Cleanup env file
|
|
36
30
|
if (fs.existsSync(ENV_FILE)) {
|
|
37
31
|
fs.rmSync(ENV_FILE);
|
|
38
32
|
console.log(`\nCleaned up ${ENV_FILE}`);
|
package/e2e/utils/constants.ts
CHANGED
|
@@ -2,8 +2,6 @@ export const E2E_CONFIG = {
|
|
|
2
2
|
API_URL: 'http://localhost:8082',
|
|
3
3
|
ADMIN_USERNAME: 'admin',
|
|
4
4
|
ADMIN_PASSWORD: 'admin',
|
|
5
|
-
DOCKER_COMPOSE_FILE: 'e2e/docker-compose.e2e.yml',
|
|
6
|
-
DOCKER_PROJECT_NAME: 'revisium-cli-e2e',
|
|
7
5
|
HEALTH_CHECK_TIMEOUT: 60000,
|
|
8
6
|
HEALTH_CHECK_INTERVAL: 1000,
|
|
9
7
|
};
|
|
@@ -1,28 +1,5 @@
|
|
|
1
|
-
import { execSync } from 'child_process';
|
|
2
1
|
import { E2E_CONFIG } from './constants';
|
|
3
2
|
|
|
4
|
-
export function startDocker(): void {
|
|
5
|
-
console.log('Starting Docker containers...');
|
|
6
|
-
|
|
7
|
-
execSync(
|
|
8
|
-
`docker compose -f ${E2E_CONFIG.DOCKER_COMPOSE_FILE} -p ${E2E_CONFIG.DOCKER_PROJECT_NAME} up -d --wait`,
|
|
9
|
-
{ stdio: 'inherit' },
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
console.log('Docker containers started');
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function stopDocker(): void {
|
|
16
|
-
console.log('Stopping Docker containers...');
|
|
17
|
-
|
|
18
|
-
execSync(
|
|
19
|
-
`docker compose -f ${E2E_CONFIG.DOCKER_COMPOSE_FILE} -p ${E2E_CONFIG.DOCKER_PROJECT_NAME} down -v`,
|
|
20
|
-
{ stdio: 'inherit' },
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
console.log('Docker containers stopped');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
3
|
export async function waitForHealthy(
|
|
27
4
|
url: string,
|
|
28
5
|
timeout: number = E2E_CONFIG.HEALTH_CHECK_TIMEOUT,
|