@memberjunction/ai-vector-sync 3.3.0 → 4.0.0
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/config.js +14 -20
- package/dist/config.js.map +1 -1
- package/dist/db/db.d.ts +1 -1
- package/dist/db/db.d.ts.map +1 -1
- package/dist/db/db.js +8 -33
- package/dist/db/db.js.map +1 -1
- package/dist/db/dbAI.d.ts +1 -1
- package/dist/db/dbAI.d.ts.map +1 -1
- package/dist/db/dbAI.js +8 -33
- package/dist/db/dbAI.js.map +1 -1
- package/dist/generic/EntityDocumenTemplateParserBase.d.ts +12 -0
- package/dist/generic/EntityDocumenTemplateParserBase.d.ts.map +1 -1
- package/dist/generic/EntityDocumenTemplateParserBase.js +29 -12
- package/dist/generic/EntityDocumenTemplateParserBase.js.map +1 -1
- package/dist/generic/EntityDocumentTemplateParser.d.ts +16 -1
- package/dist/generic/EntityDocumentTemplateParser.d.ts.map +1 -1
- package/dist/generic/EntityDocumentTemplateParser.js +34 -16
- package/dist/generic/EntityDocumentTemplateParser.js.map +1 -1
- package/dist/generic/entitySyncConfig.types.d.ts +25 -0
- package/dist/generic/entitySyncConfig.types.d.ts.map +1 -1
- package/dist/generic/entitySyncConfig.types.js +1 -2
- package/dist/generic/vectorSync.types.d.ts +20 -0
- package/dist/generic/vectorSync.types.d.ts.map +1 -1
- package/dist/generic/vectorSync.types.js +1 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -20
- package/dist/index.js.map +1 -1
- package/dist/models/BatchWorker.d.ts +33 -2
- package/dist/models/BatchWorker.d.ts.map +1 -1
- package/dist/models/BatchWorker.js +30 -16
- package/dist/models/BatchWorker.js.map +1 -1
- package/dist/models/EntityDocumentCache.d.ts +3 -0
- package/dist/models/EntityDocumentCache.d.ts.map +1 -1
- package/dist/models/EntityDocumentCache.js +17 -17
- package/dist/models/EntityDocumentCache.js.map +1 -1
- package/dist/models/PagedRecords.d.ts +10 -1
- package/dist/models/PagedRecords.d.ts.map +1 -1
- package/dist/models/PagedRecords.js +13 -6
- package/dist/models/PagedRecords.js.map +1 -1
- package/dist/models/entityVectorSync.d.ts +32 -1
- package/dist/models/entityVectorSync.d.ts.map +1 -1
- package/dist/models/entityVectorSync.js +133 -73
- package/dist/models/entityVectorSync.js.map +1 -1
- package/dist/models/workers/UpsertVectors.d.ts.map +1 -1
- package/dist/models/workers/UpsertVectors.js +12 -17
- package/dist/models/workers/UpsertVectors.js.map +1 -1
- package/dist/models/workers/VectorizeTemplates.js +23 -20
- package/dist/models/workers/VectorizeTemplates.js.map +1 -1
- package/dist/models/workers/upserter.js +5 -8
- package/dist/models/workers/upserter.js.map +1 -1
- package/package.json +19 -18
package/dist/config.js
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
exports.dbUsername = process.env.DB_USERNAME;
|
|
16
|
-
exports.dbPassword = process.env.DB_PASSWORD;
|
|
17
|
-
exports.dbDatabase = process.env.DB_DATABASE;
|
|
18
|
-
exports.serverPort = Number(process.env.PORT) || 8000;
|
|
19
|
-
exports.currentUserEmail = process.env.CURRENT_USER_EMAIL;
|
|
20
|
-
exports.mistralAPIKey = process.env.MISTRAL_API_KEY;
|
|
1
|
+
import dotenv from 'dotenv';
|
|
2
|
+
dotenv.config({ quiet: true });
|
|
3
|
+
export const openAIAPIKey = process.env.OPENAI_API_KEY;
|
|
4
|
+
export const pineconeHost = process.env.PINECONE_HOST;
|
|
5
|
+
export const pineconeAPIKey = process.env.PINECONE_API_KEY;
|
|
6
|
+
export const pineconeDefaultIndex = process.env.PINECONE_DEFAULT_INDEX;
|
|
7
|
+
export const dbHost = process.env.DB_HOST;
|
|
8
|
+
export const dbPort = Number(process.env.DB_PORT) || 1433;
|
|
9
|
+
export const dbUsername = process.env.DB_USERNAME;
|
|
10
|
+
export const dbPassword = process.env.DB_PASSWORD;
|
|
11
|
+
export const dbDatabase = process.env.DB_DATABASE;
|
|
12
|
+
export const serverPort = Number(process.env.PORT) || 8000;
|
|
13
|
+
export const currentUserEmail = process.env.CURRENT_USER_EMAIL;
|
|
14
|
+
export const mistralAPIKey = process.env.MISTRAL_API_KEY;
|
|
21
15
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAE/B,MAAM,CAAC,MAAM,YAAY,GAAW,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;AAC/D,MAAM,CAAC,MAAM,YAAY,GAAW,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;AAC9D,MAAM,CAAC,MAAM,cAAc,GAAW,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;AACnE,MAAM,CAAC,MAAM,oBAAoB,GAAW,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC;AAE/E,MAAM,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;AAC1C,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC;AAC1D,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;AAClD,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;AAClD,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;AAClD,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;AAE3D,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;AAE/D,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC"}
|
package/dist/db/db.d.ts
CHANGED
package/dist/db/db.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/db/db.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/db/db.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,QAAA,MAAM,iBAAiB,sBAAmC,CAAC;AAE3D,eAAe,iBAAiB,CAAC"}
|
package/dist/db/db.js
CHANGED
|
@@ -1,40 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const mssql = __importStar(require("mssql"));
|
|
27
|
-
const config_1 = require("../config");
|
|
1
|
+
import mssql from 'mssql';
|
|
2
|
+
import { dbDatabase, dbHost, dbPassword, dbPort, dbUsername } from '../config.js';
|
|
28
3
|
const config = {
|
|
29
|
-
user:
|
|
30
|
-
password:
|
|
31
|
-
server:
|
|
32
|
-
port:
|
|
33
|
-
database:
|
|
4
|
+
user: dbUsername,
|
|
5
|
+
password: dbPassword,
|
|
6
|
+
server: dbHost,
|
|
7
|
+
port: dbPort,
|
|
8
|
+
database: dbDatabase,
|
|
34
9
|
options: {
|
|
35
10
|
encrypt: true,
|
|
36
11
|
},
|
|
37
12
|
};
|
|
38
13
|
const SQLConnectionPool = new mssql.ConnectionPool(config);
|
|
39
|
-
|
|
14
|
+
export default SQLConnectionPool;
|
|
40
15
|
//# sourceMappingURL=db.js.map
|
package/dist/db/db.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.js","sourceRoot":"","sources":["../../src/db/db.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"db.js","sourceRoot":"","sources":["../../src/db/db.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE/E,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,UAAU;IAChB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE;QACP,OAAO,EAAE,IAAI;KACd;CACF,CAAC;AAEF,MAAM,iBAAiB,GAAG,IAAI,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;AAE3D,eAAe,iBAAiB,CAAC"}
|
package/dist/db/dbAI.d.ts
CHANGED
package/dist/db/dbAI.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dbAI.d.ts","sourceRoot":"","sources":["../../src/db/dbAI.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"dbAI.d.ts","sourceRoot":"","sources":["../../src/db/dbAI.ts"],"names":[],"mappings":"AAEA,OAAO,GAAG,MAAM,OAAO,CAAC;AAgBxB,QAAA,MAAM,IAAI,oBAAiC,CAAC;AAE5C,eAAe,IAAI,CAAC"}
|
package/dist/db/dbAI.js
CHANGED
|
@@ -1,36 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const config_1 = require("../config");
|
|
27
|
-
const sql = __importStar(require("mssql"));
|
|
1
|
+
import { dbDatabase, dbHost, dbPassword, dbPort, dbUsername } from '../config.js';
|
|
2
|
+
import sql from 'mssql';
|
|
28
3
|
const config = {
|
|
29
|
-
server:
|
|
30
|
-
port:
|
|
31
|
-
user:
|
|
32
|
-
password:
|
|
33
|
-
database:
|
|
4
|
+
server: dbHost,
|
|
5
|
+
port: dbPort,
|
|
6
|
+
user: dbUsername,
|
|
7
|
+
password: dbPassword,
|
|
8
|
+
database: dbDatabase,
|
|
34
9
|
requestTimeout: 45000,
|
|
35
10
|
options: {
|
|
36
11
|
encrypt: true,
|
|
@@ -39,5 +14,5 @@ const config = {
|
|
|
39
14
|
}
|
|
40
15
|
};
|
|
41
16
|
const pool = new sql.ConnectionPool(config);
|
|
42
|
-
|
|
17
|
+
export default pool;
|
|
43
18
|
//# sourceMappingURL=dbAI.js.map
|
package/dist/db/dbAI.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dbAI.js","sourceRoot":"","sources":["../../src/db/dbAI.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dbAI.js","sourceRoot":"","sources":["../../src/db/dbAI.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/E,OAAO,GAAG,MAAM,OAAO,CAAC;AAExB,MAAM,MAAM,GAAe;IACzB,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,UAAU;IAChB,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,UAAU;IACpB,cAAc,EAAE,KAAK;IACrB,OAAO,EAAE;QACP,OAAO,EAAE,IAAI;QACb,gBAAgB,EAAE,IAAI;QACtB,sBAAsB,EAAE,IAAI;KAC7B;CACF,CAAC;AAEF,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;AAE5C,eAAe,IAAI,CAAC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { UserInfo } from '@memberjunction/core';
|
|
2
|
+
/**
|
|
3
|
+
* This is an abstract base class, use the EntityDocumentTemplateParser class or a sub-class thereof.
|
|
4
|
+
*/
|
|
2
5
|
export declare abstract class EntityDocumentTemplateParserBase {
|
|
3
6
|
static ClearCache(): void;
|
|
4
7
|
static CreateCacheKey(EntityID: string, EntityRecordPrimaryKey: string, Content: string): string;
|
|
@@ -8,6 +11,15 @@ export declare abstract class EntityDocumentTemplateParserBase {
|
|
|
8
11
|
protected static get _cache(): {
|
|
9
12
|
[key: string]: string;
|
|
10
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* This method will parse an entity document template and replace values within ${} placeholders with actual values from the entity record. In the case of function calls
|
|
16
|
+
* within the placeholders, the functions object must be provided to parse the function calls.
|
|
17
|
+
* @param Template - the document template to parse
|
|
18
|
+
* @param EntityID - the ID of the entity
|
|
19
|
+
* @param EntityRecord - the values for the entity record
|
|
20
|
+
* @param ContextUser - the current user
|
|
21
|
+
* @returns the evaluated value of the template incorporating fields and function call(s), if any.
|
|
22
|
+
*/
|
|
11
23
|
Parse(Template: string, EntityID: string, EntityRecord: any, ContextUser: UserInfo): Promise<string>;
|
|
12
24
|
protected evalSingleArgument(argument: string, entityID: string, entityRecord: any, ContextUser: UserInfo): Promise<string>;
|
|
13
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityDocumenTemplateParserBase.d.ts","sourceRoot":"","sources":["../../src/generic/EntityDocumenTemplateParserBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,QAAQ,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"EntityDocumenTemplateParserBase.d.ts","sourceRoot":"","sources":["../../src/generic/EntityDocumenTemplateParserBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAExE;;GAEG;AACH,8BAAsB,gCAAgC;WACtC,UAAU;WAGV,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;IAIvG,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAM;IACzD,SAAS,CAAC,MAAM,KAAK,MAAM,IAAI;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAEvD;IAED;;;;;;;;OAQG;IACU,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;cA8CjG,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;CA4BlI"}
|
|
@@ -1,43 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class EntityDocumentTemplateParserBase {
|
|
1
|
+
import { CompositeKey, Metadata } from '@memberjunction/core';
|
|
2
|
+
/**
|
|
3
|
+
* This is an abstract base class, use the EntityDocumentTemplateParser class or a sub-class thereof.
|
|
4
|
+
*/
|
|
5
|
+
export class EntityDocumentTemplateParserBase {
|
|
6
6
|
static ClearCache() {
|
|
7
7
|
EntityDocumentTemplateParserBase.__cache = {};
|
|
8
8
|
}
|
|
9
9
|
static CreateCacheKey(EntityID, EntityRecordPrimaryKey, Content) {
|
|
10
10
|
return `${EntityID}___${EntityRecordPrimaryKey}___${Content}`;
|
|
11
11
|
}
|
|
12
|
-
static __cache = {};
|
|
12
|
+
static { this.__cache = {}; }
|
|
13
13
|
static get _cache() {
|
|
14
14
|
return EntityDocumentTemplateParserBase.__cache;
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* This method will parse an entity document template and replace values within ${} placeholders with actual values from the entity record. In the case of function calls
|
|
18
|
+
* within the placeholders, the functions object must be provided to parse the function calls.
|
|
19
|
+
* @param Template - the document template to parse
|
|
20
|
+
* @param EntityID - the ID of the entity
|
|
21
|
+
* @param EntityRecord - the values for the entity record
|
|
22
|
+
* @param ContextUser - the current user
|
|
23
|
+
* @returns the evaluated value of the template incorporating fields and function call(s), if any.
|
|
24
|
+
*/
|
|
16
25
|
async Parse(Template, EntityID, EntityRecord, ContextUser) {
|
|
17
26
|
if (!ContextUser) {
|
|
18
27
|
throw new Error('ContextUser is required to parse the template');
|
|
19
28
|
}
|
|
20
|
-
const md = new
|
|
29
|
+
const md = new Metadata();
|
|
21
30
|
const entityInfo = md.Entities.find((e) => e.ID === EntityID);
|
|
22
31
|
if (!entityInfo) {
|
|
23
32
|
throw new Error(`Entity with ID ${EntityID} not found.`);
|
|
24
33
|
}
|
|
25
|
-
let compositeKey = new
|
|
34
|
+
let compositeKey = new CompositeKey();
|
|
26
35
|
compositeKey.LoadFromEntityInfoAndRecord(entityInfo, EntityRecord);
|
|
27
36
|
const regex = /\$\{([^{}]+)\}/g;
|
|
28
37
|
const matches = Template.matchAll(regex);
|
|
38
|
+
// Convert matches to an array to handle them asynchronously
|
|
29
39
|
const replacements = Array.from(matches).map(async (match) => {
|
|
30
|
-
const content = match[1];
|
|
40
|
+
const content = match[1]; // The captured group from regex
|
|
31
41
|
const cacheKey = EntityDocumentTemplateParserBase.CreateCacheKey(EntityID, compositeKey.ToString(), content);
|
|
42
|
+
// check the cache and if we don't have an entry in the cache, add it
|
|
32
43
|
if (!EntityDocumentTemplateParserBase._cache[cacheKey]) {
|
|
44
|
+
// Cache miss, evaluate and store the result
|
|
33
45
|
EntityDocumentTemplateParserBase._cache[cacheKey] = await this.evalSingleArgument(content, EntityID, EntityRecord, ContextUser);
|
|
34
46
|
}
|
|
35
47
|
return {
|
|
36
|
-
old: match[0],
|
|
37
|
-
new: EntityDocumentTemplateParserBase._cache[cacheKey],
|
|
48
|
+
old: match[0], // The entire placeholder including ${}
|
|
49
|
+
new: EntityDocumentTemplateParserBase._cache[cacheKey], // The replacement value
|
|
38
50
|
};
|
|
39
51
|
});
|
|
52
|
+
// Resolve all promises
|
|
40
53
|
const resolvedReplacements = await Promise.all(replacements);
|
|
54
|
+
// Replace each placeholder in the template with its resolved value
|
|
41
55
|
let resolvedTemplate = Template;
|
|
42
56
|
resolvedReplacements.forEach((replacement) => {
|
|
43
57
|
resolvedTemplate = resolvedTemplate.replace(replacement.old, replacement.new);
|
|
@@ -50,6 +64,7 @@ class EntityDocumentTemplateParserBase {
|
|
|
50
64
|
const [, funcName, paramsString] = funcMatch;
|
|
51
65
|
const params = paramsString.split(',').map((param) => {
|
|
52
66
|
param = param.trim();
|
|
67
|
+
//if the string is wrapped in single or double quotes, remove them
|
|
53
68
|
if (param.startsWith('"') && param.endsWith('"')) {
|
|
54
69
|
return param.slice(1, -1);
|
|
55
70
|
}
|
|
@@ -60,7 +75,9 @@ class EntityDocumentTemplateParserBase {
|
|
|
60
75
|
return param;
|
|
61
76
|
}
|
|
62
77
|
});
|
|
78
|
+
// Check if the method exists on this instance
|
|
63
79
|
if (typeof this[funcName] === 'function') {
|
|
80
|
+
// Call the instance method dynamically using its name and spread the params
|
|
64
81
|
return this[funcName](entityID, entityRecord, ContextUser, ...params);
|
|
65
82
|
}
|
|
66
83
|
else {
|
|
@@ -68,9 +85,9 @@ class EntityDocumentTemplateParserBase {
|
|
|
68
85
|
}
|
|
69
86
|
}
|
|
70
87
|
else {
|
|
88
|
+
// not a function match, attempt to return the value from the entity record
|
|
71
89
|
return entityRecord[argument] !== undefined ? entityRecord[argument] : '';
|
|
72
90
|
}
|
|
73
91
|
}
|
|
74
92
|
}
|
|
75
|
-
exports.EntityDocumentTemplateParserBase = EntityDocumentTemplateParserBase;
|
|
76
93
|
//# sourceMappingURL=EntityDocumenTemplateParserBase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityDocumenTemplateParserBase.js","sourceRoot":"","sources":["../../src/generic/EntityDocumenTemplateParserBase.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EntityDocumenTemplateParserBase.js","sourceRoot":"","sources":["../../src/generic/EntityDocumenTemplateParserBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAY,MAAM,sBAAsB,CAAC;AAExE;;GAEG;AACH,MAAM,OAAgB,gCAAgC;IAC7C,MAAM,CAAC,UAAU;QACtB,gCAAgC,CAAC,OAAO,GAAG,EAAE,CAAC;IAChD,CAAC;IACM,MAAM,CAAC,cAAc,CAAC,QAAgB,EAAE,sBAA8B,EAAE,OAAe;QAC5F,OAAO,GAAG,QAAQ,MAAM,sBAAsB,MAAM,OAAO,EAAE,CAAC;IAChE,CAAC;aAEgB,YAAO,GAA8B,EAAE,CAAC;IAC/C,MAAM,KAAK,MAAM;QACzB,OAAO,gCAAgC,CAAC,OAAO,CAAC;IAClD,CAAC;IAED;;;;;;;;OAQG;IACI,KAAK,CAAC,KAAK,CAAC,QAAgB,EAAE,QAAgB,EAAE,YAAiB,EAAE,WAAqB;QAC7F,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;QACnE,CAAC;QAED,MAAM,EAAE,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC1B,MAAM,UAAU,GAAG,EAAE,CAAC,QAAQ,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KAAK,UAAU,EAAE,CAAC;gBACzC,4EAA4E;gBAC5E,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC,CAAC;YACxE,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CAAC,YAAY,QAAQ,kBAAkB,CAAC,CAAC;YAC1D,CAAC;QACH,CAAC;aAAM,CAAC;YACN,2EAA2E;YAC3E,OAAO,YAAY,CAAC,QAAQ,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5E,CAAC;IACH,CAAC"}
|
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
import { UserInfo } from "@memberjunction/core";
|
|
2
|
-
import { EntityDocumentTemplateParserBase } from "./EntityDocumenTemplateParserBase";
|
|
2
|
+
import { EntityDocumentTemplateParserBase } from "./EntityDocumenTemplateParserBase.js";
|
|
3
|
+
/**
|
|
4
|
+
* This is the first-level sub-class of EntityDocumentTemplateParserBase. This class is used to parse a string template with variables and functions.
|
|
5
|
+
* If you wish to override functionality you can subclass it and then use the @RegisterClass decorator to register the sub-class of EntityDocumentTemplateParser with a priority of 1 or above to
|
|
6
|
+
* then be used instead of the default implementation.
|
|
7
|
+
*/
|
|
3
8
|
export declare class EntityDocumentTemplateParser extends EntityDocumentTemplateParserBase {
|
|
9
|
+
/** Convenience method to get an instance of the class and uses the ClassFactory so we can create sub-classes if they are registered with higher priorities than the base class */
|
|
4
10
|
static CreateInstance(): EntityDocumentTemplateParser;
|
|
11
|
+
/**
|
|
12
|
+
* This function
|
|
13
|
+
* @param entityID
|
|
14
|
+
* @param entityRecord
|
|
15
|
+
* @param relationshipName
|
|
16
|
+
* @param maxRows
|
|
17
|
+
* @param entityDocumentName
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
5
20
|
protected Relationship(entityID: string, entityRecord: any, ContextUser: UserInfo, relationshipName: string, maxRows: number, entityDocumentName: string): Promise<string>;
|
|
6
21
|
}
|
|
7
22
|
//# sourceMappingURL=EntityDocumentTemplateParser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityDocumentTemplateParser.d.ts","sourceRoot":"","sources":["../../src/generic/EntityDocumentTemplateParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+C,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAG7F,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"EntityDocumentTemplateParser.d.ts","sourceRoot":"","sources":["../../src/generic/EntityDocumentTemplateParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+C,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAG7F,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AAErF;;;;GAIG;AACH,qBAAa,4BAA6B,SAAQ,gCAAgC;IAE9E,kLAAkL;WACpK,cAAc,IAAI,4BAA4B;IAI5D;;;;;;;;OAQG;cACa,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,WAAW,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAiEnL"}
|
|
@@ -1,17 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { CompositeKey, LogError, LogStatus, Metadata } from "@memberjunction/core";
|
|
2
|
+
import { MJGlobal } from "@memberjunction/global";
|
|
3
|
+
import { EntityVectorSyncer } from "../models/entityVectorSync.js";
|
|
4
|
+
import { EntityDocumentTemplateParserBase } from "./EntityDocumenTemplateParserBase.js";
|
|
5
|
+
/**
|
|
6
|
+
* This is the first-level sub-class of EntityDocumentTemplateParserBase. This class is used to parse a string template with variables and functions.
|
|
7
|
+
* If you wish to override functionality you can subclass it and then use the @RegisterClass decorator to register the sub-class of EntityDocumentTemplateParser with a priority of 1 or above to
|
|
8
|
+
* then be used instead of the default implementation.
|
|
9
|
+
*/
|
|
10
|
+
export class EntityDocumentTemplateParser extends EntityDocumentTemplateParserBase {
|
|
11
|
+
/** Convenience method to get an instance of the class and uses the ClassFactory so we can create sub-classes if they are registered with higher priorities than the base class */
|
|
9
12
|
static CreateInstance() {
|
|
10
|
-
return
|
|
13
|
+
return MJGlobal.Instance.ClassFactory.CreateInstance(EntityDocumentTemplateParser);
|
|
11
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* This function
|
|
17
|
+
* @param entityID
|
|
18
|
+
* @param entityRecord
|
|
19
|
+
* @param relationshipName
|
|
20
|
+
* @param maxRows
|
|
21
|
+
* @param entityDocumentName
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
12
24
|
async Relationship(entityID, entityRecord, ContextUser, relationshipName, maxRows, entityDocumentName) {
|
|
13
|
-
|
|
14
|
-
const
|
|
25
|
+
// super inefficient handling to start, we'll optimize this later to call the related stuff in batch
|
|
26
|
+
const md = new Metadata();
|
|
27
|
+
const vectorSyncer = new EntityVectorSyncer();
|
|
15
28
|
vectorSyncer.CurrentUser = ContextUser;
|
|
16
29
|
const entityInfo = md.Entities.find(e => e.ID === entityID);
|
|
17
30
|
if (!entityInfo) {
|
|
@@ -22,20 +35,25 @@ class EntityDocumentTemplateParser extends EntityDocumenTemplateParserBase_1.Ent
|
|
|
22
35
|
throw new Error(`Relationship ${relationshipName} not found for entity ${entityInfo.Name}`);
|
|
23
36
|
}
|
|
24
37
|
const obj = await md.GetEntityObject(entityInfo.Name, ContextUser);
|
|
25
|
-
let compositeKey = new
|
|
38
|
+
let compositeKey = new CompositeKey();
|
|
26
39
|
compositeKey.LoadFromEntityInfoAndRecord(entityInfo, entityRecord);
|
|
27
40
|
let loadResult = await obj.InnerLoad(compositeKey);
|
|
28
41
|
if (!loadResult) {
|
|
29
|
-
|
|
42
|
+
LogError(`Failed to load entity ${entityInfo.Name} with ID ${compositeKey.ToString()}`);
|
|
30
43
|
return "";
|
|
31
44
|
}
|
|
32
45
|
const reData = await obj.GetRelatedEntityDataExt(re, null, maxRows);
|
|
33
46
|
if (reData && reData.Data) {
|
|
47
|
+
// now, get the entity document info if provided
|
|
34
48
|
if (entityDocumentName && entityDocumentName.trim().length > 0) {
|
|
49
|
+
// we have a document name, attempt to locate it
|
|
35
50
|
const doc = await vectorSyncer.GetEntityDocumentByName(entityDocumentName, ContextUser);
|
|
36
51
|
if (doc) {
|
|
52
|
+
// we have the document, now we need to parse it and build a result that is the concatenation of all the parsed documents
|
|
53
|
+
// start off by creating an instance of the parser using CreateInstance() so we're using the highest priority registered subclass
|
|
37
54
|
const parser = EntityDocumentTemplateParser.CreateInstance();
|
|
38
|
-
|
|
55
|
+
// now we need to batch the requests to the parser to have the right concurrency
|
|
56
|
+
const batchSize = 10; // Set the batch size to the desired number of concurrent requests
|
|
39
57
|
const results = [];
|
|
40
58
|
for (let i = 0; i < reData.Data.length; i += batchSize) {
|
|
41
59
|
const batchPromises = reData.Data.slice(i, i + batchSize).map(data => {
|
|
@@ -47,11 +65,12 @@ class EntityDocumentTemplateParser extends EntityDocumenTemplateParserBase_1.Ent
|
|
|
47
65
|
return results.map(r => r + "\n\n").join('');
|
|
48
66
|
}
|
|
49
67
|
else {
|
|
50
|
-
|
|
68
|
+
LogStatus(`Entity Document with name ${entityDocumentName} not found.`);
|
|
51
69
|
return "";
|
|
52
70
|
}
|
|
53
71
|
}
|
|
54
72
|
else {
|
|
73
|
+
// no entity document name provided, just return the data in a simple format
|
|
55
74
|
return JSON.stringify({ Relationship: relationshipName, Data: reData.Data });
|
|
56
75
|
}
|
|
57
76
|
}
|
|
@@ -60,5 +79,4 @@ class EntityDocumentTemplateParser extends EntityDocumenTemplateParserBase_1.Ent
|
|
|
60
79
|
}
|
|
61
80
|
}
|
|
62
81
|
}
|
|
63
|
-
exports.EntityDocumentTemplateParser = EntityDocumentTemplateParser;
|
|
64
82
|
//# sourceMappingURL=EntityDocumentTemplateParser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityDocumentTemplateParser.js","sourceRoot":"","sources":["../../src/generic/EntityDocumentTemplateParser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EntityDocumentTemplateParser.js","sourceRoot":"","sources":["../../src/generic/EntityDocumentTemplateParser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAY,MAAM,sBAAsB,CAAC;AAC7F,OAAO,EAAE,QAAQ,EAAiB,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AAErF;;;;GAIG;AACH,MAAM,OAAO,4BAA6B,SAAQ,gCAAgC;IAE9E,kLAAkL;IAC3K,MAAM,CAAC,cAAc;QACxB,OAAO,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,cAAc,CAA+B,4BAA4B,CAAC,CAAC;IACrH,CAAC;IAED;;;;;;;;OAQG;IACO,KAAK,CAAC,YAAY,CAAC,QAAgB,EAAE,YAAiB,EAAE,WAAqB,EAAE,gBAAwB,EAAE,OAAe,EAAE,kBAA0B;QAC1J,oGAAoG;QACpG,MAAM,EAAE,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC1B,MAAM,YAAY,GAAuB,IAAI,kBAAkB,EAAE,CAAC;QAClE,YAAY,CAAC,WAAW,GAAG,WAAW,CAAC;QAEvC,MAAM,UAAU,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC;QAC5D,IAAI,CAAC,UAA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|
|
1
1
|
import { RunViewParams } from "@memberjunction/core";
|
|
2
2
|
export type EntitySyncConfig = {
|
|
3
|
+
/**
|
|
4
|
+
* The ID of the entity document to use
|
|
5
|
+
*/
|
|
3
6
|
EntityDocumentID: string;
|
|
7
|
+
/**
|
|
8
|
+
* The time, in seconds, inbetween each run
|
|
9
|
+
*/
|
|
4
10
|
Interval: number;
|
|
11
|
+
/**
|
|
12
|
+
* The parameters to use when running the dynamic view.
|
|
13
|
+
* Note that the EntityName property will be overriden
|
|
14
|
+
* and set to the value of the Entity Document's Type field
|
|
15
|
+
* */
|
|
5
16
|
RunViewParams: RunViewParams;
|
|
17
|
+
/**
|
|
18
|
+
* If the given entity should be included in the sync
|
|
19
|
+
*/
|
|
6
20
|
IncludeInSync: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The last time the sync was run for this entitiy
|
|
23
|
+
* format is Month day, year hour:minute:second
|
|
24
|
+
* e.g. August 19, 1975 23:15:30
|
|
25
|
+
*/
|
|
7
26
|
LastRunDate: string;
|
|
27
|
+
/**
|
|
28
|
+
* The ID of the vector index to use
|
|
29
|
+
*/
|
|
8
30
|
VectorIndexID: number;
|
|
31
|
+
/**
|
|
32
|
+
* The ID of the vector databse to use
|
|
33
|
+
*/
|
|
9
34
|
VectorID: number;
|
|
10
35
|
};
|
|
11
36
|
//# sourceMappingURL=entitySyncConfig.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entitySyncConfig.types.d.ts","sourceRoot":"","sources":["../../src/generic/entitySyncConfig.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,MAAM,MAAM,gBAAgB,GAAG;
|
|
1
|
+
{"version":3,"file":"entitySyncConfig.types.d.ts","sourceRoot":"","sources":["../../src/generic/entitySyncConfig.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,MAAM,MAAM,gBAAgB,GAAG;IAC3B;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;SAIK;IACL,aAAa,EAAE,aAAa,CAAC;IAC7B;;OAEG;IACH,aAAa,EAAE,OAAO,CAAC;IACvB;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;CACnB,CAAA"}
|
|
@@ -5,11 +5,31 @@ import { EntityDocumentEntity, TemplateContentEntity, TemplateEntityExtended } f
|
|
|
5
5
|
export type VectorizeEntityParams = {
|
|
6
6
|
entityID: string;
|
|
7
7
|
entityDocumentID?: string;
|
|
8
|
+
/**
|
|
9
|
+
* If defined, all records within the given list will be vectorized
|
|
10
|
+
* instead of all records within the entity. Note that the list's
|
|
11
|
+
* EntityID field must equal the entityID parameter.
|
|
12
|
+
*/
|
|
8
13
|
listID?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The number of records to fetch from the list at a time. Defaults to 50.
|
|
16
|
+
*/
|
|
9
17
|
listBatchCount?: number;
|
|
18
|
+
/**
|
|
19
|
+
* The number of records to vectorize at a time. Defaults to 50.
|
|
20
|
+
*/
|
|
10
21
|
VectorizeBatchCount?: number;
|
|
22
|
+
/**
|
|
23
|
+
* The number of records to upsert to the vector database at a time. Defaults to 50.
|
|
24
|
+
*/
|
|
11
25
|
UpsertBatchCount?: number;
|
|
26
|
+
/**
|
|
27
|
+
* The UserInfo object to use
|
|
28
|
+
*/
|
|
12
29
|
CurrentUser?: UserInfo;
|
|
30
|
+
/**
|
|
31
|
+
* The number of records to skip before starting to fetch records from the list.
|
|
32
|
+
*/
|
|
13
33
|
StartingOffset?: number;
|
|
14
34
|
options?: any;
|
|
15
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vectorSync.types.d.ts","sourceRoot":"","sources":["../../src/generic/vectorSync.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEpH,MAAM,MAAM,qBAAqB,GAAG;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"vectorSync.types.d.ts","sourceRoot":"","sources":["../../src/generic/vectorSync.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEpH,MAAM,MAAM,qBAAqB,GAAG;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;MAIE;IACF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,WAAW,CAAC,EAAE,QAAQ,CAAC;IACvB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,GAAG,CAAC;CACjB,CAAA;AAED,MAAM,MAAM,uBAAuB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,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,qBAAqB,CAAC;IACvC,UAAU,EAAE,gBAAgB,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,OAAO,EAAE,CAAC;CACjB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './generic/vectorSync.types';
|
|
2
|
-
export * from './generic/entitySyncConfig.types';
|
|
3
|
-
export * from './models/entityVectorSync';
|
|
4
|
-
export * from './generic/EntityDocumentTemplateParser';
|
|
1
|
+
export * from './generic/vectorSync.types.js';
|
|
2
|
+
export * from './generic/entitySyncConfig.types.js';
|
|
3
|
+
export * from './models/entityVectorSync.js';
|
|
4
|
+
export * from './generic/EntityDocumentTemplateParser.js';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./generic/vectorSync.types"), exports);
|
|
18
|
-
__exportStar(require("./generic/entitySyncConfig.types"), exports);
|
|
19
|
-
__exportStar(require("./models/entityVectorSync"), exports);
|
|
20
|
-
__exportStar(require("./generic/EntityDocumentTemplateParser"), exports);
|
|
1
|
+
export * from './generic/vectorSync.types.js';
|
|
2
|
+
export * from './generic/entitySyncConfig.types.js';
|
|
3
|
+
export * from './models/entityVectorSync.js';
|
|
4
|
+
export * from './generic/EntityDocumentTemplateParser.js';
|
|
21
5
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wCAAwC,CAAC"}
|