@sequenceholdings/studio-cli 0.1.13 → 0.1.18
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 +94 -30
- package/dist/artifact/delegate.d.ts +2 -2
- package/dist/artifact/delegate.js +31 -73
- package/dist/atlas-client.js +52 -37
- package/dist/auth-cmds/commands.d.ts +1 -1
- package/dist/auth-cmds/commands.js +12 -7
- package/dist/auth.d.ts +97 -19
- package/dist/auth.js +376 -81
- package/dist/config.d.ts +3 -3
- package/dist/config.js +18 -13
- package/dist/env-catalog.js +13 -3
- package/dist/env-flags.d.ts +2 -0
- package/dist/env-flags.js +2 -0
- package/dist/env-registry.d.ts +27 -0
- package/dist/env-registry.js +204 -0
- package/dist/envs/commands.d.ts +1 -1
- package/dist/envs/commands.js +41 -3
- package/dist/file-lock.d.ts +5 -0
- package/dist/file-lock.js +187 -0
- package/dist/functions/commands.d.ts +9 -1
- package/dist/functions/commands.js +71 -29
- package/dist/functions/manifest.d.ts +1 -0
- package/dist/functions/manifest.js +36 -0
- package/dist/login.d.ts +8 -3
- package/dist/login.js +46 -34
- package/dist/main.d.ts +2 -1
- package/dist/main.js +35 -12
- package/dist/orm/delegate.js +15 -2
- package/dist/pat-hints.js +2 -2
- package/dist/pipeline/commands.d.ts +58 -0
- package/dist/pipeline/commands.js +330 -0
- package/dist/pipeline/lifecycle.d.ts +58 -0
- package/dist/pipeline/lifecycle.js +348 -0
- package/dist/pipeline/pinning.d.ts +5 -0
- package/dist/pipeline/pinning.js +9 -0
- package/dist/pipeline/templates.d.ts +11 -0
- package/dist/pipeline/templates.js +166 -0
- package/dist/process/build.d.ts +4 -0
- package/dist/process/build.js +31 -1
- package/dist/process/codegen.js +19 -1
- package/dist/process/commands.js +97 -47
- package/dist/process/compiler-subprocess.d.ts +29 -0
- package/dist/process/compiler-subprocess.js +99 -0
- package/dist/process/compiler-worker.d.ts +1 -0
- package/dist/process/compiler-worker.js +38 -0
- package/dist/process/lint.d.ts +8 -0
- package/dist/process/lint.js +76 -29
- package/dist/process/repo-install.js +18 -2
- package/dist/repos/commands.d.ts +1 -1
- package/dist/repos/commands.js +17 -12
- package/dist/secrets/commands.d.ts +1 -1
- package/dist/secrets/commands.js +18 -18
- package/package.json +8 -3
package/dist/auth.d.ts
CHANGED
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
* cloud agents with no interactive login can still push.
|
|
11
11
|
* (M2M carries app scopes but NO user identity / workspace membership
|
|
12
12
|
* — see the `atlas-test-access` rule.)
|
|
13
|
-
* 2. Cached user token — read from the seqapi token file
|
|
14
|
-
*
|
|
13
|
+
* 2. Cached user access token — read from the seqapi token file. When it
|
|
14
|
+
* expires, an interactive session performs a bounded PKCE login again.
|
|
15
15
|
*
|
|
16
|
-
* Login
|
|
16
|
+
* Login writes the shared file. This mirrors
|
|
17
17
|
* `seqapi._save_tokens` exactly:
|
|
18
18
|
* same fields, same shape, same 0o600 permissions, atomic write via
|
|
19
19
|
* tmpfile + rename. The M2M token is in-memory only (never persisted).
|
|
@@ -21,11 +21,50 @@
|
|
|
21
21
|
export declare const AUTH0_DOMAIN = "dev-n1t8ts403fp8oyxp.us.auth0.com";
|
|
22
22
|
export declare const AUTH0_CLIENT_ID = "GD9riCDWocfc66odpWBjwBiX43qqAX8r";
|
|
23
23
|
export declare const AUTH0_AUDIENCE = "https://api.studio.com";
|
|
24
|
+
/** The realm name the built-in Sequence environments' tokens live under —
|
|
25
|
+
* also the implicit realm of the legacy flat fields in tokens.json. */
|
|
26
|
+
export declare const SEQUENCE_REALM = "sequence";
|
|
27
|
+
export declare function isSequenceAuthEnvName(envName: string): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* One Auth0 login context. Mirrors seqapi's `AuthRealm`
|
|
30
|
+
* (`shared/seqapi/seqapi/config.py`): the Sequence realm is hard-coded;
|
|
31
|
+
* OpCo-environment realms are read from seqapi's config.json registry,
|
|
32
|
+
* written by `seq-studio envs add` or `seqapi env add` — both CLIs share one
|
|
33
|
+
* registry and one token file, so either can log in and the other picks the
|
|
34
|
+
* session up.
|
|
35
|
+
*/
|
|
36
|
+
export interface AuthRealm {
|
|
37
|
+
name: string;
|
|
38
|
+
domain: string;
|
|
39
|
+
clientId: string;
|
|
40
|
+
audience: string;
|
|
41
|
+
organization?: string;
|
|
42
|
+
m2mClientId?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A discovery response is not a trust anchor for the host that receives an
|
|
46
|
+
* M2M client secret. Even another valid *.auth0.com tenant is untrusted;
|
|
47
|
+
* additional Auth0 tenants/custom domains require an explicit code-reviewed
|
|
48
|
+
* allowlist entry.
|
|
49
|
+
*/
|
|
50
|
+
export declare function validateAuth0Domain(domain: string): string;
|
|
51
|
+
export declare const SEQUENCE_AUTH_REALM: AuthRealm;
|
|
24
52
|
export interface SeqapiTokens {
|
|
25
|
-
refresh_token?: string;
|
|
26
53
|
access_token?: string;
|
|
27
54
|
expires_at?: number;
|
|
28
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Resolve the auth realm for an environment name. Undefined, built-ins, and
|
|
58
|
+
* per-PR preview targets map to the shared Sequence realm. Preview URLs are
|
|
59
|
+
* constrained to Sequence's preview domain by the environment resolver. Every
|
|
60
|
+
* other explicit name must have a valid seqapi registry entry; otherwise fail
|
|
61
|
+
* closed so a shared Sequence bearer token can never be sent to a tenant URL.
|
|
62
|
+
*/
|
|
63
|
+
export declare function realmForEnv(envName?: string): Promise<AuthRealm>;
|
|
64
|
+
/** Env var(s) carrying a realm's M2M client secret — the Sequence realm keeps
|
|
65
|
+
* the legacy bare name; OpCo realms use a suffixed name so one shell can hold
|
|
66
|
+
* several credentials unambiguously. Mirrors seqapi's `_m2m_secret_env_names`. */
|
|
67
|
+
export declare function m2mSecretEnvName(realm: AuthRealm): string;
|
|
29
68
|
/**
|
|
30
69
|
* A configured M2M credential failed to mint a token. Typed so callers that
|
|
31
70
|
* normally swallow discovery errors (lazy catalog refresh) can still surface
|
|
@@ -38,38 +77,77 @@ export declare function seqapiTokenDir(): string;
|
|
|
38
77
|
export declare function seqapiTokenPath(): string;
|
|
39
78
|
export declare class NotLoggedInError extends Error {
|
|
40
79
|
readonly name = "NotLoggedInError";
|
|
41
|
-
constructor();
|
|
80
|
+
constructor(realmName?: string, reason?: string);
|
|
42
81
|
}
|
|
43
82
|
/**
|
|
44
|
-
* Return a valid access token
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* resolve the same identity for the same
|
|
83
|
+
* Return a valid access token for an environment's auth realm. Tries the
|
|
84
|
+
* realm's M2M service account first (secret env var), then falls back to the
|
|
85
|
+
* cached user access token. Expired user sessions perform bounded PKCE login
|
|
86
|
+
* when browser auto-login is enabled. Same precedence and token file as seqapi's
|
|
87
|
+
* `get_access_token`, so both CLIs resolve the same identity for the same
|
|
88
|
+
* environment. No `env` (or a built-in Sequence env) means the shared
|
|
89
|
+
* Sequence realm — the legacy behavior every existing caller gets unchanged.
|
|
49
90
|
*/
|
|
50
|
-
export declare
|
|
91
|
+
export declare class UnsafeAuthTargetError extends Error {
|
|
92
|
+
}
|
|
93
|
+
export type AuthMode = 'm2m' | 'user';
|
|
94
|
+
export interface ResolvedAccessToken {
|
|
95
|
+
authMode: AuthMode;
|
|
96
|
+
token: string;
|
|
97
|
+
}
|
|
98
|
+
export declare function getAccessTokenWithMode(options?: {
|
|
99
|
+
/** Disable browser PKCE fallback for probe-only and other non-interactive callers. */
|
|
100
|
+
allowInteractiveLogin?: boolean;
|
|
101
|
+
env?: string;
|
|
102
|
+
targetUrl?: string;
|
|
103
|
+
}): Promise<ResolvedAccessToken>;
|
|
104
|
+
export declare function getAccessToken(options?: {
|
|
105
|
+
/** Disable browser PKCE fallback for probe-only and other non-interactive callers. */
|
|
106
|
+
allowInteractiveLogin?: boolean;
|
|
107
|
+
env?: string;
|
|
108
|
+
targetUrl?: string;
|
|
109
|
+
}): Promise<string>;
|
|
51
110
|
/**
|
|
52
111
|
* Try to load a token without throwing. Returns `null` for any error
|
|
53
112
|
* condition (missing file, parse error, no token fields). Used by
|
|
54
113
|
* `doctor` for non-fatal "are you logged in?" checks.
|
|
55
114
|
*/
|
|
56
|
-
export declare function
|
|
115
|
+
export declare function tryGetAccessTokenWithMode(options?: {
|
|
57
116
|
/**
|
|
58
117
|
* When the M2M secret is configured, failing to mint an M2M token should fail
|
|
59
118
|
* closed (avoid silently falling back to some other cached identity).
|
|
60
119
|
*/
|
|
61
120
|
failClosedForM2m?: boolean;
|
|
121
|
+
/** Environment name — selects the auth realm (default: Sequence). */
|
|
122
|
+
env?: string;
|
|
123
|
+
/** Resolved request origin — checked against the realm before returning credentials. */
|
|
124
|
+
targetUrl?: string;
|
|
125
|
+
}): Promise<ResolvedAccessToken | null>;
|
|
126
|
+
export declare function tryGetAccessToken(options?: {
|
|
127
|
+
failClosedForM2m?: boolean;
|
|
128
|
+
env?: string;
|
|
129
|
+
targetUrl?: string;
|
|
62
130
|
}): Promise<string | null>;
|
|
63
131
|
/**
|
|
64
|
-
*
|
|
65
|
-
* server
|
|
66
|
-
*
|
|
132
|
+
* Refuse to persist a token minted for another audience or Auth0
|
|
133
|
+
* organization. Auth0/server-side JWT verification remains authoritative;
|
|
134
|
+
* this local decode is only a cross-realm confusion check on a token received
|
|
135
|
+
* directly from the configured Auth0 tenant over TLS.
|
|
67
136
|
*/
|
|
137
|
+
export declare function verifyTokenMatchesRealm({ accessToken, realm, requireOrganization, }: {
|
|
138
|
+
accessToken: string;
|
|
139
|
+
realm: AuthRealm;
|
|
140
|
+
requireOrganization?: boolean;
|
|
141
|
+
}): void;
|
|
68
142
|
export declare function decodeJwtSub(token: string): string | null;
|
|
69
143
|
/**
|
|
70
144
|
* The Auth0 subject the CLI would authenticate as right now, without any
|
|
71
|
-
* network call: the
|
|
72
|
-
* else the `sub` of
|
|
145
|
+
* network call: the requested realm's M2M client subject when its secret is
|
|
146
|
+
* configured, else the `sub` of that realm's cached user token, else null.
|
|
73
147
|
*/
|
|
74
|
-
export declare function currentIdentitySubject(
|
|
75
|
-
|
|
148
|
+
export declare function currentIdentitySubject(options?: {
|
|
149
|
+
env?: string;
|
|
150
|
+
}): Promise<string | null>;
|
|
151
|
+
export declare function loadCachedUserTokens(realmName?: string): Promise<SeqapiTokens | null>;
|
|
152
|
+
export declare function saveTokens(tokens: SeqapiTokens, realmName?: string): Promise<void>;
|
|
153
|
+
export declare function deleteRealmTokens(realmName: string): Promise<void>;
|