only_ever_generator 4.0.2 → 4.0.4
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/bootstrap/app.js +7 -7
- package/dist/bootstrap/app.js.map +1 -1
- package/dist/helper/mongo_helper.d.ts +5 -0
- package/dist/helper/mongo_helper.d.ts.map +1 -0
- package/dist/helper/mongo_helper.js +12 -0
- package/dist/helper/mongo_helper.js.map +1 -0
- package/dist/helper/schema_helper/build_classify_summarize_schema.d.ts +1 -76
- package/dist/helper/schema_helper/build_classify_summarize_schema.d.ts.map +1 -1
- package/dist/helper/schema_helper/build_classify_summarize_schema.js +43 -93
- package/dist/helper/schema_helper/build_classify_summarize_schema.js.map +1 -1
- package/dist/helper/schema_helper/build_concept_facts_schema.d.ts +1 -42
- package/dist/helper/schema_helper/build_concept_facts_schema.d.ts.map +1 -1
- package/dist/helper/schema_helper/build_concept_facts_schema.js +40 -40
- package/dist/helper/schema_helper/build_concept_facts_schema.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +917 -907
- package/dist/index.js.map +1 -1
- package/dist/typology_gen/generate_concept_facts.js +3 -3
- package/dist/typology_gen/generate_concept_facts.js.map +1 -1
- package/dist/typology_gen/generate_typology.d.ts +12 -2
- package/dist/typology_gen/generate_typology.d.ts.map +1 -1
- package/dist/typology_gen/generate_typology.js +9 -4
- package/dist/typology_gen/generate_typology.js.map +1 -1
- package/package.json +3 -2
- package/src/bootstrap/app.ts +7 -7
- package/src/helper/mongo_helper.ts +9 -0
- package/src/helper/schema_helper/build_classify_summarize_schema.ts +38 -98
- package/src/helper/schema_helper/build_concept_facts_schema.ts +35 -83
- package/src/index.ts +920 -917
- package/src/typology_gen/generate_concept_facts.ts +4 -4
- package/src/typology_gen/generate_typology.ts +23 -4
package/dist/bootstrap/app.js
CHANGED
|
@@ -155,13 +155,13 @@ class OnlyEverGenerator {
|
|
|
155
155
|
}
|
|
156
156
|
generateTypology() {
|
|
157
157
|
return __awaiter(this, void 0, void 0, function* () {
|
|
158
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
158
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
159
159
|
const type = (_b = (_a = this.parsedContent) === null || _a === void 0 ? void 0 : _a.type) !== null && _b !== void 0 ? _b : "text";
|
|
160
|
-
const content = Object.assign(Object.assign({ title: (_c = this.parsedContent) === null || _c === void 0 ? void 0 : _c.title }, (type === "text"
|
|
161
|
-
? { h1_headings: (
|
|
162
|
-
: { timecodes: (
|
|
160
|
+
const content = Object.assign(Object.assign({ title: (_d = (_c = this.parsedContent) === null || _c === void 0 ? void 0 : _c.title) !== null && _d !== void 0 ? _d : "" }, (type === "text"
|
|
161
|
+
? { h1_headings: (_f = (_e = this.parsedContent) === null || _e === void 0 ? void 0 : _e.headings) !== null && _f !== void 0 ? _f : [""] }
|
|
162
|
+
: { timecodes: (_h = (_g = this.parsedContent) === null || _g === void 0 ? void 0 : _g.headings) !== null && _h !== void 0 ? _h : [""] })), { content: (_k = (_j = this.parsedContent) === null || _j === void 0 ? void 0 : _j.content) !== null && _k !== void 0 ? _k : [] });
|
|
163
163
|
try {
|
|
164
|
-
let response = yield new generate_typology_1.GenerateTypology(this.openAiService, type,
|
|
164
|
+
let response = yield new generate_typology_1.GenerateTypology(this.openAiService, type, content, this.expectedFields, this.promptIdForTypology).generate();
|
|
165
165
|
return response;
|
|
166
166
|
}
|
|
167
167
|
catch (error) {
|
|
@@ -174,8 +174,8 @@ class OnlyEverGenerator {
|
|
|
174
174
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
175
175
|
const type = (_b = (_a = this.parsedContent) === null || _a === void 0 ? void 0 : _a.type) !== null && _b !== void 0 ? _b : "text";
|
|
176
176
|
const content = Object.assign(Object.assign(Object.assign({ title: (_d = (_c = this.parsedContent) === null || _c === void 0 ? void 0 : _c.title) !== null && _d !== void 0 ? _d : "" }, (type === "text"
|
|
177
|
-
? { h1_headings: (_f = (_e = this.parsedContent) === null || _e === void 0 ? void 0 : _e.headings) !== null && _f !== void 0 ? _f : [] }
|
|
178
|
-
: { timecodes: (_h = (_g = this.parsedContent) === null || _g === void 0 ? void 0 : _g.headings) !== null && _h !== void 0 ? _h : [] })), { content: (_k = (_j = this.parsedContent) === null || _j === void 0 ? void 0 : _j.content) !== null && _k !== void 0 ? _k : [] }), (typologyResponse && typeof typologyResponse === "object"
|
|
177
|
+
? { h1_headings: (_f = (_e = this.parsedContent) === null || _e === void 0 ? void 0 : _e.headings) !== null && _f !== void 0 ? _f : [""] }
|
|
178
|
+
: { timecodes: (_h = (_g = this.parsedContent) === null || _g === void 0 ? void 0 : _g.headings) !== null && _h !== void 0 ? _h : [""] })), { content: (_k = (_j = this.parsedContent) === null || _j === void 0 ? void 0 : _j.content) !== null && _k !== void 0 ? _k : [] }), (typologyResponse && typeof typologyResponse === "object"
|
|
179
179
|
? typologyResponse
|
|
180
180
|
: {}));
|
|
181
181
|
let response = yield new generate_concept_facts_1.GenerateConceptFacts(this.openAiService, content, type, this.promptIdForConceptFacts).generate();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/bootstrap/app.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+DAA2D;AAC3D,wEAAmE;AACnE,iEAA4D;AAC5D,yEAAqE;AACrE,0DAAsD;AACtD,qFAAiF;AACjF,mGAA+F;AAC/F,qGAAiG;AAMjG,mFAA8E;AAE9E,MAAa,iBAAiB;IAgC5B,YACE,MAAc,EACd,KAAa,EACb,iBAAgC,EAChC,mBAA2B,EAC3B,uBAA+B,EAC/B,0BAAkC,EAClC,mBAIC;QA1CI,YAAO,GAAW,EAAE,CAAC;QAG5B,yDAAyD;QACzD,kBAAa,GAOT,SAAS,CAAC;QACd,sBAAiB,GAAW,EAAE,CAAC;QAC/B,qBAAgB,GAAW,EAAE,CAAC;QAI9B,wBAAmB,GAIf;YACF,kBAAkB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;QACpB,CAAC;KAAA;IAEK,kBAAkB,CACtB,cAKG,EACH,QAAgB;;YAEhB,MAAM,UAAU,GAAG,IAAI,wCAAkB,EAAE,CAAC,WAAW,CACrD,cAAc,EACd,QAAQ,CACT,CAAC;YACF,OAAO,UAAU,CAAC;QACpB,CAAC;KAAA;IAEK,mBAAmB,CACvB,cAMG,EACH,QAAgB,EAChB,SAAiB;;YAEjB,MAAM,UAAU,GAAG,MAAM,IAAI,0CAAmB,EAAE,CAAC,WAAW,CAC5D,cAAc,EACd,QAAQ,EACR,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,GAAG,CACjB,CAAC;YAEF,OAAO,UAAU,CAAC;QACpB,CAAC;KAAA;CACF;AAlRD,8CAkRC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mongo_helper.d.ts","sourceRoot":"","sources":["../../src/helper/mongo_helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,EAAE,EAAe,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEhE,eAAO,IAAI,QAAQ,EAAE,EAAE,CAAC;AACxB,eAAO,MAAM,KAAK,YAGjB,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObjectId = exports.Collection = exports.setUp = exports.database = void 0;
|
|
4
|
+
const mongodb_1 = require("mongodb");
|
|
5
|
+
Object.defineProperty(exports, "Collection", { enumerable: true, get: function () { return mongodb_1.Collection; } });
|
|
6
|
+
Object.defineProperty(exports, "ObjectId", { enumerable: true, get: function () { return mongodb_1.ObjectId; } });
|
|
7
|
+
const setUp = () => {
|
|
8
|
+
const client = new mongodb_1.MongoClient(process.env.DB_URI || "");
|
|
9
|
+
exports.database = client.db(process.env.DB_NAME || "");
|
|
10
|
+
};
|
|
11
|
+
exports.setUp = setUp;
|
|
12
|
+
//# sourceMappingURL=mongo_helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mongo_helper.js","sourceRoot":"","sources":["../../src/helper/mongo_helper.ts"],"names":[],"mappings":";;;AAAA,qCAAgE;AAQvD,2FARA,oBAAU,OAQA;AAAE,yFARiB,kBAAQ,OAQjB;AALtB,MAAM,KAAK,GAAG,GAAG,EAAE;IACxB,MAAM,MAAM,GAAG,IAAI,qBAAW,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;IACzD,gBAAQ,GAAG,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;AAClD,CAAC,CAAC;AAHW,QAAA,KAAK,SAGhB"}
|
|
@@ -1,77 +1,2 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
name: string;
|
|
3
|
-
strict: boolean;
|
|
4
|
-
schema: {
|
|
5
|
-
type: string;
|
|
6
|
-
properties: {
|
|
7
|
-
learn_value: {
|
|
8
|
-
type: string;
|
|
9
|
-
properties: {
|
|
10
|
-
state: {
|
|
11
|
-
type: string;
|
|
12
|
-
description: string;
|
|
13
|
-
};
|
|
14
|
-
reason: {
|
|
15
|
-
type: string;
|
|
16
|
-
description: string;
|
|
17
|
-
maxLength: number;
|
|
18
|
-
};
|
|
19
|
-
bloom_levels: {
|
|
20
|
-
type: string;
|
|
21
|
-
description: string;
|
|
22
|
-
items: {
|
|
23
|
-
type: string;
|
|
24
|
-
enum: number[];
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
bloom_levels_reason: {
|
|
28
|
-
type: string;
|
|
29
|
-
description: string;
|
|
30
|
-
maxLength: number;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
required: string[];
|
|
34
|
-
additionalProperties: boolean;
|
|
35
|
-
};
|
|
36
|
-
field: {
|
|
37
|
-
type: string;
|
|
38
|
-
description: string;
|
|
39
|
-
items: {
|
|
40
|
-
type: string;
|
|
41
|
-
enum: string[];
|
|
42
|
-
};
|
|
43
|
-
minItems: number;
|
|
44
|
-
maxItems: number;
|
|
45
|
-
};
|
|
46
|
-
summary_cards: {
|
|
47
|
-
type: string;
|
|
48
|
-
description: string;
|
|
49
|
-
maxItems: number;
|
|
50
|
-
items: {
|
|
51
|
-
type: string;
|
|
52
|
-
properties: {
|
|
53
|
-
title: {
|
|
54
|
-
type: string;
|
|
55
|
-
description: string;
|
|
56
|
-
maxLength: number;
|
|
57
|
-
};
|
|
58
|
-
text: {
|
|
59
|
-
type: string;
|
|
60
|
-
description: string;
|
|
61
|
-
maxLength: number;
|
|
62
|
-
};
|
|
63
|
-
reference: {
|
|
64
|
-
type: string;
|
|
65
|
-
description: string;
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
required: string[];
|
|
69
|
-
additionalProperties: boolean;
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
required: string[];
|
|
74
|
-
additionalProperties: boolean;
|
|
75
|
-
};
|
|
76
|
-
};
|
|
1
|
+
export declare const buildClassifySummarizeSchema: (headings: string[]) => Promise<any>;
|
|
77
2
|
//# sourceMappingURL=build_classify_summarize_schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build_classify_summarize_schema.d.ts","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_classify_summarize_schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build_classify_summarize_schema.d.ts","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_classify_summarize_schema.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,4BAA4B,GAAU,UAAU,MAAM,EAAE,iBA0BpE,CAAC"}
|
|
@@ -1,96 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
learn_value: {
|
|
11
|
-
type: "object",
|
|
12
|
-
properties: {
|
|
13
|
-
state: {
|
|
14
|
-
type: "boolean",
|
|
15
|
-
description: "Whether the content has educational value and should be used to generate test materials.",
|
|
16
|
-
},
|
|
17
|
-
reason: {
|
|
18
|
-
type: "string",
|
|
19
|
-
description: "Concise justification (≤320 chars) for why the source was marked true or false.",
|
|
20
|
-
maxLength: 320,
|
|
21
|
-
},
|
|
22
|
-
bloom_levels: {
|
|
23
|
-
type: "array",
|
|
24
|
-
description: "List of applicable Bloom levels (1–5). Leave empty if state is false.",
|
|
25
|
-
items: { type: "integer", enum: [1, 2, 3, 4, 5] },
|
|
26
|
-
},
|
|
27
|
-
bloom_levels_reason: {
|
|
28
|
-
type: "string",
|
|
29
|
-
description: "Explanation (≤320 chars) for the selected Bloom levels.",
|
|
30
|
-
maxLength: 320,
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
required: ["state", "reason", "bloom_levels", "bloom_levels_reason"],
|
|
34
|
-
additionalProperties: false,
|
|
35
|
-
},
|
|
36
|
-
field: {
|
|
37
|
-
type: "array",
|
|
38
|
-
description: "One to three fields of knowledge this content relates to.",
|
|
39
|
-
items: {
|
|
40
|
-
type: "string",
|
|
41
|
-
enum: [
|
|
42
|
-
"Sciences",
|
|
43
|
-
"Technology & Engineering",
|
|
44
|
-
"Humanities & Cultural Studies",
|
|
45
|
-
"Social Sciences & Global Studies",
|
|
46
|
-
"Business & Management",
|
|
47
|
-
"Health & Medicine",
|
|
48
|
-
"Environmental Studies & Earth Sciences",
|
|
49
|
-
"Education, Learning & Personal Development",
|
|
50
|
-
"Creative & Performing Arts",
|
|
51
|
-
"Law, Governance & Ethics",
|
|
52
|
-
"Recreation, Lifestyle & Practical Skills",
|
|
53
|
-
"Technology & Media Literacy",
|
|
54
|
-
"Philosophy & Critical Thinking",
|
|
55
|
-
"Space & Astronomical Sciences",
|
|
56
|
-
"Agriculture & Food Sciences",
|
|
57
|
-
"Trades & Craftsmanship",
|
|
58
|
-
"Reference & Indexing",
|
|
59
|
-
"Other",
|
|
60
|
-
],
|
|
61
|
-
},
|
|
62
|
-
minItems: 1,
|
|
63
|
-
maxItems: 3,
|
|
64
|
-
},
|
|
65
|
-
summary_cards: {
|
|
66
|
-
type: "array",
|
|
67
|
-
description: "Concise summary cards (0–15) that walk through key learning points from the source.",
|
|
68
|
-
maxItems: 15,
|
|
69
|
-
items: {
|
|
70
|
-
type: "object",
|
|
71
|
-
properties: {
|
|
72
|
-
title: {
|
|
73
|
-
type: "string",
|
|
74
|
-
description: "Card title (≤60 chars).",
|
|
75
|
-
maxLength: 60,
|
|
76
|
-
},
|
|
77
|
-
text: {
|
|
78
|
-
type: "string",
|
|
79
|
-
description: "Summary text (≤320 chars).",
|
|
80
|
-
maxLength: 320,
|
|
81
|
-
},
|
|
82
|
-
reference: {
|
|
83
|
-
type: "string",
|
|
84
|
-
description: "A {{heading_type}} or empty string; enum populated dynamically at runtime.",
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
required: ["title", "text", "reference"],
|
|
88
|
-
additionalProperties: false,
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
required: ["learn_value", "field", "summary_cards"],
|
|
93
|
-
additionalProperties: false,
|
|
94
|
-
},
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
95
10
|
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.buildClassifySummarizeSchema = void 0;
|
|
13
|
+
const mongo_helper_1 = require("../mongo_helper");
|
|
14
|
+
// Function to populate enums in a parsed schema
|
|
15
|
+
const buildClassifySummarizeSchema = (headings) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
var _a, _b, _c, _d, _e, _f;
|
|
17
|
+
(0, mongo_helper_1.setUp)();
|
|
18
|
+
const objectId = new mongo_helper_1.ObjectId("6895ab99aa1cad73b0018060");
|
|
19
|
+
const schemaObj = yield mongo_helper_1.database.collection("_prompts").findOne({
|
|
20
|
+
_id: objectId,
|
|
21
|
+
});
|
|
22
|
+
if (!schemaObj) {
|
|
23
|
+
throw new Error("Schema not found");
|
|
24
|
+
}
|
|
25
|
+
const schema = schemaObj.schema;
|
|
26
|
+
if (!schema) {
|
|
27
|
+
throw new Error("Schema not found");
|
|
28
|
+
}
|
|
29
|
+
// Deep clone to avoid mutating the original
|
|
30
|
+
const populatedSchema = JSON.parse(schema);
|
|
31
|
+
// Type-safe enum population for reference field in summary_cards
|
|
32
|
+
if ((_f = (_e = (_d = (_c = (_b = (_a = populatedSchema.schema) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.summary_cards) === null || _c === void 0 ? void 0 : _c.items) === null || _d === void 0 ? void 0 : _d.properties) === null || _e === void 0 ? void 0 : _e.reference) === null || _f === void 0 ? void 0 : _f.enum) {
|
|
33
|
+
populatedSchema.schema.properties.summary_cards.items.properties.reference.enum =
|
|
34
|
+
headings;
|
|
35
|
+
}
|
|
36
|
+
return populatedSchema;
|
|
37
|
+
});
|
|
38
|
+
exports.buildClassifySummarizeSchema = buildClassifySummarizeSchema;
|
|
39
|
+
// export const buildClassifySummarizeSchema = (headings: string[]) => {
|
|
40
|
+
// const schema = JSON.parse(JSON.stringify(baseClassifySummarizeSchema));
|
|
41
|
+
// // Populate the enum after schema creation
|
|
42
|
+
// (schema.schema.properties.summary_cards.items.properties.reference
|
|
43
|
+
// .enum as string[]) = headings;
|
|
44
|
+
// return schema;
|
|
45
|
+
// };
|
|
96
46
|
//# sourceMappingURL=build_classify_summarize_schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build_classify_summarize_schema.js","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_classify_summarize_schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build_classify_summarize_schema.js","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_classify_summarize_schema.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA4D;AAE5D,gDAAgD;AACzC,MAAM,4BAA4B,GAAG,CAAO,QAAkB,EAAE,EAAE;;IACvE,IAAA,oBAAK,GAAE,CAAC;IACR,MAAM,QAAQ,GAAG,IAAI,uBAAQ,CAAC,0BAA0B,CAAC,CAAC;IAC1D,MAAM,SAAS,GAAG,MAAM,uBAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;QAC9D,GAAG,EAAE,QAAQ;KACd,CAAC,CAAC;IACH,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IACD,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;IAChC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACtC,CAAC;IACD,4CAA4C;IAC5C,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAE3C,iEAAiE;IACjE,IACE,MAAA,MAAA,MAAA,MAAA,MAAA,MAAA,eAAe,CAAC,MAAM,0CAAE,UAAU,0CAAE,aAAa,0CAAE,KAAK,0CAAE,UAAU,0CAChE,SAAS,0CAAE,IAAI,EACnB,CAAC;QACD,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI;YAC7E,QAAQ,CAAC;IACb,CAAC;IAED,OAAO,eAAe,CAAC;AACzB,CAAC,CAAA,CAAC;AA1BW,QAAA,4BAA4B,gCA0BvC;AAEF,wEAAwE;AACxE,4EAA4E;AAC5E,+CAA+C;AAC/C,uEAAuE;AACvE,qCAAqC;AAErC,mBAAmB;AACnB,KAAK"}
|
|
@@ -1,43 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
interface ConceptFactSchemaItem {
|
|
3
|
-
text: {
|
|
4
|
-
type: "string";
|
|
5
|
-
minLength: number;
|
|
6
|
-
maxLength: number;
|
|
7
|
-
description: string;
|
|
8
|
-
};
|
|
9
|
-
type: {
|
|
10
|
-
type: "string";
|
|
11
|
-
enum: ConceptFactType[];
|
|
12
|
-
description: string;
|
|
13
|
-
};
|
|
14
|
-
reference: {
|
|
15
|
-
type: "string";
|
|
16
|
-
enum: string[];
|
|
17
|
-
description: string;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
interface Schema {
|
|
21
|
-
name: string;
|
|
22
|
-
strict: boolean;
|
|
23
|
-
schema: {
|
|
24
|
-
type: "object";
|
|
25
|
-
properties: {
|
|
26
|
-
concepts_facts: {
|
|
27
|
-
type: "array";
|
|
28
|
-
minItems: number;
|
|
29
|
-
items: {
|
|
30
|
-
type: "object";
|
|
31
|
-
properties: ConceptFactSchemaItem;
|
|
32
|
-
required: ["text", "type", "reference"];
|
|
33
|
-
additionalProperties: false;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
required: ["concepts_facts"];
|
|
38
|
-
additionalProperties: false;
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
export declare function buildConceptFactSchema(headings: string[], name?: string, strict?: boolean): Schema;
|
|
42
|
-
export {};
|
|
1
|
+
export declare function buildConceptFactSchema(headings: string[], name?: string, strict?: boolean): Promise<any>;
|
|
43
2
|
//# sourceMappingURL=build_concept_facts_schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build_concept_facts_schema.d.ts","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_concept_facts_schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build_concept_facts_schema.d.ts","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_concept_facts_schema.ts"],"names":[],"mappings":"AAIA,wBAAsB,sBAAsB,CAC1C,QAAQ,EAAE,MAAM,EAAE,EAClB,IAAI,GAAE,MAAkC,EACxC,MAAM,GAAE,OAAc,gBAiCvB"}
|
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.buildConceptFactSchema = buildConceptFactSchema;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
required: ["text", "type", "reference"],
|
|
36
|
-
additionalProperties: false,
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
required: ["concepts_facts"],
|
|
41
|
-
additionalProperties: false,
|
|
42
|
-
},
|
|
43
|
-
};
|
|
13
|
+
const mongodb_1 = require("mongodb");
|
|
14
|
+
const mongo_helper_1 = require("../mongo_helper");
|
|
15
|
+
// Function to populate enums in a parsed schema
|
|
16
|
+
function buildConceptFactSchema(headings_1) {
|
|
17
|
+
return __awaiter(this, arguments, void 0, function* (headings, name = "concept_fact_gen_schema", strict = true) {
|
|
18
|
+
var _a, _b, _c, _d, _e, _f;
|
|
19
|
+
(0, mongo_helper_1.setUp)();
|
|
20
|
+
const objectId = new mongodb_1.ObjectId("6895ac4baa1cad73b0018061");
|
|
21
|
+
const schemaObj = yield mongo_helper_1.database.collection("_prompts").findOne({
|
|
22
|
+
_id: objectId,
|
|
23
|
+
});
|
|
24
|
+
if (!schemaObj) {
|
|
25
|
+
throw new Error("Schema not found");
|
|
26
|
+
}
|
|
27
|
+
const schema = schemaObj.schema;
|
|
28
|
+
if (!schema) {
|
|
29
|
+
throw new Error("Schema not found");
|
|
30
|
+
}
|
|
31
|
+
// Deep clone to avoid mutating the original
|
|
32
|
+
const populatedSchema = JSON.parse(schema);
|
|
33
|
+
// Update name and strict mode
|
|
34
|
+
populatedSchema.name = name;
|
|
35
|
+
populatedSchema.strict = strict;
|
|
36
|
+
const allowedRefs = [...headings, ""];
|
|
37
|
+
// Type-safe enum population for reference field
|
|
38
|
+
if ((_f = (_e = (_d = (_c = (_b = (_a = populatedSchema.schema) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.concepts_facts) === null || _c === void 0 ? void 0 : _c.items) === null || _d === void 0 ? void 0 : _d.properties) === null || _e === void 0 ? void 0 : _e.reference) === null || _f === void 0 ? void 0 : _f.enum) {
|
|
39
|
+
populatedSchema.schema.properties.concepts_facts.items.properties.reference.enum =
|
|
40
|
+
allowedRefs;
|
|
41
|
+
}
|
|
42
|
+
return populatedSchema;
|
|
43
|
+
});
|
|
44
44
|
}
|
|
45
45
|
//# sourceMappingURL=build_concept_facts_schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build_concept_facts_schema.js","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_concept_facts_schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build_concept_facts_schema.js","sourceRoot":"","sources":["../../../src/helper/schema_helper/build_concept_facts_schema.ts"],"names":[],"mappings":";;;;;;;;;;;AAIA,wDAoCC;AAxCD,qCAAmC;AACnC,kDAAkD;AAElD,gDAAgD;AAChD,SAAsB,sBAAsB;yDAC1C,QAAkB,EAClB,OAAe,yBAAyB,EACxC,SAAkB,IAAI;;QAEtB,IAAA,oBAAK,GAAE,CAAC;QACR,MAAM,QAAQ,GAAG,IAAI,kBAAQ,CAAC,0BAA0B,CAAC,CAAC;QAC1D,MAAM,SAAS,GAAG,MAAM,uBAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;YAC9D,GAAG,EAAE,QAAQ;SACd,CAAC,CAAC;QACH,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACtC,CAAC;QACD,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;QAChC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACtC,CAAC;QACD,4CAA4C;QAC5C,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAE3C,8BAA8B;QAC9B,eAAe,CAAC,IAAI,GAAG,IAAI,CAAC;QAC5B,eAAe,CAAC,MAAM,GAAG,MAAM,CAAC;QAEhC,MAAM,WAAW,GAAG,CAAC,GAAG,QAAQ,EAAE,EAAE,CAAC,CAAC;QAEtC,gDAAgD;QAChD,IACE,MAAA,MAAA,MAAA,MAAA,MAAA,MAAA,eAAe,CAAC,MAAM,0CAAE,UAAU,0CAAE,cAAc,0CAAE,KAAK,0CAAE,UAAU,0CACjE,SAAS,0CAAE,IAAI,EACnB,CAAC;YACD,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI;gBAC9E,WAAW,CAAC;QAChB,CAAC;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;CAAA"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGpD,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|