@solidnumber/cli 1.0.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/README.md +150 -0
- package/dist/commands/auth.d.ts +6 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +144 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/clone.d.ts +19 -0
- package/dist/commands/clone.d.ts.map +1 -0
- package/dist/commands/clone.js +205 -0
- package/dist/commands/clone.js.map +1 -0
- package/dist/commands/dev.d.ts +6 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +218 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/docs.d.ts +17 -0
- package/dist/commands/docs.d.ts.map +1 -0
- package/dist/commands/docs.js +864 -0
- package/dist/commands/docs.js.map +1 -0
- package/dist/commands/droplet.d.ts +10 -0
- package/dist/commands/droplet.d.ts.map +1 -0
- package/dist/commands/droplet.js +292 -0
- package/dist/commands/droplet.js.map +1 -0
- package/dist/commands/health.d.ts +6 -0
- package/dist/commands/health.d.ts.map +1 -0
- package/dist/commands/health.js +129 -0
- package/dist/commands/health.js.map +1 -0
- package/dist/commands/integrations.d.ts +6 -0
- package/dist/commands/integrations.d.ts.map +1 -0
- package/dist/commands/integrations.js +380 -0
- package/dist/commands/integrations.js.map +1 -0
- package/dist/commands/kb.d.ts +9 -0
- package/dist/commands/kb.d.ts.map +1 -0
- package/dist/commands/kb.js +151 -0
- package/dist/commands/kb.js.map +1 -0
- package/dist/commands/pages.d.ts +8 -0
- package/dist/commands/pages.d.ts.map +1 -0
- package/dist/commands/pages.js +103 -0
- package/dist/commands/pages.js.map +1 -0
- package/dist/commands/pull.d.ts +16 -0
- package/dist/commands/pull.d.ts.map +1 -0
- package/dist/commands/pull.js +336 -0
- package/dist/commands/pull.js.map +1 -0
- package/dist/commands/push.d.ts +14 -0
- package/dist/commands/push.d.ts.map +1 -0
- package/dist/commands/push.js +370 -0
- package/dist/commands/push.js.map +1 -0
- package/dist/commands/services.d.ts +8 -0
- package/dist/commands/services.d.ts.map +1 -0
- package/dist/commands/services.js +66 -0
- package/dist/commands/services.js.map +1 -0
- package/dist/commands/status.d.ts +9 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +89 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/train.d.ts +16 -0
- package/dist/commands/train.d.ts.map +1 -0
- package/dist/commands/train.js +338 -0
- package/dist/commands/train.js.map +1 -0
- package/dist/commands/vibe.d.ts +6 -0
- package/dist/commands/vibe.d.ts.map +1 -0
- package/dist/commands/vibe.js +176 -0
- package/dist/commands/vibe.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +119 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/api-client.d.ts +235 -0
- package/dist/lib/api-client.d.ts.map +1 -0
- package/dist/lib/api-client.js +287 -0
- package/dist/lib/api-client.js.map +1 -0
- package/dist/lib/config.d.ts +43 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +189 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/ui.d.ts +49 -0
- package/dist/lib/ui.d.ts.map +1 -0
- package/dist/lib/ui.js +182 -0
- package/dist/lib/ui.js.map +1 -0
- package/package.json +60 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* ================================================================================
|
|
5
|
+
* Solid# CLI — AI Business Infrastructure
|
|
6
|
+
* ================================================================================
|
|
7
|
+
* @solidnumber/cli
|
|
8
|
+
*
|
|
9
|
+
* The command-line interface for building on Solid#.
|
|
10
|
+
* Everything is scoped to your company_id. Safe and isolated.
|
|
11
|
+
*
|
|
12
|
+
* Install: npm install -g @solidnumber/cli
|
|
13
|
+
* Login: solid auth login
|
|
14
|
+
* Pull: solid pull
|
|
15
|
+
* Push: solid push
|
|
16
|
+
* Train: solid train chat sarah
|
|
17
|
+
* ================================================================================
|
|
18
|
+
*/
|
|
19
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
20
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
const commander_1 = require("commander");
|
|
24
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
25
|
+
const auth_1 = require("./commands/auth");
|
|
26
|
+
const status_1 = require("./commands/status");
|
|
27
|
+
const kb_1 = require("./commands/kb");
|
|
28
|
+
const pages_1 = require("./commands/pages");
|
|
29
|
+
const services_1 = require("./commands/services");
|
|
30
|
+
const integrations_1 = require("./commands/integrations");
|
|
31
|
+
const vibe_1 = require("./commands/vibe");
|
|
32
|
+
const health_1 = require("./commands/health");
|
|
33
|
+
const pull_1 = require("./commands/pull");
|
|
34
|
+
const push_1 = require("./commands/push");
|
|
35
|
+
const docs_1 = require("./commands/docs");
|
|
36
|
+
const train_1 = require("./commands/train");
|
|
37
|
+
const clone_1 = require("./commands/clone");
|
|
38
|
+
const dev_1 = require("./commands/dev");
|
|
39
|
+
const droplet_1 = require("./commands/droplet");
|
|
40
|
+
const ui_1 = require("./lib/ui");
|
|
41
|
+
const program = new commander_1.Command();
|
|
42
|
+
program
|
|
43
|
+
.name('solid')
|
|
44
|
+
.description('Solid# CLI — AI Business Infrastructure')
|
|
45
|
+
.version('1.0.0')
|
|
46
|
+
.configureHelp({
|
|
47
|
+
sortSubcommands: false,
|
|
48
|
+
sortOptions: false,
|
|
49
|
+
});
|
|
50
|
+
// Register commands — grouped by purpose
|
|
51
|
+
// Core workflow
|
|
52
|
+
program.addCommand(auth_1.authCommand);
|
|
53
|
+
program.addCommand(status_1.statusCommand);
|
|
54
|
+
program.addCommand(pull_1.pullCommand);
|
|
55
|
+
program.addCommand(push_1.pushCommand);
|
|
56
|
+
// Business data
|
|
57
|
+
program.addCommand(kb_1.kbCommand);
|
|
58
|
+
program.addCommand(pages_1.pagesCommand);
|
|
59
|
+
program.addCommand(services_1.servicesCommand);
|
|
60
|
+
// AI
|
|
61
|
+
program.addCommand(vibe_1.vibeCommand);
|
|
62
|
+
program.addCommand(train_1.trainCommand);
|
|
63
|
+
// Platform
|
|
64
|
+
program.addCommand(clone_1.cloneCommand);
|
|
65
|
+
program.addCommand(integrations_1.integrationsCommand);
|
|
66
|
+
program.addCommand(docs_1.docsCommand);
|
|
67
|
+
program.addCommand(health_1.healthCommand);
|
|
68
|
+
// Dev tools
|
|
69
|
+
program.addCommand(dev_1.devCommand);
|
|
70
|
+
program.addCommand(droplet_1.dropletCommand);
|
|
71
|
+
// ── Custom help screen ──────────────────────────────────────────────
|
|
72
|
+
program.addHelpText('beforeAll', () => {
|
|
73
|
+
return ui_1.ui.banner();
|
|
74
|
+
});
|
|
75
|
+
program.addHelpText('after', () => {
|
|
76
|
+
const sections = [
|
|
77
|
+
'',
|
|
78
|
+
ui_1.ui.divider('Quick Start'),
|
|
79
|
+
'',
|
|
80
|
+
ui_1.ui.commandHelp([
|
|
81
|
+
{ cmd: 'solid auth login', desc: 'Login to your company' },
|
|
82
|
+
{ cmd: 'solid clone plumber', desc: 'Scaffold from 52 industry templates' },
|
|
83
|
+
{ cmd: 'solid pull', desc: 'Download business data as local files' },
|
|
84
|
+
{ cmd: 'solid push', desc: 'Push local changes to production' },
|
|
85
|
+
{ cmd: 'solid train chat', desc: 'Chat with your AI agent' },
|
|
86
|
+
]),
|
|
87
|
+
'',
|
|
88
|
+
ui_1.ui.divider('Workflow'),
|
|
89
|
+
'',
|
|
90
|
+
` ${chalk_1.default.dim('1.')} ${chalk_1.default.cyan('solid pull')} ${chalk_1.default.dim('→ Download pages, KB, services')}`,
|
|
91
|
+
` ${chalk_1.default.dim('2.')} ${chalk_1.default.dim('Edit files')} ${chalk_1.default.dim('→ VS Code, Cursor, any editor')}`,
|
|
92
|
+
` ${chalk_1.default.dim('3.')} ${chalk_1.default.cyan('solid push')} ${chalk_1.default.dim('→ Deploy changes instantly')}`,
|
|
93
|
+
` ${chalk_1.default.dim('4.')} ${chalk_1.default.cyan('solid vibe')} ${chalk_1.default.dim('→ "Add a hero section" (natural language)')}`,
|
|
94
|
+
'',
|
|
95
|
+
ui_1.ui.divider('AI Training'),
|
|
96
|
+
'',
|
|
97
|
+
ui_1.ui.commandHelp([
|
|
98
|
+
{ cmd: 'solid train import ./kb/', desc: 'Bulk import knowledge base' },
|
|
99
|
+
{ cmd: 'solid train chat sarah', desc: 'Test your AI agent interactively' },
|
|
100
|
+
{ cmd: 'solid train status', desc: 'See KB coverage and gaps' },
|
|
101
|
+
{ cmd: 'solid train add -t "Title"', desc: 'Quick-add a KB entry' },
|
|
102
|
+
]),
|
|
103
|
+
'',
|
|
104
|
+
ui_1.ui.divider(),
|
|
105
|
+
'',
|
|
106
|
+
` ${chalk_1.default.dim('Docs:')} ${chalk_1.default.cyan('solid docs')} ${chalk_1.default.dim('Pull developer documentation')}`,
|
|
107
|
+
` ${chalk_1.default.dim('Help:')} ${chalk_1.default.cyan('solid <cmd> -h')} ${chalk_1.default.dim('Help for any command')}`,
|
|
108
|
+
` ${chalk_1.default.dim('Web:')} ${chalk_1.default.hex('#818cf8')('https://solidnumber.com/developers')}`,
|
|
109
|
+
'',
|
|
110
|
+
];
|
|
111
|
+
return sections.join('\n');
|
|
112
|
+
});
|
|
113
|
+
// Parse arguments
|
|
114
|
+
program.parse(process.argv);
|
|
115
|
+
// Show branded help if no command provided
|
|
116
|
+
if (!process.argv.slice(2).length) {
|
|
117
|
+
program.outputHelp();
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AACA;;;;;;;;;;;;;;;GAeG;;;;;AAEH,yCAAoC;AACpC,kDAA0B;AAC1B,0CAA8C;AAC9C,8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vB,CAAC"}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Client for Solid# Backend
|
|
3
|
+
*/
|
|
4
|
+
interface ApiResponse<T = unknown> {
|
|
5
|
+
data: T;
|
|
6
|
+
status: number;
|
|
7
|
+
success: boolean;
|
|
8
|
+
}
|
|
9
|
+
interface ApiError {
|
|
10
|
+
message: string;
|
|
11
|
+
code?: string;
|
|
12
|
+
status: number;
|
|
13
|
+
}
|
|
14
|
+
declare class ApiClient {
|
|
15
|
+
private client;
|
|
16
|
+
constructor();
|
|
17
|
+
private refreshToken;
|
|
18
|
+
get<T = unknown>(url: string, options?: {
|
|
19
|
+
params?: Record<string, unknown>;
|
|
20
|
+
}): Promise<ApiResponse<T>>;
|
|
21
|
+
post<T = unknown>(url: string, data?: unknown): Promise<ApiResponse<T>>;
|
|
22
|
+
patch<T = unknown>(url: string, data?: unknown): Promise<ApiResponse<T>>;
|
|
23
|
+
delete<T = unknown>(url: string, options?: {
|
|
24
|
+
params?: Record<string, unknown>;
|
|
25
|
+
}): Promise<ApiResponse<T>>;
|
|
26
|
+
login(email: string, password: string): Promise<ApiResponse<{
|
|
27
|
+
access_token: string;
|
|
28
|
+
refresh_token: string;
|
|
29
|
+
expires_at: string;
|
|
30
|
+
user: {
|
|
31
|
+
id: number;
|
|
32
|
+
email: string;
|
|
33
|
+
company_id: number;
|
|
34
|
+
};
|
|
35
|
+
}>>;
|
|
36
|
+
authStatus(): Promise<ApiResponse<{
|
|
37
|
+
authenticated: boolean;
|
|
38
|
+
user?: {
|
|
39
|
+
id: number;
|
|
40
|
+
email: string;
|
|
41
|
+
company_id: number;
|
|
42
|
+
};
|
|
43
|
+
}>>;
|
|
44
|
+
healthQuick(): Promise<ApiResponse<{
|
|
45
|
+
status: string;
|
|
46
|
+
timestamp: string;
|
|
47
|
+
}>>;
|
|
48
|
+
healthFull(): Promise<ApiResponse<{
|
|
49
|
+
status: string;
|
|
50
|
+
layers: Record<string, unknown>;
|
|
51
|
+
summary: {
|
|
52
|
+
healthy_layers: number;
|
|
53
|
+
total_layers: number;
|
|
54
|
+
};
|
|
55
|
+
}>>;
|
|
56
|
+
healthMcp(): Promise<ApiResponse<{
|
|
57
|
+
status: string;
|
|
58
|
+
mcp_enabled: boolean;
|
|
59
|
+
agents: {
|
|
60
|
+
total_agents: number;
|
|
61
|
+
};
|
|
62
|
+
}>>;
|
|
63
|
+
integrationsCatalog(): Promise<ApiResponse<{
|
|
64
|
+
internal_apis: Record<string, unknown>;
|
|
65
|
+
mcp_tools: Record<string, unknown>;
|
|
66
|
+
external_integrations: Record<string, unknown>;
|
|
67
|
+
}>>;
|
|
68
|
+
integrationsList(status?: string): Promise<ApiResponse<{
|
|
69
|
+
integrations: Array<{
|
|
70
|
+
id: string;
|
|
71
|
+
name: string;
|
|
72
|
+
description: string;
|
|
73
|
+
integration_type: string;
|
|
74
|
+
status: string;
|
|
75
|
+
created_at: string;
|
|
76
|
+
}>;
|
|
77
|
+
total: number;
|
|
78
|
+
}>>;
|
|
79
|
+
integrationsHealth(): Promise<ApiResponse<{
|
|
80
|
+
healthy: boolean;
|
|
81
|
+
can_proceed: boolean;
|
|
82
|
+
checks: Record<string, {
|
|
83
|
+
status: string;
|
|
84
|
+
message: string;
|
|
85
|
+
}>;
|
|
86
|
+
warnings: string[];
|
|
87
|
+
}>>;
|
|
88
|
+
integrationsGenerate(params: {
|
|
89
|
+
name: string;
|
|
90
|
+
description: string;
|
|
91
|
+
integration_type: string;
|
|
92
|
+
method?: string;
|
|
93
|
+
endpoint?: string;
|
|
94
|
+
tool_name?: string;
|
|
95
|
+
provider?: string;
|
|
96
|
+
}): Promise<ApiResponse<{
|
|
97
|
+
success: boolean;
|
|
98
|
+
integration: {
|
|
99
|
+
id: string;
|
|
100
|
+
name: string;
|
|
101
|
+
status: string;
|
|
102
|
+
};
|
|
103
|
+
code_preview: string;
|
|
104
|
+
}>>;
|
|
105
|
+
integrationsValidate(integrationId: string): Promise<ApiResponse<{
|
|
106
|
+
valid: boolean;
|
|
107
|
+
issues: Array<{
|
|
108
|
+
severity: string;
|
|
109
|
+
code: string;
|
|
110
|
+
message: string;
|
|
111
|
+
}>;
|
|
112
|
+
blocking_issues_count: number;
|
|
113
|
+
}>>;
|
|
114
|
+
integrationsTest(integrationId: string, testParams?: Record<string, unknown>): Promise<ApiResponse<{
|
|
115
|
+
success: boolean;
|
|
116
|
+
message: string;
|
|
117
|
+
status: string;
|
|
118
|
+
}>>;
|
|
119
|
+
integrationsDeploy(integrationId: string): Promise<ApiResponse<{
|
|
120
|
+
success: boolean;
|
|
121
|
+
integration_id: string;
|
|
122
|
+
status: string;
|
|
123
|
+
deployed_at: string;
|
|
124
|
+
}>>;
|
|
125
|
+
integrationsDisable(integrationId: string, reason?: string): Promise<ApiResponse<{
|
|
126
|
+
success: boolean;
|
|
127
|
+
status: string;
|
|
128
|
+
}>>;
|
|
129
|
+
integrationsRollback(integrationId: string, reason?: string): Promise<ApiResponse<{
|
|
130
|
+
success: boolean;
|
|
131
|
+
status: string;
|
|
132
|
+
}>>;
|
|
133
|
+
integrationsLogs(integrationId: string, limit?: number): Promise<ApiResponse<{
|
|
134
|
+
logs: Array<{
|
|
135
|
+
id: string;
|
|
136
|
+
action: string;
|
|
137
|
+
success: boolean;
|
|
138
|
+
created_at: string;
|
|
139
|
+
}>;
|
|
140
|
+
total: number;
|
|
141
|
+
}>>;
|
|
142
|
+
vibeAnalyze(prompt: string): Promise<ApiResponse<{
|
|
143
|
+
intent: {
|
|
144
|
+
action: string;
|
|
145
|
+
entity_type: string;
|
|
146
|
+
};
|
|
147
|
+
parsed: Record<string, unknown>;
|
|
148
|
+
safety_check: {
|
|
149
|
+
passed: boolean;
|
|
150
|
+
blocked: boolean;
|
|
151
|
+
};
|
|
152
|
+
preview_id?: string;
|
|
153
|
+
}>>;
|
|
154
|
+
vibeApply(previewId: string): Promise<ApiResponse<{
|
|
155
|
+
success: boolean;
|
|
156
|
+
message: string;
|
|
157
|
+
entity_id?: number;
|
|
158
|
+
}>>;
|
|
159
|
+
companyInfo(): Promise<ApiResponse<{
|
|
160
|
+
status: string;
|
|
161
|
+
company: Record<string, unknown>;
|
|
162
|
+
}>>;
|
|
163
|
+
kbSearch(query: string, limit?: number): Promise<ApiResponse<{
|
|
164
|
+
results: unknown[];
|
|
165
|
+
total: number;
|
|
166
|
+
}>>;
|
|
167
|
+
kbCreate(params: {
|
|
168
|
+
title: string;
|
|
169
|
+
content: string;
|
|
170
|
+
category?: string;
|
|
171
|
+
}): Promise<ApiResponse<{
|
|
172
|
+
success: boolean;
|
|
173
|
+
id?: number;
|
|
174
|
+
}>>;
|
|
175
|
+
kbUpdate(id: number, params: {
|
|
176
|
+
title?: string;
|
|
177
|
+
content?: string;
|
|
178
|
+
category?: string;
|
|
179
|
+
}): Promise<ApiResponse<{
|
|
180
|
+
success: boolean;
|
|
181
|
+
}>>;
|
|
182
|
+
kbDelete(id: number): Promise<ApiResponse<{
|
|
183
|
+
success: boolean;
|
|
184
|
+
}>>;
|
|
185
|
+
pagesList(params?: {
|
|
186
|
+
site_id?: number;
|
|
187
|
+
page_type?: string;
|
|
188
|
+
}): Promise<ApiResponse<{
|
|
189
|
+
pages: unknown[];
|
|
190
|
+
total: number;
|
|
191
|
+
}>>;
|
|
192
|
+
pagesPublish(pageId: number): Promise<ApiResponse<{
|
|
193
|
+
success: boolean;
|
|
194
|
+
}>>;
|
|
195
|
+
pagesUnpublish(pageId: number): Promise<ApiResponse<{
|
|
196
|
+
success: boolean;
|
|
197
|
+
}>>;
|
|
198
|
+
servicesList(): Promise<ApiResponse<{
|
|
199
|
+
items: unknown[];
|
|
200
|
+
total: number;
|
|
201
|
+
}>>;
|
|
202
|
+
productsList(params?: {
|
|
203
|
+
category?: string;
|
|
204
|
+
featured_only?: boolean;
|
|
205
|
+
}): Promise<ApiResponse<{
|
|
206
|
+
items: unknown[];
|
|
207
|
+
total: number;
|
|
208
|
+
}>>;
|
|
209
|
+
updateWebsiteSettings(settings: Record<string, unknown>): Promise<ApiResponse<unknown>>;
|
|
210
|
+
pageGet(pageId: number): Promise<ApiResponse<Record<string, unknown>>>;
|
|
211
|
+
pageUpdate(pageId: number, data: Record<string, unknown>): Promise<ApiResponse<Record<string, unknown>>>;
|
|
212
|
+
pageCreate(data: Record<string, unknown>): Promise<ApiResponse<Record<string, unknown>>>;
|
|
213
|
+
agentChat(message: string, agentName?: string): Promise<ApiResponse<{
|
|
214
|
+
response: string;
|
|
215
|
+
}>>;
|
|
216
|
+
templatesList(): Promise<ApiResponse<{
|
|
217
|
+
templates: unknown[];
|
|
218
|
+
total: number;
|
|
219
|
+
}>>;
|
|
220
|
+
templatePreview(name: string): Promise<ApiResponse<Record<string, unknown>>>;
|
|
221
|
+
templateClone(name: string): Promise<ApiResponse<{
|
|
222
|
+
success: boolean;
|
|
223
|
+
template: string;
|
|
224
|
+
display_name: string;
|
|
225
|
+
created: {
|
|
226
|
+
kb_entries: number;
|
|
227
|
+
pages?: number;
|
|
228
|
+
services?: number;
|
|
229
|
+
};
|
|
230
|
+
}>>;
|
|
231
|
+
}
|
|
232
|
+
export declare const apiClient: ApiClient;
|
|
233
|
+
export declare function handleApiError(error: unknown): ApiError;
|
|
234
|
+
export {};
|
|
235
|
+
//# sourceMappingURL=api-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../../src/lib/api-client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,UAAU,WAAW,CAAC,CAAC,GAAG,OAAO;IAC/B,IAAI,EAAE,CAAC,CAAC;IACR,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,UAAU,QAAQ;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,cAAM,SAAS;IACb,OAAO,CAAC,MAAM,CAAgB;;YAyChB,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xF,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,SAAU,GAAG,OAAO,CAAC,WAAW,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAS3F,aAAa,IAAI,OAAO,CAAC,WAAW,CAAC;QAAE,SAAS,EAAE,OAAO,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAK9E,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAK5E,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;QACrD,OAAO,EAAE,OAAO,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;QACrB,OAAO,EAAE;YAAE,UAAU,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KACpE,CAAC,CAAC;CAIJ;AAED,eAAO,MAAM,SAAS,WAAkB,CAAC;AAEzC,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAYvD"}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* API Client for Solid# Backend
|
|
4
|
+
*/
|
|
5
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.apiClient = void 0;
|
|
10
|
+
exports.handleApiError = handleApiError;
|
|
11
|
+
const axios_1 = __importDefault(require("axios"));
|
|
12
|
+
const config_1 = require("./config");
|
|
13
|
+
class ApiClient {
|
|
14
|
+
client;
|
|
15
|
+
constructor() {
|
|
16
|
+
this.client = axios_1.default.create({
|
|
17
|
+
baseURL: config_1.config.apiUrl,
|
|
18
|
+
timeout: 30000,
|
|
19
|
+
headers: {
|
|
20
|
+
'Content-Type': 'application/json',
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
// Add auth interceptor
|
|
24
|
+
this.client.interceptors.request.use((requestConfig) => {
|
|
25
|
+
const token = config_1.config.accessToken;
|
|
26
|
+
if (token) {
|
|
27
|
+
requestConfig.headers.Authorization = `Bearer ${token}`;
|
|
28
|
+
}
|
|
29
|
+
const companyId = config_1.config.companyId;
|
|
30
|
+
if (companyId) {
|
|
31
|
+
requestConfig.headers['X-Company-ID'] = companyId.toString();
|
|
32
|
+
}
|
|
33
|
+
return requestConfig;
|
|
34
|
+
});
|
|
35
|
+
// Add response interceptor
|
|
36
|
+
this.client.interceptors.response.use((response) => response, async (error) => {
|
|
37
|
+
if (error.response?.status === 401) {
|
|
38
|
+
// Try to refresh token
|
|
39
|
+
const refreshed = await this.refreshToken();
|
|
40
|
+
if (refreshed && error.config) {
|
|
41
|
+
// Retry original request
|
|
42
|
+
return this.client.request(error.config);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
throw error;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
async refreshToken() {
|
|
49
|
+
const refreshToken = config_1.config.refreshToken;
|
|
50
|
+
if (!refreshToken)
|
|
51
|
+
return false;
|
|
52
|
+
try {
|
|
53
|
+
const response = await axios_1.default.post(`${config_1.config.apiUrl}/api/v1/auth/refresh`, {
|
|
54
|
+
refresh_token: refreshToken,
|
|
55
|
+
});
|
|
56
|
+
config_1.config.accessToken = response.data.access_token;
|
|
57
|
+
if (response.data.refresh_token) {
|
|
58
|
+
config_1.config.refreshToken = response.data.refresh_token;
|
|
59
|
+
}
|
|
60
|
+
if (response.data.expires_at) {
|
|
61
|
+
config_1.config.tokenExpiresAt = new Date(response.data.expires_at);
|
|
62
|
+
}
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
config_1.config.logout();
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// Generic HTTP methods (used by droplet, dev, etc.)
|
|
71
|
+
async get(url, options) {
|
|
72
|
+
const response = await this.client.get(url, options);
|
|
73
|
+
return { data: response.data, status: response.status, success: true };
|
|
74
|
+
}
|
|
75
|
+
async post(url, data) {
|
|
76
|
+
const response = await this.client.post(url, data);
|
|
77
|
+
return { data: response.data, status: response.status, success: true };
|
|
78
|
+
}
|
|
79
|
+
async patch(url, data) {
|
|
80
|
+
const response = await this.client.patch(url, data);
|
|
81
|
+
return { data: response.data, status: response.status, success: true };
|
|
82
|
+
}
|
|
83
|
+
async delete(url, options) {
|
|
84
|
+
const response = await this.client.delete(url, options);
|
|
85
|
+
return { data: response.data, status: response.status, success: true };
|
|
86
|
+
}
|
|
87
|
+
// Auth endpoints
|
|
88
|
+
async login(email, password) {
|
|
89
|
+
const response = await this.client.post('/api/v1/auth/login', {
|
|
90
|
+
email,
|
|
91
|
+
password,
|
|
92
|
+
});
|
|
93
|
+
return { data: response.data, status: response.status, success: true };
|
|
94
|
+
}
|
|
95
|
+
async authStatus() {
|
|
96
|
+
try {
|
|
97
|
+
const response = await this.client.get('/api/v1/auth/me');
|
|
98
|
+
return { data: { authenticated: true, user: response.data }, status: response.status, success: true };
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
return { data: { authenticated: false }, status: 401, success: false };
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// Health endpoints
|
|
105
|
+
async healthQuick() {
|
|
106
|
+
const response = await this.client.get('/api/v1/healthcheck/quick');
|
|
107
|
+
return { data: response.data, status: response.status, success: true };
|
|
108
|
+
}
|
|
109
|
+
async healthFull() {
|
|
110
|
+
const response = await this.client.get('/api/v1/healthcheck/');
|
|
111
|
+
return { data: response.data, status: response.status, success: true };
|
|
112
|
+
}
|
|
113
|
+
async healthMcp() {
|
|
114
|
+
const response = await this.client.get('/api/v1/healthcheck/mcp');
|
|
115
|
+
return { data: response.data, status: response.status, success: true };
|
|
116
|
+
}
|
|
117
|
+
// Integration endpoints
|
|
118
|
+
async integrationsCatalog() {
|
|
119
|
+
const response = await this.client.get('/api/v1/vibe/integrations/catalog');
|
|
120
|
+
return { data: response.data, status: response.status, success: true };
|
|
121
|
+
}
|
|
122
|
+
async integrationsList(status) {
|
|
123
|
+
const params = status ? { status } : {};
|
|
124
|
+
const response = await this.client.get('/api/v1/vibe/integrations/', { params });
|
|
125
|
+
return { data: response.data, status: response.status, success: true };
|
|
126
|
+
}
|
|
127
|
+
async integrationsHealth() {
|
|
128
|
+
const response = await this.client.get('/api/v1/vibe/integrations/health');
|
|
129
|
+
return { data: response.data, status: response.status, success: true };
|
|
130
|
+
}
|
|
131
|
+
async integrationsGenerate(params) {
|
|
132
|
+
const response = await this.client.post('/api/v1/vibe/integrations/generate', params);
|
|
133
|
+
return { data: response.data, status: response.status, success: true };
|
|
134
|
+
}
|
|
135
|
+
async integrationsValidate(integrationId) {
|
|
136
|
+
const response = await this.client.post(`/api/v1/vibe/integrations/validate/${integrationId}`);
|
|
137
|
+
return { data: response.data, status: response.status, success: true };
|
|
138
|
+
}
|
|
139
|
+
async integrationsTest(integrationId, testParams) {
|
|
140
|
+
const response = await this.client.post(`/api/v1/vibe/integrations/test/${integrationId}`, {
|
|
141
|
+
test_params: testParams || {},
|
|
142
|
+
});
|
|
143
|
+
return { data: response.data, status: response.status, success: true };
|
|
144
|
+
}
|
|
145
|
+
async integrationsDeploy(integrationId) {
|
|
146
|
+
const response = await this.client.post(`/api/v1/vibe/integrations/deploy/${integrationId}`);
|
|
147
|
+
return { data: response.data, status: response.status, success: true };
|
|
148
|
+
}
|
|
149
|
+
async integrationsDisable(integrationId, reason) {
|
|
150
|
+
const response = await this.client.post(`/api/v1/vibe/integrations/disable/${integrationId}`, { reason });
|
|
151
|
+
return { data: response.data, status: response.status, success: true };
|
|
152
|
+
}
|
|
153
|
+
async integrationsRollback(integrationId, reason) {
|
|
154
|
+
const response = await this.client.post(`/api/v1/vibe/integrations/rollback/${integrationId}`, { reason });
|
|
155
|
+
return { data: response.data, status: response.status, success: true };
|
|
156
|
+
}
|
|
157
|
+
async integrationsLogs(integrationId, limit = 100) {
|
|
158
|
+
const response = await this.client.get(`/api/v1/vibe/integrations/${integrationId}/logs`, {
|
|
159
|
+
params: { limit },
|
|
160
|
+
});
|
|
161
|
+
return { data: response.data, status: response.status, success: true };
|
|
162
|
+
}
|
|
163
|
+
// Vibe endpoints
|
|
164
|
+
async vibeAnalyze(prompt) {
|
|
165
|
+
const response = await this.client.post('/api/v1/vibe/analyze', { prompt });
|
|
166
|
+
return { data: response.data, status: response.status, success: true };
|
|
167
|
+
}
|
|
168
|
+
async vibeApply(previewId) {
|
|
169
|
+
const response = await this.client.post('/api/v1/vibe/apply', {
|
|
170
|
+
preview_id: previewId,
|
|
171
|
+
confirm: true,
|
|
172
|
+
});
|
|
173
|
+
return { data: response.data, status: response.status, success: true };
|
|
174
|
+
}
|
|
175
|
+
// Company info
|
|
176
|
+
async companyInfo() {
|
|
177
|
+
const response = await this.client.post('/api/v1/rpc/Company/info', {
|
|
178
|
+
query: { id: config_1.config.companyId },
|
|
179
|
+
});
|
|
180
|
+
return { data: response.data, status: response.status, success: true };
|
|
181
|
+
}
|
|
182
|
+
// KB endpoints (via MCP tools)
|
|
183
|
+
async kbSearch(query, limit = 20) {
|
|
184
|
+
const response = await this.client.post('/mcp/tools/kb.search', { query, limit });
|
|
185
|
+
return { data: response.data, status: response.status, success: true };
|
|
186
|
+
}
|
|
187
|
+
async kbCreate(params) {
|
|
188
|
+
const response = await this.client.post('/mcp/tools/kb.create', params);
|
|
189
|
+
return { data: response.data, status: response.status, success: true };
|
|
190
|
+
}
|
|
191
|
+
async kbUpdate(id, params) {
|
|
192
|
+
const response = await this.client.post('/mcp/tools/kb.update', { id, ...params });
|
|
193
|
+
return { data: response.data, status: response.status, success: true };
|
|
194
|
+
}
|
|
195
|
+
async kbDelete(id) {
|
|
196
|
+
const response = await this.client.post('/mcp/tools/kb.delete', { id });
|
|
197
|
+
return { data: response.data, status: response.status, success: true };
|
|
198
|
+
}
|
|
199
|
+
// CMS Pages
|
|
200
|
+
async pagesList(params) {
|
|
201
|
+
const response = await this.client.get('/api/v1/cms/pages', { params });
|
|
202
|
+
return { data: response.data, status: response.status, success: true };
|
|
203
|
+
}
|
|
204
|
+
async pagesPublish(pageId) {
|
|
205
|
+
const response = await this.client.post(`/api/v1/cms/pages/${pageId}/publish`);
|
|
206
|
+
return { data: response.data, status: response.status, success: true };
|
|
207
|
+
}
|
|
208
|
+
async pagesUnpublish(pageId) {
|
|
209
|
+
const response = await this.client.post(`/api/v1/cms/pages/${pageId}/unpublish`);
|
|
210
|
+
return { data: response.data, status: response.status, success: true };
|
|
211
|
+
}
|
|
212
|
+
// Services
|
|
213
|
+
async servicesList() {
|
|
214
|
+
const companyId = config_1.config.companyId;
|
|
215
|
+
const response = await this.client.get(`/api/v1/cms/public/services`, {
|
|
216
|
+
params: { company_id: companyId },
|
|
217
|
+
});
|
|
218
|
+
return { data: response.data, status: response.status, success: true };
|
|
219
|
+
}
|
|
220
|
+
// Products
|
|
221
|
+
async productsList(params) {
|
|
222
|
+
const companyId = config_1.config.companyId;
|
|
223
|
+
const response = await this.client.get(`/api/v1/cms/public/products`, {
|
|
224
|
+
params: { company_id: companyId, ...params },
|
|
225
|
+
});
|
|
226
|
+
return { data: response.data, status: response.status, success: true };
|
|
227
|
+
}
|
|
228
|
+
// Website settings update
|
|
229
|
+
async updateWebsiteSettings(settings) {
|
|
230
|
+
const companyId = config_1.config.companyId;
|
|
231
|
+
const response = await this.client.patch(`/api/v1/companies/${companyId}`, {
|
|
232
|
+
website_settings: settings,
|
|
233
|
+
});
|
|
234
|
+
return { data: response.data, status: response.status, success: true };
|
|
235
|
+
}
|
|
236
|
+
// Single page (full detail with layout_json)
|
|
237
|
+
async pageGet(pageId) {
|
|
238
|
+
const response = await this.client.get(`/api/v1/cms/pages/${pageId}`);
|
|
239
|
+
return { data: response.data, status: response.status, success: true };
|
|
240
|
+
}
|
|
241
|
+
// Update page
|
|
242
|
+
async pageUpdate(pageId, data) {
|
|
243
|
+
const response = await this.client.patch(`/api/v1/cms/pages/${pageId}`, data);
|
|
244
|
+
return { data: response.data, status: response.status, success: true };
|
|
245
|
+
}
|
|
246
|
+
// Create page
|
|
247
|
+
async pageCreate(data) {
|
|
248
|
+
const response = await this.client.post(`/api/v1/cms/pages`, data);
|
|
249
|
+
return { data: response.data, status: response.status, success: true };
|
|
250
|
+
}
|
|
251
|
+
// AI Chat (talk to agents)
|
|
252
|
+
async agentChat(message, agentName = 'sarah') {
|
|
253
|
+
const response = await this.client.post('/api/v1/chat/', {
|
|
254
|
+
message,
|
|
255
|
+
agent: agentName,
|
|
256
|
+
});
|
|
257
|
+
return { data: response.data, status: response.status, success: true };
|
|
258
|
+
}
|
|
259
|
+
// Templates (solid clone)
|
|
260
|
+
async templatesList() {
|
|
261
|
+
const response = await this.client.get('/api/v1/cli/templates/');
|
|
262
|
+
return { data: response.data, status: response.status, success: true };
|
|
263
|
+
}
|
|
264
|
+
async templatePreview(name) {
|
|
265
|
+
const response = await this.client.get(`/api/v1/cli/templates/${name}`);
|
|
266
|
+
return { data: response.data, status: response.status, success: true };
|
|
267
|
+
}
|
|
268
|
+
async templateClone(name) {
|
|
269
|
+
const response = await this.client.post(`/api/v1/cli/templates/${name}/clone`);
|
|
270
|
+
return { data: response.data, status: response.status, success: true };
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
exports.apiClient = new ApiClient();
|
|
274
|
+
function handleApiError(error) {
|
|
275
|
+
if (axios_1.default.isAxiosError(error)) {
|
|
276
|
+
const axiosError = error;
|
|
277
|
+
return {
|
|
278
|
+
message: axiosError.response?.data?.detail || axiosError.response?.data?.message || axiosError.message,
|
|
279
|
+
status: axiosError.response?.status || 500,
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
return {
|
|
283
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
284
|
+
status: 500,
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
//# sourceMappingURL=api-client.js.map
|