@sembix/cli 1.2.1 → 1.4.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/COMMANDS.md +1522 -0
- package/QUICKSTART.md +829 -0
- package/README.md +1976 -309
- package/USAGE-EXAMPLES.md +872 -0
- package/config.example.yaml +3 -0
- package/dist/commands/configure.d.ts.map +1 -1
- package/dist/commands/configure.js +172 -2
- package/dist/commands/configure.js.map +1 -1
- package/dist/commands/index.d.ts +10 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +11 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/login.d.ts +19 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +118 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.d.ts +21 -0
- package/dist/commands/logout.d.ts.map +1 -0
- package/dist/commands/logout.js +66 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/profile-project.d.ts +14 -0
- package/dist/commands/profile-project.d.ts.map +1 -0
- package/dist/commands/profile-project.js +123 -0
- package/dist/commands/profile-project.js.map +1 -0
- package/dist/commands/profile.d.ts +26 -0
- package/dist/commands/profile.d.ts.map +1 -0
- package/dist/commands/profile.js +177 -0
- package/dist/commands/profile.js.map +1 -0
- package/dist/commands/project.d.ts +16 -0
- package/dist/commands/project.d.ts.map +1 -0
- package/dist/commands/project.js +153 -0
- package/dist/commands/project.js.map +1 -0
- package/dist/commands/setup.js +3 -0
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/workflow.d.ts +91 -0
- package/dist/commands/workflow.d.ts.map +1 -0
- package/dist/commands/workflow.js +1201 -0
- package/dist/commands/workflow.js.map +1 -0
- package/dist/config-schema.d.ts +26 -0
- package/dist/config-schema.d.ts.map +1 -1
- package/dist/config-schema.js +24 -1
- package/dist/config-schema.js.map +1 -1
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +23 -2
- package/dist/config.js.map +1 -1
- package/dist/index.js +324 -1
- package/dist/index.js.map +1 -1
- package/dist/prompts/environment-setup.d.ts.map +1 -1
- package/dist/prompts/environment-setup.js +12 -0
- package/dist/prompts/environment-setup.js.map +1 -1
- package/dist/prompts/project-selection.d.ts +8 -0
- package/dist/prompts/project-selection.d.ts.map +1 -0
- package/dist/prompts/project-selection.js +132 -0
- package/dist/prompts/project-selection.js.map +1 -0
- package/dist/prompts/workflow-inputs.d.ts +10 -0
- package/dist/prompts/workflow-inputs.d.ts.map +1 -0
- package/dist/prompts/workflow-inputs.js +71 -0
- package/dist/prompts/workflow-inputs.js.map +1 -0
- package/dist/prompts/workflow-selection.d.ts +8 -0
- package/dist/prompts/workflow-selection.d.ts.map +1 -0
- package/dist/prompts/workflow-selection.js +147 -0
- package/dist/prompts/workflow-selection.js.map +1 -0
- package/dist/sembix-cli-1.4.0.tgz +0 -0
- package/dist/services/cognito-auth.d.ts +92 -0
- package/dist/services/cognito-auth.d.ts.map +1 -0
- package/dist/services/cognito-auth.js +319 -0
- package/dist/services/cognito-auth.js.map +1 -0
- package/dist/services/studio-api-client.d.ts +127 -0
- package/dist/services/studio-api-client.d.ts.map +1 -0
- package/dist/services/studio-api-client.js +291 -0
- package/dist/services/studio-api-client.js.map +1 -0
- package/dist/types/studio.d.ts +82 -0
- package/dist/types/studio.d.ts.map +1 -0
- package/dist/types/studio.js +7 -0
- package/dist/types/studio.js.map +1 -0
- package/dist/types.d.ts +286 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -1
- package/dist/utils/browser-auth.d.ts +45 -0
- package/dist/utils/browser-auth.d.ts.map +1 -0
- package/dist/utils/browser-auth.js +168 -0
- package/dist/utils/browser-auth.js.map +1 -0
- package/dist/utils/cognito-auth.d.ts +3 -0
- package/dist/utils/cognito-auth.d.ts.map +1 -0
- package/dist/utils/cognito-auth.js +3 -0
- package/dist/utils/cognito-auth.js.map +1 -0
- package/dist/utils/config-file.d.ts +40 -0
- package/dist/utils/config-file.d.ts.map +1 -1
- package/dist/utils/config-file.js +158 -4
- package/dist/utils/config-file.js.map +1 -1
- package/dist/utils/config-loader.d.ts.map +1 -1
- package/dist/utils/config-loader.js +15 -2
- package/dist/utils/config-loader.js.map +1 -1
- package/dist/utils/environment.d.ts +22 -0
- package/dist/utils/environment.d.ts.map +1 -0
- package/dist/utils/environment.js +39 -0
- package/dist/utils/environment.js.map +1 -0
- package/dist/utils/error-handler.d.ts +53 -0
- package/dist/utils/error-handler.d.ts.map +1 -0
- package/dist/utils/error-handler.js +174 -0
- package/dist/utils/error-handler.js.map +1 -0
- package/dist/utils/fuzzy-match.d.ts +31 -0
- package/dist/utils/fuzzy-match.d.ts.map +1 -0
- package/dist/utils/fuzzy-match.js +138 -0
- package/dist/utils/fuzzy-match.js.map +1 -0
- package/dist/utils/input-parser.d.ts +14 -0
- package/dist/utils/input-parser.d.ts.map +1 -0
- package/dist/utils/input-parser.js +34 -0
- package/dist/utils/input-parser.js.map +1 -0
- package/dist/utils/output.d.ts +55 -0
- package/dist/utils/output.d.ts.map +1 -0
- package/dist/utils/output.js +80 -0
- package/dist/utils/output.js.map +1 -0
- package/dist/utils/recent-workflows.d.ts +37 -0
- package/dist/utils/recent-workflows.d.ts.map +1 -0
- package/dist/utils/recent-workflows.js +172 -0
- package/dist/utils/recent-workflows.js.map +1 -0
- package/dist/utils/studio-api-client.d.ts +3 -0
- package/dist/utils/studio-api-client.d.ts.map +1 -0
- package/dist/utils/studio-api-client.js +3 -0
- package/dist/utils/studio-api-client.js.map +1 -0
- package/dist/utils/studio-api.d.ts +53 -0
- package/dist/utils/studio-api.d.ts.map +1 -0
- package/dist/utils/studio-api.js +102 -0
- package/dist/utils/studio-api.js.map +1 -0
- package/dist/utils/studio-config.d.ts +74 -0
- package/dist/utils/studio-config.d.ts.map +1 -0
- package/dist/utils/studio-config.js +213 -0
- package/dist/utils/studio-config.js.map +1 -0
- package/dist/utils/token-manager.d.ts +4 -0
- package/dist/utils/token-manager.d.ts.map +1 -0
- package/dist/utils/token-manager.js +3 -0
- package/dist/utils/token-manager.js.map +1 -0
- package/dist/utils/ui.d.ts +55 -1
- package/dist/utils/ui.d.ts.map +1 -1
- package/dist/utils/ui.js +151 -2
- package/dist/utils/ui.js.map +1 -1
- package/package.json +4 -1
- package/dist/__tests__/config-schema.test.d.ts +0 -2
- package/dist/__tests__/config-schema.test.d.ts.map +0 -1
- package/dist/__tests__/config-schema.test.js +0 -471
- package/dist/__tests__/config-schema.test.js.map +0 -1
- package/dist/__tests__/config.test.d.ts +0 -2
- package/dist/__tests__/config.test.d.ts.map +0 -1
- package/dist/__tests__/config.test.js +0 -75
- package/dist/__tests__/config.test.js.map +0 -1
- package/dist/__tests__/integration/configure.test.d.ts +0 -2
- package/dist/__tests__/integration/configure.test.d.ts.map +0 -1
- package/dist/__tests__/integration/configure.test.js +0 -247
- package/dist/__tests__/integration/configure.test.js.map +0 -1
- package/dist/__tests__/integration/fixtures/configs.d.ts +0 -477
- package/dist/__tests__/integration/fixtures/configs.d.ts.map +0 -1
- package/dist/__tests__/integration/fixtures/configs.js +0 -175
- package/dist/__tests__/integration/fixtures/configs.js.map +0 -1
- package/dist/__tests__/integration/helpers/cli-runner.d.ts +0 -63
- package/dist/__tests__/integration/helpers/cli-runner.d.ts.map +0 -1
- package/dist/__tests__/integration/helpers/cli-runner.js +0 -152
- package/dist/__tests__/integration/helpers/cli-runner.js.map +0 -1
- package/dist/__tests__/integration/helpers/command-runner.d.ts +0 -53
- package/dist/__tests__/integration/helpers/command-runner.d.ts.map +0 -1
- package/dist/__tests__/integration/helpers/command-runner.js +0 -117
- package/dist/__tests__/integration/helpers/command-runner.js.map +0 -1
- package/dist/__tests__/integration/studio-create.test.d.ts +0 -2
- package/dist/__tests__/integration/studio-create.test.d.ts.map +0 -1
- package/dist/__tests__/integration/studio-create.test.js +0 -209
- package/dist/__tests__/integration/studio-create.test.js.map +0 -1
- package/dist/__tests__/integration/studio-update.test.d.ts +0 -2
- package/dist/__tests__/integration/studio-update.test.d.ts.map +0 -1
- package/dist/__tests__/integration/studio-update.test.js +0 -166
- package/dist/__tests__/integration/studio-update.test.js.map +0 -1
- package/dist/commands/__tests__/configure.test.d.ts +0 -2
- package/dist/commands/__tests__/configure.test.d.ts.map +0 -1
- package/dist/commands/__tests__/configure.test.js +0 -229
- package/dist/commands/__tests__/configure.test.js.map +0 -1
- package/dist/prompts/__tests__/environment-setup.test.d.ts +0 -2
- package/dist/prompts/__tests__/environment-setup.test.d.ts.map +0 -1
- package/dist/prompts/__tests__/environment-setup.test.js +0 -206
- package/dist/prompts/__tests__/environment-setup.test.js.map +0 -1
- package/dist/prompts/__tests__/hub-integration.test.d.ts +0 -2
- package/dist/prompts/__tests__/hub-integration.test.d.ts.map +0 -1
- package/dist/prompts/__tests__/hub-integration.test.js +0 -126
- package/dist/prompts/__tests__/hub-integration.test.js.map +0 -1
- package/dist/prompts/__tests__/prompt-helpers.test.d.ts +0 -2
- package/dist/prompts/__tests__/prompt-helpers.test.d.ts.map +0 -1
- package/dist/prompts/__tests__/prompt-helpers.test.js +0 -235
- package/dist/prompts/__tests__/prompt-helpers.test.js.map +0 -1
- package/dist/sembix-cli-1.2.1.tgz +0 -0
- package/dist/utils/__tests__/config-file.test.d.ts +0 -2
- package/dist/utils/__tests__/config-file.test.d.ts.map +0 -1
- package/dist/utils/__tests__/config-file.test.js +0 -218
- package/dist/utils/__tests__/config-file.test.js.map +0 -1
- package/dist/utils/__tests__/config-loader.test.d.ts +0 -2
- package/dist/utils/__tests__/config-loader.test.d.ts.map +0 -1
- package/dist/utils/__tests__/config-loader.test.js +0 -325
- package/dist/utils/__tests__/config-loader.test.js.map +0 -1
- package/dist/utils/__tests__/github.test.d.ts +0 -2
- package/dist/utils/__tests__/github.test.d.ts.map +0 -1
- package/dist/utils/__tests__/github.test.js +0 -282
- package/dist/utils/__tests__/github.test.js.map +0 -1
- package/dist/utils/__tests__/ui.test.d.ts +0 -2
- package/dist/utils/__tests__/ui.test.d.ts.map +0 -1
- package/dist/utils/__tests__/ui.test.js +0 -256
- package/dist/utils/__tests__/ui.test.js.map +0 -1
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { CognitoAuthService } from './cognito-auth.js';
|
|
2
|
+
import { saveTokens } from '../utils/studio-config.js';
|
|
3
|
+
/**
|
|
4
|
+
* Client for interacting with Sembix Studio API endpoints.
|
|
5
|
+
* Handles authenticated requests, automatic token refresh, and error handling.
|
|
6
|
+
*/
|
|
7
|
+
export class StudioApiClient {
|
|
8
|
+
profile;
|
|
9
|
+
tokens;
|
|
10
|
+
cognitoService;
|
|
11
|
+
constructor(profile, tokens) {
|
|
12
|
+
this.profile = profile;
|
|
13
|
+
this.tokens = tokens;
|
|
14
|
+
this.cognitoService = new CognitoAuthService(profile);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Search for projects by name or IDs.
|
|
18
|
+
* @param params - Search parameters (projectName, projectIds)
|
|
19
|
+
* @returns Promise resolving to project list response
|
|
20
|
+
*/
|
|
21
|
+
async searchProjects(params = {}) {
|
|
22
|
+
return this._makeRequest('POST', '/projects', params);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Get a specific project by ID.
|
|
26
|
+
* Note: API doesn't have a direct GET endpoint, so we search with projectIds filter.
|
|
27
|
+
* @param projectId - The project ID
|
|
28
|
+
* @returns Promise resolving to project or null if not found
|
|
29
|
+
*/
|
|
30
|
+
async getProject(projectId) {
|
|
31
|
+
const response = await this.searchProjects({ projectIds: [projectId] });
|
|
32
|
+
return response.items.length > 0 ? response.items[0] : null;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* List workflows with optional filters.
|
|
36
|
+
* @param params - Filter parameters (projectId, workflowId, workflowTemplateIds, parentWorkflowId)
|
|
37
|
+
* @returns Promise resolving to workflow list response
|
|
38
|
+
*/
|
|
39
|
+
async listWorkflows(params = {}) {
|
|
40
|
+
return this._makeRequest('POST', '/workflows/search', undefined, params);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get a specific workflow by ID.
|
|
44
|
+
* @param projectId - The project ID
|
|
45
|
+
* @param workflowId - The workflow ID
|
|
46
|
+
* @returns Promise resolving to workflow details
|
|
47
|
+
*/
|
|
48
|
+
async getWorkflow(projectId, workflowId) {
|
|
49
|
+
const path = `/projects/${projectId}/workflows/${workflowId}`;
|
|
50
|
+
return this._makeRequest('GET', path);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Find a workflow by name within a project.
|
|
54
|
+
* Searches all workflows in the project and returns the first match.
|
|
55
|
+
* API returns only parent workflows by default (unless parentWorkflowId is specified).
|
|
56
|
+
* @param projectId - The project ID
|
|
57
|
+
* @param workflowName - The workflow name (case-insensitive)
|
|
58
|
+
* @returns Promise resolving to workflow or null if not found
|
|
59
|
+
*/
|
|
60
|
+
async findWorkflowByName(projectId, workflowName) {
|
|
61
|
+
const response = await this.listWorkflows({ projectId });
|
|
62
|
+
// API already filters to parent workflows only
|
|
63
|
+
const match = response.workflows.find((w) => w.name.toLowerCase() === workflowName.toLowerCase());
|
|
64
|
+
if (match) {
|
|
65
|
+
return this.getWorkflow(projectId, match.workflowId);
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Resolves a parent workflow to its published child workflow with the highest version.
|
|
71
|
+
* This is required because workflow lists show parent workflows, but you must start child workflows.
|
|
72
|
+
* @param projectId - The project ID
|
|
73
|
+
* @param parentWorkflowId - The parent workflow ID to resolve
|
|
74
|
+
* @returns Promise resolving to the published child workflow with highest version
|
|
75
|
+
* @throws Error if no published children found
|
|
76
|
+
*/
|
|
77
|
+
async resolveToPublishedChild(projectId, parentWorkflowId) {
|
|
78
|
+
// Get all child workflows of this parent
|
|
79
|
+
const response = await this.listWorkflows({
|
|
80
|
+
projectId,
|
|
81
|
+
parentWorkflowId
|
|
82
|
+
});
|
|
83
|
+
// Filter to only published children (state === 'Published')
|
|
84
|
+
const publishedChildren = response.workflows.filter(w => w.state === 'Published');
|
|
85
|
+
if (publishedChildren.length === 0) {
|
|
86
|
+
throw new Error(`No published versions found for this workflow.\n\n` +
|
|
87
|
+
`This workflow has no published children that can be started.\n` +
|
|
88
|
+
`Please publish a version in Sembix Studio first.`);
|
|
89
|
+
}
|
|
90
|
+
// Sort by version (highest first) and return the first one
|
|
91
|
+
publishedChildren.sort((a, b) => {
|
|
92
|
+
const versionA = a.version || 0;
|
|
93
|
+
const versionB = b.version || 0;
|
|
94
|
+
return versionB - versionA;
|
|
95
|
+
});
|
|
96
|
+
return publishedChildren[0];
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Start a workflow execution.
|
|
100
|
+
* @param projectId - The project ID
|
|
101
|
+
* @param workflowId - The workflow ID
|
|
102
|
+
* @param startConfiguration - Workflow start configuration with input variables
|
|
103
|
+
* @returns Promise resolving to workflow start response with runId and taskArn
|
|
104
|
+
*/
|
|
105
|
+
async startWorkflow(projectId, workflowId, startConfiguration) {
|
|
106
|
+
const path = `/projects/${projectId}/workflows/${workflowId}/start`;
|
|
107
|
+
// API expects body with startConfiguration field
|
|
108
|
+
return this._makeRequest('POST', path, { startConfiguration });
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Get details of a specific workflow run.
|
|
112
|
+
* @param workflowId - The workflow ID
|
|
113
|
+
* @param runId - The run ID
|
|
114
|
+
* @returns Promise resolving to workflow run details
|
|
115
|
+
*/
|
|
116
|
+
async getWorkflowRun(workflowId, runId) {
|
|
117
|
+
const path = `/workflows/${workflowId}/runs/${runId}`;
|
|
118
|
+
return this._makeRequest('GET', path);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Search workflow runs with optional filters.
|
|
122
|
+
* @param params - Search parameters for filtering and pagination
|
|
123
|
+
* @returns Promise resolving to list of workflow runs
|
|
124
|
+
*/
|
|
125
|
+
async searchWorkflowRuns(params) {
|
|
126
|
+
const path = '/workflows/runs';
|
|
127
|
+
return this._makeRequest('GET', path, undefined, params);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Stop a running workflow.
|
|
131
|
+
* @param projectId - The project ID
|
|
132
|
+
* @param workflowId - The workflow ID
|
|
133
|
+
* @param runId - The run ID to stop
|
|
134
|
+
* @returns Promise resolving when workflow is stopped
|
|
135
|
+
*/
|
|
136
|
+
async stopWorkflowRun(projectId, workflowId, runId) {
|
|
137
|
+
const path = `/projects/${projectId}/workflows/${workflowId}/runs/${runId}/stop`;
|
|
138
|
+
await this._makeRequest('POST', path);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Get a specific workflow template by ID.
|
|
142
|
+
* @param projectId - The project ID
|
|
143
|
+
* @param templateId - The workflow template ID
|
|
144
|
+
* @returns Promise resolving to template details
|
|
145
|
+
*/
|
|
146
|
+
async getWorkflowTemplate(projectId, templateId) {
|
|
147
|
+
const path = `/projects/${projectId}/workflow-templates/${templateId}`;
|
|
148
|
+
return this._makeRequest('GET', path);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* List workflow templates with optional filters.
|
|
152
|
+
* @param params - Filter parameters (templateIds, category, tags)
|
|
153
|
+
* @returns Promise resolving to template list response
|
|
154
|
+
*/
|
|
155
|
+
async listWorkflowTemplates(params = {}) {
|
|
156
|
+
return this._makeRequest('POST', '/workflow-templates/search', undefined, params);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Get workflow template for a specific workflow.
|
|
160
|
+
* Convenience method that fetches workflow and then its template.
|
|
161
|
+
* @param projectId - The project ID
|
|
162
|
+
* @param workflowId - The workflow ID
|
|
163
|
+
* @returns Promise resolving to template details or null if workflow has no template
|
|
164
|
+
*/
|
|
165
|
+
async getWorkflowTemplateForWorkflow(projectId, workflowId) {
|
|
166
|
+
const workflow = await this.getWorkflow(projectId, workflowId);
|
|
167
|
+
if (!workflow.workflowTemplateId) {
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
return this.getWorkflowTemplate(projectId, workflow.workflowTemplateId);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Make an authenticated HTTP request to the Studio API.
|
|
174
|
+
* Handles token refresh on 401 responses and retries the request.
|
|
175
|
+
* @param method - HTTP method
|
|
176
|
+
* @param path - API endpoint path
|
|
177
|
+
* @param body - Optional request body
|
|
178
|
+
* @param queryParams - Optional query parameters
|
|
179
|
+
* @returns Promise resolving to parsed response
|
|
180
|
+
*/
|
|
181
|
+
async _makeRequest(method, path, body, queryParams) {
|
|
182
|
+
// Construct full URL with query parameters
|
|
183
|
+
const url = new URL(path, this.profile.studioApiUrl);
|
|
184
|
+
if (queryParams) {
|
|
185
|
+
Object.entries(queryParams).forEach(([key, value]) => {
|
|
186
|
+
if (value !== undefined && value !== null) {
|
|
187
|
+
url.searchParams.append(key, String(value));
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
// Prepare request options
|
|
192
|
+
const headers = {
|
|
193
|
+
'Authorization': `Bearer ${this.tokens.idToken}`
|
|
194
|
+
};
|
|
195
|
+
// Only set Content-Type if there's a body to send
|
|
196
|
+
if (body) {
|
|
197
|
+
headers['Content-Type'] = 'application/json';
|
|
198
|
+
}
|
|
199
|
+
const options = {
|
|
200
|
+
method,
|
|
201
|
+
headers
|
|
202
|
+
};
|
|
203
|
+
if (body) {
|
|
204
|
+
options.body = JSON.stringify(body);
|
|
205
|
+
}
|
|
206
|
+
try {
|
|
207
|
+
// Make the request
|
|
208
|
+
const response = await fetch(url.toString(), options);
|
|
209
|
+
// Handle 401 Unauthorized - attempt token refresh
|
|
210
|
+
if (response.status === 401) {
|
|
211
|
+
await this._refreshTokensAndRetry();
|
|
212
|
+
// Retry the request with new token
|
|
213
|
+
options.headers = {
|
|
214
|
+
...options.headers,
|
|
215
|
+
'Authorization': `Bearer ${this.tokens.idToken}`
|
|
216
|
+
};
|
|
217
|
+
const retryResponse = await fetch(url.toString(), options);
|
|
218
|
+
return this._handleResponse(retryResponse);
|
|
219
|
+
}
|
|
220
|
+
return this._handleResponse(response);
|
|
221
|
+
}
|
|
222
|
+
catch (error) {
|
|
223
|
+
// Handle network errors
|
|
224
|
+
if (error instanceof Error) {
|
|
225
|
+
throw new Error(`Network error while calling Studio API: ${error.message}`);
|
|
226
|
+
}
|
|
227
|
+
throw error;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Handle HTTP response, parsing JSON or throwing errors.
|
|
232
|
+
* @param response - Fetch response object
|
|
233
|
+
* @returns Promise resolving to parsed response body
|
|
234
|
+
*/
|
|
235
|
+
async _handleResponse(response) {
|
|
236
|
+
// Handle successful responses
|
|
237
|
+
if (response.ok) {
|
|
238
|
+
// Handle 204 No Content
|
|
239
|
+
if (response.status === 204) {
|
|
240
|
+
return undefined;
|
|
241
|
+
}
|
|
242
|
+
return response.json();
|
|
243
|
+
}
|
|
244
|
+
// Handle error responses
|
|
245
|
+
let errorMessage = `Studio API error: ${response.status} ${response.statusText}`;
|
|
246
|
+
try {
|
|
247
|
+
const errorBody = await response.text();
|
|
248
|
+
if (errorBody) {
|
|
249
|
+
errorMessage += ` - ${errorBody}`;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
catch {
|
|
253
|
+
// Ignore errors parsing error body
|
|
254
|
+
}
|
|
255
|
+
// Provide specific error messages for common status codes
|
|
256
|
+
if (response.status === 404) {
|
|
257
|
+
throw new Error('Resource not found. Please check the workflow ID, run ID, or project ID.');
|
|
258
|
+
}
|
|
259
|
+
else if (response.status === 400) {
|
|
260
|
+
throw new Error(`Bad request: ${errorMessage}`);
|
|
261
|
+
}
|
|
262
|
+
else if (response.status === 403) {
|
|
263
|
+
throw new Error('Access forbidden. Please check your permissions.');
|
|
264
|
+
}
|
|
265
|
+
else if (response.status >= 500) {
|
|
266
|
+
throw new Error(`Studio API server error: ${errorMessage}`);
|
|
267
|
+
}
|
|
268
|
+
throw new Error(errorMessage);
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Refresh authentication tokens and update stored tokens.
|
|
272
|
+
* @throws Error if token refresh fails
|
|
273
|
+
*/
|
|
274
|
+
async _refreshTokensAndRetry() {
|
|
275
|
+
try {
|
|
276
|
+
// Attempt to refresh tokens using refresh token
|
|
277
|
+
const newTokens = await this.cognitoService.refreshTokens(this.tokens.refreshToken);
|
|
278
|
+
// Update internal token state
|
|
279
|
+
this.tokens = newTokens;
|
|
280
|
+
// Persist refreshed tokens to disk
|
|
281
|
+
await saveTokens(this.profile.name, newTokens);
|
|
282
|
+
}
|
|
283
|
+
catch (error) {
|
|
284
|
+
// Token refresh failed - user needs to re-authenticate
|
|
285
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
286
|
+
throw new Error(`Authentication token refresh failed: ${errorMessage}. ` +
|
|
287
|
+
`Please run "sembix login --profile ${this.profile.name}" to re-authenticate.`);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
//# sourceMappingURL=studio-api-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"studio-api-client.js","sourceRoot":"","sources":["../../src/services/studio-api-client.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD;;;GAGG;AACH,MAAM,OAAO,eAAe;IAClB,OAAO,CAAgB;IACvB,MAAM,CAAmB;IACzB,cAAc,CAAqB;IAE3C,YAAY,OAAsB,EAAE,MAAwB;QAC1D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,cAAc,GAAG,IAAI,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACxD,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,cAAc,CAAC,SAA8B,EAA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Schema: z.ZodString;
|
|
4
|
+
export declare const cognitoClientIdSchema: z.ZodString;
|
|
5
|
+
export declare const cognitoUserPoolIdSchema: z.ZodString;
|
|
6
|
+
export interface StudioProfile {
|
|
7
|
+
name: string;
|
|
8
|
+
studioApiUrl: string;
|
|
9
|
+
cognitoUserPoolId: string;
|
|
10
|
+
cognitoClientId: string;
|
|
11
|
+
cognitoRegion: string;
|
|
12
|
+
cognitoDomain: string;
|
|
13
|
+
}
|
|
14
|
+
export interface StudioAuthTokens {
|
|
15
|
+
accessToken: string;
|
|
16
|
+
idToken: string;
|
|
17
|
+
refreshToken: string;
|
|
18
|
+
expiresAt: string;
|
|
19
|
+
}
|
|
20
|
+
export interface StudioConfig {
|
|
21
|
+
profiles: StudioProfile[];
|
|
22
|
+
defaultProfile?: string;
|
|
23
|
+
currentProfile?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface CognitoConfig {
|
|
26
|
+
domain: string;
|
|
27
|
+
clientId: string;
|
|
28
|
+
region: string;
|
|
29
|
+
userPoolId: string;
|
|
30
|
+
}
|
|
31
|
+
export interface TokenSet {
|
|
32
|
+
id_token: string;
|
|
33
|
+
access_token: string;
|
|
34
|
+
refresh_token: string;
|
|
35
|
+
expires_in: number;
|
|
36
|
+
}
|
|
37
|
+
export interface StartWorkflowConfiguration {
|
|
38
|
+
inputVariables?: Record<string, unknown>;
|
|
39
|
+
workspaceId?: string;
|
|
40
|
+
workspaceName?: string;
|
|
41
|
+
issueId?: string;
|
|
42
|
+
issueKey?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface WorkflowRun {
|
|
45
|
+
runId: string;
|
|
46
|
+
workflowId: string;
|
|
47
|
+
name: string;
|
|
48
|
+
status: 'pending' | 'running' | 'completed' | 'failed' | 'stopped';
|
|
49
|
+
progress: number;
|
|
50
|
+
createdAt: string;
|
|
51
|
+
creatorId: string;
|
|
52
|
+
error?: string;
|
|
53
|
+
startConfiguration?: StartWorkflowConfiguration;
|
|
54
|
+
}
|
|
55
|
+
export interface WorkflowStartResponse {
|
|
56
|
+
runId: string;
|
|
57
|
+
taskArn: string;
|
|
58
|
+
}
|
|
59
|
+
export interface FetchWorkflowRunResponse {
|
|
60
|
+
run: WorkflowRun;
|
|
61
|
+
}
|
|
62
|
+
export interface FetchWorkflowRunListItem {
|
|
63
|
+
runs: WorkflowRun[];
|
|
64
|
+
total: number;
|
|
65
|
+
limit: number;
|
|
66
|
+
offset: number;
|
|
67
|
+
}
|
|
68
|
+
export interface SearchParams {
|
|
69
|
+
workflowId?: string;
|
|
70
|
+
projectId?: string;
|
|
71
|
+
status?: string;
|
|
72
|
+
currentUser?: boolean;
|
|
73
|
+
workspaceId?: string;
|
|
74
|
+
workspaceName?: string;
|
|
75
|
+
issueId?: string;
|
|
76
|
+
issueKey?: string;
|
|
77
|
+
limit?: number;
|
|
78
|
+
offset?: number;
|
|
79
|
+
sortBy?: string;
|
|
80
|
+
sortOrder?: 'ASC' | 'DESC';
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=studio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"studio.d.ts","sourceRoot":"","sources":["../../src/types/studio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,kBAAkB,aAA6D,CAAC;AAC7F,eAAO,MAAM,mBAAmB,aAAoG,CAAC;AACrI,eAAO,MAAM,qBAAqB,aAAqD,CAAC;AACxF,eAAO,MAAM,uBAAuB,aAAmF,CAAC;AAGxH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB;AAGD,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB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CACjB;AAGD,MAAM,WAAW,wBAAwB;IACvC,GAAG,EAAE,WAAW,CAAC;CAClB;AAGD,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,WAAW,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAGD,MAAM,WAAW,YAAY;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CAC5B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// Studio validation schemas
|
|
3
|
+
export const studioApiUrlSchema = z.string().url().regex(/^https:\/\//, 'Must be HTTPS URL');
|
|
4
|
+
export const cognitoDomainSchema = z.string().regex(/^https:\/\/.+\.auth\..+\.amazoncognito\.com$/, 'Invalid Cognito domain format');
|
|
5
|
+
export const cognitoClientIdSchema = z.string().min(1, 'Cognito Client ID is required');
|
|
6
|
+
export const cognitoUserPoolIdSchema = z.string().regex(/^[\w-]+_[a-zA-Z0-9]+$/, 'Invalid Cognito User Pool ID format');
|
|
7
|
+
//# sourceMappingURL=studio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"studio.js","sourceRoot":"","sources":["../../src/types/studio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,4BAA4B;AAC5B,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,aAAa,EAAE,mBAAmB,CAAC,CAAC;AAC7F,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,8CAA8C,EAAE,+BAA+B,CAAC,CAAC;AACrI,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,+BAA+B,CAAC,CAAC;AACxF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,uBAAuB,EAAE,qCAAqC,CAAC,CAAC"}
|