@seamapi/cli 0.19.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.
Files changed (69) hide show
  1. package/README.md +4 -4
  2. package/bin/cli.js +2 -2
  3. package/bin/cli.js.map +1 -1
  4. package/lib/auth/operations.d.ts +10 -21
  5. package/lib/auth/operations.js +30 -38
  6. package/lib/auth/operations.js.map +1 -1
  7. package/lib/auth/validate-token.js +1 -1
  8. package/lib/auth/validate-token.js.map +1 -1
  9. package/lib/blueprint/index.d.ts +1 -1
  10. package/lib/blueprint/index.js +2 -2
  11. package/lib/blueprint/index.js.map +1 -1
  12. package/lib/blueprint/source-remote.d.ts +2 -2
  13. package/lib/blueprint/source-remote.js +3 -3
  14. package/lib/blueprint/source-remote.js.map +1 -1
  15. package/lib/commands/local/login.js +3 -3
  16. package/lib/commands/local/login.js.map +1 -1
  17. package/lib/commands/local/{select-server.d.ts → select-endpoint.d.ts} +1 -1
  18. package/lib/commands/local/select-endpoint.js +27 -0
  19. package/lib/commands/local/select-endpoint.js.map +1 -0
  20. package/lib/commands/registry.js +2 -4
  21. package/lib/commands/registry.js.map +1 -1
  22. package/lib/context.d.ts +5 -5
  23. package/lib/context.js +9 -7
  24. package/lib/context.js.map +1 -1
  25. package/lib/env.d.ts +2 -2
  26. package/lib/env.js +2 -2
  27. package/lib/env.js.map +1 -1
  28. package/lib/http/client.js +2 -2
  29. package/lib/http/client.js.map +1 -1
  30. package/lib/interactions/endpoint-selection.d.ts +1 -0
  31. package/lib/interactions/endpoint-selection.js +21 -0
  32. package/lib/interactions/endpoint-selection.js.map +1 -0
  33. package/lib/interactions/index.d.ts +1 -1
  34. package/lib/interactions/index.js +1 -1
  35. package/lib/interactions/index.js.map +1 -1
  36. package/lib/interactions/login.js +2 -2
  37. package/lib/interactions/login.js.map +1 -1
  38. package/lib/interactions/workspace-id.js +1 -1
  39. package/lib/interactions/workspace-id.js.map +1 -1
  40. package/lib/version.d.ts +1 -1
  41. package/lib/version.js +1 -1
  42. package/package.json +1 -1
  43. package/src/bin/cli.ts +2 -2
  44. package/src/lib/auth/operations.ts +34 -51
  45. package/src/lib/auth/validate-token.ts +1 -1
  46. package/src/lib/blueprint/index.ts +3 -3
  47. package/src/lib/blueprint/source-remote.ts +3 -3
  48. package/src/lib/commands/local/login.ts +3 -3
  49. package/src/lib/commands/local/select-endpoint.ts +30 -0
  50. package/src/lib/commands/registry.ts +2 -4
  51. package/src/lib/context.ts +17 -13
  52. package/src/lib/env.ts +2 -2
  53. package/src/lib/http/client.ts +2 -2
  54. package/src/lib/interactions/endpoint-selection.ts +24 -0
  55. package/src/lib/interactions/index.ts +1 -1
  56. package/src/lib/interactions/login.ts +2 -2
  57. package/src/lib/interactions/workspace-id.ts +1 -1
  58. package/src/lib/version.ts +1 -1
  59. package/lib/commands/local/config-set-fake-server.d.ts +0 -3
  60. package/lib/commands/local/config-set-fake-server.js +0 -20
  61. package/lib/commands/local/config-set-fake-server.js.map +0 -1
  62. package/lib/commands/local/select-server.js +0 -27
  63. package/lib/commands/local/select-server.js.map +0 -1
  64. package/lib/interactions/server-selection.d.ts +0 -1
  65. package/lib/interactions/server-selection.js +0 -36
  66. package/lib/interactions/server-selection.js.map +0 -1
  67. package/src/lib/commands/local/config-set-fake-server.ts +0 -21
  68. package/src/lib/commands/local/select-server.ts +0 -30
  69. package/src/lib/interactions/server-selection.ts +0 -45
