chore: publish current DataStack updates
Publish the current application, design, and Phase 1 deployment updates. Excludes ignored personal notes, local MCP config, and generated TypeScript build info.
This commit is contained in:
1 parent
d39d9f92f9
commit
fcc4f4db2d
88 files changed
+21248
-2213
No files matched your search
+31
-19
@@ -1,4 +1,4 @@
|
||||
import { AuthService } from '../auth/jwt';
|
||||
import { AuthService } from "../auth/jwt";
|
||||
|
||||
export interface ClientSDK {
|
||||
clientId: string;
|
||||
@@ -6,7 +6,7 @@ export interface ClientSDK {
|
||||
secret: string;
|
||||
token: string;
|
||||
rateLimit: number; // max events per sec
|
||||
status: 'active' | 'revoked';
|
||||
status: "active" | "revoked";
|
||||
totalEvents: number;
|
||||
lastActive?: string;
|
||||
createdAt: string;
|
||||
@@ -19,29 +19,31 @@ export class SDKManager {
|
||||
static {
|
||||
const seedClients = [
|
||||
{
|
||||
clientId: 'py_telemetry_agent_01',
|
||||
name: 'Python Telemetry Agent (US-East)',
|
||||
clientId: "py_telemetry_agent_01",
|
||||
name: "Python Telemetry Agent (US-East)",
|
||||
rateLimit: 150,
|
||||
},
|
||||
{
|
||||
clientId: 'py_scraper_prod_02',
|
||||
name: 'Python Web Scraper Engine',
|
||||
clientId: "py_scraper_prod_02",
|
||||
name: "Python Web Scraper Engine",
|
||||
rateLimit: 200,
|
||||
},
|
||||
{
|
||||
clientId: 'iot_fleet_east_03',
|
||||
name: 'IoT Sensor Gateway Node',
|
||||
clientId: "iot_fleet_east_03",
|
||||
name: "IoT Sensor Gateway Node",
|
||||
rateLimit: 50,
|
||||
},
|
||||
];
|
||||
|
||||
for (const c of seedClients) {
|
||||
const secret = `sec_${c.clientId}_${Math.random().toString(36).substring(2, 10)}`;
|
||||
const token = AuthService.generateClientToken({
|
||||
clientId: c.clientId,
|
||||
name: c.name,
|
||||
rateLimit: c.rateLimit,
|
||||
});
|
||||
const token = AuthService.getSecret()
|
||||
? AuthService.generateClientToken({
|
||||
clientId: c.clientId,
|
||||
name: c.name,
|
||||
rateLimit: c.rateLimit,
|
||||
})
|
||||
: "";
|
||||
|
||||
SDKManager.clients.set(c.clientId, {
|
||||
clientId: c.clientId,
|
||||
@@ -49,10 +51,10 @@ export class SDKManager {
|
||||
secret,
|
||||
token,
|
||||
rateLimit: c.rateLimit,
|
||||
status: 'active',
|
||||
status: "active",
|
||||
totalEvents: 4280,
|
||||
lastActive: new Date().toISOString(),
|
||||
createdAt: '2026-10-20T10:00:00.000Z',
|
||||
createdAt: "2026-10-20T10:00:00.000Z",
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -65,8 +67,15 @@ export class SDKManager {
|
||||
return this.clients.get(clientId);
|
||||
}
|
||||
|
||||
public static registerClient(data: { clientId: string; name: string; rateLimit?: number }): ClientSDK {
|
||||
const safeClientId = data.clientId.trim().toLowerCase().replace(/[^a-z0-9_-]/g, '_');
|
||||
public static registerClient(data: {
|
||||
clientId: string;
|
||||
name: string;
|
||||
rateLimit?: number;
|
||||
}): ClientSDK {
|
||||
const safeClientId = data.clientId
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
.replace(/[^a-z0-9_-]/g, "_");
|
||||
const secret = `sec_${safeClientId}_${Math.random().toString(36).substring(2, 10)}`;
|
||||
const rateLimit = data.rateLimit || 100;
|
||||
|
||||
@@ -82,7 +91,7 @@ export class SDKManager {
|
||||
secret,
|
||||
token,
|
||||
rateLimit,
|
||||
status: 'active',
|
||||
status: "active",
|
||||
totalEvents: 0,
|
||||
createdAt: new Date().toISOString(),
|
||||
};
|
||||
@@ -106,7 +115,10 @@ export class SDKManager {
|
||||
return client;
|
||||
}
|
||||
|
||||
public static updateClient(clientId: string, updates: Partial<Pick<ClientSDK, 'name' | 'rateLimit' | 'status'>>): ClientSDK | null {
|
||||
public static updateClient(
|
||||
clientId: string,
|
||||
updates: Partial<Pick<ClientSDK, "name" | "rateLimit" | "status">>,
|
||||
): ClientSDK | null {
|
||||
const client = this.clients.get(clientId);
|
||||
if (!client) return null;
|
||||
|
||||
|
||||
Reference in new issue
Block a user