@infuro/cms-core 1.0.20 → 1.0.22
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 +194 -75
- package/dist/admin.cjs.map +1 -1
- package/dist/admin.js +188 -70
- package/dist/admin.js.map +1 -1
- package/dist/api.cjs +3230 -259
- 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 +3232 -252
- package/dist/api.js.map +1 -1
- package/dist/{index-DGtM2Gsk.d.cts → index-BGAh4fPQ.d.cts} +18 -1
- package/dist/{index--GBYw5JE.d.ts → index-Cnwh7B3r.d.ts} +18 -1
- package/dist/index.cjs +753 -209
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -9
- package/dist/index.d.ts +34 -9
- package/dist/index.js +753 -209
- package/dist/index.js.map +1 -1
- package/dist/migrations/1775300000000-LlmAgents.ts +57 -57
- package/dist/migrations/1775300000001-LlmAgentsValidationRulesText.ts +43 -43
- package/dist/migrations/1775300000002-SeedLlmAgentsPermissions.ts +33 -33
- package/dist/migrations/1775300000003-LlmAgentKnowledgeDocuments.ts +50 -50
- package/package.json +2 -1
package/dist/api.js
CHANGED
|
@@ -477,6 +477,13 @@ async function queueErpProductUpsertIfEnabled(cms, dataSource, entityMap, produc
|
|
|
477
477
|
}
|
|
478
478
|
|
|
479
479
|
// src/api/crud.ts
|
|
480
|
+
var CRUD_LOG = "[cms-crud]";
|
|
481
|
+
function logCrudClientError(op, detail) {
|
|
482
|
+
console.warn(CRUD_LOG, op, detail);
|
|
483
|
+
}
|
|
484
|
+
function logCrudServerError(op, detail) {
|
|
485
|
+
console.error(CRUD_LOG, op, detail);
|
|
486
|
+
}
|
|
480
487
|
var DATE_COLUMN_TYPES = /* @__PURE__ */ new Set([
|
|
481
488
|
"date",
|
|
482
489
|
"datetime",
|
|
@@ -588,6 +595,13 @@ function createCrudHandler(dataSource, entityMap, options) {
|
|
|
588
595
|
if (authError) return authError;
|
|
589
596
|
const entity = entityMap[resource];
|
|
590
597
|
if (!resource || !entity) {
|
|
598
|
+
logCrudClientError("GET list", {
|
|
599
|
+
reason: "invalid_resource",
|
|
600
|
+
resource,
|
|
601
|
+
hasEntity: Boolean(entity),
|
|
602
|
+
entityMapHasLlmAgents: Boolean(entityMap.llm_agents),
|
|
603
|
+
entityMapKeyCount: Object.keys(entityMap).length
|
|
604
|
+
});
|
|
591
605
|
return json({ error: "Invalid resource" }, { status: 400 });
|
|
592
606
|
}
|
|
593
607
|
const { searchParams } = new URL(req.url);
|
|
@@ -795,12 +809,22 @@ function createCrudHandler(dataSource, entityMap, options) {
|
|
|
795
809
|
}
|
|
796
810
|
}
|
|
797
811
|
where = mergeDeletedFalseWhere(repo, where);
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
812
|
+
let data;
|
|
813
|
+
let total;
|
|
814
|
+
try {
|
|
815
|
+
const r = await repo.findAndCount({
|
|
816
|
+
skip,
|
|
817
|
+
take: limit,
|
|
818
|
+
order: { [sortField]: sortOrder },
|
|
819
|
+
where
|
|
820
|
+
});
|
|
821
|
+
data = r[0];
|
|
822
|
+
total = r[1];
|
|
823
|
+
} catch (err) {
|
|
824
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
825
|
+
logCrudServerError("GET list query failed", { resource, sortField, sortOrder, message });
|
|
826
|
+
throw err;
|
|
827
|
+
}
|
|
804
828
|
return json({ total, page, limit, totalPages: Math.ceil(total / limit), data });
|
|
805
829
|
},
|
|
806
830
|
async POST(req, resource) {
|
|
@@ -808,12 +832,25 @@ function createCrudHandler(dataSource, entityMap, options) {
|
|
|
808
832
|
if (authError) return authError;
|
|
809
833
|
const entity = entityMap[resource];
|
|
810
834
|
if (!resource || !entity) {
|
|
835
|
+
logCrudClientError("POST create", {
|
|
836
|
+
reason: "invalid_resource",
|
|
837
|
+
resource,
|
|
838
|
+
hasEntity: Boolean(entity),
|
|
839
|
+
entityMapHasLlmAgents: Boolean(entityMap.llm_agents)
|
|
840
|
+
});
|
|
811
841
|
return json({ error: "Invalid resource" }, { status: 400 });
|
|
812
842
|
}
|
|
813
|
-
const
|
|
814
|
-
if (!
|
|
843
|
+
const rawPostBody = await req.json();
|
|
844
|
+
if (!rawPostBody || typeof rawPostBody !== "object" || Object.keys(rawPostBody).length === 0) {
|
|
845
|
+
logCrudClientError("POST create", {
|
|
846
|
+
reason: "invalid_request_payload",
|
|
847
|
+
resource,
|
|
848
|
+
rawType: rawPostBody == null ? "nullish" : typeof rawPostBody,
|
|
849
|
+
keyCount: rawPostBody && typeof rawPostBody === "object" ? Object.keys(rawPostBody).length : 0
|
|
850
|
+
});
|
|
815
851
|
return json({ error: "Invalid request payload" }, { status: 400 });
|
|
816
852
|
}
|
|
853
|
+
const body = rawPostBody;
|
|
817
854
|
if (resource === "media") {
|
|
818
855
|
const b = body;
|
|
819
856
|
const kind = b.kind === "folder" ? "folder" : "file";
|
|
@@ -847,8 +884,24 @@ function createCrudHandler(dataSource, entityMap, options) {
|
|
|
847
884
|
}
|
|
848
885
|
}
|
|
849
886
|
const repo = dataSource.getRepository(entity);
|
|
850
|
-
|
|
851
|
-
|
|
887
|
+
const persistBody = resource === "media" ? body : pickColumnUpdates(repo, body);
|
|
888
|
+
if (resource !== "media" && Object.keys(persistBody).length === 0) {
|
|
889
|
+
logCrudClientError("POST create", {
|
|
890
|
+
reason: "no_scalar_columns_after_pick",
|
|
891
|
+
resource,
|
|
892
|
+
incomingKeys: Object.keys(body)
|
|
893
|
+
});
|
|
894
|
+
return json({ error: "Invalid request payload" }, { status: 400 });
|
|
895
|
+
}
|
|
896
|
+
sanitizeBodyForEntity(repo, persistBody);
|
|
897
|
+
let created;
|
|
898
|
+
try {
|
|
899
|
+
created = await repo.save(repo.create(persistBody));
|
|
900
|
+
} catch (err) {
|
|
901
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
902
|
+
logCrudServerError("POST create save failed", { resource, message, persistKeys: Object.keys(persistBody) });
|
|
903
|
+
throw err;
|
|
904
|
+
}
|
|
852
905
|
if (resource === "contacts") {
|
|
853
906
|
await syncContactRowToErp(created);
|
|
854
907
|
}
|
|
@@ -863,6 +916,7 @@ function createCrudHandler(dataSource, entityMap, options) {
|
|
|
863
916
|
if (authError) return authError;
|
|
864
917
|
const entity = entityMap[resource];
|
|
865
918
|
if (!resource || !entity) {
|
|
919
|
+
logCrudClientError("GET_METADATA", { reason: "invalid_resource", resource });
|
|
866
920
|
return json({ error: "Invalid resource" }, { status: 400 });
|
|
867
921
|
}
|
|
868
922
|
const repo = dataSource.getRepository(entity);
|
|
@@ -894,11 +948,18 @@ function createCrudHandler(dataSource, entityMap, options) {
|
|
|
894
948
|
if (authError) return authError;
|
|
895
949
|
const entity = entityMap[resource];
|
|
896
950
|
if (!resource || !entity) {
|
|
951
|
+
logCrudClientError("BULK_POST", { reason: "invalid_resource", resource });
|
|
897
952
|
return json({ error: "Invalid resource" }, { status: 400 });
|
|
898
953
|
}
|
|
899
954
|
const body = await req.json();
|
|
900
955
|
const { records, upsertKey = "id" } = body;
|
|
901
956
|
if (!Array.isArray(records) || records.length === 0) {
|
|
957
|
+
logCrudClientError("BULK_POST", {
|
|
958
|
+
reason: "records_required",
|
|
959
|
+
resource,
|
|
960
|
+
recordsIsArray: Array.isArray(records),
|
|
961
|
+
recordCount: Array.isArray(records) ? records.length : 0
|
|
962
|
+
});
|
|
902
963
|
return json({ error: "Records array is required" }, { status: 400 });
|
|
903
964
|
}
|
|
904
965
|
const repo = dataSource.getRepository(entity);
|
|
@@ -917,6 +978,7 @@ function createCrudHandler(dataSource, entityMap, options) {
|
|
|
917
978
|
});
|
|
918
979
|
} catch (error) {
|
|
919
980
|
const message = error instanceof Error ? error.message : "Bulk import failed";
|
|
981
|
+
logCrudClientError("BULK_POST upsert failed", { resource, upsertKey, message });
|
|
920
982
|
return json({ error: message }, { status: 400 });
|
|
921
983
|
}
|
|
922
984
|
},
|
|
@@ -925,6 +987,7 @@ function createCrudHandler(dataSource, entityMap, options) {
|
|
|
925
987
|
if (authError) return authError;
|
|
926
988
|
const entity = entityMap[resource];
|
|
927
989
|
if (!resource || !entity) {
|
|
990
|
+
logCrudClientError("GET_EXPORT", { reason: "invalid_resource", resource });
|
|
928
991
|
return json({ error: "Invalid resource" }, { status: 400 });
|
|
929
992
|
}
|
|
930
993
|
const { searchParams } = new URL(req.url);
|
|
@@ -979,7 +1042,10 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
979
1042
|
const authError = await authz(req, resource, "read");
|
|
980
1043
|
if (authError) return authError;
|
|
981
1044
|
const entity = entityMap[resource];
|
|
982
|
-
if (!entity)
|
|
1045
|
+
if (!entity) {
|
|
1046
|
+
logCrudClientError("GET by id", { reason: "invalid_resource", resource, id });
|
|
1047
|
+
return json({ error: "Invalid resource" }, { status: 400 });
|
|
1048
|
+
}
|
|
983
1049
|
const repo = dataSource.getRepository(entity);
|
|
984
1050
|
if (resource === "orders") {
|
|
985
1051
|
const order = await repo.findOne({
|
|
@@ -1038,7 +1104,10 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
1038
1104
|
const authError = await authz(req, resource, "update");
|
|
1039
1105
|
if (authError) return authError;
|
|
1040
1106
|
const entity = entityMap[resource];
|
|
1041
|
-
if (!entity)
|
|
1107
|
+
if (!entity) {
|
|
1108
|
+
logCrudClientError("PUT by id", { reason: "invalid_resource", resource, id });
|
|
1109
|
+
return json({ error: "Invalid resource" }, { status: 400 });
|
|
1110
|
+
}
|
|
1042
1111
|
const rawBody = await req.json();
|
|
1043
1112
|
const repo = dataSource.getRepository(entity);
|
|
1044
1113
|
const numericId = Number(id);
|
|
@@ -1151,7 +1220,10 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
1151
1220
|
const authError = await authz(req, resource, "delete");
|
|
1152
1221
|
if (authError) return authError;
|
|
1153
1222
|
const entity = entityMap[resource];
|
|
1154
|
-
if (!entity)
|
|
1223
|
+
if (!entity) {
|
|
1224
|
+
logCrudClientError("DELETE by id", { reason: "invalid_resource", resource, id });
|
|
1225
|
+
return json({ error: "Invalid resource" }, { status: 400 });
|
|
1226
|
+
}
|
|
1155
1227
|
const repo = dataSource.getRepository(entity);
|
|
1156
1228
|
const numericId = Number(id);
|
|
1157
1229
|
if (entityHasSoftDelete(repo)) {
|
|
@@ -2822,15 +2894,33 @@ function createChatHandlers(config) {
|
|
|
2822
2894
|
const email = body?.email?.trim();
|
|
2823
2895
|
if (!name || !email) return json({ error: "name and email required" }, { status: 400 });
|
|
2824
2896
|
const repo = contactRepo();
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2897
|
+
const phone = body.phone?.trim() || null;
|
|
2898
|
+
const existing = await repo.findOne({ where: { email } });
|
|
2899
|
+
let contact;
|
|
2900
|
+
if (!existing) {
|
|
2901
|
+
contact = await repo.save(repo.create({ name, email, phone }));
|
|
2902
|
+
} else {
|
|
2903
|
+
const row = existing;
|
|
2904
|
+
if (row.deleted) {
|
|
2905
|
+
await repo.update(row.id, {
|
|
2906
|
+
deleted: false,
|
|
2907
|
+
deletedAt: null,
|
|
2908
|
+
deletedBy: null,
|
|
2909
|
+
name,
|
|
2910
|
+
phone
|
|
2911
|
+
});
|
|
2912
|
+
const refreshed = await repo.findOne({ where: { id: row.id } });
|
|
2913
|
+
if (!refreshed) return json({ error: "Failed to identify", detail: "contact missing after reactivate" }, { status: 500 });
|
|
2914
|
+
contact = refreshed;
|
|
2915
|
+
} else {
|
|
2916
|
+
contact = existing;
|
|
2917
|
+
}
|
|
2829
2918
|
}
|
|
2830
2919
|
const convRepoInst = convRepo();
|
|
2831
|
-
const
|
|
2920
|
+
const contactId = contact.id;
|
|
2921
|
+
const conv = await convRepoInst.save(convRepoInst.create({ contactId }));
|
|
2832
2922
|
return json({
|
|
2833
|
-
contactId
|
|
2923
|
+
contactId,
|
|
2834
2924
|
conversationId: conv.id
|
|
2835
2925
|
});
|
|
2836
2926
|
} catch (err) {
|
|
@@ -3051,6 +3141,9 @@ var EMBED_CONCURRENCY = 5;
|
|
|
3051
3141
|
var MAX_PDF_BYTES = 25 * 1024 * 1024;
|
|
3052
3142
|
var TEXT_FILE_TYPES = /* @__PURE__ */ new Set(["text/plain", "text/markdown", "application/json"]);
|
|
3053
3143
|
var KB_LOG = "[llm-agent-knowledge]";
|
|
3144
|
+
function logKbPipeline(step, meta) {
|
|
3145
|
+
console.info(`${KB_LOG} pipeline`, { step, ...meta });
|
|
3146
|
+
}
|
|
3054
3147
|
function llmEmbedDebug() {
|
|
3055
3148
|
const v = process.env.LLM_EMBED_DEBUG?.toLowerCase();
|
|
3056
3149
|
return v === "1" || v === "true" || v === "yes";
|
|
@@ -3065,11 +3158,29 @@ async function extractTextFromPdf(buffer) {
|
|
|
3065
3158
|
const data = await pdfParse(buffer);
|
|
3066
3159
|
return (data?.text ?? "").trim();
|
|
3067
3160
|
}
|
|
3068
|
-
async function
|
|
3161
|
+
async function loadChunksMissingEmbeddings(dataSource, documentId, slug) {
|
|
3162
|
+
const rows = await dataSource.query(
|
|
3163
|
+
`SELECT id, content FROM knowledge_base_chunks WHERE "documentId" = $1 AND embedding IS NULL ORDER BY "chunkIndex" ASC`,
|
|
3164
|
+
[documentId]
|
|
3165
|
+
);
|
|
3166
|
+
const list = rows ?? [];
|
|
3167
|
+
logKbPipeline("07_query_chunks_missing_embedding", {
|
|
3168
|
+
slug,
|
|
3169
|
+
documentId,
|
|
3170
|
+
missingEmbeddingCount: list.length
|
|
3171
|
+
});
|
|
3172
|
+
return list;
|
|
3173
|
+
}
|
|
3174
|
+
async function writeEmbeddingsConcurrent(dataSource, embed, chunks, concurrency, slug) {
|
|
3069
3175
|
let next = 0;
|
|
3070
3176
|
let written = 0;
|
|
3071
3177
|
let failed = 0;
|
|
3072
3178
|
let skippedEmpty = 0;
|
|
3179
|
+
logKbPipeline("09_embedding_workers_start", {
|
|
3180
|
+
slug,
|
|
3181
|
+
chunkCount: chunks.length,
|
|
3182
|
+
concurrency: Math.max(1, Math.min(concurrency, chunks.length))
|
|
3183
|
+
});
|
|
3073
3184
|
async function worker() {
|
|
3074
3185
|
for (; ; ) {
|
|
3075
3186
|
const i = next++;
|
|
@@ -3108,9 +3219,12 @@ async function writeEmbeddingsConcurrent(dataSource, embed, chunks, concurrency)
|
|
|
3108
3219
|
skippedEmpty
|
|
3109
3220
|
};
|
|
3110
3221
|
if (skippedEmpty > 0 && written === 0) {
|
|
3111
|
-
summary.hint = "embed() returned empty vectors \u2014 see [LLM embed] logs (
|
|
3222
|
+
summary.hint = "embed() returned empty vectors \u2014 see [LLM embed] / [LLM embed HF] logs (OpenAI gateway vs @huggingface/inference + legacy HTTP).";
|
|
3223
|
+
}
|
|
3224
|
+
logKbPipeline("10_embedding_workers_finished", { slug, ...summary });
|
|
3225
|
+
if (failed > 0 || skippedEmpty > 0 && written === 0) {
|
|
3226
|
+
console.error(`${KB_LOG} embedding pass finished with issues`, summary);
|
|
3112
3227
|
}
|
|
3113
|
-
console.error(`${KB_LOG} embedding pass finished`, summary);
|
|
3114
3228
|
return { written, failed };
|
|
3115
3229
|
}
|
|
3116
3230
|
function splitIntoChunks(text, maxLen) {
|
|
@@ -3146,6 +3260,58 @@ function createLlmAgentKnowledgeHandlers(config) {
|
|
|
3146
3260
|
}
|
|
3147
3261
|
return null;
|
|
3148
3262
|
}
|
|
3263
|
+
async function runEmbeddingPass(slug, savedChunks) {
|
|
3264
|
+
let embeddingsWritten = 0;
|
|
3265
|
+
let embeddingsFailed = 0;
|
|
3266
|
+
try {
|
|
3267
|
+
logKbPipeline("08_resolve_llm_plugin", { slug, chunkCount: savedChunks.length });
|
|
3268
|
+
const cms = await getCms();
|
|
3269
|
+
const llm = cms.getPlugin("llm");
|
|
3270
|
+
if (llm?.embed && savedChunks.length > 0) {
|
|
3271
|
+
logKbPipeline("08b_embed_fn_available", {
|
|
3272
|
+
slug,
|
|
3273
|
+
chunkCount: savedChunks.length,
|
|
3274
|
+
firstChunkId: savedChunks[0]?.id,
|
|
3275
|
+
lastChunkId: savedChunks[savedChunks.length - 1]?.id
|
|
3276
|
+
});
|
|
3277
|
+
const embedBound = (text) => llm.embed(text);
|
|
3278
|
+
const { written, failed } = await writeEmbeddingsConcurrent(
|
|
3279
|
+
dataSource,
|
|
3280
|
+
embedBound,
|
|
3281
|
+
savedChunks,
|
|
3282
|
+
EMBED_CONCURRENCY,
|
|
3283
|
+
slug
|
|
3284
|
+
);
|
|
3285
|
+
embeddingsWritten = written;
|
|
3286
|
+
embeddingsFailed = failed;
|
|
3287
|
+
} else {
|
|
3288
|
+
logKbPipeline("08c_embed_skipped", {
|
|
3289
|
+
slug,
|
|
3290
|
+
hasLlmPlugin: !!llm,
|
|
3291
|
+
hasEmbed: typeof llm?.embed === "function",
|
|
3292
|
+
chunkCount: savedChunks.length,
|
|
3293
|
+
reason: savedChunks.length === 0 ? "no_chunks" : !llm ? "no_llm_plugin" : "no_embed_method"
|
|
3294
|
+
});
|
|
3295
|
+
console.error(`${KB_LOG} embeddings skipped`, {
|
|
3296
|
+
slug,
|
|
3297
|
+
hasLlmPlugin: !!llm,
|
|
3298
|
+
hasEmbed: typeof llm?.embed === "function",
|
|
3299
|
+
chunkCount: savedChunks.length,
|
|
3300
|
+
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
|
|
3301
|
+
});
|
|
3302
|
+
}
|
|
3303
|
+
} catch (embErr) {
|
|
3304
|
+
const detail = embErr instanceof Error ? embErr.message : String(embErr);
|
|
3305
|
+
logKbPipeline("08d_embed_pass_exception", { slug, detail });
|
|
3306
|
+
console.error(`${KB_LOG} embedding step threw before/during batch`, { slug, detail, embErr });
|
|
3307
|
+
return {
|
|
3308
|
+
embeddingsWritten: 0,
|
|
3309
|
+
embeddingsFailed: savedChunks.length,
|
|
3310
|
+
embedError: detail
|
|
3311
|
+
};
|
|
3312
|
+
}
|
|
3313
|
+
return { embeddingsWritten, embeddingsFailed };
|
|
3314
|
+
}
|
|
3149
3315
|
return {
|
|
3150
3316
|
async list(req, slug) {
|
|
3151
3317
|
const denied = await gate(req, "read");
|
|
@@ -3174,8 +3340,11 @@ function createLlmAgentKnowledgeHandlers(config) {
|
|
|
3174
3340
|
const denied = await gate(req, "update");
|
|
3175
3341
|
if (denied) return denied;
|
|
3176
3342
|
try {
|
|
3343
|
+
const ct0 = req.headers.get("content-type") || "";
|
|
3344
|
+
logKbPipeline("01_request", { slug, contentType: ct0.slice(0, 80) });
|
|
3177
3345
|
const agent = await findAgentBySlug(dataSource, llmAgents, slug);
|
|
3178
3346
|
if (!agent) return json({ error: "Agent not found" }, { status: 404 });
|
|
3347
|
+
logKbPipeline("02_agent_loaded", { slug, agentId: agent.id });
|
|
3179
3348
|
let name = "";
|
|
3180
3349
|
let text = "";
|
|
3181
3350
|
let sourceUrl = null;
|
|
@@ -3187,6 +3356,14 @@ function createLlmAgentKnowledgeHandlers(config) {
|
|
|
3187
3356
|
name = (body?.name ?? "").trim();
|
|
3188
3357
|
text = (body?.text ?? "").trim();
|
|
3189
3358
|
sourceUrl = typeof body?.sourceUrl === "string" && body.sourceUrl.trim() ? body.sourceUrl.trim() : null;
|
|
3359
|
+
logKbPipeline("03_body_parsed", {
|
|
3360
|
+
slug,
|
|
3361
|
+
mode: "json",
|
|
3362
|
+
existingDocumentId,
|
|
3363
|
+
nameLen: name.length,
|
|
3364
|
+
textChars: text.length,
|
|
3365
|
+
hasSourceUrl: !!sourceUrl
|
|
3366
|
+
});
|
|
3190
3367
|
} else if (ct.includes("multipart/form-data")) {
|
|
3191
3368
|
const form = await req.formData();
|
|
3192
3369
|
name = form.get("name")?.trim() ?? "";
|
|
@@ -3196,9 +3373,17 @@ function createLlmAgentKnowledgeHandlers(config) {
|
|
|
3196
3373
|
const f = file;
|
|
3197
3374
|
const mime = (f.type || "").split(";")[0].trim().toLowerCase();
|
|
3198
3375
|
const buf = Buffer.from(await f.arrayBuffer());
|
|
3376
|
+
logKbPipeline("03_body_parsed", {
|
|
3377
|
+
slug,
|
|
3378
|
+
mode: "multipart",
|
|
3379
|
+
fileName: f.name || "(no name)",
|
|
3380
|
+
mime,
|
|
3381
|
+
fileBytes: buf.length
|
|
3382
|
+
});
|
|
3199
3383
|
if (TEXT_FILE_TYPES.has(mime)) {
|
|
3200
3384
|
const decoded = buf.toString("utf8");
|
|
3201
3385
|
if (!text) text = decoded;
|
|
3386
|
+
logKbPipeline("04_file_decoded_text", { slug, mime, textChars: text.length });
|
|
3202
3387
|
} else if (isPdfUpload(mime, f.name || "")) {
|
|
3203
3388
|
if (buf.length > MAX_PDF_BYTES) {
|
|
3204
3389
|
return json(
|
|
@@ -3207,8 +3392,10 @@ function createLlmAgentKnowledgeHandlers(config) {
|
|
|
3207
3392
|
);
|
|
3208
3393
|
}
|
|
3209
3394
|
try {
|
|
3395
|
+
logKbPipeline("04_pdf_extract_start", { slug, fileBytes: buf.length });
|
|
3210
3396
|
const extracted = await extractTextFromPdf(buf);
|
|
3211
3397
|
if (!text) text = extracted;
|
|
3398
|
+
logKbPipeline("04_pdf_extract_done", { slug, textChars: text.length });
|
|
3212
3399
|
} catch {
|
|
3213
3400
|
return json(
|
|
3214
3401
|
{ error: "Could not read PDF text (file may be encrypted, corrupt, or image-only)" },
|
|
@@ -3224,12 +3411,15 @@ function createLlmAgentKnowledgeHandlers(config) {
|
|
|
3224
3411
|
);
|
|
3225
3412
|
}
|
|
3226
3413
|
if (!name && f.name) name = f.name.replace(/\.[^/.]+$/, "") || f.name;
|
|
3414
|
+
} else {
|
|
3415
|
+
logKbPipeline("03_body_parsed", { slug, mode: "multipart", hasFile: false, textChars: text.length });
|
|
3227
3416
|
}
|
|
3228
3417
|
} else {
|
|
3229
3418
|
return json({ error: "Use application/json or multipart/form-data" }, { status: 400 });
|
|
3230
3419
|
}
|
|
3231
3420
|
const linkRepo = dataSource.getRepository(junction);
|
|
3232
3421
|
if (existingDocumentId != null) {
|
|
3422
|
+
logKbPipeline("05_branch", { slug, branch: "link_existing_document", documentId: existingDocumentId });
|
|
3233
3423
|
const docRepo2 = dataSource.getRepository(kbDoc);
|
|
3234
3424
|
const existing = await docRepo2.findOne({ where: { id: existingDocumentId } });
|
|
3235
3425
|
if (!existing) return json({ error: "documentId not found" }, { status: 404 });
|
|
@@ -3238,9 +3428,137 @@ function createLlmAgentKnowledgeHandlers(config) {
|
|
|
3238
3428
|
});
|
|
3239
3429
|
if (!dup2) {
|
|
3240
3430
|
await linkRepo.save(linkRepo.create({ agentId: agent.id, documentId: existingDocumentId }));
|
|
3431
|
+
logKbPipeline("06_junction_link_created", {
|
|
3432
|
+
slug,
|
|
3433
|
+
agentId: agent.id,
|
|
3434
|
+
documentId: existingDocumentId
|
|
3435
|
+
});
|
|
3436
|
+
} else {
|
|
3437
|
+
logKbPipeline("06_junction_link_exists", {
|
|
3438
|
+
slug,
|
|
3439
|
+
agentId: agent.id,
|
|
3440
|
+
documentId: existingDocumentId
|
|
3441
|
+
});
|
|
3442
|
+
}
|
|
3443
|
+
const chunkRepo2 = dataSource.getRepository(kbChunk);
|
|
3444
|
+
const docRow = existing;
|
|
3445
|
+
const chunkCount = await chunkRepo2.count({ where: { documentId: existingDocumentId } });
|
|
3446
|
+
logKbPipeline("06b_chunks_existing_count", {
|
|
3447
|
+
slug,
|
|
3448
|
+
documentId: existingDocumentId,
|
|
3449
|
+
chunkCount
|
|
3450
|
+
});
|
|
3451
|
+
let chunksToEmbed = [];
|
|
3452
|
+
let chunksCreated = 0;
|
|
3453
|
+
if (chunkCount === 0) {
|
|
3454
|
+
const text2 = (docRow.content ?? "").trim();
|
|
3455
|
+
if (!text2) {
|
|
3456
|
+
logKbPipeline("07_ingest_aborted_empty_document", { slug, documentId: existingDocumentId });
|
|
3457
|
+
return json({
|
|
3458
|
+
documentId: existingDocumentId,
|
|
3459
|
+
linked: true,
|
|
3460
|
+
created: false,
|
|
3461
|
+
chunkCount: 0,
|
|
3462
|
+
embeddingsWritten: 0,
|
|
3463
|
+
embeddingsFailed: 0,
|
|
3464
|
+
warning: "Document has no text content; add content then attach again to build chunks and embeddings."
|
|
3465
|
+
});
|
|
3466
|
+
}
|
|
3467
|
+
const parts2 = splitIntoChunks(text2, INGEST_CHUNK_CHARS);
|
|
3468
|
+
if (parts2.length > MAX_CHUNKS_PER_UPLOAD) {
|
|
3469
|
+
return json(
|
|
3470
|
+
{
|
|
3471
|
+
error: `Document is too large for one ingest (${parts2.length} chunks; max ${MAX_CHUNKS_PER_UPLOAD}). Split into smaller files.`
|
|
3472
|
+
},
|
|
3473
|
+
{ status: 413 }
|
|
3474
|
+
);
|
|
3475
|
+
}
|
|
3476
|
+
logKbPipeline("07_chunk_split", {
|
|
3477
|
+
slug,
|
|
3478
|
+
documentId: existingDocumentId,
|
|
3479
|
+
partCount: parts2.length,
|
|
3480
|
+
maxChunkChars: INGEST_CHUNK_CHARS,
|
|
3481
|
+
totalChars: text2.length
|
|
3482
|
+
});
|
|
3483
|
+
const now2 = /* @__PURE__ */ new Date();
|
|
3484
|
+
const chunkRows2 = parts2.map(
|
|
3485
|
+
(content, i) => chunkRepo2.create({
|
|
3486
|
+
documentId: existingDocumentId,
|
|
3487
|
+
content,
|
|
3488
|
+
chunkIndex: i,
|
|
3489
|
+
createdAt: now2
|
|
3490
|
+
})
|
|
3491
|
+
);
|
|
3492
|
+
const savedList2 = await chunkRepo2.save(chunkRows2);
|
|
3493
|
+
chunksCreated = savedList2.length;
|
|
3494
|
+
chunksToEmbed = savedList2.map((row, i) => ({
|
|
3495
|
+
id: row.id,
|
|
3496
|
+
content: parts2[i]
|
|
3497
|
+
}));
|
|
3498
|
+
logKbPipeline("07b_chunks_persisted", {
|
|
3499
|
+
slug,
|
|
3500
|
+
documentId: existingDocumentId,
|
|
3501
|
+
rowsInserted: chunksCreated
|
|
3502
|
+
});
|
|
3503
|
+
} else {
|
|
3504
|
+
chunksToEmbed = await loadChunksMissingEmbeddings(dataSource, existingDocumentId, slug);
|
|
3505
|
+
if (chunksToEmbed.length === 0) {
|
|
3506
|
+
logKbPipeline("08_skip_embed_all_chunks_have_vectors", {
|
|
3507
|
+
slug,
|
|
3508
|
+
documentId: existingDocumentId,
|
|
3509
|
+
existingChunkCount: chunkCount
|
|
3510
|
+
});
|
|
3511
|
+
}
|
|
3512
|
+
}
|
|
3513
|
+
const embedResult2 = chunksToEmbed.length > 0 ? await runEmbeddingPass(slug, chunksToEmbed) : { embeddingsWritten: 0, embeddingsFailed: 0 };
|
|
3514
|
+
if (embedResult2.embedError) {
|
|
3515
|
+
logKbPipeline("11_response", {
|
|
3516
|
+
slug,
|
|
3517
|
+
branch: "link",
|
|
3518
|
+
documentId: existingDocumentId,
|
|
3519
|
+
ok: false,
|
|
3520
|
+
embeddingError: true
|
|
3521
|
+
});
|
|
3522
|
+
return json(
|
|
3523
|
+
{
|
|
3524
|
+
documentId: existingDocumentId,
|
|
3525
|
+
linked: true,
|
|
3526
|
+
created: false,
|
|
3527
|
+
chunkCount: chunkCount + chunksCreated,
|
|
3528
|
+
chunksCreated,
|
|
3529
|
+
embeddingAttempted: true,
|
|
3530
|
+
embeddingsWritten: 0,
|
|
3531
|
+
embeddingsFailed: chunksToEmbed.length,
|
|
3532
|
+
warning: "Document linked; embedding step failed. Fix LLM/embed config and attach again (or unlink and re-attach) to retry NULL embeddings.",
|
|
3533
|
+
detail: embedResult2.embedError
|
|
3534
|
+
},
|
|
3535
|
+
{ status: 201 }
|
|
3536
|
+
);
|
|
3241
3537
|
}
|
|
3242
|
-
|
|
3538
|
+
logKbPipeline("11_response", {
|
|
3539
|
+
slug,
|
|
3540
|
+
branch: "link",
|
|
3541
|
+
documentId: existingDocumentId,
|
|
3542
|
+
ok: true,
|
|
3543
|
+
chunkCount: chunkCount + chunksCreated,
|
|
3544
|
+
chunksCreated,
|
|
3545
|
+
chunksQueuedForEmbedding: chunksToEmbed.length,
|
|
3546
|
+
embeddingsWritten: embedResult2.embeddingsWritten,
|
|
3547
|
+
embeddingsFailed: embedResult2.embeddingsFailed
|
|
3548
|
+
});
|
|
3549
|
+
return json({
|
|
3550
|
+
documentId: existingDocumentId,
|
|
3551
|
+
linked: true,
|
|
3552
|
+
created: false,
|
|
3553
|
+
chunkCount: chunkCount + chunksCreated,
|
|
3554
|
+
chunksCreated: chunksCreated || void 0,
|
|
3555
|
+
chunksQueuedForEmbedding: chunksToEmbed.length,
|
|
3556
|
+
embeddingAttempted: chunksToEmbed.length > 0,
|
|
3557
|
+
embeddingsWritten: embedResult2.embeddingsWritten,
|
|
3558
|
+
embeddingsFailed: embedResult2.embeddingsFailed
|
|
3559
|
+
});
|
|
3243
3560
|
}
|
|
3561
|
+
logKbPipeline("05_branch", { slug, branch: "new_upload_ingest" });
|
|
3244
3562
|
if (!text) return json({ error: "text or file with text content is required" }, { status: 400 });
|
|
3245
3563
|
if (!name) name = "Untitled";
|
|
3246
3564
|
const parts = splitIntoChunks(text, INGEST_CHUNK_CHARS);
|
|
@@ -3255,6 +3573,13 @@ function createLlmAgentKnowledgeHandlers(config) {
|
|
|
3255
3573
|
{ status: 413 }
|
|
3256
3574
|
);
|
|
3257
3575
|
}
|
|
3576
|
+
logKbPipeline("07_chunk_split", {
|
|
3577
|
+
slug,
|
|
3578
|
+
partCount: parts.length,
|
|
3579
|
+
maxChunkChars: INGEST_CHUNK_CHARS,
|
|
3580
|
+
totalChars: text.length,
|
|
3581
|
+
documentName: name
|
|
3582
|
+
});
|
|
3258
3583
|
const docRepo = dataSource.getRepository(kbDoc);
|
|
3259
3584
|
const chunkRepo = dataSource.getRepository(kbChunk);
|
|
3260
3585
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -3262,6 +3587,13 @@ function createLlmAgentKnowledgeHandlers(config) {
|
|
|
3262
3587
|
docRepo.create({ name, content: text, sourceUrl, createdAt: now, updatedAt: now })
|
|
3263
3588
|
);
|
|
3264
3589
|
const docId = doc.id;
|
|
3590
|
+
logKbPipeline("06_knowledge_document_saved", {
|
|
3591
|
+
slug,
|
|
3592
|
+
documentId: docId,
|
|
3593
|
+
name,
|
|
3594
|
+
contentChars: text.length,
|
|
3595
|
+
hasSourceUrl: !!sourceUrl
|
|
3596
|
+
});
|
|
3265
3597
|
const chunkRows = parts.map(
|
|
3266
3598
|
(content, i) => chunkRepo.create({ documentId: docId, content, chunkIndex: i, createdAt: now })
|
|
3267
3599
|
);
|
|
@@ -3272,63 +3604,66 @@ function createLlmAgentKnowledgeHandlers(config) {
|
|
|
3272
3604
|
content: parts[i]
|
|
3273
3605
|
})
|
|
3274
3606
|
);
|
|
3607
|
+
logKbPipeline("07b_chunks_persisted", {
|
|
3608
|
+
slug,
|
|
3609
|
+
documentId: docId,
|
|
3610
|
+
rowsInserted: savedChunks.length,
|
|
3611
|
+
firstChunkId: savedChunks[0]?.id,
|
|
3612
|
+
lastChunkId: savedChunks[savedChunks.length - 1]?.id
|
|
3613
|
+
});
|
|
3275
3614
|
const dup = await linkRepo.findOne({ where: { agentId: agent.id, documentId: docId } });
|
|
3276
3615
|
if (!dup) {
|
|
3277
3616
|
await linkRepo.save(linkRepo.create({ agentId: agent.id, documentId: docId }));
|
|
3617
|
+
logKbPipeline("06c_junction_link_created", { slug, agentId: agent.id, documentId: docId });
|
|
3618
|
+
} else {
|
|
3619
|
+
logKbPipeline("06c_junction_link_exists", { slug, agentId: agent.id, documentId: docId });
|
|
3278
3620
|
}
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
dataSource,
|
|
3289
|
-
embedBound,
|
|
3290
|
-
savedChunks,
|
|
3291
|
-
EMBED_CONCURRENCY
|
|
3292
|
-
);
|
|
3293
|
-
embeddingsWritten = written;
|
|
3294
|
-
embeddingsFailed = failed;
|
|
3295
|
-
} else {
|
|
3296
|
-
console.error(`${KB_LOG} embeddings skipped`, {
|
|
3297
|
-
slug,
|
|
3298
|
-
hasLlmPlugin: !!llm,
|
|
3299
|
-
hasEmbed: typeof llm?.embed === "function",
|
|
3300
|
-
chunkCount: savedChunks.length,
|
|
3301
|
-
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
|
|
3302
|
-
});
|
|
3303
|
-
}
|
|
3304
|
-
} catch (embErr) {
|
|
3305
|
-
const detail = embErr instanceof Error ? embErr.message : String(embErr);
|
|
3306
|
-
console.error(`${KB_LOG} embedding step threw before/during batch`, { slug, detail, embErr });
|
|
3621
|
+
const embedResult = await runEmbeddingPass(slug, savedChunks);
|
|
3622
|
+
if (embedResult.embedError) {
|
|
3623
|
+
logKbPipeline("11_response", {
|
|
3624
|
+
slug,
|
|
3625
|
+
branch: "ingest",
|
|
3626
|
+
documentId: docId,
|
|
3627
|
+
ok: false,
|
|
3628
|
+
embeddingError: true
|
|
3629
|
+
});
|
|
3307
3630
|
return json(
|
|
3308
3631
|
{
|
|
3309
3632
|
documentId: docId,
|
|
3310
3633
|
chunkCount: savedChunks.length,
|
|
3634
|
+
embeddingAttempted: true,
|
|
3311
3635
|
created: true,
|
|
3312
3636
|
linked: true,
|
|
3313
3637
|
embeddingsWritten: 0,
|
|
3314
3638
|
embeddingsFailed: savedChunks.length,
|
|
3315
3639
|
warning: "Document saved and linked; embedding step failed.",
|
|
3316
|
-
detail
|
|
3640
|
+
detail: embedResult.embedError
|
|
3317
3641
|
},
|
|
3318
3642
|
{ status: 201 }
|
|
3319
3643
|
);
|
|
3320
3644
|
}
|
|
3645
|
+
logKbPipeline("11_response", {
|
|
3646
|
+
slug,
|
|
3647
|
+
branch: "ingest",
|
|
3648
|
+
documentId: docId,
|
|
3649
|
+
ok: true,
|
|
3650
|
+
chunkCount: savedChunks.length,
|
|
3651
|
+
embeddingsWritten: embedResult.embeddingsWritten,
|
|
3652
|
+
embeddingsFailed: embedResult.embeddingsFailed
|
|
3653
|
+
});
|
|
3321
3654
|
return json({
|
|
3322
3655
|
documentId: docId,
|
|
3323
3656
|
chunkCount: savedChunks.length,
|
|
3657
|
+
embeddingAttempted: savedChunks.length > 0,
|
|
3324
3658
|
created: true,
|
|
3325
3659
|
linked: true,
|
|
3326
|
-
embeddingsWritten,
|
|
3327
|
-
embeddingsFailed
|
|
3660
|
+
embeddingsWritten: embedResult.embeddingsWritten,
|
|
3661
|
+
embeddingsFailed: embedResult.embeddingsFailed
|
|
3328
3662
|
});
|
|
3329
3663
|
} catch (err) {
|
|
3330
3664
|
const msg = err instanceof Error ? err.message : "Failed to ingest knowledge";
|
|
3331
3665
|
const name = err instanceof Error ? err.name : "";
|
|
3666
|
+
logKbPipeline("99_pipeline_error", { slug, errorName: name, message: msg });
|
|
3332
3667
|
return json({ error: msg, errorName: name || void 0 }, { status: 500 });
|
|
3333
3668
|
}
|
|
3334
3669
|
},
|
|
@@ -3340,6 +3675,7 @@ function createLlmAgentKnowledgeHandlers(config) {
|
|
|
3340
3675
|
try {
|
|
3341
3676
|
const agent = await findAgentBySlug(dataSource, llmAgents, slug);
|
|
3342
3677
|
if (!agent) return json({ error: "Agent not found" }, { status: 404 });
|
|
3678
|
+
logKbPipeline("unlink_junction", { slug, agentId: agent.id, documentId });
|
|
3343
3679
|
const linkRepo = dataSource.getRepository(junction);
|
|
3344
3680
|
await linkRepo.delete({ agentId: agent.id, documentId });
|
|
3345
3681
|
return json({ ok: true });
|
|
@@ -3658,149 +3994,2757 @@ function createAdminRolesHandlers(config) {
|
|
|
3658
3994
|
};
|
|
3659
3995
|
}
|
|
3660
3996
|
|
|
3661
|
-
// src/
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
"
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
"
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3997
|
+
// src/entities/user.entity.ts
|
|
3998
|
+
import { Entity as Entity4, PrimaryGeneratedColumn as PrimaryGeneratedColumn4, Column as Column4, ManyToOne as ManyToOne2, JoinColumn as JoinColumn2 } from "typeorm";
|
|
3999
|
+
|
|
4000
|
+
// src/entities/user-group.entity.ts
|
|
4001
|
+
import { Entity as Entity3, PrimaryGeneratedColumn as PrimaryGeneratedColumn3, Column as Column3, OneToMany } from "typeorm";
|
|
4002
|
+
|
|
4003
|
+
// src/entities/permission.entity.ts
|
|
4004
|
+
import { Entity as Entity2, PrimaryGeneratedColumn as PrimaryGeneratedColumn2, Column as Column2, ManyToOne, JoinColumn } from "typeorm";
|
|
4005
|
+
var Permission = class {
|
|
4006
|
+
id;
|
|
4007
|
+
groupId;
|
|
4008
|
+
entity;
|
|
4009
|
+
canCreate;
|
|
4010
|
+
canRead;
|
|
4011
|
+
canUpdate;
|
|
4012
|
+
canDelete;
|
|
4013
|
+
createdAt;
|
|
4014
|
+
updatedAt;
|
|
4015
|
+
deletedAt;
|
|
4016
|
+
deleted;
|
|
4017
|
+
createdBy;
|
|
4018
|
+
updatedBy;
|
|
4019
|
+
deletedBy;
|
|
4020
|
+
group;
|
|
4021
|
+
};
|
|
4022
|
+
__decorateClass([
|
|
4023
|
+
PrimaryGeneratedColumn2()
|
|
4024
|
+
], Permission.prototype, "id", 2);
|
|
4025
|
+
__decorateClass([
|
|
4026
|
+
Column2("int")
|
|
4027
|
+
], Permission.prototype, "groupId", 2);
|
|
4028
|
+
__decorateClass([
|
|
4029
|
+
Column2("varchar")
|
|
4030
|
+
], Permission.prototype, "entity", 2);
|
|
4031
|
+
__decorateClass([
|
|
4032
|
+
Column2("boolean", { default: false })
|
|
4033
|
+
], Permission.prototype, "canCreate", 2);
|
|
4034
|
+
__decorateClass([
|
|
4035
|
+
Column2("boolean", { default: false })
|
|
4036
|
+
], Permission.prototype, "canRead", 2);
|
|
4037
|
+
__decorateClass([
|
|
4038
|
+
Column2("boolean", { default: false })
|
|
4039
|
+
], Permission.prototype, "canUpdate", 2);
|
|
4040
|
+
__decorateClass([
|
|
4041
|
+
Column2("boolean", { default: false })
|
|
4042
|
+
], Permission.prototype, "canDelete", 2);
|
|
4043
|
+
__decorateClass([
|
|
4044
|
+
Column2({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4045
|
+
], Permission.prototype, "createdAt", 2);
|
|
4046
|
+
__decorateClass([
|
|
4047
|
+
Column2({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4048
|
+
], Permission.prototype, "updatedAt", 2);
|
|
4049
|
+
__decorateClass([
|
|
4050
|
+
Column2({ type: "timestamp", nullable: true })
|
|
4051
|
+
], Permission.prototype, "deletedAt", 2);
|
|
4052
|
+
__decorateClass([
|
|
4053
|
+
Column2("boolean", { default: false })
|
|
4054
|
+
], Permission.prototype, "deleted", 2);
|
|
4055
|
+
__decorateClass([
|
|
4056
|
+
Column2("int", { nullable: true })
|
|
4057
|
+
], Permission.prototype, "createdBy", 2);
|
|
4058
|
+
__decorateClass([
|
|
4059
|
+
Column2("int", { nullable: true })
|
|
4060
|
+
], Permission.prototype, "updatedBy", 2);
|
|
4061
|
+
__decorateClass([
|
|
4062
|
+
Column2("int", { nullable: true })
|
|
4063
|
+
], Permission.prototype, "deletedBy", 2);
|
|
4064
|
+
__decorateClass([
|
|
4065
|
+
ManyToOne(() => UserGroup, (g) => g.permissions, { onDelete: "CASCADE" }),
|
|
4066
|
+
JoinColumn({ name: "groupId" })
|
|
4067
|
+
], Permission.prototype, "group", 2);
|
|
4068
|
+
Permission = __decorateClass([
|
|
4069
|
+
Entity2("permissions")
|
|
4070
|
+
], Permission);
|
|
4071
|
+
|
|
4072
|
+
// src/entities/user-group.entity.ts
|
|
4073
|
+
var UserGroup = class {
|
|
4074
|
+
id;
|
|
4075
|
+
name;
|
|
4076
|
+
createdAt;
|
|
4077
|
+
updatedAt;
|
|
4078
|
+
deletedAt;
|
|
4079
|
+
deleted;
|
|
4080
|
+
createdBy;
|
|
4081
|
+
updatedBy;
|
|
4082
|
+
deletedBy;
|
|
4083
|
+
permissions;
|
|
4084
|
+
users;
|
|
4085
|
+
};
|
|
4086
|
+
__decorateClass([
|
|
4087
|
+
PrimaryGeneratedColumn3()
|
|
4088
|
+
], UserGroup.prototype, "id", 2);
|
|
4089
|
+
__decorateClass([
|
|
4090
|
+
Column3("varchar", { unique: true })
|
|
4091
|
+
], UserGroup.prototype, "name", 2);
|
|
4092
|
+
__decorateClass([
|
|
4093
|
+
Column3({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4094
|
+
], UserGroup.prototype, "createdAt", 2);
|
|
4095
|
+
__decorateClass([
|
|
4096
|
+
Column3({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4097
|
+
], UserGroup.prototype, "updatedAt", 2);
|
|
4098
|
+
__decorateClass([
|
|
4099
|
+
Column3({ type: "timestamp", nullable: true })
|
|
4100
|
+
], UserGroup.prototype, "deletedAt", 2);
|
|
4101
|
+
__decorateClass([
|
|
4102
|
+
Column3("boolean", { default: false })
|
|
4103
|
+
], UserGroup.prototype, "deleted", 2);
|
|
4104
|
+
__decorateClass([
|
|
4105
|
+
Column3("int", { nullable: true })
|
|
4106
|
+
], UserGroup.prototype, "createdBy", 2);
|
|
4107
|
+
__decorateClass([
|
|
4108
|
+
Column3("int", { nullable: true })
|
|
4109
|
+
], UserGroup.prototype, "updatedBy", 2);
|
|
4110
|
+
__decorateClass([
|
|
4111
|
+
Column3("int", { nullable: true })
|
|
4112
|
+
], UserGroup.prototype, "deletedBy", 2);
|
|
4113
|
+
__decorateClass([
|
|
4114
|
+
OneToMany(() => Permission, (p) => p.group)
|
|
4115
|
+
], UserGroup.prototype, "permissions", 2);
|
|
4116
|
+
__decorateClass([
|
|
4117
|
+
OneToMany(() => User, (u) => u.group)
|
|
4118
|
+
], UserGroup.prototype, "users", 2);
|
|
4119
|
+
UserGroup = __decorateClass([
|
|
4120
|
+
Entity3("user_groups")
|
|
4121
|
+
], UserGroup);
|
|
4122
|
+
|
|
4123
|
+
// src/entities/user.entity.ts
|
|
4124
|
+
var User = class {
|
|
4125
|
+
id;
|
|
4126
|
+
name;
|
|
4127
|
+
email;
|
|
4128
|
+
phone;
|
|
4129
|
+
phoneVerifiedAt;
|
|
4130
|
+
emailVerifiedAt;
|
|
4131
|
+
password;
|
|
4132
|
+
blocked;
|
|
4133
|
+
adminAccess;
|
|
4134
|
+
groupId;
|
|
4135
|
+
createdAt;
|
|
4136
|
+
updatedAt;
|
|
4137
|
+
deletedAt;
|
|
4138
|
+
deleted;
|
|
4139
|
+
createdBy;
|
|
4140
|
+
updatedBy;
|
|
4141
|
+
deletedBy;
|
|
4142
|
+
group;
|
|
4143
|
+
};
|
|
4144
|
+
__decorateClass([
|
|
4145
|
+
PrimaryGeneratedColumn4()
|
|
4146
|
+
], User.prototype, "id", 2);
|
|
4147
|
+
__decorateClass([
|
|
4148
|
+
Column4("varchar")
|
|
4149
|
+
], User.prototype, "name", 2);
|
|
4150
|
+
__decorateClass([
|
|
4151
|
+
Column4("varchar", { unique: true })
|
|
4152
|
+
], User.prototype, "email", 2);
|
|
4153
|
+
__decorateClass([
|
|
4154
|
+
Column4("varchar", { nullable: true })
|
|
4155
|
+
], User.prototype, "phone", 2);
|
|
4156
|
+
__decorateClass([
|
|
4157
|
+
Column4({ type: "timestamp", nullable: true })
|
|
4158
|
+
], User.prototype, "phoneVerifiedAt", 2);
|
|
4159
|
+
__decorateClass([
|
|
4160
|
+
Column4({ type: "timestamp", nullable: true })
|
|
4161
|
+
], User.prototype, "emailVerifiedAt", 2);
|
|
4162
|
+
__decorateClass([
|
|
4163
|
+
Column4("varchar", { nullable: true })
|
|
4164
|
+
], User.prototype, "password", 2);
|
|
4165
|
+
__decorateClass([
|
|
4166
|
+
Column4("boolean", { default: false })
|
|
4167
|
+
], User.prototype, "blocked", 2);
|
|
4168
|
+
__decorateClass([
|
|
4169
|
+
Column4("boolean", { default: false })
|
|
4170
|
+
], User.prototype, "adminAccess", 2);
|
|
4171
|
+
__decorateClass([
|
|
4172
|
+
Column4("int", { nullable: true })
|
|
4173
|
+
], User.prototype, "groupId", 2);
|
|
4174
|
+
__decorateClass([
|
|
4175
|
+
Column4({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4176
|
+
], User.prototype, "createdAt", 2);
|
|
4177
|
+
__decorateClass([
|
|
4178
|
+
Column4({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4179
|
+
], User.prototype, "updatedAt", 2);
|
|
4180
|
+
__decorateClass([
|
|
4181
|
+
Column4({ type: "timestamp", nullable: true })
|
|
4182
|
+
], User.prototype, "deletedAt", 2);
|
|
4183
|
+
__decorateClass([
|
|
4184
|
+
Column4("boolean", { default: false })
|
|
4185
|
+
], User.prototype, "deleted", 2);
|
|
4186
|
+
__decorateClass([
|
|
4187
|
+
Column4("int", { nullable: true })
|
|
4188
|
+
], User.prototype, "createdBy", 2);
|
|
4189
|
+
__decorateClass([
|
|
4190
|
+
Column4("int", { nullable: true })
|
|
4191
|
+
], User.prototype, "updatedBy", 2);
|
|
4192
|
+
__decorateClass([
|
|
4193
|
+
Column4("int", { nullable: true })
|
|
4194
|
+
], User.prototype, "deletedBy", 2);
|
|
4195
|
+
__decorateClass([
|
|
4196
|
+
ManyToOne2(() => UserGroup, (g) => g.users, { onDelete: "SET NULL" }),
|
|
4197
|
+
JoinColumn2({ name: "groupId" })
|
|
4198
|
+
], User.prototype, "group", 2);
|
|
4199
|
+
User = __decorateClass([
|
|
4200
|
+
Entity4("users")
|
|
4201
|
+
], User);
|
|
4202
|
+
|
|
4203
|
+
// src/entities/otp-challenge.entity.ts
|
|
4204
|
+
import { Entity as Entity5, PrimaryGeneratedColumn as PrimaryGeneratedColumn5, Column as Column5, Index } from "typeorm";
|
|
4205
|
+
var OtpChallenge = class {
|
|
4206
|
+
id;
|
|
4207
|
+
purpose;
|
|
4208
|
+
channel;
|
|
4209
|
+
identifier;
|
|
4210
|
+
codeHash;
|
|
4211
|
+
expiresAt;
|
|
4212
|
+
attempts;
|
|
4213
|
+
consumedAt;
|
|
4214
|
+
createdAt;
|
|
4215
|
+
};
|
|
4216
|
+
__decorateClass([
|
|
4217
|
+
PrimaryGeneratedColumn5()
|
|
4218
|
+
], OtpChallenge.prototype, "id", 2);
|
|
4219
|
+
__decorateClass([
|
|
4220
|
+
Column5("varchar")
|
|
4221
|
+
], OtpChallenge.prototype, "purpose", 2);
|
|
4222
|
+
__decorateClass([
|
|
4223
|
+
Column5("varchar")
|
|
4224
|
+
], OtpChallenge.prototype, "channel", 2);
|
|
4225
|
+
__decorateClass([
|
|
4226
|
+
Column5("varchar")
|
|
4227
|
+
], OtpChallenge.prototype, "identifier", 2);
|
|
4228
|
+
__decorateClass([
|
|
4229
|
+
Column5("varchar")
|
|
4230
|
+
], OtpChallenge.prototype, "codeHash", 2);
|
|
4231
|
+
__decorateClass([
|
|
4232
|
+
Column5({ type: "timestamp" })
|
|
4233
|
+
], OtpChallenge.prototype, "expiresAt", 2);
|
|
4234
|
+
__decorateClass([
|
|
4235
|
+
Column5("int", { default: 0 })
|
|
4236
|
+
], OtpChallenge.prototype, "attempts", 2);
|
|
4237
|
+
__decorateClass([
|
|
4238
|
+
Column5({ type: "timestamp", nullable: true })
|
|
4239
|
+
], OtpChallenge.prototype, "consumedAt", 2);
|
|
4240
|
+
__decorateClass([
|
|
4241
|
+
Column5({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4242
|
+
], OtpChallenge.prototype, "createdAt", 2);
|
|
4243
|
+
OtpChallenge = __decorateClass([
|
|
4244
|
+
Entity5("otp_challenges"),
|
|
4245
|
+
Index(["purpose", "identifier"])
|
|
4246
|
+
], OtpChallenge);
|
|
4247
|
+
|
|
4248
|
+
// src/entities/password-reset-token.entity.ts
|
|
4249
|
+
import { Entity as Entity6, PrimaryGeneratedColumn as PrimaryGeneratedColumn6, Column as Column6 } from "typeorm";
|
|
4250
|
+
var PasswordResetToken = class {
|
|
4251
|
+
id;
|
|
4252
|
+
email;
|
|
4253
|
+
token;
|
|
4254
|
+
expiresAt;
|
|
4255
|
+
createdAt;
|
|
4256
|
+
};
|
|
4257
|
+
__decorateClass([
|
|
4258
|
+
PrimaryGeneratedColumn6()
|
|
4259
|
+
], PasswordResetToken.prototype, "id", 2);
|
|
4260
|
+
__decorateClass([
|
|
4261
|
+
Column6("varchar")
|
|
4262
|
+
], PasswordResetToken.prototype, "email", 2);
|
|
4263
|
+
__decorateClass([
|
|
4264
|
+
Column6("varchar", { unique: true })
|
|
4265
|
+
], PasswordResetToken.prototype, "token", 2);
|
|
4266
|
+
__decorateClass([
|
|
4267
|
+
Column6({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4268
|
+
], PasswordResetToken.prototype, "expiresAt", 2);
|
|
4269
|
+
__decorateClass([
|
|
4270
|
+
Column6({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4271
|
+
], PasswordResetToken.prototype, "createdAt", 2);
|
|
4272
|
+
PasswordResetToken = __decorateClass([
|
|
4273
|
+
Entity6("password_reset_tokens")
|
|
4274
|
+
], PasswordResetToken);
|
|
4275
|
+
|
|
4276
|
+
// src/entities/blog.entity.ts
|
|
4277
|
+
import {
|
|
4278
|
+
Entity as Entity11,
|
|
4279
|
+
PrimaryGeneratedColumn as PrimaryGeneratedColumn11,
|
|
4280
|
+
Column as Column11,
|
|
4281
|
+
ManyToOne as ManyToOne4,
|
|
4282
|
+
OneToMany as OneToMany4,
|
|
4283
|
+
ManyToMany as ManyToMany2,
|
|
4284
|
+
JoinTable,
|
|
4285
|
+
JoinColumn as JoinColumn4
|
|
4286
|
+
} from "typeorm";
|
|
4287
|
+
|
|
4288
|
+
// src/entities/category.entity.ts
|
|
4289
|
+
import { Entity as Entity7, PrimaryGeneratedColumn as PrimaryGeneratedColumn7, Column as Column7, OneToMany as OneToMany2 } from "typeorm";
|
|
4290
|
+
var Category = class {
|
|
4291
|
+
id;
|
|
4292
|
+
name;
|
|
4293
|
+
createdAt;
|
|
4294
|
+
updatedAt;
|
|
4295
|
+
deletedAt;
|
|
4296
|
+
deleted;
|
|
4297
|
+
createdBy;
|
|
4298
|
+
updatedBy;
|
|
4299
|
+
deletedBy;
|
|
4300
|
+
blogs;
|
|
4301
|
+
};
|
|
4302
|
+
__decorateClass([
|
|
4303
|
+
PrimaryGeneratedColumn7()
|
|
4304
|
+
], Category.prototype, "id", 2);
|
|
4305
|
+
__decorateClass([
|
|
4306
|
+
Column7("varchar", { unique: true })
|
|
4307
|
+
], Category.prototype, "name", 2);
|
|
4308
|
+
__decorateClass([
|
|
4309
|
+
Column7({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4310
|
+
], Category.prototype, "createdAt", 2);
|
|
4311
|
+
__decorateClass([
|
|
4312
|
+
Column7({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4313
|
+
], Category.prototype, "updatedAt", 2);
|
|
4314
|
+
__decorateClass([
|
|
4315
|
+
Column7({ type: "timestamp", nullable: true })
|
|
4316
|
+
], Category.prototype, "deletedAt", 2);
|
|
4317
|
+
__decorateClass([
|
|
4318
|
+
Column7("boolean", { default: false })
|
|
4319
|
+
], Category.prototype, "deleted", 2);
|
|
4320
|
+
__decorateClass([
|
|
4321
|
+
Column7("int", { nullable: true })
|
|
4322
|
+
], Category.prototype, "createdBy", 2);
|
|
4323
|
+
__decorateClass([
|
|
4324
|
+
Column7("int", { nullable: true })
|
|
4325
|
+
], Category.prototype, "updatedBy", 2);
|
|
4326
|
+
__decorateClass([
|
|
4327
|
+
Column7("int", { nullable: true })
|
|
4328
|
+
], Category.prototype, "deletedBy", 2);
|
|
4329
|
+
__decorateClass([
|
|
4330
|
+
OneToMany2("Blog", "category")
|
|
4331
|
+
], Category.prototype, "blogs", 2);
|
|
4332
|
+
Category = __decorateClass([
|
|
4333
|
+
Entity7("categories")
|
|
4334
|
+
], Category);
|
|
4335
|
+
|
|
4336
|
+
// src/entities/seo.entity.ts
|
|
4337
|
+
import { Entity as Entity8, PrimaryGeneratedColumn as PrimaryGeneratedColumn8, Column as Column8, OneToMany as OneToMany3 } from "typeorm";
|
|
4338
|
+
var Seo = class {
|
|
4339
|
+
id;
|
|
4340
|
+
title;
|
|
4341
|
+
description;
|
|
4342
|
+
keywords;
|
|
4343
|
+
ogTitle;
|
|
4344
|
+
ogDescription;
|
|
4345
|
+
ogImage;
|
|
4346
|
+
slug;
|
|
4347
|
+
createdAt;
|
|
4348
|
+
updatedAt;
|
|
4349
|
+
deletedAt;
|
|
4350
|
+
deleted;
|
|
4351
|
+
createdBy;
|
|
4352
|
+
updatedBy;
|
|
4353
|
+
deletedBy;
|
|
4354
|
+
blogs;
|
|
4355
|
+
};
|
|
4356
|
+
__decorateClass([
|
|
4357
|
+
PrimaryGeneratedColumn8()
|
|
4358
|
+
], Seo.prototype, "id", 2);
|
|
4359
|
+
__decorateClass([
|
|
4360
|
+
Column8("varchar", { nullable: true })
|
|
4361
|
+
], Seo.prototype, "title", 2);
|
|
4362
|
+
__decorateClass([
|
|
4363
|
+
Column8("varchar", { nullable: true })
|
|
4364
|
+
], Seo.prototype, "description", 2);
|
|
4365
|
+
__decorateClass([
|
|
4366
|
+
Column8("varchar", { nullable: true })
|
|
4367
|
+
], Seo.prototype, "keywords", 2);
|
|
4368
|
+
__decorateClass([
|
|
4369
|
+
Column8("varchar", { nullable: true })
|
|
4370
|
+
], Seo.prototype, "ogTitle", 2);
|
|
4371
|
+
__decorateClass([
|
|
4372
|
+
Column8("varchar", { nullable: true })
|
|
4373
|
+
], Seo.prototype, "ogDescription", 2);
|
|
4374
|
+
__decorateClass([
|
|
4375
|
+
Column8("varchar", { nullable: true })
|
|
4376
|
+
], Seo.prototype, "ogImage", 2);
|
|
4377
|
+
__decorateClass([
|
|
4378
|
+
Column8("varchar", { unique: true })
|
|
4379
|
+
], Seo.prototype, "slug", 2);
|
|
4380
|
+
__decorateClass([
|
|
4381
|
+
Column8({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4382
|
+
], Seo.prototype, "createdAt", 2);
|
|
4383
|
+
__decorateClass([
|
|
4384
|
+
Column8({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4385
|
+
], Seo.prototype, "updatedAt", 2);
|
|
4386
|
+
__decorateClass([
|
|
4387
|
+
Column8({ type: "timestamp", nullable: true })
|
|
4388
|
+
], Seo.prototype, "deletedAt", 2);
|
|
4389
|
+
__decorateClass([
|
|
4390
|
+
Column8("boolean", { default: false })
|
|
4391
|
+
], Seo.prototype, "deleted", 2);
|
|
4392
|
+
__decorateClass([
|
|
4393
|
+
Column8("int", { nullable: true })
|
|
4394
|
+
], Seo.prototype, "createdBy", 2);
|
|
4395
|
+
__decorateClass([
|
|
4396
|
+
Column8("int", { nullable: true })
|
|
4397
|
+
], Seo.prototype, "updatedBy", 2);
|
|
4398
|
+
__decorateClass([
|
|
4399
|
+
Column8("int", { nullable: true })
|
|
4400
|
+
], Seo.prototype, "deletedBy", 2);
|
|
4401
|
+
__decorateClass([
|
|
4402
|
+
OneToMany3(() => Blog, (blog) => blog.seo)
|
|
4403
|
+
], Seo.prototype, "blogs", 2);
|
|
4404
|
+
Seo = __decorateClass([
|
|
4405
|
+
Entity8("seos")
|
|
4406
|
+
], Seo);
|
|
4407
|
+
|
|
4408
|
+
// src/entities/comment.entity.ts
|
|
4409
|
+
import { Entity as Entity9, PrimaryGeneratedColumn as PrimaryGeneratedColumn9, Column as Column9, ManyToOne as ManyToOne3, JoinColumn as JoinColumn3 } from "typeorm";
|
|
4410
|
+
var Comment = class {
|
|
4411
|
+
id;
|
|
4412
|
+
content;
|
|
4413
|
+
blogId;
|
|
4414
|
+
authorId;
|
|
4415
|
+
createdAt;
|
|
4416
|
+
updatedAt;
|
|
4417
|
+
deletedAt;
|
|
4418
|
+
deleted;
|
|
4419
|
+
createdBy;
|
|
4420
|
+
updatedBy;
|
|
4421
|
+
deletedBy;
|
|
4422
|
+
author;
|
|
4423
|
+
blog;
|
|
4424
|
+
};
|
|
4425
|
+
__decorateClass([
|
|
4426
|
+
PrimaryGeneratedColumn9()
|
|
4427
|
+
], Comment.prototype, "id", 2);
|
|
4428
|
+
__decorateClass([
|
|
4429
|
+
Column9("text")
|
|
4430
|
+
], Comment.prototype, "content", 2);
|
|
4431
|
+
__decorateClass([
|
|
4432
|
+
Column9("int")
|
|
4433
|
+
], Comment.prototype, "blogId", 2);
|
|
4434
|
+
__decorateClass([
|
|
4435
|
+
Column9("int")
|
|
4436
|
+
], Comment.prototype, "authorId", 2);
|
|
4437
|
+
__decorateClass([
|
|
4438
|
+
Column9({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4439
|
+
], Comment.prototype, "createdAt", 2);
|
|
4440
|
+
__decorateClass([
|
|
4441
|
+
Column9({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4442
|
+
], Comment.prototype, "updatedAt", 2);
|
|
4443
|
+
__decorateClass([
|
|
4444
|
+
Column9({ type: "timestamp", nullable: true })
|
|
4445
|
+
], Comment.prototype, "deletedAt", 2);
|
|
4446
|
+
__decorateClass([
|
|
4447
|
+
Column9("boolean", { default: false })
|
|
4448
|
+
], Comment.prototype, "deleted", 2);
|
|
4449
|
+
__decorateClass([
|
|
4450
|
+
Column9("int", { nullable: true })
|
|
4451
|
+
], Comment.prototype, "createdBy", 2);
|
|
4452
|
+
__decorateClass([
|
|
4453
|
+
Column9("int", { nullable: true })
|
|
4454
|
+
], Comment.prototype, "updatedBy", 2);
|
|
4455
|
+
__decorateClass([
|
|
4456
|
+
Column9("int", { nullable: true })
|
|
4457
|
+
], Comment.prototype, "deletedBy", 2);
|
|
4458
|
+
__decorateClass([
|
|
4459
|
+
ManyToOne3(() => User, { onDelete: "CASCADE" }),
|
|
4460
|
+
JoinColumn3({ name: "authorId" })
|
|
4461
|
+
], Comment.prototype, "author", 2);
|
|
4462
|
+
__decorateClass([
|
|
4463
|
+
ManyToOne3(() => Blog, (b) => b.comments, { onDelete: "CASCADE" }),
|
|
4464
|
+
JoinColumn3({ name: "blogId" })
|
|
4465
|
+
], Comment.prototype, "blog", 2);
|
|
4466
|
+
Comment = __decorateClass([
|
|
4467
|
+
Entity9("comments")
|
|
4468
|
+
], Comment);
|
|
4469
|
+
|
|
4470
|
+
// src/entities/tag.entity.ts
|
|
4471
|
+
import { Entity as Entity10, PrimaryGeneratedColumn as PrimaryGeneratedColumn10, Column as Column10, ManyToMany } from "typeorm";
|
|
4472
|
+
var Tag = class {
|
|
4473
|
+
id;
|
|
4474
|
+
name;
|
|
4475
|
+
createdAt;
|
|
4476
|
+
updatedAt;
|
|
4477
|
+
deletedAt;
|
|
4478
|
+
deleted;
|
|
4479
|
+
createdBy;
|
|
4480
|
+
updatedBy;
|
|
4481
|
+
deletedBy;
|
|
4482
|
+
blogs;
|
|
4483
|
+
};
|
|
4484
|
+
__decorateClass([
|
|
4485
|
+
PrimaryGeneratedColumn10()
|
|
4486
|
+
], Tag.prototype, "id", 2);
|
|
4487
|
+
__decorateClass([
|
|
4488
|
+
Column10("varchar", { unique: true })
|
|
4489
|
+
], Tag.prototype, "name", 2);
|
|
4490
|
+
__decorateClass([
|
|
4491
|
+
Column10({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4492
|
+
], Tag.prototype, "createdAt", 2);
|
|
4493
|
+
__decorateClass([
|
|
4494
|
+
Column10({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4495
|
+
], Tag.prototype, "updatedAt", 2);
|
|
4496
|
+
__decorateClass([
|
|
4497
|
+
Column10({ type: "timestamp", nullable: true })
|
|
4498
|
+
], Tag.prototype, "deletedAt", 2);
|
|
4499
|
+
__decorateClass([
|
|
4500
|
+
Column10("boolean", { default: false })
|
|
4501
|
+
], Tag.prototype, "deleted", 2);
|
|
4502
|
+
__decorateClass([
|
|
4503
|
+
Column10("int", { nullable: true })
|
|
4504
|
+
], Tag.prototype, "createdBy", 2);
|
|
4505
|
+
__decorateClass([
|
|
4506
|
+
Column10("int", { nullable: true })
|
|
4507
|
+
], Tag.prototype, "updatedBy", 2);
|
|
4508
|
+
__decorateClass([
|
|
4509
|
+
Column10("int", { nullable: true })
|
|
4510
|
+
], Tag.prototype, "deletedBy", 2);
|
|
4511
|
+
__decorateClass([
|
|
4512
|
+
ManyToMany(() => Blog, (blog) => blog.tags)
|
|
4513
|
+
], Tag.prototype, "blogs", 2);
|
|
4514
|
+
Tag = __decorateClass([
|
|
4515
|
+
Entity10("tags")
|
|
4516
|
+
], Tag);
|
|
4517
|
+
|
|
4518
|
+
// src/entities/blog.entity.ts
|
|
4519
|
+
var Blog = class {
|
|
4520
|
+
id;
|
|
4521
|
+
title;
|
|
4522
|
+
content;
|
|
4523
|
+
coverImage;
|
|
4524
|
+
authorId;
|
|
4525
|
+
categoryId;
|
|
4526
|
+
seoId;
|
|
4527
|
+
published;
|
|
4528
|
+
createdAt;
|
|
4529
|
+
updatedAt;
|
|
4530
|
+
deletedAt;
|
|
4531
|
+
deleted;
|
|
4532
|
+
createdBy;
|
|
4533
|
+
updatedBy;
|
|
4534
|
+
deletedBy;
|
|
4535
|
+
slug;
|
|
4536
|
+
author;
|
|
4537
|
+
category;
|
|
4538
|
+
seo;
|
|
4539
|
+
comments;
|
|
4540
|
+
tags;
|
|
4541
|
+
};
|
|
4542
|
+
__decorateClass([
|
|
4543
|
+
PrimaryGeneratedColumn11()
|
|
4544
|
+
], Blog.prototype, "id", 2);
|
|
4545
|
+
__decorateClass([
|
|
4546
|
+
Column11("varchar")
|
|
4547
|
+
], Blog.prototype, "title", 2);
|
|
4548
|
+
__decorateClass([
|
|
4549
|
+
Column11("text")
|
|
4550
|
+
], Blog.prototype, "content", 2);
|
|
4551
|
+
__decorateClass([
|
|
4552
|
+
Column11("varchar", { nullable: true })
|
|
4553
|
+
], Blog.prototype, "coverImage", 2);
|
|
4554
|
+
__decorateClass([
|
|
4555
|
+
Column11("int")
|
|
4556
|
+
], Blog.prototype, "authorId", 2);
|
|
4557
|
+
__decorateClass([
|
|
4558
|
+
Column11("int", { nullable: true })
|
|
4559
|
+
], Blog.prototype, "categoryId", 2);
|
|
4560
|
+
__decorateClass([
|
|
4561
|
+
Column11("int", { nullable: true })
|
|
4562
|
+
], Blog.prototype, "seoId", 2);
|
|
4563
|
+
__decorateClass([
|
|
4564
|
+
Column11("boolean", { default: false })
|
|
4565
|
+
], Blog.prototype, "published", 2);
|
|
4566
|
+
__decorateClass([
|
|
4567
|
+
Column11({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4568
|
+
], Blog.prototype, "createdAt", 2);
|
|
4569
|
+
__decorateClass([
|
|
4570
|
+
Column11({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4571
|
+
], Blog.prototype, "updatedAt", 2);
|
|
4572
|
+
__decorateClass([
|
|
4573
|
+
Column11({ type: "timestamp", nullable: true })
|
|
4574
|
+
], Blog.prototype, "deletedAt", 2);
|
|
4575
|
+
__decorateClass([
|
|
4576
|
+
Column11("boolean", { default: false })
|
|
4577
|
+
], Blog.prototype, "deleted", 2);
|
|
4578
|
+
__decorateClass([
|
|
4579
|
+
Column11("int", { nullable: true })
|
|
4580
|
+
], Blog.prototype, "createdBy", 2);
|
|
4581
|
+
__decorateClass([
|
|
4582
|
+
Column11("int", { nullable: true })
|
|
4583
|
+
], Blog.prototype, "updatedBy", 2);
|
|
4584
|
+
__decorateClass([
|
|
4585
|
+
Column11("int", { nullable: true })
|
|
4586
|
+
], Blog.prototype, "deletedBy", 2);
|
|
4587
|
+
__decorateClass([
|
|
4588
|
+
Column11("varchar", { unique: true })
|
|
4589
|
+
], Blog.prototype, "slug", 2);
|
|
4590
|
+
__decorateClass([
|
|
4591
|
+
ManyToOne4(() => User, { onDelete: "CASCADE" }),
|
|
4592
|
+
JoinColumn4({ name: "authorId" })
|
|
4593
|
+
], Blog.prototype, "author", 2);
|
|
4594
|
+
__decorateClass([
|
|
4595
|
+
ManyToOne4(() => Category, (c) => c.blogs, { onDelete: "SET NULL" }),
|
|
4596
|
+
JoinColumn4({ name: "categoryId" })
|
|
4597
|
+
], Blog.prototype, "category", 2);
|
|
4598
|
+
__decorateClass([
|
|
4599
|
+
ManyToOne4(() => Seo, (s) => s.blogs, { onDelete: "SET NULL" }),
|
|
4600
|
+
JoinColumn4({ name: "seoId" })
|
|
4601
|
+
], Blog.prototype, "seo", 2);
|
|
4602
|
+
__decorateClass([
|
|
4603
|
+
OneToMany4(() => Comment, (c) => c.blog)
|
|
4604
|
+
], Blog.prototype, "comments", 2);
|
|
4605
|
+
__decorateClass([
|
|
4606
|
+
ManyToMany2(() => Tag, (t) => t.blogs),
|
|
4607
|
+
JoinTable({
|
|
4608
|
+
name: "blog_tags",
|
|
4609
|
+
joinColumn: { name: "blogId", referencedColumnName: "id" },
|
|
4610
|
+
inverseJoinColumn: { name: "tagId", referencedColumnName: "id" }
|
|
4611
|
+
})
|
|
4612
|
+
], Blog.prototype, "tags", 2);
|
|
4613
|
+
Blog = __decorateClass([
|
|
4614
|
+
Entity11("blogs")
|
|
4615
|
+
], Blog);
|
|
4616
|
+
|
|
4617
|
+
// src/entities/contact.entity.ts
|
|
4618
|
+
import { Entity as Entity20, PrimaryGeneratedColumn as PrimaryGeneratedColumn20, Column as Column20, OneToMany as OneToMany8, ManyToOne as ManyToOne12, JoinColumn as JoinColumn12 } from "typeorm";
|
|
4619
|
+
|
|
4620
|
+
// src/entities/form-submission.entity.ts
|
|
4621
|
+
import { Entity as Entity14, PrimaryGeneratedColumn as PrimaryGeneratedColumn14, Column as Column14, ManyToOne as ManyToOne6, JoinColumn as JoinColumn6 } from "typeorm";
|
|
4622
|
+
|
|
4623
|
+
// src/entities/form.entity.ts
|
|
4624
|
+
import { Entity as Entity13, PrimaryGeneratedColumn as PrimaryGeneratedColumn13, Column as Column13, OneToMany as OneToMany5 } from "typeorm";
|
|
4625
|
+
|
|
4626
|
+
// src/entities/form-field.entity.ts
|
|
4627
|
+
import { Entity as Entity12, PrimaryGeneratedColumn as PrimaryGeneratedColumn12, Column as Column12, ManyToOne as ManyToOne5, JoinColumn as JoinColumn5 } from "typeorm";
|
|
4628
|
+
var FormField = class {
|
|
4629
|
+
id;
|
|
4630
|
+
formId;
|
|
4631
|
+
label;
|
|
4632
|
+
type;
|
|
4633
|
+
placeholder;
|
|
4634
|
+
options;
|
|
4635
|
+
required;
|
|
4636
|
+
validation;
|
|
4637
|
+
order;
|
|
4638
|
+
groupId;
|
|
4639
|
+
columnWidth;
|
|
4640
|
+
createdAt;
|
|
4641
|
+
updatedAt;
|
|
4642
|
+
deletedAt;
|
|
4643
|
+
deleted;
|
|
4644
|
+
createdBy;
|
|
4645
|
+
updatedBy;
|
|
4646
|
+
deletedBy;
|
|
4647
|
+
form;
|
|
4648
|
+
};
|
|
4649
|
+
__decorateClass([
|
|
4650
|
+
PrimaryGeneratedColumn12()
|
|
4651
|
+
], FormField.prototype, "id", 2);
|
|
4652
|
+
__decorateClass([
|
|
4653
|
+
Column12("int")
|
|
4654
|
+
], FormField.prototype, "formId", 2);
|
|
4655
|
+
__decorateClass([
|
|
4656
|
+
Column12("varchar")
|
|
4657
|
+
], FormField.prototype, "label", 2);
|
|
4658
|
+
__decorateClass([
|
|
4659
|
+
Column12("varchar")
|
|
4660
|
+
], FormField.prototype, "type", 2);
|
|
4661
|
+
__decorateClass([
|
|
4662
|
+
Column12("varchar", { nullable: true })
|
|
4663
|
+
], FormField.prototype, "placeholder", 2);
|
|
4664
|
+
__decorateClass([
|
|
4665
|
+
Column12("varchar", { nullable: true })
|
|
4666
|
+
], FormField.prototype, "options", 2);
|
|
4667
|
+
__decorateClass([
|
|
4668
|
+
Column12("boolean", { default: false })
|
|
4669
|
+
], FormField.prototype, "required", 2);
|
|
4670
|
+
__decorateClass([
|
|
4671
|
+
Column12("varchar", { nullable: true })
|
|
4672
|
+
], FormField.prototype, "validation", 2);
|
|
4673
|
+
__decorateClass([
|
|
4674
|
+
Column12("int")
|
|
4675
|
+
], FormField.prototype, "order", 2);
|
|
4676
|
+
__decorateClass([
|
|
4677
|
+
Column12("int", { default: 1 })
|
|
4678
|
+
], FormField.prototype, "groupId", 2);
|
|
4679
|
+
__decorateClass([
|
|
4680
|
+
Column12("int", { default: 12 })
|
|
4681
|
+
], FormField.prototype, "columnWidth", 2);
|
|
4682
|
+
__decorateClass([
|
|
4683
|
+
Column12({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4684
|
+
], FormField.prototype, "createdAt", 2);
|
|
4685
|
+
__decorateClass([
|
|
4686
|
+
Column12({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4687
|
+
], FormField.prototype, "updatedAt", 2);
|
|
4688
|
+
__decorateClass([
|
|
4689
|
+
Column12({ type: "timestamp", nullable: true })
|
|
4690
|
+
], FormField.prototype, "deletedAt", 2);
|
|
4691
|
+
__decorateClass([
|
|
4692
|
+
Column12("boolean", { default: false })
|
|
4693
|
+
], FormField.prototype, "deleted", 2);
|
|
4694
|
+
__decorateClass([
|
|
4695
|
+
Column12("int", { nullable: true })
|
|
4696
|
+
], FormField.prototype, "createdBy", 2);
|
|
4697
|
+
__decorateClass([
|
|
4698
|
+
Column12("int", { nullable: true })
|
|
4699
|
+
], FormField.prototype, "updatedBy", 2);
|
|
4700
|
+
__decorateClass([
|
|
4701
|
+
Column12("int", { nullable: true })
|
|
4702
|
+
], FormField.prototype, "deletedBy", 2);
|
|
4703
|
+
__decorateClass([
|
|
4704
|
+
ManyToOne5(() => Form, (f) => f.fields, { onDelete: "CASCADE" }),
|
|
4705
|
+
JoinColumn5({ name: "formId" })
|
|
4706
|
+
], FormField.prototype, "form", 2);
|
|
4707
|
+
FormField = __decorateClass([
|
|
4708
|
+
Entity12("form_fields")
|
|
4709
|
+
], FormField);
|
|
4710
|
+
|
|
4711
|
+
// src/entities/form.entity.ts
|
|
4712
|
+
var Form = class {
|
|
4713
|
+
id;
|
|
4714
|
+
name;
|
|
4715
|
+
description;
|
|
4716
|
+
campaign;
|
|
4717
|
+
slug;
|
|
4718
|
+
published;
|
|
4719
|
+
createdAt;
|
|
4720
|
+
updatedAt;
|
|
4721
|
+
deletedAt;
|
|
4722
|
+
deleted;
|
|
4723
|
+
createdBy;
|
|
4724
|
+
updatedBy;
|
|
4725
|
+
deletedBy;
|
|
4726
|
+
fields;
|
|
4727
|
+
submissions;
|
|
4728
|
+
};
|
|
4729
|
+
__decorateClass([
|
|
4730
|
+
PrimaryGeneratedColumn13()
|
|
4731
|
+
], Form.prototype, "id", 2);
|
|
4732
|
+
__decorateClass([
|
|
4733
|
+
Column13("varchar")
|
|
4734
|
+
], Form.prototype, "name", 2);
|
|
4735
|
+
__decorateClass([
|
|
4736
|
+
Column13("text", { nullable: true })
|
|
4737
|
+
], Form.prototype, "description", 2);
|
|
4738
|
+
__decorateClass([
|
|
4739
|
+
Column13("varchar", { nullable: true })
|
|
4740
|
+
], Form.prototype, "campaign", 2);
|
|
4741
|
+
__decorateClass([
|
|
4742
|
+
Column13("varchar", { unique: true })
|
|
4743
|
+
], Form.prototype, "slug", 2);
|
|
4744
|
+
__decorateClass([
|
|
4745
|
+
Column13("boolean", { default: false })
|
|
4746
|
+
], Form.prototype, "published", 2);
|
|
4747
|
+
__decorateClass([
|
|
4748
|
+
Column13({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4749
|
+
], Form.prototype, "createdAt", 2);
|
|
4750
|
+
__decorateClass([
|
|
4751
|
+
Column13({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4752
|
+
], Form.prototype, "updatedAt", 2);
|
|
4753
|
+
__decorateClass([
|
|
4754
|
+
Column13({ type: "timestamp", nullable: true })
|
|
4755
|
+
], Form.prototype, "deletedAt", 2);
|
|
4756
|
+
__decorateClass([
|
|
4757
|
+
Column13("boolean", { default: false })
|
|
4758
|
+
], Form.prototype, "deleted", 2);
|
|
4759
|
+
__decorateClass([
|
|
4760
|
+
Column13("int", { nullable: true })
|
|
4761
|
+
], Form.prototype, "createdBy", 2);
|
|
4762
|
+
__decorateClass([
|
|
4763
|
+
Column13("int", { nullable: true })
|
|
4764
|
+
], Form.prototype, "updatedBy", 2);
|
|
4765
|
+
__decorateClass([
|
|
4766
|
+
Column13("int", { nullable: true })
|
|
4767
|
+
], Form.prototype, "deletedBy", 2);
|
|
4768
|
+
__decorateClass([
|
|
4769
|
+
OneToMany5(() => FormField, (f) => f.form)
|
|
4770
|
+
], Form.prototype, "fields", 2);
|
|
4771
|
+
__decorateClass([
|
|
4772
|
+
OneToMany5(() => FormSubmission, (s) => s.form)
|
|
4773
|
+
], Form.prototype, "submissions", 2);
|
|
4774
|
+
Form = __decorateClass([
|
|
4775
|
+
Entity13("forms")
|
|
4776
|
+
], Form);
|
|
4777
|
+
|
|
4778
|
+
// src/entities/form-submission.entity.ts
|
|
4779
|
+
var FormSubmission = class {
|
|
4780
|
+
id;
|
|
4781
|
+
formId;
|
|
4782
|
+
contactId;
|
|
4783
|
+
data;
|
|
4784
|
+
ipAddress;
|
|
4785
|
+
userAgent;
|
|
4786
|
+
createdAt;
|
|
4787
|
+
updatedAt;
|
|
4788
|
+
form;
|
|
4789
|
+
contact;
|
|
4790
|
+
};
|
|
4791
|
+
__decorateClass([
|
|
4792
|
+
PrimaryGeneratedColumn14()
|
|
4793
|
+
], FormSubmission.prototype, "id", 2);
|
|
4794
|
+
__decorateClass([
|
|
4795
|
+
Column14("int")
|
|
4796
|
+
], FormSubmission.prototype, "formId", 2);
|
|
4797
|
+
__decorateClass([
|
|
4798
|
+
Column14("int", { nullable: true })
|
|
4799
|
+
], FormSubmission.prototype, "contactId", 2);
|
|
4800
|
+
__decorateClass([
|
|
4801
|
+
Column14("jsonb")
|
|
4802
|
+
], FormSubmission.prototype, "data", 2);
|
|
4803
|
+
__decorateClass([
|
|
4804
|
+
Column14("varchar", { nullable: true })
|
|
4805
|
+
], FormSubmission.prototype, "ipAddress", 2);
|
|
4806
|
+
__decorateClass([
|
|
4807
|
+
Column14("varchar", { nullable: true })
|
|
4808
|
+
], FormSubmission.prototype, "userAgent", 2);
|
|
4809
|
+
__decorateClass([
|
|
4810
|
+
Column14({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4811
|
+
], FormSubmission.prototype, "createdAt", 2);
|
|
4812
|
+
__decorateClass([
|
|
4813
|
+
Column14({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4814
|
+
], FormSubmission.prototype, "updatedAt", 2);
|
|
4815
|
+
__decorateClass([
|
|
4816
|
+
ManyToOne6(() => Form, (f) => f.submissions, { onDelete: "CASCADE" }),
|
|
4817
|
+
JoinColumn6({ name: "formId" })
|
|
4818
|
+
], FormSubmission.prototype, "form", 2);
|
|
4819
|
+
__decorateClass([
|
|
4820
|
+
ManyToOne6(() => Contact, (c) => c.form_submissions, { onDelete: "SET NULL" }),
|
|
4821
|
+
JoinColumn6({ name: "contactId" })
|
|
4822
|
+
], FormSubmission.prototype, "contact", 2);
|
|
4823
|
+
FormSubmission = __decorateClass([
|
|
4824
|
+
Entity14("form_submissions")
|
|
4825
|
+
], FormSubmission);
|
|
4826
|
+
|
|
4827
|
+
// src/entities/address.entity.ts
|
|
4828
|
+
import { Entity as Entity15, PrimaryGeneratedColumn as PrimaryGeneratedColumn15, Column as Column15, ManyToOne as ManyToOne7, JoinColumn as JoinColumn7 } from "typeorm";
|
|
4829
|
+
var Address = class {
|
|
4830
|
+
id;
|
|
4831
|
+
contactId;
|
|
4832
|
+
tag;
|
|
4833
|
+
line1;
|
|
4834
|
+
line2;
|
|
4835
|
+
city;
|
|
4836
|
+
state;
|
|
4837
|
+
postalCode;
|
|
4838
|
+
country;
|
|
4839
|
+
createdAt;
|
|
4840
|
+
updatedAt;
|
|
4841
|
+
contact;
|
|
4842
|
+
};
|
|
4843
|
+
__decorateClass([
|
|
4844
|
+
PrimaryGeneratedColumn15()
|
|
4845
|
+
], Address.prototype, "id", 2);
|
|
4846
|
+
__decorateClass([
|
|
4847
|
+
Column15("int")
|
|
4848
|
+
], Address.prototype, "contactId", 2);
|
|
4849
|
+
__decorateClass([
|
|
4850
|
+
Column15("varchar", { nullable: true })
|
|
4851
|
+
], Address.prototype, "tag", 2);
|
|
4852
|
+
__decorateClass([
|
|
4853
|
+
Column15("varchar", { nullable: true })
|
|
4854
|
+
], Address.prototype, "line1", 2);
|
|
4855
|
+
__decorateClass([
|
|
4856
|
+
Column15("varchar", { nullable: true })
|
|
4857
|
+
], Address.prototype, "line2", 2);
|
|
4858
|
+
__decorateClass([
|
|
4859
|
+
Column15("varchar", { nullable: true })
|
|
4860
|
+
], Address.prototype, "city", 2);
|
|
4861
|
+
__decorateClass([
|
|
4862
|
+
Column15("varchar", { nullable: true })
|
|
4863
|
+
], Address.prototype, "state", 2);
|
|
4864
|
+
__decorateClass([
|
|
4865
|
+
Column15("varchar", { nullable: true })
|
|
4866
|
+
], Address.prototype, "postalCode", 2);
|
|
4867
|
+
__decorateClass([
|
|
4868
|
+
Column15("varchar", { nullable: true })
|
|
4869
|
+
], Address.prototype, "country", 2);
|
|
4870
|
+
__decorateClass([
|
|
4871
|
+
Column15({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4872
|
+
], Address.prototype, "createdAt", 2);
|
|
4873
|
+
__decorateClass([
|
|
4874
|
+
Column15({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4875
|
+
], Address.prototype, "updatedAt", 2);
|
|
4876
|
+
__decorateClass([
|
|
4877
|
+
ManyToOne7(() => Contact, (c) => c.addresses, { onDelete: "CASCADE" }),
|
|
4878
|
+
JoinColumn7({ name: "contactId" })
|
|
4879
|
+
], Address.prototype, "contact", 2);
|
|
4880
|
+
Address = __decorateClass([
|
|
4881
|
+
Entity15("addresses")
|
|
4882
|
+
], Address);
|
|
4883
|
+
|
|
4884
|
+
// src/entities/order.entity.ts
|
|
4885
|
+
import { Entity as Entity16, PrimaryGeneratedColumn as PrimaryGeneratedColumn16, Column as Column16, ManyToOne as ManyToOne8, OneToMany as OneToMany6, JoinColumn as JoinColumn8 } from "typeorm";
|
|
4886
|
+
var Order = class {
|
|
4887
|
+
id;
|
|
4888
|
+
orderNumber;
|
|
4889
|
+
orderKind;
|
|
4890
|
+
parentOrderId;
|
|
4891
|
+
contactId;
|
|
4892
|
+
billingAddressId;
|
|
4893
|
+
shippingAddressId;
|
|
4894
|
+
status;
|
|
4895
|
+
subtotal;
|
|
4896
|
+
tax;
|
|
4897
|
+
discount;
|
|
4898
|
+
total;
|
|
4899
|
+
currency;
|
|
4900
|
+
metadata;
|
|
4901
|
+
createdAt;
|
|
4902
|
+
updatedAt;
|
|
4903
|
+
deletedAt;
|
|
4904
|
+
deleted;
|
|
4905
|
+
createdBy;
|
|
4906
|
+
updatedBy;
|
|
4907
|
+
deletedBy;
|
|
4908
|
+
parentOrder;
|
|
4909
|
+
children;
|
|
4910
|
+
contact;
|
|
4911
|
+
billingAddress;
|
|
4912
|
+
shippingAddress;
|
|
4913
|
+
items;
|
|
4914
|
+
payments;
|
|
4915
|
+
};
|
|
4916
|
+
__decorateClass([
|
|
4917
|
+
PrimaryGeneratedColumn16()
|
|
4918
|
+
], Order.prototype, "id", 2);
|
|
4919
|
+
__decorateClass([
|
|
4920
|
+
Column16("varchar", { unique: true })
|
|
4921
|
+
], Order.prototype, "orderNumber", 2);
|
|
4922
|
+
__decorateClass([
|
|
4923
|
+
Column16("varchar", { default: "sale" })
|
|
4924
|
+
], Order.prototype, "orderKind", 2);
|
|
4925
|
+
__decorateClass([
|
|
4926
|
+
Column16("int", { nullable: true })
|
|
4927
|
+
], Order.prototype, "parentOrderId", 2);
|
|
4928
|
+
__decorateClass([
|
|
4929
|
+
Column16("int")
|
|
4930
|
+
], Order.prototype, "contactId", 2);
|
|
4931
|
+
__decorateClass([
|
|
4932
|
+
Column16("int", { nullable: true })
|
|
4933
|
+
], Order.prototype, "billingAddressId", 2);
|
|
4934
|
+
__decorateClass([
|
|
4935
|
+
Column16("int", { nullable: true })
|
|
4936
|
+
], Order.prototype, "shippingAddressId", 2);
|
|
4937
|
+
__decorateClass([
|
|
4938
|
+
Column16("varchar", { default: "pending" })
|
|
4939
|
+
], Order.prototype, "status", 2);
|
|
4940
|
+
__decorateClass([
|
|
4941
|
+
Column16("decimal", { precision: 12, scale: 2, default: 0 })
|
|
4942
|
+
], Order.prototype, "subtotal", 2);
|
|
4943
|
+
__decorateClass([
|
|
4944
|
+
Column16("decimal", { precision: 12, scale: 2, default: 0 })
|
|
4945
|
+
], Order.prototype, "tax", 2);
|
|
4946
|
+
__decorateClass([
|
|
4947
|
+
Column16("decimal", { precision: 12, scale: 2, default: 0 })
|
|
4948
|
+
], Order.prototype, "discount", 2);
|
|
4949
|
+
__decorateClass([
|
|
4950
|
+
Column16("decimal", { precision: 12, scale: 2, default: 0 })
|
|
4951
|
+
], Order.prototype, "total", 2);
|
|
4952
|
+
__decorateClass([
|
|
4953
|
+
Column16("varchar", { default: "INR" })
|
|
4954
|
+
], Order.prototype, "currency", 2);
|
|
4955
|
+
__decorateClass([
|
|
4956
|
+
Column16("jsonb", { nullable: true })
|
|
4957
|
+
], Order.prototype, "metadata", 2);
|
|
4958
|
+
__decorateClass([
|
|
4959
|
+
Column16({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4960
|
+
], Order.prototype, "createdAt", 2);
|
|
4961
|
+
__decorateClass([
|
|
4962
|
+
Column16({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
4963
|
+
], Order.prototype, "updatedAt", 2);
|
|
4964
|
+
__decorateClass([
|
|
4965
|
+
Column16({ type: "timestamp", nullable: true })
|
|
4966
|
+
], Order.prototype, "deletedAt", 2);
|
|
4967
|
+
__decorateClass([
|
|
4968
|
+
Column16("boolean", { default: false })
|
|
4969
|
+
], Order.prototype, "deleted", 2);
|
|
4970
|
+
__decorateClass([
|
|
4971
|
+
Column16("int", { nullable: true })
|
|
4972
|
+
], Order.prototype, "createdBy", 2);
|
|
4973
|
+
__decorateClass([
|
|
4974
|
+
Column16("int", { nullable: true })
|
|
4975
|
+
], Order.prototype, "updatedBy", 2);
|
|
4976
|
+
__decorateClass([
|
|
4977
|
+
Column16("int", { nullable: true })
|
|
4978
|
+
], Order.prototype, "deletedBy", 2);
|
|
4979
|
+
__decorateClass([
|
|
4980
|
+
ManyToOne8(() => Order, (o) => o.children, { nullable: true, onDelete: "SET NULL" }),
|
|
4981
|
+
JoinColumn8({ name: "parentOrderId" })
|
|
4982
|
+
], Order.prototype, "parentOrder", 2);
|
|
4983
|
+
__decorateClass([
|
|
4984
|
+
OneToMany6(() => Order, (o) => o.parentOrder)
|
|
4985
|
+
], Order.prototype, "children", 2);
|
|
4986
|
+
__decorateClass([
|
|
4987
|
+
ManyToOne8(() => Contact, { onDelete: "CASCADE" }),
|
|
4988
|
+
JoinColumn8({ name: "contactId" })
|
|
4989
|
+
], Order.prototype, "contact", 2);
|
|
4990
|
+
__decorateClass([
|
|
4991
|
+
ManyToOne8(() => Address, { onDelete: "SET NULL" }),
|
|
4992
|
+
JoinColumn8({ name: "billingAddressId" })
|
|
4993
|
+
], Order.prototype, "billingAddress", 2);
|
|
4994
|
+
__decorateClass([
|
|
4995
|
+
ManyToOne8(() => Address, { onDelete: "SET NULL" }),
|
|
4996
|
+
JoinColumn8({ name: "shippingAddressId" })
|
|
4997
|
+
], Order.prototype, "shippingAddress", 2);
|
|
4998
|
+
__decorateClass([
|
|
4999
|
+
OneToMany6("OrderItem", "order")
|
|
5000
|
+
], Order.prototype, "items", 2);
|
|
5001
|
+
__decorateClass([
|
|
5002
|
+
OneToMany6("Payment", "order")
|
|
5003
|
+
], Order.prototype, "payments", 2);
|
|
5004
|
+
Order = __decorateClass([
|
|
5005
|
+
Entity16("orders")
|
|
5006
|
+
], Order);
|
|
5007
|
+
|
|
5008
|
+
// src/entities/payment.entity.ts
|
|
5009
|
+
import { Entity as Entity17, PrimaryGeneratedColumn as PrimaryGeneratedColumn17, Column as Column17, ManyToOne as ManyToOne9, JoinColumn as JoinColumn9 } from "typeorm";
|
|
5010
|
+
var Payment = class {
|
|
5011
|
+
id;
|
|
5012
|
+
orderId;
|
|
5013
|
+
contactId;
|
|
5014
|
+
amount;
|
|
5015
|
+
currency;
|
|
5016
|
+
status;
|
|
5017
|
+
method;
|
|
5018
|
+
externalReference;
|
|
5019
|
+
metadata;
|
|
5020
|
+
paidAt;
|
|
5021
|
+
createdAt;
|
|
5022
|
+
updatedAt;
|
|
5023
|
+
deletedAt;
|
|
5024
|
+
deleted;
|
|
5025
|
+
createdBy;
|
|
5026
|
+
updatedBy;
|
|
5027
|
+
deletedBy;
|
|
5028
|
+
order;
|
|
5029
|
+
contact;
|
|
5030
|
+
};
|
|
5031
|
+
__decorateClass([
|
|
5032
|
+
PrimaryGeneratedColumn17()
|
|
5033
|
+
], Payment.prototype, "id", 2);
|
|
5034
|
+
__decorateClass([
|
|
5035
|
+
Column17("int")
|
|
5036
|
+
], Payment.prototype, "orderId", 2);
|
|
5037
|
+
__decorateClass([
|
|
5038
|
+
Column17("int", { nullable: true })
|
|
5039
|
+
], Payment.prototype, "contactId", 2);
|
|
5040
|
+
__decorateClass([
|
|
5041
|
+
Column17("decimal", { precision: 12, scale: 2 })
|
|
5042
|
+
], Payment.prototype, "amount", 2);
|
|
5043
|
+
__decorateClass([
|
|
5044
|
+
Column17("varchar", { default: "INR" })
|
|
5045
|
+
], Payment.prototype, "currency", 2);
|
|
5046
|
+
__decorateClass([
|
|
5047
|
+
Column17("varchar", { default: "pending" })
|
|
5048
|
+
], Payment.prototype, "status", 2);
|
|
5049
|
+
__decorateClass([
|
|
5050
|
+
Column17("varchar", { nullable: true })
|
|
5051
|
+
], Payment.prototype, "method", 2);
|
|
5052
|
+
__decorateClass([
|
|
5053
|
+
Column17("varchar", { nullable: true })
|
|
5054
|
+
], Payment.prototype, "externalReference", 2);
|
|
5055
|
+
__decorateClass([
|
|
5056
|
+
Column17("jsonb", { nullable: true })
|
|
5057
|
+
], Payment.prototype, "metadata", 2);
|
|
5058
|
+
__decorateClass([
|
|
5059
|
+
Column17({ type: "timestamp", nullable: true })
|
|
5060
|
+
], Payment.prototype, "paidAt", 2);
|
|
5061
|
+
__decorateClass([
|
|
5062
|
+
Column17({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5063
|
+
], Payment.prototype, "createdAt", 2);
|
|
5064
|
+
__decorateClass([
|
|
5065
|
+
Column17({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5066
|
+
], Payment.prototype, "updatedAt", 2);
|
|
5067
|
+
__decorateClass([
|
|
5068
|
+
Column17({ type: "timestamp", nullable: true })
|
|
5069
|
+
], Payment.prototype, "deletedAt", 2);
|
|
5070
|
+
__decorateClass([
|
|
5071
|
+
Column17("boolean", { default: false })
|
|
5072
|
+
], Payment.prototype, "deleted", 2);
|
|
5073
|
+
__decorateClass([
|
|
5074
|
+
Column17("int", { nullable: true })
|
|
5075
|
+
], Payment.prototype, "createdBy", 2);
|
|
5076
|
+
__decorateClass([
|
|
5077
|
+
Column17("int", { nullable: true })
|
|
5078
|
+
], Payment.prototype, "updatedBy", 2);
|
|
5079
|
+
__decorateClass([
|
|
5080
|
+
Column17("int", { nullable: true })
|
|
5081
|
+
], Payment.prototype, "deletedBy", 2);
|
|
5082
|
+
__decorateClass([
|
|
5083
|
+
ManyToOne9(() => Order, (o) => o.payments, { onDelete: "CASCADE" }),
|
|
5084
|
+
JoinColumn9({ name: "orderId" })
|
|
5085
|
+
], Payment.prototype, "order", 2);
|
|
5086
|
+
__decorateClass([
|
|
5087
|
+
ManyToOne9(() => Contact, { onDelete: "SET NULL" }),
|
|
5088
|
+
JoinColumn9({ name: "contactId" })
|
|
5089
|
+
], Payment.prototype, "contact", 2);
|
|
5090
|
+
Payment = __decorateClass([
|
|
5091
|
+
Entity17("payments")
|
|
5092
|
+
], Payment);
|
|
5093
|
+
|
|
5094
|
+
// src/entities/chat-conversation.entity.ts
|
|
5095
|
+
import { Entity as Entity19, PrimaryGeneratedColumn as PrimaryGeneratedColumn19, Column as Column19, ManyToOne as ManyToOne11, OneToMany as OneToMany7, JoinColumn as JoinColumn11 } from "typeorm";
|
|
5096
|
+
|
|
5097
|
+
// src/entities/chat-message.entity.ts
|
|
5098
|
+
import { Entity as Entity18, PrimaryGeneratedColumn as PrimaryGeneratedColumn18, Column as Column18, ManyToOne as ManyToOne10, JoinColumn as JoinColumn10 } from "typeorm";
|
|
5099
|
+
var ChatMessage = class {
|
|
5100
|
+
id;
|
|
5101
|
+
conversationId;
|
|
5102
|
+
role;
|
|
5103
|
+
content;
|
|
5104
|
+
createdAt;
|
|
5105
|
+
conversation;
|
|
5106
|
+
};
|
|
5107
|
+
__decorateClass([
|
|
5108
|
+
PrimaryGeneratedColumn18()
|
|
5109
|
+
], ChatMessage.prototype, "id", 2);
|
|
5110
|
+
__decorateClass([
|
|
5111
|
+
Column18("int")
|
|
5112
|
+
], ChatMessage.prototype, "conversationId", 2);
|
|
5113
|
+
__decorateClass([
|
|
5114
|
+
Column18("varchar")
|
|
5115
|
+
], ChatMessage.prototype, "role", 2);
|
|
5116
|
+
__decorateClass([
|
|
5117
|
+
Column18("text")
|
|
5118
|
+
], ChatMessage.prototype, "content", 2);
|
|
5119
|
+
__decorateClass([
|
|
5120
|
+
Column18({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5121
|
+
], ChatMessage.prototype, "createdAt", 2);
|
|
5122
|
+
__decorateClass([
|
|
5123
|
+
ManyToOne10(() => ChatConversation, (c) => c.messages, { onDelete: "CASCADE" }),
|
|
5124
|
+
JoinColumn10({ name: "conversationId" })
|
|
5125
|
+
], ChatMessage.prototype, "conversation", 2);
|
|
5126
|
+
ChatMessage = __decorateClass([
|
|
5127
|
+
Entity18("chat_messages")
|
|
5128
|
+
], ChatMessage);
|
|
5129
|
+
|
|
5130
|
+
// src/entities/chat-conversation.entity.ts
|
|
5131
|
+
var ChatConversation = class {
|
|
5132
|
+
id;
|
|
5133
|
+
contactId;
|
|
5134
|
+
createdAt;
|
|
5135
|
+
updatedAt;
|
|
5136
|
+
contact;
|
|
5137
|
+
messages;
|
|
5138
|
+
};
|
|
5139
|
+
__decorateClass([
|
|
5140
|
+
PrimaryGeneratedColumn19()
|
|
5141
|
+
], ChatConversation.prototype, "id", 2);
|
|
5142
|
+
__decorateClass([
|
|
5143
|
+
Column19("int")
|
|
5144
|
+
], ChatConversation.prototype, "contactId", 2);
|
|
5145
|
+
__decorateClass([
|
|
5146
|
+
Column19({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5147
|
+
], ChatConversation.prototype, "createdAt", 2);
|
|
5148
|
+
__decorateClass([
|
|
5149
|
+
Column19({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5150
|
+
], ChatConversation.prototype, "updatedAt", 2);
|
|
5151
|
+
__decorateClass([
|
|
5152
|
+
ManyToOne11(() => Contact, (c) => c.chatConversations, { onDelete: "CASCADE" }),
|
|
5153
|
+
JoinColumn11({ name: "contactId" })
|
|
5154
|
+
], ChatConversation.prototype, "contact", 2);
|
|
5155
|
+
__decorateClass([
|
|
5156
|
+
OneToMany7(() => ChatMessage, (m) => m.conversation)
|
|
5157
|
+
], ChatConversation.prototype, "messages", 2);
|
|
5158
|
+
ChatConversation = __decorateClass([
|
|
5159
|
+
Entity19("chat_conversations")
|
|
5160
|
+
], ChatConversation);
|
|
5161
|
+
|
|
5162
|
+
// src/entities/contact.entity.ts
|
|
5163
|
+
var Contact = class {
|
|
5164
|
+
id;
|
|
5165
|
+
name;
|
|
5166
|
+
email;
|
|
5167
|
+
phone;
|
|
5168
|
+
type;
|
|
5169
|
+
company;
|
|
5170
|
+
taxId;
|
|
5171
|
+
notes;
|
|
5172
|
+
createdAt;
|
|
5173
|
+
updatedAt;
|
|
5174
|
+
deletedAt;
|
|
5175
|
+
deleted;
|
|
5176
|
+
createdBy;
|
|
5177
|
+
updatedBy;
|
|
5178
|
+
deletedBy;
|
|
5179
|
+
userId;
|
|
5180
|
+
user;
|
|
5181
|
+
form_submissions;
|
|
5182
|
+
addresses;
|
|
5183
|
+
orders;
|
|
5184
|
+
payments;
|
|
5185
|
+
chatConversations;
|
|
5186
|
+
};
|
|
5187
|
+
__decorateClass([
|
|
5188
|
+
PrimaryGeneratedColumn20()
|
|
5189
|
+
], Contact.prototype, "id", 2);
|
|
5190
|
+
__decorateClass([
|
|
5191
|
+
Column20("varchar")
|
|
5192
|
+
], Contact.prototype, "name", 2);
|
|
5193
|
+
__decorateClass([
|
|
5194
|
+
Column20("varchar", { unique: true })
|
|
5195
|
+
], Contact.prototype, "email", 2);
|
|
5196
|
+
__decorateClass([
|
|
5197
|
+
Column20("varchar", { nullable: true })
|
|
5198
|
+
], Contact.prototype, "phone", 2);
|
|
5199
|
+
__decorateClass([
|
|
5200
|
+
Column20("varchar", { nullable: true })
|
|
5201
|
+
], Contact.prototype, "type", 2);
|
|
5202
|
+
__decorateClass([
|
|
5203
|
+
Column20("varchar", { nullable: true })
|
|
5204
|
+
], Contact.prototype, "company", 2);
|
|
5205
|
+
__decorateClass([
|
|
5206
|
+
Column20("varchar", { nullable: true })
|
|
5207
|
+
], Contact.prototype, "taxId", 2);
|
|
5208
|
+
__decorateClass([
|
|
5209
|
+
Column20("text", { nullable: true })
|
|
5210
|
+
], Contact.prototype, "notes", 2);
|
|
5211
|
+
__decorateClass([
|
|
5212
|
+
Column20({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5213
|
+
], Contact.prototype, "createdAt", 2);
|
|
5214
|
+
__decorateClass([
|
|
5215
|
+
Column20({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5216
|
+
], Contact.prototype, "updatedAt", 2);
|
|
5217
|
+
__decorateClass([
|
|
5218
|
+
Column20({ type: "timestamp", nullable: true })
|
|
5219
|
+
], Contact.prototype, "deletedAt", 2);
|
|
5220
|
+
__decorateClass([
|
|
5221
|
+
Column20("boolean", { default: false })
|
|
5222
|
+
], Contact.prototype, "deleted", 2);
|
|
5223
|
+
__decorateClass([
|
|
5224
|
+
Column20("int", { nullable: true })
|
|
5225
|
+
], Contact.prototype, "createdBy", 2);
|
|
5226
|
+
__decorateClass([
|
|
5227
|
+
Column20("int", { nullable: true })
|
|
5228
|
+
], Contact.prototype, "updatedBy", 2);
|
|
5229
|
+
__decorateClass([
|
|
5230
|
+
Column20("int", { nullable: true })
|
|
5231
|
+
], Contact.prototype, "deletedBy", 2);
|
|
5232
|
+
__decorateClass([
|
|
5233
|
+
Column20("int", { nullable: true })
|
|
5234
|
+
], Contact.prototype, "userId", 2);
|
|
5235
|
+
__decorateClass([
|
|
5236
|
+
ManyToOne12(() => User, { onDelete: "SET NULL" }),
|
|
5237
|
+
JoinColumn12({ name: "userId" })
|
|
5238
|
+
], Contact.prototype, "user", 2);
|
|
5239
|
+
__decorateClass([
|
|
5240
|
+
OneToMany8(() => FormSubmission, (fs) => fs.contact)
|
|
5241
|
+
], Contact.prototype, "form_submissions", 2);
|
|
5242
|
+
__decorateClass([
|
|
5243
|
+
OneToMany8(() => Address, (a) => a.contact)
|
|
5244
|
+
], Contact.prototype, "addresses", 2);
|
|
5245
|
+
__decorateClass([
|
|
5246
|
+
OneToMany8(() => Order, (o) => o.contact)
|
|
5247
|
+
], Contact.prototype, "orders", 2);
|
|
5248
|
+
__decorateClass([
|
|
5249
|
+
OneToMany8(() => Payment, (p) => p.contact)
|
|
5250
|
+
], Contact.prototype, "payments", 2);
|
|
5251
|
+
__decorateClass([
|
|
5252
|
+
OneToMany8(() => ChatConversation, (c) => c.contact)
|
|
5253
|
+
], Contact.prototype, "chatConversations", 2);
|
|
5254
|
+
Contact = __decorateClass([
|
|
5255
|
+
Entity20("contacts")
|
|
5256
|
+
], Contact);
|
|
5257
|
+
|
|
5258
|
+
// src/entities/config.entity.ts
|
|
5259
|
+
import { Entity as Entity21, PrimaryGeneratedColumn as PrimaryGeneratedColumn21, Column as Column21, Unique } from "typeorm";
|
|
5260
|
+
var Config = class {
|
|
5261
|
+
id;
|
|
5262
|
+
settings;
|
|
5263
|
+
key;
|
|
5264
|
+
value;
|
|
5265
|
+
type;
|
|
5266
|
+
encrypted;
|
|
5267
|
+
createdAt;
|
|
5268
|
+
updatedAt;
|
|
5269
|
+
deletedAt;
|
|
5270
|
+
deleted;
|
|
5271
|
+
createdBy;
|
|
5272
|
+
updatedBy;
|
|
5273
|
+
deletedBy;
|
|
5274
|
+
};
|
|
5275
|
+
__decorateClass([
|
|
5276
|
+
PrimaryGeneratedColumn21()
|
|
5277
|
+
], Config.prototype, "id", 2);
|
|
5278
|
+
__decorateClass([
|
|
5279
|
+
Column21("varchar")
|
|
5280
|
+
], Config.prototype, "settings", 2);
|
|
5281
|
+
__decorateClass([
|
|
5282
|
+
Column21("varchar")
|
|
5283
|
+
], Config.prototype, "key", 2);
|
|
5284
|
+
__decorateClass([
|
|
5285
|
+
Column21("varchar")
|
|
5286
|
+
], Config.prototype, "value", 2);
|
|
5287
|
+
__decorateClass([
|
|
5288
|
+
Column21("varchar", { default: "private" })
|
|
5289
|
+
], Config.prototype, "type", 2);
|
|
5290
|
+
__decorateClass([
|
|
5291
|
+
Column21("boolean", { default: false })
|
|
5292
|
+
], Config.prototype, "encrypted", 2);
|
|
5293
|
+
__decorateClass([
|
|
5294
|
+
Column21({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5295
|
+
], Config.prototype, "createdAt", 2);
|
|
5296
|
+
__decorateClass([
|
|
5297
|
+
Column21({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5298
|
+
], Config.prototype, "updatedAt", 2);
|
|
5299
|
+
__decorateClass([
|
|
5300
|
+
Column21({ type: "timestamp", nullable: true })
|
|
5301
|
+
], Config.prototype, "deletedAt", 2);
|
|
5302
|
+
__decorateClass([
|
|
5303
|
+
Column21("boolean", { default: false })
|
|
5304
|
+
], Config.prototype, "deleted", 2);
|
|
5305
|
+
__decorateClass([
|
|
5306
|
+
Column21("int", { nullable: true })
|
|
5307
|
+
], Config.prototype, "createdBy", 2);
|
|
5308
|
+
__decorateClass([
|
|
5309
|
+
Column21("int", { nullable: true })
|
|
5310
|
+
], Config.prototype, "updatedBy", 2);
|
|
5311
|
+
__decorateClass([
|
|
5312
|
+
Column21("int", { nullable: true })
|
|
5313
|
+
], Config.prototype, "deletedBy", 2);
|
|
5314
|
+
Config = __decorateClass([
|
|
5315
|
+
Entity21("configs"),
|
|
5316
|
+
Unique(["settings", "key"])
|
|
5317
|
+
], Config);
|
|
5318
|
+
|
|
5319
|
+
// src/entities/message-template.entity.ts
|
|
5320
|
+
import { Entity as Entity22, PrimaryGeneratedColumn as PrimaryGeneratedColumn22, Column as Column22 } from "typeorm";
|
|
5321
|
+
var MessageTemplate = class {
|
|
5322
|
+
id;
|
|
5323
|
+
channel;
|
|
5324
|
+
templateKey;
|
|
5325
|
+
name;
|
|
5326
|
+
subject;
|
|
5327
|
+
body;
|
|
5328
|
+
externalTemplateRef;
|
|
5329
|
+
providerMeta;
|
|
5330
|
+
enabled;
|
|
5331
|
+
createdAt;
|
|
5332
|
+
updatedAt;
|
|
5333
|
+
deletedAt;
|
|
5334
|
+
deleted;
|
|
5335
|
+
createdBy;
|
|
5336
|
+
updatedBy;
|
|
5337
|
+
deletedBy;
|
|
5338
|
+
};
|
|
5339
|
+
__decorateClass([
|
|
5340
|
+
PrimaryGeneratedColumn22()
|
|
5341
|
+
], MessageTemplate.prototype, "id", 2);
|
|
5342
|
+
__decorateClass([
|
|
5343
|
+
Column22("varchar")
|
|
5344
|
+
], MessageTemplate.prototype, "channel", 2);
|
|
5345
|
+
__decorateClass([
|
|
5346
|
+
Column22("varchar", { name: "template_key" })
|
|
5347
|
+
], MessageTemplate.prototype, "templateKey", 2);
|
|
5348
|
+
__decorateClass([
|
|
5349
|
+
Column22("varchar", { nullable: true })
|
|
5350
|
+
], MessageTemplate.prototype, "name", 2);
|
|
5351
|
+
__decorateClass([
|
|
5352
|
+
Column22("varchar", { nullable: true })
|
|
5353
|
+
], MessageTemplate.prototype, "subject", 2);
|
|
5354
|
+
__decorateClass([
|
|
5355
|
+
Column22("text", { default: "" })
|
|
5356
|
+
], MessageTemplate.prototype, "body", 2);
|
|
5357
|
+
__decorateClass([
|
|
5358
|
+
Column22("varchar", { name: "external_template_ref", nullable: true })
|
|
5359
|
+
], MessageTemplate.prototype, "externalTemplateRef", 2);
|
|
5360
|
+
__decorateClass([
|
|
5361
|
+
Column22({ type: "jsonb", nullable: true })
|
|
5362
|
+
], MessageTemplate.prototype, "providerMeta", 2);
|
|
5363
|
+
__decorateClass([
|
|
5364
|
+
Column22("boolean", { default: true })
|
|
5365
|
+
], MessageTemplate.prototype, "enabled", 2);
|
|
5366
|
+
__decorateClass([
|
|
5367
|
+
Column22({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5368
|
+
], MessageTemplate.prototype, "createdAt", 2);
|
|
5369
|
+
__decorateClass([
|
|
5370
|
+
Column22({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5371
|
+
], MessageTemplate.prototype, "updatedAt", 2);
|
|
5372
|
+
__decorateClass([
|
|
5373
|
+
Column22({ type: "timestamp", nullable: true })
|
|
5374
|
+
], MessageTemplate.prototype, "deletedAt", 2);
|
|
5375
|
+
__decorateClass([
|
|
5376
|
+
Column22("boolean", { default: false })
|
|
5377
|
+
], MessageTemplate.prototype, "deleted", 2);
|
|
5378
|
+
__decorateClass([
|
|
5379
|
+
Column22("int", { nullable: true })
|
|
5380
|
+
], MessageTemplate.prototype, "createdBy", 2);
|
|
5381
|
+
__decorateClass([
|
|
5382
|
+
Column22("int", { nullable: true })
|
|
5383
|
+
], MessageTemplate.prototype, "updatedBy", 2);
|
|
5384
|
+
__decorateClass([
|
|
5385
|
+
Column22("int", { nullable: true })
|
|
5386
|
+
], MessageTemplate.prototype, "deletedBy", 2);
|
|
5387
|
+
MessageTemplate = __decorateClass([
|
|
5388
|
+
Entity22("message_templates")
|
|
5389
|
+
], MessageTemplate);
|
|
5390
|
+
|
|
5391
|
+
// src/entities/media.entity.ts
|
|
5392
|
+
import { Entity as Entity23, PrimaryGeneratedColumn as PrimaryGeneratedColumn23, Column as Column23, ManyToOne as ManyToOne13, OneToMany as OneToMany9, JoinColumn as JoinColumn13 } from "typeorm";
|
|
5393
|
+
var Media = class {
|
|
5394
|
+
id;
|
|
5395
|
+
kind;
|
|
5396
|
+
parentId;
|
|
5397
|
+
parent;
|
|
5398
|
+
children;
|
|
5399
|
+
filename;
|
|
5400
|
+
url;
|
|
5401
|
+
mimeType;
|
|
5402
|
+
size;
|
|
5403
|
+
alt;
|
|
5404
|
+
isPublic;
|
|
5405
|
+
createdAt;
|
|
5406
|
+
updatedAt;
|
|
5407
|
+
deletedAt;
|
|
5408
|
+
deleted;
|
|
5409
|
+
};
|
|
5410
|
+
__decorateClass([
|
|
5411
|
+
PrimaryGeneratedColumn23()
|
|
5412
|
+
], Media.prototype, "id", 2);
|
|
5413
|
+
__decorateClass([
|
|
5414
|
+
Column23({ type: "varchar", length: 16, default: "file" })
|
|
5415
|
+
], Media.prototype, "kind", 2);
|
|
5416
|
+
__decorateClass([
|
|
5417
|
+
Column23({ type: "int", nullable: true })
|
|
5418
|
+
], Media.prototype, "parentId", 2);
|
|
5419
|
+
__decorateClass([
|
|
5420
|
+
ManyToOne13(() => Media, (m) => m.children, { onDelete: "CASCADE" }),
|
|
5421
|
+
JoinColumn13({ name: "parentId" })
|
|
5422
|
+
], Media.prototype, "parent", 2);
|
|
5423
|
+
__decorateClass([
|
|
5424
|
+
OneToMany9(() => Media, (m) => m.parent)
|
|
5425
|
+
], Media.prototype, "children", 2);
|
|
5426
|
+
__decorateClass([
|
|
5427
|
+
Column23("varchar")
|
|
5428
|
+
], Media.prototype, "filename", 2);
|
|
5429
|
+
__decorateClass([
|
|
5430
|
+
Column23("varchar", { nullable: true })
|
|
5431
|
+
], Media.prototype, "url", 2);
|
|
5432
|
+
__decorateClass([
|
|
5433
|
+
Column23("varchar", { nullable: true })
|
|
5434
|
+
], Media.prototype, "mimeType", 2);
|
|
5435
|
+
__decorateClass([
|
|
5436
|
+
Column23("int", { default: 0 })
|
|
5437
|
+
], Media.prototype, "size", 2);
|
|
5438
|
+
__decorateClass([
|
|
5439
|
+
Column23("varchar", { nullable: true })
|
|
5440
|
+
], Media.prototype, "alt", 2);
|
|
5441
|
+
__decorateClass([
|
|
5442
|
+
Column23("boolean", { default: false })
|
|
5443
|
+
], Media.prototype, "isPublic", 2);
|
|
5444
|
+
__decorateClass([
|
|
5445
|
+
Column23({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5446
|
+
], Media.prototype, "createdAt", 2);
|
|
5447
|
+
__decorateClass([
|
|
5448
|
+
Column23({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5449
|
+
], Media.prototype, "updatedAt", 2);
|
|
5450
|
+
__decorateClass([
|
|
5451
|
+
Column23({ type: "timestamp", nullable: true })
|
|
5452
|
+
], Media.prototype, "deletedAt", 2);
|
|
5453
|
+
__decorateClass([
|
|
5454
|
+
Column23("boolean", { default: false })
|
|
5455
|
+
], Media.prototype, "deleted", 2);
|
|
5456
|
+
Media = __decorateClass([
|
|
5457
|
+
Entity23("media")
|
|
5458
|
+
], Media);
|
|
5459
|
+
|
|
5460
|
+
// src/entities/page.entity.ts
|
|
5461
|
+
import { Entity as Entity24, PrimaryGeneratedColumn as PrimaryGeneratedColumn24, Column as Column24, ManyToOne as ManyToOne14, JoinColumn as JoinColumn14 } from "typeorm";
|
|
5462
|
+
var Page = class {
|
|
5463
|
+
id;
|
|
5464
|
+
title;
|
|
5465
|
+
slug;
|
|
5466
|
+
content;
|
|
5467
|
+
published;
|
|
5468
|
+
theme;
|
|
5469
|
+
parentId;
|
|
5470
|
+
parent;
|
|
5471
|
+
seoId;
|
|
5472
|
+
seo;
|
|
5473
|
+
createdAt;
|
|
5474
|
+
updatedAt;
|
|
5475
|
+
deletedAt;
|
|
5476
|
+
deleted;
|
|
5477
|
+
createdBy;
|
|
5478
|
+
updatedBy;
|
|
5479
|
+
deletedBy;
|
|
5480
|
+
};
|
|
5481
|
+
__decorateClass([
|
|
5482
|
+
PrimaryGeneratedColumn24()
|
|
5483
|
+
], Page.prototype, "id", 2);
|
|
5484
|
+
__decorateClass([
|
|
5485
|
+
Column24("varchar")
|
|
5486
|
+
], Page.prototype, "title", 2);
|
|
5487
|
+
__decorateClass([
|
|
5488
|
+
Column24("varchar", { unique: true })
|
|
5489
|
+
], Page.prototype, "slug", 2);
|
|
5490
|
+
__decorateClass([
|
|
5491
|
+
Column24({ type: "jsonb", default: {} })
|
|
5492
|
+
], Page.prototype, "content", 2);
|
|
5493
|
+
__decorateClass([
|
|
5494
|
+
Column24("boolean", { default: false })
|
|
5495
|
+
], Page.prototype, "published", 2);
|
|
5496
|
+
__decorateClass([
|
|
5497
|
+
Column24("varchar", { default: "default" })
|
|
5498
|
+
], Page.prototype, "theme", 2);
|
|
5499
|
+
__decorateClass([
|
|
5500
|
+
Column24("int", { nullable: true })
|
|
5501
|
+
], Page.prototype, "parentId", 2);
|
|
5502
|
+
__decorateClass([
|
|
5503
|
+
ManyToOne14(() => Page, { onDelete: "SET NULL" }),
|
|
5504
|
+
JoinColumn14({ name: "parentId" })
|
|
5505
|
+
], Page.prototype, "parent", 2);
|
|
5506
|
+
__decorateClass([
|
|
5507
|
+
Column24("int", { nullable: true })
|
|
5508
|
+
], Page.prototype, "seoId", 2);
|
|
5509
|
+
__decorateClass([
|
|
5510
|
+
ManyToOne14(() => Seo, { onDelete: "SET NULL" }),
|
|
5511
|
+
JoinColumn14({ name: "seoId" })
|
|
5512
|
+
], Page.prototype, "seo", 2);
|
|
5513
|
+
__decorateClass([
|
|
5514
|
+
Column24({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5515
|
+
], Page.prototype, "createdAt", 2);
|
|
5516
|
+
__decorateClass([
|
|
5517
|
+
Column24({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5518
|
+
], Page.prototype, "updatedAt", 2);
|
|
5519
|
+
__decorateClass([
|
|
5520
|
+
Column24({ type: "timestamp", nullable: true })
|
|
5521
|
+
], Page.prototype, "deletedAt", 2);
|
|
5522
|
+
__decorateClass([
|
|
5523
|
+
Column24("boolean", { default: false })
|
|
5524
|
+
], Page.prototype, "deleted", 2);
|
|
5525
|
+
__decorateClass([
|
|
5526
|
+
Column24("int", { nullable: true })
|
|
5527
|
+
], Page.prototype, "createdBy", 2);
|
|
5528
|
+
__decorateClass([
|
|
5529
|
+
Column24("int", { nullable: true })
|
|
5530
|
+
], Page.prototype, "updatedBy", 2);
|
|
5531
|
+
__decorateClass([
|
|
5532
|
+
Column24("int", { nullable: true })
|
|
5533
|
+
], Page.prototype, "deletedBy", 2);
|
|
5534
|
+
Page = __decorateClass([
|
|
5535
|
+
Entity24("pages")
|
|
5536
|
+
], Page);
|
|
5537
|
+
|
|
5538
|
+
// src/entities/product-category.entity.ts
|
|
5539
|
+
import { Entity as Entity25, PrimaryGeneratedColumn as PrimaryGeneratedColumn25, Column as Column25, ManyToOne as ManyToOne15, OneToMany as OneToMany10, JoinColumn as JoinColumn15 } from "typeorm";
|
|
5540
|
+
var ProductCategory = class {
|
|
5541
|
+
id;
|
|
5542
|
+
name;
|
|
5543
|
+
slug;
|
|
5544
|
+
parentId;
|
|
5545
|
+
image;
|
|
5546
|
+
description;
|
|
5547
|
+
metadata;
|
|
5548
|
+
active;
|
|
5549
|
+
sortOrder;
|
|
5550
|
+
createdAt;
|
|
5551
|
+
updatedAt;
|
|
5552
|
+
deletedAt;
|
|
5553
|
+
deleted;
|
|
5554
|
+
createdBy;
|
|
5555
|
+
updatedBy;
|
|
5556
|
+
deletedBy;
|
|
5557
|
+
parent;
|
|
5558
|
+
children;
|
|
5559
|
+
products;
|
|
5560
|
+
collections;
|
|
5561
|
+
};
|
|
5562
|
+
__decorateClass([
|
|
5563
|
+
PrimaryGeneratedColumn25()
|
|
5564
|
+
], ProductCategory.prototype, "id", 2);
|
|
5565
|
+
__decorateClass([
|
|
5566
|
+
Column25("varchar")
|
|
5567
|
+
], ProductCategory.prototype, "name", 2);
|
|
5568
|
+
__decorateClass([
|
|
5569
|
+
Column25("varchar", { unique: true })
|
|
5570
|
+
], ProductCategory.prototype, "slug", 2);
|
|
5571
|
+
__decorateClass([
|
|
5572
|
+
Column25("int", { nullable: true })
|
|
5573
|
+
], ProductCategory.prototype, "parentId", 2);
|
|
5574
|
+
__decorateClass([
|
|
5575
|
+
Column25("varchar", { nullable: true })
|
|
5576
|
+
], ProductCategory.prototype, "image", 2);
|
|
5577
|
+
__decorateClass([
|
|
5578
|
+
Column25("text", { nullable: true })
|
|
5579
|
+
], ProductCategory.prototype, "description", 2);
|
|
5580
|
+
__decorateClass([
|
|
5581
|
+
Column25("jsonb", { nullable: true })
|
|
5582
|
+
], ProductCategory.prototype, "metadata", 2);
|
|
5583
|
+
__decorateClass([
|
|
5584
|
+
Column25("boolean", { default: true })
|
|
5585
|
+
], ProductCategory.prototype, "active", 2);
|
|
5586
|
+
__decorateClass([
|
|
5587
|
+
Column25("int", { default: 0 })
|
|
5588
|
+
], ProductCategory.prototype, "sortOrder", 2);
|
|
5589
|
+
__decorateClass([
|
|
5590
|
+
Column25({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5591
|
+
], ProductCategory.prototype, "createdAt", 2);
|
|
5592
|
+
__decorateClass([
|
|
5593
|
+
Column25({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5594
|
+
], ProductCategory.prototype, "updatedAt", 2);
|
|
5595
|
+
__decorateClass([
|
|
5596
|
+
Column25({ type: "timestamp", nullable: true })
|
|
5597
|
+
], ProductCategory.prototype, "deletedAt", 2);
|
|
5598
|
+
__decorateClass([
|
|
5599
|
+
Column25("boolean", { default: false })
|
|
5600
|
+
], ProductCategory.prototype, "deleted", 2);
|
|
5601
|
+
__decorateClass([
|
|
5602
|
+
Column25("int", { nullable: true })
|
|
5603
|
+
], ProductCategory.prototype, "createdBy", 2);
|
|
5604
|
+
__decorateClass([
|
|
5605
|
+
Column25("int", { nullable: true })
|
|
5606
|
+
], ProductCategory.prototype, "updatedBy", 2);
|
|
5607
|
+
__decorateClass([
|
|
5608
|
+
Column25("int", { nullable: true })
|
|
5609
|
+
], ProductCategory.prototype, "deletedBy", 2);
|
|
5610
|
+
__decorateClass([
|
|
5611
|
+
ManyToOne15(() => ProductCategory, (c) => c.children, { onDelete: "SET NULL" }),
|
|
5612
|
+
JoinColumn15({ name: "parentId" })
|
|
5613
|
+
], ProductCategory.prototype, "parent", 2);
|
|
5614
|
+
__decorateClass([
|
|
5615
|
+
OneToMany10(() => ProductCategory, (c) => c.parent)
|
|
5616
|
+
], ProductCategory.prototype, "children", 2);
|
|
5617
|
+
__decorateClass([
|
|
5618
|
+
OneToMany10("Product", "category")
|
|
5619
|
+
], ProductCategory.prototype, "products", 2);
|
|
5620
|
+
__decorateClass([
|
|
5621
|
+
OneToMany10("Collection", "category")
|
|
5622
|
+
], ProductCategory.prototype, "collections", 2);
|
|
5623
|
+
ProductCategory = __decorateClass([
|
|
5624
|
+
Entity25("product_categories")
|
|
5625
|
+
], ProductCategory);
|
|
5626
|
+
|
|
5627
|
+
// src/entities/collection.entity.ts
|
|
5628
|
+
import { Entity as Entity27, PrimaryGeneratedColumn as PrimaryGeneratedColumn27, Column as Column27, ManyToOne as ManyToOne17, OneToMany as OneToMany12, JoinColumn as JoinColumn17 } from "typeorm";
|
|
5629
|
+
|
|
5630
|
+
// src/entities/brand.entity.ts
|
|
5631
|
+
import { Entity as Entity26, PrimaryGeneratedColumn as PrimaryGeneratedColumn26, Column as Column26, OneToMany as OneToMany11, ManyToOne as ManyToOne16, JoinColumn as JoinColumn16 } from "typeorm";
|
|
5632
|
+
var Brand = class {
|
|
5633
|
+
id;
|
|
5634
|
+
name;
|
|
5635
|
+
slug;
|
|
5636
|
+
logo;
|
|
5637
|
+
metadata;
|
|
5638
|
+
description;
|
|
5639
|
+
active;
|
|
5640
|
+
sortOrder;
|
|
5641
|
+
createdAt;
|
|
5642
|
+
updatedAt;
|
|
5643
|
+
deletedAt;
|
|
5644
|
+
deleted;
|
|
5645
|
+
createdBy;
|
|
5646
|
+
updatedBy;
|
|
5647
|
+
deletedBy;
|
|
5648
|
+
seoId;
|
|
5649
|
+
seo;
|
|
5650
|
+
products;
|
|
5651
|
+
collections;
|
|
5652
|
+
};
|
|
5653
|
+
__decorateClass([
|
|
5654
|
+
PrimaryGeneratedColumn26()
|
|
5655
|
+
], Brand.prototype, "id", 2);
|
|
5656
|
+
__decorateClass([
|
|
5657
|
+
Column26("varchar")
|
|
5658
|
+
], Brand.prototype, "name", 2);
|
|
5659
|
+
__decorateClass([
|
|
5660
|
+
Column26("varchar", { unique: true })
|
|
5661
|
+
], Brand.prototype, "slug", 2);
|
|
5662
|
+
__decorateClass([
|
|
5663
|
+
Column26("varchar", { nullable: true })
|
|
5664
|
+
], Brand.prototype, "logo", 2);
|
|
5665
|
+
__decorateClass([
|
|
5666
|
+
Column26("jsonb", { nullable: true })
|
|
5667
|
+
], Brand.prototype, "metadata", 2);
|
|
5668
|
+
__decorateClass([
|
|
5669
|
+
Column26("text", { nullable: true })
|
|
5670
|
+
], Brand.prototype, "description", 2);
|
|
5671
|
+
__decorateClass([
|
|
5672
|
+
Column26("boolean", { default: true })
|
|
5673
|
+
], Brand.prototype, "active", 2);
|
|
5674
|
+
__decorateClass([
|
|
5675
|
+
Column26("int", { default: 0 })
|
|
5676
|
+
], Brand.prototype, "sortOrder", 2);
|
|
5677
|
+
__decorateClass([
|
|
5678
|
+
Column26({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5679
|
+
], Brand.prototype, "createdAt", 2);
|
|
5680
|
+
__decorateClass([
|
|
5681
|
+
Column26({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5682
|
+
], Brand.prototype, "updatedAt", 2);
|
|
5683
|
+
__decorateClass([
|
|
5684
|
+
Column26({ type: "timestamp", nullable: true })
|
|
5685
|
+
], Brand.prototype, "deletedAt", 2);
|
|
5686
|
+
__decorateClass([
|
|
5687
|
+
Column26("boolean", { default: false })
|
|
5688
|
+
], Brand.prototype, "deleted", 2);
|
|
5689
|
+
__decorateClass([
|
|
5690
|
+
Column26("int", { nullable: true })
|
|
5691
|
+
], Brand.prototype, "createdBy", 2);
|
|
5692
|
+
__decorateClass([
|
|
5693
|
+
Column26("int", { nullable: true })
|
|
5694
|
+
], Brand.prototype, "updatedBy", 2);
|
|
5695
|
+
__decorateClass([
|
|
5696
|
+
Column26("int", { nullable: true })
|
|
5697
|
+
], Brand.prototype, "deletedBy", 2);
|
|
5698
|
+
__decorateClass([
|
|
5699
|
+
Column26("int", { nullable: true })
|
|
5700
|
+
], Brand.prototype, "seoId", 2);
|
|
5701
|
+
__decorateClass([
|
|
5702
|
+
ManyToOne16(() => Seo, { onDelete: "SET NULL" }),
|
|
5703
|
+
JoinColumn16({ name: "seoId" })
|
|
5704
|
+
], Brand.prototype, "seo", 2);
|
|
5705
|
+
__decorateClass([
|
|
5706
|
+
OneToMany11("Product", "brand")
|
|
5707
|
+
], Brand.prototype, "products", 2);
|
|
5708
|
+
__decorateClass([
|
|
5709
|
+
OneToMany11("Collection", "brand")
|
|
5710
|
+
], Brand.prototype, "collections", 2);
|
|
5711
|
+
Brand = __decorateClass([
|
|
5712
|
+
Entity26("brands")
|
|
5713
|
+
], Brand);
|
|
5714
|
+
|
|
5715
|
+
// src/entities/collection.entity.ts
|
|
5716
|
+
var Collection = class {
|
|
5717
|
+
id;
|
|
5718
|
+
categoryId;
|
|
5719
|
+
brandId;
|
|
5720
|
+
name;
|
|
5721
|
+
slug;
|
|
5722
|
+
hsn;
|
|
5723
|
+
description;
|
|
5724
|
+
image;
|
|
5725
|
+
metadata;
|
|
5726
|
+
variants;
|
|
5727
|
+
active;
|
|
5728
|
+
sortOrder;
|
|
5729
|
+
createdAt;
|
|
5730
|
+
updatedAt;
|
|
5731
|
+
deletedAt;
|
|
5732
|
+
deleted;
|
|
5733
|
+
createdBy;
|
|
5734
|
+
updatedBy;
|
|
5735
|
+
deletedBy;
|
|
5736
|
+
seoId;
|
|
5737
|
+
seo;
|
|
5738
|
+
category;
|
|
5739
|
+
brand;
|
|
5740
|
+
products;
|
|
5741
|
+
};
|
|
5742
|
+
__decorateClass([
|
|
5743
|
+
PrimaryGeneratedColumn27()
|
|
5744
|
+
], Collection.prototype, "id", 2);
|
|
5745
|
+
__decorateClass([
|
|
5746
|
+
Column27("int", { nullable: true })
|
|
5747
|
+
], Collection.prototype, "categoryId", 2);
|
|
5748
|
+
__decorateClass([
|
|
5749
|
+
Column27("int", { nullable: true })
|
|
5750
|
+
], Collection.prototype, "brandId", 2);
|
|
5751
|
+
__decorateClass([
|
|
5752
|
+
Column27("varchar")
|
|
5753
|
+
], Collection.prototype, "name", 2);
|
|
5754
|
+
__decorateClass([
|
|
5755
|
+
Column27("varchar", { unique: true })
|
|
5756
|
+
], Collection.prototype, "slug", 2);
|
|
5757
|
+
__decorateClass([
|
|
5758
|
+
Column27("varchar", { nullable: true })
|
|
5759
|
+
], Collection.prototype, "hsn", 2);
|
|
5760
|
+
__decorateClass([
|
|
5761
|
+
Column27("text", { nullable: true })
|
|
5762
|
+
], Collection.prototype, "description", 2);
|
|
5763
|
+
__decorateClass([
|
|
5764
|
+
Column27("varchar", { nullable: true })
|
|
5765
|
+
], Collection.prototype, "image", 2);
|
|
5766
|
+
__decorateClass([
|
|
5767
|
+
Column27("jsonb", { nullable: true })
|
|
5768
|
+
], Collection.prototype, "metadata", 2);
|
|
5769
|
+
__decorateClass([
|
|
5770
|
+
Column27("jsonb", { nullable: true })
|
|
5771
|
+
], Collection.prototype, "variants", 2);
|
|
5772
|
+
__decorateClass([
|
|
5773
|
+
Column27("boolean", { default: true })
|
|
5774
|
+
], Collection.prototype, "active", 2);
|
|
5775
|
+
__decorateClass([
|
|
5776
|
+
Column27("int", { default: 0 })
|
|
5777
|
+
], Collection.prototype, "sortOrder", 2);
|
|
5778
|
+
__decorateClass([
|
|
5779
|
+
Column27({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5780
|
+
], Collection.prototype, "createdAt", 2);
|
|
5781
|
+
__decorateClass([
|
|
5782
|
+
Column27({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5783
|
+
], Collection.prototype, "updatedAt", 2);
|
|
5784
|
+
__decorateClass([
|
|
5785
|
+
Column27({ type: "timestamp", nullable: true })
|
|
5786
|
+
], Collection.prototype, "deletedAt", 2);
|
|
5787
|
+
__decorateClass([
|
|
5788
|
+
Column27("boolean", { default: false })
|
|
5789
|
+
], Collection.prototype, "deleted", 2);
|
|
5790
|
+
__decorateClass([
|
|
5791
|
+
Column27("int", { nullable: true })
|
|
5792
|
+
], Collection.prototype, "createdBy", 2);
|
|
5793
|
+
__decorateClass([
|
|
5794
|
+
Column27("int", { nullable: true })
|
|
5795
|
+
], Collection.prototype, "updatedBy", 2);
|
|
5796
|
+
__decorateClass([
|
|
5797
|
+
Column27("int", { nullable: true })
|
|
5798
|
+
], Collection.prototype, "deletedBy", 2);
|
|
5799
|
+
__decorateClass([
|
|
5800
|
+
Column27("int", { nullable: true })
|
|
5801
|
+
], Collection.prototype, "seoId", 2);
|
|
5802
|
+
__decorateClass([
|
|
5803
|
+
ManyToOne17(() => Seo, { onDelete: "SET NULL" }),
|
|
5804
|
+
JoinColumn17({ name: "seoId" })
|
|
5805
|
+
], Collection.prototype, "seo", 2);
|
|
5806
|
+
__decorateClass([
|
|
5807
|
+
ManyToOne17(() => ProductCategory, (c) => c.collections, { onDelete: "SET NULL" }),
|
|
5808
|
+
JoinColumn17({ name: "categoryId" })
|
|
5809
|
+
], Collection.prototype, "category", 2);
|
|
5810
|
+
__decorateClass([
|
|
5811
|
+
ManyToOne17(() => Brand, (b) => b.collections, { onDelete: "SET NULL" }),
|
|
5812
|
+
JoinColumn17({ name: "brandId" })
|
|
5813
|
+
], Collection.prototype, "brand", 2);
|
|
5814
|
+
__decorateClass([
|
|
5815
|
+
OneToMany12("Product", "collection")
|
|
5816
|
+
], Collection.prototype, "products", 2);
|
|
5817
|
+
Collection = __decorateClass([
|
|
5818
|
+
Entity27("collections")
|
|
5819
|
+
], Collection);
|
|
5820
|
+
|
|
5821
|
+
// src/entities/product.entity.ts
|
|
5822
|
+
import { Entity as Entity28, PrimaryGeneratedColumn as PrimaryGeneratedColumn28, Column as Column28, ManyToOne as ManyToOne18, OneToMany as OneToMany13, JoinColumn as JoinColumn18 } from "typeorm";
|
|
5823
|
+
var Product = class {
|
|
5824
|
+
id;
|
|
5825
|
+
collectionId;
|
|
5826
|
+
brandId;
|
|
5827
|
+
categoryId;
|
|
5828
|
+
sku;
|
|
5829
|
+
hsn;
|
|
5830
|
+
uom;
|
|
5831
|
+
type;
|
|
5832
|
+
slug;
|
|
5833
|
+
name;
|
|
5834
|
+
price;
|
|
5835
|
+
compareAtPrice;
|
|
5836
|
+
quantity;
|
|
5837
|
+
status;
|
|
5838
|
+
featured;
|
|
5839
|
+
metadata;
|
|
5840
|
+
createdAt;
|
|
5841
|
+
updatedAt;
|
|
5842
|
+
deletedAt;
|
|
5843
|
+
deleted;
|
|
5844
|
+
createdBy;
|
|
5845
|
+
updatedBy;
|
|
5846
|
+
deletedBy;
|
|
5847
|
+
seoId;
|
|
5848
|
+
seo;
|
|
5849
|
+
collection;
|
|
5850
|
+
brand;
|
|
5851
|
+
category;
|
|
5852
|
+
attributes;
|
|
5853
|
+
taxes;
|
|
5854
|
+
};
|
|
5855
|
+
__decorateClass([
|
|
5856
|
+
PrimaryGeneratedColumn28()
|
|
5857
|
+
], Product.prototype, "id", 2);
|
|
5858
|
+
__decorateClass([
|
|
5859
|
+
Column28("int", { nullable: true })
|
|
5860
|
+
], Product.prototype, "collectionId", 2);
|
|
5861
|
+
__decorateClass([
|
|
5862
|
+
Column28("int", { nullable: true })
|
|
5863
|
+
], Product.prototype, "brandId", 2);
|
|
5864
|
+
__decorateClass([
|
|
5865
|
+
Column28("int", { nullable: true })
|
|
5866
|
+
], Product.prototype, "categoryId", 2);
|
|
5867
|
+
__decorateClass([
|
|
5868
|
+
Column28("varchar", { nullable: true })
|
|
5869
|
+
], Product.prototype, "sku", 2);
|
|
5870
|
+
__decorateClass([
|
|
5871
|
+
Column28("varchar", { nullable: true })
|
|
5872
|
+
], Product.prototype, "hsn", 2);
|
|
5873
|
+
__decorateClass([
|
|
5874
|
+
Column28("varchar", { nullable: true })
|
|
5875
|
+
], Product.prototype, "uom", 2);
|
|
5876
|
+
__decorateClass([
|
|
5877
|
+
Column28("varchar", { default: "product" })
|
|
5878
|
+
], Product.prototype, "type", 2);
|
|
5879
|
+
__decorateClass([
|
|
5880
|
+
Column28("varchar", { unique: true, nullable: true })
|
|
5881
|
+
], Product.prototype, "slug", 2);
|
|
5882
|
+
__decorateClass([
|
|
5883
|
+
Column28("varchar", { nullable: true })
|
|
5884
|
+
], Product.prototype, "name", 2);
|
|
5885
|
+
__decorateClass([
|
|
5886
|
+
Column28("decimal", { precision: 12, scale: 2 })
|
|
5887
|
+
], Product.prototype, "price", 2);
|
|
5888
|
+
__decorateClass([
|
|
5889
|
+
Column28("decimal", { precision: 12, scale: 2, nullable: true })
|
|
5890
|
+
], Product.prototype, "compareAtPrice", 2);
|
|
5891
|
+
__decorateClass([
|
|
5892
|
+
Column28("int", { default: 0 })
|
|
5893
|
+
], Product.prototype, "quantity", 2);
|
|
5894
|
+
__decorateClass([
|
|
5895
|
+
Column28("varchar", { default: "draft" })
|
|
5896
|
+
], Product.prototype, "status", 2);
|
|
5897
|
+
__decorateClass([
|
|
5898
|
+
Column28("boolean", { default: false })
|
|
5899
|
+
], Product.prototype, "featured", 2);
|
|
5900
|
+
__decorateClass([
|
|
5901
|
+
Column28("jsonb", { nullable: true })
|
|
5902
|
+
], Product.prototype, "metadata", 2);
|
|
5903
|
+
__decorateClass([
|
|
5904
|
+
Column28({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5905
|
+
], Product.prototype, "createdAt", 2);
|
|
5906
|
+
__decorateClass([
|
|
5907
|
+
Column28({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5908
|
+
], Product.prototype, "updatedAt", 2);
|
|
5909
|
+
__decorateClass([
|
|
5910
|
+
Column28({ type: "timestamp", nullable: true })
|
|
5911
|
+
], Product.prototype, "deletedAt", 2);
|
|
5912
|
+
__decorateClass([
|
|
5913
|
+
Column28("boolean", { default: false })
|
|
5914
|
+
], Product.prototype, "deleted", 2);
|
|
5915
|
+
__decorateClass([
|
|
5916
|
+
Column28("int", { nullable: true })
|
|
5917
|
+
], Product.prototype, "createdBy", 2);
|
|
5918
|
+
__decorateClass([
|
|
5919
|
+
Column28("int", { nullable: true })
|
|
5920
|
+
], Product.prototype, "updatedBy", 2);
|
|
5921
|
+
__decorateClass([
|
|
5922
|
+
Column28("int", { nullable: true })
|
|
5923
|
+
], Product.prototype, "deletedBy", 2);
|
|
5924
|
+
__decorateClass([
|
|
5925
|
+
Column28("int", { nullable: true })
|
|
5926
|
+
], Product.prototype, "seoId", 2);
|
|
5927
|
+
__decorateClass([
|
|
5928
|
+
ManyToOne18(() => Seo, { onDelete: "SET NULL" }),
|
|
5929
|
+
JoinColumn18({ name: "seoId" })
|
|
5930
|
+
], Product.prototype, "seo", 2);
|
|
5931
|
+
__decorateClass([
|
|
5932
|
+
ManyToOne18(() => Collection, (c) => c.products, { onDelete: "SET NULL" }),
|
|
5933
|
+
JoinColumn18({ name: "collectionId" })
|
|
5934
|
+
], Product.prototype, "collection", 2);
|
|
5935
|
+
__decorateClass([
|
|
5936
|
+
ManyToOne18(() => Brand, (b) => b.products, { onDelete: "SET NULL" }),
|
|
5937
|
+
JoinColumn18({ name: "brandId" })
|
|
5938
|
+
], Product.prototype, "brand", 2);
|
|
5939
|
+
__decorateClass([
|
|
5940
|
+
ManyToOne18(() => ProductCategory, (c) => c.products, { onDelete: "SET NULL" }),
|
|
5941
|
+
JoinColumn18({ name: "categoryId" })
|
|
5942
|
+
], Product.prototype, "category", 2);
|
|
5943
|
+
__decorateClass([
|
|
5944
|
+
OneToMany13("ProductAttribute", "product")
|
|
5945
|
+
], Product.prototype, "attributes", 2);
|
|
5946
|
+
__decorateClass([
|
|
5947
|
+
OneToMany13("ProductTax", "product")
|
|
5948
|
+
], Product.prototype, "taxes", 2);
|
|
5949
|
+
Product = __decorateClass([
|
|
5950
|
+
Entity28("products")
|
|
5951
|
+
], Product);
|
|
5952
|
+
|
|
5953
|
+
// src/entities/attribute.entity.ts
|
|
5954
|
+
import { Entity as Entity29, PrimaryGeneratedColumn as PrimaryGeneratedColumn29, Column as Column29 } from "typeorm";
|
|
5955
|
+
var Attribute = class {
|
|
5956
|
+
id;
|
|
5957
|
+
name;
|
|
5958
|
+
slug;
|
|
5959
|
+
type;
|
|
5960
|
+
options;
|
|
5961
|
+
metadata;
|
|
5962
|
+
active;
|
|
5963
|
+
sortOrder;
|
|
5964
|
+
createdAt;
|
|
5965
|
+
updatedAt;
|
|
5966
|
+
deletedAt;
|
|
5967
|
+
deleted;
|
|
5968
|
+
createdBy;
|
|
5969
|
+
updatedBy;
|
|
5970
|
+
deletedBy;
|
|
5971
|
+
};
|
|
5972
|
+
__decorateClass([
|
|
5973
|
+
PrimaryGeneratedColumn29()
|
|
5974
|
+
], Attribute.prototype, "id", 2);
|
|
5975
|
+
__decorateClass([
|
|
5976
|
+
Column29("varchar")
|
|
5977
|
+
], Attribute.prototype, "name", 2);
|
|
5978
|
+
__decorateClass([
|
|
5979
|
+
Column29("varchar", { unique: true })
|
|
5980
|
+
], Attribute.prototype, "slug", 2);
|
|
5981
|
+
__decorateClass([
|
|
5982
|
+
Column29("varchar", { default: "text" })
|
|
5983
|
+
], Attribute.prototype, "type", 2);
|
|
5984
|
+
__decorateClass([
|
|
5985
|
+
Column29("jsonb", { nullable: true })
|
|
5986
|
+
], Attribute.prototype, "options", 2);
|
|
5987
|
+
__decorateClass([
|
|
5988
|
+
Column29("jsonb", { nullable: true })
|
|
5989
|
+
], Attribute.prototype, "metadata", 2);
|
|
5990
|
+
__decorateClass([
|
|
5991
|
+
Column29("boolean", { default: true })
|
|
5992
|
+
], Attribute.prototype, "active", 2);
|
|
5993
|
+
__decorateClass([
|
|
5994
|
+
Column29("int", { default: 0 })
|
|
5995
|
+
], Attribute.prototype, "sortOrder", 2);
|
|
5996
|
+
__decorateClass([
|
|
5997
|
+
Column29({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
5998
|
+
], Attribute.prototype, "createdAt", 2);
|
|
5999
|
+
__decorateClass([
|
|
6000
|
+
Column29({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6001
|
+
], Attribute.prototype, "updatedAt", 2);
|
|
6002
|
+
__decorateClass([
|
|
6003
|
+
Column29({ type: "timestamp", nullable: true })
|
|
6004
|
+
], Attribute.prototype, "deletedAt", 2);
|
|
6005
|
+
__decorateClass([
|
|
6006
|
+
Column29("boolean", { default: false })
|
|
6007
|
+
], Attribute.prototype, "deleted", 2);
|
|
6008
|
+
__decorateClass([
|
|
6009
|
+
Column29("int", { nullable: true })
|
|
6010
|
+
], Attribute.prototype, "createdBy", 2);
|
|
6011
|
+
__decorateClass([
|
|
6012
|
+
Column29("int", { nullable: true })
|
|
6013
|
+
], Attribute.prototype, "updatedBy", 2);
|
|
6014
|
+
__decorateClass([
|
|
6015
|
+
Column29("int", { nullable: true })
|
|
6016
|
+
], Attribute.prototype, "deletedBy", 2);
|
|
6017
|
+
Attribute = __decorateClass([
|
|
6018
|
+
Entity29("attributes")
|
|
6019
|
+
], Attribute);
|
|
6020
|
+
|
|
6021
|
+
// src/entities/product-attribute.entity.ts
|
|
6022
|
+
import { Entity as Entity30, PrimaryGeneratedColumn as PrimaryGeneratedColumn30, Column as Column30, ManyToOne as ManyToOne19, JoinColumn as JoinColumn19 } from "typeorm";
|
|
6023
|
+
var ProductAttribute = class {
|
|
6024
|
+
id;
|
|
6025
|
+
productId;
|
|
6026
|
+
attributeId;
|
|
6027
|
+
value;
|
|
6028
|
+
metadata;
|
|
6029
|
+
createdAt;
|
|
6030
|
+
updatedAt;
|
|
6031
|
+
product;
|
|
6032
|
+
attribute;
|
|
6033
|
+
};
|
|
6034
|
+
__decorateClass([
|
|
6035
|
+
PrimaryGeneratedColumn30()
|
|
6036
|
+
], ProductAttribute.prototype, "id", 2);
|
|
6037
|
+
__decorateClass([
|
|
6038
|
+
Column30("int")
|
|
6039
|
+
], ProductAttribute.prototype, "productId", 2);
|
|
6040
|
+
__decorateClass([
|
|
6041
|
+
Column30("int")
|
|
6042
|
+
], ProductAttribute.prototype, "attributeId", 2);
|
|
6043
|
+
__decorateClass([
|
|
6044
|
+
Column30("varchar")
|
|
6045
|
+
], ProductAttribute.prototype, "value", 2);
|
|
6046
|
+
__decorateClass([
|
|
6047
|
+
Column30("jsonb", { nullable: true })
|
|
6048
|
+
], ProductAttribute.prototype, "metadata", 2);
|
|
6049
|
+
__decorateClass([
|
|
6050
|
+
Column30({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6051
|
+
], ProductAttribute.prototype, "createdAt", 2);
|
|
6052
|
+
__decorateClass([
|
|
6053
|
+
Column30({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6054
|
+
], ProductAttribute.prototype, "updatedAt", 2);
|
|
6055
|
+
__decorateClass([
|
|
6056
|
+
ManyToOne19(() => Product, (p) => p.attributes, { onDelete: "CASCADE" }),
|
|
6057
|
+
JoinColumn19({ name: "productId" })
|
|
6058
|
+
], ProductAttribute.prototype, "product", 2);
|
|
6059
|
+
__decorateClass([
|
|
6060
|
+
ManyToOne19(() => Attribute, { onDelete: "CASCADE" }),
|
|
6061
|
+
JoinColumn19({ name: "attributeId" })
|
|
6062
|
+
], ProductAttribute.prototype, "attribute", 2);
|
|
6063
|
+
ProductAttribute = __decorateClass([
|
|
6064
|
+
Entity30("product_attributes")
|
|
6065
|
+
], ProductAttribute);
|
|
6066
|
+
|
|
6067
|
+
// src/entities/tax.entity.ts
|
|
6068
|
+
import { Entity as Entity31, PrimaryGeneratedColumn as PrimaryGeneratedColumn31, Column as Column31 } from "typeorm";
|
|
6069
|
+
var Tax = class {
|
|
6070
|
+
id;
|
|
6071
|
+
name;
|
|
6072
|
+
slug;
|
|
6073
|
+
rate;
|
|
6074
|
+
isDefault;
|
|
6075
|
+
description;
|
|
6076
|
+
active;
|
|
6077
|
+
metadata;
|
|
6078
|
+
createdAt;
|
|
6079
|
+
updatedAt;
|
|
6080
|
+
deletedAt;
|
|
6081
|
+
deleted;
|
|
6082
|
+
createdBy;
|
|
6083
|
+
updatedBy;
|
|
6084
|
+
deletedBy;
|
|
6085
|
+
};
|
|
6086
|
+
__decorateClass([
|
|
6087
|
+
PrimaryGeneratedColumn31()
|
|
6088
|
+
], Tax.prototype, "id", 2);
|
|
6089
|
+
__decorateClass([
|
|
6090
|
+
Column31("varchar")
|
|
6091
|
+
], Tax.prototype, "name", 2);
|
|
6092
|
+
__decorateClass([
|
|
6093
|
+
Column31("varchar", { unique: true })
|
|
6094
|
+
], Tax.prototype, "slug", 2);
|
|
6095
|
+
__decorateClass([
|
|
6096
|
+
Column31("decimal", { precision: 5, scale: 2 })
|
|
6097
|
+
], Tax.prototype, "rate", 2);
|
|
6098
|
+
__decorateClass([
|
|
6099
|
+
Column31("boolean", { default: false })
|
|
6100
|
+
], Tax.prototype, "isDefault", 2);
|
|
6101
|
+
__decorateClass([
|
|
6102
|
+
Column31("text", { nullable: true })
|
|
6103
|
+
], Tax.prototype, "description", 2);
|
|
6104
|
+
__decorateClass([
|
|
6105
|
+
Column31("boolean", { default: true })
|
|
6106
|
+
], Tax.prototype, "active", 2);
|
|
6107
|
+
__decorateClass([
|
|
6108
|
+
Column31("jsonb", { nullable: true })
|
|
6109
|
+
], Tax.prototype, "metadata", 2);
|
|
6110
|
+
__decorateClass([
|
|
6111
|
+
Column31({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6112
|
+
], Tax.prototype, "createdAt", 2);
|
|
6113
|
+
__decorateClass([
|
|
6114
|
+
Column31({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6115
|
+
], Tax.prototype, "updatedAt", 2);
|
|
6116
|
+
__decorateClass([
|
|
6117
|
+
Column31({ type: "timestamp", nullable: true })
|
|
6118
|
+
], Tax.prototype, "deletedAt", 2);
|
|
6119
|
+
__decorateClass([
|
|
6120
|
+
Column31("boolean", { default: false })
|
|
6121
|
+
], Tax.prototype, "deleted", 2);
|
|
6122
|
+
__decorateClass([
|
|
6123
|
+
Column31("int", { nullable: true })
|
|
6124
|
+
], Tax.prototype, "createdBy", 2);
|
|
6125
|
+
__decorateClass([
|
|
6126
|
+
Column31("int", { nullable: true })
|
|
6127
|
+
], Tax.prototype, "updatedBy", 2);
|
|
6128
|
+
__decorateClass([
|
|
6129
|
+
Column31("int", { nullable: true })
|
|
6130
|
+
], Tax.prototype, "deletedBy", 2);
|
|
6131
|
+
Tax = __decorateClass([
|
|
6132
|
+
Entity31("taxes")
|
|
6133
|
+
], Tax);
|
|
6134
|
+
|
|
6135
|
+
// src/entities/product-tax.entity.ts
|
|
6136
|
+
import { Entity as Entity32, PrimaryGeneratedColumn as PrimaryGeneratedColumn32, Column as Column32, ManyToOne as ManyToOne20, JoinColumn as JoinColumn20 } from "typeorm";
|
|
6137
|
+
var ProductTax = class {
|
|
6138
|
+
id;
|
|
6139
|
+
productId;
|
|
6140
|
+
taxId;
|
|
6141
|
+
rate;
|
|
6142
|
+
createdAt;
|
|
6143
|
+
updatedAt;
|
|
6144
|
+
product;
|
|
6145
|
+
tax;
|
|
6146
|
+
};
|
|
6147
|
+
__decorateClass([
|
|
6148
|
+
PrimaryGeneratedColumn32()
|
|
6149
|
+
], ProductTax.prototype, "id", 2);
|
|
6150
|
+
__decorateClass([
|
|
6151
|
+
Column32("int")
|
|
6152
|
+
], ProductTax.prototype, "productId", 2);
|
|
6153
|
+
__decorateClass([
|
|
6154
|
+
Column32("int")
|
|
6155
|
+
], ProductTax.prototype, "taxId", 2);
|
|
6156
|
+
__decorateClass([
|
|
6157
|
+
Column32("decimal", { precision: 5, scale: 2, nullable: true })
|
|
6158
|
+
], ProductTax.prototype, "rate", 2);
|
|
6159
|
+
__decorateClass([
|
|
6160
|
+
Column32({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6161
|
+
], ProductTax.prototype, "createdAt", 2);
|
|
6162
|
+
__decorateClass([
|
|
6163
|
+
Column32({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6164
|
+
], ProductTax.prototype, "updatedAt", 2);
|
|
6165
|
+
__decorateClass([
|
|
6166
|
+
ManyToOne20(() => Product, (p) => p.taxes, { onDelete: "CASCADE" }),
|
|
6167
|
+
JoinColumn20({ name: "productId" })
|
|
6168
|
+
], ProductTax.prototype, "product", 2);
|
|
6169
|
+
__decorateClass([
|
|
6170
|
+
ManyToOne20(() => Tax, { onDelete: "CASCADE" }),
|
|
6171
|
+
JoinColumn20({ name: "taxId" })
|
|
6172
|
+
], ProductTax.prototype, "tax", 2);
|
|
6173
|
+
ProductTax = __decorateClass([
|
|
6174
|
+
Entity32("product_taxes")
|
|
6175
|
+
], ProductTax);
|
|
6176
|
+
|
|
6177
|
+
// src/entities/order-item.entity.ts
|
|
6178
|
+
import { Entity as Entity33, PrimaryGeneratedColumn as PrimaryGeneratedColumn33, Column as Column33, ManyToOne as ManyToOne21, JoinColumn as JoinColumn21 } from "typeorm";
|
|
6179
|
+
var OrderItem = class {
|
|
6180
|
+
id;
|
|
6181
|
+
orderId;
|
|
6182
|
+
productId;
|
|
6183
|
+
quantity;
|
|
6184
|
+
unitPrice;
|
|
6185
|
+
tax;
|
|
6186
|
+
total;
|
|
6187
|
+
hsn;
|
|
6188
|
+
uom;
|
|
6189
|
+
productType;
|
|
6190
|
+
taxRate;
|
|
6191
|
+
taxCode;
|
|
6192
|
+
metadata;
|
|
6193
|
+
createdAt;
|
|
6194
|
+
updatedAt;
|
|
6195
|
+
order;
|
|
6196
|
+
product;
|
|
6197
|
+
};
|
|
6198
|
+
__decorateClass([
|
|
6199
|
+
PrimaryGeneratedColumn33()
|
|
6200
|
+
], OrderItem.prototype, "id", 2);
|
|
6201
|
+
__decorateClass([
|
|
6202
|
+
Column33("int")
|
|
6203
|
+
], OrderItem.prototype, "orderId", 2);
|
|
6204
|
+
__decorateClass([
|
|
6205
|
+
Column33("int")
|
|
6206
|
+
], OrderItem.prototype, "productId", 2);
|
|
6207
|
+
__decorateClass([
|
|
6208
|
+
Column33("int", { default: 1 })
|
|
6209
|
+
], OrderItem.prototype, "quantity", 2);
|
|
6210
|
+
__decorateClass([
|
|
6211
|
+
Column33("decimal", { precision: 12, scale: 2 })
|
|
6212
|
+
], OrderItem.prototype, "unitPrice", 2);
|
|
6213
|
+
__decorateClass([
|
|
6214
|
+
Column33("decimal", { precision: 12, scale: 2, default: 0 })
|
|
6215
|
+
], OrderItem.prototype, "tax", 2);
|
|
6216
|
+
__decorateClass([
|
|
6217
|
+
Column33("decimal", { precision: 12, scale: 2 })
|
|
6218
|
+
], OrderItem.prototype, "total", 2);
|
|
6219
|
+
__decorateClass([
|
|
6220
|
+
Column33("varchar", { nullable: true })
|
|
6221
|
+
], OrderItem.prototype, "hsn", 2);
|
|
6222
|
+
__decorateClass([
|
|
6223
|
+
Column33("varchar", { nullable: true })
|
|
6224
|
+
], OrderItem.prototype, "uom", 2);
|
|
6225
|
+
__decorateClass([
|
|
6226
|
+
Column33("varchar", { nullable: true })
|
|
6227
|
+
], OrderItem.prototype, "productType", 2);
|
|
6228
|
+
__decorateClass([
|
|
6229
|
+
Column33("decimal", { precision: 5, scale: 2, nullable: true })
|
|
6230
|
+
], OrderItem.prototype, "taxRate", 2);
|
|
6231
|
+
__decorateClass([
|
|
6232
|
+
Column33("varchar", { nullable: true })
|
|
6233
|
+
], OrderItem.prototype, "taxCode", 2);
|
|
6234
|
+
__decorateClass([
|
|
6235
|
+
Column33("jsonb", { nullable: true })
|
|
6236
|
+
], OrderItem.prototype, "metadata", 2);
|
|
6237
|
+
__decorateClass([
|
|
6238
|
+
Column33({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6239
|
+
], OrderItem.prototype, "createdAt", 2);
|
|
6240
|
+
__decorateClass([
|
|
6241
|
+
Column33({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6242
|
+
], OrderItem.prototype, "updatedAt", 2);
|
|
6243
|
+
__decorateClass([
|
|
6244
|
+
ManyToOne21(() => Order, (o) => o.items, { onDelete: "CASCADE" }),
|
|
6245
|
+
JoinColumn21({ name: "orderId" })
|
|
6246
|
+
], OrderItem.prototype, "order", 2);
|
|
6247
|
+
__decorateClass([
|
|
6248
|
+
ManyToOne21(() => Product, { onDelete: "CASCADE" }),
|
|
6249
|
+
JoinColumn21({ name: "productId" })
|
|
6250
|
+
], OrderItem.prototype, "product", 2);
|
|
6251
|
+
OrderItem = __decorateClass([
|
|
6252
|
+
Entity33("order_items")
|
|
6253
|
+
], OrderItem);
|
|
6254
|
+
|
|
6255
|
+
// src/entities/knowledge-base-document.entity.ts
|
|
6256
|
+
import { Entity as Entity35, PrimaryGeneratedColumn as PrimaryGeneratedColumn35, Column as Column35, OneToMany as OneToMany14 } from "typeorm";
|
|
6257
|
+
|
|
6258
|
+
// src/entities/knowledge-base-chunk.entity.ts
|
|
6259
|
+
import { Entity as Entity34, PrimaryGeneratedColumn as PrimaryGeneratedColumn34, Column as Column34, ManyToOne as ManyToOne22, JoinColumn as JoinColumn22 } from "typeorm";
|
|
6260
|
+
var KnowledgeBaseChunk = class {
|
|
6261
|
+
id;
|
|
6262
|
+
documentId;
|
|
6263
|
+
content;
|
|
6264
|
+
chunkIndex;
|
|
6265
|
+
createdAt;
|
|
6266
|
+
document;
|
|
6267
|
+
};
|
|
6268
|
+
__decorateClass([
|
|
6269
|
+
PrimaryGeneratedColumn34()
|
|
6270
|
+
], KnowledgeBaseChunk.prototype, "id", 2);
|
|
6271
|
+
__decorateClass([
|
|
6272
|
+
Column34("int")
|
|
6273
|
+
], KnowledgeBaseChunk.prototype, "documentId", 2);
|
|
6274
|
+
__decorateClass([
|
|
6275
|
+
Column34("text")
|
|
6276
|
+
], KnowledgeBaseChunk.prototype, "content", 2);
|
|
6277
|
+
__decorateClass([
|
|
6278
|
+
Column34("int", { default: 0 })
|
|
6279
|
+
], KnowledgeBaseChunk.prototype, "chunkIndex", 2);
|
|
6280
|
+
__decorateClass([
|
|
6281
|
+
Column34({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6282
|
+
], KnowledgeBaseChunk.prototype, "createdAt", 2);
|
|
6283
|
+
__decorateClass([
|
|
6284
|
+
ManyToOne22(() => KnowledgeBaseDocument, (d) => d.chunks, { onDelete: "CASCADE" }),
|
|
6285
|
+
JoinColumn22({ name: "documentId" })
|
|
6286
|
+
], KnowledgeBaseChunk.prototype, "document", 2);
|
|
6287
|
+
KnowledgeBaseChunk = __decorateClass([
|
|
6288
|
+
Entity34("knowledge_base_chunks")
|
|
6289
|
+
], KnowledgeBaseChunk);
|
|
6290
|
+
|
|
6291
|
+
// src/entities/knowledge-base-document.entity.ts
|
|
6292
|
+
var KnowledgeBaseDocument = class {
|
|
6293
|
+
id;
|
|
6294
|
+
name;
|
|
6295
|
+
sourceUrl;
|
|
6296
|
+
content;
|
|
6297
|
+
createdAt;
|
|
6298
|
+
updatedAt;
|
|
6299
|
+
chunks;
|
|
6300
|
+
};
|
|
6301
|
+
__decorateClass([
|
|
6302
|
+
PrimaryGeneratedColumn35()
|
|
6303
|
+
], KnowledgeBaseDocument.prototype, "id", 2);
|
|
6304
|
+
__decorateClass([
|
|
6305
|
+
Column35("varchar")
|
|
6306
|
+
], KnowledgeBaseDocument.prototype, "name", 2);
|
|
6307
|
+
__decorateClass([
|
|
6308
|
+
Column35("varchar", { nullable: true })
|
|
6309
|
+
], KnowledgeBaseDocument.prototype, "sourceUrl", 2);
|
|
6310
|
+
__decorateClass([
|
|
6311
|
+
Column35("text")
|
|
6312
|
+
], KnowledgeBaseDocument.prototype, "content", 2);
|
|
6313
|
+
__decorateClass([
|
|
6314
|
+
Column35({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6315
|
+
], KnowledgeBaseDocument.prototype, "createdAt", 2);
|
|
6316
|
+
__decorateClass([
|
|
6317
|
+
Column35({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6318
|
+
], KnowledgeBaseDocument.prototype, "updatedAt", 2);
|
|
6319
|
+
__decorateClass([
|
|
6320
|
+
OneToMany14(() => KnowledgeBaseChunk, (c) => c.document)
|
|
6321
|
+
], KnowledgeBaseDocument.prototype, "chunks", 2);
|
|
6322
|
+
KnowledgeBaseDocument = __decorateClass([
|
|
6323
|
+
Entity35("knowledge_base_documents")
|
|
6324
|
+
], KnowledgeBaseDocument);
|
|
6325
|
+
|
|
6326
|
+
// src/entities/cart.entity.ts
|
|
6327
|
+
import { Entity as Entity36, PrimaryGeneratedColumn as PrimaryGeneratedColumn36, Column as Column36, ManyToOne as ManyToOne23, OneToMany as OneToMany15, JoinColumn as JoinColumn23 } from "typeorm";
|
|
6328
|
+
var Cart = class {
|
|
6329
|
+
id;
|
|
6330
|
+
guestToken;
|
|
6331
|
+
contactId;
|
|
6332
|
+
currency;
|
|
6333
|
+
expiresAt;
|
|
6334
|
+
createdAt;
|
|
6335
|
+
updatedAt;
|
|
6336
|
+
contact;
|
|
6337
|
+
items;
|
|
6338
|
+
};
|
|
6339
|
+
__decorateClass([
|
|
6340
|
+
PrimaryGeneratedColumn36()
|
|
6341
|
+
], Cart.prototype, "id", 2);
|
|
6342
|
+
__decorateClass([
|
|
6343
|
+
Column36("varchar", { nullable: true })
|
|
6344
|
+
], Cart.prototype, "guestToken", 2);
|
|
6345
|
+
__decorateClass([
|
|
6346
|
+
Column36("int", { nullable: true })
|
|
6347
|
+
], Cart.prototype, "contactId", 2);
|
|
6348
|
+
__decorateClass([
|
|
6349
|
+
Column36("varchar", { default: "INR" })
|
|
6350
|
+
], Cart.prototype, "currency", 2);
|
|
6351
|
+
__decorateClass([
|
|
6352
|
+
Column36({ type: "timestamp", nullable: true })
|
|
6353
|
+
], Cart.prototype, "expiresAt", 2);
|
|
6354
|
+
__decorateClass([
|
|
6355
|
+
Column36({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6356
|
+
], Cart.prototype, "createdAt", 2);
|
|
6357
|
+
__decorateClass([
|
|
6358
|
+
Column36({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6359
|
+
], Cart.prototype, "updatedAt", 2);
|
|
6360
|
+
__decorateClass([
|
|
6361
|
+
ManyToOne23(() => Contact, { onDelete: "CASCADE" }),
|
|
6362
|
+
JoinColumn23({ name: "contactId" })
|
|
6363
|
+
], Cart.prototype, "contact", 2);
|
|
6364
|
+
__decorateClass([
|
|
6365
|
+
OneToMany15("CartItem", "cart")
|
|
6366
|
+
], Cart.prototype, "items", 2);
|
|
6367
|
+
Cart = __decorateClass([
|
|
6368
|
+
Entity36("carts")
|
|
6369
|
+
], Cart);
|
|
6370
|
+
|
|
6371
|
+
// src/entities/cart-item.entity.ts
|
|
6372
|
+
import { Entity as Entity37, PrimaryGeneratedColumn as PrimaryGeneratedColumn37, Column as Column37, ManyToOne as ManyToOne24, JoinColumn as JoinColumn24 } from "typeorm";
|
|
6373
|
+
var CartItem = class {
|
|
6374
|
+
id;
|
|
6375
|
+
cartId;
|
|
6376
|
+
productId;
|
|
6377
|
+
quantity;
|
|
6378
|
+
metadata;
|
|
6379
|
+
createdAt;
|
|
6380
|
+
updatedAt;
|
|
6381
|
+
cart;
|
|
6382
|
+
product;
|
|
6383
|
+
};
|
|
6384
|
+
__decorateClass([
|
|
6385
|
+
PrimaryGeneratedColumn37()
|
|
6386
|
+
], CartItem.prototype, "id", 2);
|
|
6387
|
+
__decorateClass([
|
|
6388
|
+
Column37("int")
|
|
6389
|
+
], CartItem.prototype, "cartId", 2);
|
|
6390
|
+
__decorateClass([
|
|
6391
|
+
Column37("int")
|
|
6392
|
+
], CartItem.prototype, "productId", 2);
|
|
6393
|
+
__decorateClass([
|
|
6394
|
+
Column37("int", { default: 1 })
|
|
6395
|
+
], CartItem.prototype, "quantity", 2);
|
|
6396
|
+
__decorateClass([
|
|
6397
|
+
Column37("jsonb", { nullable: true })
|
|
6398
|
+
], CartItem.prototype, "metadata", 2);
|
|
6399
|
+
__decorateClass([
|
|
6400
|
+
Column37({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6401
|
+
], CartItem.prototype, "createdAt", 2);
|
|
6402
|
+
__decorateClass([
|
|
6403
|
+
Column37({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6404
|
+
], CartItem.prototype, "updatedAt", 2);
|
|
6405
|
+
__decorateClass([
|
|
6406
|
+
ManyToOne24(() => Cart, (c) => c.items, { onDelete: "CASCADE" }),
|
|
6407
|
+
JoinColumn24({ name: "cartId" })
|
|
6408
|
+
], CartItem.prototype, "cart", 2);
|
|
6409
|
+
__decorateClass([
|
|
6410
|
+
ManyToOne24(() => Product, { onDelete: "CASCADE" }),
|
|
6411
|
+
JoinColumn24({ name: "productId" })
|
|
6412
|
+
], CartItem.prototype, "product", 2);
|
|
6413
|
+
CartItem = __decorateClass([
|
|
6414
|
+
Entity37("cart_items")
|
|
6415
|
+
], CartItem);
|
|
6416
|
+
|
|
6417
|
+
// src/entities/wishlist.entity.ts
|
|
6418
|
+
import { Entity as Entity38, PrimaryGeneratedColumn as PrimaryGeneratedColumn38, Column as Column38, ManyToOne as ManyToOne25, OneToMany as OneToMany16, JoinColumn as JoinColumn25 } from "typeorm";
|
|
6419
|
+
var Wishlist = class {
|
|
6420
|
+
id;
|
|
6421
|
+
guestId;
|
|
6422
|
+
contactId;
|
|
6423
|
+
name;
|
|
6424
|
+
createdAt;
|
|
6425
|
+
updatedAt;
|
|
6426
|
+
contact;
|
|
6427
|
+
items;
|
|
6428
|
+
};
|
|
6429
|
+
__decorateClass([
|
|
6430
|
+
PrimaryGeneratedColumn38()
|
|
6431
|
+
], Wishlist.prototype, "id", 2);
|
|
6432
|
+
__decorateClass([
|
|
6433
|
+
Column38("varchar", { nullable: true })
|
|
6434
|
+
], Wishlist.prototype, "guestId", 2);
|
|
6435
|
+
__decorateClass([
|
|
6436
|
+
Column38("int", { nullable: true })
|
|
6437
|
+
], Wishlist.prototype, "contactId", 2);
|
|
6438
|
+
__decorateClass([
|
|
6439
|
+
Column38("varchar", { default: "default" })
|
|
6440
|
+
], Wishlist.prototype, "name", 2);
|
|
6441
|
+
__decorateClass([
|
|
6442
|
+
Column38({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6443
|
+
], Wishlist.prototype, "createdAt", 2);
|
|
6444
|
+
__decorateClass([
|
|
6445
|
+
Column38({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6446
|
+
], Wishlist.prototype, "updatedAt", 2);
|
|
6447
|
+
__decorateClass([
|
|
6448
|
+
ManyToOne25(() => Contact, { onDelete: "CASCADE" }),
|
|
6449
|
+
JoinColumn25({ name: "contactId" })
|
|
6450
|
+
], Wishlist.prototype, "contact", 2);
|
|
6451
|
+
__decorateClass([
|
|
6452
|
+
OneToMany16("WishlistItem", "wishlist")
|
|
6453
|
+
], Wishlist.prototype, "items", 2);
|
|
6454
|
+
Wishlist = __decorateClass([
|
|
6455
|
+
Entity38("wishlists")
|
|
6456
|
+
], Wishlist);
|
|
6457
|
+
|
|
6458
|
+
// src/entities/wishlist-item.entity.ts
|
|
6459
|
+
import { Entity as Entity39, PrimaryGeneratedColumn as PrimaryGeneratedColumn39, Column as Column39, ManyToOne as ManyToOne26, JoinColumn as JoinColumn26 } from "typeorm";
|
|
6460
|
+
var WishlistItem = class {
|
|
6461
|
+
id;
|
|
6462
|
+
wishlistId;
|
|
6463
|
+
productId;
|
|
6464
|
+
metadata;
|
|
6465
|
+
createdAt;
|
|
6466
|
+
updatedAt;
|
|
6467
|
+
wishlist;
|
|
6468
|
+
product;
|
|
6469
|
+
};
|
|
6470
|
+
__decorateClass([
|
|
6471
|
+
PrimaryGeneratedColumn39()
|
|
6472
|
+
], WishlistItem.prototype, "id", 2);
|
|
6473
|
+
__decorateClass([
|
|
6474
|
+
Column39("int")
|
|
6475
|
+
], WishlistItem.prototype, "wishlistId", 2);
|
|
6476
|
+
__decorateClass([
|
|
6477
|
+
Column39("int")
|
|
6478
|
+
], WishlistItem.prototype, "productId", 2);
|
|
6479
|
+
__decorateClass([
|
|
6480
|
+
Column39("jsonb", { nullable: true })
|
|
6481
|
+
], WishlistItem.prototype, "metadata", 2);
|
|
6482
|
+
__decorateClass([
|
|
6483
|
+
Column39({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6484
|
+
], WishlistItem.prototype, "createdAt", 2);
|
|
6485
|
+
__decorateClass([
|
|
6486
|
+
Column39({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6487
|
+
], WishlistItem.prototype, "updatedAt", 2);
|
|
6488
|
+
__decorateClass([
|
|
6489
|
+
ManyToOne26(() => Wishlist, (w) => w.items, { onDelete: "CASCADE" }),
|
|
6490
|
+
JoinColumn26({ name: "wishlistId" })
|
|
6491
|
+
], WishlistItem.prototype, "wishlist", 2);
|
|
6492
|
+
__decorateClass([
|
|
6493
|
+
ManyToOne26(() => Product, { onDelete: "CASCADE" }),
|
|
6494
|
+
JoinColumn26({ name: "productId" })
|
|
6495
|
+
], WishlistItem.prototype, "product", 2);
|
|
6496
|
+
WishlistItem = __decorateClass([
|
|
6497
|
+
Entity39("wishlist_items")
|
|
6498
|
+
], WishlistItem);
|
|
6499
|
+
|
|
6500
|
+
// src/entities/llm-agent-knowledge-document.entity.ts
|
|
6501
|
+
import { Entity as Entity40, PrimaryGeneratedColumn as PrimaryGeneratedColumn40, Column as Column40, ManyToOne as ManyToOne27, JoinColumn as JoinColumn27, Index as Index2, Unique as Unique2 } from "typeorm";
|
|
6502
|
+
var LlmAgentKnowledgeDocument = class {
|
|
6503
|
+
id;
|
|
6504
|
+
agentId;
|
|
6505
|
+
documentId;
|
|
6506
|
+
createdAt;
|
|
6507
|
+
agent;
|
|
6508
|
+
document;
|
|
6509
|
+
};
|
|
6510
|
+
__decorateClass([
|
|
6511
|
+
PrimaryGeneratedColumn40()
|
|
6512
|
+
], LlmAgentKnowledgeDocument.prototype, "id", 2);
|
|
6513
|
+
__decorateClass([
|
|
6514
|
+
Column40("int")
|
|
6515
|
+
], LlmAgentKnowledgeDocument.prototype, "agentId", 2);
|
|
6516
|
+
__decorateClass([
|
|
6517
|
+
Column40("int")
|
|
6518
|
+
], LlmAgentKnowledgeDocument.prototype, "documentId", 2);
|
|
6519
|
+
__decorateClass([
|
|
6520
|
+
Column40({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
6521
|
+
], LlmAgentKnowledgeDocument.prototype, "createdAt", 2);
|
|
6522
|
+
__decorateClass([
|
|
6523
|
+
ManyToOne27(() => LlmAgent, { onDelete: "CASCADE" }),
|
|
6524
|
+
JoinColumn27({ name: "agentId" })
|
|
6525
|
+
], LlmAgentKnowledgeDocument.prototype, "agent", 2);
|
|
6526
|
+
__decorateClass([
|
|
6527
|
+
ManyToOne27(() => KnowledgeBaseDocument, { onDelete: "CASCADE" }),
|
|
6528
|
+
JoinColumn27({ name: "documentId" })
|
|
6529
|
+
], LlmAgentKnowledgeDocument.prototype, "document", 2);
|
|
6530
|
+
LlmAgentKnowledgeDocument = __decorateClass([
|
|
6531
|
+
Entity40("llm_agent_knowledge_documents"),
|
|
6532
|
+
Unique2("UQ_llm_agent_knowledge_agent_document", ["agentId", "documentId"]),
|
|
6533
|
+
Index2("IDX_llm_agent_knowledge_agent", ["agentId"])
|
|
6534
|
+
], LlmAgentKnowledgeDocument);
|
|
6535
|
+
|
|
6536
|
+
// src/entities/index.ts
|
|
6537
|
+
var CMS_ENTITY_MAP = {
|
|
6538
|
+
users: User,
|
|
6539
|
+
otp_challenges: OtpChallenge,
|
|
6540
|
+
password_reset_tokens: PasswordResetToken,
|
|
6541
|
+
user_groups: UserGroup,
|
|
6542
|
+
permissions: Permission,
|
|
6543
|
+
blogs: Blog,
|
|
6544
|
+
tags: Tag,
|
|
6545
|
+
categories: Category,
|
|
6546
|
+
comments: Comment,
|
|
6547
|
+
contacts: Contact,
|
|
6548
|
+
addresses: Address,
|
|
6549
|
+
forms: Form,
|
|
6550
|
+
form_fields: FormField,
|
|
6551
|
+
form_submissions: FormSubmission,
|
|
6552
|
+
seos: Seo,
|
|
6553
|
+
configs: Config,
|
|
6554
|
+
message_templates: MessageTemplate,
|
|
6555
|
+
media: Media,
|
|
6556
|
+
pages: Page,
|
|
6557
|
+
product_categories: ProductCategory,
|
|
6558
|
+
collections: Collection,
|
|
6559
|
+
products: Product,
|
|
6560
|
+
attributes: Attribute,
|
|
6561
|
+
product_attributes: ProductAttribute,
|
|
6562
|
+
taxes: Tax,
|
|
6563
|
+
product_taxes: ProductTax,
|
|
6564
|
+
orders: Order,
|
|
6565
|
+
order_items: OrderItem,
|
|
6566
|
+
payments: Payment,
|
|
6567
|
+
brands: Brand,
|
|
6568
|
+
knowledge_base_documents: KnowledgeBaseDocument,
|
|
6569
|
+
knowledge_base_chunks: KnowledgeBaseChunk,
|
|
6570
|
+
chat_conversations: ChatConversation,
|
|
6571
|
+
chat_messages: ChatMessage,
|
|
6572
|
+
carts: Cart,
|
|
6573
|
+
cart_items: CartItem,
|
|
6574
|
+
wishlists: Wishlist,
|
|
6575
|
+
wishlist_items: WishlistItem,
|
|
6576
|
+
llm_agents: LlmAgent,
|
|
6577
|
+
llm_agent_knowledge_documents: LlmAgentKnowledgeDocument
|
|
6578
|
+
};
|
|
6579
|
+
|
|
6580
|
+
// src/api/cms-api-handler.ts
|
|
6581
|
+
var KNOWLEDGE_SUFFIX = "knowledge";
|
|
6582
|
+
var CMS_API_LOG = "[cms-api]";
|
|
6583
|
+
function withLlmKnowledgeEntityFallbacks(base) {
|
|
6584
|
+
const keys = [
|
|
6585
|
+
"llm_agents",
|
|
6586
|
+
"llm_agent_knowledge_documents",
|
|
6587
|
+
"knowledge_base_documents",
|
|
6588
|
+
"knowledge_base_chunks"
|
|
6589
|
+
];
|
|
6590
|
+
const patch = {};
|
|
6591
|
+
for (const key of keys) {
|
|
6592
|
+
if (!(key in base) || base[key] == null) {
|
|
6593
|
+
const fallback = CMS_ENTITY_MAP[key];
|
|
6594
|
+
if (fallback) patch[key] = fallback;
|
|
6595
|
+
}
|
|
6596
|
+
}
|
|
6597
|
+
const merged = Object.keys(patch).length > 0 ? { ...base, ...patch } : base;
|
|
6598
|
+
if (!merged.llm_agents) {
|
|
6599
|
+
const agent = CMS_ENTITY_MAP.llm_agents ?? LlmAgent;
|
|
6600
|
+
return { ...merged, llm_agents: agent };
|
|
6601
|
+
}
|
|
6602
|
+
return merged;
|
|
6603
|
+
}
|
|
6604
|
+
function matchLlmAgentKnowledgeRoute(path) {
|
|
6605
|
+
const p = path[0] === "api" ? path.slice(1) : path;
|
|
6606
|
+
if (p[0] !== "llm_agents" || p.length < 2) return null;
|
|
6607
|
+
const seg1 = p[1];
|
|
6608
|
+
if (!seg1) return null;
|
|
6609
|
+
if (p[2] === KNOWLEDGE_SUFFIX) {
|
|
6610
|
+
return {
|
|
6611
|
+
slug: seg1,
|
|
6612
|
+
documentId: p.length >= 4 ? p[3] : void 0
|
|
6613
|
+
};
|
|
6614
|
+
}
|
|
6615
|
+
if (seg1.endsWith(KNOWLEDGE_SUFFIX) && seg1.length > KNOWLEDGE_SUFFIX.length) {
|
|
6616
|
+
const slug = seg1.slice(0, -KNOWLEDGE_SUFFIX.length);
|
|
6617
|
+
if (!slug) return null;
|
|
6618
|
+
if (p.length === 2) return { slug, documentId: void 0 };
|
|
6619
|
+
if (p.length === 3) return { slug, documentId: p[2] };
|
|
6620
|
+
}
|
|
6621
|
+
return null;
|
|
6622
|
+
}
|
|
6623
|
+
var DEFAULT_EXCLUDE = /* @__PURE__ */ new Set([
|
|
6624
|
+
"users",
|
|
6625
|
+
"password_reset_tokens",
|
|
6626
|
+
"user_groups",
|
|
6627
|
+
"permissions",
|
|
6628
|
+
"comments",
|
|
6629
|
+
"form_fields",
|
|
6630
|
+
"configs",
|
|
6631
|
+
"carts",
|
|
6632
|
+
"cart_items",
|
|
6633
|
+
"wishlists",
|
|
6634
|
+
"wishlist_items",
|
|
6635
|
+
"message_templates",
|
|
6636
|
+
"llm_agent_knowledge_documents"
|
|
6637
|
+
]);
|
|
6638
|
+
function createCmsApiHandler(config) {
|
|
6639
|
+
const {
|
|
6640
|
+
dataSource,
|
|
6641
|
+
entityMap: rawEntityMap,
|
|
6642
|
+
pathToModel = (s) => s,
|
|
6643
|
+
crudResources: crudResourcesOverride,
|
|
6644
|
+
getCms,
|
|
6645
|
+
userAuth: userAuthConfig,
|
|
6646
|
+
dashboard,
|
|
6647
|
+
ecommerceAnalytics,
|
|
6648
|
+
analytics: analyticsConfig,
|
|
6649
|
+
upload,
|
|
6650
|
+
blogBySlug,
|
|
6651
|
+
formBySlug,
|
|
6652
|
+
formSave: formSaveConfig,
|
|
6653
|
+
formSubmission: formSubmissionConfig,
|
|
6654
|
+
formSubmissionGetById: formSubmissionGetByIdConfig,
|
|
6655
|
+
usersApi,
|
|
6656
|
+
userAvatar,
|
|
6657
|
+
userProfile,
|
|
6658
|
+
settings: settingsConfig,
|
|
6659
|
+
chat: chatConfig,
|
|
6660
|
+
llmAgentKnowledge: llmAgentKnowledgeConfig,
|
|
6661
|
+
requireEntityPermission: userRequireEntityPermission,
|
|
6662
|
+
getSessionUser
|
|
6663
|
+
} = config;
|
|
6664
|
+
const entityMap = withLlmKnowledgeEntityFallbacks(rawEntityMap);
|
|
6665
|
+
const baseCrudResources = crudResourcesOverride ?? Object.keys(entityMap).filter((k) => !DEFAULT_EXCLUDE.has(k));
|
|
6666
|
+
const crudResources = entityMap.llm_agents && !baseCrudResources.includes("llm_agents") ? [...baseCrudResources, "llm_agents"] : baseCrudResources;
|
|
6667
|
+
const requireEntityPermissionEffective = userRequireEntityPermission ?? (async (_req, entity, action) => config.json({ error: "Forbidden", reason: "entity_rbac_required", entity, action }, { status: 403 }));
|
|
6668
|
+
const analytics = analyticsConfig ?? (getCms ? {
|
|
6669
|
+
json: config.json,
|
|
6670
|
+
requireAuth: async () => null,
|
|
6671
|
+
getAnalyticsData: async (days) => {
|
|
6672
|
+
const cms = await getCms();
|
|
6673
|
+
const a = cms.getPlugin("analytics");
|
|
6674
|
+
if (!a?.getAnalyticsData) throw new Error("Analytics not configured");
|
|
6675
|
+
return a.getAnalyticsData(days);
|
|
6676
|
+
},
|
|
6677
|
+
getPropertyId: () => ({ currentViewId: process.env.GOOGLE_ANALYTICS_VIEW_ID }),
|
|
6678
|
+
getPermissions: () => ({
|
|
6679
|
+
serviceAccountEmail: process.env.GOOGLE_ANALYTICS_CLIENT_EMAIL,
|
|
6680
|
+
currentViewId: process.env.GOOGLE_ANALYTICS_VIEW_ID
|
|
6681
|
+
})
|
|
6682
|
+
} : void 0);
|
|
6683
|
+
const userAuth = userAuthConfig && getCms && userAuthConfig.sendEmail === void 0 ? {
|
|
6684
|
+
...userAuthConfig,
|
|
6685
|
+
sendEmail: async (opts) => {
|
|
6686
|
+
const cms = await getCms();
|
|
6687
|
+
const queue = cms.getPlugin("queue");
|
|
6688
|
+
const companyDetails = config.getCompanyDetails ? await config.getCompanyDetails() : {};
|
|
6689
|
+
const resetLink = typeof opts.resetLink === "string" && opts.resetLink.trim() || typeof opts.text === "string" && opts.text.trim() || (typeof opts.html === "string" ? opts.html.match(/href\s*=\s*["']([^"']+)["']/)?.[1] ?? "" : "");
|
|
6690
|
+
const ctx = { resetLink, companyDetails };
|
|
6691
|
+
if (queue) {
|
|
6692
|
+
const { queueEmail: queueEmail2 } = await Promise.resolve().then(() => (init_email_queue(), email_queue_exports));
|
|
6693
|
+
await queueEmail2(cms, { to: opts.to, templateName: "passwordReset", ctx });
|
|
6694
|
+
return;
|
|
6695
|
+
}
|
|
6696
|
+
const email = cms.getPlugin("email");
|
|
6697
|
+
if (!email?.send) return;
|
|
6698
|
+
const rendered = email.renderTemplate("passwordReset", ctx);
|
|
6699
|
+
await email.send({ subject: rendered.subject, html: rendered.html, text: rendered.text, to: opts.to });
|
|
6700
|
+
}
|
|
6701
|
+
} : userAuthConfig;
|
|
6702
|
+
const crudOpts = {
|
|
6703
|
+
requireAuth: config.requireAuth,
|
|
6704
|
+
json: config.json,
|
|
6705
|
+
requireEntityPermission: requireEntityPermissionEffective,
|
|
6706
|
+
getCms,
|
|
6707
|
+
...getSessionUser ? {
|
|
6708
|
+
getDeletedByUserId: async () => {
|
|
6709
|
+
const u = await getSessionUser();
|
|
6710
|
+
if (!u?.id) return null;
|
|
6711
|
+
const n = Number(u.id);
|
|
6712
|
+
return Number.isFinite(n) ? n : null;
|
|
6713
|
+
}
|
|
6714
|
+
} : {}
|
|
6715
|
+
};
|
|
6716
|
+
const crud = createCrudHandler(dataSource, entityMap, crudOpts);
|
|
6717
|
+
const crudById = createCrudByIdHandler(dataSource, entityMap, crudOpts);
|
|
6718
|
+
const mergePerm = (c) => !c ? void 0 : { ...c, requireEntityPermission: requireEntityPermissionEffective };
|
|
6719
|
+
const adminRoles = getSessionUser && createAdminRolesHandlers({
|
|
6720
|
+
dataSource,
|
|
6721
|
+
entityMap,
|
|
6722
|
+
json: config.json,
|
|
6723
|
+
getSessionUser
|
|
6724
|
+
});
|
|
6725
|
+
const userAuthRouter = userAuth ? createUserAuthApiRouter(userAuth) : null;
|
|
6726
|
+
const dashboardGet = dashboard ? createDashboardStatsHandler(mergePerm(dashboard) ?? dashboard) : null;
|
|
6727
|
+
const ecommerceAnalyticsResolved = mergePerm(
|
|
6728
|
+
ecommerceAnalytics ?? {
|
|
6729
|
+
dataSource,
|
|
6730
|
+
entityMap,
|
|
6731
|
+
json: config.json,
|
|
6732
|
+
requireAuth: config.requireAuth
|
|
6733
|
+
}
|
|
6734
|
+
);
|
|
6735
|
+
const ecommerceAnalyticsGet = createEcommerceAnalyticsHandler(ecommerceAnalyticsResolved);
|
|
6736
|
+
const analyticsHandlers = analytics ? createAnalyticsHandlers(analytics) : null;
|
|
6737
|
+
const uploadMerged = upload ? {
|
|
6738
|
+
...mergePerm(upload) ?? upload,
|
|
6739
|
+
dataSource: upload.dataSource ?? dataSource,
|
|
6740
|
+
entityMap: upload.entityMap ?? entityMap
|
|
6741
|
+
} : null;
|
|
6742
|
+
const uploadPost = uploadMerged ? createUploadHandler(uploadMerged) : null;
|
|
6743
|
+
const zipExtractPost = uploadMerged ? createMediaZipExtractHandler(uploadMerged) : null;
|
|
6744
|
+
const blogBySlugGet = blogBySlug ? createBlogBySlugHandler(blogBySlug) : null;
|
|
6745
|
+
const formBySlugGet = formBySlug ? createFormBySlugHandler(formBySlug) : null;
|
|
6746
|
+
const formSaveHandlers = formSaveConfig ? createFormSaveHandlers(mergePerm(formSaveConfig) ?? formSaveConfig) : null;
|
|
6747
|
+
const formSubmissionPost = formSubmissionConfig ? createFormSubmissionHandler(formSubmissionConfig) : null;
|
|
3804
6748
|
const formSubmissionGetById = formSubmissionGetByIdConfig ? createFormSubmissionGetByIdHandler(mergePerm(formSubmissionGetByIdConfig) ?? formSubmissionGetByIdConfig) : null;
|
|
3805
6749
|
const formSubmissionList = formSubmissionGetByIdConfig ? createFormSubmissionListHandler(mergePerm(formSubmissionGetByIdConfig) ?? formSubmissionGetByIdConfig) : null;
|
|
3806
6750
|
const usersApiMerged = usersApi && getCms ? {
|
|
@@ -3826,7 +6770,7 @@ function createCmsApiHandler(config) {
|
|
|
3826
6770
|
const chatHandlers = chatConfig ? createChatHandlers(chatConfig) : null;
|
|
3827
6771
|
const llmAgentKnowledgeMerged = llmAgentKnowledgeConfig ?? (chatConfig ? {
|
|
3828
6772
|
dataSource: chatConfig.dataSource,
|
|
3829
|
-
entityMap: chatConfig.entityMap,
|
|
6773
|
+
entityMap: withLlmKnowledgeEntityFallbacks(chatConfig.entityMap ?? rawEntityMap),
|
|
3830
6774
|
getCms: chatConfig.getCms,
|
|
3831
6775
|
json: chatConfig.json,
|
|
3832
6776
|
requireAuth: chatConfig.requireAuth
|
|
@@ -3840,7 +6784,9 @@ function createCmsApiHandler(config) {
|
|
|
3840
6784
|
return crudResources.includes(model) ? model : segment;
|
|
3841
6785
|
}
|
|
3842
6786
|
return {
|
|
3843
|
-
async handle(method,
|
|
6787
|
+
async handle(method, pathInput, req) {
|
|
6788
|
+
const m = typeof method === "string" ? method.toUpperCase() : "GET";
|
|
6789
|
+
const path = pathInput.length > 0 && pathInput[0] === "api" ? pathInput.slice(1) : pathInput;
|
|
3844
6790
|
async function analyticsGate() {
|
|
3845
6791
|
const a = await config.requireAuth(req);
|
|
3846
6792
|
if (a) return a;
|
|
@@ -3848,86 +6794,86 @@ function createCmsApiHandler(config) {
|
|
|
3848
6794
|
}
|
|
3849
6795
|
if (path[0] === "admin" && path[1] === "roles") {
|
|
3850
6796
|
if (!adminRoles) return config.json({ error: "Not found" }, { status: 404 });
|
|
3851
|
-
if (path.length === 2 &&
|
|
3852
|
-
if (path.length === 2 &&
|
|
3853
|
-
if (path.length === 3 &&
|
|
3854
|
-
if (path.length === 3 &&
|
|
3855
|
-
if (path.length === 4 && path[3] === "permissions" &&
|
|
6797
|
+
if (path.length === 2 && m === "GET") return adminRoles.list();
|
|
6798
|
+
if (path.length === 2 && m === "POST") return adminRoles.createGroup(req);
|
|
6799
|
+
if (path.length === 3 && m === "PATCH") return adminRoles.patchGroup(req, path[2]);
|
|
6800
|
+
if (path.length === 3 && m === "DELETE") return adminRoles.deleteGroup(path[2]);
|
|
6801
|
+
if (path.length === 4 && path[3] === "permissions" && m === "PUT") return adminRoles.putPermissions(req, path[2]);
|
|
3856
6802
|
return config.json({ error: "Not found" }, { status: 404 });
|
|
3857
6803
|
}
|
|
3858
|
-
if (path[0] === "dashboard" && path[1] === "stats" && path.length === 2 &&
|
|
6804
|
+
if (path[0] === "dashboard" && path[1] === "stats" && path.length === 2 && m === "GET" && dashboardGet) {
|
|
3859
6805
|
return dashboardGet(req);
|
|
3860
6806
|
}
|
|
3861
|
-
if (path[0] === "dashboard" && path[1] === "ecommerce" && path.length === 2 &&
|
|
6807
|
+
if (path[0] === "dashboard" && path[1] === "ecommerce" && path.length === 2 && m === "GET" && ecommerceAnalyticsGet) {
|
|
3862
6808
|
const g = await analyticsGate();
|
|
3863
6809
|
if (g) return g;
|
|
3864
6810
|
return ecommerceAnalyticsGet(req);
|
|
3865
6811
|
}
|
|
3866
6812
|
if (path[0] === "analytics" && analyticsHandlers) {
|
|
3867
|
-
if (path.length === 1 &&
|
|
6813
|
+
if (path.length === 1 && m === "GET") {
|
|
3868
6814
|
const g = await analyticsGate();
|
|
3869
6815
|
if (g) return g;
|
|
3870
6816
|
return analyticsHandlers.GET(req);
|
|
3871
6817
|
}
|
|
3872
|
-
if (path.length === 2 && path[1] === "property-id" &&
|
|
6818
|
+
if (path.length === 2 && path[1] === "property-id" && m === "GET") {
|
|
3873
6819
|
const g = await analyticsGate();
|
|
3874
6820
|
if (g) return g;
|
|
3875
6821
|
return analyticsHandlers.propertyId();
|
|
3876
6822
|
}
|
|
3877
|
-
if (path.length === 2 && path[1] === "permissions" &&
|
|
6823
|
+
if (path.length === 2 && path[1] === "permissions" && m === "GET") {
|
|
3878
6824
|
const g = await analyticsGate();
|
|
3879
6825
|
if (g) return g;
|
|
3880
6826
|
return analyticsHandlers.permissions();
|
|
3881
6827
|
}
|
|
3882
6828
|
}
|
|
3883
|
-
if (path[0] === "upload" && path.length === 1 &&
|
|
3884
|
-
if (path[0] === "media" && path[1] === "extract" && path.length === 3 &&
|
|
6829
|
+
if (path[0] === "upload" && path.length === 1 && m === "POST" && uploadPost) return uploadPost(req);
|
|
6830
|
+
if (path[0] === "media" && path[1] === "extract" && path.length === 3 && m === "POST" && zipExtractPost) {
|
|
3885
6831
|
return zipExtractPost(req, path[2]);
|
|
3886
6832
|
}
|
|
3887
|
-
if (path[0] === "blogs" && path[1] === "slug" && path.length === 3 &&
|
|
6833
|
+
if (path[0] === "blogs" && path[1] === "slug" && path.length === 3 && m === "GET" && blogBySlugGet) {
|
|
3888
6834
|
return blogBySlugGet(req, path[2]);
|
|
3889
6835
|
}
|
|
3890
|
-
if (path[0] === "forms" && path[1] === "slug" && path.length === 3 &&
|
|
6836
|
+
if (path[0] === "forms" && path[1] === "slug" && path.length === 3 && m === "GET" && formBySlugGet) {
|
|
3891
6837
|
return formBySlugGet(req, path[2]);
|
|
3892
6838
|
}
|
|
3893
6839
|
if (path[0] === "form-submissions") {
|
|
3894
6840
|
if (path.length === 1) {
|
|
3895
|
-
if (
|
|
3896
|
-
if (
|
|
6841
|
+
if (m === "GET" && formSubmissionList) return formSubmissionList(req);
|
|
6842
|
+
if (m === "POST" && formSubmissionPost) return formSubmissionPost(req);
|
|
3897
6843
|
}
|
|
3898
|
-
if (path.length === 2 &&
|
|
6844
|
+
if (path.length === 2 && m === "GET" && formSubmissionGetById) return formSubmissionGetById(req, path[1]);
|
|
3899
6845
|
}
|
|
3900
6846
|
if (path[0] === "forms" && formSaveHandlers) {
|
|
3901
|
-
if (path.length === 1 &&
|
|
6847
|
+
if (path.length === 1 && m === "POST") return formSaveHandlers.POST(req);
|
|
3902
6848
|
if (path.length === 2) {
|
|
3903
|
-
if (
|
|
3904
|
-
if (
|
|
6849
|
+
if (m === "GET") return formSaveHandlers.GET(req, path[1]);
|
|
6850
|
+
if (m === "PUT" || m === "PATCH") return formSaveHandlers.PUT(req, path[1]);
|
|
3905
6851
|
}
|
|
3906
6852
|
}
|
|
3907
6853
|
if (path[0] === "users" && usersHandlers) {
|
|
3908
6854
|
if (path.length === 1) {
|
|
3909
|
-
if (
|
|
3910
|
-
if (
|
|
6855
|
+
if (m === "GET") return usersHandlers.list(req);
|
|
6856
|
+
if (m === "POST") return usersHandlers.create(req);
|
|
3911
6857
|
}
|
|
3912
6858
|
if (path.length === 2) {
|
|
3913
|
-
if (path[1] === "avatar" &&
|
|
3914
|
-
if (path[1] === "profile" &&
|
|
6859
|
+
if (path[1] === "avatar" && m === "POST" && avatarPost) return avatarPost(req);
|
|
6860
|
+
if (path[1] === "profile" && m === "PUT" && profilePut) return profilePut(req);
|
|
3915
6861
|
const id = path[1];
|
|
3916
|
-
if (
|
|
3917
|
-
if (
|
|
3918
|
-
if (
|
|
6862
|
+
if (m === "GET") return usersHandlers.getById(req, id);
|
|
6863
|
+
if (m === "PUT" || m === "PATCH") return usersHandlers.update(req, id);
|
|
6864
|
+
if (m === "DELETE") return usersHandlers.delete(req, id);
|
|
3919
6865
|
}
|
|
3920
|
-
if (path.length === 3 && path[2] === "regenerate-invite" &&
|
|
6866
|
+
if (path.length === 3 && path[2] === "regenerate-invite" && m === "POST") {
|
|
3921
6867
|
return usersHandlers.regenerateInvite(req, path[1]);
|
|
3922
6868
|
}
|
|
3923
6869
|
}
|
|
3924
|
-
if (path[0] === "users" && path.length === 2 && userAuthRouter &&
|
|
6870
|
+
if (path[0] === "users" && path.length === 2 && userAuthRouter && m === "POST") {
|
|
3925
6871
|
return userAuthRouter.POST(req, path[1]);
|
|
3926
6872
|
}
|
|
3927
6873
|
if (path[0] === "settings" && path.length === 2 && settingsHandlers) {
|
|
3928
6874
|
const group = path[1];
|
|
3929
6875
|
const isPublic = settingsConfig?.publicGetGroups?.includes(group);
|
|
3930
|
-
if (
|
|
6876
|
+
if (m === "GET") {
|
|
3931
6877
|
if (!isPublic) {
|
|
3932
6878
|
const a = await config.requireAuth(req);
|
|
3933
6879
|
if (a) return a;
|
|
@@ -3936,15 +6882,38 @@ function createCmsApiHandler(config) {
|
|
|
3936
6882
|
}
|
|
3937
6883
|
return settingsHandlers.GET(req, group);
|
|
3938
6884
|
}
|
|
3939
|
-
if (
|
|
6885
|
+
if (m === "PUT") {
|
|
3940
6886
|
const pe = await requireEntityPermissionEffective(req, "settings", "update");
|
|
3941
6887
|
if (pe) return pe;
|
|
3942
6888
|
return settingsHandlers.PUT(req, group);
|
|
3943
6889
|
}
|
|
3944
6890
|
}
|
|
3945
6891
|
if (path[0] === "message-templates" && path[1] === "sms" && path.length === 2) {
|
|
3946
|
-
if (
|
|
3947
|
-
if (
|
|
6892
|
+
if (m === "GET") return smsMessageTemplateHandlers.GET(req);
|
|
6893
|
+
if (m === "PUT") return smsMessageTemplateHandlers.PUT(req);
|
|
6894
|
+
}
|
|
6895
|
+
if (path[0] === "llm_agents") {
|
|
6896
|
+
if (!entityMap.llm_agents) {
|
|
6897
|
+
console.error(CMS_API_LOG, "llm_agents route: entity missing after merge", {
|
|
6898
|
+
method: m,
|
|
6899
|
+
pathJoined: path.join("/"),
|
|
6900
|
+
entityMapKeyCount: Object.keys(entityMap).length
|
|
6901
|
+
});
|
|
6902
|
+
return config.json(
|
|
6903
|
+
{ error: "LlmAgent entity is not registered", hint: "Ensure migrations ran and entities include LlmAgent." },
|
|
6904
|
+
{ status: 503 }
|
|
6905
|
+
);
|
|
6906
|
+
}
|
|
6907
|
+
if (path.length === 1) {
|
|
6908
|
+
if (m === "GET") return crud.GET(req, "llm_agents");
|
|
6909
|
+
if (m === "POST") return crud.POST(req, "llm_agents");
|
|
6910
|
+
}
|
|
6911
|
+
if (path.length === 2 && !path[1]?.includes("knowledge")) {
|
|
6912
|
+
const id = path[1];
|
|
6913
|
+
if (m === "GET") return crudById.GET(req, "llm_agents", id);
|
|
6914
|
+
if (m === "PUT" || m === "PATCH") return crudById.PUT(req, "llm_agents", id);
|
|
6915
|
+
if (m === "DELETE") return crudById.DELETE(req, "llm_agents", id);
|
|
6916
|
+
}
|
|
3948
6917
|
}
|
|
3949
6918
|
{
|
|
3950
6919
|
const kbMatch = matchLlmAgentKnowledgeRoute(path);
|
|
@@ -3959,24 +6928,24 @@ function createCmsApiHandler(config) {
|
|
|
3959
6928
|
);
|
|
3960
6929
|
}
|
|
3961
6930
|
const { slug, documentId } = kbMatch;
|
|
3962
|
-
if (
|
|
6931
|
+
if (m === "DELETE" && documentId != null && documentId !== "") {
|
|
3963
6932
|
return llmAgentKnowledgeHandlers.unlink(req, slug, documentId);
|
|
3964
6933
|
}
|
|
3965
|
-
if (
|
|
6934
|
+
if (m === "GET" && (documentId == null || documentId === "")) {
|
|
3966
6935
|
return llmAgentKnowledgeHandlers.list(req, slug);
|
|
3967
6936
|
}
|
|
3968
|
-
if (
|
|
6937
|
+
if (m === "POST" && (documentId == null || documentId === "")) {
|
|
3969
6938
|
return llmAgentKnowledgeHandlers.post(req, slug);
|
|
3970
6939
|
}
|
|
3971
6940
|
}
|
|
3972
6941
|
}
|
|
3973
6942
|
if (path[0] === "chat" && chatHandlers) {
|
|
3974
|
-
if (path.length === 2 && path[1] === "config" &&
|
|
3975
|
-
if (path.length === 2 && path[1] === "identify" &&
|
|
3976
|
-
if (path.length === 4 && path[1] === "conversations" && path[3] === "messages" &&
|
|
3977
|
-
if (path.length === 2 && path[1] === "messages" &&
|
|
6943
|
+
if (path.length === 2 && path[1] === "config" && m === "GET") return chatHandlers.publicConfig(req);
|
|
6944
|
+
if (path.length === 2 && path[1] === "identify" && m === "POST") return chatHandlers.identify(req);
|
|
6945
|
+
if (path.length === 4 && path[1] === "conversations" && path[3] === "messages" && m === "GET") return chatHandlers.getMessages(req, path[2]);
|
|
6946
|
+
if (path.length === 2 && path[1] === "messages" && m === "POST") return chatHandlers.postMessage(req);
|
|
3978
6947
|
}
|
|
3979
|
-
if (path[0] === "orders" && path.length === 3 && path[2] === "invoice" &&
|
|
6948
|
+
if (path[0] === "orders" && path.length === 3 && path[2] === "invoice" && m === "GET" && getCms) {
|
|
3980
6949
|
const a = await config.requireAuth(req);
|
|
3981
6950
|
if (a) return a;
|
|
3982
6951
|
const pe = await requireEntityPermissionEffective(req, "orders", "read");
|
|
@@ -3990,17 +6959,17 @@ function createCmsApiHandler(config) {
|
|
|
3990
6959
|
if (path[0] === "orders" && path.length === 3 && path[2] === "repost-erp" && getCms) {
|
|
3991
6960
|
const a = await config.requireAuth(req);
|
|
3992
6961
|
if (a) return a;
|
|
3993
|
-
const pe = await requireEntityPermissionEffective(req, "orders",
|
|
6962
|
+
const pe = await requireEntityPermissionEffective(req, "orders", m === "GET" ? "read" : "update");
|
|
3994
6963
|
if (pe) return pe;
|
|
3995
6964
|
const oid = Number(path[1]);
|
|
3996
6965
|
if (!Number.isFinite(oid)) return config.json({ error: "Invalid id" }, { status: 400 });
|
|
3997
6966
|
const cms = await getCms();
|
|
3998
6967
|
const { isErpIntegrationEnabled: isErpIntegrationEnabled3 } = await Promise.resolve().then(() => (init_erp_config_enabled(), erp_config_enabled_exports));
|
|
3999
6968
|
const enabled = await isErpIntegrationEnabled3(cms, dataSource, entityMap);
|
|
4000
|
-
if (
|
|
6969
|
+
if (m === "GET") {
|
|
4001
6970
|
return config.json({ enabled });
|
|
4002
6971
|
}
|
|
4003
|
-
if (
|
|
6972
|
+
if (m === "POST") {
|
|
4004
6973
|
if (!enabled) return config.json({ error: "ERP integration is disabled" }, { status: 409 });
|
|
4005
6974
|
const { queueErpPaidOrderForOrderId: queueErpPaidOrderForOrderId2 } = await Promise.resolve().then(() => (init_paid_order_erp(), paid_order_erp_exports));
|
|
4006
6975
|
await queueErpPaidOrderForOrderId2(cms, dataSource, entityMap, oid);
|
|
@@ -4010,28 +6979,39 @@ function createCmsApiHandler(config) {
|
|
|
4010
6979
|
}
|
|
4011
6980
|
if (path.length === 0) return config.json({ error: "Not found" }, { status: 404 });
|
|
4012
6981
|
const resource = resolveResource(path[0]);
|
|
4013
|
-
if (!crudResources.includes(resource))
|
|
6982
|
+
if (!crudResources.includes(resource)) {
|
|
6983
|
+
console.warn(CMS_API_LOG, "generic CRUD gate: Invalid resource (not in crudResources)", {
|
|
6984
|
+
method: m,
|
|
6985
|
+
pathJoined: path.join("/"),
|
|
6986
|
+
pathSegments: path,
|
|
6987
|
+
resource,
|
|
6988
|
+
hasLlmAgentsEntity: Boolean(entityMap.llm_agents),
|
|
6989
|
+
crudResourcesHasResource: crudResources.includes(resource),
|
|
6990
|
+
crudResourcesLength: crudResources.length
|
|
6991
|
+
});
|
|
6992
|
+
return config.json({ error: "Invalid resource" }, { status: 400 });
|
|
6993
|
+
}
|
|
4014
6994
|
if (path.length === 2) {
|
|
4015
|
-
if (path[1] === "metadata" &&
|
|
6995
|
+
if (path[1] === "metadata" && m === "GET") {
|
|
4016
6996
|
return crud.GET_METADATA(req, resource);
|
|
4017
6997
|
}
|
|
4018
|
-
if (path[1] === "bulk" &&
|
|
6998
|
+
if (path[1] === "bulk" && m === "POST") {
|
|
4019
6999
|
return crud.BULK_POST(req, resource);
|
|
4020
7000
|
}
|
|
4021
|
-
if (path[1] === "export" &&
|
|
7001
|
+
if (path[1] === "export" && m === "GET") {
|
|
4022
7002
|
return crud.GET_EXPORT(req, resource);
|
|
4023
7003
|
}
|
|
4024
7004
|
}
|
|
4025
7005
|
if (path.length === 1) {
|
|
4026
|
-
if (
|
|
4027
|
-
if (
|
|
7006
|
+
if (m === "GET") return crud.GET(req, resource);
|
|
7007
|
+
if (m === "POST") return crud.POST(req, resource);
|
|
4028
7008
|
return config.json({ error: "Method not allowed" }, { status: 405 });
|
|
4029
7009
|
}
|
|
4030
7010
|
if (path.length === 2) {
|
|
4031
7011
|
const id = path[1];
|
|
4032
|
-
if (
|
|
4033
|
-
if (
|
|
4034
|
-
if (
|
|
7012
|
+
if (m === "GET") return crudById.GET(req, resource, id);
|
|
7013
|
+
if (m === "PUT" || m === "PATCH") return crudById.PUT(req, resource, id);
|
|
7014
|
+
if (m === "DELETE") return crudById.DELETE(req, resource, id);
|
|
4035
7015
|
return config.json({ error: "Method not allowed" }, { status: 405 });
|
|
4036
7016
|
}
|
|
4037
7017
|
return config.json({ error: "Not found" }, { status: 404 });
|