@@ -1,5 +1,5 @@
1
1
  // Versions are replaced with generated values when the package is packed.
2
- const seamapiCliVersion = '0.19.0'
2
+ const seamapiCliVersion = '0.21.0'
3
3
  const seamapiBlueprintVersion = '1.5.0'
4
4
 
5
5
  export { seamapiBlueprintVersion }
@@ -1,3 +0,0 @@
1
- import type { Command } from '../../commands/registry.js';
2
- /** Hidden: a development shortcut, kept out of help and completion. */
3
- export declare const configSetFakeServerCommand: Command;
@@ -1,20 +0,0 @@
1
- import { selectFakeServer } from '../../auth/operations.js';
2
- /** Hidden: a development shortcut, kept out of help and completion. */
3
- export const configSetFakeServerCommand = {
4
- definition: {
5
- path: ['config', 'set', 'fake-server'],
6
- kind: 'cli',
7
- title: 'Point the CLI at a fake Seam Connect server.',
8
- description: '',
9
- flags: [],
10
- },
11
- requiresAuth: false,
12
- hidden: true,
13
- execute: async (_invocation, ctx) => {
14
- const { server } = selectFakeServer({ config: ctx.config });
15
- ctx.output.info(`Server URL set to ${server}`);
16
- ctx.output.info(`PAT set to use fakeseamconnect with "seam_apikey1_token"`);
17
- return { kind: 'done' };
18
- },
19
- };
20
- //# sourceMappingURL=config-set-fake-server.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-set-fake-server.js","sourceRoot":"","sources":["../../../src/lib/commands/local/config-set-fake-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAGzD,uEAAuE;AACvE,MAAM,CAAC,MAAM,0BAA0B,GAAY;IACjD,UAAU,EAAE;QACV,IAAI,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,aAAa,CAAC;QACtC,IAAI,EAAE,KAAK;QACX,KAAK,EAAE,8CAA8C;QACrD,WAAW,EAAE,EAAE;QACf,KAAK,EAAE,EAAE;KACV;IACD,YAAY,EAAE,KAAK;IACnB,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,EAAE;QAClC,MAAM,EAAE,MAAM,EAAE,GAAG,gBAAgB,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAA;QAC3D,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,MAAM,EAAE,CAAC,CAAA;QAC9C,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,0DAA0D,CAAC,CAAA;QAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA;IACzB,CAAC;CACF,CAAA"}
@@ -1,27 +0,0 @@
1
- import { assertMutable, selectServer } from '../../auth/operations.js';
2
- import { stringFlag } from '../../commands/spec.js';
3
- import { NonInteractiveError } from '../../errors.js';
4
- import { interactForServerSelection } from '../../interactions/index.js';
5
- export const selectServerCommand = {
6
- definition: {
7
- path: ['select', 'server'],
8
- kind: 'cli',
9
- title: 'Select the Seam API server.',
10
- description: '',
11
- flags: [stringFlag('server', 'Seam API server to select.')],
12
- },
13
- requiresAuth: false,
14
- execute: async ({ args }, ctx) => {
15
- assertMutable(ctx.auth, 'server', 'select a server');
16
- if (args['server']) {
17
- selectServer(args['server'], ctx.config);
18
- return { kind: 'done' };
19
- }
20
- if (ctx.interactivity === 'non-interactive') {
21
- throw new NonInteractiveError('Missing required parameter for select server: --server');
22
- }
23
- await interactForServerSelection();
24
- return { kind: 'done' };
25
- },
26
- };
27
- //# sourceMappingURL=select-server.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"select-server.js","sourceRoot":"","sources":["../../../src/lib/commands/local/select-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAA;AAEtE,MAAM,CAAC,MAAM,mBAAmB,GAAY;IAC1C,UAAU,EAAE;QACV,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;QAC1B,IAAI,EAAE,KAAK;QACX,KAAK,EAAE,6BAA6B;QACpC,WAAW,EAAE,EAAE;QACf,KAAK,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,4BAA4B,CAAC,CAAC;KAC5D;IACD,YAAY,EAAE,KAAK;IACnB,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE;QAC/B,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAA;QACpD,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YACnB,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;YACxC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA;QACzB,CAAC;QACD,IAAI,GAAG,CAAC,aAAa,KAAK,iBAAiB,EAAE,CAAC;YAC5C,MAAM,IAAI,mBAAmB,CAC3B,wDAAwD,CACzD,CAAA;QACH,CAAC;QACD,MAAM,0BAA0B,EAAE,CAAA;QAClC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA;IACzB,CAAC;CACF,CAAA"}
@@ -1 +0,0 @@
1
- export declare function interactForServerSelection(): Promise<void>;
@@ -1,36 +0,0 @@
1
- import { randomBytes } from 'node:crypto';
2
- import { assertMutable, selectFakeServer, selectServer, } from '../auth/operations.js';
3
- import { getConfigStore } from '../config/index.js';
4
- import { resolveAuth } from '../context.js';
5
- import { getOutput } from '../output/get-output.js';
6
- import { promptAutocomplete, promptText } from '../prompt.js';
7
- export async function interactForServerSelection() {
8
- const config = getConfigStore();
9
- assertMutable(resolveAuth(config), 'server', 'select a server');
10
- const servers = [
11
- 'http://localhost:3020',
12
- 'https://connect.getseam.com',
13
- 'https://fakeseamconnect.seam.vc',
14
- ];
15
- // Searchable, as selecting a device or a command is.
16
- const server = await promptAutocomplete({
17
- message: 'Select a server:',
18
- choices: servers.map((server) => ({ label: server, value: server })),
19
- });
20
- const output = getOutput();
21
- if (server === servers[2]) {
22
- let userUrlSeed = await promptText({
23
- message: 'You can input a custom server URL or leave this field empty to use a new fakeserver.',
24
- });
25
- if (userUrlSeed.trim().length === 0) {
26
- userUrlSeed = randomBytes(5).toString('hex');
27
- }
28
- selectFakeServer({ urlSeed: userUrlSeed, config });
29
- output.info(`PAT set to use fakeseamconnect with "seam_apikey1_token"`);
30
- }
31
- else {
32
- selectServer(server, config);
33
- }
34
- output.info(`Server set to ${server}`);
35
- }
36
- //# sourceMappingURL=server-selection.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server-selection.js","sourceRoot":"","sources":["../../src/lib/interactions/server-selection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEzC,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,YAAY,GACb,MAAM,wBAAwB,CAAA;AAC/B,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,UAAU,EAAE,MAAM,eAAe,CAAA;AAE9D,MAAM,CAAC,KAAK,UAAU,0BAA0B;IAC9C,MAAM,MAAM,GAAG,cAAc,EAAE,CAAA;IAC/B,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAA;IAE/D,MAAM,OAAO,GAAG;QACd,uBAAuB;QACvB,6BAA6B;QAC7B,iCAAiC;KAClC,CAAA;IAED,qDAAqD;IACrD,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC;QACtC,OAAO,EAAE,kBAAkB;QAC3B,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;KACrE,CAAC,CAAA;IAEF,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,IAAI,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1B,IAAI,WAAW,GAAG,MAAM,UAAU,CAAC;YACjC,OAAO,EACL,sFAAsF;SACzF,CAAC,CAAA;QAEF,IAAI,WAAW,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACpC,WAAW,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QAC9C,CAAC;QACD,gBAAgB,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAA;QAClD,MAAM,CAAC,IAAI,CAAC,0DAA0D,CAAC,CAAA;IACzE,CAAC;SAAM,CAAC;QACN,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9B,CAAC;IACD,MAAM,CAAC,IAAI,CAAC,iBAAiB,MAAM,EAAE,CAAC,CAAA;AACxC,CAAC"}
@@ -1,21 +0,0 @@
1
- import { selectFakeServer } from 'lib/auth/operations.js'
2
- import type { Command } from 'lib/commands/registry.js'
3
-
4
- /** Hidden: a development shortcut, kept out of help and completion. */
5
- export const configSetFakeServerCommand: Command = {
6
- definition: {
7
- path: ['config', 'set', 'fake-server'],
8
- kind: 'cli',
9
- title: 'Point the CLI at a fake Seam Connect server.',
10
- description: '',
11
- flags: [],
12
- },
13
- requiresAuth: false,
14
- hidden: true,
15
- execute: async (_invocation, ctx) => {
16
- const { server } = selectFakeServer({ config: ctx.config })
17
- ctx.output.info(`Server URL set to ${server}`)
18
- ctx.output.info(`PAT set to use fakeseamconnect with "seam_apikey1_token"`)
19
- return { kind: 'done' }
20
- },
21
- }
@@ -1,30 +0,0 @@
1
- import { assertMutable, selectServer } from 'lib/auth/operations.js'
2
- import type { Command } from 'lib/commands/registry.js'
3
- import { stringFlag } from 'lib/commands/spec.js'
4
- import { NonInteractiveError } from 'lib/errors.js'
5
- import { interactForServerSelection } from 'lib/interactions/index.js'
6
-
7
- export const selectServerCommand: Command = {
8
- definition: {
9
- path: ['select', 'server'],
10
- kind: 'cli',
11
- title: 'Select the Seam API server.',
12
- description: '',
13
- flags: [stringFlag('server', 'Seam API server to select.')],
14
- },
15
- requiresAuth: false,
16
- execute: async ({ args }, ctx) => {
17
- assertMutable(ctx.auth, 'server', 'select a server')
18
- if (args['server']) {
19
- selectServer(args['server'], ctx.config)
20
- return { kind: 'done' }
21
- }
22
- if (ctx.interactivity === 'non-interactive') {
23
- throw new NonInteractiveError(
24
- 'Missing required parameter for select server: --server',
25
- )
26
- }
27
- await interactForServerSelection()
28
- return { kind: 'done' }
29
- },
30
- }
@@ -1,45 +0,0 @@
1
- import { randomBytes } from 'node:crypto'
2
-
3
- import {
4
- assertMutable,
5
- selectFakeServer,
6
- selectServer,
7
- } from 'lib/auth/operations.js'
8
- import { getConfigStore } from 'lib/config/index.js'
9
- import { resolveAuth } from 'lib/context.js'
10
- import { getOutput } from 'lib/output/get-output.js'
11
- import { promptAutocomplete, promptText } from 'lib/prompt.js'
12
-
13
- export async function interactForServerSelection() {
14
- const config = getConfigStore()
15
- assertMutable(resolveAuth(config), 'server', 'select a server')
16
-
17
- const servers = [
18
- 'http://localhost:3020',
19
- 'https://connect.getseam.com',
20
- 'https://fakeseamconnect.seam.vc',
21
- ]
22
-
23
- // Searchable, as selecting a device or a command is.
24
- const server = await promptAutocomplete({
25
- message: 'Select a server:',
26
- choices: servers.map((server) => ({ label: server, value: server })),
27
- })
28
-
29
- const output = getOutput()
30
- if (server === servers[2]) {
31
- let userUrlSeed = await promptText({
32
- message:
33
- 'You can input a custom server URL or leave this field empty to use a new fakeserver.',
34
- })
35
-
36
- if (userUrlSeed.trim().length === 0) {
37
- userUrlSeed = randomBytes(5).toString('hex')
38
- }
39
- selectFakeServer({ urlSeed: userUrlSeed, config })
40
- output.info(`PAT set to use fakeseamconnect with "seam_apikey1_token"`)
41
- } else {
42
- selectServer(server, config)
43
- }
44
- output.info(`Server set to ${server}`)
45
- }