[TSM.ID].[11031972] PXE : Platform X Ecosystem I [118 Module -LIVE-]

This commit is contained in:
TSM.ID
2026-05-25 03:50:05 +07:00
commit e820143b3c
673 changed files with 101320 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';
import * as schema from './schema';
const connectionString = process.env.DATABASE_URL as string;
const writerConnectionString = process.env.WRITER_DATABASE_URL || connectionString;
// Definisikan tipe untuk global
declare global {
var _postgresClient: postgres.Sql | undefined;
var _postgresWriterClient: postgres.Sql | undefined;
}
// Gunakan koneksi global jika sudah ada, untuk mencegah PostgreSQL connection exhaustion di Next.js
const queryClient = global._postgresClient || postgres(connectionString, { max: 10 });
const queryWriterClient = global._postgresWriterClient || postgres(writerConnectionString, { max: 5 });
global._postgresClient = queryClient;
global._postgresWriterClient = queryWriterClient;
export const db = drizzle(queryClient, { schema });
export const writerDb = drizzle(queryWriterClient, { schema });
@@ -0,0 +1,18 @@
CREATE TABLE "tenants" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"name" text NOT NULL,
"is_active" boolean DEFAULT true,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "users" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"tenant_id" uuid NOT NULL,
"email" text NOT NULL,
"password_hash" text NOT NULL,
"role" text DEFAULT 'user' NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "users_email_unique" UNIQUE("email")
);
--> statement-breakpoint
ALTER TABLE "users" ADD CONSTRAINT "users_tenant_id_tenants_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;
@@ -0,0 +1,78 @@
CREATE TABLE "chat_broadcasts" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"tenant_id" uuid,
"sender_name" text NOT NULL,
"content" text NOT NULL,
"targets" text NOT NULL,
"scheduled_at" timestamp NOT NULL,
"is_sent" boolean DEFAULT false NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "chat_statuses" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"tenant_id" uuid,
"sender" text NOT NULL,
"content" text NOT NULL,
"visibility" text DEFAULT 'tenant' NOT NULL,
"expires_at" timestamp NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "guest_invites" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"room" text NOT NULL,
"host_id" text NOT NULL,
"pin" text NOT NULL,
"is_used" boolean DEFAULT false NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "messages" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"room" text NOT NULL,
"sender" text NOT NULL,
"content" text NOT NULL,
"status" text DEFAULT 'sent' NOT NULL,
"is_edited" boolean DEFAULT false NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "quantum_logs" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"actor" text NOT NULL,
"action" text NOT NULL,
"target_id" text NOT NULL,
"ip_address" text,
"user_agent" text,
"nano_timestamp" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "saas_packages" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"name" text NOT NULL,
"price" text NOT NULL,
"features" text DEFAULT '["chat", "vc"]' NOT NULL,
"is_hidden" boolean DEFAULT false NOT NULL,
"is_active" boolean DEFAULT true NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "system_features" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"module" text DEFAULT 'IAM' NOT NULL,
"key" text NOT NULL,
"name" text NOT NULL,
"description" text,
"default_state" text DEFAULT 'UPSELL' NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
CONSTRAINT "system_features_key_unique" UNIQUE("key")
);
--> statement-breakpoint
ALTER TABLE "tenants" ADD COLUMN "licenses" text DEFAULT '["chat", "vc"]' NOT NULL;--> statement-breakpoint
ALTER TABLE "tenants" ADD COLUMN "allow_cross_group" boolean DEFAULT false NOT NULL;--> statement-breakpoint
ALTER TABLE "tenants" ADD COLUMN "brand_color" text DEFAULT '#00ff88';--> statement-breakpoint
ALTER TABLE "tenants" ADD COLUMN "platform_name" text DEFAULT 'JUMPA.ID';--> statement-breakpoint
ALTER TABLE "users" ADD COLUMN "licenses" text;--> statement-breakpoint
ALTER TABLE "chat_broadcasts" ADD CONSTRAINT "chat_broadcasts_tenant_id_tenants_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "chat_statuses" ADD CONSTRAINT "chat_statuses_tenant_id_tenants_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;
@@ -0,0 +1,13 @@
ALTER TABLE "saas_packages" ALTER COLUMN "features" SET DEFAULT '[]';--> statement-breakpoint
ALTER TABLE "tenants" ALTER COLUMN "licenses" SET DEFAULT '{}';--> statement-breakpoint
ALTER TABLE "tenants" ALTER COLUMN "brand_color" SET DEFAULT '#0b5cff';--> statement-breakpoint
ALTER TABLE "tenants" ADD COLUMN "package_id" uuid;--> statement-breakpoint
ALTER TABLE "tenants" ADD COLUMN "license_number" text;--> statement-breakpoint
ALTER TABLE "tenants" ADD COLUMN "media_engine_strategy" text DEFAULT 'XCU_GLOBAL_MESH' NOT NULL;--> statement-breakpoint
ALTER TABLE "tenants" ADD COLUMN "chat_engine_strategy" text DEFAULT 'XTM_GLOBAL_MESH' NOT NULL;--> statement-breakpoint
ALTER TABLE "tenants" ADD COLUMN "byok_enabled" boolean DEFAULT false NOT NULL;--> statement-breakpoint
ALTER TABLE "tenants" ADD COLUMN "byok_key" text;--> statement-breakpoint
ALTER TABLE "users" ADD COLUMN "byok_enabled" boolean DEFAULT false NOT NULL;--> statement-breakpoint
ALTER TABLE "users" ADD COLUMN "byok_key" text;--> statement-breakpoint
ALTER TABLE "tenants" ADD CONSTRAINT "tenants_package_id_saas_packages_id_fk" FOREIGN KEY ("package_id") REFERENCES "public"."saas_packages"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "tenants" ADD CONSTRAINT "tenants_license_number_unique" UNIQUE("license_number");
@@ -0,0 +1,30 @@
CREATE TABLE "live_kill_switches" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"tenant_id" uuid,
"target_type" text NOT NULL,
"target_id" text NOT NULL,
"reason" text,
"issued_by" text NOT NULL,
"expires_at" timestamp,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "network_telemetry" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"tenant_id" uuid,
"user_id" uuid,
"endpoint" text NOT NULL,
"method" text NOT NULL,
"response_time_ms" text NOT NULL,
"status_code" text NOT NULL,
"ip_address" text NOT NULL,
"geo_region" text,
"traffic_bytes" text NOT NULL,
"timestamp" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "quantum_logs" ADD COLUMN "tenant_id" uuid;--> statement-breakpoint
ALTER TABLE "live_kill_switches" ADD CONSTRAINT "live_kill_switches_tenant_id_tenants_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "network_telemetry" ADD CONSTRAINT "network_telemetry_tenant_id_tenants_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "network_telemetry" ADD CONSTRAINT "network_telemetry_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "quantum_logs" ADD CONSTRAINT "quantum_logs_tenant_id_tenants_id_fk" FOREIGN KEY ("tenant_id") REFERENCES "public"."tenants"("id") ON DELETE no action ON UPDATE no action;
@@ -0,0 +1,9 @@
-- [TSM.ID].[11031972] — All Rights Reserved. Proprietary & Confidential.
-- Migration: Tambahkan fitur Guest Access ke system_features
-- Jalankan: psql -U <user> -d <db> -f add_guest_features.sql
INSERT INTO system_features (module, key, name, description, default_state)
VALUES
('XCU', 'jvc.guest_access', 'Guest Access (Zoom-Like)', 'Mengizinkan tamu masuk tanpa login. Tamu mendapat JWT terbatas (tanpa host controls, tanpa recording, tanpa screen share).', 'UPSELL'),
('XCU', 'jvc.guest_duration_hours', 'Guest Session Duration (Jam)', 'Durasi sesi tamu dalam jam. Default: 2 jam. Range: 0.5 - 24 jam. Admin/Host dapat mengatur. Isi angka: 0.5, 1, 2, 4, 8, 12, 24.', 'UPSELL')
ON CONFLICT (key) DO NOTHING;
@@ -0,0 +1,133 @@
{
"id": "29c790f8-345c-4375-bf76-01b60c0ca281",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "7",
"dialect": "postgresql",
"tables": {
"public.tenants": {
"name": "tenants",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.users": {
"name": "users",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"tenant_id": {
"name": "tenant_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"password_hash": {
"name": "password_hash",
"type": "text",
"primaryKey": false,
"notNull": true
},
"role": {
"name": "role",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'user'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"users_tenant_id_tenants_id_fk": {
"name": "users_tenant_id_tenants_id_fk",
"tableFrom": "users",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"users_email_unique": {
"name": "users_email_unique",
"nullsNotDistinct": false,
"columns": [
"email"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
}
},
"enums": {},
"schemas": {},
"sequences": {},
"roles": {},
"policies": {},
"views": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}
@@ -0,0 +1,612 @@
{
"id": "402dc7db-3276-4a83-8efb-f16a769d5b64",
"prevId": "29c790f8-345c-4375-bf76-01b60c0ca281",
"version": "7",
"dialect": "postgresql",
"tables": {
"public.chat_broadcasts": {
"name": "chat_broadcasts",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"tenant_id": {
"name": "tenant_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"sender_name": {
"name": "sender_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true
},
"targets": {
"name": "targets",
"type": "text",
"primaryKey": false,
"notNull": true
},
"scheduled_at": {
"name": "scheduled_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"is_sent": {
"name": "is_sent",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"chat_broadcasts_tenant_id_tenants_id_fk": {
"name": "chat_broadcasts_tenant_id_tenants_id_fk",
"tableFrom": "chat_broadcasts",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.chat_statuses": {
"name": "chat_statuses",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"tenant_id": {
"name": "tenant_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"sender": {
"name": "sender",
"type": "text",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true
},
"visibility": {
"name": "visibility",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'tenant'"
},
"expires_at": {
"name": "expires_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"chat_statuses_tenant_id_tenants_id_fk": {
"name": "chat_statuses_tenant_id_tenants_id_fk",
"tableFrom": "chat_statuses",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.guest_invites": {
"name": "guest_invites",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"room": {
"name": "room",
"type": "text",
"primaryKey": false,
"notNull": true
},
"host_id": {
"name": "host_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"pin": {
"name": "pin",
"type": "text",
"primaryKey": false,
"notNull": true
},
"is_used": {
"name": "is_used",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.messages": {
"name": "messages",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"room": {
"name": "room",
"type": "text",
"primaryKey": false,
"notNull": true
},
"sender": {
"name": "sender",
"type": "text",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'sent'"
},
"is_edited": {
"name": "is_edited",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.quantum_logs": {
"name": "quantum_logs",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"actor": {
"name": "actor",
"type": "text",
"primaryKey": false,
"notNull": true
},
"action": {
"name": "action",
"type": "text",
"primaryKey": false,
"notNull": true
},
"target_id": {
"name": "target_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"ip_address": {
"name": "ip_address",
"type": "text",
"primaryKey": false,
"notNull": false
},
"user_agent": {
"name": "user_agent",
"type": "text",
"primaryKey": false,
"notNull": false
},
"nano_timestamp": {
"name": "nano_timestamp",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.saas_packages": {
"name": "saas_packages",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"price": {
"name": "price",
"type": "text",
"primaryKey": false,
"notNull": true
},
"features": {
"name": "features",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'[\"chat\", \"vc\"]'"
},
"is_hidden": {
"name": "is_hidden",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.system_features": {
"name": "system_features",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"module": {
"name": "module",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'IAM'"
},
"key": {
"name": "key",
"type": "text",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"default_state": {
"name": "default_state",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'UPSELL'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"system_features_key_unique": {
"name": "system_features_key_unique",
"nullsNotDistinct": false,
"columns": [
"key"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.tenants": {
"name": "tenants",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"licenses": {
"name": "licenses",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'[\"chat\", \"vc\"]'"
},
"allow_cross_group": {
"name": "allow_cross_group",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"brand_color": {
"name": "brand_color",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'#00ff88'"
},
"platform_name": {
"name": "platform_name",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'JUMPA.ID'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.users": {
"name": "users",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"tenant_id": {
"name": "tenant_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"password_hash": {
"name": "password_hash",
"type": "text",
"primaryKey": false,
"notNull": true
},
"role": {
"name": "role",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'user'"
},
"licenses": {
"name": "licenses",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"users_tenant_id_tenants_id_fk": {
"name": "users_tenant_id_tenants_id_fk",
"tableFrom": "users",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"users_email_unique": {
"name": "users_email_unique",
"nullsNotDistinct": false,
"columns": [
"email"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
}
},
"enums": {},
"schemas": {},
"sequences": {},
"roles": {},
"policies": {},
"views": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}
@@ -0,0 +1,686 @@
{
"id": "f12500b5-9962-46e2-bcca-521c363dd234",
"prevId": "402dc7db-3276-4a83-8efb-f16a769d5b64",
"version": "7",
"dialect": "postgresql",
"tables": {
"public.chat_broadcasts": {
"name": "chat_broadcasts",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"tenant_id": {
"name": "tenant_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"sender_name": {
"name": "sender_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true
},
"targets": {
"name": "targets",
"type": "text",
"primaryKey": false,
"notNull": true
},
"scheduled_at": {
"name": "scheduled_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"is_sent": {
"name": "is_sent",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"chat_broadcasts_tenant_id_tenants_id_fk": {
"name": "chat_broadcasts_tenant_id_tenants_id_fk",
"tableFrom": "chat_broadcasts",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.chat_statuses": {
"name": "chat_statuses",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"tenant_id": {
"name": "tenant_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"sender": {
"name": "sender",
"type": "text",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true
},
"visibility": {
"name": "visibility",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'tenant'"
},
"expires_at": {
"name": "expires_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"chat_statuses_tenant_id_tenants_id_fk": {
"name": "chat_statuses_tenant_id_tenants_id_fk",
"tableFrom": "chat_statuses",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.guest_invites": {
"name": "guest_invites",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"room": {
"name": "room",
"type": "text",
"primaryKey": false,
"notNull": true
},
"host_id": {
"name": "host_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"pin": {
"name": "pin",
"type": "text",
"primaryKey": false,
"notNull": true
},
"is_used": {
"name": "is_used",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.messages": {
"name": "messages",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"room": {
"name": "room",
"type": "text",
"primaryKey": false,
"notNull": true
},
"sender": {
"name": "sender",
"type": "text",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'sent'"
},
"is_edited": {
"name": "is_edited",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.quantum_logs": {
"name": "quantum_logs",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"actor": {
"name": "actor",
"type": "text",
"primaryKey": false,
"notNull": true
},
"action": {
"name": "action",
"type": "text",
"primaryKey": false,
"notNull": true
},
"target_id": {
"name": "target_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"ip_address": {
"name": "ip_address",
"type": "text",
"primaryKey": false,
"notNull": false
},
"user_agent": {
"name": "user_agent",
"type": "text",
"primaryKey": false,
"notNull": false
},
"nano_timestamp": {
"name": "nano_timestamp",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.saas_packages": {
"name": "saas_packages",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"price": {
"name": "price",
"type": "text",
"primaryKey": false,
"notNull": true
},
"features": {
"name": "features",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'[]'"
},
"is_hidden": {
"name": "is_hidden",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.system_features": {
"name": "system_features",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"module": {
"name": "module",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'IAM'"
},
"key": {
"name": "key",
"type": "text",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"default_state": {
"name": "default_state",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'UPSELL'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"system_features_key_unique": {
"name": "system_features_key_unique",
"nullsNotDistinct": false,
"columns": [
"key"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.tenants": {
"name": "tenants",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"package_id": {
"name": "package_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"licenses": {
"name": "licenses",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'{}'"
},
"license_number": {
"name": "license_number",
"type": "text",
"primaryKey": false,
"notNull": false
},
"allow_cross_group": {
"name": "allow_cross_group",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"brand_color": {
"name": "brand_color",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'#0b5cff'"
},
"platform_name": {
"name": "platform_name",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'JUMPA.ID'"
},
"media_engine_strategy": {
"name": "media_engine_strategy",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'XCU_GLOBAL_MESH'"
},
"chat_engine_strategy": {
"name": "chat_engine_strategy",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'XTM_GLOBAL_MESH'"
},
"byok_enabled": {
"name": "byok_enabled",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"byok_key": {
"name": "byok_key",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"tenants_package_id_saas_packages_id_fk": {
"name": "tenants_package_id_saas_packages_id_fk",
"tableFrom": "tenants",
"tableTo": "saas_packages",
"columnsFrom": [
"package_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"tenants_license_number_unique": {
"name": "tenants_license_number_unique",
"nullsNotDistinct": false,
"columns": [
"license_number"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.users": {
"name": "users",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"tenant_id": {
"name": "tenant_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"password_hash": {
"name": "password_hash",
"type": "text",
"primaryKey": false,
"notNull": true
},
"role": {
"name": "role",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'user'"
},
"licenses": {
"name": "licenses",
"type": "text",
"primaryKey": false,
"notNull": false
},
"byok_enabled": {
"name": "byok_enabled",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"byok_key": {
"name": "byok_key",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"users_tenant_id_tenants_id_fk": {
"name": "users_tenant_id_tenants_id_fk",
"tableFrom": "users",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"users_email_unique": {
"name": "users_email_unique",
"nullsNotDistinct": false,
"columns": [
"email"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
}
},
"enums": {},
"schemas": {},
"sequences": {},
"roles": {},
"policies": {},
"views": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}
@@ -0,0 +1,891 @@
{
"id": "1c45018a-8bb7-4a78-84dd-519805b83f61",
"prevId": "f12500b5-9962-46e2-bcca-521c363dd234",
"version": "7",
"dialect": "postgresql",
"tables": {
"public.chat_broadcasts": {
"name": "chat_broadcasts",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"tenant_id": {
"name": "tenant_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"sender_name": {
"name": "sender_name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true
},
"targets": {
"name": "targets",
"type": "text",
"primaryKey": false,
"notNull": true
},
"scheduled_at": {
"name": "scheduled_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"is_sent": {
"name": "is_sent",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"chat_broadcasts_tenant_id_tenants_id_fk": {
"name": "chat_broadcasts_tenant_id_tenants_id_fk",
"tableFrom": "chat_broadcasts",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.chat_statuses": {
"name": "chat_statuses",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"tenant_id": {
"name": "tenant_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"sender": {
"name": "sender",
"type": "text",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true
},
"visibility": {
"name": "visibility",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'tenant'"
},
"expires_at": {
"name": "expires_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"chat_statuses_tenant_id_tenants_id_fk": {
"name": "chat_statuses_tenant_id_tenants_id_fk",
"tableFrom": "chat_statuses",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.guest_invites": {
"name": "guest_invites",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"room": {
"name": "room",
"type": "text",
"primaryKey": false,
"notNull": true
},
"host_id": {
"name": "host_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"pin": {
"name": "pin",
"type": "text",
"primaryKey": false,
"notNull": true
},
"is_used": {
"name": "is_used",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.live_kill_switches": {
"name": "live_kill_switches",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"tenant_id": {
"name": "tenant_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"target_type": {
"name": "target_type",
"type": "text",
"primaryKey": false,
"notNull": true
},
"target_id": {
"name": "target_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"reason": {
"name": "reason",
"type": "text",
"primaryKey": false,
"notNull": false
},
"issued_by": {
"name": "issued_by",
"type": "text",
"primaryKey": false,
"notNull": true
},
"expires_at": {
"name": "expires_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"live_kill_switches_tenant_id_tenants_id_fk": {
"name": "live_kill_switches_tenant_id_tenants_id_fk",
"tableFrom": "live_kill_switches",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.messages": {
"name": "messages",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"room": {
"name": "room",
"type": "text",
"primaryKey": false,
"notNull": true
},
"sender": {
"name": "sender",
"type": "text",
"primaryKey": false,
"notNull": true
},
"content": {
"name": "content",
"type": "text",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'sent'"
},
"is_edited": {
"name": "is_edited",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.network_telemetry": {
"name": "network_telemetry",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"tenant_id": {
"name": "tenant_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"user_id": {
"name": "user_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"endpoint": {
"name": "endpoint",
"type": "text",
"primaryKey": false,
"notNull": true
},
"method": {
"name": "method",
"type": "text",
"primaryKey": false,
"notNull": true
},
"response_time_ms": {
"name": "response_time_ms",
"type": "text",
"primaryKey": false,
"notNull": true
},
"status_code": {
"name": "status_code",
"type": "text",
"primaryKey": false,
"notNull": true
},
"ip_address": {
"name": "ip_address",
"type": "text",
"primaryKey": false,
"notNull": true
},
"geo_region": {
"name": "geo_region",
"type": "text",
"primaryKey": false,
"notNull": false
},
"traffic_bytes": {
"name": "traffic_bytes",
"type": "text",
"primaryKey": false,
"notNull": true
},
"timestamp": {
"name": "timestamp",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"network_telemetry_tenant_id_tenants_id_fk": {
"name": "network_telemetry_tenant_id_tenants_id_fk",
"tableFrom": "network_telemetry",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"network_telemetry_user_id_users_id_fk": {
"name": "network_telemetry_user_id_users_id_fk",
"tableFrom": "network_telemetry",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.quantum_logs": {
"name": "quantum_logs",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"tenant_id": {
"name": "tenant_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"actor": {
"name": "actor",
"type": "text",
"primaryKey": false,
"notNull": true
},
"action": {
"name": "action",
"type": "text",
"primaryKey": false,
"notNull": true
},
"target_id": {
"name": "target_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"ip_address": {
"name": "ip_address",
"type": "text",
"primaryKey": false,
"notNull": false
},
"user_agent": {
"name": "user_agent",
"type": "text",
"primaryKey": false,
"notNull": false
},
"nano_timestamp": {
"name": "nano_timestamp",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"quantum_logs_tenant_id_tenants_id_fk": {
"name": "quantum_logs_tenant_id_tenants_id_fk",
"tableFrom": "quantum_logs",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.saas_packages": {
"name": "saas_packages",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"price": {
"name": "price",
"type": "text",
"primaryKey": false,
"notNull": true
},
"features": {
"name": "features",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'[]'"
},
"is_hidden": {
"name": "is_hidden",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.system_features": {
"name": "system_features",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"module": {
"name": "module",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'IAM'"
},
"key": {
"name": "key",
"type": "text",
"primaryKey": false,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"default_state": {
"name": "default_state",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'UPSELL'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"system_features_key_unique": {
"name": "system_features_key_unique",
"nullsNotDistinct": false,
"columns": [
"key"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.tenants": {
"name": "tenants",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"is_active": {
"name": "is_active",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"default": true
},
"package_id": {
"name": "package_id",
"type": "uuid",
"primaryKey": false,
"notNull": false
},
"licenses": {
"name": "licenses",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'{}'"
},
"license_number": {
"name": "license_number",
"type": "text",
"primaryKey": false,
"notNull": false
},
"allow_cross_group": {
"name": "allow_cross_group",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"brand_color": {
"name": "brand_color",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'#0b5cff'"
},
"platform_name": {
"name": "platform_name",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'JUMPA.ID'"
},
"media_engine_strategy": {
"name": "media_engine_strategy",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'XCU_GLOBAL_MESH'"
},
"chat_engine_strategy": {
"name": "chat_engine_strategy",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'XTM_GLOBAL_MESH'"
},
"byok_enabled": {
"name": "byok_enabled",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"byok_key": {
"name": "byok_key",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"tenants_package_id_saas_packages_id_fk": {
"name": "tenants_package_id_saas_packages_id_fk",
"tableFrom": "tenants",
"tableTo": "saas_packages",
"columnsFrom": [
"package_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"tenants_license_number_unique": {
"name": "tenants_license_number_unique",
"nullsNotDistinct": false,
"columns": [
"license_number"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.users": {
"name": "users",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "uuid",
"primaryKey": true,
"notNull": true,
"default": "gen_random_uuid()"
},
"tenant_id": {
"name": "tenant_id",
"type": "uuid",
"primaryKey": false,
"notNull": true
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"password_hash": {
"name": "password_hash",
"type": "text",
"primaryKey": false,
"notNull": true
},
"role": {
"name": "role",
"type": "text",
"primaryKey": false,
"notNull": true,
"default": "'user'"
},
"licenses": {
"name": "licenses",
"type": "text",
"primaryKey": false,
"notNull": false
},
"byok_enabled": {
"name": "byok_enabled",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"byok_key": {
"name": "byok_key",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"users_tenant_id_tenants_id_fk": {
"name": "users_tenant_id_tenants_id_fk",
"tableFrom": "users",
"tableTo": "tenants",
"columnsFrom": [
"tenant_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"users_email_unique": {
"name": "users_email_unique",
"nullsNotDistinct": false,
"columns": [
"email"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
}
},
"enums": {},
"schemas": {},
"sequences": {},
"roles": {},
"policies": {},
"views": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}
@@ -0,0 +1,34 @@
{
"version": "7",
"dialect": "postgresql",
"entries": [
{
"idx": 0,
"version": "7",
"when": 1777728588999,
"tag": "0000_curvy_demogoblin",
"breakpoints": true
},
{
"idx": 1,
"version": "7",
"when": 1777843063884,
"tag": "0001_busy_puff_adder",
"breakpoints": true
},
{
"idx": 2,
"version": "7",
"when": 1778689401748,
"tag": "0002_closed_stark_industries",
"breakpoints": true
},
{
"idx": 3,
"version": "7",
"when": 1778738273469,
"tag": "0003_amusing_stepford_cuckoos",
"breakpoints": true
}
]
}
+129
View File
@@ -0,0 +1,129 @@
import { pgTable, text, timestamp, boolean, uuid } from 'drizzle-orm/pg-core';
export const tenants = pgTable('tenants', {
id: uuid('id').defaultRandom().primaryKey(),
name: text('name').notNull(),
isActive: boolean('is_active').default(true),
packageId: uuid('package_id').references(() => saasPackages.id),
licenses: text('licenses').default('{}').notNull(),
licenseNumber: text('license_number').unique(),
allowCrossGroup: boolean('allow_cross_group').default(false).notNull(),
brandColor: text('brand_color').default('#0b5cff'), // Zoom Blue
platformName: text('platform_name').default('JUMPA.ID'),
mediaEngineStrategy: text('media_engine_strategy').default('XCU_GLOBAL_MESH').notNull(),
chatEngineStrategy: text('chat_engine_strategy').default('XTM_GLOBAL_MESH').notNull(),
securityTier: text('security_tier').default('STANDARD').notNull(), // STANDARD | SOVEREIGN
byokEnabled: boolean('byok_enabled').default(false).notNull(),
byokKey: text('byok_key'),
createdAt: timestamp('created_at').defaultNow().notNull(),
});
export const users = pgTable('users', {
id: uuid('id').defaultRandom().primaryKey(),
tenantId: uuid('tenant_id').references(() => tenants.id).notNull(),
email: text('email').notNull().unique(),
passwordHash: text('password_hash').notNull(),
role: text('role').default('user').notNull(),
licenses: text('licenses'), // User-specific override
byokEnabled: boolean('byok_enabled').default(false).notNull(),
byokKey: text('byok_key'),
createdAt: timestamp('created_at').defaultNow().notNull(),
});
export const messages = pgTable('messages', {
id: uuid('id').defaultRandom().primaryKey(),
room: text('room').notNull(),
sender: text('sender').notNull(),
content: text('content').notNull(),
status: text('status').default('sent').notNull(),
isEdited: boolean('is_edited').default(false).notNull(),
createdAt: timestamp('created_at').defaultNow().notNull(),
});
export const chatStatuses = pgTable('chat_statuses', {
id: uuid('id').defaultRandom().primaryKey(),
tenantId: uuid('tenant_id').references(() => tenants.id),
sender: text('sender').notNull(),
content: text('content').notNull(),
visibility: text('visibility').default('tenant').notNull(), // 'global', 'tenant'
expiresAt: timestamp('expires_at').notNull(),
createdAt: timestamp('created_at').defaultNow().notNull(),
});
export const chatBroadcasts = pgTable('chat_broadcasts', {
id: uuid('id').defaultRandom().primaryKey(),
tenantId: uuid('tenant_id').references(() => tenants.id),
senderName: text('sender_name').notNull(), // Usually the user's name or JUMPA Bot
content: text('content').notNull(),
targets: text('targets').notNull(), // JSON string of targets (rooms/users)
scheduledAt: timestamp('scheduled_at').notNull(),
isSent: boolean('is_sent').default(false).notNull(),
createdAt: timestamp('created_at').defaultNow().notNull(),
});
export const guestInvites = pgTable('guest_invites', {
id: uuid('id').defaultRandom().primaryKey(),
room: text('room').notNull(),
hostId: text('host_id').notNull(),
pin: text('pin').notNull(),
isUsed: boolean('is_used').default(false).notNull(),
createdAt: timestamp('created_at').defaultNow().notNull(),
});
export const saasPackages = pgTable('saas_packages', {
id: uuid('id').defaultRandom().primaryKey(),
name: text('name').notNull(),
price: text('price').notNull(),
features: text('features').default('[]').notNull(),
isHidden: boolean('is_hidden').default(false).notNull(),
isActive: boolean('is_active').default(true).notNull(),
createdAt: timestamp('created_at').defaultNow().notNull(),
});
export const quantumLogs = pgTable('quantum_logs', {
id: uuid('id').defaultRandom().primaryKey(),
tenantId: uuid('tenant_id').references(() => tenants.id), // Added for PANOPTICON isolation
actor: text('actor').notNull(),
action: text('action').notNull(),
targetId: text('target_id').notNull(),
ipAddress: text('ip_address'),
userAgent: text('user_agent'),
nanoTimestamp: timestamp('nano_timestamp').defaultNow().notNull(),
});
// PANOPTICON: Ultra-detailed telemetry table for XCU QUIC MoQ
export const networkTelemetry = pgTable('network_telemetry', {
id: uuid('id').defaultRandom().primaryKey(),
tenantId: uuid('tenant_id').references(() => tenants.id),
userId: uuid('user_id').references(() => users.id),
endpoint: text('endpoint').notNull(),
method: text('method').notNull(),
responseTimeMs: text('response_time_ms').notNull(), // using text to avoid integer limits for nano precision
statusCode: text('status_code').notNull(),
ipAddress: text('ip_address').notNull(),
geoRegion: text('geo_region'),
trafficBytes: text('traffic_bytes').notNull(),
timestamp: timestamp('timestamp').defaultNow().notNull(),
});
// PANOPTICON: Live Kill Switch Registry
export const liveKillSwitches = pgTable('live_kill_switches', {
id: uuid('id').defaultRandom().primaryKey(),
tenantId: uuid('tenant_id').references(() => tenants.id),
targetType: text('target_type').notNull(), // 'USER', 'TENANT', 'ROOM'
targetId: text('target_id').notNull(),
reason: text('reason'),
issuedBy: text('issued_by').notNull(), // actor email or ID
expiresAt: timestamp('expires_at'), // null means permanent block
createdAt: timestamp('created_at').defaultNow().notNull(),
});
export const systemFeatures = pgTable('system_features', {
id: uuid('id').defaultRandom().primaryKey(),
module: text('module').default('IAM').notNull(),
key: text('key').notNull().unique(),
name: text('name').notNull(),
description: text('description'),
defaultState: text('default_state').default('UPSELL').notNull(), // UPSELL, HIDDEN, GRANTED
createdAt: timestamp('created_at').defaultNow().notNull(),
});
+53
View File
@@ -0,0 +1,53 @@
// XCom ULTRA (XCU) - Kernel Layer Logic (eBPF/Rust)
// This is how the "Muscle" handles the 101 modules at the kernel level.
#include <linux/bpf.h>
#include <bpf/bpf_helpers.h>
/**
* XCU KERNEL INTERCEPTOR (eBPF/XDP)
* Modul: [xcu.feature.ebpf]
*
* Fungsi: Mem-bypass Network Stack Linux untuk paket video QUIC.
*/
struct tenant_config {
__u32 allow_av1;
__u32 allow_moq;
__u32 active_killswitch;
};
// Map untuk menyimpan konfigurasi tenant dari IAM (diperbarui via lib/quantum-orchestrator.ts)
struct {
__uint(type, BPF_MAP_TYPE_HASH);
__uint(max_entries, 1024);
__type(key, __u32); // Tenant ID Hash
__type(value, struct tenant_config);
} tenant_matrix_map SEC(".maps");
SEC("xdp_xcu")
int xcu_ingress_handler(struct xdp_md *ctx) {
void *data_end = (void *)(long)ctx->data_end;
void *data = (void *)(long)ctx->data;
// 1. Ambil Tenant ID dari Packet Header (Custom XCU Header)
__u32 tenant_id = extract_tenant_id(data, data_end);
struct tenant_config *config = bpf_map_lookup_elem(&tenant_matrix_map, &tenant_id);
if (!config) return XDP_PASS; // Tenant tidak dikenal, gunakan jalur lambat standar.
// 2. MODUL: [xcu.security.killswitch]
if (config->active_killswitch) {
return XDP_DROP; // Paket dibuang langsung di hardware/kernel. Nol latensi, nol beban CPU aplikasi.
}
// 3. MODUL: [xcu.transport.moq]
if (config->allow_moq) {
// Alihkan paket langsung ke High-Priority Media Queue
return XDP_REDIRECT;
}
return XDP_PASS;
}
char _license[] SEC("license") = "GPL";