@infuro/cms-core 1.0.19 → 1.0.20
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/dist/admin.cjs +534 -11
- package/dist/admin.cjs.map +1 -1
- package/dist/admin.js +564 -23
- package/dist/admin.js.map +1 -1
- package/dist/api.cjs +727 -36
- package/dist/api.cjs.map +1 -1
- package/dist/api.d.cts +1 -1
- package/dist/api.d.ts +1 -1
- package/dist/api.js +705 -18
- package/dist/api.js.map +1 -1
- package/dist/{index-GMn7-9PX.d.ts → index--GBYw5JE.d.ts} +84 -2
- package/dist/{index-D2C1O9b4.d.cts → index-DGtM2Gsk.d.cts} +84 -2
- package/dist/index.cjs +1701 -713
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +99 -13
- package/dist/index.d.ts +99 -13
- package/dist/index.js +1554 -574
- package/dist/index.js.map +1 -1
- package/dist/migrations/1775300000000-LlmAgents.ts +57 -0
- package/dist/migrations/1775300000001-LlmAgentsValidationRulesText.ts +43 -0
- package/dist/migrations/1775300000002-SeedLlmAgentsPermissions.ts +33 -0
- package/dist/migrations/1775300000003-LlmAgentKnowledgeDocuments.ts +50 -0
- package/dist/migrations/1775400000000-KnowledgeBaseVectorDimension384.ts +32 -0
- package/package.json +8 -6
package/dist/index.js
CHANGED
|
@@ -2432,29 +2432,111 @@ function localStoragePlugin(config = {}) {
|
|
|
2432
2432
|
}
|
|
2433
2433
|
|
|
2434
2434
|
// src/plugins/llm/llm-service.ts
|
|
2435
|
+
function parseHfInferenceEmbeddingBody(data) {
|
|
2436
|
+
if (data === null || data === void 0) return null;
|
|
2437
|
+
if (Array.isArray(data)) {
|
|
2438
|
+
if (data.length === 0) return null;
|
|
2439
|
+
const first = data[0];
|
|
2440
|
+
if (typeof first === "number") return data;
|
|
2441
|
+
if (Array.isArray(first) && first.length > 0 && typeof first[0] === "number") {
|
|
2442
|
+
return first;
|
|
2443
|
+
}
|
|
2444
|
+
if (Array.isArray(first) && Array.isArray(first[0]) && typeof first[0][0] === "number") {
|
|
2445
|
+
return first[0];
|
|
2446
|
+
}
|
|
2447
|
+
return null;
|
|
2448
|
+
}
|
|
2449
|
+
if (typeof data === "object" && data !== null && !Array.isArray(data)) {
|
|
2450
|
+
const o = data;
|
|
2451
|
+
if (typeof o.error === "string") return null;
|
|
2452
|
+
if ("embeddings" in o) return parseHfInferenceEmbeddingBody(o.embeddings);
|
|
2453
|
+
}
|
|
2454
|
+
return null;
|
|
2455
|
+
}
|
|
2435
2456
|
var LlmService = class _LlmService {
|
|
2436
|
-
|
|
2437
|
-
|
|
2457
|
+
static embedHttpErrorLogged = false;
|
|
2458
|
+
static embedShapeErrorLogged = false;
|
|
2459
|
+
static embedSuccessLogged = false;
|
|
2460
|
+
static hfDimensionMismatchWarned = false;
|
|
2461
|
+
baseURL;
|
|
2462
|
+
apiKey;
|
|
2463
|
+
defaultEmbeddingModel;
|
|
2464
|
+
embeddingProvider;
|
|
2465
|
+
hfInferenceBaseURL;
|
|
2466
|
+
embeddingApiKey;
|
|
2467
|
+
constructor(baseURL, apiKey, defaultEmbeddingModel, embedOpts) {
|
|
2468
|
+
this.baseURL = baseURL.replace(/\/$/, "");
|
|
2438
2469
|
this.apiKey = apiKey;
|
|
2439
2470
|
this.defaultEmbeddingModel = defaultEmbeddingModel;
|
|
2471
|
+
const p = (embedOpts?.embeddingProvider ?? "openai").toLowerCase();
|
|
2472
|
+
this.embeddingProvider = p === "huggingface" ? "huggingface" : "openai";
|
|
2473
|
+
this.hfInferenceBaseURL = (embedOpts?.hfInferenceBaseUrl ?? "https://api-inference.huggingface.co").replace(
|
|
2474
|
+
/\/$/,
|
|
2475
|
+
""
|
|
2476
|
+
);
|
|
2477
|
+
this.embeddingApiKey = (embedOpts?.embeddingApiKey ?? apiKey).trim();
|
|
2440
2478
|
}
|
|
2441
|
-
static embedWarned = false;
|
|
2442
2479
|
get base() {
|
|
2443
2480
|
return this.baseURL.replace(/\/$/, "");
|
|
2444
2481
|
}
|
|
2445
2482
|
get url() {
|
|
2446
2483
|
return `${this.base}/v1/chat/completions`;
|
|
2447
2484
|
}
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2485
|
+
llmDebugEnabled() {
|
|
2486
|
+
const v = process.env.LLM_DEBUG?.toLowerCase();
|
|
2487
|
+
return v === "1" || v === "true" || v === "yes";
|
|
2488
|
+
}
|
|
2489
|
+
/** Per-request embedding logs (noisy with many chunks). Set `LLM_EMBED_DEBUG=1`. */
|
|
2490
|
+
embedDebugEnabled() {
|
|
2491
|
+
const v = process.env.LLM_EMBED_DEBUG?.toLowerCase();
|
|
2492
|
+
return v === "1" || v === "true" || v === "yes";
|
|
2493
|
+
}
|
|
2494
|
+
logAgentComposition(options) {
|
|
2495
|
+
if (!this.llmDebugEnabled()) return;
|
|
2496
|
+
const { systemPrompt, context, history = [], userPrompt, model, temperature, max_tokens } = options;
|
|
2497
|
+
console.log("\n[LLM chatAgent] composing request");
|
|
2498
|
+
if (systemPrompt?.trim()) {
|
|
2499
|
+
console.log("[System instruction]\n", systemPrompt.trim());
|
|
2500
|
+
}
|
|
2501
|
+
if (context?.trim()) {
|
|
2502
|
+
console.log("[Context \u2014 merged into system message by chatAgent]\n", context.trim());
|
|
2503
|
+
}
|
|
2504
|
+
if (history.length > 0) {
|
|
2505
|
+
console.log("[Conversation so far]");
|
|
2506
|
+
for (const m of history) {
|
|
2507
|
+
console.log(` ${m.role}: ${m.content}`);
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2510
|
+
console.log("[Current user message]\n", userPrompt);
|
|
2511
|
+
if (model !== void 0 || temperature !== void 0 || max_tokens !== void 0) {
|
|
2512
|
+
console.log("[Agent options]", { model, temperature, max_tokens });
|
|
2513
|
+
}
|
|
2514
|
+
}
|
|
2515
|
+
logChatCompletionsRequest(kind, messages, options, stream) {
|
|
2516
|
+
if (!this.llmDebugEnabled()) return;
|
|
2517
|
+
const model = options.model ?? "meta-llama/Meta-Llama-3-8B-Instruct";
|
|
2518
|
+
console.log(`
|
|
2519
|
+
[LLM ${kind}] POST`, this.url);
|
|
2520
|
+
console.log("[Request options]", {
|
|
2521
|
+
model,
|
|
2522
|
+
temperature: options.temperature,
|
|
2523
|
+
max_tokens: options.max_tokens,
|
|
2524
|
+
stream
|
|
2525
|
+
});
|
|
2526
|
+
console.log("[Messages \u2014 wire payload]\n", JSON.stringify(messages, null, 2));
|
|
2527
|
+
}
|
|
2454
2528
|
async embed(text, options = {}) {
|
|
2455
|
-
const model = options.model ?? this.defaultEmbeddingModel ?? "text-embedding-3-small";
|
|
2456
2529
|
const input = text.slice(0, 8e3);
|
|
2457
|
-
|
|
2530
|
+
if (this.embeddingProvider === "huggingface") {
|
|
2531
|
+
const model2 = options.model ?? this.defaultEmbeddingModel ?? "sentence-transformers/all-MiniLM-L6-v2";
|
|
2532
|
+
return this.embedHuggingFaceInference(input, model2);
|
|
2533
|
+
}
|
|
2534
|
+
const model = options.model ?? this.defaultEmbeddingModel ?? "text-embedding-3-small";
|
|
2535
|
+
const embedUrl = `${this.base}/v1/embeddings`;
|
|
2536
|
+
if (this.embedDebugEnabled()) {
|
|
2537
|
+
console.info("[LLM embed] request", { url: embedUrl, model, inputChars: input.length });
|
|
2538
|
+
}
|
|
2539
|
+
const res = await fetch(embedUrl, {
|
|
2458
2540
|
method: "POST",
|
|
2459
2541
|
headers: {
|
|
2460
2542
|
"Content-Type": "application/json",
|
|
@@ -2467,9 +2549,17 @@ var LlmService = class _LlmService {
|
|
|
2467
2549
|
});
|
|
2468
2550
|
if (!res.ok) {
|
|
2469
2551
|
const body = await res.text();
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2552
|
+
const hint404 = res.status === 404 ? "This base URL does not expose OpenAI-compatible POST /v1/embeddings (e.g. router.huggingface.co). Set EMBEDDING_PROVIDER=huggingface and EMBEDDING_MODEL to a HF Inference\u2013supported embedding model, or use a host with /v1/embeddings." : "Embeddings HTTP error \u2014 knowledge_base_chunks.embedding will stay NULL for failed calls.";
|
|
2553
|
+
if (!_LlmService.embedHttpErrorLogged) {
|
|
2554
|
+
_LlmService.embedHttpErrorLogged = true;
|
|
2555
|
+
console.error("[LLM embed]", hint404, {
|
|
2556
|
+
url: embedUrl,
|
|
2557
|
+
status: res.status,
|
|
2558
|
+
statusText: res.statusText,
|
|
2559
|
+
bodyPreview: body.slice(0, 800)
|
|
2560
|
+
});
|
|
2561
|
+
} else if (this.embedDebugEnabled()) {
|
|
2562
|
+
console.warn("[LLM embed] repeat HTTP error", { status: res.status, bodyPreview: body.slice(0, 200) });
|
|
2473
2563
|
}
|
|
2474
2564
|
return [];
|
|
2475
2565
|
}
|
|
@@ -2477,7 +2567,10 @@ var LlmService = class _LlmService {
|
|
|
2477
2567
|
try {
|
|
2478
2568
|
data = await res.json();
|
|
2479
2569
|
} catch {
|
|
2480
|
-
|
|
2570
|
+
if (!_LlmService.embedShapeErrorLogged) {
|
|
2571
|
+
_LlmService.embedShapeErrorLogged = true;
|
|
2572
|
+
console.error("[LLM embed] Response body is not JSON \u2014 treating as no embedding.");
|
|
2573
|
+
}
|
|
2481
2574
|
return [];
|
|
2482
2575
|
}
|
|
2483
2576
|
let embedding = data?.data?.[0]?.embedding;
|
|
@@ -2488,13 +2581,154 @@ var LlmService = class _LlmService {
|
|
|
2488
2581
|
const first = data.data[0];
|
|
2489
2582
|
embedding = Array.isArray(first) ? first : first?.embedding;
|
|
2490
2583
|
}
|
|
2491
|
-
if (!Array.isArray(embedding)
|
|
2492
|
-
_LlmService.
|
|
2493
|
-
|
|
2584
|
+
if (!Array.isArray(embedding)) {
|
|
2585
|
+
if (!_LlmService.embedShapeErrorLogged) {
|
|
2586
|
+
_LlmService.embedShapeErrorLogged = true;
|
|
2587
|
+
console.error(
|
|
2588
|
+
"[LLM embed] Response OK but no parseable embedding array (OpenAI shape expected). knowledge_base_chunks will not update.",
|
|
2589
|
+
{
|
|
2590
|
+
url: embedUrl,
|
|
2591
|
+
topKeys: Object.keys(data),
|
|
2592
|
+
data0Type: Array.isArray(data?.data) ? typeof data.data[0] : "n/a"
|
|
2593
|
+
}
|
|
2594
|
+
);
|
|
2595
|
+
}
|
|
2596
|
+
return [];
|
|
2597
|
+
}
|
|
2598
|
+
if (!_LlmService.embedSuccessLogged) {
|
|
2599
|
+
_LlmService.embedSuccessLogged = true;
|
|
2600
|
+
console.info("[LLM embed] first success", { dimension: embedding.length, model });
|
|
2601
|
+
} else if (this.embedDebugEnabled()) {
|
|
2602
|
+
console.info("[LLM embed] ok", { dimension: embedding.length });
|
|
2603
|
+
}
|
|
2604
|
+
return embedding;
|
|
2605
|
+
}
|
|
2606
|
+
async embedHuggingFaceInference(input, model) {
|
|
2607
|
+
const normalizedBase = this.hfInferenceBaseURL.replace(/\/$/, "");
|
|
2608
|
+
const baseWithProvider = /router\.huggingface\.co\/hf-inference$/i.test(normalizedBase) ? normalizedBase : /router\.huggingface\.co$/i.test(normalizedBase) ? `${normalizedBase}/hf-inference` : normalizedBase;
|
|
2609
|
+
const requestBody = JSON.stringify({
|
|
2610
|
+
inputs: input,
|
|
2611
|
+
options: { wait_for_model: true }
|
|
2612
|
+
});
|
|
2613
|
+
const pipelineUrl = `${baseWithProvider}/pipeline/feature-extraction/${model}`;
|
|
2614
|
+
const modelUrl = `${baseWithProvider}/models/${model}`;
|
|
2615
|
+
if (this.embedDebugEnabled()) {
|
|
2616
|
+
console.info("[LLM embed HF]", { url: pipelineUrl, model, inputChars: input.length });
|
|
2617
|
+
}
|
|
2618
|
+
let embedUrl = pipelineUrl;
|
|
2619
|
+
let res = await fetch(embedUrl, {
|
|
2620
|
+
method: "POST",
|
|
2621
|
+
headers: {
|
|
2622
|
+
"Content-Type": "application/json",
|
|
2623
|
+
Authorization: `Bearer ${this.embeddingApiKey}`
|
|
2624
|
+
},
|
|
2625
|
+
body: requestBody
|
|
2626
|
+
});
|
|
2627
|
+
let bodyText = await res.text();
|
|
2628
|
+
if (res.status === 404) {
|
|
2629
|
+
embedUrl = modelUrl;
|
|
2630
|
+
if (this.embedDebugEnabled()) {
|
|
2631
|
+
console.warn("[LLM embed HF] /pipeline route returned 404; retrying with /models.", {
|
|
2632
|
+
model,
|
|
2633
|
+
fallbackUrl: embedUrl
|
|
2634
|
+
});
|
|
2635
|
+
}
|
|
2636
|
+
res = await fetch(embedUrl, {
|
|
2637
|
+
method: "POST",
|
|
2638
|
+
headers: {
|
|
2639
|
+
"Content-Type": "application/json",
|
|
2640
|
+
Authorization: `Bearer ${this.embeddingApiKey}`
|
|
2641
|
+
},
|
|
2642
|
+
body: requestBody
|
|
2643
|
+
});
|
|
2644
|
+
bodyText = await res.text();
|
|
2645
|
+
}
|
|
2646
|
+
if (!res.ok) {
|
|
2647
|
+
if (!_LlmService.embedHttpErrorLogged) {
|
|
2648
|
+
_LlmService.embedHttpErrorLogged = true;
|
|
2649
|
+
console.error(
|
|
2650
|
+
"[LLM embed HF] Hugging Face Inference request failed \u2014 knowledge chunks stay without vectors.",
|
|
2651
|
+
{
|
|
2652
|
+
url: embedUrl,
|
|
2653
|
+
status: res.status,
|
|
2654
|
+
statusText: res.statusText,
|
|
2655
|
+
bodyPreview: bodyText.slice(0, 800),
|
|
2656
|
+
hint: res.status === 410 || res.status === 404 ? "Model or route unavailable on Inference API; pick another EMBEDDING_MODEL (e.g. sentence-transformers/all-MiniLM-L6-v2)." : void 0
|
|
2657
|
+
}
|
|
2658
|
+
);
|
|
2659
|
+
} else if (this.embedDebugEnabled()) {
|
|
2660
|
+
console.warn("[LLM embed HF] repeat HTTP error", { status: res.status, bodyPreview: bodyText.slice(0, 200) });
|
|
2661
|
+
}
|
|
2662
|
+
return [];
|
|
2663
|
+
}
|
|
2664
|
+
let data;
|
|
2665
|
+
try {
|
|
2666
|
+
data = JSON.parse(bodyText);
|
|
2667
|
+
} catch {
|
|
2668
|
+
if (!_LlmService.embedShapeErrorLogged) {
|
|
2669
|
+
_LlmService.embedShapeErrorLogged = true;
|
|
2670
|
+
console.error("[LLM embed HF] Response is not JSON \u2014 treating as no embedding.");
|
|
2671
|
+
}
|
|
2672
|
+
return [];
|
|
2673
|
+
}
|
|
2674
|
+
const embedding = parseHfInferenceEmbeddingBody(data);
|
|
2675
|
+
if (!embedding?.length) {
|
|
2676
|
+
if (!_LlmService.embedShapeErrorLogged) {
|
|
2677
|
+
_LlmService.embedShapeErrorLogged = true;
|
|
2678
|
+
const preview = typeof data === "object" && data !== null && !Array.isArray(data) ? Object.keys(data) : typeof data;
|
|
2679
|
+
console.error("[LLM embed HF] Unrecognized embedding shape from Inference API.", { url: embedUrl, preview });
|
|
2680
|
+
}
|
|
2681
|
+
return [];
|
|
2682
|
+
}
|
|
2683
|
+
if (!_LlmService.embedSuccessLogged) {
|
|
2684
|
+
_LlmService.embedSuccessLogged = true;
|
|
2685
|
+
console.info("[LLM embed HF] first success", { dimension: embedding.length, model });
|
|
2686
|
+
if (!_LlmService.hfDimensionMismatchWarned && embedding.length !== 1536) {
|
|
2687
|
+
_LlmService.hfDimensionMismatchWarned = true;
|
|
2688
|
+
console.warn(
|
|
2689
|
+
`[LLM embed HF] Embedding dimensions=${embedding.length}; default CMS migration uses vector(1536). If pgvector updates fail, alter the column, e.g. ALTER TABLE knowledge_base_chunks ALTER COLUMN embedding TYPE vector(${embedding.length});`
|
|
2690
|
+
);
|
|
2691
|
+
}
|
|
2692
|
+
} else if (this.embedDebugEnabled()) {
|
|
2693
|
+
console.info("[LLM embed HF] ok", { dimension: embedding.length });
|
|
2694
|
+
}
|
|
2695
|
+
return embedding;
|
|
2696
|
+
}
|
|
2697
|
+
buildAgentMessages(options) {
|
|
2698
|
+
const { systemPrompt, userPrompt, history = [], context } = options;
|
|
2699
|
+
const messages = [];
|
|
2700
|
+
let systemContent = systemPrompt?.trim();
|
|
2701
|
+
if (context) {
|
|
2702
|
+
systemContent = systemContent ? `${systemContent}
|
|
2703
|
+
|
|
2704
|
+
Context:
|
|
2705
|
+
${context}` : `Use the following context to answer:
|
|
2706
|
+
|
|
2707
|
+
${context}`;
|
|
2708
|
+
}
|
|
2709
|
+
if (systemContent) {
|
|
2710
|
+
messages.push({ role: "system", content: systemContent });
|
|
2494
2711
|
}
|
|
2495
|
-
|
|
2712
|
+
if (history.length > 0) {
|
|
2713
|
+
messages.push(...history);
|
|
2714
|
+
}
|
|
2715
|
+
messages.push({ role: "user", content: userPrompt });
|
|
2716
|
+
return messages;
|
|
2717
|
+
}
|
|
2718
|
+
async chatAgent(options) {
|
|
2719
|
+
this.logAgentComposition(options);
|
|
2720
|
+
const messages = this.buildAgentMessages(options);
|
|
2721
|
+
const { model, temperature, max_tokens } = options;
|
|
2722
|
+
return this.chat(messages, { model, temperature, max_tokens });
|
|
2723
|
+
}
|
|
2724
|
+
async *streamChatAgent(options) {
|
|
2725
|
+
this.logAgentComposition(options);
|
|
2726
|
+
const messages = this.buildAgentMessages(options);
|
|
2727
|
+
const { model, temperature, max_tokens } = options;
|
|
2728
|
+
yield* this.streamChat(messages, { model, temperature, max_tokens });
|
|
2496
2729
|
}
|
|
2497
2730
|
async chat(messages, options = {}) {
|
|
2731
|
+
this.logChatCompletionsRequest("chat", messages, options, false);
|
|
2498
2732
|
const res = await fetch(this.url, {
|
|
2499
2733
|
method: "POST",
|
|
2500
2734
|
headers: {
|
|
@@ -2502,7 +2736,7 @@ var LlmService = class _LlmService {
|
|
|
2502
2736
|
Authorization: `Bearer ${this.apiKey}`
|
|
2503
2737
|
},
|
|
2504
2738
|
body: JSON.stringify({
|
|
2505
|
-
model: options.model ?? "
|
|
2739
|
+
model: options.model ?? "meta-llama/Meta-Llama-3-8B-Instruct",
|
|
2506
2740
|
messages,
|
|
2507
2741
|
stream: false,
|
|
2508
2742
|
temperature: options.temperature,
|
|
@@ -2515,9 +2749,13 @@ var LlmService = class _LlmService {
|
|
|
2515
2749
|
}
|
|
2516
2750
|
const data = await res.json();
|
|
2517
2751
|
const content = data.choices?.[0]?.message?.content ?? "";
|
|
2752
|
+
if (this.llmDebugEnabled()) {
|
|
2753
|
+
console.log("\n[LLM chat] assistant reply\n", content);
|
|
2754
|
+
}
|
|
2518
2755
|
return { content };
|
|
2519
2756
|
}
|
|
2520
2757
|
async *streamChat(messages, options = {}) {
|
|
2758
|
+
this.logChatCompletionsRequest("streamChat", messages, options, true);
|
|
2521
2759
|
const res = await fetch(this.url, {
|
|
2522
2760
|
method: "POST",
|
|
2523
2761
|
headers: {
|
|
@@ -2525,7 +2763,7 @@ var LlmService = class _LlmService {
|
|
|
2525
2763
|
Authorization: `Bearer ${this.apiKey}`
|
|
2526
2764
|
},
|
|
2527
2765
|
body: JSON.stringify({
|
|
2528
|
-
model: options.model ?? "
|
|
2766
|
+
model: options.model ?? "meta-llama/Meta-Llama-3-8B-Instruct",
|
|
2529
2767
|
messages,
|
|
2530
2768
|
stream: true,
|
|
2531
2769
|
temperature: options.temperature,
|
|
@@ -2540,6 +2778,8 @@ var LlmService = class _LlmService {
|
|
|
2540
2778
|
if (!reader) return;
|
|
2541
2779
|
const decoder = new TextDecoder();
|
|
2542
2780
|
let buffer = "";
|
|
2781
|
+
const debug = this.llmDebugEnabled();
|
|
2782
|
+
let streamedReply = "";
|
|
2543
2783
|
while (true) {
|
|
2544
2784
|
const { value, done } = await reader.read();
|
|
2545
2785
|
if (done) break;
|
|
@@ -2551,16 +2791,28 @@ var LlmService = class _LlmService {
|
|
|
2551
2791
|
try {
|
|
2552
2792
|
const json = JSON.parse(line.slice(6));
|
|
2553
2793
|
const content = json.choices?.[0]?.delta?.content;
|
|
2554
|
-
if (content)
|
|
2794
|
+
if (content) {
|
|
2795
|
+
if (debug) streamedReply += content;
|
|
2796
|
+
yield content;
|
|
2797
|
+
}
|
|
2555
2798
|
} catch {
|
|
2556
2799
|
}
|
|
2557
2800
|
}
|
|
2558
2801
|
}
|
|
2559
2802
|
}
|
|
2803
|
+
if (debug) {
|
|
2804
|
+
console.log("\n[LLM streamChat] assistant reply (full)\n", streamedReply);
|
|
2805
|
+
}
|
|
2560
2806
|
}
|
|
2561
2807
|
};
|
|
2562
2808
|
|
|
2563
2809
|
// src/plugins/llm/index.ts
|
|
2810
|
+
function normalizeEmbeddingProvider(raw) {
|
|
2811
|
+
if (!raw) return "openai";
|
|
2812
|
+
const s = raw.toLowerCase().trim();
|
|
2813
|
+
if (s === "huggingface" || s === "hf" || s === "hf_inference" || s === "inference") return "huggingface";
|
|
2814
|
+
return "openai";
|
|
2815
|
+
}
|
|
2564
2816
|
function llmPlugin(config = {}) {
|
|
2565
2817
|
return {
|
|
2566
2818
|
name: "llm",
|
|
@@ -2573,7 +2825,16 @@ function llmPlugin(config = {}) {
|
|
|
2573
2825
|
return void 0;
|
|
2574
2826
|
}
|
|
2575
2827
|
const embeddingModel = config.embeddingModel ?? context.config.EMBEDDING_MODEL;
|
|
2576
|
-
|
|
2828
|
+
const embeddingProvider = normalizeEmbeddingProvider(
|
|
2829
|
+
config.embeddingProvider ?? context.config.EMBEDDING_PROVIDER
|
|
2830
|
+
);
|
|
2831
|
+
const hfInferenceBaseUrl = config.hfInferenceBaseUrl ?? context.config.HF_INFERENCE_URL;
|
|
2832
|
+
const embeddingApiKey = config.embeddingApiKey ?? context.config.EMBEDDING_API_KEY;
|
|
2833
|
+
return new LlmService(baseURL.replace(/\/$/, ""), apiKey, embeddingModel, {
|
|
2834
|
+
embeddingProvider,
|
|
2835
|
+
hfInferenceBaseUrl,
|
|
2836
|
+
embeddingApiKey
|
|
2837
|
+
});
|
|
2577
2838
|
}
|
|
2578
2839
|
};
|
|
2579
2840
|
}
|
|
@@ -3437,6 +3698,86 @@ init_email_queue();
|
|
|
3437
3698
|
init_erp_queue();
|
|
3438
3699
|
import { MoreThanOrEqual, ILike, In } from "typeorm";
|
|
3439
3700
|
|
|
3701
|
+
// src/entities/llm-agent.entity.ts
|
|
3702
|
+
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm";
|
|
3703
|
+
var LlmAgent = class {
|
|
3704
|
+
id;
|
|
3705
|
+
name;
|
|
3706
|
+
slug;
|
|
3707
|
+
systemInstruction;
|
|
3708
|
+
model;
|
|
3709
|
+
temperature;
|
|
3710
|
+
maxTokens;
|
|
3711
|
+
validationRules;
|
|
3712
|
+
enabled;
|
|
3713
|
+
createdAt;
|
|
3714
|
+
updatedAt;
|
|
3715
|
+
deletedAt;
|
|
3716
|
+
deleted;
|
|
3717
|
+
createdBy;
|
|
3718
|
+
updatedBy;
|
|
3719
|
+
deletedBy;
|
|
3720
|
+
};
|
|
3721
|
+
__decorateClass([
|
|
3722
|
+
PrimaryGeneratedColumn()
|
|
3723
|
+
], LlmAgent.prototype, "id", 2);
|
|
3724
|
+
__decorateClass([
|
|
3725
|
+
Column("varchar")
|
|
3726
|
+
], LlmAgent.prototype, "name", 2);
|
|
3727
|
+
__decorateClass([
|
|
3728
|
+
Column("varchar")
|
|
3729
|
+
], LlmAgent.prototype, "slug", 2);
|
|
3730
|
+
__decorateClass([
|
|
3731
|
+
Column("text", { name: "system_instruction", default: "" })
|
|
3732
|
+
], LlmAgent.prototype, "systemInstruction", 2);
|
|
3733
|
+
__decorateClass([
|
|
3734
|
+
Column("varchar", { nullable: true })
|
|
3735
|
+
], LlmAgent.prototype, "model", 2);
|
|
3736
|
+
__decorateClass([
|
|
3737
|
+
Column("double precision", { name: "temperature", nullable: true })
|
|
3738
|
+
], LlmAgent.prototype, "temperature", 2);
|
|
3739
|
+
__decorateClass([
|
|
3740
|
+
Column("int", { name: "max_tokens", nullable: true })
|
|
3741
|
+
], LlmAgent.prototype, "maxTokens", 2);
|
|
3742
|
+
__decorateClass([
|
|
3743
|
+
Column("text", { name: "validation_rules", nullable: true })
|
|
3744
|
+
], LlmAgent.prototype, "validationRules", 2);
|
|
3745
|
+
__decorateClass([
|
|
3746
|
+
Column("boolean", { default: true })
|
|
3747
|
+
], LlmAgent.prototype, "enabled", 2);
|
|
3748
|
+
__decorateClass([
|
|
3749
|
+
Column({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
3750
|
+
], LlmAgent.prototype, "createdAt", 2);
|
|
3751
|
+
__decorateClass([
|
|
3752
|
+
Column({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
3753
|
+
], LlmAgent.prototype, "updatedAt", 2);
|
|
3754
|
+
__decorateClass([
|
|
3755
|
+
Column({ type: "timestamp", nullable: true })
|
|
3756
|
+
], LlmAgent.prototype, "deletedAt", 2);
|
|
3757
|
+
__decorateClass([
|
|
3758
|
+
Column("boolean", { default: false })
|
|
3759
|
+
], LlmAgent.prototype, "deleted", 2);
|
|
3760
|
+
__decorateClass([
|
|
3761
|
+
Column("int", { nullable: true })
|
|
3762
|
+
], LlmAgent.prototype, "createdBy", 2);
|
|
3763
|
+
__decorateClass([
|
|
3764
|
+
Column("int", { nullable: true })
|
|
3765
|
+
], LlmAgent.prototype, "updatedBy", 2);
|
|
3766
|
+
__decorateClass([
|
|
3767
|
+
Column("int", { nullable: true })
|
|
3768
|
+
], LlmAgent.prototype, "deletedBy", 2);
|
|
3769
|
+
LlmAgent = __decorateClass([
|
|
3770
|
+
Entity("llm_agents")
|
|
3771
|
+
], LlmAgent);
|
|
3772
|
+
function llmAgentToChatAgentOptions(agent) {
|
|
3773
|
+
return {
|
|
3774
|
+
systemPrompt: agent.systemInstruction?.trim() || void 0,
|
|
3775
|
+
model: agent.model?.trim() || void 0,
|
|
3776
|
+
temperature: agent.temperature ?? void 0,
|
|
3777
|
+
max_tokens: agent.maxTokens ?? void 0
|
|
3778
|
+
};
|
|
3779
|
+
}
|
|
3780
|
+
|
|
3440
3781
|
// src/lib/media-folder-path.ts
|
|
3441
3782
|
function sanitizeMediaFolderPath(input) {
|
|
3442
3783
|
if (input == null) return "";
|
|
@@ -3626,6 +3967,82 @@ async function extractZipMediaIntoParentTree(opts) {
|
|
|
3626
3967
|
}
|
|
3627
3968
|
|
|
3628
3969
|
// src/api/cms-handlers.ts
|
|
3970
|
+
function historyBeforeCurrentUser(history, currentUserContent) {
|
|
3971
|
+
const last = history[history.length - 1];
|
|
3972
|
+
if (last?.role === "user" && last.content === currentUserContent) {
|
|
3973
|
+
return history.slice(0, -1);
|
|
3974
|
+
}
|
|
3975
|
+
return [...history];
|
|
3976
|
+
}
|
|
3977
|
+
function pickStructuredRules(rules) {
|
|
3978
|
+
return {
|
|
3979
|
+
maxUserChars: rules.maxUserChars,
|
|
3980
|
+
maxMessageLength: rules.maxMessageLength,
|
|
3981
|
+
minUserChars: rules.minUserChars,
|
|
3982
|
+
minMessageLength: rules.minMessageLength,
|
|
3983
|
+
blockedSubstrings: rules.blockedSubstrings
|
|
3984
|
+
};
|
|
3985
|
+
}
|
|
3986
|
+
function guardrailsTextFromJsonObject(rules) {
|
|
3987
|
+
const g = typeof rules.guardrails === "string" && rules.guardrails.trim() || typeof rules.outputRules === "string" && rules.outputRules.trim() || typeof rules.outputInstructions === "string" && rules.outputInstructions.trim() || "";
|
|
3988
|
+
return g || null;
|
|
3989
|
+
}
|
|
3990
|
+
function parseLlmAgentValidationRules(validationRulesText) {
|
|
3991
|
+
const raw = validationRulesText?.trim();
|
|
3992
|
+
if (!raw) return { structured: {}, guardrailsForPrompt: null };
|
|
3993
|
+
try {
|
|
3994
|
+
const parsed = JSON.parse(raw);
|
|
3995
|
+
if (typeof parsed === "string") {
|
|
3996
|
+
const s = parsed.trim();
|
|
3997
|
+
return { structured: {}, guardrailsForPrompt: s || null };
|
|
3998
|
+
}
|
|
3999
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
4000
|
+
return { structured: {}, guardrailsForPrompt: raw };
|
|
4001
|
+
}
|
|
4002
|
+
const rules = parsed;
|
|
4003
|
+
return {
|
|
4004
|
+
structured: pickStructuredRules(rules),
|
|
4005
|
+
guardrailsForPrompt: guardrailsTextFromJsonObject(rules)
|
|
4006
|
+
};
|
|
4007
|
+
} catch {
|
|
4008
|
+
return { structured: {}, guardrailsForPrompt: raw };
|
|
4009
|
+
}
|
|
4010
|
+
}
|
|
4011
|
+
function validateUserMessageAgainstStructuredRules(message, structured) {
|
|
4012
|
+
const maxLen = structured.maxUserChars ?? structured.maxMessageLength;
|
|
4013
|
+
if (typeof maxLen === "number" && Number.isFinite(maxLen) && maxLen >= 0 && message.length > maxLen) {
|
|
4014
|
+
return { ok: false, error: `Message exceeds maximum length (${maxLen} characters)` };
|
|
4015
|
+
}
|
|
4016
|
+
const minLen = structured.minUserChars ?? structured.minMessageLength;
|
|
4017
|
+
if (typeof minLen === "number" && Number.isFinite(minLen) && minLen > 0 && message.length < minLen) {
|
|
4018
|
+
return { ok: false, error: `Message is shorter than minimum length (${minLen} characters)` };
|
|
4019
|
+
}
|
|
4020
|
+
const blocked = structured.blockedSubstrings;
|
|
4021
|
+
if (Array.isArray(blocked) && blocked.length > 0) {
|
|
4022
|
+
const lower = message.toLowerCase();
|
|
4023
|
+
for (const s of blocked) {
|
|
4024
|
+
if (typeof s !== "string" || !s.trim()) continue;
|
|
4025
|
+
if (lower.includes(s.toLowerCase())) {
|
|
4026
|
+
return { ok: false, error: "Message contains disallowed content" };
|
|
4027
|
+
}
|
|
4028
|
+
}
|
|
4029
|
+
}
|
|
4030
|
+
return { ok: true };
|
|
4031
|
+
}
|
|
4032
|
+
function validateUserMessageAgainstAgentRules(message, validationRulesText) {
|
|
4033
|
+
const { structured } = parseLlmAgentValidationRules(validationRulesText);
|
|
4034
|
+
return validateUserMessageAgainstStructuredRules(message, structured);
|
|
4035
|
+
}
|
|
4036
|
+
function mergeGuardrailsIntoSystemPrompt(baseSystem, guardrailsForPrompt) {
|
|
4037
|
+
const g = guardrailsForPrompt?.trim();
|
|
4038
|
+
const b = (baseSystem ?? "").trim();
|
|
4039
|
+
if (!g) return b;
|
|
4040
|
+
const block = `### Output guardrails (follow in every reply)
|
|
4041
|
+
${g}`;
|
|
4042
|
+
return b ? `${b}
|
|
4043
|
+
|
|
4044
|
+
${block}` : block;
|
|
4045
|
+
}
|
|
3629
4046
|
function createDashboardStatsHandler(config) {
|
|
3630
4047
|
const { dataSource, entityMap, json, requireAuth, requirePermission, requireEntityPermission } = config;
|
|
3631
4048
|
return async function GET(req) {
|
|
@@ -4707,9 +5124,24 @@ function createSettingsApiHandlers(config) {
|
|
|
4707
5124
|
}
|
|
4708
5125
|
var KB_CHUNK_LIMIT = 10;
|
|
4709
5126
|
var KB_CONTEXT_MAX_CHARS = 4e3;
|
|
5127
|
+
var RAG_LOG = "[rag-context]";
|
|
4710
5128
|
function getQueryTerms(message) {
|
|
4711
5129
|
return message.replace(/[^\w\s]/g, " ").split(/\s+/).filter((w) => w.length > 2).slice(0, 6);
|
|
4712
5130
|
}
|
|
5131
|
+
function normalizeChatModeSetting(raw) {
|
|
5132
|
+
if (raw === "external" || raw === "llm") return raw;
|
|
5133
|
+
return "whatsapp";
|
|
5134
|
+
}
|
|
5135
|
+
async function loadLlmSettingsMap(dataSource, entityMap) {
|
|
5136
|
+
if (!entityMap.configs) return {};
|
|
5137
|
+
const repo = dataSource.getRepository(entityMap.configs);
|
|
5138
|
+
const rows = await repo.find({ where: { settings: "llm", deleted: false } });
|
|
5139
|
+
const out = {};
|
|
5140
|
+
for (const row of rows) {
|
|
5141
|
+
out[row.key] = row.value;
|
|
5142
|
+
}
|
|
5143
|
+
return out;
|
|
5144
|
+
}
|
|
4713
5145
|
function createChatHandlers(config) {
|
|
4714
5146
|
const { dataSource, entityMap, json, getCms } = config;
|
|
4715
5147
|
const contactRepo = () => dataSource.getRepository(entityMap.contacts);
|
|
@@ -4717,6 +5149,26 @@ function createChatHandlers(config) {
|
|
|
4717
5149
|
const msgRepo = () => dataSource.getRepository(entityMap.chat_messages);
|
|
4718
5150
|
const chunkRepo = () => dataSource.getRepository(entityMap.knowledge_base_chunks);
|
|
4719
5151
|
return {
|
|
5152
|
+
async publicConfig(_req) {
|
|
5153
|
+
try {
|
|
5154
|
+
const map = await loadLlmSettingsMap(dataSource, entityMap);
|
|
5155
|
+
const mode = normalizeChatModeSetting(map.chatMode);
|
|
5156
|
+
const body = {
|
|
5157
|
+
enabled: map.enabled !== "false",
|
|
5158
|
+
chatMode: mode,
|
|
5159
|
+
agentSlug: mode === "llm" ? (map.attachedAgentSlug ?? "").trim() : "",
|
|
5160
|
+
botName: map.botName ?? "",
|
|
5161
|
+
icon: map.icon ?? "",
|
|
5162
|
+
iconImageUrl: map.iconImageUrl ?? "",
|
|
5163
|
+
iconBackgroundColor: map.iconBackgroundColor ?? "#6366f1",
|
|
5164
|
+
headerColor: map.headerColor ?? "#6366f1",
|
|
5165
|
+
whatsappPhone: map.whatsappPhone ?? ""
|
|
5166
|
+
};
|
|
5167
|
+
return json(body);
|
|
5168
|
+
} catch {
|
|
5169
|
+
return json({ error: "Failed to load chat config" }, { status: 500 });
|
|
5170
|
+
}
|
|
5171
|
+
},
|
|
4720
5172
|
async identify(req) {
|
|
4721
5173
|
try {
|
|
4722
5174
|
const body = await req.json();
|
|
@@ -4764,20 +5216,78 @@ function createChatHandlers(config) {
|
|
|
4764
5216
|
relations: ["messages"]
|
|
4765
5217
|
});
|
|
4766
5218
|
if (!conv) return json({ error: "Conversation not found" }, { status: 404 });
|
|
4767
|
-
const msgRepoInst = msgRepo();
|
|
4768
|
-
await msgRepoInst.save(msgRepoInst.create({ conversationId, role: "user", content: message }));
|
|
4769
5219
|
const cms = await getCms();
|
|
4770
5220
|
const llm = cms.getPlugin("llm");
|
|
4771
5221
|
if (!llm?.chat) return json({ error: "LLM not configured" }, { status: 503 });
|
|
5222
|
+
const llmSettings = await loadLlmSettingsMap(dataSource, entityMap);
|
|
5223
|
+
const supportMode = normalizeChatModeSetting(llmSettings.chatMode);
|
|
5224
|
+
let effectiveSlug = (body?.agentSlug ?? "").trim();
|
|
5225
|
+
if (!effectiveSlug && supportMode === "llm" && entityMap.llm_agents) {
|
|
5226
|
+
effectiveSlug = (llmSettings.attachedAgentSlug ?? "").trim();
|
|
5227
|
+
}
|
|
5228
|
+
let agentRow = null;
|
|
5229
|
+
if (effectiveSlug) {
|
|
5230
|
+
if (!entityMap.llm_agents) {
|
|
5231
|
+
return json({ error: "LLM agents are not configured on this deployment" }, { status: 400 });
|
|
5232
|
+
}
|
|
5233
|
+
const agentRepo = dataSource.getRepository(
|
|
5234
|
+
entityMap.llm_agents
|
|
5235
|
+
);
|
|
5236
|
+
agentRow = await agentRepo.findOne({
|
|
5237
|
+
where: { slug: effectiveSlug, deleted: false, enabled: true }
|
|
5238
|
+
});
|
|
5239
|
+
if (!agentRow && (body?.agentSlug ?? "").trim()) {
|
|
5240
|
+
return json({ error: "Agent not found or disabled", agentSlug: effectiveSlug }, { status: 404 });
|
|
5241
|
+
}
|
|
5242
|
+
}
|
|
5243
|
+
console.info(RAG_LOG, "step 1 | resolve agent", {
|
|
5244
|
+
agentSlug: effectiveSlug || "(none)",
|
|
5245
|
+
agentFound: !!agentRow,
|
|
5246
|
+
agentId: agentRow?.id ?? null
|
|
5247
|
+
});
|
|
5248
|
+
const parsedValidation = agentRow ? parseLlmAgentValidationRules(agentRow.validationRules) : { structured: {}, guardrailsForPrompt: null };
|
|
5249
|
+
if (agentRow) {
|
|
5250
|
+
const v = validateUserMessageAgainstStructuredRules(message, parsedValidation.structured);
|
|
5251
|
+
if (!v.ok) return json({ error: v.error, reason: "validation_failed" }, { status: 400 });
|
|
5252
|
+
}
|
|
5253
|
+
let kbDocumentScope;
|
|
5254
|
+
const Junction = entityMap.llm_agent_knowledge_documents;
|
|
5255
|
+
if (agentRow && Junction) {
|
|
5256
|
+
const linkRepo = dataSource.getRepository(Junction);
|
|
5257
|
+
const links = await linkRepo.find({ where: { agentId: agentRow.id } });
|
|
5258
|
+
const ids = [...new Set(links.map((l) => l.documentId))];
|
|
5259
|
+
if (ids.length > 0) kbDocumentScope = ids;
|
|
5260
|
+
}
|
|
5261
|
+
console.info(RAG_LOG, "step 2 | knowledge scope", {
|
|
5262
|
+
scopedDocumentIds: kbDocumentScope ?? "(all documents)",
|
|
5263
|
+
documentCount: kbDocumentScope?.length ?? "all"
|
|
5264
|
+
});
|
|
5265
|
+
const msgRepoInst = msgRepo();
|
|
5266
|
+
await msgRepoInst.save(msgRepoInst.create({ conversationId, role: "user", content: message }));
|
|
4772
5267
|
let contextParts = [];
|
|
5268
|
+
console.info(RAG_LOG, "step 3 | embed user query", {
|
|
5269
|
+
messageChars: message.length,
|
|
5270
|
+
embedAvailable: !!llm.embed
|
|
5271
|
+
});
|
|
4773
5272
|
const queryEmbedding = llm.embed ? await llm.embed(message) : null;
|
|
5273
|
+
console.info(RAG_LOG, "step 4 | query embedding result", {
|
|
5274
|
+
dimensions: queryEmbedding?.length ?? 0,
|
|
5275
|
+
hasEmbedding: !!(queryEmbedding && queryEmbedding.length > 0)
|
|
5276
|
+
});
|
|
4774
5277
|
if (queryEmbedding && queryEmbedding.length > 0) {
|
|
4775
5278
|
const vectorStr = "[" + queryEmbedding.join(",") + "]";
|
|
4776
5279
|
try {
|
|
4777
|
-
const rows = await dataSource.query(
|
|
5280
|
+
const rows = kbDocumentScope?.length ? await dataSource.query(
|
|
5281
|
+
`SELECT id, content FROM knowledge_base_chunks WHERE embedding IS NOT NULL AND "documentId" = ANY($3::int[]) ORDER BY embedding <=> $1::vector LIMIT $2`,
|
|
5282
|
+
[vectorStr, KB_CHUNK_LIMIT, kbDocumentScope]
|
|
5283
|
+
) : await dataSource.query(
|
|
4778
5284
|
`SELECT id, content FROM knowledge_base_chunks WHERE embedding IS NOT NULL ORDER BY embedding <=> $1::vector LIMIT $2`,
|
|
4779
5285
|
[vectorStr, KB_CHUNK_LIMIT]
|
|
4780
5286
|
);
|
|
5287
|
+
console.info(RAG_LOG, "step 5 | vector search results", {
|
|
5288
|
+
rowsReturned: rows.length,
|
|
5289
|
+
chunkIds: rows.map((r) => r.id)
|
|
5290
|
+
});
|
|
4781
5291
|
let totalLen = 0;
|
|
4782
5292
|
for (const r of rows) {
|
|
4783
5293
|
const text = (r.content ?? "").trim();
|
|
@@ -4785,13 +5295,24 @@ function createChatHandlers(config) {
|
|
|
4785
5295
|
contextParts.push(text);
|
|
4786
5296
|
totalLen += text.length;
|
|
4787
5297
|
}
|
|
4788
|
-
|
|
5298
|
+
console.info(RAG_LOG, "step 5a | vector context selected", {
|
|
5299
|
+
chunksUsed: contextParts.length,
|
|
5300
|
+
totalChars: totalLen
|
|
5301
|
+
});
|
|
5302
|
+
} catch (vecErr) {
|
|
5303
|
+
console.warn(RAG_LOG, "step 5 | vector search failed; falling back to keyword", {
|
|
5304
|
+
err: vecErr instanceof Error ? vecErr.message : String(vecErr)
|
|
5305
|
+
});
|
|
4789
5306
|
}
|
|
4790
5307
|
}
|
|
4791
5308
|
if (contextParts.length === 0) {
|
|
4792
5309
|
const terms = getQueryTerms(message);
|
|
5310
|
+
console.info(RAG_LOG, "step 6 | keyword fallback", {
|
|
5311
|
+
reason: !(queryEmbedding && queryEmbedding.length > 0) ? "no embedding" : "vector search returned nothing",
|
|
5312
|
+
searchTerms: terms
|
|
5313
|
+
});
|
|
4793
5314
|
if (terms.length > 0) {
|
|
4794
|
-
const conditions = terms.map((t) => ({ content: ILike(`%${t}%`) }));
|
|
5315
|
+
const conditions = kbDocumentScope?.length ? terms.map((t) => ({ content: ILike(`%${t}%`), documentId: In(kbDocumentScope) })) : terms.map((t) => ({ content: ILike(`%${t}%`) }));
|
|
4795
5316
|
const chunks = await chunkRepo().find({
|
|
4796
5317
|
where: conditions,
|
|
4797
5318
|
take: KB_CHUNK_LIMIT,
|
|
@@ -4806,19 +5327,66 @@ function createChatHandlers(config) {
|
|
|
4806
5327
|
contextParts.push(text);
|
|
4807
5328
|
totalLen += text.length;
|
|
4808
5329
|
}
|
|
5330
|
+
console.info(RAG_LOG, "step 6a | keyword results", {
|
|
5331
|
+
chunksFound: chunks.length,
|
|
5332
|
+
chunksUsed: contextParts.length,
|
|
5333
|
+
totalChars: totalLen
|
|
5334
|
+
});
|
|
4809
5335
|
}
|
|
4810
5336
|
}
|
|
4811
|
-
const
|
|
4812
|
-
const
|
|
5337
|
+
const historyRaw = (conv.messages ?? []).sort((a, b) => new Date(a.createdAt ?? 0).getTime() - new Date(b.createdAt ?? 0).getTime()).map((m) => ({ role: m.role, content: m.content }));
|
|
5338
|
+
const history = historyBeforeCurrentUser(historyRaw, message);
|
|
5339
|
+
let content;
|
|
5340
|
+
const ragContext = contextParts.length > 0 ? contextParts.join("\n\n") : void 0;
|
|
5341
|
+
console.info(RAG_LOG, "step 7 | final context", {
|
|
5342
|
+
method: contextParts.length > 0 ? "rag" : "none",
|
|
5343
|
+
contextChunks: contextParts.length,
|
|
5344
|
+
contextChars: ragContext?.length ?? 0,
|
|
5345
|
+
contextPreview: ragContext ? ragContext.slice(0, 200) + (ragContext.length > 200 ? "\u2026" : "") : "(no context)"
|
|
5346
|
+
});
|
|
5347
|
+
if (agentRow && llm.chatAgent) {
|
|
5348
|
+
const fromAgent = llmAgentToChatAgentOptions(agentRow);
|
|
5349
|
+
const systemPrompt = mergeGuardrailsIntoSystemPrompt(
|
|
5350
|
+
fromAgent.systemPrompt,
|
|
5351
|
+
parsedValidation.guardrailsForPrompt
|
|
5352
|
+
);
|
|
5353
|
+
const res = await llm.chatAgent({
|
|
5354
|
+
...fromAgent,
|
|
5355
|
+
systemPrompt: systemPrompt || void 0,
|
|
5356
|
+
context: ragContext,
|
|
5357
|
+
history,
|
|
5358
|
+
userPrompt: message
|
|
5359
|
+
});
|
|
5360
|
+
content = res.content;
|
|
5361
|
+
} else {
|
|
5362
|
+
const ragSystem = contextParts.length > 0 ? `Use the following context about the company and its products to answer. If the answer is not in the context, say so.
|
|
4813
5363
|
|
|
4814
5364
|
Context:
|
|
4815
|
-
${contextParts.join("\n\n")}` : "
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
5365
|
+
${contextParts.join("\n\n")}` : "";
|
|
5366
|
+
const defaultSystem = "You are a helpful assistant for the company. If you do not have specific information, say so.";
|
|
5367
|
+
let systemContent;
|
|
5368
|
+
if (agentRow) {
|
|
5369
|
+
const base = agentRow.systemInstruction?.trim() || "";
|
|
5370
|
+
systemContent = mergeGuardrailsIntoSystemPrompt(
|
|
5371
|
+
[base, ragSystem].filter(Boolean).join("\n\n") || defaultSystem,
|
|
5372
|
+
parsedValidation.guardrailsForPrompt
|
|
5373
|
+
);
|
|
5374
|
+
} else {
|
|
5375
|
+
systemContent = ragSystem || defaultSystem;
|
|
5376
|
+
}
|
|
5377
|
+
const messages = [
|
|
5378
|
+
{ role: "system", content: systemContent },
|
|
5379
|
+
...history,
|
|
5380
|
+
{ role: "user", content: message }
|
|
5381
|
+
];
|
|
5382
|
+
const chatOpts = agentRow ? {
|
|
5383
|
+
model: agentRow.model ?? void 0,
|
|
5384
|
+
temperature: agentRow.temperature ?? void 0,
|
|
5385
|
+
max_tokens: agentRow.maxTokens ?? void 0
|
|
5386
|
+
} : {};
|
|
5387
|
+
const res = await llm.chat(messages, chatOpts);
|
|
5388
|
+
content = res.content;
|
|
5389
|
+
}
|
|
4822
5390
|
await msgRepoInst.save(msgRepoInst.create({ conversationId, role: "assistant", content }));
|
|
4823
5391
|
return json({ content });
|
|
4824
5392
|
} catch (err) {
|
|
@@ -4877,13 +5445,13 @@ async function loadPublicThemeSettings(config) {
|
|
|
4877
5445
|
}
|
|
4878
5446
|
|
|
4879
5447
|
// src/entities/user.entity.ts
|
|
4880
|
-
import { Entity as
|
|
5448
|
+
import { Entity as Entity4, PrimaryGeneratedColumn as PrimaryGeneratedColumn4, Column as Column4, ManyToOne as ManyToOne2, JoinColumn as JoinColumn2 } from "typeorm";
|
|
4881
5449
|
|
|
4882
5450
|
// src/entities/user-group.entity.ts
|
|
4883
|
-
import { Entity as
|
|
5451
|
+
import { Entity as Entity3, PrimaryGeneratedColumn as PrimaryGeneratedColumn3, Column as Column3, OneToMany } from "typeorm";
|
|
4884
5452
|
|
|
4885
5453
|
// src/entities/permission.entity.ts
|
|
4886
|
-
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn } from "typeorm";
|
|
5454
|
+
import { Entity as Entity2, PrimaryGeneratedColumn as PrimaryGeneratedColumn2, Column as Column2, ManyToOne, JoinColumn } from "typeorm";
|
|
4887
5455
|
var Permission = class {
|
|
4888
5456
|
id;
|
|
4889
5457
|
groupId;
|
|
@@ -4902,53 +5470,53 @@ var Permission = class {
|
|
|
4902
5470
|
group;
|
|
4903
5471
|
};
|
|
4904
5472
|
__decorateClass([
|
|
4905
|
-
|
|
5473
|
+
PrimaryGeneratedColumn2()
|
|
4906
5474
|
], Permission.prototype, "id", 2);
|
|
4907
5475
|
__decorateClass([
|
|
4908
|
-
|
|
5476
|
+
Column2("int")
|
|
4909
5477
|
], Permission.prototype, "groupId", 2);
|
|
4910
5478
|
__decorateClass([
|
|
4911
|
-
|
|
5479
|
+
Column2("varchar")
|
|
4912
5480
|
], Permission.prototype, "entity", 2);
|
|
4913
5481
|
__decorateClass([
|
|
4914
|
-
|
|
5482
|
+
Column2("boolean", { default: false })
|
|
4915
5483
|
], Permission.prototype, "canCreate", 2);
|
|
4916
5484
|
__decorateClass([
|
|
4917
|
-
|
|
5485
|
+
Column2("boolean", { default: false })
|
|
4918
5486
|
], Permission.prototype, "canRead", 2);
|
|
4919
5487
|
__decorateClass([
|
|
4920
|
-
|
|
5488
|
+
Column2("boolean", { default: false })
|
|
4921
5489
|
], Permission.prototype, "canUpdate", 2);
|
|
4922
5490
|
__decorateClass([
|
|
4923
|
-
|
|
5491
|
+
Column2("boolean", { default: false })
|
|
4924
5492
|
], Permission.prototype, "canDelete", 2);
|
|
4925
5493
|
__decorateClass([
|
|
4926
|
-
|
|
5494
|
+
Column2({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4927
5495
|
], Permission.prototype, "createdAt", 2);
|
|
4928
5496
|
__decorateClass([
|
|
4929
|
-
|
|
5497
|
+
Column2({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4930
5498
|
], Permission.prototype, "updatedAt", 2);
|
|
4931
5499
|
__decorateClass([
|
|
4932
|
-
|
|
5500
|
+
Column2({ type: "timestamp", nullable: true })
|
|
4933
5501
|
], Permission.prototype, "deletedAt", 2);
|
|
4934
5502
|
__decorateClass([
|
|
4935
|
-
|
|
5503
|
+
Column2("boolean", { default: false })
|
|
4936
5504
|
], Permission.prototype, "deleted", 2);
|
|
4937
5505
|
__decorateClass([
|
|
4938
|
-
|
|
5506
|
+
Column2("int", { nullable: true })
|
|
4939
5507
|
], Permission.prototype, "createdBy", 2);
|
|
4940
5508
|
__decorateClass([
|
|
4941
|
-
|
|
5509
|
+
Column2("int", { nullable: true })
|
|
4942
5510
|
], Permission.prototype, "updatedBy", 2);
|
|
4943
5511
|
__decorateClass([
|
|
4944
|
-
|
|
5512
|
+
Column2("int", { nullable: true })
|
|
4945
5513
|
], Permission.prototype, "deletedBy", 2);
|
|
4946
5514
|
__decorateClass([
|
|
4947
5515
|
ManyToOne(() => UserGroup, (g) => g.permissions, { onDelete: "CASCADE" }),
|
|
4948
5516
|
JoinColumn({ name: "groupId" })
|
|
4949
5517
|
], Permission.prototype, "group", 2);
|
|
4950
5518
|
Permission = __decorateClass([
|
|
4951
|
-
|
|
5519
|
+
Entity2("permissions")
|
|
4952
5520
|
], Permission);
|
|
4953
5521
|
|
|
4954
5522
|
// src/entities/user-group.entity.ts
|
|
@@ -4966,31 +5534,31 @@ var UserGroup = class {
|
|
|
4966
5534
|
users;
|
|
4967
5535
|
};
|
|
4968
5536
|
__decorateClass([
|
|
4969
|
-
|
|
5537
|
+
PrimaryGeneratedColumn3()
|
|
4970
5538
|
], UserGroup.prototype, "id", 2);
|
|
4971
5539
|
__decorateClass([
|
|
4972
|
-
|
|
5540
|
+
Column3("varchar", { unique: true })
|
|
4973
5541
|
], UserGroup.prototype, "name", 2);
|
|
4974
5542
|
__decorateClass([
|
|
4975
|
-
|
|
5543
|
+
Column3({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4976
5544
|
], UserGroup.prototype, "createdAt", 2);
|
|
4977
5545
|
__decorateClass([
|
|
4978
|
-
|
|
5546
|
+
Column3({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4979
5547
|
], UserGroup.prototype, "updatedAt", 2);
|
|
4980
5548
|
__decorateClass([
|
|
4981
|
-
|
|
5549
|
+
Column3({ type: "timestamp", nullable: true })
|
|
4982
5550
|
], UserGroup.prototype, "deletedAt", 2);
|
|
4983
5551
|
__decorateClass([
|
|
4984
|
-
|
|
5552
|
+
Column3("boolean", { default: false })
|
|
4985
5553
|
], UserGroup.prototype, "deleted", 2);
|
|
4986
5554
|
__decorateClass([
|
|
4987
|
-
|
|
5555
|
+
Column3("int", { nullable: true })
|
|
4988
5556
|
], UserGroup.prototype, "createdBy", 2);
|
|
4989
5557
|
__decorateClass([
|
|
4990
|
-
|
|
5558
|
+
Column3("int", { nullable: true })
|
|
4991
5559
|
], UserGroup.prototype, "updatedBy", 2);
|
|
4992
5560
|
__decorateClass([
|
|
4993
|
-
|
|
5561
|
+
Column3("int", { nullable: true })
|
|
4994
5562
|
], UserGroup.prototype, "deletedBy", 2);
|
|
4995
5563
|
__decorateClass([
|
|
4996
5564
|
OneToMany(() => Permission, (p) => p.group)
|
|
@@ -4999,7 +5567,7 @@ __decorateClass([
|
|
|
4999
5567
|
OneToMany(() => User, (u) => u.group)
|
|
5000
5568
|
], UserGroup.prototype, "users", 2);
|
|
5001
5569
|
UserGroup = __decorateClass([
|
|
5002
|
-
|
|
5570
|
+
Entity3("user_groups")
|
|
5003
5571
|
], UserGroup);
|
|
5004
5572
|
|
|
5005
5573
|
// src/entities/user.entity.ts
|
|
@@ -5024,66 +5592,66 @@ var User = class {
|
|
|
5024
5592
|
group;
|
|
5025
5593
|
};
|
|
5026
5594
|
__decorateClass([
|
|
5027
|
-
|
|
5595
|
+
PrimaryGeneratedColumn4()
|
|
5028
5596
|
], User.prototype, "id", 2);
|
|
5029
5597
|
__decorateClass([
|
|
5030
|
-
|
|
5598
|
+
Column4("varchar")
|
|
5031
5599
|
], User.prototype, "name", 2);
|
|
5032
5600
|
__decorateClass([
|
|
5033
|
-
|
|
5601
|
+
Column4("varchar", { unique: true })
|
|
5034
5602
|
], User.prototype, "email", 2);
|
|
5035
5603
|
__decorateClass([
|
|
5036
|
-
|
|
5604
|
+
Column4("varchar", { nullable: true })
|
|
5037
5605
|
], User.prototype, "phone", 2);
|
|
5038
5606
|
__decorateClass([
|
|
5039
|
-
|
|
5607
|
+
Column4({ type: "timestamp", nullable: true })
|
|
5040
5608
|
], User.prototype, "phoneVerifiedAt", 2);
|
|
5041
5609
|
__decorateClass([
|
|
5042
|
-
|
|
5610
|
+
Column4({ type: "timestamp", nullable: true })
|
|
5043
5611
|
], User.prototype, "emailVerifiedAt", 2);
|
|
5044
5612
|
__decorateClass([
|
|
5045
|
-
|
|
5613
|
+
Column4("varchar", { nullable: true })
|
|
5046
5614
|
], User.prototype, "password", 2);
|
|
5047
5615
|
__decorateClass([
|
|
5048
|
-
|
|
5616
|
+
Column4("boolean", { default: false })
|
|
5049
5617
|
], User.prototype, "blocked", 2);
|
|
5050
5618
|
__decorateClass([
|
|
5051
|
-
|
|
5619
|
+
Column4("boolean", { default: false })
|
|
5052
5620
|
], User.prototype, "adminAccess", 2);
|
|
5053
5621
|
__decorateClass([
|
|
5054
|
-
|
|
5622
|
+
Column4("int", { nullable: true })
|
|
5055
5623
|
], User.prototype, "groupId", 2);
|
|
5056
5624
|
__decorateClass([
|
|
5057
|
-
|
|
5625
|
+
Column4({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5058
5626
|
], User.prototype, "createdAt", 2);
|
|
5059
5627
|
__decorateClass([
|
|
5060
|
-
|
|
5628
|
+
Column4({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5061
5629
|
], User.prototype, "updatedAt", 2);
|
|
5062
5630
|
__decorateClass([
|
|
5063
|
-
|
|
5631
|
+
Column4({ type: "timestamp", nullable: true })
|
|
5064
5632
|
], User.prototype, "deletedAt", 2);
|
|
5065
5633
|
__decorateClass([
|
|
5066
|
-
|
|
5634
|
+
Column4("boolean", { default: false })
|
|
5067
5635
|
], User.prototype, "deleted", 2);
|
|
5068
5636
|
__decorateClass([
|
|
5069
|
-
|
|
5637
|
+
Column4("int", { nullable: true })
|
|
5070
5638
|
], User.prototype, "createdBy", 2);
|
|
5071
5639
|
__decorateClass([
|
|
5072
|
-
|
|
5640
|
+
Column4("int", { nullable: true })
|
|
5073
5641
|
], User.prototype, "updatedBy", 2);
|
|
5074
5642
|
__decorateClass([
|
|
5075
|
-
|
|
5643
|
+
Column4("int", { nullable: true })
|
|
5076
5644
|
], User.prototype, "deletedBy", 2);
|
|
5077
5645
|
__decorateClass([
|
|
5078
5646
|
ManyToOne2(() => UserGroup, (g) => g.users, { onDelete: "SET NULL" }),
|
|
5079
5647
|
JoinColumn2({ name: "groupId" })
|
|
5080
5648
|
], User.prototype, "group", 2);
|
|
5081
5649
|
User = __decorateClass([
|
|
5082
|
-
|
|
5650
|
+
Entity4("users")
|
|
5083
5651
|
], User);
|
|
5084
5652
|
|
|
5085
5653
|
// src/entities/otp-challenge.entity.ts
|
|
5086
|
-
import { Entity as
|
|
5654
|
+
import { Entity as Entity5, PrimaryGeneratedColumn as PrimaryGeneratedColumn5, Column as Column5, Index } from "typeorm";
|
|
5087
5655
|
var OtpChallenge = class {
|
|
5088
5656
|
id;
|
|
5089
5657
|
purpose;
|
|
@@ -5096,39 +5664,39 @@ var OtpChallenge = class {
|
|
|
5096
5664
|
createdAt;
|
|
5097
5665
|
};
|
|
5098
5666
|
__decorateClass([
|
|
5099
|
-
|
|
5667
|
+
PrimaryGeneratedColumn5()
|
|
5100
5668
|
], OtpChallenge.prototype, "id", 2);
|
|
5101
5669
|
__decorateClass([
|
|
5102
|
-
|
|
5670
|
+
Column5("varchar")
|
|
5103
5671
|
], OtpChallenge.prototype, "purpose", 2);
|
|
5104
5672
|
__decorateClass([
|
|
5105
|
-
|
|
5673
|
+
Column5("varchar")
|
|
5106
5674
|
], OtpChallenge.prototype, "channel", 2);
|
|
5107
5675
|
__decorateClass([
|
|
5108
|
-
|
|
5676
|
+
Column5("varchar")
|
|
5109
5677
|
], OtpChallenge.prototype, "identifier", 2);
|
|
5110
5678
|
__decorateClass([
|
|
5111
|
-
|
|
5679
|
+
Column5("varchar")
|
|
5112
5680
|
], OtpChallenge.prototype, "codeHash", 2);
|
|
5113
5681
|
__decorateClass([
|
|
5114
|
-
|
|
5682
|
+
Column5({ type: "timestamp" })
|
|
5115
5683
|
], OtpChallenge.prototype, "expiresAt", 2);
|
|
5116
5684
|
__decorateClass([
|
|
5117
|
-
|
|
5685
|
+
Column5("int", { default: 0 })
|
|
5118
5686
|
], OtpChallenge.prototype, "attempts", 2);
|
|
5119
5687
|
__decorateClass([
|
|
5120
|
-
|
|
5688
|
+
Column5({ type: "timestamp", nullable: true })
|
|
5121
5689
|
], OtpChallenge.prototype, "consumedAt", 2);
|
|
5122
5690
|
__decorateClass([
|
|
5123
|
-
|
|
5691
|
+
Column5({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5124
5692
|
], OtpChallenge.prototype, "createdAt", 2);
|
|
5125
5693
|
OtpChallenge = __decorateClass([
|
|
5126
|
-
|
|
5694
|
+
Entity5("otp_challenges"),
|
|
5127
5695
|
Index(["purpose", "identifier"])
|
|
5128
5696
|
], OtpChallenge);
|
|
5129
5697
|
|
|
5130
5698
|
// src/entities/password-reset-token.entity.ts
|
|
5131
|
-
import { Entity as
|
|
5699
|
+
import { Entity as Entity6, PrimaryGeneratedColumn as PrimaryGeneratedColumn6, Column as Column6 } from "typeorm";
|
|
5132
5700
|
var PasswordResetToken = class {
|
|
5133
5701
|
id;
|
|
5134
5702
|
email;
|
|
@@ -5137,29 +5705,29 @@ var PasswordResetToken = class {
|
|
|
5137
5705
|
createdAt;
|
|
5138
5706
|
};
|
|
5139
5707
|
__decorateClass([
|
|
5140
|
-
|
|
5708
|
+
PrimaryGeneratedColumn6()
|
|
5141
5709
|
], PasswordResetToken.prototype, "id", 2);
|
|
5142
5710
|
__decorateClass([
|
|
5143
|
-
|
|
5711
|
+
Column6("varchar")
|
|
5144
5712
|
], PasswordResetToken.prototype, "email", 2);
|
|
5145
5713
|
__decorateClass([
|
|
5146
|
-
|
|
5714
|
+
Column6("varchar", { unique: true })
|
|
5147
5715
|
], PasswordResetToken.prototype, "token", 2);
|
|
5148
5716
|
__decorateClass([
|
|
5149
|
-
|
|
5717
|
+
Column6({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5150
5718
|
], PasswordResetToken.prototype, "expiresAt", 2);
|
|
5151
5719
|
__decorateClass([
|
|
5152
|
-
|
|
5720
|
+
Column6({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5153
5721
|
], PasswordResetToken.prototype, "createdAt", 2);
|
|
5154
5722
|
PasswordResetToken = __decorateClass([
|
|
5155
|
-
|
|
5723
|
+
Entity6("password_reset_tokens")
|
|
5156
5724
|
], PasswordResetToken);
|
|
5157
5725
|
|
|
5158
5726
|
// src/entities/blog.entity.ts
|
|
5159
5727
|
import {
|
|
5160
|
-
Entity as
|
|
5161
|
-
PrimaryGeneratedColumn as
|
|
5162
|
-
Column as
|
|
5728
|
+
Entity as Entity11,
|
|
5729
|
+
PrimaryGeneratedColumn as PrimaryGeneratedColumn11,
|
|
5730
|
+
Column as Column11,
|
|
5163
5731
|
ManyToOne as ManyToOne4,
|
|
5164
5732
|
OneToMany as OneToMany4,
|
|
5165
5733
|
ManyToMany as ManyToMany2,
|
|
@@ -5168,7 +5736,7 @@ import {
|
|
|
5168
5736
|
} from "typeorm";
|
|
5169
5737
|
|
|
5170
5738
|
// src/entities/category.entity.ts
|
|
5171
|
-
import { Entity as
|
|
5739
|
+
import { Entity as Entity7, PrimaryGeneratedColumn as PrimaryGeneratedColumn7, Column as Column7, OneToMany as OneToMany2 } from "typeorm";
|
|
5172
5740
|
var Category = class {
|
|
5173
5741
|
id;
|
|
5174
5742
|
name;
|
|
@@ -5182,41 +5750,41 @@ var Category = class {
|
|
|
5182
5750
|
blogs;
|
|
5183
5751
|
};
|
|
5184
5752
|
__decorateClass([
|
|
5185
|
-
|
|
5753
|
+
PrimaryGeneratedColumn7()
|
|
5186
5754
|
], Category.prototype, "id", 2);
|
|
5187
5755
|
__decorateClass([
|
|
5188
|
-
|
|
5756
|
+
Column7("varchar", { unique: true })
|
|
5189
5757
|
], Category.prototype, "name", 2);
|
|
5190
5758
|
__decorateClass([
|
|
5191
|
-
|
|
5759
|
+
Column7({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5192
5760
|
], Category.prototype, "createdAt", 2);
|
|
5193
5761
|
__decorateClass([
|
|
5194
|
-
|
|
5762
|
+
Column7({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5195
5763
|
], Category.prototype, "updatedAt", 2);
|
|
5196
5764
|
__decorateClass([
|
|
5197
|
-
|
|
5765
|
+
Column7({ type: "timestamp", nullable: true })
|
|
5198
5766
|
], Category.prototype, "deletedAt", 2);
|
|
5199
5767
|
__decorateClass([
|
|
5200
|
-
|
|
5768
|
+
Column7("boolean", { default: false })
|
|
5201
5769
|
], Category.prototype, "deleted", 2);
|
|
5202
5770
|
__decorateClass([
|
|
5203
|
-
|
|
5771
|
+
Column7("int", { nullable: true })
|
|
5204
5772
|
], Category.prototype, "createdBy", 2);
|
|
5205
5773
|
__decorateClass([
|
|
5206
|
-
|
|
5774
|
+
Column7("int", { nullable: true })
|
|
5207
5775
|
], Category.prototype, "updatedBy", 2);
|
|
5208
5776
|
__decorateClass([
|
|
5209
|
-
|
|
5777
|
+
Column7("int", { nullable: true })
|
|
5210
5778
|
], Category.prototype, "deletedBy", 2);
|
|
5211
5779
|
__decorateClass([
|
|
5212
5780
|
OneToMany2("Blog", "category")
|
|
5213
5781
|
], Category.prototype, "blogs", 2);
|
|
5214
5782
|
Category = __decorateClass([
|
|
5215
|
-
|
|
5783
|
+
Entity7("categories")
|
|
5216
5784
|
], Category);
|
|
5217
5785
|
|
|
5218
5786
|
// src/entities/seo.entity.ts
|
|
5219
|
-
import { Entity as
|
|
5787
|
+
import { Entity as Entity8, PrimaryGeneratedColumn as PrimaryGeneratedColumn8, Column as Column8, OneToMany as OneToMany3 } from "typeorm";
|
|
5220
5788
|
var Seo = class {
|
|
5221
5789
|
id;
|
|
5222
5790
|
title;
|
|
@@ -5236,59 +5804,59 @@ var Seo = class {
|
|
|
5236
5804
|
blogs;
|
|
5237
5805
|
};
|
|
5238
5806
|
__decorateClass([
|
|
5239
|
-
|
|
5807
|
+
PrimaryGeneratedColumn8()
|
|
5240
5808
|
], Seo.prototype, "id", 2);
|
|
5241
5809
|
__decorateClass([
|
|
5242
|
-
|
|
5810
|
+
Column8("varchar", { nullable: true })
|
|
5243
5811
|
], Seo.prototype, "title", 2);
|
|
5244
5812
|
__decorateClass([
|
|
5245
|
-
|
|
5813
|
+
Column8("varchar", { nullable: true })
|
|
5246
5814
|
], Seo.prototype, "description", 2);
|
|
5247
5815
|
__decorateClass([
|
|
5248
|
-
|
|
5816
|
+
Column8("varchar", { nullable: true })
|
|
5249
5817
|
], Seo.prototype, "keywords", 2);
|
|
5250
5818
|
__decorateClass([
|
|
5251
|
-
|
|
5819
|
+
Column8("varchar", { nullable: true })
|
|
5252
5820
|
], Seo.prototype, "ogTitle", 2);
|
|
5253
5821
|
__decorateClass([
|
|
5254
|
-
|
|
5822
|
+
Column8("varchar", { nullable: true })
|
|
5255
5823
|
], Seo.prototype, "ogDescription", 2);
|
|
5256
5824
|
__decorateClass([
|
|
5257
|
-
|
|
5825
|
+
Column8("varchar", { nullable: true })
|
|
5258
5826
|
], Seo.prototype, "ogImage", 2);
|
|
5259
5827
|
__decorateClass([
|
|
5260
|
-
|
|
5828
|
+
Column8("varchar", { unique: true })
|
|
5261
5829
|
], Seo.prototype, "slug", 2);
|
|
5262
5830
|
__decorateClass([
|
|
5263
|
-
|
|
5831
|
+
Column8({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5264
5832
|
], Seo.prototype, "createdAt", 2);
|
|
5265
5833
|
__decorateClass([
|
|
5266
|
-
|
|
5834
|
+
Column8({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5267
5835
|
], Seo.prototype, "updatedAt", 2);
|
|
5268
5836
|
__decorateClass([
|
|
5269
|
-
|
|
5837
|
+
Column8({ type: "timestamp", nullable: true })
|
|
5270
5838
|
], Seo.prototype, "deletedAt", 2);
|
|
5271
5839
|
__decorateClass([
|
|
5272
|
-
|
|
5840
|
+
Column8("boolean", { default: false })
|
|
5273
5841
|
], Seo.prototype, "deleted", 2);
|
|
5274
5842
|
__decorateClass([
|
|
5275
|
-
|
|
5843
|
+
Column8("int", { nullable: true })
|
|
5276
5844
|
], Seo.prototype, "createdBy", 2);
|
|
5277
5845
|
__decorateClass([
|
|
5278
|
-
|
|
5846
|
+
Column8("int", { nullable: true })
|
|
5279
5847
|
], Seo.prototype, "updatedBy", 2);
|
|
5280
5848
|
__decorateClass([
|
|
5281
|
-
|
|
5849
|
+
Column8("int", { nullable: true })
|
|
5282
5850
|
], Seo.prototype, "deletedBy", 2);
|
|
5283
5851
|
__decorateClass([
|
|
5284
5852
|
OneToMany3(() => Blog, (blog) => blog.seo)
|
|
5285
5853
|
], Seo.prototype, "blogs", 2);
|
|
5286
5854
|
Seo = __decorateClass([
|
|
5287
|
-
|
|
5855
|
+
Entity8("seos")
|
|
5288
5856
|
], Seo);
|
|
5289
5857
|
|
|
5290
5858
|
// src/entities/comment.entity.ts
|
|
5291
|
-
import { Entity as
|
|
5859
|
+
import { Entity as Entity9, PrimaryGeneratedColumn as PrimaryGeneratedColumn9, Column as Column9, ManyToOne as ManyToOne3, JoinColumn as JoinColumn3 } from "typeorm";
|
|
5292
5860
|
var Comment = class {
|
|
5293
5861
|
id;
|
|
5294
5862
|
content;
|
|
@@ -5305,37 +5873,37 @@ var Comment = class {
|
|
|
5305
5873
|
blog;
|
|
5306
5874
|
};
|
|
5307
5875
|
__decorateClass([
|
|
5308
|
-
|
|
5876
|
+
PrimaryGeneratedColumn9()
|
|
5309
5877
|
], Comment.prototype, "id", 2);
|
|
5310
5878
|
__decorateClass([
|
|
5311
|
-
|
|
5879
|
+
Column9("text")
|
|
5312
5880
|
], Comment.prototype, "content", 2);
|
|
5313
5881
|
__decorateClass([
|
|
5314
|
-
|
|
5882
|
+
Column9("int")
|
|
5315
5883
|
], Comment.prototype, "blogId", 2);
|
|
5316
5884
|
__decorateClass([
|
|
5317
|
-
|
|
5885
|
+
Column9("int")
|
|
5318
5886
|
], Comment.prototype, "authorId", 2);
|
|
5319
5887
|
__decorateClass([
|
|
5320
|
-
|
|
5888
|
+
Column9({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5321
5889
|
], Comment.prototype, "createdAt", 2);
|
|
5322
5890
|
__decorateClass([
|
|
5323
|
-
|
|
5891
|
+
Column9({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5324
5892
|
], Comment.prototype, "updatedAt", 2);
|
|
5325
5893
|
__decorateClass([
|
|
5326
|
-
|
|
5894
|
+
Column9({ type: "timestamp", nullable: true })
|
|
5327
5895
|
], Comment.prototype, "deletedAt", 2);
|
|
5328
5896
|
__decorateClass([
|
|
5329
|
-
|
|
5897
|
+
Column9("boolean", { default: false })
|
|
5330
5898
|
], Comment.prototype, "deleted", 2);
|
|
5331
5899
|
__decorateClass([
|
|
5332
|
-
|
|
5900
|
+
Column9("int", { nullable: true })
|
|
5333
5901
|
], Comment.prototype, "createdBy", 2);
|
|
5334
5902
|
__decorateClass([
|
|
5335
|
-
|
|
5903
|
+
Column9("int", { nullable: true })
|
|
5336
5904
|
], Comment.prototype, "updatedBy", 2);
|
|
5337
5905
|
__decorateClass([
|
|
5338
|
-
|
|
5906
|
+
Column9("int", { nullable: true })
|
|
5339
5907
|
], Comment.prototype, "deletedBy", 2);
|
|
5340
5908
|
__decorateClass([
|
|
5341
5909
|
ManyToOne3(() => User, { onDelete: "CASCADE" }),
|
|
@@ -5346,11 +5914,11 @@ __decorateClass([
|
|
|
5346
5914
|
JoinColumn3({ name: "blogId" })
|
|
5347
5915
|
], Comment.prototype, "blog", 2);
|
|
5348
5916
|
Comment = __decorateClass([
|
|
5349
|
-
|
|
5917
|
+
Entity9("comments")
|
|
5350
5918
|
], Comment);
|
|
5351
5919
|
|
|
5352
5920
|
// src/entities/tag.entity.ts
|
|
5353
|
-
import { Entity as
|
|
5921
|
+
import { Entity as Entity10, PrimaryGeneratedColumn as PrimaryGeneratedColumn10, Column as Column10, ManyToMany } from "typeorm";
|
|
5354
5922
|
var Tag = class {
|
|
5355
5923
|
id;
|
|
5356
5924
|
name;
|
|
@@ -5364,37 +5932,37 @@ var Tag = class {
|
|
|
5364
5932
|
blogs;
|
|
5365
5933
|
};
|
|
5366
5934
|
__decorateClass([
|
|
5367
|
-
|
|
5935
|
+
PrimaryGeneratedColumn10()
|
|
5368
5936
|
], Tag.prototype, "id", 2);
|
|
5369
5937
|
__decorateClass([
|
|
5370
|
-
|
|
5938
|
+
Column10("varchar", { unique: true })
|
|
5371
5939
|
], Tag.prototype, "name", 2);
|
|
5372
5940
|
__decorateClass([
|
|
5373
|
-
|
|
5941
|
+
Column10({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5374
5942
|
], Tag.prototype, "createdAt", 2);
|
|
5375
5943
|
__decorateClass([
|
|
5376
|
-
|
|
5944
|
+
Column10({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5377
5945
|
], Tag.prototype, "updatedAt", 2);
|
|
5378
5946
|
__decorateClass([
|
|
5379
|
-
|
|
5947
|
+
Column10({ type: "timestamp", nullable: true })
|
|
5380
5948
|
], Tag.prototype, "deletedAt", 2);
|
|
5381
5949
|
__decorateClass([
|
|
5382
|
-
|
|
5950
|
+
Column10("boolean", { default: false })
|
|
5383
5951
|
], Tag.prototype, "deleted", 2);
|
|
5384
5952
|
__decorateClass([
|
|
5385
|
-
|
|
5953
|
+
Column10("int", { nullable: true })
|
|
5386
5954
|
], Tag.prototype, "createdBy", 2);
|
|
5387
5955
|
__decorateClass([
|
|
5388
|
-
|
|
5956
|
+
Column10("int", { nullable: true })
|
|
5389
5957
|
], Tag.prototype, "updatedBy", 2);
|
|
5390
5958
|
__decorateClass([
|
|
5391
|
-
|
|
5959
|
+
Column10("int", { nullable: true })
|
|
5392
5960
|
], Tag.prototype, "deletedBy", 2);
|
|
5393
5961
|
__decorateClass([
|
|
5394
5962
|
ManyToMany(() => Blog, (blog) => blog.tags)
|
|
5395
5963
|
], Tag.prototype, "blogs", 2);
|
|
5396
5964
|
Tag = __decorateClass([
|
|
5397
|
-
|
|
5965
|
+
Entity10("tags")
|
|
5398
5966
|
], Tag);
|
|
5399
5967
|
|
|
5400
5968
|
// src/entities/blog.entity.ts
|
|
@@ -5422,52 +5990,52 @@ var Blog = class {
|
|
|
5422
5990
|
tags;
|
|
5423
5991
|
};
|
|
5424
5992
|
__decorateClass([
|
|
5425
|
-
|
|
5993
|
+
PrimaryGeneratedColumn11()
|
|
5426
5994
|
], Blog.prototype, "id", 2);
|
|
5427
5995
|
__decorateClass([
|
|
5428
|
-
|
|
5996
|
+
Column11("varchar")
|
|
5429
5997
|
], Blog.prototype, "title", 2);
|
|
5430
5998
|
__decorateClass([
|
|
5431
|
-
|
|
5999
|
+
Column11("text")
|
|
5432
6000
|
], Blog.prototype, "content", 2);
|
|
5433
6001
|
__decorateClass([
|
|
5434
|
-
|
|
6002
|
+
Column11("varchar", { nullable: true })
|
|
5435
6003
|
], Blog.prototype, "coverImage", 2);
|
|
5436
6004
|
__decorateClass([
|
|
5437
|
-
|
|
6005
|
+
Column11("int")
|
|
5438
6006
|
], Blog.prototype, "authorId", 2);
|
|
5439
6007
|
__decorateClass([
|
|
5440
|
-
|
|
6008
|
+
Column11("int", { nullable: true })
|
|
5441
6009
|
], Blog.prototype, "categoryId", 2);
|
|
5442
6010
|
__decorateClass([
|
|
5443
|
-
|
|
6011
|
+
Column11("int", { nullable: true })
|
|
5444
6012
|
], Blog.prototype, "seoId", 2);
|
|
5445
6013
|
__decorateClass([
|
|
5446
|
-
|
|
6014
|
+
Column11("boolean", { default: false })
|
|
5447
6015
|
], Blog.prototype, "published", 2);
|
|
5448
6016
|
__decorateClass([
|
|
5449
|
-
|
|
6017
|
+
Column11({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5450
6018
|
], Blog.prototype, "createdAt", 2);
|
|
5451
6019
|
__decorateClass([
|
|
5452
|
-
|
|
6020
|
+
Column11({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5453
6021
|
], Blog.prototype, "updatedAt", 2);
|
|
5454
6022
|
__decorateClass([
|
|
5455
|
-
|
|
6023
|
+
Column11({ type: "timestamp", nullable: true })
|
|
5456
6024
|
], Blog.prototype, "deletedAt", 2);
|
|
5457
6025
|
__decorateClass([
|
|
5458
|
-
|
|
6026
|
+
Column11("boolean", { default: false })
|
|
5459
6027
|
], Blog.prototype, "deleted", 2);
|
|
5460
6028
|
__decorateClass([
|
|
5461
|
-
|
|
6029
|
+
Column11("int", { nullable: true })
|
|
5462
6030
|
], Blog.prototype, "createdBy", 2);
|
|
5463
6031
|
__decorateClass([
|
|
5464
|
-
|
|
6032
|
+
Column11("int", { nullable: true })
|
|
5465
6033
|
], Blog.prototype, "updatedBy", 2);
|
|
5466
6034
|
__decorateClass([
|
|
5467
|
-
|
|
6035
|
+
Column11("int", { nullable: true })
|
|
5468
6036
|
], Blog.prototype, "deletedBy", 2);
|
|
5469
6037
|
__decorateClass([
|
|
5470
|
-
|
|
6038
|
+
Column11("varchar", { unique: true })
|
|
5471
6039
|
], Blog.prototype, "slug", 2);
|
|
5472
6040
|
__decorateClass([
|
|
5473
6041
|
ManyToOne4(() => User, { onDelete: "CASCADE" }),
|
|
@@ -5493,20 +6061,20 @@ __decorateClass([
|
|
|
5493
6061
|
})
|
|
5494
6062
|
], Blog.prototype, "tags", 2);
|
|
5495
6063
|
Blog = __decorateClass([
|
|
5496
|
-
|
|
6064
|
+
Entity11("blogs")
|
|
5497
6065
|
], Blog);
|
|
5498
6066
|
|
|
5499
6067
|
// src/entities/contact.entity.ts
|
|
5500
|
-
import { Entity as
|
|
6068
|
+
import { Entity as Entity20, PrimaryGeneratedColumn as PrimaryGeneratedColumn20, Column as Column20, OneToMany as OneToMany8, ManyToOne as ManyToOne12, JoinColumn as JoinColumn12 } from "typeorm";
|
|
5501
6069
|
|
|
5502
6070
|
// src/entities/form-submission.entity.ts
|
|
5503
|
-
import { Entity as
|
|
6071
|
+
import { Entity as Entity14, PrimaryGeneratedColumn as PrimaryGeneratedColumn14, Column as Column14, ManyToOne as ManyToOne6, JoinColumn as JoinColumn6 } from "typeorm";
|
|
5504
6072
|
|
|
5505
6073
|
// src/entities/form.entity.ts
|
|
5506
|
-
import { Entity as
|
|
6074
|
+
import { Entity as Entity13, PrimaryGeneratedColumn as PrimaryGeneratedColumn13, Column as Column13, OneToMany as OneToMany5 } from "typeorm";
|
|
5507
6075
|
|
|
5508
6076
|
// src/entities/form-field.entity.ts
|
|
5509
|
-
import { Entity as
|
|
6077
|
+
import { Entity as Entity12, PrimaryGeneratedColumn as PrimaryGeneratedColumn12, Column as Column12, ManyToOne as ManyToOne5, JoinColumn as JoinColumn5 } from "typeorm";
|
|
5510
6078
|
var FormField = class {
|
|
5511
6079
|
id;
|
|
5512
6080
|
formId;
|
|
@@ -5529,65 +6097,65 @@ var FormField = class {
|
|
|
5529
6097
|
form;
|
|
5530
6098
|
};
|
|
5531
6099
|
__decorateClass([
|
|
5532
|
-
|
|
6100
|
+
PrimaryGeneratedColumn12()
|
|
5533
6101
|
], FormField.prototype, "id", 2);
|
|
5534
6102
|
__decorateClass([
|
|
5535
|
-
|
|
6103
|
+
Column12("int")
|
|
5536
6104
|
], FormField.prototype, "formId", 2);
|
|
5537
6105
|
__decorateClass([
|
|
5538
|
-
|
|
6106
|
+
Column12("varchar")
|
|
5539
6107
|
], FormField.prototype, "label", 2);
|
|
5540
6108
|
__decorateClass([
|
|
5541
|
-
|
|
6109
|
+
Column12("varchar")
|
|
5542
6110
|
], FormField.prototype, "type", 2);
|
|
5543
6111
|
__decorateClass([
|
|
5544
|
-
|
|
6112
|
+
Column12("varchar", { nullable: true })
|
|
5545
6113
|
], FormField.prototype, "placeholder", 2);
|
|
5546
6114
|
__decorateClass([
|
|
5547
|
-
|
|
6115
|
+
Column12("varchar", { nullable: true })
|
|
5548
6116
|
], FormField.prototype, "options", 2);
|
|
5549
6117
|
__decorateClass([
|
|
5550
|
-
|
|
6118
|
+
Column12("boolean", { default: false })
|
|
5551
6119
|
], FormField.prototype, "required", 2);
|
|
5552
6120
|
__decorateClass([
|
|
5553
|
-
|
|
6121
|
+
Column12("varchar", { nullable: true })
|
|
5554
6122
|
], FormField.prototype, "validation", 2);
|
|
5555
6123
|
__decorateClass([
|
|
5556
|
-
|
|
6124
|
+
Column12("int")
|
|
5557
6125
|
], FormField.prototype, "order", 2);
|
|
5558
6126
|
__decorateClass([
|
|
5559
|
-
|
|
6127
|
+
Column12("int", { default: 1 })
|
|
5560
6128
|
], FormField.prototype, "groupId", 2);
|
|
5561
6129
|
__decorateClass([
|
|
5562
|
-
|
|
6130
|
+
Column12("int", { default: 12 })
|
|
5563
6131
|
], FormField.prototype, "columnWidth", 2);
|
|
5564
6132
|
__decorateClass([
|
|
5565
|
-
|
|
6133
|
+
Column12({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5566
6134
|
], FormField.prototype, "createdAt", 2);
|
|
5567
6135
|
__decorateClass([
|
|
5568
|
-
|
|
6136
|
+
Column12({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5569
6137
|
], FormField.prototype, "updatedAt", 2);
|
|
5570
6138
|
__decorateClass([
|
|
5571
|
-
|
|
6139
|
+
Column12({ type: "timestamp", nullable: true })
|
|
5572
6140
|
], FormField.prototype, "deletedAt", 2);
|
|
5573
6141
|
__decorateClass([
|
|
5574
|
-
|
|
6142
|
+
Column12("boolean", { default: false })
|
|
5575
6143
|
], FormField.prototype, "deleted", 2);
|
|
5576
6144
|
__decorateClass([
|
|
5577
|
-
|
|
6145
|
+
Column12("int", { nullable: true })
|
|
5578
6146
|
], FormField.prototype, "createdBy", 2);
|
|
5579
6147
|
__decorateClass([
|
|
5580
|
-
|
|
6148
|
+
Column12("int", { nullable: true })
|
|
5581
6149
|
], FormField.prototype, "updatedBy", 2);
|
|
5582
6150
|
__decorateClass([
|
|
5583
|
-
|
|
6151
|
+
Column12("int", { nullable: true })
|
|
5584
6152
|
], FormField.prototype, "deletedBy", 2);
|
|
5585
6153
|
__decorateClass([
|
|
5586
6154
|
ManyToOne5(() => Form, (f) => f.fields, { onDelete: "CASCADE" }),
|
|
5587
6155
|
JoinColumn5({ name: "formId" })
|
|
5588
6156
|
], FormField.prototype, "form", 2);
|
|
5589
6157
|
FormField = __decorateClass([
|
|
5590
|
-
|
|
6158
|
+
Entity12("form_fields")
|
|
5591
6159
|
], FormField);
|
|
5592
6160
|
|
|
5593
6161
|
// src/entities/form.entity.ts
|
|
@@ -5609,43 +6177,43 @@ var Form = class {
|
|
|
5609
6177
|
submissions;
|
|
5610
6178
|
};
|
|
5611
6179
|
__decorateClass([
|
|
5612
|
-
|
|
6180
|
+
PrimaryGeneratedColumn13()
|
|
5613
6181
|
], Form.prototype, "id", 2);
|
|
5614
6182
|
__decorateClass([
|
|
5615
|
-
|
|
6183
|
+
Column13("varchar")
|
|
5616
6184
|
], Form.prototype, "name", 2);
|
|
5617
6185
|
__decorateClass([
|
|
5618
|
-
|
|
6186
|
+
Column13("text", { nullable: true })
|
|
5619
6187
|
], Form.prototype, "description", 2);
|
|
5620
6188
|
__decorateClass([
|
|
5621
|
-
|
|
6189
|
+
Column13("varchar", { nullable: true })
|
|
5622
6190
|
], Form.prototype, "campaign", 2);
|
|
5623
6191
|
__decorateClass([
|
|
5624
|
-
|
|
6192
|
+
Column13("varchar", { unique: true })
|
|
5625
6193
|
], Form.prototype, "slug", 2);
|
|
5626
6194
|
__decorateClass([
|
|
5627
|
-
|
|
6195
|
+
Column13("boolean", { default: false })
|
|
5628
6196
|
], Form.prototype, "published", 2);
|
|
5629
6197
|
__decorateClass([
|
|
5630
|
-
|
|
6198
|
+
Column13({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5631
6199
|
], Form.prototype, "createdAt", 2);
|
|
5632
6200
|
__decorateClass([
|
|
5633
|
-
|
|
6201
|
+
Column13({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5634
6202
|
], Form.prototype, "updatedAt", 2);
|
|
5635
6203
|
__decorateClass([
|
|
5636
|
-
|
|
6204
|
+
Column13({ type: "timestamp", nullable: true })
|
|
5637
6205
|
], Form.prototype, "deletedAt", 2);
|
|
5638
6206
|
__decorateClass([
|
|
5639
|
-
|
|
6207
|
+
Column13("boolean", { default: false })
|
|
5640
6208
|
], Form.prototype, "deleted", 2);
|
|
5641
6209
|
__decorateClass([
|
|
5642
|
-
|
|
6210
|
+
Column13("int", { nullable: true })
|
|
5643
6211
|
], Form.prototype, "createdBy", 2);
|
|
5644
6212
|
__decorateClass([
|
|
5645
|
-
|
|
6213
|
+
Column13("int", { nullable: true })
|
|
5646
6214
|
], Form.prototype, "updatedBy", 2);
|
|
5647
6215
|
__decorateClass([
|
|
5648
|
-
|
|
6216
|
+
Column13("int", { nullable: true })
|
|
5649
6217
|
], Form.prototype, "deletedBy", 2);
|
|
5650
6218
|
__decorateClass([
|
|
5651
6219
|
OneToMany5(() => FormField, (f) => f.form)
|
|
@@ -5654,7 +6222,7 @@ __decorateClass([
|
|
|
5654
6222
|
OneToMany5(() => FormSubmission, (s) => s.form)
|
|
5655
6223
|
], Form.prototype, "submissions", 2);
|
|
5656
6224
|
Form = __decorateClass([
|
|
5657
|
-
|
|
6225
|
+
Entity13("forms")
|
|
5658
6226
|
], Form);
|
|
5659
6227
|
|
|
5660
6228
|
// src/entities/form-submission.entity.ts
|
|
@@ -5671,28 +6239,28 @@ var FormSubmission = class {
|
|
|
5671
6239
|
contact;
|
|
5672
6240
|
};
|
|
5673
6241
|
__decorateClass([
|
|
5674
|
-
|
|
6242
|
+
PrimaryGeneratedColumn14()
|
|
5675
6243
|
], FormSubmission.prototype, "id", 2);
|
|
5676
6244
|
__decorateClass([
|
|
5677
|
-
|
|
6245
|
+
Column14("int")
|
|
5678
6246
|
], FormSubmission.prototype, "formId", 2);
|
|
5679
6247
|
__decorateClass([
|
|
5680
|
-
|
|
6248
|
+
Column14("int", { nullable: true })
|
|
5681
6249
|
], FormSubmission.prototype, "contactId", 2);
|
|
5682
6250
|
__decorateClass([
|
|
5683
|
-
|
|
6251
|
+
Column14("jsonb")
|
|
5684
6252
|
], FormSubmission.prototype, "data", 2);
|
|
5685
6253
|
__decorateClass([
|
|
5686
|
-
|
|
6254
|
+
Column14("varchar", { nullable: true })
|
|
5687
6255
|
], FormSubmission.prototype, "ipAddress", 2);
|
|
5688
6256
|
__decorateClass([
|
|
5689
|
-
|
|
6257
|
+
Column14("varchar", { nullable: true })
|
|
5690
6258
|
], FormSubmission.prototype, "userAgent", 2);
|
|
5691
6259
|
__decorateClass([
|
|
5692
|
-
|
|
6260
|
+
Column14({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5693
6261
|
], FormSubmission.prototype, "createdAt", 2);
|
|
5694
6262
|
__decorateClass([
|
|
5695
|
-
|
|
6263
|
+
Column14({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5696
6264
|
], FormSubmission.prototype, "updatedAt", 2);
|
|
5697
6265
|
__decorateClass([
|
|
5698
6266
|
ManyToOne6(() => Form, (f) => f.submissions, { onDelete: "CASCADE" }),
|
|
@@ -5703,11 +6271,11 @@ __decorateClass([
|
|
|
5703
6271
|
JoinColumn6({ name: "contactId" })
|
|
5704
6272
|
], FormSubmission.prototype, "contact", 2);
|
|
5705
6273
|
FormSubmission = __decorateClass([
|
|
5706
|
-
|
|
6274
|
+
Entity14("form_submissions")
|
|
5707
6275
|
], FormSubmission);
|
|
5708
6276
|
|
|
5709
6277
|
// src/entities/address.entity.ts
|
|
5710
|
-
import { Entity as
|
|
6278
|
+
import { Entity as Entity15, PrimaryGeneratedColumn as PrimaryGeneratedColumn15, Column as Column15, ManyToOne as ManyToOne7, JoinColumn as JoinColumn7 } from "typeorm";
|
|
5711
6279
|
var Address = class {
|
|
5712
6280
|
id;
|
|
5713
6281
|
contactId;
|
|
@@ -5723,48 +6291,48 @@ var Address = class {
|
|
|
5723
6291
|
contact;
|
|
5724
6292
|
};
|
|
5725
6293
|
__decorateClass([
|
|
5726
|
-
|
|
6294
|
+
PrimaryGeneratedColumn15()
|
|
5727
6295
|
], Address.prototype, "id", 2);
|
|
5728
6296
|
__decorateClass([
|
|
5729
|
-
|
|
6297
|
+
Column15("int")
|
|
5730
6298
|
], Address.prototype, "contactId", 2);
|
|
5731
6299
|
__decorateClass([
|
|
5732
|
-
|
|
6300
|
+
Column15("varchar", { nullable: true })
|
|
5733
6301
|
], Address.prototype, "tag", 2);
|
|
5734
6302
|
__decorateClass([
|
|
5735
|
-
|
|
6303
|
+
Column15("varchar", { nullable: true })
|
|
5736
6304
|
], Address.prototype, "line1", 2);
|
|
5737
6305
|
__decorateClass([
|
|
5738
|
-
|
|
6306
|
+
Column15("varchar", { nullable: true })
|
|
5739
6307
|
], Address.prototype, "line2", 2);
|
|
5740
6308
|
__decorateClass([
|
|
5741
|
-
|
|
6309
|
+
Column15("varchar", { nullable: true })
|
|
5742
6310
|
], Address.prototype, "city", 2);
|
|
5743
6311
|
__decorateClass([
|
|
5744
|
-
|
|
6312
|
+
Column15("varchar", { nullable: true })
|
|
5745
6313
|
], Address.prototype, "state", 2);
|
|
5746
6314
|
__decorateClass([
|
|
5747
|
-
|
|
6315
|
+
Column15("varchar", { nullable: true })
|
|
5748
6316
|
], Address.prototype, "postalCode", 2);
|
|
5749
6317
|
__decorateClass([
|
|
5750
|
-
|
|
6318
|
+
Column15("varchar", { nullable: true })
|
|
5751
6319
|
], Address.prototype, "country", 2);
|
|
5752
6320
|
__decorateClass([
|
|
5753
|
-
|
|
6321
|
+
Column15({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5754
6322
|
], Address.prototype, "createdAt", 2);
|
|
5755
6323
|
__decorateClass([
|
|
5756
|
-
|
|
6324
|
+
Column15({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5757
6325
|
], Address.prototype, "updatedAt", 2);
|
|
5758
6326
|
__decorateClass([
|
|
5759
6327
|
ManyToOne7(() => Contact, (c) => c.addresses, { onDelete: "CASCADE" }),
|
|
5760
6328
|
JoinColumn7({ name: "contactId" })
|
|
5761
6329
|
], Address.prototype, "contact", 2);
|
|
5762
6330
|
Address = __decorateClass([
|
|
5763
|
-
|
|
6331
|
+
Entity15("addresses")
|
|
5764
6332
|
], Address);
|
|
5765
6333
|
|
|
5766
6334
|
// src/entities/order.entity.ts
|
|
5767
|
-
import { Entity as
|
|
6335
|
+
import { Entity as Entity16, PrimaryGeneratedColumn as PrimaryGeneratedColumn16, Column as Column16, ManyToOne as ManyToOne8, OneToMany as OneToMany6, JoinColumn as JoinColumn8 } from "typeorm";
|
|
5768
6336
|
var Order = class {
|
|
5769
6337
|
id;
|
|
5770
6338
|
orderNumber;
|
|
@@ -5796,67 +6364,67 @@ var Order = class {
|
|
|
5796
6364
|
payments;
|
|
5797
6365
|
};
|
|
5798
6366
|
__decorateClass([
|
|
5799
|
-
|
|
6367
|
+
PrimaryGeneratedColumn16()
|
|
5800
6368
|
], Order.prototype, "id", 2);
|
|
5801
6369
|
__decorateClass([
|
|
5802
|
-
|
|
6370
|
+
Column16("varchar", { unique: true })
|
|
5803
6371
|
], Order.prototype, "orderNumber", 2);
|
|
5804
6372
|
__decorateClass([
|
|
5805
|
-
|
|
6373
|
+
Column16("varchar", { default: "sale" })
|
|
5806
6374
|
], Order.prototype, "orderKind", 2);
|
|
5807
6375
|
__decorateClass([
|
|
5808
|
-
|
|
6376
|
+
Column16("int", { nullable: true })
|
|
5809
6377
|
], Order.prototype, "parentOrderId", 2);
|
|
5810
6378
|
__decorateClass([
|
|
5811
|
-
|
|
6379
|
+
Column16("int")
|
|
5812
6380
|
], Order.prototype, "contactId", 2);
|
|
5813
6381
|
__decorateClass([
|
|
5814
|
-
|
|
6382
|
+
Column16("int", { nullable: true })
|
|
5815
6383
|
], Order.prototype, "billingAddressId", 2);
|
|
5816
6384
|
__decorateClass([
|
|
5817
|
-
|
|
6385
|
+
Column16("int", { nullable: true })
|
|
5818
6386
|
], Order.prototype, "shippingAddressId", 2);
|
|
5819
6387
|
__decorateClass([
|
|
5820
|
-
|
|
6388
|
+
Column16("varchar", { default: "pending" })
|
|
5821
6389
|
], Order.prototype, "status", 2);
|
|
5822
6390
|
__decorateClass([
|
|
5823
|
-
|
|
6391
|
+
Column16("decimal", { precision: 12, scale: 2, default: 0 })
|
|
5824
6392
|
], Order.prototype, "subtotal", 2);
|
|
5825
6393
|
__decorateClass([
|
|
5826
|
-
|
|
6394
|
+
Column16("decimal", { precision: 12, scale: 2, default: 0 })
|
|
5827
6395
|
], Order.prototype, "tax", 2);
|
|
5828
6396
|
__decorateClass([
|
|
5829
|
-
|
|
6397
|
+
Column16("decimal", { precision: 12, scale: 2, default: 0 })
|
|
5830
6398
|
], Order.prototype, "discount", 2);
|
|
5831
6399
|
__decorateClass([
|
|
5832
|
-
|
|
6400
|
+
Column16("decimal", { precision: 12, scale: 2, default: 0 })
|
|
5833
6401
|
], Order.prototype, "total", 2);
|
|
5834
6402
|
__decorateClass([
|
|
5835
|
-
|
|
6403
|
+
Column16("varchar", { default: "INR" })
|
|
5836
6404
|
], Order.prototype, "currency", 2);
|
|
5837
6405
|
__decorateClass([
|
|
5838
|
-
|
|
6406
|
+
Column16("jsonb", { nullable: true })
|
|
5839
6407
|
], Order.prototype, "metadata", 2);
|
|
5840
6408
|
__decorateClass([
|
|
5841
|
-
|
|
6409
|
+
Column16({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5842
6410
|
], Order.prototype, "createdAt", 2);
|
|
5843
6411
|
__decorateClass([
|
|
5844
|
-
|
|
6412
|
+
Column16({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5845
6413
|
], Order.prototype, "updatedAt", 2);
|
|
5846
6414
|
__decorateClass([
|
|
5847
|
-
|
|
6415
|
+
Column16({ type: "timestamp", nullable: true })
|
|
5848
6416
|
], Order.prototype, "deletedAt", 2);
|
|
5849
6417
|
__decorateClass([
|
|
5850
|
-
|
|
6418
|
+
Column16("boolean", { default: false })
|
|
5851
6419
|
], Order.prototype, "deleted", 2);
|
|
5852
6420
|
__decorateClass([
|
|
5853
|
-
|
|
6421
|
+
Column16("int", { nullable: true })
|
|
5854
6422
|
], Order.prototype, "createdBy", 2);
|
|
5855
6423
|
__decorateClass([
|
|
5856
|
-
|
|
6424
|
+
Column16("int", { nullable: true })
|
|
5857
6425
|
], Order.prototype, "updatedBy", 2);
|
|
5858
6426
|
__decorateClass([
|
|
5859
|
-
|
|
6427
|
+
Column16("int", { nullable: true })
|
|
5860
6428
|
], Order.prototype, "deletedBy", 2);
|
|
5861
6429
|
__decorateClass([
|
|
5862
6430
|
ManyToOne8(() => Order, (o) => o.children, { nullable: true, onDelete: "SET NULL" }),
|
|
@@ -5884,11 +6452,11 @@ __decorateClass([
|
|
|
5884
6452
|
OneToMany6("Payment", "order")
|
|
5885
6453
|
], Order.prototype, "payments", 2);
|
|
5886
6454
|
Order = __decorateClass([
|
|
5887
|
-
|
|
6455
|
+
Entity16("orders")
|
|
5888
6456
|
], Order);
|
|
5889
6457
|
|
|
5890
6458
|
// src/entities/payment.entity.ts
|
|
5891
|
-
import { Entity as
|
|
6459
|
+
import { Entity as Entity17, PrimaryGeneratedColumn as PrimaryGeneratedColumn17, Column as Column17, ManyToOne as ManyToOne9, JoinColumn as JoinColumn9 } from "typeorm";
|
|
5892
6460
|
var Payment = class {
|
|
5893
6461
|
id;
|
|
5894
6462
|
orderId;
|
|
@@ -5911,55 +6479,55 @@ var Payment = class {
|
|
|
5911
6479
|
contact;
|
|
5912
6480
|
};
|
|
5913
6481
|
__decorateClass([
|
|
5914
|
-
|
|
6482
|
+
PrimaryGeneratedColumn17()
|
|
5915
6483
|
], Payment.prototype, "id", 2);
|
|
5916
6484
|
__decorateClass([
|
|
5917
|
-
|
|
6485
|
+
Column17("int")
|
|
5918
6486
|
], Payment.prototype, "orderId", 2);
|
|
5919
6487
|
__decorateClass([
|
|
5920
|
-
|
|
6488
|
+
Column17("int", { nullable: true })
|
|
5921
6489
|
], Payment.prototype, "contactId", 2);
|
|
5922
6490
|
__decorateClass([
|
|
5923
|
-
|
|
6491
|
+
Column17("decimal", { precision: 12, scale: 2 })
|
|
5924
6492
|
], Payment.prototype, "amount", 2);
|
|
5925
6493
|
__decorateClass([
|
|
5926
|
-
|
|
6494
|
+
Column17("varchar", { default: "INR" })
|
|
5927
6495
|
], Payment.prototype, "currency", 2);
|
|
5928
6496
|
__decorateClass([
|
|
5929
|
-
|
|
6497
|
+
Column17("varchar", { default: "pending" })
|
|
5930
6498
|
], Payment.prototype, "status", 2);
|
|
5931
6499
|
__decorateClass([
|
|
5932
|
-
|
|
6500
|
+
Column17("varchar", { nullable: true })
|
|
5933
6501
|
], Payment.prototype, "method", 2);
|
|
5934
6502
|
__decorateClass([
|
|
5935
|
-
|
|
6503
|
+
Column17("varchar", { nullable: true })
|
|
5936
6504
|
], Payment.prototype, "externalReference", 2);
|
|
5937
6505
|
__decorateClass([
|
|
5938
|
-
|
|
6506
|
+
Column17("jsonb", { nullable: true })
|
|
5939
6507
|
], Payment.prototype, "metadata", 2);
|
|
5940
6508
|
__decorateClass([
|
|
5941
|
-
|
|
6509
|
+
Column17({ type: "timestamp", nullable: true })
|
|
5942
6510
|
], Payment.prototype, "paidAt", 2);
|
|
5943
6511
|
__decorateClass([
|
|
5944
|
-
|
|
6512
|
+
Column17({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5945
6513
|
], Payment.prototype, "createdAt", 2);
|
|
5946
6514
|
__decorateClass([
|
|
5947
|
-
|
|
6515
|
+
Column17({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5948
6516
|
], Payment.prototype, "updatedAt", 2);
|
|
5949
6517
|
__decorateClass([
|
|
5950
|
-
|
|
6518
|
+
Column17({ type: "timestamp", nullable: true })
|
|
5951
6519
|
], Payment.prototype, "deletedAt", 2);
|
|
5952
6520
|
__decorateClass([
|
|
5953
|
-
|
|
6521
|
+
Column17("boolean", { default: false })
|
|
5954
6522
|
], Payment.prototype, "deleted", 2);
|
|
5955
6523
|
__decorateClass([
|
|
5956
|
-
|
|
6524
|
+
Column17("int", { nullable: true })
|
|
5957
6525
|
], Payment.prototype, "createdBy", 2);
|
|
5958
6526
|
__decorateClass([
|
|
5959
|
-
|
|
6527
|
+
Column17("int", { nullable: true })
|
|
5960
6528
|
], Payment.prototype, "updatedBy", 2);
|
|
5961
6529
|
__decorateClass([
|
|
5962
|
-
|
|
6530
|
+
Column17("int", { nullable: true })
|
|
5963
6531
|
], Payment.prototype, "deletedBy", 2);
|
|
5964
6532
|
__decorateClass([
|
|
5965
6533
|
ManyToOne9(() => Order, (o) => o.payments, { onDelete: "CASCADE" }),
|
|
@@ -5970,14 +6538,14 @@ __decorateClass([
|
|
|
5970
6538
|
JoinColumn9({ name: "contactId" })
|
|
5971
6539
|
], Payment.prototype, "contact", 2);
|
|
5972
6540
|
Payment = __decorateClass([
|
|
5973
|
-
|
|
6541
|
+
Entity17("payments")
|
|
5974
6542
|
], Payment);
|
|
5975
6543
|
|
|
5976
6544
|
// src/entities/chat-conversation.entity.ts
|
|
5977
|
-
import { Entity as
|
|
6545
|
+
import { Entity as Entity19, PrimaryGeneratedColumn as PrimaryGeneratedColumn19, Column as Column19, ManyToOne as ManyToOne11, OneToMany as OneToMany7, JoinColumn as JoinColumn11 } from "typeorm";
|
|
5978
6546
|
|
|
5979
6547
|
// src/entities/chat-message.entity.ts
|
|
5980
|
-
import { Entity as
|
|
6548
|
+
import { Entity as Entity18, PrimaryGeneratedColumn as PrimaryGeneratedColumn18, Column as Column18, ManyToOne as ManyToOne10, JoinColumn as JoinColumn10 } from "typeorm";
|
|
5981
6549
|
var ChatMessage = class {
|
|
5982
6550
|
id;
|
|
5983
6551
|
conversationId;
|
|
@@ -5987,26 +6555,26 @@ var ChatMessage = class {
|
|
|
5987
6555
|
conversation;
|
|
5988
6556
|
};
|
|
5989
6557
|
__decorateClass([
|
|
5990
|
-
|
|
6558
|
+
PrimaryGeneratedColumn18()
|
|
5991
6559
|
], ChatMessage.prototype, "id", 2);
|
|
5992
6560
|
__decorateClass([
|
|
5993
|
-
|
|
6561
|
+
Column18("int")
|
|
5994
6562
|
], ChatMessage.prototype, "conversationId", 2);
|
|
5995
6563
|
__decorateClass([
|
|
5996
|
-
|
|
6564
|
+
Column18("varchar")
|
|
5997
6565
|
], ChatMessage.prototype, "role", 2);
|
|
5998
6566
|
__decorateClass([
|
|
5999
|
-
|
|
6567
|
+
Column18("text")
|
|
6000
6568
|
], ChatMessage.prototype, "content", 2);
|
|
6001
6569
|
__decorateClass([
|
|
6002
|
-
|
|
6570
|
+
Column18({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6003
6571
|
], ChatMessage.prototype, "createdAt", 2);
|
|
6004
6572
|
__decorateClass([
|
|
6005
6573
|
ManyToOne10(() => ChatConversation, (c) => c.messages, { onDelete: "CASCADE" }),
|
|
6006
6574
|
JoinColumn10({ name: "conversationId" })
|
|
6007
6575
|
], ChatMessage.prototype, "conversation", 2);
|
|
6008
6576
|
ChatMessage = __decorateClass([
|
|
6009
|
-
|
|
6577
|
+
Entity18("chat_messages")
|
|
6010
6578
|
], ChatMessage);
|
|
6011
6579
|
|
|
6012
6580
|
// src/entities/chat-conversation.entity.ts
|
|
@@ -6019,16 +6587,16 @@ var ChatConversation = class {
|
|
|
6019
6587
|
messages;
|
|
6020
6588
|
};
|
|
6021
6589
|
__decorateClass([
|
|
6022
|
-
|
|
6590
|
+
PrimaryGeneratedColumn19()
|
|
6023
6591
|
], ChatConversation.prototype, "id", 2);
|
|
6024
6592
|
__decorateClass([
|
|
6025
|
-
|
|
6593
|
+
Column19("int")
|
|
6026
6594
|
], ChatConversation.prototype, "contactId", 2);
|
|
6027
6595
|
__decorateClass([
|
|
6028
|
-
|
|
6596
|
+
Column19({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6029
6597
|
], ChatConversation.prototype, "createdAt", 2);
|
|
6030
6598
|
__decorateClass([
|
|
6031
|
-
|
|
6599
|
+
Column19({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6032
6600
|
], ChatConversation.prototype, "updatedAt", 2);
|
|
6033
6601
|
__decorateClass([
|
|
6034
6602
|
ManyToOne11(() => Contact, (c) => c.chatConversations, { onDelete: "CASCADE" }),
|
|
@@ -6038,7 +6606,7 @@ __decorateClass([
|
|
|
6038
6606
|
OneToMany7(() => ChatMessage, (m) => m.conversation)
|
|
6039
6607
|
], ChatConversation.prototype, "messages", 2);
|
|
6040
6608
|
ChatConversation = __decorateClass([
|
|
6041
|
-
|
|
6609
|
+
Entity19("chat_conversations")
|
|
6042
6610
|
], ChatConversation);
|
|
6043
6611
|
|
|
6044
6612
|
// src/entities/contact.entity.ts
|
|
@@ -6067,52 +6635,52 @@ var Contact = class {
|
|
|
6067
6635
|
chatConversations;
|
|
6068
6636
|
};
|
|
6069
6637
|
__decorateClass([
|
|
6070
|
-
|
|
6638
|
+
PrimaryGeneratedColumn20()
|
|
6071
6639
|
], Contact.prototype, "id", 2);
|
|
6072
6640
|
__decorateClass([
|
|
6073
|
-
|
|
6641
|
+
Column20("varchar")
|
|
6074
6642
|
], Contact.prototype, "name", 2);
|
|
6075
6643
|
__decorateClass([
|
|
6076
|
-
|
|
6644
|
+
Column20("varchar", { unique: true })
|
|
6077
6645
|
], Contact.prototype, "email", 2);
|
|
6078
6646
|
__decorateClass([
|
|
6079
|
-
|
|
6647
|
+
Column20("varchar", { nullable: true })
|
|
6080
6648
|
], Contact.prototype, "phone", 2);
|
|
6081
6649
|
__decorateClass([
|
|
6082
|
-
|
|
6650
|
+
Column20("varchar", { nullable: true })
|
|
6083
6651
|
], Contact.prototype, "type", 2);
|
|
6084
6652
|
__decorateClass([
|
|
6085
|
-
|
|
6653
|
+
Column20("varchar", { nullable: true })
|
|
6086
6654
|
], Contact.prototype, "company", 2);
|
|
6087
6655
|
__decorateClass([
|
|
6088
|
-
|
|
6656
|
+
Column20("varchar", { nullable: true })
|
|
6089
6657
|
], Contact.prototype, "taxId", 2);
|
|
6090
6658
|
__decorateClass([
|
|
6091
|
-
|
|
6659
|
+
Column20("text", { nullable: true })
|
|
6092
6660
|
], Contact.prototype, "notes", 2);
|
|
6093
6661
|
__decorateClass([
|
|
6094
|
-
|
|
6662
|
+
Column20({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6095
6663
|
], Contact.prototype, "createdAt", 2);
|
|
6096
6664
|
__decorateClass([
|
|
6097
|
-
|
|
6665
|
+
Column20({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6098
6666
|
], Contact.prototype, "updatedAt", 2);
|
|
6099
6667
|
__decorateClass([
|
|
6100
|
-
|
|
6668
|
+
Column20({ type: "timestamp", nullable: true })
|
|
6101
6669
|
], Contact.prototype, "deletedAt", 2);
|
|
6102
6670
|
__decorateClass([
|
|
6103
|
-
|
|
6671
|
+
Column20("boolean", { default: false })
|
|
6104
6672
|
], Contact.prototype, "deleted", 2);
|
|
6105
6673
|
__decorateClass([
|
|
6106
|
-
|
|
6674
|
+
Column20("int", { nullable: true })
|
|
6107
6675
|
], Contact.prototype, "createdBy", 2);
|
|
6108
6676
|
__decorateClass([
|
|
6109
|
-
|
|
6677
|
+
Column20("int", { nullable: true })
|
|
6110
6678
|
], Contact.prototype, "updatedBy", 2);
|
|
6111
6679
|
__decorateClass([
|
|
6112
|
-
|
|
6680
|
+
Column20("int", { nullable: true })
|
|
6113
6681
|
], Contact.prototype, "deletedBy", 2);
|
|
6114
6682
|
__decorateClass([
|
|
6115
|
-
|
|
6683
|
+
Column20("int", { nullable: true })
|
|
6116
6684
|
], Contact.prototype, "userId", 2);
|
|
6117
6685
|
__decorateClass([
|
|
6118
6686
|
ManyToOne12(() => User, { onDelete: "SET NULL" }),
|
|
@@ -6134,11 +6702,11 @@ __decorateClass([
|
|
|
6134
6702
|
OneToMany8(() => ChatConversation, (c) => c.contact)
|
|
6135
6703
|
], Contact.prototype, "chatConversations", 2);
|
|
6136
6704
|
Contact = __decorateClass([
|
|
6137
|
-
|
|
6705
|
+
Entity20("contacts")
|
|
6138
6706
|
], Contact);
|
|
6139
6707
|
|
|
6140
6708
|
// src/entities/config.entity.ts
|
|
6141
|
-
import { Entity as
|
|
6709
|
+
import { Entity as Entity21, PrimaryGeneratedColumn as PrimaryGeneratedColumn21, Column as Column21, Unique } from "typeorm";
|
|
6142
6710
|
var Config = class {
|
|
6143
6711
|
id;
|
|
6144
6712
|
settings;
|
|
@@ -6155,51 +6723,51 @@ var Config = class {
|
|
|
6155
6723
|
deletedBy;
|
|
6156
6724
|
};
|
|
6157
6725
|
__decorateClass([
|
|
6158
|
-
|
|
6726
|
+
PrimaryGeneratedColumn21()
|
|
6159
6727
|
], Config.prototype, "id", 2);
|
|
6160
6728
|
__decorateClass([
|
|
6161
|
-
|
|
6729
|
+
Column21("varchar")
|
|
6162
6730
|
], Config.prototype, "settings", 2);
|
|
6163
6731
|
__decorateClass([
|
|
6164
|
-
|
|
6732
|
+
Column21("varchar")
|
|
6165
6733
|
], Config.prototype, "key", 2);
|
|
6166
6734
|
__decorateClass([
|
|
6167
|
-
|
|
6735
|
+
Column21("varchar")
|
|
6168
6736
|
], Config.prototype, "value", 2);
|
|
6169
6737
|
__decorateClass([
|
|
6170
|
-
|
|
6738
|
+
Column21("varchar", { default: "private" })
|
|
6171
6739
|
], Config.prototype, "type", 2);
|
|
6172
6740
|
__decorateClass([
|
|
6173
|
-
|
|
6741
|
+
Column21("boolean", { default: false })
|
|
6174
6742
|
], Config.prototype, "encrypted", 2);
|
|
6175
6743
|
__decorateClass([
|
|
6176
|
-
|
|
6744
|
+
Column21({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6177
6745
|
], Config.prototype, "createdAt", 2);
|
|
6178
6746
|
__decorateClass([
|
|
6179
|
-
|
|
6747
|
+
Column21({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6180
6748
|
], Config.prototype, "updatedAt", 2);
|
|
6181
6749
|
__decorateClass([
|
|
6182
|
-
|
|
6750
|
+
Column21({ type: "timestamp", nullable: true })
|
|
6183
6751
|
], Config.prototype, "deletedAt", 2);
|
|
6184
6752
|
__decorateClass([
|
|
6185
|
-
|
|
6753
|
+
Column21("boolean", { default: false })
|
|
6186
6754
|
], Config.prototype, "deleted", 2);
|
|
6187
6755
|
__decorateClass([
|
|
6188
|
-
|
|
6756
|
+
Column21("int", { nullable: true })
|
|
6189
6757
|
], Config.prototype, "createdBy", 2);
|
|
6190
6758
|
__decorateClass([
|
|
6191
|
-
|
|
6759
|
+
Column21("int", { nullable: true })
|
|
6192
6760
|
], Config.prototype, "updatedBy", 2);
|
|
6193
6761
|
__decorateClass([
|
|
6194
|
-
|
|
6762
|
+
Column21("int", { nullable: true })
|
|
6195
6763
|
], Config.prototype, "deletedBy", 2);
|
|
6196
6764
|
Config = __decorateClass([
|
|
6197
|
-
|
|
6765
|
+
Entity21("configs"),
|
|
6198
6766
|
Unique(["settings", "key"])
|
|
6199
6767
|
], Config);
|
|
6200
6768
|
|
|
6201
6769
|
// src/entities/message-template.entity.ts
|
|
6202
|
-
import { Entity as
|
|
6770
|
+
import { Entity as Entity22, PrimaryGeneratedColumn as PrimaryGeneratedColumn22, Column as Column22 } from "typeorm";
|
|
6203
6771
|
var MessageTemplate = class {
|
|
6204
6772
|
id;
|
|
6205
6773
|
channel;
|
|
@@ -6219,59 +6787,59 @@ var MessageTemplate = class {
|
|
|
6219
6787
|
deletedBy;
|
|
6220
6788
|
};
|
|
6221
6789
|
__decorateClass([
|
|
6222
|
-
|
|
6790
|
+
PrimaryGeneratedColumn22()
|
|
6223
6791
|
], MessageTemplate.prototype, "id", 2);
|
|
6224
6792
|
__decorateClass([
|
|
6225
|
-
|
|
6793
|
+
Column22("varchar")
|
|
6226
6794
|
], MessageTemplate.prototype, "channel", 2);
|
|
6227
6795
|
__decorateClass([
|
|
6228
|
-
|
|
6796
|
+
Column22("varchar", { name: "template_key" })
|
|
6229
6797
|
], MessageTemplate.prototype, "templateKey", 2);
|
|
6230
6798
|
__decorateClass([
|
|
6231
|
-
|
|
6799
|
+
Column22("varchar", { nullable: true })
|
|
6232
6800
|
], MessageTemplate.prototype, "name", 2);
|
|
6233
6801
|
__decorateClass([
|
|
6234
|
-
|
|
6802
|
+
Column22("varchar", { nullable: true })
|
|
6235
6803
|
], MessageTemplate.prototype, "subject", 2);
|
|
6236
6804
|
__decorateClass([
|
|
6237
|
-
|
|
6805
|
+
Column22("text", { default: "" })
|
|
6238
6806
|
], MessageTemplate.prototype, "body", 2);
|
|
6239
6807
|
__decorateClass([
|
|
6240
|
-
|
|
6808
|
+
Column22("varchar", { name: "external_template_ref", nullable: true })
|
|
6241
6809
|
], MessageTemplate.prototype, "externalTemplateRef", 2);
|
|
6242
6810
|
__decorateClass([
|
|
6243
|
-
|
|
6811
|
+
Column22({ type: "jsonb", nullable: true })
|
|
6244
6812
|
], MessageTemplate.prototype, "providerMeta", 2);
|
|
6245
6813
|
__decorateClass([
|
|
6246
|
-
|
|
6814
|
+
Column22("boolean", { default: true })
|
|
6247
6815
|
], MessageTemplate.prototype, "enabled", 2);
|
|
6248
6816
|
__decorateClass([
|
|
6249
|
-
|
|
6817
|
+
Column22({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6250
6818
|
], MessageTemplate.prototype, "createdAt", 2);
|
|
6251
6819
|
__decorateClass([
|
|
6252
|
-
|
|
6820
|
+
Column22({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6253
6821
|
], MessageTemplate.prototype, "updatedAt", 2);
|
|
6254
6822
|
__decorateClass([
|
|
6255
|
-
|
|
6823
|
+
Column22({ type: "timestamp", nullable: true })
|
|
6256
6824
|
], MessageTemplate.prototype, "deletedAt", 2);
|
|
6257
6825
|
__decorateClass([
|
|
6258
|
-
|
|
6826
|
+
Column22("boolean", { default: false })
|
|
6259
6827
|
], MessageTemplate.prototype, "deleted", 2);
|
|
6260
6828
|
__decorateClass([
|
|
6261
|
-
|
|
6829
|
+
Column22("int", { nullable: true })
|
|
6262
6830
|
], MessageTemplate.prototype, "createdBy", 2);
|
|
6263
6831
|
__decorateClass([
|
|
6264
|
-
|
|
6832
|
+
Column22("int", { nullable: true })
|
|
6265
6833
|
], MessageTemplate.prototype, "updatedBy", 2);
|
|
6266
6834
|
__decorateClass([
|
|
6267
|
-
|
|
6835
|
+
Column22("int", { nullable: true })
|
|
6268
6836
|
], MessageTemplate.prototype, "deletedBy", 2);
|
|
6269
6837
|
MessageTemplate = __decorateClass([
|
|
6270
|
-
|
|
6838
|
+
Entity22("message_templates")
|
|
6271
6839
|
], MessageTemplate);
|
|
6272
6840
|
|
|
6273
6841
|
// src/entities/media.entity.ts
|
|
6274
|
-
import { Entity as
|
|
6842
|
+
import { Entity as Entity23, PrimaryGeneratedColumn as PrimaryGeneratedColumn23, Column as Column23, ManyToOne as ManyToOne13, OneToMany as OneToMany9, JoinColumn as JoinColumn13 } from "typeorm";
|
|
6275
6843
|
var Media = class {
|
|
6276
6844
|
id;
|
|
6277
6845
|
kind;
|
|
@@ -6290,13 +6858,13 @@ var Media = class {
|
|
|
6290
6858
|
deleted;
|
|
6291
6859
|
};
|
|
6292
6860
|
__decorateClass([
|
|
6293
|
-
|
|
6861
|
+
PrimaryGeneratedColumn23()
|
|
6294
6862
|
], Media.prototype, "id", 2);
|
|
6295
6863
|
__decorateClass([
|
|
6296
|
-
|
|
6864
|
+
Column23({ type: "varchar", length: 16, default: "file" })
|
|
6297
6865
|
], Media.prototype, "kind", 2);
|
|
6298
6866
|
__decorateClass([
|
|
6299
|
-
|
|
6867
|
+
Column23({ type: "int", nullable: true })
|
|
6300
6868
|
], Media.prototype, "parentId", 2);
|
|
6301
6869
|
__decorateClass([
|
|
6302
6870
|
ManyToOne13(() => Media, (m) => m.children, { onDelete: "CASCADE" }),
|
|
@@ -6306,41 +6874,41 @@ __decorateClass([
|
|
|
6306
6874
|
OneToMany9(() => Media, (m) => m.parent)
|
|
6307
6875
|
], Media.prototype, "children", 2);
|
|
6308
6876
|
__decorateClass([
|
|
6309
|
-
|
|
6877
|
+
Column23("varchar")
|
|
6310
6878
|
], Media.prototype, "filename", 2);
|
|
6311
6879
|
__decorateClass([
|
|
6312
|
-
|
|
6880
|
+
Column23("varchar", { nullable: true })
|
|
6313
6881
|
], Media.prototype, "url", 2);
|
|
6314
6882
|
__decorateClass([
|
|
6315
|
-
|
|
6883
|
+
Column23("varchar", { nullable: true })
|
|
6316
6884
|
], Media.prototype, "mimeType", 2);
|
|
6317
6885
|
__decorateClass([
|
|
6318
|
-
|
|
6886
|
+
Column23("int", { default: 0 })
|
|
6319
6887
|
], Media.prototype, "size", 2);
|
|
6320
6888
|
__decorateClass([
|
|
6321
|
-
|
|
6889
|
+
Column23("varchar", { nullable: true })
|
|
6322
6890
|
], Media.prototype, "alt", 2);
|
|
6323
6891
|
__decorateClass([
|
|
6324
|
-
|
|
6892
|
+
Column23("boolean", { default: false })
|
|
6325
6893
|
], Media.prototype, "isPublic", 2);
|
|
6326
6894
|
__decorateClass([
|
|
6327
|
-
|
|
6895
|
+
Column23({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6328
6896
|
], Media.prototype, "createdAt", 2);
|
|
6329
6897
|
__decorateClass([
|
|
6330
|
-
|
|
6898
|
+
Column23({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6331
6899
|
], Media.prototype, "updatedAt", 2);
|
|
6332
6900
|
__decorateClass([
|
|
6333
|
-
|
|
6901
|
+
Column23({ type: "timestamp", nullable: true })
|
|
6334
6902
|
], Media.prototype, "deletedAt", 2);
|
|
6335
6903
|
__decorateClass([
|
|
6336
|
-
|
|
6904
|
+
Column23("boolean", { default: false })
|
|
6337
6905
|
], Media.prototype, "deleted", 2);
|
|
6338
6906
|
Media = __decorateClass([
|
|
6339
|
-
|
|
6907
|
+
Entity23("media")
|
|
6340
6908
|
], Media);
|
|
6341
6909
|
|
|
6342
6910
|
// src/entities/page.entity.ts
|
|
6343
|
-
import { Entity as
|
|
6911
|
+
import { Entity as Entity24, PrimaryGeneratedColumn as PrimaryGeneratedColumn24, Column as Column24, ManyToOne as ManyToOne14, JoinColumn as JoinColumn14 } from "typeorm";
|
|
6344
6912
|
var Page = class {
|
|
6345
6913
|
id;
|
|
6346
6914
|
title;
|
|
@@ -6361,64 +6929,64 @@ var Page = class {
|
|
|
6361
6929
|
deletedBy;
|
|
6362
6930
|
};
|
|
6363
6931
|
__decorateClass([
|
|
6364
|
-
|
|
6932
|
+
PrimaryGeneratedColumn24()
|
|
6365
6933
|
], Page.prototype, "id", 2);
|
|
6366
6934
|
__decorateClass([
|
|
6367
|
-
|
|
6935
|
+
Column24("varchar")
|
|
6368
6936
|
], Page.prototype, "title", 2);
|
|
6369
6937
|
__decorateClass([
|
|
6370
|
-
|
|
6938
|
+
Column24("varchar", { unique: true })
|
|
6371
6939
|
], Page.prototype, "slug", 2);
|
|
6372
6940
|
__decorateClass([
|
|
6373
|
-
|
|
6941
|
+
Column24({ type: "jsonb", default: {} })
|
|
6374
6942
|
], Page.prototype, "content", 2);
|
|
6375
6943
|
__decorateClass([
|
|
6376
|
-
|
|
6944
|
+
Column24("boolean", { default: false })
|
|
6377
6945
|
], Page.prototype, "published", 2);
|
|
6378
6946
|
__decorateClass([
|
|
6379
|
-
|
|
6947
|
+
Column24("varchar", { default: "default" })
|
|
6380
6948
|
], Page.prototype, "theme", 2);
|
|
6381
6949
|
__decorateClass([
|
|
6382
|
-
|
|
6950
|
+
Column24("int", { nullable: true })
|
|
6383
6951
|
], Page.prototype, "parentId", 2);
|
|
6384
6952
|
__decorateClass([
|
|
6385
6953
|
ManyToOne14(() => Page, { onDelete: "SET NULL" }),
|
|
6386
6954
|
JoinColumn14({ name: "parentId" })
|
|
6387
6955
|
], Page.prototype, "parent", 2);
|
|
6388
6956
|
__decorateClass([
|
|
6389
|
-
|
|
6957
|
+
Column24("int", { nullable: true })
|
|
6390
6958
|
], Page.prototype, "seoId", 2);
|
|
6391
6959
|
__decorateClass([
|
|
6392
6960
|
ManyToOne14(() => Seo, { onDelete: "SET NULL" }),
|
|
6393
6961
|
JoinColumn14({ name: "seoId" })
|
|
6394
6962
|
], Page.prototype, "seo", 2);
|
|
6395
6963
|
__decorateClass([
|
|
6396
|
-
|
|
6964
|
+
Column24({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6397
6965
|
], Page.prototype, "createdAt", 2);
|
|
6398
6966
|
__decorateClass([
|
|
6399
|
-
|
|
6967
|
+
Column24({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6400
6968
|
], Page.prototype, "updatedAt", 2);
|
|
6401
6969
|
__decorateClass([
|
|
6402
|
-
|
|
6970
|
+
Column24({ type: "timestamp", nullable: true })
|
|
6403
6971
|
], Page.prototype, "deletedAt", 2);
|
|
6404
6972
|
__decorateClass([
|
|
6405
|
-
|
|
6973
|
+
Column24("boolean", { default: false })
|
|
6406
6974
|
], Page.prototype, "deleted", 2);
|
|
6407
6975
|
__decorateClass([
|
|
6408
|
-
|
|
6976
|
+
Column24("int", { nullable: true })
|
|
6409
6977
|
], Page.prototype, "createdBy", 2);
|
|
6410
6978
|
__decorateClass([
|
|
6411
|
-
|
|
6979
|
+
Column24("int", { nullable: true })
|
|
6412
6980
|
], Page.prototype, "updatedBy", 2);
|
|
6413
6981
|
__decorateClass([
|
|
6414
|
-
|
|
6982
|
+
Column24("int", { nullable: true })
|
|
6415
6983
|
], Page.prototype, "deletedBy", 2);
|
|
6416
6984
|
Page = __decorateClass([
|
|
6417
|
-
|
|
6985
|
+
Entity24("pages")
|
|
6418
6986
|
], Page);
|
|
6419
6987
|
|
|
6420
6988
|
// src/entities/product-category.entity.ts
|
|
6421
|
-
import { Entity as
|
|
6989
|
+
import { Entity as Entity25, PrimaryGeneratedColumn as PrimaryGeneratedColumn25, Column as Column25, ManyToOne as ManyToOne15, OneToMany as OneToMany10, JoinColumn as JoinColumn15 } from "typeorm";
|
|
6422
6990
|
var ProductCategory = class {
|
|
6423
6991
|
id;
|
|
6424
6992
|
name;
|
|
@@ -6442,52 +7010,52 @@ var ProductCategory = class {
|
|
|
6442
7010
|
collections;
|
|
6443
7011
|
};
|
|
6444
7012
|
__decorateClass([
|
|
6445
|
-
|
|
7013
|
+
PrimaryGeneratedColumn25()
|
|
6446
7014
|
], ProductCategory.prototype, "id", 2);
|
|
6447
7015
|
__decorateClass([
|
|
6448
|
-
|
|
7016
|
+
Column25("varchar")
|
|
6449
7017
|
], ProductCategory.prototype, "name", 2);
|
|
6450
7018
|
__decorateClass([
|
|
6451
|
-
|
|
7019
|
+
Column25("varchar", { unique: true })
|
|
6452
7020
|
], ProductCategory.prototype, "slug", 2);
|
|
6453
7021
|
__decorateClass([
|
|
6454
|
-
|
|
7022
|
+
Column25("int", { nullable: true })
|
|
6455
7023
|
], ProductCategory.prototype, "parentId", 2);
|
|
6456
7024
|
__decorateClass([
|
|
6457
|
-
|
|
7025
|
+
Column25("varchar", { nullable: true })
|
|
6458
7026
|
], ProductCategory.prototype, "image", 2);
|
|
6459
7027
|
__decorateClass([
|
|
6460
|
-
|
|
7028
|
+
Column25("text", { nullable: true })
|
|
6461
7029
|
], ProductCategory.prototype, "description", 2);
|
|
6462
7030
|
__decorateClass([
|
|
6463
|
-
|
|
7031
|
+
Column25("jsonb", { nullable: true })
|
|
6464
7032
|
], ProductCategory.prototype, "metadata", 2);
|
|
6465
7033
|
__decorateClass([
|
|
6466
|
-
|
|
7034
|
+
Column25("boolean", { default: true })
|
|
6467
7035
|
], ProductCategory.prototype, "active", 2);
|
|
6468
7036
|
__decorateClass([
|
|
6469
|
-
|
|
7037
|
+
Column25("int", { default: 0 })
|
|
6470
7038
|
], ProductCategory.prototype, "sortOrder", 2);
|
|
6471
7039
|
__decorateClass([
|
|
6472
|
-
|
|
7040
|
+
Column25({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6473
7041
|
], ProductCategory.prototype, "createdAt", 2);
|
|
6474
7042
|
__decorateClass([
|
|
6475
|
-
|
|
7043
|
+
Column25({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6476
7044
|
], ProductCategory.prototype, "updatedAt", 2);
|
|
6477
7045
|
__decorateClass([
|
|
6478
|
-
|
|
7046
|
+
Column25({ type: "timestamp", nullable: true })
|
|
6479
7047
|
], ProductCategory.prototype, "deletedAt", 2);
|
|
6480
7048
|
__decorateClass([
|
|
6481
|
-
|
|
7049
|
+
Column25("boolean", { default: false })
|
|
6482
7050
|
], ProductCategory.prototype, "deleted", 2);
|
|
6483
7051
|
__decorateClass([
|
|
6484
|
-
|
|
7052
|
+
Column25("int", { nullable: true })
|
|
6485
7053
|
], ProductCategory.prototype, "createdBy", 2);
|
|
6486
7054
|
__decorateClass([
|
|
6487
|
-
|
|
7055
|
+
Column25("int", { nullable: true })
|
|
6488
7056
|
], ProductCategory.prototype, "updatedBy", 2);
|
|
6489
7057
|
__decorateClass([
|
|
6490
|
-
|
|
7058
|
+
Column25("int", { nullable: true })
|
|
6491
7059
|
], ProductCategory.prototype, "deletedBy", 2);
|
|
6492
7060
|
__decorateClass([
|
|
6493
7061
|
ManyToOne15(() => ProductCategory, (c) => c.children, { onDelete: "SET NULL" }),
|
|
@@ -6503,14 +7071,14 @@ __decorateClass([
|
|
|
6503
7071
|
OneToMany10("Collection", "category")
|
|
6504
7072
|
], ProductCategory.prototype, "collections", 2);
|
|
6505
7073
|
ProductCategory = __decorateClass([
|
|
6506
|
-
|
|
7074
|
+
Entity25("product_categories")
|
|
6507
7075
|
], ProductCategory);
|
|
6508
7076
|
|
|
6509
7077
|
// src/entities/collection.entity.ts
|
|
6510
|
-
import { Entity as
|
|
7078
|
+
import { Entity as Entity27, PrimaryGeneratedColumn as PrimaryGeneratedColumn27, Column as Column27, ManyToOne as ManyToOne17, OneToMany as OneToMany12, JoinColumn as JoinColumn17 } from "typeorm";
|
|
6511
7079
|
|
|
6512
7080
|
// src/entities/brand.entity.ts
|
|
6513
|
-
import { Entity as
|
|
7081
|
+
import { Entity as Entity26, PrimaryGeneratedColumn as PrimaryGeneratedColumn26, Column as Column26, OneToMany as OneToMany11, ManyToOne as ManyToOne16, JoinColumn as JoinColumn16 } from "typeorm";
|
|
6514
7082
|
var Brand = class {
|
|
6515
7083
|
id;
|
|
6516
7084
|
name;
|
|
@@ -6533,52 +7101,52 @@ var Brand = class {
|
|
|
6533
7101
|
collections;
|
|
6534
7102
|
};
|
|
6535
7103
|
__decorateClass([
|
|
6536
|
-
|
|
7104
|
+
PrimaryGeneratedColumn26()
|
|
6537
7105
|
], Brand.prototype, "id", 2);
|
|
6538
7106
|
__decorateClass([
|
|
6539
|
-
|
|
7107
|
+
Column26("varchar")
|
|
6540
7108
|
], Brand.prototype, "name", 2);
|
|
6541
7109
|
__decorateClass([
|
|
6542
|
-
|
|
7110
|
+
Column26("varchar", { unique: true })
|
|
6543
7111
|
], Brand.prototype, "slug", 2);
|
|
6544
7112
|
__decorateClass([
|
|
6545
|
-
|
|
7113
|
+
Column26("varchar", { nullable: true })
|
|
6546
7114
|
], Brand.prototype, "logo", 2);
|
|
6547
7115
|
__decorateClass([
|
|
6548
|
-
|
|
7116
|
+
Column26("jsonb", { nullable: true })
|
|
6549
7117
|
], Brand.prototype, "metadata", 2);
|
|
6550
7118
|
__decorateClass([
|
|
6551
|
-
|
|
7119
|
+
Column26("text", { nullable: true })
|
|
6552
7120
|
], Brand.prototype, "description", 2);
|
|
6553
7121
|
__decorateClass([
|
|
6554
|
-
|
|
7122
|
+
Column26("boolean", { default: true })
|
|
6555
7123
|
], Brand.prototype, "active", 2);
|
|
6556
7124
|
__decorateClass([
|
|
6557
|
-
|
|
7125
|
+
Column26("int", { default: 0 })
|
|
6558
7126
|
], Brand.prototype, "sortOrder", 2);
|
|
6559
7127
|
__decorateClass([
|
|
6560
|
-
|
|
7128
|
+
Column26({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6561
7129
|
], Brand.prototype, "createdAt", 2);
|
|
6562
7130
|
__decorateClass([
|
|
6563
|
-
|
|
7131
|
+
Column26({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6564
7132
|
], Brand.prototype, "updatedAt", 2);
|
|
6565
7133
|
__decorateClass([
|
|
6566
|
-
|
|
7134
|
+
Column26({ type: "timestamp", nullable: true })
|
|
6567
7135
|
], Brand.prototype, "deletedAt", 2);
|
|
6568
7136
|
__decorateClass([
|
|
6569
|
-
|
|
7137
|
+
Column26("boolean", { default: false })
|
|
6570
7138
|
], Brand.prototype, "deleted", 2);
|
|
6571
7139
|
__decorateClass([
|
|
6572
|
-
|
|
7140
|
+
Column26("int", { nullable: true })
|
|
6573
7141
|
], Brand.prototype, "createdBy", 2);
|
|
6574
7142
|
__decorateClass([
|
|
6575
|
-
|
|
7143
|
+
Column26("int", { nullable: true })
|
|
6576
7144
|
], Brand.prototype, "updatedBy", 2);
|
|
6577
7145
|
__decorateClass([
|
|
6578
|
-
|
|
7146
|
+
Column26("int", { nullable: true })
|
|
6579
7147
|
], Brand.prototype, "deletedBy", 2);
|
|
6580
7148
|
__decorateClass([
|
|
6581
|
-
|
|
7149
|
+
Column26("int", { nullable: true })
|
|
6582
7150
|
], Brand.prototype, "seoId", 2);
|
|
6583
7151
|
__decorateClass([
|
|
6584
7152
|
ManyToOne16(() => Seo, { onDelete: "SET NULL" }),
|
|
@@ -6591,7 +7159,7 @@ __decorateClass([
|
|
|
6591
7159
|
OneToMany11("Collection", "brand")
|
|
6592
7160
|
], Brand.prototype, "collections", 2);
|
|
6593
7161
|
Brand = __decorateClass([
|
|
6594
|
-
|
|
7162
|
+
Entity26("brands")
|
|
6595
7163
|
], Brand);
|
|
6596
7164
|
|
|
6597
7165
|
// src/entities/collection.entity.ts
|
|
@@ -6622,64 +7190,64 @@ var Collection = class {
|
|
|
6622
7190
|
products;
|
|
6623
7191
|
};
|
|
6624
7192
|
__decorateClass([
|
|
6625
|
-
|
|
7193
|
+
PrimaryGeneratedColumn27()
|
|
6626
7194
|
], Collection.prototype, "id", 2);
|
|
6627
7195
|
__decorateClass([
|
|
6628
|
-
|
|
7196
|
+
Column27("int", { nullable: true })
|
|
6629
7197
|
], Collection.prototype, "categoryId", 2);
|
|
6630
7198
|
__decorateClass([
|
|
6631
|
-
|
|
7199
|
+
Column27("int", { nullable: true })
|
|
6632
7200
|
], Collection.prototype, "brandId", 2);
|
|
6633
7201
|
__decorateClass([
|
|
6634
|
-
|
|
7202
|
+
Column27("varchar")
|
|
6635
7203
|
], Collection.prototype, "name", 2);
|
|
6636
7204
|
__decorateClass([
|
|
6637
|
-
|
|
7205
|
+
Column27("varchar", { unique: true })
|
|
6638
7206
|
], Collection.prototype, "slug", 2);
|
|
6639
7207
|
__decorateClass([
|
|
6640
|
-
|
|
7208
|
+
Column27("varchar", { nullable: true })
|
|
6641
7209
|
], Collection.prototype, "hsn", 2);
|
|
6642
7210
|
__decorateClass([
|
|
6643
|
-
|
|
7211
|
+
Column27("text", { nullable: true })
|
|
6644
7212
|
], Collection.prototype, "description", 2);
|
|
6645
7213
|
__decorateClass([
|
|
6646
|
-
|
|
7214
|
+
Column27("varchar", { nullable: true })
|
|
6647
7215
|
], Collection.prototype, "image", 2);
|
|
6648
7216
|
__decorateClass([
|
|
6649
|
-
|
|
7217
|
+
Column27("jsonb", { nullable: true })
|
|
6650
7218
|
], Collection.prototype, "metadata", 2);
|
|
6651
7219
|
__decorateClass([
|
|
6652
|
-
|
|
7220
|
+
Column27("jsonb", { nullable: true })
|
|
6653
7221
|
], Collection.prototype, "variants", 2);
|
|
6654
7222
|
__decorateClass([
|
|
6655
|
-
|
|
7223
|
+
Column27("boolean", { default: true })
|
|
6656
7224
|
], Collection.prototype, "active", 2);
|
|
6657
7225
|
__decorateClass([
|
|
6658
|
-
|
|
7226
|
+
Column27("int", { default: 0 })
|
|
6659
7227
|
], Collection.prototype, "sortOrder", 2);
|
|
6660
7228
|
__decorateClass([
|
|
6661
|
-
|
|
7229
|
+
Column27({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6662
7230
|
], Collection.prototype, "createdAt", 2);
|
|
6663
7231
|
__decorateClass([
|
|
6664
|
-
|
|
7232
|
+
Column27({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6665
7233
|
], Collection.prototype, "updatedAt", 2);
|
|
6666
7234
|
__decorateClass([
|
|
6667
|
-
|
|
7235
|
+
Column27({ type: "timestamp", nullable: true })
|
|
6668
7236
|
], Collection.prototype, "deletedAt", 2);
|
|
6669
7237
|
__decorateClass([
|
|
6670
|
-
|
|
7238
|
+
Column27("boolean", { default: false })
|
|
6671
7239
|
], Collection.prototype, "deleted", 2);
|
|
6672
7240
|
__decorateClass([
|
|
6673
|
-
|
|
7241
|
+
Column27("int", { nullable: true })
|
|
6674
7242
|
], Collection.prototype, "createdBy", 2);
|
|
6675
7243
|
__decorateClass([
|
|
6676
|
-
|
|
7244
|
+
Column27("int", { nullable: true })
|
|
6677
7245
|
], Collection.prototype, "updatedBy", 2);
|
|
6678
7246
|
__decorateClass([
|
|
6679
|
-
|
|
7247
|
+
Column27("int", { nullable: true })
|
|
6680
7248
|
], Collection.prototype, "deletedBy", 2);
|
|
6681
7249
|
__decorateClass([
|
|
6682
|
-
|
|
7250
|
+
Column27("int", { nullable: true })
|
|
6683
7251
|
], Collection.prototype, "seoId", 2);
|
|
6684
7252
|
__decorateClass([
|
|
6685
7253
|
ManyToOne17(() => Seo, { onDelete: "SET NULL" }),
|
|
@@ -6697,11 +7265,11 @@ __decorateClass([
|
|
|
6697
7265
|
OneToMany12("Product", "collection")
|
|
6698
7266
|
], Collection.prototype, "products", 2);
|
|
6699
7267
|
Collection = __decorateClass([
|
|
6700
|
-
|
|
7268
|
+
Entity27("collections")
|
|
6701
7269
|
], Collection);
|
|
6702
7270
|
|
|
6703
7271
|
// src/entities/product.entity.ts
|
|
6704
|
-
import { Entity as
|
|
7272
|
+
import { Entity as Entity28, PrimaryGeneratedColumn as PrimaryGeneratedColumn28, Column as Column28, ManyToOne as ManyToOne18, OneToMany as OneToMany13, JoinColumn as JoinColumn18 } from "typeorm";
|
|
6705
7273
|
var Product = class {
|
|
6706
7274
|
id;
|
|
6707
7275
|
collectionId;
|
|
@@ -6735,76 +7303,76 @@ var Product = class {
|
|
|
6735
7303
|
taxes;
|
|
6736
7304
|
};
|
|
6737
7305
|
__decorateClass([
|
|
6738
|
-
|
|
7306
|
+
PrimaryGeneratedColumn28()
|
|
6739
7307
|
], Product.prototype, "id", 2);
|
|
6740
7308
|
__decorateClass([
|
|
6741
|
-
|
|
7309
|
+
Column28("int", { nullable: true })
|
|
6742
7310
|
], Product.prototype, "collectionId", 2);
|
|
6743
7311
|
__decorateClass([
|
|
6744
|
-
|
|
7312
|
+
Column28("int", { nullable: true })
|
|
6745
7313
|
], Product.prototype, "brandId", 2);
|
|
6746
7314
|
__decorateClass([
|
|
6747
|
-
|
|
7315
|
+
Column28("int", { nullable: true })
|
|
6748
7316
|
], Product.prototype, "categoryId", 2);
|
|
6749
7317
|
__decorateClass([
|
|
6750
|
-
|
|
7318
|
+
Column28("varchar", { nullable: true })
|
|
6751
7319
|
], Product.prototype, "sku", 2);
|
|
6752
7320
|
__decorateClass([
|
|
6753
|
-
|
|
7321
|
+
Column28("varchar", { nullable: true })
|
|
6754
7322
|
], Product.prototype, "hsn", 2);
|
|
6755
7323
|
__decorateClass([
|
|
6756
|
-
|
|
7324
|
+
Column28("varchar", { nullable: true })
|
|
6757
7325
|
], Product.prototype, "uom", 2);
|
|
6758
7326
|
__decorateClass([
|
|
6759
|
-
|
|
7327
|
+
Column28("varchar", { default: "product" })
|
|
6760
7328
|
], Product.prototype, "type", 2);
|
|
6761
7329
|
__decorateClass([
|
|
6762
|
-
|
|
7330
|
+
Column28("varchar", { unique: true, nullable: true })
|
|
6763
7331
|
], Product.prototype, "slug", 2);
|
|
6764
7332
|
__decorateClass([
|
|
6765
|
-
|
|
7333
|
+
Column28("varchar", { nullable: true })
|
|
6766
7334
|
], Product.prototype, "name", 2);
|
|
6767
7335
|
__decorateClass([
|
|
6768
|
-
|
|
7336
|
+
Column28("decimal", { precision: 12, scale: 2 })
|
|
6769
7337
|
], Product.prototype, "price", 2);
|
|
6770
7338
|
__decorateClass([
|
|
6771
|
-
|
|
7339
|
+
Column28("decimal", { precision: 12, scale: 2, nullable: true })
|
|
6772
7340
|
], Product.prototype, "compareAtPrice", 2);
|
|
6773
7341
|
__decorateClass([
|
|
6774
|
-
|
|
7342
|
+
Column28("int", { default: 0 })
|
|
6775
7343
|
], Product.prototype, "quantity", 2);
|
|
6776
7344
|
__decorateClass([
|
|
6777
|
-
|
|
7345
|
+
Column28("varchar", { default: "draft" })
|
|
6778
7346
|
], Product.prototype, "status", 2);
|
|
6779
7347
|
__decorateClass([
|
|
6780
|
-
|
|
7348
|
+
Column28("boolean", { default: false })
|
|
6781
7349
|
], Product.prototype, "featured", 2);
|
|
6782
7350
|
__decorateClass([
|
|
6783
|
-
|
|
7351
|
+
Column28("jsonb", { nullable: true })
|
|
6784
7352
|
], Product.prototype, "metadata", 2);
|
|
6785
7353
|
__decorateClass([
|
|
6786
|
-
|
|
7354
|
+
Column28({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6787
7355
|
], Product.prototype, "createdAt", 2);
|
|
6788
7356
|
__decorateClass([
|
|
6789
|
-
|
|
7357
|
+
Column28({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6790
7358
|
], Product.prototype, "updatedAt", 2);
|
|
6791
7359
|
__decorateClass([
|
|
6792
|
-
|
|
7360
|
+
Column28({ type: "timestamp", nullable: true })
|
|
6793
7361
|
], Product.prototype, "deletedAt", 2);
|
|
6794
7362
|
__decorateClass([
|
|
6795
|
-
|
|
7363
|
+
Column28("boolean", { default: false })
|
|
6796
7364
|
], Product.prototype, "deleted", 2);
|
|
6797
7365
|
__decorateClass([
|
|
6798
|
-
|
|
7366
|
+
Column28("int", { nullable: true })
|
|
6799
7367
|
], Product.prototype, "createdBy", 2);
|
|
6800
7368
|
__decorateClass([
|
|
6801
|
-
|
|
7369
|
+
Column28("int", { nullable: true })
|
|
6802
7370
|
], Product.prototype, "updatedBy", 2);
|
|
6803
7371
|
__decorateClass([
|
|
6804
|
-
|
|
7372
|
+
Column28("int", { nullable: true })
|
|
6805
7373
|
], Product.prototype, "deletedBy", 2);
|
|
6806
7374
|
__decorateClass([
|
|
6807
|
-
|
|
7375
|
+
Column28("int", { nullable: true })
|
|
6808
7376
|
], Product.prototype, "seoId", 2);
|
|
6809
7377
|
__decorateClass([
|
|
6810
7378
|
ManyToOne18(() => Seo, { onDelete: "SET NULL" }),
|
|
@@ -6829,11 +7397,11 @@ __decorateClass([
|
|
|
6829
7397
|
OneToMany13("ProductTax", "product")
|
|
6830
7398
|
], Product.prototype, "taxes", 2);
|
|
6831
7399
|
Product = __decorateClass([
|
|
6832
|
-
|
|
7400
|
+
Entity28("products")
|
|
6833
7401
|
], Product);
|
|
6834
7402
|
|
|
6835
7403
|
// src/entities/attribute.entity.ts
|
|
6836
|
-
import { Entity as
|
|
7404
|
+
import { Entity as Entity29, PrimaryGeneratedColumn as PrimaryGeneratedColumn29, Column as Column29 } from "typeorm";
|
|
6837
7405
|
var Attribute = class {
|
|
6838
7406
|
id;
|
|
6839
7407
|
name;
|
|
@@ -6852,56 +7420,56 @@ var Attribute = class {
|
|
|
6852
7420
|
deletedBy;
|
|
6853
7421
|
};
|
|
6854
7422
|
__decorateClass([
|
|
6855
|
-
|
|
7423
|
+
PrimaryGeneratedColumn29()
|
|
6856
7424
|
], Attribute.prototype, "id", 2);
|
|
6857
7425
|
__decorateClass([
|
|
6858
|
-
|
|
7426
|
+
Column29("varchar")
|
|
6859
7427
|
], Attribute.prototype, "name", 2);
|
|
6860
7428
|
__decorateClass([
|
|
6861
|
-
|
|
7429
|
+
Column29("varchar", { unique: true })
|
|
6862
7430
|
], Attribute.prototype, "slug", 2);
|
|
6863
7431
|
__decorateClass([
|
|
6864
|
-
|
|
7432
|
+
Column29("varchar", { default: "text" })
|
|
6865
7433
|
], Attribute.prototype, "type", 2);
|
|
6866
7434
|
__decorateClass([
|
|
6867
|
-
|
|
7435
|
+
Column29("jsonb", { nullable: true })
|
|
6868
7436
|
], Attribute.prototype, "options", 2);
|
|
6869
7437
|
__decorateClass([
|
|
6870
|
-
|
|
7438
|
+
Column29("jsonb", { nullable: true })
|
|
6871
7439
|
], Attribute.prototype, "metadata", 2);
|
|
6872
7440
|
__decorateClass([
|
|
6873
|
-
|
|
7441
|
+
Column29("boolean", { default: true })
|
|
6874
7442
|
], Attribute.prototype, "active", 2);
|
|
6875
7443
|
__decorateClass([
|
|
6876
|
-
|
|
7444
|
+
Column29("int", { default: 0 })
|
|
6877
7445
|
], Attribute.prototype, "sortOrder", 2);
|
|
6878
7446
|
__decorateClass([
|
|
6879
|
-
|
|
7447
|
+
Column29({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6880
7448
|
], Attribute.prototype, "createdAt", 2);
|
|
6881
7449
|
__decorateClass([
|
|
6882
|
-
|
|
7450
|
+
Column29({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6883
7451
|
], Attribute.prototype, "updatedAt", 2);
|
|
6884
7452
|
__decorateClass([
|
|
6885
|
-
|
|
7453
|
+
Column29({ type: "timestamp", nullable: true })
|
|
6886
7454
|
], Attribute.prototype, "deletedAt", 2);
|
|
6887
7455
|
__decorateClass([
|
|
6888
|
-
|
|
7456
|
+
Column29("boolean", { default: false })
|
|
6889
7457
|
], Attribute.prototype, "deleted", 2);
|
|
6890
7458
|
__decorateClass([
|
|
6891
|
-
|
|
7459
|
+
Column29("int", { nullable: true })
|
|
6892
7460
|
], Attribute.prototype, "createdBy", 2);
|
|
6893
7461
|
__decorateClass([
|
|
6894
|
-
|
|
7462
|
+
Column29("int", { nullable: true })
|
|
6895
7463
|
], Attribute.prototype, "updatedBy", 2);
|
|
6896
7464
|
__decorateClass([
|
|
6897
|
-
|
|
7465
|
+
Column29("int", { nullable: true })
|
|
6898
7466
|
], Attribute.prototype, "deletedBy", 2);
|
|
6899
7467
|
Attribute = __decorateClass([
|
|
6900
|
-
|
|
7468
|
+
Entity29("attributes")
|
|
6901
7469
|
], Attribute);
|
|
6902
7470
|
|
|
6903
7471
|
// src/entities/product-attribute.entity.ts
|
|
6904
|
-
import { Entity as
|
|
7472
|
+
import { Entity as Entity30, PrimaryGeneratedColumn as PrimaryGeneratedColumn30, Column as Column30, ManyToOne as ManyToOne19, JoinColumn as JoinColumn19 } from "typeorm";
|
|
6905
7473
|
var ProductAttribute = class {
|
|
6906
7474
|
id;
|
|
6907
7475
|
productId;
|
|
@@ -6914,25 +7482,25 @@ var ProductAttribute = class {
|
|
|
6914
7482
|
attribute;
|
|
6915
7483
|
};
|
|
6916
7484
|
__decorateClass([
|
|
6917
|
-
|
|
7485
|
+
PrimaryGeneratedColumn30()
|
|
6918
7486
|
], ProductAttribute.prototype, "id", 2);
|
|
6919
7487
|
__decorateClass([
|
|
6920
|
-
|
|
7488
|
+
Column30("int")
|
|
6921
7489
|
], ProductAttribute.prototype, "productId", 2);
|
|
6922
7490
|
__decorateClass([
|
|
6923
|
-
|
|
7491
|
+
Column30("int")
|
|
6924
7492
|
], ProductAttribute.prototype, "attributeId", 2);
|
|
6925
7493
|
__decorateClass([
|
|
6926
|
-
|
|
7494
|
+
Column30("varchar")
|
|
6927
7495
|
], ProductAttribute.prototype, "value", 2);
|
|
6928
7496
|
__decorateClass([
|
|
6929
|
-
|
|
7497
|
+
Column30("jsonb", { nullable: true })
|
|
6930
7498
|
], ProductAttribute.prototype, "metadata", 2);
|
|
6931
7499
|
__decorateClass([
|
|
6932
|
-
|
|
7500
|
+
Column30({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6933
7501
|
], ProductAttribute.prototype, "createdAt", 2);
|
|
6934
7502
|
__decorateClass([
|
|
6935
|
-
|
|
7503
|
+
Column30({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6936
7504
|
], ProductAttribute.prototype, "updatedAt", 2);
|
|
6937
7505
|
__decorateClass([
|
|
6938
7506
|
ManyToOne19(() => Product, (p) => p.attributes, { onDelete: "CASCADE" }),
|
|
@@ -6943,11 +7511,11 @@ __decorateClass([
|
|
|
6943
7511
|
JoinColumn19({ name: "attributeId" })
|
|
6944
7512
|
], ProductAttribute.prototype, "attribute", 2);
|
|
6945
7513
|
ProductAttribute = __decorateClass([
|
|
6946
|
-
|
|
7514
|
+
Entity30("product_attributes")
|
|
6947
7515
|
], ProductAttribute);
|
|
6948
7516
|
|
|
6949
7517
|
// src/entities/tax.entity.ts
|
|
6950
|
-
import { Entity as
|
|
7518
|
+
import { Entity as Entity31, PrimaryGeneratedColumn as PrimaryGeneratedColumn31, Column as Column31 } from "typeorm";
|
|
6951
7519
|
var Tax = class {
|
|
6952
7520
|
id;
|
|
6953
7521
|
name;
|
|
@@ -6966,56 +7534,56 @@ var Tax = class {
|
|
|
6966
7534
|
deletedBy;
|
|
6967
7535
|
};
|
|
6968
7536
|
__decorateClass([
|
|
6969
|
-
|
|
7537
|
+
PrimaryGeneratedColumn31()
|
|
6970
7538
|
], Tax.prototype, "id", 2);
|
|
6971
7539
|
__decorateClass([
|
|
6972
|
-
|
|
7540
|
+
Column31("varchar")
|
|
6973
7541
|
], Tax.prototype, "name", 2);
|
|
6974
7542
|
__decorateClass([
|
|
6975
|
-
|
|
7543
|
+
Column31("varchar", { unique: true })
|
|
6976
7544
|
], Tax.prototype, "slug", 2);
|
|
6977
7545
|
__decorateClass([
|
|
6978
|
-
|
|
7546
|
+
Column31("decimal", { precision: 5, scale: 2 })
|
|
6979
7547
|
], Tax.prototype, "rate", 2);
|
|
6980
7548
|
__decorateClass([
|
|
6981
|
-
|
|
7549
|
+
Column31("boolean", { default: false })
|
|
6982
7550
|
], Tax.prototype, "isDefault", 2);
|
|
6983
7551
|
__decorateClass([
|
|
6984
|
-
|
|
7552
|
+
Column31("text", { nullable: true })
|
|
6985
7553
|
], Tax.prototype, "description", 2);
|
|
6986
7554
|
__decorateClass([
|
|
6987
|
-
|
|
7555
|
+
Column31("boolean", { default: true })
|
|
6988
7556
|
], Tax.prototype, "active", 2);
|
|
6989
7557
|
__decorateClass([
|
|
6990
|
-
|
|
7558
|
+
Column31("jsonb", { nullable: true })
|
|
6991
7559
|
], Tax.prototype, "metadata", 2);
|
|
6992
7560
|
__decorateClass([
|
|
6993
|
-
|
|
7561
|
+
Column31({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6994
7562
|
], Tax.prototype, "createdAt", 2);
|
|
6995
7563
|
__decorateClass([
|
|
6996
|
-
|
|
7564
|
+
Column31({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6997
7565
|
], Tax.prototype, "updatedAt", 2);
|
|
6998
7566
|
__decorateClass([
|
|
6999
|
-
|
|
7567
|
+
Column31({ type: "timestamp", nullable: true })
|
|
7000
7568
|
], Tax.prototype, "deletedAt", 2);
|
|
7001
7569
|
__decorateClass([
|
|
7002
|
-
|
|
7570
|
+
Column31("boolean", { default: false })
|
|
7003
7571
|
], Tax.prototype, "deleted", 2);
|
|
7004
7572
|
__decorateClass([
|
|
7005
|
-
|
|
7573
|
+
Column31("int", { nullable: true })
|
|
7006
7574
|
], Tax.prototype, "createdBy", 2);
|
|
7007
7575
|
__decorateClass([
|
|
7008
|
-
|
|
7576
|
+
Column31("int", { nullable: true })
|
|
7009
7577
|
], Tax.prototype, "updatedBy", 2);
|
|
7010
7578
|
__decorateClass([
|
|
7011
|
-
|
|
7579
|
+
Column31("int", { nullable: true })
|
|
7012
7580
|
], Tax.prototype, "deletedBy", 2);
|
|
7013
7581
|
Tax = __decorateClass([
|
|
7014
|
-
|
|
7582
|
+
Entity31("taxes")
|
|
7015
7583
|
], Tax);
|
|
7016
7584
|
|
|
7017
7585
|
// src/entities/product-tax.entity.ts
|
|
7018
|
-
import { Entity as
|
|
7586
|
+
import { Entity as Entity32, PrimaryGeneratedColumn as PrimaryGeneratedColumn32, Column as Column32, ManyToOne as ManyToOne20, JoinColumn as JoinColumn20 } from "typeorm";
|
|
7019
7587
|
var ProductTax = class {
|
|
7020
7588
|
id;
|
|
7021
7589
|
productId;
|
|
@@ -7027,22 +7595,22 @@ var ProductTax = class {
|
|
|
7027
7595
|
tax;
|
|
7028
7596
|
};
|
|
7029
7597
|
__decorateClass([
|
|
7030
|
-
|
|
7598
|
+
PrimaryGeneratedColumn32()
|
|
7031
7599
|
], ProductTax.prototype, "id", 2);
|
|
7032
7600
|
__decorateClass([
|
|
7033
|
-
|
|
7601
|
+
Column32("int")
|
|
7034
7602
|
], ProductTax.prototype, "productId", 2);
|
|
7035
7603
|
__decorateClass([
|
|
7036
|
-
|
|
7604
|
+
Column32("int")
|
|
7037
7605
|
], ProductTax.prototype, "taxId", 2);
|
|
7038
7606
|
__decorateClass([
|
|
7039
|
-
|
|
7607
|
+
Column32("decimal", { precision: 5, scale: 2, nullable: true })
|
|
7040
7608
|
], ProductTax.prototype, "rate", 2);
|
|
7041
7609
|
__decorateClass([
|
|
7042
|
-
|
|
7610
|
+
Column32({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
7043
7611
|
], ProductTax.prototype, "createdAt", 2);
|
|
7044
7612
|
__decorateClass([
|
|
7045
|
-
|
|
7613
|
+
Column32({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
7046
7614
|
], ProductTax.prototype, "updatedAt", 2);
|
|
7047
7615
|
__decorateClass([
|
|
7048
7616
|
ManyToOne20(() => Product, (p) => p.taxes, { onDelete: "CASCADE" }),
|
|
@@ -7053,11 +7621,11 @@ __decorateClass([
|
|
|
7053
7621
|
JoinColumn20({ name: "taxId" })
|
|
7054
7622
|
], ProductTax.prototype, "tax", 2);
|
|
7055
7623
|
ProductTax = __decorateClass([
|
|
7056
|
-
|
|
7624
|
+
Entity32("product_taxes")
|
|
7057
7625
|
], ProductTax);
|
|
7058
7626
|
|
|
7059
7627
|
// src/entities/order-item.entity.ts
|
|
7060
|
-
import { Entity as
|
|
7628
|
+
import { Entity as Entity33, PrimaryGeneratedColumn as PrimaryGeneratedColumn33, Column as Column33, ManyToOne as ManyToOne21, JoinColumn as JoinColumn21 } from "typeorm";
|
|
7061
7629
|
var OrderItem = class {
|
|
7062
7630
|
id;
|
|
7063
7631
|
orderId;
|
|
@@ -7078,49 +7646,49 @@ var OrderItem = class {
|
|
|
7078
7646
|
product;
|
|
7079
7647
|
};
|
|
7080
7648
|
__decorateClass([
|
|
7081
|
-
|
|
7649
|
+
PrimaryGeneratedColumn33()
|
|
7082
7650
|
], OrderItem.prototype, "id", 2);
|
|
7083
7651
|
__decorateClass([
|
|
7084
|
-
|
|
7652
|
+
Column33("int")
|
|
7085
7653
|
], OrderItem.prototype, "orderId", 2);
|
|
7086
7654
|
__decorateClass([
|
|
7087
|
-
|
|
7655
|
+
Column33("int")
|
|
7088
7656
|
], OrderItem.prototype, "productId", 2);
|
|
7089
7657
|
__decorateClass([
|
|
7090
|
-
|
|
7658
|
+
Column33("int", { default: 1 })
|
|
7091
7659
|
], OrderItem.prototype, "quantity", 2);
|
|
7092
7660
|
__decorateClass([
|
|
7093
|
-
|
|
7661
|
+
Column33("decimal", { precision: 12, scale: 2 })
|
|
7094
7662
|
], OrderItem.prototype, "unitPrice", 2);
|
|
7095
7663
|
__decorateClass([
|
|
7096
|
-
|
|
7664
|
+
Column33("decimal", { precision: 12, scale: 2, default: 0 })
|
|
7097
7665
|
], OrderItem.prototype, "tax", 2);
|
|
7098
7666
|
__decorateClass([
|
|
7099
|
-
|
|
7667
|
+
Column33("decimal", { precision: 12, scale: 2 })
|
|
7100
7668
|
], OrderItem.prototype, "total", 2);
|
|
7101
7669
|
__decorateClass([
|
|
7102
|
-
|
|
7670
|
+
Column33("varchar", { nullable: true })
|
|
7103
7671
|
], OrderItem.prototype, "hsn", 2);
|
|
7104
7672
|
__decorateClass([
|
|
7105
|
-
|
|
7673
|
+
Column33("varchar", { nullable: true })
|
|
7106
7674
|
], OrderItem.prototype, "uom", 2);
|
|
7107
7675
|
__decorateClass([
|
|
7108
|
-
|
|
7676
|
+
Column33("varchar", { nullable: true })
|
|
7109
7677
|
], OrderItem.prototype, "productType", 2);
|
|
7110
7678
|
__decorateClass([
|
|
7111
|
-
|
|
7679
|
+
Column33("decimal", { precision: 5, scale: 2, nullable: true })
|
|
7112
7680
|
], OrderItem.prototype, "taxRate", 2);
|
|
7113
7681
|
__decorateClass([
|
|
7114
|
-
|
|
7682
|
+
Column33("varchar", { nullable: true })
|
|
7115
7683
|
], OrderItem.prototype, "taxCode", 2);
|
|
7116
7684
|
__decorateClass([
|
|
7117
|
-
|
|
7685
|
+
Column33("jsonb", { nullable: true })
|
|
7118
7686
|
], OrderItem.prototype, "metadata", 2);
|
|
7119
7687
|
__decorateClass([
|
|
7120
|
-
|
|
7688
|
+
Column33({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
7121
7689
|
], OrderItem.prototype, "createdAt", 2);
|
|
7122
7690
|
__decorateClass([
|
|
7123
|
-
|
|
7691
|
+
Column33({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
7124
7692
|
], OrderItem.prototype, "updatedAt", 2);
|
|
7125
7693
|
__decorateClass([
|
|
7126
7694
|
ManyToOne21(() => Order, (o) => o.items, { onDelete: "CASCADE" }),
|
|
@@ -7131,14 +7699,14 @@ __decorateClass([
|
|
|
7131
7699
|
JoinColumn21({ name: "productId" })
|
|
7132
7700
|
], OrderItem.prototype, "product", 2);
|
|
7133
7701
|
OrderItem = __decorateClass([
|
|
7134
|
-
|
|
7702
|
+
Entity33("order_items")
|
|
7135
7703
|
], OrderItem);
|
|
7136
7704
|
|
|
7137
7705
|
// src/entities/knowledge-base-document.entity.ts
|
|
7138
|
-
import { Entity as
|
|
7706
|
+
import { Entity as Entity35, PrimaryGeneratedColumn as PrimaryGeneratedColumn35, Column as Column35, OneToMany as OneToMany14 } from "typeorm";
|
|
7139
7707
|
|
|
7140
7708
|
// src/entities/knowledge-base-chunk.entity.ts
|
|
7141
|
-
import { Entity as
|
|
7709
|
+
import { Entity as Entity34, PrimaryGeneratedColumn as PrimaryGeneratedColumn34, Column as Column34, ManyToOne as ManyToOne22, JoinColumn as JoinColumn22 } from "typeorm";
|
|
7142
7710
|
var KnowledgeBaseChunk = class {
|
|
7143
7711
|
id;
|
|
7144
7712
|
documentId;
|
|
@@ -7148,26 +7716,26 @@ var KnowledgeBaseChunk = class {
|
|
|
7148
7716
|
document;
|
|
7149
7717
|
};
|
|
7150
7718
|
__decorateClass([
|
|
7151
|
-
|
|
7719
|
+
PrimaryGeneratedColumn34()
|
|
7152
7720
|
], KnowledgeBaseChunk.prototype, "id", 2);
|
|
7153
7721
|
__decorateClass([
|
|
7154
|
-
|
|
7722
|
+
Column34("int")
|
|
7155
7723
|
], KnowledgeBaseChunk.prototype, "documentId", 2);
|
|
7156
7724
|
__decorateClass([
|
|
7157
|
-
|
|
7725
|
+
Column34("text")
|
|
7158
7726
|
], KnowledgeBaseChunk.prototype, "content", 2);
|
|
7159
7727
|
__decorateClass([
|
|
7160
|
-
|
|
7728
|
+
Column34("int", { default: 0 })
|
|
7161
7729
|
], KnowledgeBaseChunk.prototype, "chunkIndex", 2);
|
|
7162
7730
|
__decorateClass([
|
|
7163
|
-
|
|
7731
|
+
Column34({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
7164
7732
|
], KnowledgeBaseChunk.prototype, "createdAt", 2);
|
|
7165
7733
|
__decorateClass([
|
|
7166
7734
|
ManyToOne22(() => KnowledgeBaseDocument, (d) => d.chunks, { onDelete: "CASCADE" }),
|
|
7167
7735
|
JoinColumn22({ name: "documentId" })
|
|
7168
7736
|
], KnowledgeBaseChunk.prototype, "document", 2);
|
|
7169
7737
|
KnowledgeBaseChunk = __decorateClass([
|
|
7170
|
-
|
|
7738
|
+
Entity34("knowledge_base_chunks")
|
|
7171
7739
|
], KnowledgeBaseChunk);
|
|
7172
7740
|
|
|
7173
7741
|
// src/entities/knowledge-base-document.entity.ts
|
|
@@ -7181,32 +7749,32 @@ var KnowledgeBaseDocument = class {
|
|
|
7181
7749
|
chunks;
|
|
7182
7750
|
};
|
|
7183
7751
|
__decorateClass([
|
|
7184
|
-
|
|
7752
|
+
PrimaryGeneratedColumn35()
|
|
7185
7753
|
], KnowledgeBaseDocument.prototype, "id", 2);
|
|
7186
7754
|
__decorateClass([
|
|
7187
|
-
|
|
7755
|
+
Column35("varchar")
|
|
7188
7756
|
], KnowledgeBaseDocument.prototype, "name", 2);
|
|
7189
7757
|
__decorateClass([
|
|
7190
|
-
|
|
7758
|
+
Column35("varchar", { nullable: true })
|
|
7191
7759
|
], KnowledgeBaseDocument.prototype, "sourceUrl", 2);
|
|
7192
7760
|
__decorateClass([
|
|
7193
|
-
|
|
7761
|
+
Column35("text")
|
|
7194
7762
|
], KnowledgeBaseDocument.prototype, "content", 2);
|
|
7195
7763
|
__decorateClass([
|
|
7196
|
-
|
|
7764
|
+
Column35({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
7197
7765
|
], KnowledgeBaseDocument.prototype, "createdAt", 2);
|
|
7198
7766
|
__decorateClass([
|
|
7199
|
-
|
|
7767
|
+
Column35({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
7200
7768
|
], KnowledgeBaseDocument.prototype, "updatedAt", 2);
|
|
7201
7769
|
__decorateClass([
|
|
7202
7770
|
OneToMany14(() => KnowledgeBaseChunk, (c) => c.document)
|
|
7203
7771
|
], KnowledgeBaseDocument.prototype, "chunks", 2);
|
|
7204
7772
|
KnowledgeBaseDocument = __decorateClass([
|
|
7205
|
-
|
|
7773
|
+
Entity35("knowledge_base_documents")
|
|
7206
7774
|
], KnowledgeBaseDocument);
|
|
7207
7775
|
|
|
7208
7776
|
// src/entities/cart.entity.ts
|
|
7209
|
-
import { Entity as
|
|
7777
|
+
import { Entity as Entity36, PrimaryGeneratedColumn as PrimaryGeneratedColumn36, Column as Column36, ManyToOne as ManyToOne23, OneToMany as OneToMany15, JoinColumn as JoinColumn23 } from "typeorm";
|
|
7210
7778
|
var Cart = class {
|
|
7211
7779
|
id;
|
|
7212
7780
|
guestToken;
|
|
@@ -7219,25 +7787,25 @@ var Cart = class {
|
|
|
7219
7787
|
items;
|
|
7220
7788
|
};
|
|
7221
7789
|
__decorateClass([
|
|
7222
|
-
|
|
7790
|
+
PrimaryGeneratedColumn36()
|
|
7223
7791
|
], Cart.prototype, "id", 2);
|
|
7224
7792
|
__decorateClass([
|
|
7225
|
-
|
|
7793
|
+
Column36("varchar", { nullable: true })
|
|
7226
7794
|
], Cart.prototype, "guestToken", 2);
|
|
7227
7795
|
__decorateClass([
|
|
7228
|
-
|
|
7796
|
+
Column36("int", { nullable: true })
|
|
7229
7797
|
], Cart.prototype, "contactId", 2);
|
|
7230
7798
|
__decorateClass([
|
|
7231
|
-
|
|
7799
|
+
Column36("varchar", { default: "INR" })
|
|
7232
7800
|
], Cart.prototype, "currency", 2);
|
|
7233
7801
|
__decorateClass([
|
|
7234
|
-
|
|
7802
|
+
Column36({ type: "timestamp", nullable: true })
|
|
7235
7803
|
], Cart.prototype, "expiresAt", 2);
|
|
7236
7804
|
__decorateClass([
|
|
7237
|
-
|
|
7805
|
+
Column36({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
7238
7806
|
], Cart.prototype, "createdAt", 2);
|
|
7239
7807
|
__decorateClass([
|
|
7240
|
-
|
|
7808
|
+
Column36({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
7241
7809
|
], Cart.prototype, "updatedAt", 2);
|
|
7242
7810
|
__decorateClass([
|
|
7243
7811
|
ManyToOne23(() => Contact, { onDelete: "CASCADE" }),
|
|
@@ -7247,11 +7815,11 @@ __decorateClass([
|
|
|
7247
7815
|
OneToMany15("CartItem", "cart")
|
|
7248
7816
|
], Cart.prototype, "items", 2);
|
|
7249
7817
|
Cart = __decorateClass([
|
|
7250
|
-
|
|
7818
|
+
Entity36("carts")
|
|
7251
7819
|
], Cart);
|
|
7252
7820
|
|
|
7253
7821
|
// src/entities/cart-item.entity.ts
|
|
7254
|
-
import { Entity as
|
|
7822
|
+
import { Entity as Entity37, PrimaryGeneratedColumn as PrimaryGeneratedColumn37, Column as Column37, ManyToOne as ManyToOne24, JoinColumn as JoinColumn24 } from "typeorm";
|
|
7255
7823
|
var CartItem = class {
|
|
7256
7824
|
id;
|
|
7257
7825
|
cartId;
|
|
@@ -7264,25 +7832,25 @@ var CartItem = class {
|
|
|
7264
7832
|
product;
|
|
7265
7833
|
};
|
|
7266
7834
|
__decorateClass([
|
|
7267
|
-
|
|
7835
|
+
PrimaryGeneratedColumn37()
|
|
7268
7836
|
], CartItem.prototype, "id", 2);
|
|
7269
7837
|
__decorateClass([
|
|
7270
|
-
|
|
7838
|
+
Column37("int")
|
|
7271
7839
|
], CartItem.prototype, "cartId", 2);
|
|
7272
7840
|
__decorateClass([
|
|
7273
|
-
|
|
7841
|
+
Column37("int")
|
|
7274
7842
|
], CartItem.prototype, "productId", 2);
|
|
7275
7843
|
__decorateClass([
|
|
7276
|
-
|
|
7844
|
+
Column37("int", { default: 1 })
|
|
7277
7845
|
], CartItem.prototype, "quantity", 2);
|
|
7278
7846
|
__decorateClass([
|
|
7279
|
-
|
|
7847
|
+
Column37("jsonb", { nullable: true })
|
|
7280
7848
|
], CartItem.prototype, "metadata", 2);
|
|
7281
7849
|
__decorateClass([
|
|
7282
|
-
|
|
7850
|
+
Column37({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
7283
7851
|
], CartItem.prototype, "createdAt", 2);
|
|
7284
7852
|
__decorateClass([
|
|
7285
|
-
|
|
7853
|
+
Column37({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
7286
7854
|
], CartItem.prototype, "updatedAt", 2);
|
|
7287
7855
|
__decorateClass([
|
|
7288
7856
|
ManyToOne24(() => Cart, (c) => c.items, { onDelete: "CASCADE" }),
|
|
@@ -7293,11 +7861,11 @@ __decorateClass([
|
|
|
7293
7861
|
JoinColumn24({ name: "productId" })
|
|
7294
7862
|
], CartItem.prototype, "product", 2);
|
|
7295
7863
|
CartItem = __decorateClass([
|
|
7296
|
-
|
|
7864
|
+
Entity37("cart_items")
|
|
7297
7865
|
], CartItem);
|
|
7298
7866
|
|
|
7299
7867
|
// src/entities/wishlist.entity.ts
|
|
7300
|
-
import { Entity as
|
|
7868
|
+
import { Entity as Entity38, PrimaryGeneratedColumn as PrimaryGeneratedColumn38, Column as Column38, ManyToOne as ManyToOne25, OneToMany as OneToMany16, JoinColumn as JoinColumn25 } from "typeorm";
|
|
7301
7869
|
var Wishlist = class {
|
|
7302
7870
|
id;
|
|
7303
7871
|
guestId;
|
|
@@ -7309,22 +7877,22 @@ var Wishlist = class {
|
|
|
7309
7877
|
items;
|
|
7310
7878
|
};
|
|
7311
7879
|
__decorateClass([
|
|
7312
|
-
|
|
7880
|
+
PrimaryGeneratedColumn38()
|
|
7313
7881
|
], Wishlist.prototype, "id", 2);
|
|
7314
7882
|
__decorateClass([
|
|
7315
|
-
|
|
7883
|
+
Column38("varchar", { nullable: true })
|
|
7316
7884
|
], Wishlist.prototype, "guestId", 2);
|
|
7317
7885
|
__decorateClass([
|
|
7318
|
-
|
|
7886
|
+
Column38("int", { nullable: true })
|
|
7319
7887
|
], Wishlist.prototype, "contactId", 2);
|
|
7320
7888
|
__decorateClass([
|
|
7321
|
-
|
|
7889
|
+
Column38("varchar", { default: "default" })
|
|
7322
7890
|
], Wishlist.prototype, "name", 2);
|
|
7323
7891
|
__decorateClass([
|
|
7324
|
-
|
|
7892
|
+
Column38({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
7325
7893
|
], Wishlist.prototype, "createdAt", 2);
|
|
7326
7894
|
__decorateClass([
|
|
7327
|
-
|
|
7895
|
+
Column38({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
7328
7896
|
], Wishlist.prototype, "updatedAt", 2);
|
|
7329
7897
|
__decorateClass([
|
|
7330
7898
|
ManyToOne25(() => Contact, { onDelete: "CASCADE" }),
|
|
@@ -7334,11 +7902,11 @@ __decorateClass([
|
|
|
7334
7902
|
OneToMany16("WishlistItem", "wishlist")
|
|
7335
7903
|
], Wishlist.prototype, "items", 2);
|
|
7336
7904
|
Wishlist = __decorateClass([
|
|
7337
|
-
|
|
7905
|
+
Entity38("wishlists")
|
|
7338
7906
|
], Wishlist);
|
|
7339
7907
|
|
|
7340
7908
|
// src/entities/wishlist-item.entity.ts
|
|
7341
|
-
import { Entity as
|
|
7909
|
+
import { Entity as Entity39, PrimaryGeneratedColumn as PrimaryGeneratedColumn39, Column as Column39, ManyToOne as ManyToOne26, JoinColumn as JoinColumn26 } from "typeorm";
|
|
7342
7910
|
var WishlistItem = class {
|
|
7343
7911
|
id;
|
|
7344
7912
|
wishlistId;
|
|
@@ -7350,22 +7918,22 @@ var WishlistItem = class {
|
|
|
7350
7918
|
product;
|
|
7351
7919
|
};
|
|
7352
7920
|
__decorateClass([
|
|
7353
|
-
|
|
7921
|
+
PrimaryGeneratedColumn39()
|
|
7354
7922
|
], WishlistItem.prototype, "id", 2);
|
|
7355
7923
|
__decorateClass([
|
|
7356
|
-
|
|
7924
|
+
Column39("int")
|
|
7357
7925
|
], WishlistItem.prototype, "wishlistId", 2);
|
|
7358
7926
|
__decorateClass([
|
|
7359
|
-
|
|
7927
|
+
Column39("int")
|
|
7360
7928
|
], WishlistItem.prototype, "productId", 2);
|
|
7361
7929
|
__decorateClass([
|
|
7362
|
-
|
|
7930
|
+
Column39("jsonb", { nullable: true })
|
|
7363
7931
|
], WishlistItem.prototype, "metadata", 2);
|
|
7364
7932
|
__decorateClass([
|
|
7365
|
-
|
|
7933
|
+
Column39({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
7366
7934
|
], WishlistItem.prototype, "createdAt", 2);
|
|
7367
7935
|
__decorateClass([
|
|
7368
|
-
|
|
7936
|
+
Column39({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
7369
7937
|
], WishlistItem.prototype, "updatedAt", 2);
|
|
7370
7938
|
__decorateClass([
|
|
7371
7939
|
ManyToOne26(() => Wishlist, (w) => w.items, { onDelete: "CASCADE" }),
|
|
@@ -7376,9 +7944,45 @@ __decorateClass([
|
|
|
7376
7944
|
JoinColumn26({ name: "productId" })
|
|
7377
7945
|
], WishlistItem.prototype, "product", 2);
|
|
7378
7946
|
WishlistItem = __decorateClass([
|
|
7379
|
-
|
|
7947
|
+
Entity39("wishlist_items")
|
|
7380
7948
|
], WishlistItem);
|
|
7381
7949
|
|
|
7950
|
+
// src/entities/llm-agent-knowledge-document.entity.ts
|
|
7951
|
+
import { Entity as Entity40, PrimaryGeneratedColumn as PrimaryGeneratedColumn40, Column as Column40, ManyToOne as ManyToOne27, JoinColumn as JoinColumn27, Index as Index2, Unique as Unique2 } from "typeorm";
|
|
7952
|
+
var LlmAgentKnowledgeDocument = class {
|
|
7953
|
+
id;
|
|
7954
|
+
agentId;
|
|
7955
|
+
documentId;
|
|
7956
|
+
createdAt;
|
|
7957
|
+
agent;
|
|
7958
|
+
document;
|
|
7959
|
+
};
|
|
7960
|
+
__decorateClass([
|
|
7961
|
+
PrimaryGeneratedColumn40()
|
|
7962
|
+
], LlmAgentKnowledgeDocument.prototype, "id", 2);
|
|
7963
|
+
__decorateClass([
|
|
7964
|
+
Column40("int")
|
|
7965
|
+
], LlmAgentKnowledgeDocument.prototype, "agentId", 2);
|
|
7966
|
+
__decorateClass([
|
|
7967
|
+
Column40("int")
|
|
7968
|
+
], LlmAgentKnowledgeDocument.prototype, "documentId", 2);
|
|
7969
|
+
__decorateClass([
|
|
7970
|
+
Column40({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
7971
|
+
], LlmAgentKnowledgeDocument.prototype, "createdAt", 2);
|
|
7972
|
+
__decorateClass([
|
|
7973
|
+
ManyToOne27(() => LlmAgent, { onDelete: "CASCADE" }),
|
|
7974
|
+
JoinColumn27({ name: "agentId" })
|
|
7975
|
+
], LlmAgentKnowledgeDocument.prototype, "agent", 2);
|
|
7976
|
+
__decorateClass([
|
|
7977
|
+
ManyToOne27(() => KnowledgeBaseDocument, { onDelete: "CASCADE" }),
|
|
7978
|
+
JoinColumn27({ name: "documentId" })
|
|
7979
|
+
], LlmAgentKnowledgeDocument.prototype, "document", 2);
|
|
7980
|
+
LlmAgentKnowledgeDocument = __decorateClass([
|
|
7981
|
+
Entity40("llm_agent_knowledge_documents"),
|
|
7982
|
+
Unique2("UQ_llm_agent_knowledge_agent_document", ["agentId", "documentId"]),
|
|
7983
|
+
Index2("IDX_llm_agent_knowledge_agent", ["agentId"])
|
|
7984
|
+
], LlmAgentKnowledgeDocument);
|
|
7985
|
+
|
|
7382
7986
|
// src/entities/index.ts
|
|
7383
7987
|
var CMS_ENTITY_MAP = {
|
|
7384
7988
|
users: User,
|
|
@@ -7418,7 +8022,9 @@ var CMS_ENTITY_MAP = {
|
|
|
7418
8022
|
carts: Cart,
|
|
7419
8023
|
cart_items: CartItem,
|
|
7420
8024
|
wishlists: Wishlist,
|
|
7421
|
-
wishlist_items: WishlistItem
|
|
8025
|
+
wishlist_items: WishlistItem,
|
|
8026
|
+
llm_agents: LlmAgent,
|
|
8027
|
+
llm_agent_knowledge_documents: LlmAgentKnowledgeDocument
|
|
7422
8028
|
};
|
|
7423
8029
|
|
|
7424
8030
|
// src/auth/permission-entities.ts
|
|
@@ -8593,6 +9199,314 @@ function createUserAuthApiRouter(config) {
|
|
|
8593
9199
|
};
|
|
8594
9200
|
}
|
|
8595
9201
|
|
|
9202
|
+
// src/api/llm-agent-knowledge-handlers.ts
|
|
9203
|
+
import { In as In2 } from "typeorm";
|
|
9204
|
+
var INGEST_CHUNK_CHARS = 900;
|
|
9205
|
+
var MAX_CHUNKS_PER_UPLOAD = 400;
|
|
9206
|
+
var EMBED_CONCURRENCY = 5;
|
|
9207
|
+
var MAX_PDF_BYTES = 25 * 1024 * 1024;
|
|
9208
|
+
var TEXT_FILE_TYPES = /* @__PURE__ */ new Set(["text/plain", "text/markdown", "application/json"]);
|
|
9209
|
+
var KB_LOG = "[llm-agent-knowledge]";
|
|
9210
|
+
function llmEmbedDebug() {
|
|
9211
|
+
const v = process.env.LLM_EMBED_DEBUG?.toLowerCase();
|
|
9212
|
+
return v === "1" || v === "true" || v === "yes";
|
|
9213
|
+
}
|
|
9214
|
+
function isPdfUpload(mime, fileName) {
|
|
9215
|
+
if (mime === "application/pdf") return true;
|
|
9216
|
+
const n = fileName.toLowerCase();
|
|
9217
|
+
return n.endsWith(".pdf");
|
|
9218
|
+
}
|
|
9219
|
+
async function extractTextFromPdf(buffer) {
|
|
9220
|
+
const pdfParse = await import("pdf-parse");
|
|
9221
|
+
const data = await pdfParse(buffer);
|
|
9222
|
+
return (data?.text ?? "").trim();
|
|
9223
|
+
}
|
|
9224
|
+
async function writeEmbeddingsConcurrent(dataSource, embed, chunks, concurrency) {
|
|
9225
|
+
let next = 0;
|
|
9226
|
+
let written = 0;
|
|
9227
|
+
let failed = 0;
|
|
9228
|
+
let skippedEmpty = 0;
|
|
9229
|
+
async function worker() {
|
|
9230
|
+
for (; ; ) {
|
|
9231
|
+
const i = next++;
|
|
9232
|
+
if (i >= chunks.length) return;
|
|
9233
|
+
const c = chunks[i];
|
|
9234
|
+
try {
|
|
9235
|
+
const emb = await embed(c.content);
|
|
9236
|
+
if (emb?.length) {
|
|
9237
|
+
const vectorStr = "[" + emb.join(",") + "]";
|
|
9238
|
+
await dataSource.query(
|
|
9239
|
+
`UPDATE knowledge_base_chunks SET embedding = $1::vector WHERE id = $2`,
|
|
9240
|
+
[vectorStr, c.id]
|
|
9241
|
+
);
|
|
9242
|
+
written++;
|
|
9243
|
+
} else {
|
|
9244
|
+
skippedEmpty++;
|
|
9245
|
+
if (llmEmbedDebug()) {
|
|
9246
|
+
console.warn(`${KB_LOG} embed() returned empty vector`, { chunkId: c.id });
|
|
9247
|
+
}
|
|
9248
|
+
}
|
|
9249
|
+
} catch (err) {
|
|
9250
|
+
failed++;
|
|
9251
|
+
console.error(`${KB_LOG} embedding DB update failed`, {
|
|
9252
|
+
chunkId: c.id,
|
|
9253
|
+
err: err instanceof Error ? err.message : String(err)
|
|
9254
|
+
});
|
|
9255
|
+
}
|
|
9256
|
+
}
|
|
9257
|
+
}
|
|
9258
|
+
const n = Math.max(1, Math.min(concurrency, chunks.length));
|
|
9259
|
+
await Promise.all(Array.from({ length: n }, () => worker()));
|
|
9260
|
+
const summary = {
|
|
9261
|
+
chunkCount: chunks.length,
|
|
9262
|
+
written,
|
|
9263
|
+
failed,
|
|
9264
|
+
skippedEmpty
|
|
9265
|
+
};
|
|
9266
|
+
if (skippedEmpty > 0 && written === 0) {
|
|
9267
|
+
summary.hint = "embed() returned empty vectors \u2014 see [LLM embed] logs (often HTTP 404 on /v1/embeddings, or wrong response shape).";
|
|
9268
|
+
}
|
|
9269
|
+
console.error(`${KB_LOG} embedding pass finished`, summary);
|
|
9270
|
+
return { written, failed };
|
|
9271
|
+
}
|
|
9272
|
+
function splitIntoChunks(text, maxLen) {
|
|
9273
|
+
const t = text.trim();
|
|
9274
|
+
if (!t) return [];
|
|
9275
|
+
const chunks = [];
|
|
9276
|
+
for (let i = 0; i < t.length; i += maxLen) {
|
|
9277
|
+
chunks.push(t.slice(i, i + maxLen));
|
|
9278
|
+
}
|
|
9279
|
+
return chunks;
|
|
9280
|
+
}
|
|
9281
|
+
async function findAgentBySlug(dataSource, llmAgents, slug) {
|
|
9282
|
+
const repo = dataSource.getRepository(llmAgents);
|
|
9283
|
+
return repo.findOne({
|
|
9284
|
+
where: { slug, deleted: false }
|
|
9285
|
+
});
|
|
9286
|
+
}
|
|
9287
|
+
function createLlmAgentKnowledgeHandlers(config) {
|
|
9288
|
+
const { dataSource, entityMap, getCms, json, requireAuth, requireEntityPermission } = config;
|
|
9289
|
+
const kbDoc = entityMap.knowledge_base_documents;
|
|
9290
|
+
const kbChunk = entityMap.knowledge_base_chunks;
|
|
9291
|
+
const llmAgents = entityMap.llm_agents;
|
|
9292
|
+
const junction = entityMap.llm_agent_knowledge_documents;
|
|
9293
|
+
if (!kbDoc || !kbChunk || !llmAgents || !junction) {
|
|
9294
|
+
return null;
|
|
9295
|
+
}
|
|
9296
|
+
async function gate(req, action) {
|
|
9297
|
+
const a = await requireAuth(req);
|
|
9298
|
+
if (a) return a;
|
|
9299
|
+
if (requireEntityPermission) {
|
|
9300
|
+
const pe = await requireEntityPermission(req, "llm_agents", action);
|
|
9301
|
+
if (pe) return pe;
|
|
9302
|
+
}
|
|
9303
|
+
return null;
|
|
9304
|
+
}
|
|
9305
|
+
return {
|
|
9306
|
+
async list(req, slug) {
|
|
9307
|
+
const denied = await gate(req, "read");
|
|
9308
|
+
if (denied) return denied;
|
|
9309
|
+
try {
|
|
9310
|
+
const agent = await findAgentBySlug(dataSource, llmAgents, slug);
|
|
9311
|
+
if (!agent) return json({ error: "Agent not found" }, { status: 404 });
|
|
9312
|
+
const linkRepo = dataSource.getRepository(junction);
|
|
9313
|
+
const links = await linkRepo.find({ where: { agentId: agent.id } });
|
|
9314
|
+
const docIds = [...new Set(links.map((l) => l.documentId))];
|
|
9315
|
+
if (docIds.length === 0) return json({ documents: [] });
|
|
9316
|
+
const docRepo = dataSource.getRepository(kbDoc);
|
|
9317
|
+
const docs = await docRepo.find({ where: { id: In2(docIds) } });
|
|
9318
|
+
const byId = new Map(docs.map((d) => [d.id, d]));
|
|
9319
|
+
const documents = docIds.map((id) => {
|
|
9320
|
+
const d = byId.get(id);
|
|
9321
|
+
return d ? { id: d.id, name: d.name } : null;
|
|
9322
|
+
}).filter(Boolean);
|
|
9323
|
+
return json({ documents });
|
|
9324
|
+
} catch (err) {
|
|
9325
|
+
const msg = err instanceof Error ? err.message : "Failed to list knowledge";
|
|
9326
|
+
return json({ error: msg }, { status: 500 });
|
|
9327
|
+
}
|
|
9328
|
+
},
|
|
9329
|
+
async post(req, slug) {
|
|
9330
|
+
const denied = await gate(req, "update");
|
|
9331
|
+
if (denied) return denied;
|
|
9332
|
+
try {
|
|
9333
|
+
const agent = await findAgentBySlug(dataSource, llmAgents, slug);
|
|
9334
|
+
if (!agent) return json({ error: "Agent not found" }, { status: 404 });
|
|
9335
|
+
let name = "";
|
|
9336
|
+
let text = "";
|
|
9337
|
+
let sourceUrl = null;
|
|
9338
|
+
let existingDocumentId = null;
|
|
9339
|
+
const ct = req.headers.get("content-type") || "";
|
|
9340
|
+
if (ct.includes("application/json")) {
|
|
9341
|
+
const body = await req.json();
|
|
9342
|
+
existingDocumentId = typeof body?.documentId === "number" && Number.isFinite(body.documentId) ? body.documentId : null;
|
|
9343
|
+
name = (body?.name ?? "").trim();
|
|
9344
|
+
text = (body?.text ?? "").trim();
|
|
9345
|
+
sourceUrl = typeof body?.sourceUrl === "string" && body.sourceUrl.trim() ? body.sourceUrl.trim() : null;
|
|
9346
|
+
} else if (ct.includes("multipart/form-data")) {
|
|
9347
|
+
const form = await req.formData();
|
|
9348
|
+
name = form.get("name")?.trim() ?? "";
|
|
9349
|
+
text = form.get("text")?.trim() ?? "";
|
|
9350
|
+
const file = form.get("file");
|
|
9351
|
+
if (file && typeof file !== "string" && "arrayBuffer" in file) {
|
|
9352
|
+
const f = file;
|
|
9353
|
+
const mime = (f.type || "").split(";")[0].trim().toLowerCase();
|
|
9354
|
+
const buf = Buffer.from(await f.arrayBuffer());
|
|
9355
|
+
if (TEXT_FILE_TYPES.has(mime)) {
|
|
9356
|
+
const decoded = buf.toString("utf8");
|
|
9357
|
+
if (!text) text = decoded;
|
|
9358
|
+
} else if (isPdfUpload(mime, f.name || "")) {
|
|
9359
|
+
if (buf.length > MAX_PDF_BYTES) {
|
|
9360
|
+
return json(
|
|
9361
|
+
{ error: `PDF too large (max ${Math.floor(MAX_PDF_BYTES / (1024 * 1024))}MB)` },
|
|
9362
|
+
{ status: 413 }
|
|
9363
|
+
);
|
|
9364
|
+
}
|
|
9365
|
+
try {
|
|
9366
|
+
const extracted = await extractTextFromPdf(buf);
|
|
9367
|
+
if (!text) text = extracted;
|
|
9368
|
+
} catch {
|
|
9369
|
+
return json(
|
|
9370
|
+
{ error: "Could not read PDF text (file may be encrypted, corrupt, or image-only)" },
|
|
9371
|
+
{ status: 422 }
|
|
9372
|
+
);
|
|
9373
|
+
}
|
|
9374
|
+
} else {
|
|
9375
|
+
return json(
|
|
9376
|
+
{
|
|
9377
|
+
error: "Unsupported file type; use text/plain, text/markdown, application/json, or application/pdf"
|
|
9378
|
+
},
|
|
9379
|
+
{ status: 415 }
|
|
9380
|
+
);
|
|
9381
|
+
}
|
|
9382
|
+
if (!name && f.name) name = f.name.replace(/\.[^/.]+$/, "") || f.name;
|
|
9383
|
+
}
|
|
9384
|
+
} else {
|
|
9385
|
+
return json({ error: "Use application/json or multipart/form-data" }, { status: 400 });
|
|
9386
|
+
}
|
|
9387
|
+
const linkRepo = dataSource.getRepository(junction);
|
|
9388
|
+
if (existingDocumentId != null) {
|
|
9389
|
+
const docRepo2 = dataSource.getRepository(kbDoc);
|
|
9390
|
+
const existing = await docRepo2.findOne({ where: { id: existingDocumentId } });
|
|
9391
|
+
if (!existing) return json({ error: "documentId not found" }, { status: 404 });
|
|
9392
|
+
const dup2 = await linkRepo.findOne({
|
|
9393
|
+
where: { agentId: agent.id, documentId: existingDocumentId }
|
|
9394
|
+
});
|
|
9395
|
+
if (!dup2) {
|
|
9396
|
+
await linkRepo.save(linkRepo.create({ agentId: agent.id, documentId: existingDocumentId }));
|
|
9397
|
+
}
|
|
9398
|
+
return json({ documentId: existingDocumentId, linked: true, created: false });
|
|
9399
|
+
}
|
|
9400
|
+
if (!text) return json({ error: "text or file with text content is required" }, { status: 400 });
|
|
9401
|
+
if (!name) name = "Untitled";
|
|
9402
|
+
const parts = splitIntoChunks(text, INGEST_CHUNK_CHARS);
|
|
9403
|
+
if (parts.length === 0) {
|
|
9404
|
+
return json({ error: "text or file with text content is required" }, { status: 400 });
|
|
9405
|
+
}
|
|
9406
|
+
if (parts.length > MAX_CHUNKS_PER_UPLOAD) {
|
|
9407
|
+
return json(
|
|
9408
|
+
{
|
|
9409
|
+
error: `Document is too large for one upload (${parts.length} chunks; max ${MAX_CHUNKS_PER_UPLOAD}). Split into smaller files.`
|
|
9410
|
+
},
|
|
9411
|
+
{ status: 413 }
|
|
9412
|
+
);
|
|
9413
|
+
}
|
|
9414
|
+
const docRepo = dataSource.getRepository(kbDoc);
|
|
9415
|
+
const chunkRepo = dataSource.getRepository(kbChunk);
|
|
9416
|
+
const now = /* @__PURE__ */ new Date();
|
|
9417
|
+
const doc = await docRepo.save(
|
|
9418
|
+
docRepo.create({ name, content: text, sourceUrl, createdAt: now, updatedAt: now })
|
|
9419
|
+
);
|
|
9420
|
+
const docId = doc.id;
|
|
9421
|
+
const chunkRows = parts.map(
|
|
9422
|
+
(content, i) => chunkRepo.create({ documentId: docId, content, chunkIndex: i, createdAt: now })
|
|
9423
|
+
);
|
|
9424
|
+
const savedList = await chunkRepo.save(chunkRows);
|
|
9425
|
+
const savedChunks = savedList.map(
|
|
9426
|
+
(row, i) => ({
|
|
9427
|
+
id: row.id,
|
|
9428
|
+
content: parts[i]
|
|
9429
|
+
})
|
|
9430
|
+
);
|
|
9431
|
+
const dup = await linkRepo.findOne({ where: { agentId: agent.id, documentId: docId } });
|
|
9432
|
+
if (!dup) {
|
|
9433
|
+
await linkRepo.save(linkRepo.create({ agentId: agent.id, documentId: docId }));
|
|
9434
|
+
}
|
|
9435
|
+
let embeddingsWritten = 0;
|
|
9436
|
+
let embeddingsFailed = 0;
|
|
9437
|
+
try {
|
|
9438
|
+
const cms = await getCms();
|
|
9439
|
+
const llm = cms.getPlugin("llm");
|
|
9440
|
+
if (llm?.embed && savedChunks.length > 0) {
|
|
9441
|
+
console.info(`${KB_LOG} starting embedding pass`, { slug, chunkCount: savedChunks.length });
|
|
9442
|
+
const embedBound = (text2) => llm.embed(text2);
|
|
9443
|
+
const { written, failed } = await writeEmbeddingsConcurrent(
|
|
9444
|
+
dataSource,
|
|
9445
|
+
embedBound,
|
|
9446
|
+
savedChunks,
|
|
9447
|
+
EMBED_CONCURRENCY
|
|
9448
|
+
);
|
|
9449
|
+
embeddingsWritten = written;
|
|
9450
|
+
embeddingsFailed = failed;
|
|
9451
|
+
} else {
|
|
9452
|
+
console.error(`${KB_LOG} embeddings skipped`, {
|
|
9453
|
+
slug,
|
|
9454
|
+
hasLlmPlugin: !!llm,
|
|
9455
|
+
hasEmbed: typeof llm?.embed === "function",
|
|
9456
|
+
chunkCount: savedChunks.length,
|
|
9457
|
+
hint: !llm || typeof llm.embed !== "function" ? "LLM plugin missing or no embed(); check LLM_GATEWAY_URL + LLM_API_KEY so llm plugin initializes." : void 0
|
|
9458
|
+
});
|
|
9459
|
+
}
|
|
9460
|
+
} catch (embErr) {
|
|
9461
|
+
const detail = embErr instanceof Error ? embErr.message : String(embErr);
|
|
9462
|
+
console.error(`${KB_LOG} embedding step threw before/during batch`, { slug, detail, embErr });
|
|
9463
|
+
return json(
|
|
9464
|
+
{
|
|
9465
|
+
documentId: docId,
|
|
9466
|
+
chunkCount: savedChunks.length,
|
|
9467
|
+
created: true,
|
|
9468
|
+
linked: true,
|
|
9469
|
+
embeddingsWritten: 0,
|
|
9470
|
+
embeddingsFailed: savedChunks.length,
|
|
9471
|
+
warning: "Document saved and linked; embedding step failed.",
|
|
9472
|
+
detail
|
|
9473
|
+
},
|
|
9474
|
+
{ status: 201 }
|
|
9475
|
+
);
|
|
9476
|
+
}
|
|
9477
|
+
return json({
|
|
9478
|
+
documentId: docId,
|
|
9479
|
+
chunkCount: savedChunks.length,
|
|
9480
|
+
created: true,
|
|
9481
|
+
linked: true,
|
|
9482
|
+
embeddingsWritten,
|
|
9483
|
+
embeddingsFailed
|
|
9484
|
+
});
|
|
9485
|
+
} catch (err) {
|
|
9486
|
+
const msg = err instanceof Error ? err.message : "Failed to ingest knowledge";
|
|
9487
|
+
const name = err instanceof Error ? err.name : "";
|
|
9488
|
+
return json({ error: msg, errorName: name || void 0 }, { status: 500 });
|
|
9489
|
+
}
|
|
9490
|
+
},
|
|
9491
|
+
async unlink(req, slug, documentIdStr) {
|
|
9492
|
+
const denied = await gate(req, "update");
|
|
9493
|
+
if (denied) return denied;
|
|
9494
|
+
const documentId = parseInt(documentIdStr, 10);
|
|
9495
|
+
if (!Number.isFinite(documentId)) return json({ error: "Invalid document id" }, { status: 400 });
|
|
9496
|
+
try {
|
|
9497
|
+
const agent = await findAgentBySlug(dataSource, llmAgents, slug);
|
|
9498
|
+
if (!agent) return json({ error: "Agent not found" }, { status: 404 });
|
|
9499
|
+
const linkRepo = dataSource.getRepository(junction);
|
|
9500
|
+
await linkRepo.delete({ agentId: agent.id, documentId });
|
|
9501
|
+
return json({ ok: true });
|
|
9502
|
+
} catch (err) {
|
|
9503
|
+
const msg = err instanceof Error ? err.message : "Failed to unlink";
|
|
9504
|
+
return json({ error: msg }, { status: 500 });
|
|
9505
|
+
}
|
|
9506
|
+
}
|
|
9507
|
+
};
|
|
9508
|
+
}
|
|
9509
|
+
|
|
8596
9510
|
// src/api/message-template-admin-handlers.ts
|
|
8597
9511
|
init_sms_defaults();
|
|
8598
9512
|
function createSmsMessageTemplateHandlers(config) {
|
|
@@ -8842,6 +9756,26 @@ function createAdminRolesHandlers(config) {
|
|
|
8842
9756
|
}
|
|
8843
9757
|
|
|
8844
9758
|
// src/api/cms-api-handler.ts
|
|
9759
|
+
var KNOWLEDGE_SUFFIX = "knowledge";
|
|
9760
|
+
function matchLlmAgentKnowledgeRoute(path) {
|
|
9761
|
+
const p = path[0] === "api" ? path.slice(1) : path;
|
|
9762
|
+
if (p[0] !== "llm_agents" || p.length < 2) return null;
|
|
9763
|
+
const seg1 = p[1];
|
|
9764
|
+
if (!seg1) return null;
|
|
9765
|
+
if (p[2] === KNOWLEDGE_SUFFIX) {
|
|
9766
|
+
return {
|
|
9767
|
+
slug: seg1,
|
|
9768
|
+
documentId: p.length >= 4 ? p[3] : void 0
|
|
9769
|
+
};
|
|
9770
|
+
}
|
|
9771
|
+
if (seg1.endsWith(KNOWLEDGE_SUFFIX) && seg1.length > KNOWLEDGE_SUFFIX.length) {
|
|
9772
|
+
const slug = seg1.slice(0, -KNOWLEDGE_SUFFIX.length);
|
|
9773
|
+
if (!slug) return null;
|
|
9774
|
+
if (p.length === 2) return { slug, documentId: void 0 };
|
|
9775
|
+
if (p.length === 3) return { slug, documentId: p[2] };
|
|
9776
|
+
}
|
|
9777
|
+
return null;
|
|
9778
|
+
}
|
|
8845
9779
|
var DEFAULT_EXCLUDE = /* @__PURE__ */ new Set([
|
|
8846
9780
|
"users",
|
|
8847
9781
|
"password_reset_tokens",
|
|
@@ -8854,7 +9788,8 @@ var DEFAULT_EXCLUDE = /* @__PURE__ */ new Set([
|
|
|
8854
9788
|
"cart_items",
|
|
8855
9789
|
"wishlists",
|
|
8856
9790
|
"wishlist_items",
|
|
8857
|
-
"message_templates"
|
|
9791
|
+
"message_templates",
|
|
9792
|
+
"llm_agent_knowledge_documents"
|
|
8858
9793
|
]);
|
|
8859
9794
|
function createCmsApiHandler(config) {
|
|
8860
9795
|
const {
|
|
@@ -8878,6 +9813,7 @@ function createCmsApiHandler(config) {
|
|
|
8878
9813
|
userProfile,
|
|
8879
9814
|
settings: settingsConfig,
|
|
8880
9815
|
chat: chatConfig,
|
|
9816
|
+
llmAgentKnowledge: llmAgentKnowledgeConfig,
|
|
8881
9817
|
requireEntityPermission: userRequireEntityPermission,
|
|
8882
9818
|
getSessionUser
|
|
8883
9819
|
} = config;
|
|
@@ -8985,6 +9921,17 @@ function createCmsApiHandler(config) {
|
|
|
8985
9921
|
requireEntityPermission: requireEntityPermissionEffective
|
|
8986
9922
|
});
|
|
8987
9923
|
const chatHandlers = chatConfig ? createChatHandlers(chatConfig) : null;
|
|
9924
|
+
const llmAgentKnowledgeMerged = llmAgentKnowledgeConfig ?? (chatConfig ? {
|
|
9925
|
+
dataSource: chatConfig.dataSource,
|
|
9926
|
+
entityMap: chatConfig.entityMap,
|
|
9927
|
+
getCms: chatConfig.getCms,
|
|
9928
|
+
json: chatConfig.json,
|
|
9929
|
+
requireAuth: chatConfig.requireAuth
|
|
9930
|
+
} : void 0);
|
|
9931
|
+
const llmAgentKnowledgeHandlers = llmAgentKnowledgeMerged ? createLlmAgentKnowledgeHandlers({
|
|
9932
|
+
...llmAgentKnowledgeMerged,
|
|
9933
|
+
requireEntityPermission: requireEntityPermissionEffective
|
|
9934
|
+
}) : null;
|
|
8988
9935
|
function resolveResource(segment) {
|
|
8989
9936
|
const model = pathToModel(segment);
|
|
8990
9937
|
return crudResources.includes(model) ? model : segment;
|
|
@@ -9096,7 +10043,32 @@ function createCmsApiHandler(config) {
|
|
|
9096
10043
|
if (method === "GET") return smsMessageTemplateHandlers.GET(req);
|
|
9097
10044
|
if (method === "PUT") return smsMessageTemplateHandlers.PUT(req);
|
|
9098
10045
|
}
|
|
10046
|
+
{
|
|
10047
|
+
const kbMatch = matchLlmAgentKnowledgeRoute(path);
|
|
10048
|
+
if (kbMatch) {
|
|
10049
|
+
if (!llmAgentKnowledgeHandlers) {
|
|
10050
|
+
return config.json(
|
|
10051
|
+
{
|
|
10052
|
+
error: "LLM agent knowledge is not available",
|
|
10053
|
+
hint: "With chat enabled, routes usually work automatically. Otherwise pass llmAgentKnowledge. If this persists, ensure entityMap includes knowledge_base_documents, knowledge_base_chunks, llm_agent_knowledge_documents, and run migrations."
|
|
10054
|
+
},
|
|
10055
|
+
{ status: 503 }
|
|
10056
|
+
);
|
|
10057
|
+
}
|
|
10058
|
+
const { slug, documentId } = kbMatch;
|
|
10059
|
+
if (method === "DELETE" && documentId != null && documentId !== "") {
|
|
10060
|
+
return llmAgentKnowledgeHandlers.unlink(req, slug, documentId);
|
|
10061
|
+
}
|
|
10062
|
+
if (method === "GET" && (documentId == null || documentId === "")) {
|
|
10063
|
+
return llmAgentKnowledgeHandlers.list(req, slug);
|
|
10064
|
+
}
|
|
10065
|
+
if (method === "POST" && (documentId == null || documentId === "")) {
|
|
10066
|
+
return llmAgentKnowledgeHandlers.post(req, slug);
|
|
10067
|
+
}
|
|
10068
|
+
}
|
|
10069
|
+
}
|
|
9099
10070
|
if (path[0] === "chat" && chatHandlers) {
|
|
10071
|
+
if (path.length === 2 && path[1] === "config" && method === "GET") return chatHandlers.publicConfig(req);
|
|
9100
10072
|
if (path.length === 2 && path[1] === "identify" && method === "POST") return chatHandlers.identify(req);
|
|
9101
10073
|
if (path.length === 4 && path[1] === "conversations" && path[3] === "messages" && method === "GET") return chatHandlers.getMessages(req, path[2]);
|
|
9102
10074
|
if (path.length === 2 && path[1] === "messages" && method === "POST") return chatHandlers.postMessage(req);
|
|
@@ -9165,7 +10137,7 @@ function createCmsApiHandler(config) {
|
|
|
9165
10137
|
}
|
|
9166
10138
|
|
|
9167
10139
|
// src/api/storefront-handlers.ts
|
|
9168
|
-
import { In as
|
|
10140
|
+
import { In as In3, IsNull as IsNull4 } from "typeorm";
|
|
9169
10141
|
|
|
9170
10142
|
// src/lib/is-valid-signup-email.ts
|
|
9171
10143
|
var MAX_EMAIL = 254;
|
|
@@ -10437,7 +11409,7 @@ function createStorefrontApiHandler(config) {
|
|
|
10437
11409
|
const previewByOrder = {};
|
|
10438
11410
|
if (orderIds.length) {
|
|
10439
11411
|
const oItems = await orderItemRepo().find({
|
|
10440
|
-
where: { orderId:
|
|
11412
|
+
where: { orderId: In3(orderIds) },
|
|
10441
11413
|
relations: ["product"],
|
|
10442
11414
|
order: { id: "ASC" }
|
|
10443
11415
|
});
|
|
@@ -10601,6 +11573,7 @@ export {
|
|
|
10601
11573
|
FormSubmission,
|
|
10602
11574
|
KnowledgeBaseChunk,
|
|
10603
11575
|
KnowledgeBaseDocument,
|
|
11576
|
+
LlmAgent,
|
|
10604
11577
|
LlmService,
|
|
10605
11578
|
Media,
|
|
10606
11579
|
MessageTemplate,
|
|
@@ -10650,6 +11623,7 @@ export {
|
|
|
10650
11623
|
createForgotPasswordHandler,
|
|
10651
11624
|
createFormBySlugHandler,
|
|
10652
11625
|
createInviteAcceptHandler,
|
|
11626
|
+
createLlmAgentKnowledgeHandlers,
|
|
10653
11627
|
createMediaZipExtractHandler,
|
|
10654
11628
|
createOtpChallenge,
|
|
10655
11629
|
createSetPasswordHandler,
|
|
@@ -10683,13 +11657,17 @@ export {
|
|
|
10683
11657
|
isZipMedia,
|
|
10684
11658
|
joinRecipientsForSend,
|
|
10685
11659
|
linkUnclaimedContactToUser,
|
|
11660
|
+
llmAgentToChatAgentOptions,
|
|
10686
11661
|
llmPlugin,
|
|
10687
11662
|
loadPublicThemeSettings,
|
|
10688
11663
|
localStoragePlugin,
|
|
10689
11664
|
mergeEmailLayoutCompanyDetails,
|
|
11665
|
+
mergeGuardrailsIntoSystemPrompt,
|
|
10690
11666
|
mergeSeoBySlug,
|
|
10691
11667
|
normalizePhoneE164,
|
|
10692
11668
|
parseEmailRecipientsFromConfig,
|
|
11669
|
+
parseHfInferenceEmbeddingBody,
|
|
11670
|
+
parseLlmAgentValidationRules,
|
|
10693
11671
|
paymentPlugin,
|
|
10694
11672
|
permissionRowsToRecord,
|
|
10695
11673
|
queueEmail,
|
|
@@ -10721,6 +11699,8 @@ export {
|
|
|
10721
11699
|
smsPlugin,
|
|
10722
11700
|
truncateText,
|
|
10723
11701
|
validateSlug,
|
|
11702
|
+
validateUserMessageAgainstAgentRules,
|
|
11703
|
+
validateUserMessageAgainstStructuredRules,
|
|
10724
11704
|
verifyAndConsumeOtpChallenge,
|
|
10725
11705
|
verifyOtpCodeHash
|
|
10726
11706
|
};
|