@atlasauth/cli 0.8.0 → 0.10.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/CHANGELOG.md +27 -0
- package/dist/args.d.ts +146 -0
- package/dist/args.js +63 -1
- package/dist/args.js.map +1 -1
- package/dist/commands/auth.js +5 -1
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/config.d.ts +15 -0
- package/dist/commands/config.js +76 -6
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/csp.d.ts +32 -0
- package/dist/commands/csp.js +180 -0
- package/dist/commands/csp.js.map +1 -0
- package/dist/commands/info.js +1 -1
- package/dist/commands/info.js.map +1 -1
- package/dist/commands/init.js +26 -2
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/integrations.d.ts +8 -0
- package/dist/commands/integrations.js +112 -0
- package/dist/commands/integrations.js.map +1 -0
- package/dist/commands/listen.d.ts +17 -0
- package/dist/commands/listen.js +223 -0
- package/dist/commands/listen.js.map +1 -0
- package/dist/commands/move-origin.d.ts +11 -0
- package/dist/commands/move-origin.js +95 -0
- package/dist/commands/move-origin.js.map +1 -0
- package/dist/commands/operator.d.ts +26 -0
- package/dist/commands/operator.js +210 -0
- package/dist/commands/operator.js.map +1 -0
- package/dist/commands/partner-platforms.d.ts +10 -0
- package/dist/commands/partner-platforms.js +157 -0
- package/dist/commands/partner-platforms.js.map +1 -0
- package/dist/commands/project-commands.d.ts +12 -0
- package/dist/commands/project-commands.js +130 -30
- package/dist/commands/project-commands.js.map +1 -1
- package/dist/commands/referrals.d.ts +4 -4
- package/dist/commands/referrals.js +203 -33
- package/dist/commands/referrals.js.map +1 -1
- package/dist/commands/shared.d.ts +6 -0
- package/dist/commands/shared.js +10 -1
- package/dist/commands/shared.js.map +1 -1
- package/dist/commands/status.d.ts +3 -0
- package/dist/commands/status.js +77 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/webhooks.d.ts +29 -2
- package/dist/commands/webhooks.js +257 -24
- package/dist/commands/webhooks.js.map +1 -1
- package/dist/config.d.ts +14 -0
- package/dist/config.js.map +1 -1
- package/dist/context.d.ts +5 -0
- package/dist/context.js.map +1 -1
- package/dist/help.d.ts +1 -1
- package/dist/help.js +202 -16
- package/dist/help.js.map +1 -1
- package/dist/run.js +16 -0
- package/dist/run.js.map +1 -1
- package/package.json +5 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @atlasauth/cli changelog
|
|
2
2
|
|
|
3
|
+
## 0.10.0 — 2026-10-24
|
|
4
|
+
|
|
5
|
+
- Per-call integration audiences (`getToken({ for, cbid })`), partner platforms, operator tokens for partner products.
|
|
6
|
+
|
|
7
|
+
## 0.9.0 — 2026-10-24
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- `atlas webhooks` gains `upsert`, `update`, `test`, `deliveries`, `redeliver`, `replay`, `rotate` and `reveal`. Secrets go to 0600 files.
|
|
12
|
+
- `atlas listen --forward-to <url> [--events user.*]`: signed local webhook forwarding with no tunnel.
|
|
13
|
+
- `atlas move-origin --from --to [--dry-run]`: one-step domain move with a diff, a confirmation and a test delivery per moved webhook.
|
|
14
|
+
- `atlas csp --framework next|express|nginx`: the CSP sources for your integration shape; `--manifest` merges any provider's embed manifest.
|
|
15
|
+
- `atlas config plan`: field-level drift diff with `--exit-code` and `--json`. New `atlas-plan` GitHub Action.
|
|
16
|
+
- `atlas env --format k8s`, and `atlas env` without `--product` reads the live instance.
|
|
17
|
+
- `atlas migrate code --from openid-client|jose|generic-oidc`.
|
|
18
|
+
- `ATLAS_API_BASE` is accepted everywhere `ATLAS_API_URL` is (BASE wins when both are set); `atlas env` prints both.
|
|
19
|
+
- `atlas referrals conformance`: runs `@atlasauth/referral-conformance` against any referral platform (`--protocol webhook` for the generic Atlas referral protocol, `connection` for the Referalli dialect; defaults to the connected one), with `--secret-file`, `--only` and `--simulate`. Exits 1 on a failed case.
|
|
20
|
+
- `atlas referrals connect --oauth [--preset <id>]`: one-click connect. Prints the platform's link, waits for the connection to appear, pings it. No key or secret is copied.
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- Referalli is `--provider referalli`; `--provider referally`, `--referally-key`, `--referally-key-file`, `REFERALLY_BASE_URL` and `REFERALLY_API_KEY` still work and print a notice.
|
|
25
|
+
|
|
26
|
+
- `atlas status`: Atlas's components and regions, the open Atlas incidents that concern the instance, its status subscription, and the state of every upstream status page it declared. Exits 1 on an Atlas major outage or a major / critical incident that concerns the instance, or an upstream partial / major outage; `--json` for scripts.
|
|
27
|
+
- `atlas doctor` (the integration-health report, exit 1 on a failing check) and `atlas csp` (the Content-Security-Policy sources for your pages, from the embed manifest).
|
|
28
|
+
- `atlas init --backchannel <url>`: sets the first-party OAuth client's back-channel logout URI (on create, or on a re-run) and points at the ready-made receivers in `@atlasauth/backend`.
|
|
29
|
+
|
|
3
30
|
## 0.8.0 — 2026-10-24
|
|
4
31
|
|
|
5
32
|
### Added
|
package/dist/args.d.ts
CHANGED
|
@@ -31,6 +31,30 @@ declare const OPTIONS: {
|
|
|
31
31
|
readonly 'secret-key': {
|
|
32
32
|
readonly type: "string";
|
|
33
33
|
};
|
|
34
|
+
readonly device: {
|
|
35
|
+
readonly type: "boolean";
|
|
36
|
+
};
|
|
37
|
+
readonly resource: {
|
|
38
|
+
readonly type: "string";
|
|
39
|
+
};
|
|
40
|
+
readonly scope: {
|
|
41
|
+
readonly type: "string";
|
|
42
|
+
};
|
|
43
|
+
readonly scopes: {
|
|
44
|
+
readonly type: "string";
|
|
45
|
+
};
|
|
46
|
+
readonly owner: {
|
|
47
|
+
readonly type: "string";
|
|
48
|
+
};
|
|
49
|
+
readonly 'expires-at': {
|
|
50
|
+
readonly type: "string";
|
|
51
|
+
};
|
|
52
|
+
readonly 'allowed-ips': {
|
|
53
|
+
readonly type: "string";
|
|
54
|
+
};
|
|
55
|
+
readonly out: {
|
|
56
|
+
readonly type: "string";
|
|
57
|
+
};
|
|
34
58
|
readonly email: {
|
|
35
59
|
readonly type: "string";
|
|
36
60
|
};
|
|
@@ -104,6 +128,9 @@ declare const OPTIONS: {
|
|
|
104
128
|
readonly 'webhook-url': {
|
|
105
129
|
readonly type: "string";
|
|
106
130
|
};
|
|
131
|
+
readonly backchannel: {
|
|
132
|
+
readonly type: "string";
|
|
133
|
+
};
|
|
107
134
|
readonly yes: {
|
|
108
135
|
readonly type: "boolean";
|
|
109
136
|
readonly short: "y";
|
|
@@ -120,6 +147,18 @@ declare const OPTIONS: {
|
|
|
120
147
|
readonly 'fail-on': {
|
|
121
148
|
readonly type: "string";
|
|
122
149
|
};
|
|
150
|
+
readonly only: {
|
|
151
|
+
readonly type: "string";
|
|
152
|
+
};
|
|
153
|
+
readonly 'no-probe': {
|
|
154
|
+
readonly type: "boolean";
|
|
155
|
+
};
|
|
156
|
+
readonly shape: {
|
|
157
|
+
readonly type: "string";
|
|
158
|
+
};
|
|
159
|
+
readonly origin: {
|
|
160
|
+
readonly type: "string";
|
|
161
|
+
};
|
|
123
162
|
readonly now: {
|
|
124
163
|
readonly type: "boolean";
|
|
125
164
|
};
|
|
@@ -132,6 +171,55 @@ declare const OPTIONS: {
|
|
|
132
171
|
readonly events: {
|
|
133
172
|
readonly type: "string";
|
|
134
173
|
};
|
|
174
|
+
readonly delivery: {
|
|
175
|
+
readonly type: "string";
|
|
176
|
+
};
|
|
177
|
+
readonly status: {
|
|
178
|
+
readonly type: "string";
|
|
179
|
+
};
|
|
180
|
+
readonly 'event-type': {
|
|
181
|
+
readonly type: "string";
|
|
182
|
+
};
|
|
183
|
+
readonly until: {
|
|
184
|
+
readonly type: "string";
|
|
185
|
+
};
|
|
186
|
+
readonly active: {
|
|
187
|
+
readonly type: "boolean";
|
|
188
|
+
};
|
|
189
|
+
readonly inactive: {
|
|
190
|
+
readonly type: "boolean";
|
|
191
|
+
};
|
|
192
|
+
readonly timeout: {
|
|
193
|
+
readonly type: "string";
|
|
194
|
+
};
|
|
195
|
+
readonly 'no-wait': {
|
|
196
|
+
readonly type: "boolean";
|
|
197
|
+
};
|
|
198
|
+
readonly to: {
|
|
199
|
+
readonly type: "string";
|
|
200
|
+
};
|
|
201
|
+
readonly 'forward-to': {
|
|
202
|
+
readonly type: "string";
|
|
203
|
+
};
|
|
204
|
+
readonly count: {
|
|
205
|
+
readonly type: "string";
|
|
206
|
+
};
|
|
207
|
+
readonly 'no-forward': {
|
|
208
|
+
readonly type: "boolean";
|
|
209
|
+
};
|
|
210
|
+
readonly framework: {
|
|
211
|
+
readonly type: "string";
|
|
212
|
+
};
|
|
213
|
+
readonly manifest: {
|
|
214
|
+
readonly type: "string";
|
|
215
|
+
readonly multiple: true;
|
|
216
|
+
};
|
|
217
|
+
readonly 'no-atlas': {
|
|
218
|
+
readonly type: "boolean";
|
|
219
|
+
};
|
|
220
|
+
readonly 'exit-code': {
|
|
221
|
+
readonly type: "boolean";
|
|
222
|
+
};
|
|
135
223
|
readonly provider: {
|
|
136
224
|
readonly type: "string";
|
|
137
225
|
};
|
|
@@ -141,12 +229,33 @@ declare const OPTIONS: {
|
|
|
141
229
|
readonly 'base-url': {
|
|
142
230
|
readonly type: "string";
|
|
143
231
|
};
|
|
232
|
+
readonly 'referalli-key': {
|
|
233
|
+
readonly type: "string";
|
|
234
|
+
};
|
|
235
|
+
readonly 'referalli-key-file': {
|
|
236
|
+
readonly type: "string";
|
|
237
|
+
};
|
|
144
238
|
readonly 'referally-key': {
|
|
145
239
|
readonly type: "string";
|
|
146
240
|
};
|
|
147
241
|
readonly 'referally-key-file': {
|
|
148
242
|
readonly type: "string";
|
|
149
243
|
};
|
|
244
|
+
readonly oauth: {
|
|
245
|
+
readonly type: "boolean";
|
|
246
|
+
};
|
|
247
|
+
readonly preset: {
|
|
248
|
+
readonly type: "string";
|
|
249
|
+
};
|
|
250
|
+
readonly 'connection-id': {
|
|
251
|
+
readonly type: "string";
|
|
252
|
+
};
|
|
253
|
+
readonly protocol: {
|
|
254
|
+
readonly type: "string";
|
|
255
|
+
};
|
|
256
|
+
readonly simulate: {
|
|
257
|
+
readonly type: "boolean";
|
|
258
|
+
};
|
|
150
259
|
readonly 'auto-enroll': {
|
|
151
260
|
readonly type: "boolean";
|
|
152
261
|
};
|
|
@@ -229,6 +338,43 @@ declare const OPTIONS: {
|
|
|
229
338
|
readonly type: "string";
|
|
230
339
|
readonly multiple: true;
|
|
231
340
|
};
|
|
341
|
+
readonly audience: {
|
|
342
|
+
readonly type: "string";
|
|
343
|
+
};
|
|
344
|
+
readonly 'events-url': {
|
|
345
|
+
readonly type: "string";
|
|
346
|
+
};
|
|
347
|
+
readonly 'backchannel-logout-url': {
|
|
348
|
+
readonly type: "string";
|
|
349
|
+
};
|
|
350
|
+
readonly 'oauth-client-id': {
|
|
351
|
+
readonly type: "string";
|
|
352
|
+
};
|
|
353
|
+
readonly trace: {
|
|
354
|
+
readonly type: "string";
|
|
355
|
+
};
|
|
356
|
+
readonly disable: {
|
|
357
|
+
readonly type: "boolean";
|
|
358
|
+
};
|
|
359
|
+
readonly 'platform-id': {
|
|
360
|
+
readonly type: "string";
|
|
361
|
+
};
|
|
362
|
+
readonly 'jwks-url': {
|
|
363
|
+
readonly type: "string";
|
|
364
|
+
};
|
|
365
|
+
readonly 'signature-header': {
|
|
366
|
+
readonly type: "string";
|
|
367
|
+
};
|
|
368
|
+
readonly 'allowed-source': {
|
|
369
|
+
readonly type: "string";
|
|
370
|
+
readonly multiple: true;
|
|
371
|
+
};
|
|
372
|
+
readonly 'token-file': {
|
|
373
|
+
readonly type: "string";
|
|
374
|
+
};
|
|
375
|
+
readonly rotate: {
|
|
376
|
+
readonly type: "boolean";
|
|
377
|
+
};
|
|
232
378
|
readonly cursor: {
|
|
233
379
|
readonly type: "boolean";
|
|
234
380
|
};
|
package/dist/args.js
CHANGED
|
@@ -23,6 +23,16 @@ const OPTIONS = {
|
|
|
23
23
|
// login (non-interactive overrides for the prompts).
|
|
24
24
|
url: { type: 'string' },
|
|
25
25
|
'secret-key': { type: 'string' },
|
|
26
|
+
// login --device / token: the operator device flow and token exchange.
|
|
27
|
+
device: { type: 'boolean' },
|
|
28
|
+
resource: { type: 'string' },
|
|
29
|
+
scope: { type: 'string' },
|
|
30
|
+
// keys create / rotate.
|
|
31
|
+
scopes: { type: 'string' },
|
|
32
|
+
owner: { type: 'string' },
|
|
33
|
+
'expires-at': { type: 'string' },
|
|
34
|
+
'allowed-ips': { type: 'string' },
|
|
35
|
+
out: { type: 'string' },
|
|
26
36
|
// users create.
|
|
27
37
|
email: { type: 'string' },
|
|
28
38
|
'first-name': { type: 'string' },
|
|
@@ -55,23 +65,61 @@ const OPTIONS = {
|
|
|
55
65
|
'email-key-file': { type: 'string' },
|
|
56
66
|
'client-redirect': { type: 'string', multiple: true },
|
|
57
67
|
'webhook-url': { type: 'string' },
|
|
68
|
+
backchannel: { type: 'string' },
|
|
58
69
|
yes: { type: 'boolean', short: 'y' },
|
|
59
70
|
force: { type: 'boolean' },
|
|
60
71
|
'rotate-secret': { type: 'boolean' },
|
|
61
72
|
instance: { type: 'string' },
|
|
62
73
|
'fail-on': { type: 'string' },
|
|
74
|
+
// doctor / csp.
|
|
75
|
+
only: { type: 'string' },
|
|
76
|
+
'no-probe': { type: 'boolean' },
|
|
77
|
+
shape: { type: 'string' },
|
|
78
|
+
origin: { type: 'string' },
|
|
63
79
|
now: { type: 'boolean' },
|
|
64
80
|
overlap: { type: 'string' },
|
|
65
81
|
// Any command that receives a secret: print it instead of writing a 0600 file.
|
|
66
82
|
'print-secret': { type: 'boolean' },
|
|
67
|
-
// webhooks create.
|
|
83
|
+
// webhooks create / update / listen.
|
|
68
84
|
events: { type: 'string' },
|
|
85
|
+
// webhooks deliveries / redeliver / test / update.
|
|
86
|
+
delivery: { type: 'string' },
|
|
87
|
+
status: { type: 'string' },
|
|
88
|
+
'event-type': { type: 'string' },
|
|
89
|
+
until: { type: 'string' },
|
|
90
|
+
active: { type: 'boolean' },
|
|
91
|
+
inactive: { type: 'boolean' },
|
|
92
|
+
timeout: { type: 'string' },
|
|
93
|
+
'no-wait': { type: 'boolean' },
|
|
94
|
+
// move-origin.
|
|
95
|
+
to: { type: 'string' },
|
|
96
|
+
// listen.
|
|
97
|
+
'forward-to': { type: 'string' },
|
|
98
|
+
count: { type: 'string' },
|
|
99
|
+
'no-forward': { type: 'boolean' },
|
|
100
|
+
// csp.
|
|
101
|
+
framework: { type: 'string' },
|
|
102
|
+
manifest: { type: 'string', multiple: true },
|
|
103
|
+
'no-atlas': { type: 'boolean' },
|
|
104
|
+
// config plan.
|
|
105
|
+
'exit-code': { type: 'boolean' },
|
|
69
106
|
// referrals connect / backfill.
|
|
70
107
|
provider: { type: 'string' },
|
|
71
108
|
program: { type: 'string' },
|
|
72
109
|
'base-url': { type: 'string' },
|
|
110
|
+
'referalli-key': { type: 'string' },
|
|
111
|
+
'referalli-key-file': { type: 'string' },
|
|
112
|
+
// The old spellings (Referalli was first published as "Referally"): still accepted, with a notice.
|
|
73
113
|
'referally-key': { type: 'string' },
|
|
74
114
|
'referally-key-file': { type: 'string' },
|
|
115
|
+
// referrals connect --oauth: one-click connect (no key to paste).
|
|
116
|
+
oauth: { type: 'boolean' },
|
|
117
|
+
preset: { type: 'string' },
|
|
118
|
+
// referrals conformance: the platform under test.
|
|
119
|
+
'connection-id': { type: 'string' },
|
|
120
|
+
// referrals conformance: webhook (generic protocol) or connection (Referalli dialect).
|
|
121
|
+
protocol: { type: 'string' },
|
|
122
|
+
simulate: { type: 'boolean' },
|
|
75
123
|
'auto-enroll': { type: 'boolean' },
|
|
76
124
|
destination: { type: 'string' },
|
|
77
125
|
'tracking-token': { type: 'string' },
|
|
@@ -101,6 +149,20 @@ const OPTIONS = {
|
|
|
101
149
|
'bridge-days': { type: 'string' },
|
|
102
150
|
resume: { type: 'boolean' },
|
|
103
151
|
skip: { type: 'string', multiple: true },
|
|
152
|
+
// integrations set / deliveries.
|
|
153
|
+
audience: { type: 'string' },
|
|
154
|
+
'events-url': { type: 'string' },
|
|
155
|
+
'backchannel-logout-url': { type: 'string' },
|
|
156
|
+
'oauth-client-id': { type: 'string' },
|
|
157
|
+
trace: { type: 'string' },
|
|
158
|
+
disable: { type: 'boolean' },
|
|
159
|
+
// partner-platforms.
|
|
160
|
+
'platform-id': { type: 'string' },
|
|
161
|
+
'jwks-url': { type: 'string' },
|
|
162
|
+
'signature-header': { type: 'string' },
|
|
163
|
+
'allowed-source': { type: 'string', multiple: true },
|
|
164
|
+
'token-file': { type: 'string' },
|
|
165
|
+
rotate: { type: 'boolean' },
|
|
104
166
|
// mcp install.
|
|
105
167
|
cursor: { type: 'boolean' },
|
|
106
168
|
'claude-code': { type: 'boolean' },
|
package/dist/args.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"args.js","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"args.js","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":";;AAwLA,sBAeC;AAGD,kBAGC;AAGD,oBAOC;AAGD,sBAQC;AAlOD,yCAAsC;AACtC,qCAAoC;AAEpC;;;;;GAKG;AACH,MAAM,OAAO,GAAG;IACd,UAAU;IACV,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;IACzB,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC3B,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IACzB,gBAAgB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IACpC,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE;IACrC,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE;IACxC,qDAAqD;IACrD,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IACvB,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IAChC,uEAAuE;IACvE,MAAM,EA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AAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACpE,OAAO,GAAG;SACP,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SAC5B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,OAAO,CAAC,CAAC;AACrB,CAAC;AAED,yFAAyF;AACzF,SAAgB,KAAK,CAAC,MAAc;IAClC,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACxC,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IACtB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,iBAAQ,CAAC,4CAA4C,GAAG,IAAI,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
|
package/dist/commands/auth.js
CHANGED
|
@@ -9,6 +9,7 @@ const errors_1 = require("../errors");
|
|
|
9
9
|
const output_1 = require("../output");
|
|
10
10
|
const project_1 = require("../project");
|
|
11
11
|
const shared_1 = require("./shared");
|
|
12
|
+
const operator_1 = require("./operator");
|
|
12
13
|
/**
|
|
13
14
|
* `atlas login` — prompt for an API URL + a secret key, PROVE the key works
|
|
14
15
|
* with one cheap Backend call, then store it under a named profile (0600).
|
|
@@ -21,6 +22,9 @@ const shared_1 = require("./shared");
|
|
|
21
22
|
*/
|
|
22
23
|
async function login(ctx, args) {
|
|
23
24
|
const { values } = args;
|
|
25
|
+
// `--device`: operator sign-in through Atlas's own sign-in page (no key stored).
|
|
26
|
+
if (values.device === true)
|
|
27
|
+
return (0, operator_1.deviceLogin)(ctx, args);
|
|
24
28
|
const profile = (0, args_1.str)(values, 'profile') || 'default';
|
|
25
29
|
const apiUrl = (0, args_1.str)(values, 'url') ||
|
|
26
30
|
(await ctx.prompt.text('Atlas API URL', { default: backend_1.DEFAULT_API_URL })) ||
|
|
@@ -31,7 +35,7 @@ async function login(ctx, args) {
|
|
|
31
35
|
// Prove the credential before persisting it. A platform key (psk_, for
|
|
32
36
|
// `atlas init`) is proven against the platform API instead.
|
|
33
37
|
try {
|
|
34
|
-
if (secretKey.startsWith('psk_'))
|
|
38
|
+
if (secretKey.startsWith('psk_') || /^atlas_(live|test)_psk_/.test(secretKey))
|
|
35
39
|
await (0, project_1.httpFor)(ctx, { secretKey, apiUrl }).get('/v1/platform/apps');
|
|
36
40
|
else
|
|
37
41
|
await ctx.makeClient({ secretKey, apiUrl }).users.list({ limit: 1 });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":";;AAmBA,sBAsCC;AAOD,wBAkBC;AAOD,wBAkBC;AA3GD,gDAAoE;AACpE,kCAA+C;AAE/C,sCAAqC;AACrC,sCAAsC;AACtC,wCAAqC;AACrC,qCAA8D;AAC9D,yCAAyC;AAEzC;;;;;;;;;GASG;AACI,KAAK,UAAU,KAAK,CAAC,GAAe,EAAE,IAAgB;IAC3D,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACxB,iFAAiF;IACjF,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI;QAAE,OAAO,IAAA,sBAAW,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC1D,MAAM,OAAO,GAAG,IAAA,UAAG,EAAC,MAAM,EAAE,SAAS,CAAC,IAAI,SAAS,CAAC;IAEpD,MAAM,MAAM,GACV,IAAA,UAAG,EAAC,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AAC,CAAC,CAAC,CAAC;IACtD,CAAC;IACD,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEtB,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,0BAA0B,OAAO,IAAI,CAAC,CAAC;IAClD,OAAO,CAAC,CAAC;AACX,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,MAAM,CAAC,GAAe,EAAE,IAAgB;IAC5D,MAAM,IAAI,GAAG,IAAA,oBAAW,EAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAE3C,IAAI,IAAA,kBAAS,EAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3B,IAAA,kBAAS,EAAC,GAAG,CAAC,EAAE,EAAE;YAChB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,OAAO,EAAE,IAAI,CAAC,MAAM;YACpB,UAAU,EAAE,IAAA,mBAAU,EAAC,IAAI,CAAC,SAAS,CAAC;YACtC,UAAU,EAAE,IAAI,CAAC,SAAS;YAC1B,UAAU,EAAE,IAAI,CAAC,SAAS;SAC3B,CAAC,CAAC;QACH,OAAO,CAAC,CAAC;IACX,CAAC;IAED,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,eAAe,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IAC1C,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,eAAe,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;IAC7D,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,eAAe,IAAA,mBAAU,EAAC,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;IAC5E,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -2,6 +2,8 @@ import { type ParsedArgs, type Values } from '../args';
|
|
|
2
2
|
import { type ConfigHttp } from '../config-http';
|
|
3
3
|
import type { RunContext } from '../context';
|
|
4
4
|
import { type Format, type Json } from '../serialize';
|
|
5
|
+
/** A config document ready for disk / comparison: a plain, redacted JSON value. */
|
|
6
|
+
type Config = Json;
|
|
5
7
|
/** `atlas config export|import` — Auth0 `deploy-cli`-style config-as-code. */
|
|
6
8
|
export declare function config(ctx: RunContext, args: ParsedArgs): Promise<number>;
|
|
7
9
|
export declare function resolveFormat(values: Values): Format;
|
|
@@ -9,6 +11,10 @@ export interface Change {
|
|
|
9
11
|
type: string;
|
|
10
12
|
action: 'create' | 'update' | 'delete';
|
|
11
13
|
key: string;
|
|
14
|
+
/** The live document (absent on a create). Carried for `atlas config plan`'s field diff. */
|
|
15
|
+
before?: Config;
|
|
16
|
+
/** The desired document (absent on a delete). */
|
|
17
|
+
after?: Config;
|
|
12
18
|
}
|
|
13
19
|
/** A planned change and the call that applies it. */
|
|
14
20
|
export interface PlannedChange extends Change {
|
|
@@ -31,6 +37,14 @@ export declare function planConfigImport(http: ConfigHttp, opts: {
|
|
|
31
37
|
env: NodeJS.ProcessEnv;
|
|
32
38
|
prune: boolean;
|
|
33
39
|
}): Promise<ConfigPlan>;
|
|
40
|
+
/** One differing field between the live and the desired document. */
|
|
41
|
+
export interface FieldDiff {
|
|
42
|
+
path: string;
|
|
43
|
+
before?: Json;
|
|
44
|
+
after?: Json;
|
|
45
|
+
}
|
|
46
|
+
/** Leaf-level differences between two documents, as dotted paths (arrays compare whole). */
|
|
47
|
+
export declare function diffFields(before: Json | undefined, after: Json | undefined, path?: string): FieldDiff[];
|
|
34
48
|
export declare function printPlan(ctx: RunContext, changes: Change[], unchanged: number, skippedDeletes: Change[], opts: {
|
|
35
49
|
dryRun: boolean;
|
|
36
50
|
prune: boolean;
|
|
@@ -42,3 +56,4 @@ export declare function printPlan(ctx: RunContext, changes: Change[], unchanged:
|
|
|
42
56
|
* than silently blanking a credential.
|
|
43
57
|
*/
|
|
44
58
|
export declare function interpolate(value: Json, env: NodeJS.ProcessEnv): Json;
|
|
59
|
+
export {};
|
package/dist/commands/config.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.config = config;
|
|
4
4
|
exports.resolveFormat = resolveFormat;
|
|
5
5
|
exports.planConfigImport = planConfigImport;
|
|
6
|
+
exports.diffFields = diffFields;
|
|
6
7
|
exports.printPlan = printPlan;
|
|
7
8
|
exports.interpolate = interpolate;
|
|
8
9
|
const node_fs_1 = require("node:fs");
|
|
@@ -617,10 +618,12 @@ async function config(ctx, args) {
|
|
|
617
618
|
return exportConfig(ctx, args.values);
|
|
618
619
|
case 'import':
|
|
619
620
|
return importConfig(ctx, args.values);
|
|
621
|
+
case 'plan':
|
|
622
|
+
return planConfig(ctx, args.values);
|
|
620
623
|
default:
|
|
621
624
|
throw new errors_1.CliError(sub
|
|
622
|
-
? `Unknown subcommand 'config ${sub}'. Try: export, import.`
|
|
623
|
-
: 'config needs a subcommand: export, import.');
|
|
625
|
+
? `Unknown subcommand 'config ${sub}'. Try: export, import, plan.`
|
|
626
|
+
: 'config needs a subcommand: export, import, plan.');
|
|
624
627
|
}
|
|
625
628
|
}
|
|
626
629
|
function resolveFormat(values) {
|
|
@@ -698,7 +701,7 @@ async function planConfigImport(http, opts) {
|
|
|
698
701
|
unchanged += 1;
|
|
699
702
|
continue;
|
|
700
703
|
}
|
|
701
|
-
changes.push({ type: spec.type, action: live === null ? 'create' : 'update', key: '', apply: () => spec.apply(http, desired) });
|
|
704
|
+
changes.push({ type: spec.type, action: live === null ? 'create' : 'update', key: '', ...(live === null ? {} : { before: live }), after: desired, apply: () => spec.apply(http, desired) });
|
|
702
705
|
continue;
|
|
703
706
|
}
|
|
704
707
|
// Collection: diff desired-by-key against live-by-key.
|
|
@@ -711,14 +714,14 @@ async function planConfigImport(http, opts) {
|
|
|
711
714
|
for (const [key, cfg] of desiredByKey) {
|
|
712
715
|
const existing = liveByKey.get(key);
|
|
713
716
|
if (!existing) {
|
|
714
|
-
changes.push({ type: spec.type, action: 'create', key, apply: () => spec.create(http, cfg) });
|
|
717
|
+
changes.push({ type: spec.type, action: 'create', key, after: cfg, apply: () => spec.create(http, cfg) });
|
|
715
718
|
}
|
|
716
719
|
else if (!(0, serialize_1.deepEqual)(cfg, existing.config)) {
|
|
717
720
|
if (!spec.update) {
|
|
718
721
|
throw new errors_1.CliError(`${spec.type} '${key}' changed but is immutable; recreate it instead.`);
|
|
719
722
|
}
|
|
720
723
|
const upd = spec.update;
|
|
721
|
-
changes.push({ type: spec.type, action: 'update', key, apply: () => upd(http, existing, cfg) });
|
|
724
|
+
changes.push({ type: spec.type, action: 'update', key, before: existing.config, after: cfg, apply: () => upd(http, existing, cfg) });
|
|
722
725
|
}
|
|
723
726
|
else {
|
|
724
727
|
unchanged += 1;
|
|
@@ -727,7 +730,7 @@ async function planConfigImport(http, opts) {
|
|
|
727
730
|
for (const entry of live) {
|
|
728
731
|
if (desiredByKey.has(entry.key))
|
|
729
732
|
continue;
|
|
730
|
-
const change = { type: spec.type, action: 'delete', key: entry.key };
|
|
733
|
+
const change = { type: spec.type, action: 'delete', key: entry.key, before: entry.config };
|
|
731
734
|
if (!spec.remove) {
|
|
732
735
|
skippedDeletes.push(change);
|
|
733
736
|
continue;
|
|
@@ -761,6 +764,73 @@ async function importConfig(ctx, values) {
|
|
|
761
764
|
ctx.io.out('No changes to apply.');
|
|
762
765
|
return 0;
|
|
763
766
|
}
|
|
767
|
+
/** Leaf-level differences between two documents, as dotted paths (arrays compare whole). */
|
|
768
|
+
function diffFields(before, after, path = '') {
|
|
769
|
+
const isObj = (x) => x !== null && typeof x === 'object' && !Array.isArray(x);
|
|
770
|
+
if (isObj(before) && isObj(after)) {
|
|
771
|
+
const keys = [...new Set([...Object.keys(before), ...Object.keys(after)])].sort();
|
|
772
|
+
return keys.flatMap((k) => diffFields(before[k], after[k], path ? `${path}.${k}` : k));
|
|
773
|
+
}
|
|
774
|
+
if (before !== undefined && after !== undefined && (0, serialize_1.deepEqual)(before, after))
|
|
775
|
+
return [];
|
|
776
|
+
if (before === undefined && after === undefined)
|
|
777
|
+
return [];
|
|
778
|
+
return [{ path: path || '(document)', ...(before === undefined ? {} : { before }), ...(after === undefined ? {} : { after }) }];
|
|
779
|
+
}
|
|
780
|
+
const show = (v) => (v === undefined ? '(unset)' : typeof v === 'string' ? JSON.stringify(v) : JSON.stringify(v));
|
|
781
|
+
/**
|
|
782
|
+
* `atlas config plan`: a Terraform-style, read-only diff of a config directory
|
|
783
|
+
* (`atlas config export` output, committed to git) against the live instance.
|
|
784
|
+
* Field-level for updates, `--json` for tooling, and `--exit-code` to exit 2
|
|
785
|
+
* when there is drift so CI can gate on it. Never writes anything.
|
|
786
|
+
*/
|
|
787
|
+
async function planConfig(ctx, values) {
|
|
788
|
+
const http = requireHttp(ctx, values);
|
|
789
|
+
const dir = resolveDir(values);
|
|
790
|
+
const format = resolveFormat(values);
|
|
791
|
+
const prune = values.prune === true;
|
|
792
|
+
const plan = await planConfigImport(http, { dir, format, env: ctx.env, prune });
|
|
793
|
+
const deletes = prune ? [] : plan.skippedDeletes;
|
|
794
|
+
const all = plan.changes;
|
|
795
|
+
const rows = all.map((c) => ({
|
|
796
|
+
type: c.type,
|
|
797
|
+
key: c.key || null,
|
|
798
|
+
action: c.action,
|
|
799
|
+
fields: c.action === 'update' ? diffFields(c.before, c.after) : [],
|
|
800
|
+
}));
|
|
801
|
+
const pending = rows.length;
|
|
802
|
+
if (values.json === true) {
|
|
803
|
+
ctx.io.out(JSON.stringify({
|
|
804
|
+
object: 'config_plan',
|
|
805
|
+
changes: rows,
|
|
806
|
+
unchanged: plan.unchanged,
|
|
807
|
+
unmanaged_live: deletes.map((d) => ({ type: d.type, key: d.key || null })),
|
|
808
|
+
has_changes: pending > 0,
|
|
809
|
+
}, null, 2));
|
|
810
|
+
}
|
|
811
|
+
else {
|
|
812
|
+
ctx.io.out(`Plan: ${pending} to change, ${plan.unchanged} unchanged${deletes.length ? `, ${deletes.length} live but not in config` : ''}.`);
|
|
813
|
+
const sign = { create: '+', update: '~', delete: '-' };
|
|
814
|
+
for (const c of [...all].sort(sortChange)) {
|
|
815
|
+
const label = c.key ? `${c.type} ${c.key}` : c.type;
|
|
816
|
+
ctx.io.out('');
|
|
817
|
+
ctx.io.out(`${sign[c.action]} ${label} (${c.action})`);
|
|
818
|
+
if (c.action === 'update') {
|
|
819
|
+
for (const f of diffFields(c.before, c.after))
|
|
820
|
+
ctx.io.out(` ${f.path}: ${show(f.before)} -> ${show(f.after)}`);
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
if (deletes.length) {
|
|
824
|
+
ctx.io.out('');
|
|
825
|
+
ctx.io.out(`Live but not in ${dir} (kept; pass --prune to plan their deletion):`);
|
|
826
|
+
for (const d of deletes)
|
|
827
|
+
ctx.io.out(` ${d.type}${d.key ? ` ${d.key}` : ''}`);
|
|
828
|
+
}
|
|
829
|
+
if (pending === 0)
|
|
830
|
+
ctx.io.out('No drift: the instance matches the config directory.');
|
|
831
|
+
}
|
|
832
|
+
return values['exit-code'] === true && pending > 0 ? 2 : 0;
|
|
833
|
+
}
|
|
764
834
|
function printPlan(ctx, changes, unchanged, skippedDeletes, opts) {
|
|
765
835
|
const heading = opts.dryRun ? 'Plan (dry run — nothing applied):' : 'Plan:';
|
|
766
836
|
ctx.io.out(heading);
|