@semacode/cli 1.5.25 → 1.5.27
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 +3 -3
- package/SEMA_BRIEF.curto.txt +6 -6
- package/SEMA_BRIEF.md +24 -31
- package/SEMA_BRIEF.micro.txt +5 -5
- package/SEMA_INDEX.json +154 -349
- package/dist/index.js +564 -13
- package/dist/index.js.map +1 -1
- package/docs/cli.md +4 -4
- package/docs/env.md +3 -3
- package/docs/instalacao-e-primeiro-uso.md +5 -5
- package/docs/persistencia-vendor-first.md +1 -1
- package/docs/repositories.md +54 -0
- package/docs/rollback.md +1 -1
- package/docs/seguranca.md +126 -0
- package/node_modules/@sema/gerador-css/package.json +1 -1
- package/node_modules/@sema/gerador-dart/package.json +1 -1
- package/node_modules/@sema/gerador-html/package.json +1 -1
- package/node_modules/@sema/gerador-javascript/package.json +1 -1
- package/node_modules/@sema/gerador-lua/package.json +1 -1
- package/node_modules/@sema/gerador-python/package.json +1 -1
- package/node_modules/@sema/gerador-typescript/package.json +1 -1
- package/node_modules/@sema/nucleo/package.json +1 -1
- package/node_modules/@sema/padroes/package.json +1 -1
- package/package.json +10 -10
- package/dist/controleComercialSupabase.d.ts +0 -326
- package/dist/controleComercialSupabase.js +0 -310
- package/dist/controleComercialSupabase.js.map +0 -1
- package/docs/deploy.md +0 -258
|
@@ -1,326 +0,0 @@
|
|
|
1
|
-
export type SemaPlanId = "free" | "pro" | "team" | "agency";
|
|
2
|
-
export type SemaAuthProvider = "email_password" | "google" | "facebook" | "microsoft";
|
|
3
|
-
export interface SupabaseRpcResult<T> {
|
|
4
|
-
data: T | null;
|
|
5
|
-
error: {
|
|
6
|
-
message?: string;
|
|
7
|
-
} | null;
|
|
8
|
-
}
|
|
9
|
-
export interface SupabaseRpcClient {
|
|
10
|
-
rpc<T>(functionName: string, params: Record<string, unknown>): Promise<SupabaseRpcResult<T>>;
|
|
11
|
-
}
|
|
12
|
-
export interface ProvisionarWorkspaceFreeInput {
|
|
13
|
-
authUserId: string;
|
|
14
|
-
email: string;
|
|
15
|
-
emailVerified: boolean;
|
|
16
|
-
authProvider: SemaAuthProvider | string;
|
|
17
|
-
displayName?: string;
|
|
18
|
-
organizationName?: string;
|
|
19
|
-
projectName?: string;
|
|
20
|
-
}
|
|
21
|
-
export interface ProvisionarWorkspaceFreeResult {
|
|
22
|
-
usuario_id: string;
|
|
23
|
-
organizacao_id: string;
|
|
24
|
-
projeto_id: string;
|
|
25
|
-
assinatura_id: string;
|
|
26
|
-
periodo_inicio: string;
|
|
27
|
-
semas_mensais: number;
|
|
28
|
-
}
|
|
29
|
-
export interface ConsultarContextoComercialUsuarioInput {
|
|
30
|
-
authUserId: string;
|
|
31
|
-
}
|
|
32
|
-
export interface ClaimFreeWorkspaceInput {
|
|
33
|
-
displayName?: string;
|
|
34
|
-
organizationName?: string;
|
|
35
|
-
projectName?: string;
|
|
36
|
-
authProvider?: SemaAuthProvider | string;
|
|
37
|
-
}
|
|
38
|
-
export interface ConsultaContextoComercialUsuarioPlano {
|
|
39
|
-
id: SemaPlanId;
|
|
40
|
-
name: string;
|
|
41
|
-
monthly_semas: number;
|
|
42
|
-
}
|
|
43
|
-
export interface ConsultaContextoComercialUsuarioResult {
|
|
44
|
-
authUserId: string;
|
|
45
|
-
tabelas: readonly string[];
|
|
46
|
-
filtros: {
|
|
47
|
-
perfil: {
|
|
48
|
-
id: string;
|
|
49
|
-
};
|
|
50
|
-
memberships: {
|
|
51
|
-
user_id: string;
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
export interface SemaUsageBreakdownItem {
|
|
56
|
-
projectId?: string | null;
|
|
57
|
-
projectName?: string | null;
|
|
58
|
-
projectSlug?: string | null;
|
|
59
|
-
clientId?: string | null;
|
|
60
|
-
clientName?: string | null;
|
|
61
|
-
tokenPrefix?: string | null;
|
|
62
|
-
toolName?: string | null;
|
|
63
|
-
requestedSemas: number;
|
|
64
|
-
chargedSemas: number;
|
|
65
|
-
usedSemas?: number;
|
|
66
|
-
callCount: number;
|
|
67
|
-
adminBypassCount?: number;
|
|
68
|
-
share?: number;
|
|
69
|
-
lastUsedAt?: string | null;
|
|
70
|
-
usagePeriods?: SemaUsagePeriods;
|
|
71
|
-
dailySeries?: SemaUsageDailyPoint[];
|
|
72
|
-
}
|
|
73
|
-
export interface SemaUsagePeriod {
|
|
74
|
-
requestedSemas: number;
|
|
75
|
-
chargedSemas: number;
|
|
76
|
-
usedSemas?: number;
|
|
77
|
-
callCount: number;
|
|
78
|
-
adminBypassCount?: number;
|
|
79
|
-
}
|
|
80
|
-
export interface SemaUsagePeriods {
|
|
81
|
-
today: SemaUsagePeriod;
|
|
82
|
-
week: SemaUsagePeriod;
|
|
83
|
-
month: SemaUsagePeriod;
|
|
84
|
-
all: SemaUsagePeriod;
|
|
85
|
-
}
|
|
86
|
-
export interface SemaUsageDailyPoint {
|
|
87
|
-
date: string;
|
|
88
|
-
requestedSemas: number;
|
|
89
|
-
chargedSemas: number;
|
|
90
|
-
usedSemas?: number;
|
|
91
|
-
callCount: number;
|
|
92
|
-
}
|
|
93
|
-
export interface SemaUsageSummary {
|
|
94
|
-
totalRequestedSemas: number;
|
|
95
|
-
totalChargedSemas: number;
|
|
96
|
-
callCount: number;
|
|
97
|
-
adminBypassCount: number;
|
|
98
|
-
byProject: SemaUsageBreakdownItem[];
|
|
99
|
-
byKey: SemaUsageBreakdownItem[];
|
|
100
|
-
byTool: SemaUsageBreakdownItem[];
|
|
101
|
-
usagePeriods?: SemaUsagePeriods;
|
|
102
|
-
dailySeries?: SemaUsageDailyPoint[];
|
|
103
|
-
}
|
|
104
|
-
export interface SemaMcpClientSummary {
|
|
105
|
-
id: string;
|
|
106
|
-
name: string;
|
|
107
|
-
tokenPrefix?: string | null;
|
|
108
|
-
token?: string | null;
|
|
109
|
-
copyable?: boolean;
|
|
110
|
-
status: string;
|
|
111
|
-
organizationId?: string;
|
|
112
|
-
defaultProjectId?: string | null;
|
|
113
|
-
projectId?: string | null;
|
|
114
|
-
projectName?: string | null;
|
|
115
|
-
projectSlug?: string | null;
|
|
116
|
-
scope?: "workspace" | "project" | string;
|
|
117
|
-
createdAt?: string;
|
|
118
|
-
updatedAt?: string;
|
|
119
|
-
lastUsedAt?: string | null;
|
|
120
|
-
requestedSemas?: number;
|
|
121
|
-
chargedSemas?: number;
|
|
122
|
-
usedSemas?: number;
|
|
123
|
-
callCount?: number;
|
|
124
|
-
}
|
|
125
|
-
export interface SemaAccountContext {
|
|
126
|
-
authenticated: boolean;
|
|
127
|
-
provisioned: boolean;
|
|
128
|
-
user: {
|
|
129
|
-
id: string;
|
|
130
|
-
email: string;
|
|
131
|
-
displayName?: string;
|
|
132
|
-
phone?: string | null;
|
|
133
|
-
locale?: string | null;
|
|
134
|
-
timezone?: string | null;
|
|
135
|
-
emailVerified: boolean;
|
|
136
|
-
provider: string;
|
|
137
|
-
};
|
|
138
|
-
admin: {
|
|
139
|
-
isAdmin: boolean;
|
|
140
|
-
displayName?: string | null;
|
|
141
|
-
infiniteSemas: boolean;
|
|
142
|
-
};
|
|
143
|
-
organization: {
|
|
144
|
-
id: string;
|
|
145
|
-
name: string;
|
|
146
|
-
slug: string;
|
|
147
|
-
role: string;
|
|
148
|
-
} | null;
|
|
149
|
-
plan: {
|
|
150
|
-
id: SemaPlanId;
|
|
151
|
-
name: string;
|
|
152
|
-
monthlySemas: number;
|
|
153
|
-
projectLimit: number;
|
|
154
|
-
userLimit: number;
|
|
155
|
-
retentionDays: number;
|
|
156
|
-
monthlyPriceUsd: number;
|
|
157
|
-
} | null;
|
|
158
|
-
balance: {
|
|
159
|
-
periodStart: string;
|
|
160
|
-
periodEnd: string;
|
|
161
|
-
monthlySemas: number;
|
|
162
|
-
usedSemas: number;
|
|
163
|
-
reservedSemas: number;
|
|
164
|
-
remainingSemas: number | null;
|
|
165
|
-
infiniteSemas: boolean;
|
|
166
|
-
accumulates: boolean;
|
|
167
|
-
} | null;
|
|
168
|
-
projects: Array<{
|
|
169
|
-
id: string;
|
|
170
|
-
name: string;
|
|
171
|
-
description?: string;
|
|
172
|
-
slug: string;
|
|
173
|
-
status: string;
|
|
174
|
-
createdAt?: string;
|
|
175
|
-
updatedAt?: string;
|
|
176
|
-
requestedSemas?: number;
|
|
177
|
-
chargedSemas?: number;
|
|
178
|
-
usedSemas?: number;
|
|
179
|
-
callCount?: number;
|
|
180
|
-
activeKeyCount?: number;
|
|
181
|
-
lastUsedAt?: string | null;
|
|
182
|
-
usagePeriods?: SemaUsagePeriods;
|
|
183
|
-
dailySeries?: SemaUsageDailyPoint[];
|
|
184
|
-
}>;
|
|
185
|
-
usage: Array<{
|
|
186
|
-
id: string;
|
|
187
|
-
toolName: string;
|
|
188
|
-
requestedSemas: number;
|
|
189
|
-
chargedSemas: number;
|
|
190
|
-
adminBypass: boolean;
|
|
191
|
-
projectId?: string | null;
|
|
192
|
-
projectName?: string | null;
|
|
193
|
-
projectSlug?: string | null;
|
|
194
|
-
mcpClientId?: string | null;
|
|
195
|
-
mcpClientName?: string | null;
|
|
196
|
-
createdAt?: string;
|
|
197
|
-
}>;
|
|
198
|
-
usageSummary?: SemaUsageSummary;
|
|
199
|
-
mcpKeys?: SemaMcpClientSummary[];
|
|
200
|
-
}
|
|
201
|
-
export interface SemaAccountProfile {
|
|
202
|
-
id: string;
|
|
203
|
-
email: string;
|
|
204
|
-
displayName?: string | null;
|
|
205
|
-
phone?: string | null;
|
|
206
|
-
locale?: string | null;
|
|
207
|
-
timezone?: string | null;
|
|
208
|
-
emailVerified: boolean;
|
|
209
|
-
provider: string;
|
|
210
|
-
profileFound: boolean;
|
|
211
|
-
}
|
|
212
|
-
export interface AtualizarPerfilContaInput {
|
|
213
|
-
displayName?: string | null;
|
|
214
|
-
phone?: string | null;
|
|
215
|
-
locale?: string | null;
|
|
216
|
-
timezone?: string | null;
|
|
217
|
-
}
|
|
218
|
-
export interface AtualizarPerfilContaResult {
|
|
219
|
-
updated: boolean;
|
|
220
|
-
profile: SemaAccountProfile;
|
|
221
|
-
context: SemaAccountContext;
|
|
222
|
-
}
|
|
223
|
-
export interface SemaMcpClientContext {
|
|
224
|
-
active: boolean;
|
|
225
|
-
activeCount?: number;
|
|
226
|
-
token?: string | null;
|
|
227
|
-
copyable?: boolean;
|
|
228
|
-
client: SemaMcpClientSummary | null;
|
|
229
|
-
clients?: SemaMcpClientSummary[];
|
|
230
|
-
keys?: SemaMcpClientSummary[];
|
|
231
|
-
}
|
|
232
|
-
export interface CriarProjetoWorkspaceInput {
|
|
233
|
-
name: string;
|
|
234
|
-
description?: string;
|
|
235
|
-
}
|
|
236
|
-
export interface CriarProjetoWorkspaceResult {
|
|
237
|
-
created: boolean;
|
|
238
|
-
project: {
|
|
239
|
-
id: string;
|
|
240
|
-
name: string;
|
|
241
|
-
description?: string;
|
|
242
|
-
slug: string;
|
|
243
|
-
status: string;
|
|
244
|
-
};
|
|
245
|
-
context: SemaAccountContext;
|
|
246
|
-
}
|
|
247
|
-
export interface AtualizarProjetoWorkspaceInput {
|
|
248
|
-
projectId: string;
|
|
249
|
-
name?: string;
|
|
250
|
-
description?: string;
|
|
251
|
-
}
|
|
252
|
-
export interface AtualizarProjetoWorkspaceResult {
|
|
253
|
-
updated: boolean;
|
|
254
|
-
project: {
|
|
255
|
-
id: string;
|
|
256
|
-
name: string;
|
|
257
|
-
description?: string;
|
|
258
|
-
slug: string;
|
|
259
|
-
status: string;
|
|
260
|
-
};
|
|
261
|
-
context: SemaAccountContext;
|
|
262
|
-
}
|
|
263
|
-
export interface ArquivarProjetoWorkspaceInput {
|
|
264
|
-
projectId: string;
|
|
265
|
-
}
|
|
266
|
-
export interface ArquivarProjetoWorkspaceResult {
|
|
267
|
-
archived: boolean;
|
|
268
|
-
projectId: string;
|
|
269
|
-
context: SemaAccountContext;
|
|
270
|
-
}
|
|
271
|
-
export interface GerarChaveMcpWorkspaceInput {
|
|
272
|
-
name?: string;
|
|
273
|
-
projectId?: string | null;
|
|
274
|
-
}
|
|
275
|
-
export interface GerarChaveMcpWorkspaceResult {
|
|
276
|
-
generated: boolean;
|
|
277
|
-
token: string;
|
|
278
|
-
copyable?: boolean;
|
|
279
|
-
client: SemaMcpClientSummary;
|
|
280
|
-
mcpKey: SemaMcpClientContext;
|
|
281
|
-
}
|
|
282
|
-
export interface RevogarChaveMcpWorkspaceInput {
|
|
283
|
-
clientId: string;
|
|
284
|
-
}
|
|
285
|
-
export interface RevogarChaveMcpWorkspaceResult {
|
|
286
|
-
revoked: boolean;
|
|
287
|
-
clientId: string;
|
|
288
|
-
mcpKey: SemaMcpClientContext;
|
|
289
|
-
}
|
|
290
|
-
export interface ConsumirSemasMcpInput {
|
|
291
|
-
actorUserId?: string;
|
|
292
|
-
organizationId?: string;
|
|
293
|
-
projectId?: string;
|
|
294
|
-
amount?: number;
|
|
295
|
-
toolName: string;
|
|
296
|
-
requestSummary?: string;
|
|
297
|
-
idempotencyKey: string;
|
|
298
|
-
metadata?: Record<string, unknown>;
|
|
299
|
-
privateRpc?: boolean;
|
|
300
|
-
mcpTokenHash?: string;
|
|
301
|
-
}
|
|
302
|
-
export interface ConsumirSemasMcpResult {
|
|
303
|
-
authorized: boolean;
|
|
304
|
-
idempotent: boolean;
|
|
305
|
-
usageEventId: string;
|
|
306
|
-
organizationId: string;
|
|
307
|
-
projectId?: string | null;
|
|
308
|
-
requestedSemas: number;
|
|
309
|
-
chargedSemas: number;
|
|
310
|
-
remainingSemas: number | null;
|
|
311
|
-
infiniteSemas: boolean;
|
|
312
|
-
adminBypass: boolean;
|
|
313
|
-
}
|
|
314
|
-
export declare function provisionarWorkspaceFree(client: SupabaseRpcClient, input: ProvisionarWorkspaceFreeInput): Promise<ProvisionarWorkspaceFreeResult>;
|
|
315
|
-
export declare function claimFreeWorkspace(client: SupabaseRpcClient, input?: ClaimFreeWorkspaceInput): Promise<ProvisionarWorkspaceFreeResult>;
|
|
316
|
-
export declare function consultarContextoComercialUsuario(input: ConsultarContextoComercialUsuarioInput): ConsultaContextoComercialUsuarioResult;
|
|
317
|
-
export declare function consultarPainelUsuario(client: SupabaseRpcClient): Promise<SemaAccountContext>;
|
|
318
|
-
export declare function consultarPerfilConta(client: SupabaseRpcClient): Promise<SemaAccountProfile>;
|
|
319
|
-
export declare function atualizarPerfilConta(client: SupabaseRpcClient, input: AtualizarPerfilContaInput): Promise<AtualizarPerfilContaResult>;
|
|
320
|
-
export declare function criarProjetoWorkspace(client: SupabaseRpcClient, input: CriarProjetoWorkspaceInput): Promise<CriarProjetoWorkspaceResult>;
|
|
321
|
-
export declare function atualizarProjetoWorkspace(client: SupabaseRpcClient, input: AtualizarProjetoWorkspaceInput): Promise<AtualizarProjetoWorkspaceResult>;
|
|
322
|
-
export declare function arquivarProjetoWorkspace(client: SupabaseRpcClient, input: ArquivarProjetoWorkspaceInput): Promise<ArquivarProjetoWorkspaceResult>;
|
|
323
|
-
export declare function consultarChaveMcpWorkspace(client: SupabaseRpcClient): Promise<SemaMcpClientContext>;
|
|
324
|
-
export declare function gerarChaveMcpWorkspace(client: SupabaseRpcClient, input?: GerarChaveMcpWorkspaceInput): Promise<GerarChaveMcpWorkspaceResult>;
|
|
325
|
-
export declare function revogarChaveMcpWorkspace(client: SupabaseRpcClient, input: RevogarChaveMcpWorkspaceInput): Promise<RevogarChaveMcpWorkspaceResult>;
|
|
326
|
-
export declare function consumirSemasMcp(client: SupabaseRpcClient, input: ConsumirSemasMcpInput): Promise<ConsumirSemasMcpResult>;
|
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
const PROVISIONAR_WORKSPACE_FREE_RPC = "sema_private.provision_free_workspace";
|
|
2
|
-
const CLAIM_FREE_WORKSPACE_RPC = "sema_claim_free_workspace";
|
|
3
|
-
const ACCOUNT_CONTEXT_RPC = "sema_get_account_context";
|
|
4
|
-
const ACCOUNT_PROFILE_RPC = "sema_get_account_profile";
|
|
5
|
-
const UPDATE_ACCOUNT_PROFILE_RPC = "sema_update_account_profile";
|
|
6
|
-
const CREATE_PROJECT_RPC = "sema_create_project";
|
|
7
|
-
const UPDATE_PROJECT_RPC = "sema_update_project";
|
|
8
|
-
const ARCHIVE_PROJECT_RPC = "sema_archive_project";
|
|
9
|
-
const GET_MCP_KEY_CONTEXT_RPC = "sema_get_mcp_key_context";
|
|
10
|
-
const GENERATE_MCP_KEY_RPC = "sema_generate_mcp_key";
|
|
11
|
-
const REVOKE_MCP_KEY_RPC = "sema_revoke_mcp_key";
|
|
12
|
-
const CONSUME_SEMAS_PUBLIC_RPC = "sema_consume_semas";
|
|
13
|
-
const CONSUME_SEMAS_PRIVATE_RPC = "sema_private.consume_semas";
|
|
14
|
-
const CONSUME_SEMAS_MCP_TOKEN_RPC = "sema_consume_mcp_token";
|
|
15
|
-
const TABELAS_CONTEXTO_COMERCIAL = [
|
|
16
|
-
"sema_profiles",
|
|
17
|
-
"sema_organization_members",
|
|
18
|
-
"sema_organizations",
|
|
19
|
-
"sema_projects",
|
|
20
|
-
"sema_subscriptions",
|
|
21
|
-
"sema_monthly_balances",
|
|
22
|
-
"sema_plans",
|
|
23
|
-
];
|
|
24
|
-
export async function provisionarWorkspaceFree(client, input) {
|
|
25
|
-
validarCadastroFree(input);
|
|
26
|
-
const resposta = await client.rpc(PROVISIONAR_WORKSPACE_FREE_RPC, {
|
|
27
|
-
p_user_id: input.authUserId,
|
|
28
|
-
p_email: input.email,
|
|
29
|
-
p_email_verified: input.emailVerified,
|
|
30
|
-
p_auth_provider: normalizarProvedorAuth(input.authProvider),
|
|
31
|
-
p_display_name: input.displayName ?? null,
|
|
32
|
-
p_organization_name: input.organizationName ?? null,
|
|
33
|
-
p_project_name: input.projectName ?? "Projeto inicial",
|
|
34
|
-
});
|
|
35
|
-
if (resposta.error) {
|
|
36
|
-
throw new Error(resposta.error.message ?? "Falha ao provisionar workspace Free da Sema.");
|
|
37
|
-
}
|
|
38
|
-
const provisionamento = Array.isArray(resposta.data) ? resposta.data[0] : resposta.data;
|
|
39
|
-
if (!provisionamento) {
|
|
40
|
-
throw new Error("Provisionamento Free nao retornou dados.");
|
|
41
|
-
}
|
|
42
|
-
if (provisionamento.semas_mensais < 50) {
|
|
43
|
-
throw new Error("Plano Free precisa iniciar com pelo menos 50 SEMAS mensais.");
|
|
44
|
-
}
|
|
45
|
-
return provisionamento;
|
|
46
|
-
}
|
|
47
|
-
export async function claimFreeWorkspace(client, input = {}) {
|
|
48
|
-
const resposta = await client.rpc(CLAIM_FREE_WORKSPACE_RPC, {
|
|
49
|
-
p_display_name: input.displayName ?? null,
|
|
50
|
-
p_organization_name: input.organizationName ?? null,
|
|
51
|
-
p_project_name: input.projectName ?? "Projeto inicial",
|
|
52
|
-
p_auth_provider: normalizarProvedorAuth(input.authProvider ?? "email_password"),
|
|
53
|
-
});
|
|
54
|
-
if (resposta.error) {
|
|
55
|
-
throw new Error(resposta.error.message ?? "Falha ao liberar workspace Free da Sema.");
|
|
56
|
-
}
|
|
57
|
-
const provisionamento = Array.isArray(resposta.data) ? resposta.data[0] : resposta.data;
|
|
58
|
-
if (!provisionamento) {
|
|
59
|
-
throw new Error("Liberacao Free nao retornou dados.");
|
|
60
|
-
}
|
|
61
|
-
if (provisionamento.semas_mensais < 50) {
|
|
62
|
-
throw new Error("Plano Free precisa liberar pelo menos 50 SEMAS mensais.");
|
|
63
|
-
}
|
|
64
|
-
return provisionamento;
|
|
65
|
-
}
|
|
66
|
-
export function consultarContextoComercialUsuario(input) {
|
|
67
|
-
if (!input.authUserId) {
|
|
68
|
-
throw new Error("authUserId e obrigatorio para consultar contexto comercial.");
|
|
69
|
-
}
|
|
70
|
-
return {
|
|
71
|
-
authUserId: input.authUserId,
|
|
72
|
-
tabelas: TABELAS_CONTEXTO_COMERCIAL,
|
|
73
|
-
filtros: {
|
|
74
|
-
perfil: { id: input.authUserId },
|
|
75
|
-
memberships: { user_id: input.authUserId },
|
|
76
|
-
},
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
export async function consultarPainelUsuario(client) {
|
|
80
|
-
const resposta = await client.rpc(ACCOUNT_CONTEXT_RPC, {});
|
|
81
|
-
if (resposta.error) {
|
|
82
|
-
throw new Error(resposta.error.message ?? "Falha ao consultar painel da conta Sema.");
|
|
83
|
-
}
|
|
84
|
-
if (!resposta.data) {
|
|
85
|
-
throw new Error("Consulta de painel nao retornou dados.");
|
|
86
|
-
}
|
|
87
|
-
return resposta.data;
|
|
88
|
-
}
|
|
89
|
-
export async function consultarPerfilConta(client) {
|
|
90
|
-
const resposta = await client.rpc(ACCOUNT_PROFILE_RPC, {});
|
|
91
|
-
if (resposta.error) {
|
|
92
|
-
throw new Error(resposta.error.message ?? "Falha ao consultar perfil da conta Sema.");
|
|
93
|
-
}
|
|
94
|
-
if (!resposta.data) {
|
|
95
|
-
throw new Error("Consulta de perfil nao retornou dados.");
|
|
96
|
-
}
|
|
97
|
-
return resposta.data;
|
|
98
|
-
}
|
|
99
|
-
export async function atualizarPerfilConta(client, input) {
|
|
100
|
-
const displayName = input.displayName?.trim() ?? "";
|
|
101
|
-
const phone = input.phone?.trim() ?? "";
|
|
102
|
-
const locale = input.locale?.trim() ?? "";
|
|
103
|
-
const timezone = input.timezone?.trim() ?? "";
|
|
104
|
-
if (displayName.length > 160) {
|
|
105
|
-
throw new Error("nome do perfil excede 160 caracteres.");
|
|
106
|
-
}
|
|
107
|
-
if (phone.length > 40) {
|
|
108
|
-
throw new Error("telefone do perfil excede 40 caracteres.");
|
|
109
|
-
}
|
|
110
|
-
const resposta = await client.rpc(UPDATE_ACCOUNT_PROFILE_RPC, {
|
|
111
|
-
p_display_name: displayName || null,
|
|
112
|
-
p_phone: phone || null,
|
|
113
|
-
p_locale: locale || null,
|
|
114
|
-
p_timezone: timezone || null,
|
|
115
|
-
});
|
|
116
|
-
if (resposta.error) {
|
|
117
|
-
throw new Error(resposta.error.message ?? "Falha ao atualizar perfil da conta Sema.");
|
|
118
|
-
}
|
|
119
|
-
if (!resposta.data?.updated) {
|
|
120
|
-
throw new Error("Atualizacao de perfil nao retornou confirmacao.");
|
|
121
|
-
}
|
|
122
|
-
return resposta.data;
|
|
123
|
-
}
|
|
124
|
-
export async function criarProjetoWorkspace(client, input) {
|
|
125
|
-
const name = input.name.trim();
|
|
126
|
-
if (!name) {
|
|
127
|
-
throw new Error("nome do projeto e obrigatorio.");
|
|
128
|
-
}
|
|
129
|
-
const resposta = await client.rpc(CREATE_PROJECT_RPC, {
|
|
130
|
-
p_name: name,
|
|
131
|
-
p_description: input.description?.trim() || null,
|
|
132
|
-
});
|
|
133
|
-
if (resposta.error) {
|
|
134
|
-
throw new Error(resposta.error.message ?? "Falha ao criar projeto no workspace Sema.");
|
|
135
|
-
}
|
|
136
|
-
if (!resposta.data?.created) {
|
|
137
|
-
throw new Error("Criacao de projeto nao retornou confirmacao.");
|
|
138
|
-
}
|
|
139
|
-
return resposta.data;
|
|
140
|
-
}
|
|
141
|
-
export async function atualizarProjetoWorkspace(client, input) {
|
|
142
|
-
if (!input.projectId) {
|
|
143
|
-
throw new Error("projectId e obrigatorio para atualizar projeto.");
|
|
144
|
-
}
|
|
145
|
-
const hasName = input.name !== undefined;
|
|
146
|
-
const hasDescription = input.description !== undefined;
|
|
147
|
-
const name = hasName ? input.name?.trim() : undefined;
|
|
148
|
-
const description = hasDescription ? input.description?.trim() : undefined;
|
|
149
|
-
if (!hasName && !hasDescription) {
|
|
150
|
-
throw new Error("nome ou descricao do projeto e obrigatorio.");
|
|
151
|
-
}
|
|
152
|
-
if (hasName && !name) {
|
|
153
|
-
throw new Error("nome do projeto e obrigatorio.");
|
|
154
|
-
}
|
|
155
|
-
const resposta = await client.rpc(UPDATE_PROJECT_RPC, {
|
|
156
|
-
p_project_id: input.projectId,
|
|
157
|
-
p_name: name ?? null,
|
|
158
|
-
p_description: description ?? null,
|
|
159
|
-
});
|
|
160
|
-
if (resposta.error) {
|
|
161
|
-
throw new Error(resposta.error.message ?? "Falha ao atualizar projeto no workspace Sema.");
|
|
162
|
-
}
|
|
163
|
-
if (!resposta.data?.updated) {
|
|
164
|
-
throw new Error("Atualizacao de projeto nao retornou confirmacao.");
|
|
165
|
-
}
|
|
166
|
-
return resposta.data;
|
|
167
|
-
}
|
|
168
|
-
export async function arquivarProjetoWorkspace(client, input) {
|
|
169
|
-
if (!input.projectId) {
|
|
170
|
-
throw new Error("projectId e obrigatorio para arquivar projeto.");
|
|
171
|
-
}
|
|
172
|
-
const resposta = await client.rpc(ARCHIVE_PROJECT_RPC, {
|
|
173
|
-
p_project_id: input.projectId,
|
|
174
|
-
});
|
|
175
|
-
if (resposta.error) {
|
|
176
|
-
throw new Error(resposta.error.message ?? "Falha ao arquivar projeto no workspace Sema.");
|
|
177
|
-
}
|
|
178
|
-
if (!resposta.data?.archived) {
|
|
179
|
-
throw new Error("Arquivamento de projeto nao retornou confirmacao.");
|
|
180
|
-
}
|
|
181
|
-
return resposta.data;
|
|
182
|
-
}
|
|
183
|
-
export async function consultarChaveMcpWorkspace(client) {
|
|
184
|
-
const resposta = await client.rpc(GET_MCP_KEY_CONTEXT_RPC, {});
|
|
185
|
-
if (resposta.error) {
|
|
186
|
-
throw new Error(resposta.error.message ?? "Falha ao consultar chave MCP do workspace Sema.");
|
|
187
|
-
}
|
|
188
|
-
if (!resposta.data) {
|
|
189
|
-
throw new Error("Consulta de chave MCP nao retornou dados.");
|
|
190
|
-
}
|
|
191
|
-
return resposta.data;
|
|
192
|
-
}
|
|
193
|
-
export async function gerarChaveMcpWorkspace(client, input = {}) {
|
|
194
|
-
const resposta = await client.rpc(GENERATE_MCP_KEY_RPC, {
|
|
195
|
-
p_name: input.name ?? "Painel Sema",
|
|
196
|
-
p_project_id: input.projectId ?? null,
|
|
197
|
-
});
|
|
198
|
-
if (resposta.error) {
|
|
199
|
-
throw new Error(resposta.error.message ?? "Falha ao gerar chave MCP do workspace Sema.");
|
|
200
|
-
}
|
|
201
|
-
if (!resposta.data?.generated || !resposta.data.token) {
|
|
202
|
-
throw new Error("Geracao de chave MCP nao retornou token copiavel.");
|
|
203
|
-
}
|
|
204
|
-
return resposta.data;
|
|
205
|
-
}
|
|
206
|
-
export async function revogarChaveMcpWorkspace(client, input) {
|
|
207
|
-
if (!input.clientId) {
|
|
208
|
-
throw new Error("clientId e obrigatorio para revogar chave MCP.");
|
|
209
|
-
}
|
|
210
|
-
const resposta = await client.rpc(REVOKE_MCP_KEY_RPC, {
|
|
211
|
-
p_client_id: input.clientId,
|
|
212
|
-
});
|
|
213
|
-
if (resposta.error) {
|
|
214
|
-
throw new Error(resposta.error.message ?? "Falha ao revogar chave MCP do workspace Sema.");
|
|
215
|
-
}
|
|
216
|
-
if (!resposta.data?.revoked) {
|
|
217
|
-
throw new Error("Revogacao de chave MCP nao retornou confirmacao.");
|
|
218
|
-
}
|
|
219
|
-
return resposta.data;
|
|
220
|
-
}
|
|
221
|
-
export async function consumirSemasMcp(client, input) {
|
|
222
|
-
if (!input.toolName.trim()) {
|
|
223
|
-
throw new Error("toolName e obrigatorio para consumo de SEMAS.");
|
|
224
|
-
}
|
|
225
|
-
if (!input.idempotencyKey.trim()) {
|
|
226
|
-
throw new Error("idempotencyKey e obrigatoria para consumo de SEMAS.");
|
|
227
|
-
}
|
|
228
|
-
const amount = input.amount ?? 1;
|
|
229
|
-
if (!Number.isInteger(amount) || amount <= 0) {
|
|
230
|
-
throw new Error("amount precisa ser inteiro positivo para consumo de SEMAS.");
|
|
231
|
-
}
|
|
232
|
-
const privateRpc = input.privateRpc === true;
|
|
233
|
-
const tokenRpc = Boolean(input.mcpTokenHash);
|
|
234
|
-
if (privateRpc && tokenRpc) {
|
|
235
|
-
throw new Error("Use privateRpc ou mcpTokenHash, nao ambos.");
|
|
236
|
-
}
|
|
237
|
-
if (privateRpc && !input.actorUserId) {
|
|
238
|
-
throw new Error("actorUserId e obrigatorio quando o MCP usa o RPC privado.");
|
|
239
|
-
}
|
|
240
|
-
if (tokenRpc && !/^[a-f0-9]{64}$/.test(input.mcpTokenHash ?? "")) {
|
|
241
|
-
throw new Error("mcpTokenHash precisa ser um SHA-256 hexadecimal.");
|
|
242
|
-
}
|
|
243
|
-
const resposta = await client.rpc(tokenRpc ? CONSUME_SEMAS_MCP_TOKEN_RPC : privateRpc ? CONSUME_SEMAS_PRIVATE_RPC : CONSUME_SEMAS_PUBLIC_RPC, tokenRpc
|
|
244
|
-
? {
|
|
245
|
-
p_token_hash: input.mcpTokenHash,
|
|
246
|
-
p_organization_id: input.organizationId ?? null,
|
|
247
|
-
p_project_id: input.projectId ?? null,
|
|
248
|
-
p_amount: amount,
|
|
249
|
-
p_tool_name: input.toolName,
|
|
250
|
-
p_request_summary: input.requestSummary ?? null,
|
|
251
|
-
p_idempotency_key: input.idempotencyKey,
|
|
252
|
-
p_metadata: input.metadata ?? {},
|
|
253
|
-
}
|
|
254
|
-
: privateRpc
|
|
255
|
-
? {
|
|
256
|
-
p_actor_user_id: input.actorUserId,
|
|
257
|
-
p_organization_id: input.organizationId ?? null,
|
|
258
|
-
p_project_id: input.projectId ?? null,
|
|
259
|
-
p_amount: amount,
|
|
260
|
-
p_tool_name: input.toolName,
|
|
261
|
-
p_request_summary: input.requestSummary ?? null,
|
|
262
|
-
p_idempotency_key: input.idempotencyKey,
|
|
263
|
-
p_metadata: input.metadata ?? {},
|
|
264
|
-
}
|
|
265
|
-
: {
|
|
266
|
-
p_organization_id: input.organizationId ?? null,
|
|
267
|
-
p_project_id: input.projectId ?? null,
|
|
268
|
-
p_amount: amount,
|
|
269
|
-
p_tool_name: input.toolName,
|
|
270
|
-
p_request_summary: input.requestSummary ?? null,
|
|
271
|
-
p_idempotency_key: input.idempotencyKey,
|
|
272
|
-
p_metadata: input.metadata ?? {},
|
|
273
|
-
});
|
|
274
|
-
if (resposta.error) {
|
|
275
|
-
throw new Error(resposta.error.message ?? "Falha ao consumir SEMAS.");
|
|
276
|
-
}
|
|
277
|
-
if (!resposta.data?.authorized) {
|
|
278
|
-
throw new Error("Consumo de SEMAS nao foi autorizado.");
|
|
279
|
-
}
|
|
280
|
-
return resposta.data;
|
|
281
|
-
}
|
|
282
|
-
function validarCadastroFree(input) {
|
|
283
|
-
if (!input.authUserId) {
|
|
284
|
-
throw new Error("authUserId e obrigatorio para cadastro Free.");
|
|
285
|
-
}
|
|
286
|
-
if (!input.email || !input.email.includes("@")) {
|
|
287
|
-
throw new Error("email valido e obrigatorio para cadastro Free.");
|
|
288
|
-
}
|
|
289
|
-
if (input.emailVerified !== true) {
|
|
290
|
-
throw new Error("email verificado e obrigatorio para cadastro Free.");
|
|
291
|
-
}
|
|
292
|
-
normalizarProvedorAuth(input.authProvider);
|
|
293
|
-
}
|
|
294
|
-
function normalizarProvedorAuth(provider) {
|
|
295
|
-
const normalized = provider.trim().toLowerCase().replace("-", "_");
|
|
296
|
-
if (normalized === "email" || normalized === "password") {
|
|
297
|
-
return "email_password";
|
|
298
|
-
}
|
|
299
|
-
if (normalized === "azure") {
|
|
300
|
-
return "microsoft";
|
|
301
|
-
}
|
|
302
|
-
if (normalized === "email_password" ||
|
|
303
|
-
normalized === "google" ||
|
|
304
|
-
normalized === "facebook" ||
|
|
305
|
-
normalized === "microsoft") {
|
|
306
|
-
return normalized;
|
|
307
|
-
}
|
|
308
|
-
throw new Error("provedor de autenticacao nao suportado para cadastro Sema.");
|
|
309
|
-
}
|
|
310
|
-
//# sourceMappingURL=controleComercialSupabase.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"controleComercialSupabase.js","sourceRoot":"","sources":["../src/controleComercialSupabase.ts"],"names":[],"mappings":"AAmVA,MAAM,8BAA8B,GAAG,uCAAuC,CAAC;AAC/E,MAAM,wBAAwB,GAAG,2BAA2B,CAAC;AAC7D,MAAM,mBAAmB,GAAG,0BAA0B,CAAC;AACvD,MAAM,mBAAmB,GAAG,0BAA0B,CAAC;AACvD,MAAM,0BAA0B,GAAG,6BAA6B,CAAC;AACjE,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AACjD,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AACjD,MAAM,mBAAmB,GAAG,sBAAsB,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