@seamapi/cli 0.20.0 → 0.21.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/lib/auth/operations.d.ts +0 -11
- package/lib/auth/operations.js +0 -15
- package/lib/auth/operations.js.map +1 -1
- package/lib/interactions/endpoint-selection.js +5 -23
- package/lib/interactions/endpoint-selection.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/src/lib/auth/operations.ts +0 -25
- package/src/lib/interactions/endpoint-selection.ts +5 -29
- package/src/lib/version.ts +1 -1
package/lib/auth/operations.d.ts
CHANGED
|
@@ -39,16 +39,5 @@ export declare const logout: (config?: ConfigStore) => void;
|
|
|
39
39
|
export declare const selectEndpoint: (endpoint: string, config?: ConfigStore) => void;
|
|
40
40
|
/** Store the workspace requests are made against. */
|
|
41
41
|
export declare const selectWorkspace: (workspaceId: string, config?: ConfigStore) => void;
|
|
42
|
-
/**
|
|
43
|
-
* Point the CLI at a fake Seam Connect endpoint and store the well-known
|
|
44
|
-
* token it accepts. Returns the generated endpoint URL for reporting.
|
|
45
|
-
*/
|
|
46
|
-
export declare const selectFakeEndpoint: ({ urlSeed, config, }?: {
|
|
47
|
-
urlSeed?: string;
|
|
48
|
-
config?: ConfigStore;
|
|
49
|
-
}) => {
|
|
50
|
-
endpoint: string;
|
|
51
|
-
token: string;
|
|
52
|
-
};
|
|
53
42
|
/** Store whether API definitions come from the endpoint instead of npm. */
|
|
54
43
|
export declare const setUseRemoteApiDefs: (useRemoteApiDefs: boolean, config?: ConfigStore) => void;
|
package/lib/auth/operations.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { randomBytes } from 'node:crypto';
|
|
2
1
|
import { getConfigStore } from '../config/index.js';
|
|
3
2
|
import { resolveAuth } from '../context.js';
|
|
4
3
|
import { assertEnvVarUnset, endpointEnvVar, tokenEnvVar, workspaceIdEnvVar, } from '../env.js';
|
|
@@ -91,20 +90,6 @@ export const selectWorkspace = (workspaceId, config = getConfigStore()) => {
|
|
|
91
90
|
assertMutable(resolveAuth(config), 'workspaceId', 'select a workspace');
|
|
92
91
|
config.set('current_workspace_id', workspaceId);
|
|
93
92
|
};
|
|
94
|
-
/**
|
|
95
|
-
* Point the CLI at a fake Seam Connect endpoint and store the well-known
|
|
96
|
-
* token it accepts. Returns the generated endpoint URL for reporting.
|
|
97
|
-
*/
|
|
98
|
-
export const selectFakeEndpoint = ({ urlSeed = randomBytes(5).toString('hex'), config = getConfigStore(), } = {}) => {
|
|
99
|
-
const auth = resolveAuth(config);
|
|
100
|
-
assertMutable(auth, 'endpoint', 'select an endpoint');
|
|
101
|
-
assertMutable(auth, 'token', 'log in');
|
|
102
|
-
const endpoint = `https://${urlSeed}.fakeseamconnect.seam.vc`;
|
|
103
|
-
const token = 'seam_apikey1_token';
|
|
104
|
-
storeEndpoint(endpoint, config);
|
|
105
|
-
config.set(`${endpoint}.pat`, token);
|
|
106
|
-
return { endpoint, token };
|
|
107
|
-
};
|
|
108
93
|
/** Store whether API definitions come from the endpoint instead of npm. */
|
|
109
94
|
export const setUseRemoteApiDefs = (useRemoteApiDefs, config = getConfigStore()) => {
|
|
110
95
|
config.set('use_remote_api_defs', useRemoteApiDefs);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../src/lib/auth/operations.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../src/lib/auth/operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACtE,OAAO,EAAoB,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,iBAAiB,GAClB,MAAM,YAAY,CAAA;AAEnB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AA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A;AACvC,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,QAAgB,EAChB,SAAsB,cAAc,EAAE,EAChC,EAAE;IACR,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,oBAAoB,CAAC,CAAA;IACpE,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;AACjC,CAAC,CAAA;AAED,qDAAqD;AACrD,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,WAAmB,EACnB,SAAsB,cAAc,EAAE,EAChC,EAAE;IACR,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,aAAa,EAAE,oBAAoB,CAAC,CAAA;IACvE,MAAM,CAAC,GAAG,CAAC,sBAAsB,EAAE,WAAW,CAAC,CAAA;AACjD,CAAC,CAAA;AAED,2EAA2E;AAC3E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,gBAAyB,EACzB,SAAsB,cAAc,EAAE,EAChC,EAAE;IACR,MAAM,CAAC,GAAG,CAAC,qBAAqB,EAAE,gBAAgB,CAAC,CAAA;AACrD,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,aAAa,GAAG,CAAC,QAAgB,EAAE,MAAmB,EAAQ,EAAE;IACpE,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;IAChC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IACvB,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAA;AACvC,CAAC,CAAA"}
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { assertMutable, selectEndpoint, selectFakeEndpoint, } from '../auth/operations.js';
|
|
1
|
+
import { assertMutable, selectEndpoint } from '../auth/operations.js';
|
|
3
2
|
import { getConfigStore } from '../config/index.js';
|
|
4
3
|
import { resolveAuth } from '../context.js';
|
|
5
4
|
import { getOutput } from '../output/get-output.js';
|
|
6
|
-
import { promptAutocomplete
|
|
5
|
+
import { promptAutocomplete } from '../prompt.js';
|
|
7
6
|
export async function interactForEndpointSelection() {
|
|
8
7
|
const config = getConfigStore();
|
|
9
8
|
assertMutable(resolveAuth(config), 'endpoint', 'select an endpoint');
|
|
10
|
-
const endpoints = [
|
|
11
|
-
'http://localhost:3020',
|
|
12
|
-
'https://connect.getseam.com',
|
|
13
|
-
'https://fakeseamconnect.seam.vc',
|
|
14
|
-
];
|
|
9
|
+
const endpoints = ['http://localhost:3020', 'https://connect.getseam.com'];
|
|
15
10
|
// Searchable, as selecting a device or a command is.
|
|
16
11
|
const endpoint = await promptAutocomplete({
|
|
17
12
|
message: 'Select an endpoint:',
|
|
@@ -20,20 +15,7 @@ export async function interactForEndpointSelection() {
|
|
|
20
15
|
value: endpoint,
|
|
21
16
|
})),
|
|
22
17
|
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
let userUrlSeed = await promptText({
|
|
26
|
-
message: 'You can input a custom endpoint URL or leave this field empty to use a new fakeserver.',
|
|
27
|
-
});
|
|
28
|
-
if (userUrlSeed.trim().length === 0) {
|
|
29
|
-
userUrlSeed = randomBytes(5).toString('hex');
|
|
30
|
-
}
|
|
31
|
-
selectFakeEndpoint({ urlSeed: userUrlSeed, config });
|
|
32
|
-
output.info(`PAT set to use fakeseamconnect with "seam_apikey1_token"`);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
selectEndpoint(endpoint, config);
|
|
36
|
-
}
|
|
37
|
-
output.info(`Endpoint set to ${endpoint}`);
|
|
18
|
+
selectEndpoint(endpoint, config);
|
|
19
|
+
getOutput().info(`Endpoint set to ${endpoint}`);
|
|
38
20
|
}
|
|
39
21
|
//# sourceMappingURL=endpoint-selection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-selection.js","sourceRoot":"","sources":["../../src/lib/interactions/endpoint-selection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"endpoint-selection.js","sourceRoot":"","sources":["../../src/lib/interactions/endpoint-selection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAElD,MAAM,CAAC,KAAK,UAAU,4BAA4B;IAChD,MAAM,MAAM,GAAG,cAAc,EAAE,CAAA;IAC/B,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,oBAAoB,CAAC,CAAA;IAEpE,MAAM,SAAS,GAAG,CAAC,uBAAuB,EAAE,6BAA6B,CAAC,CAAA;IAE1E,qDAAqD;IACrD,MAAM,QAAQ,GAAG,MAAM,kBAAkB,CAAC;QACxC,OAAO,EAAE,qBAAqB;QAC9B,OAAO,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YACpC,KAAK,EAAE,QAAQ;YACf,KAAK,EAAE,QAAQ;SAChB,CAAC,CAAC;KACJ,CAAC,CAAA;IAEF,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;IAChC,SAAS,EAAE,CAAC,IAAI,CAAC,mBAAmB,QAAQ,EAAE,CAAC,CAAA;AACjD,CAAC"}
|
package/lib/version.d.ts
CHANGED
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { randomBytes } from 'node:crypto'
|
|
2
|
-
|
|
3
1
|
import { type ConfigStore, getConfigStore } from 'lib/config/index.js'
|
|
4
2
|
import { type AuthContext, resolveAuth } from 'lib/context.js'
|
|
5
3
|
import {
|
|
@@ -134,29 +132,6 @@ export const selectWorkspace = (
|
|
|
134
132
|
config.set('current_workspace_id', workspaceId)
|
|
135
133
|
}
|
|
136
134
|
|
|
137
|
-
/**
|
|
138
|
-
* Point the CLI at a fake Seam Connect endpoint and store the well-known
|
|
139
|
-
* token it accepts. Returns the generated endpoint URL for reporting.
|
|
140
|
-
*/
|
|
141
|
-
export const selectFakeEndpoint = ({
|
|
142
|
-
urlSeed = randomBytes(5).toString('hex'),
|
|
143
|
-
config = getConfigStore(),
|
|
144
|
-
}: {
|
|
145
|
-
urlSeed?: string
|
|
146
|
-
config?: ConfigStore
|
|
147
|
-
} = {}): { endpoint: string; token: string } => {
|
|
148
|
-
const auth = resolveAuth(config)
|
|
149
|
-
assertMutable(auth, 'endpoint', 'select an endpoint')
|
|
150
|
-
assertMutable(auth, 'token', 'log in')
|
|
151
|
-
|
|
152
|
-
const endpoint = `https://${urlSeed}.fakeseamconnect.seam.vc`
|
|
153
|
-
const token = 'seam_apikey1_token'
|
|
154
|
-
storeEndpoint(endpoint, config)
|
|
155
|
-
config.set(`${endpoint}.pat`, token)
|
|
156
|
-
|
|
157
|
-
return { endpoint, token }
|
|
158
|
-
}
|
|
159
|
-
|
|
160
135
|
/** Store whether API definitions come from the endpoint instead of npm. */
|
|
161
136
|
export const setUseRemoteApiDefs = (
|
|
162
137
|
useRemoteApiDefs: boolean,
|
|
@@ -1,24 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
assertMutable,
|
|
5
|
-
selectEndpoint,
|
|
6
|
-
selectFakeEndpoint,
|
|
7
|
-
} from 'lib/auth/operations.js'
|
|
1
|
+
import { assertMutable, selectEndpoint } from 'lib/auth/operations.js'
|
|
8
2
|
import { getConfigStore } from 'lib/config/index.js'
|
|
9
3
|
import { resolveAuth } from 'lib/context.js'
|
|
10
4
|
import { getOutput } from 'lib/output/get-output.js'
|
|
11
|
-
import { promptAutocomplete
|
|
5
|
+
import { promptAutocomplete } from 'lib/prompt.js'
|
|
12
6
|
|
|
13
7
|
export async function interactForEndpointSelection() {
|
|
14
8
|
const config = getConfigStore()
|
|
15
9
|
assertMutable(resolveAuth(config), 'endpoint', 'select an endpoint')
|
|
16
10
|
|
|
17
|
-
const endpoints = [
|
|
18
|
-
'http://localhost:3020',
|
|
19
|
-
'https://connect.getseam.com',
|
|
20
|
-
'https://fakeseamconnect.seam.vc',
|
|
21
|
-
]
|
|
11
|
+
const endpoints = ['http://localhost:3020', 'https://connect.getseam.com']
|
|
22
12
|
|
|
23
13
|
// Searchable, as selecting a device or a command is.
|
|
24
14
|
const endpoint = await promptAutocomplete({
|
|
@@ -29,20 +19,6 @@ export async function interactForEndpointSelection() {
|
|
|
29
19
|
})),
|
|
30
20
|
})
|
|
31
21
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
let userUrlSeed = await promptText({
|
|
35
|
-
message:
|
|
36
|
-
'You can input a custom endpoint URL or leave this field empty to use a new fakeserver.',
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
if (userUrlSeed.trim().length === 0) {
|
|
40
|
-
userUrlSeed = randomBytes(5).toString('hex')
|
|
41
|
-
}
|
|
42
|
-
selectFakeEndpoint({ urlSeed: userUrlSeed, config })
|
|
43
|
-
output.info(`PAT set to use fakeseamconnect with "seam_apikey1_token"`)
|
|
44
|
-
} else {
|
|
45
|
-
selectEndpoint(endpoint, config)
|
|
46
|
-
}
|
|
47
|
-
output.info(`Endpoint set to ${endpoint}`)
|
|
22
|
+
selectEndpoint(endpoint, config)
|
|
23
|
+
getOutput().info(`Endpoint set to ${endpoint}`)
|
|
48
24
|
}
|
package/src/lib/version.ts
CHANGED