@memberjunction/content-autotagging 5.0.0 → 5.2.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.
Files changed (78) hide show
  1. package/package.json +7 -7
  2. package/dist/src/CloudStorage/generic/CloudStorageBase.d.ts +0 -16
  3. package/dist/src/CloudStorage/generic/CloudStorageBase.d.ts.map +0 -1
  4. package/dist/src/CloudStorage/generic/CloudStorageBase.js +0 -48
  5. package/dist/src/CloudStorage/generic/CloudStorageBase.js.map +0 -1
  6. package/dist/src/CloudStorage/index.d.ts +0 -3
  7. package/dist/src/CloudStorage/index.d.ts.map +0 -1
  8. package/dist/src/CloudStorage/index.js +0 -19
  9. package/dist/src/CloudStorage/index.js.map +0 -1
  10. package/dist/src/CloudStorage/providers/AutotagAzureBlob.d.ts +0 -18
  11. package/dist/src/CloudStorage/providers/AutotagAzureBlob.d.ts.map +0 -1
  12. package/dist/src/CloudStorage/providers/AutotagAzureBlob.js +0 -91
  13. package/dist/src/CloudStorage/providers/AutotagAzureBlob.js.map +0 -1
  14. package/dist/src/Core/generic/AutotagBase.d.ts +0 -7
  15. package/dist/src/Core/generic/AutotagBase.d.ts.map +0 -1
  16. package/dist/src/Core/generic/AutotagBase.js +0 -7
  17. package/dist/src/Core/generic/AutotagBase.js.map +0 -1
  18. package/dist/src/Core/index.d.ts +0 -2
  19. package/dist/src/Core/index.d.ts.map +0 -1
  20. package/dist/src/Core/index.js +0 -18
  21. package/dist/src/Core/index.js.map +0 -1
  22. package/dist/src/Engine/generic/AutotagBaseEngine.d.ts +0 -52
  23. package/dist/src/Engine/generic/AutotagBaseEngine.d.ts.map +0 -1
  24. package/dist/src/Engine/generic/AutotagBaseEngine.js +0 -560
  25. package/dist/src/Engine/generic/AutotagBaseEngine.js.map +0 -1
  26. package/dist/src/Engine/generic/content.types.d.ts +0 -32
  27. package/dist/src/Engine/generic/content.types.d.ts.map +0 -1
  28. package/dist/src/Engine/generic/content.types.js +0 -38
  29. package/dist/src/Engine/generic/content.types.js.map +0 -1
  30. package/dist/src/Engine/generic/process.types.d.ts +0 -30
  31. package/dist/src/Engine/generic/process.types.d.ts.map +0 -1
  32. package/dist/src/Engine/generic/process.types.js +0 -33
  33. package/dist/src/Engine/generic/process.types.js.map +0 -1
  34. package/dist/src/Engine/index.d.ts +0 -4
  35. package/dist/src/Engine/index.d.ts.map +0 -1
  36. package/dist/src/Engine/index.js +0 -20
  37. package/dist/src/Engine/index.js.map +0 -1
  38. package/dist/src/Entity/generic/AutotagEntity.d.ts +0 -19
  39. package/dist/src/Entity/generic/AutotagEntity.d.ts.map +0 -1
  40. package/dist/src/Entity/generic/AutotagEntity.js +0 -130
  41. package/dist/src/Entity/generic/AutotagEntity.js.map +0 -1
  42. package/dist/src/Entity/index.d.ts +0 -2
  43. package/dist/src/Entity/index.d.ts.map +0 -1
  44. package/dist/src/Entity/index.js +0 -18
  45. package/dist/src/Entity/index.js.map +0 -1
  46. package/dist/src/LocalFileSystem/generic/AutotagLocalFileSystem.d.ts +0 -20
  47. package/dist/src/LocalFileSystem/generic/AutotagLocalFileSystem.d.ts.map +0 -1
  48. package/dist/src/LocalFileSystem/generic/AutotagLocalFileSystem.js +0 -155
  49. package/dist/src/LocalFileSystem/generic/AutotagLocalFileSystem.js.map +0 -1
  50. package/dist/src/LocalFileSystem/index.d.ts +0 -2
  51. package/dist/src/LocalFileSystem/index.d.ts.map +0 -1
  52. package/dist/src/LocalFileSystem/index.js +0 -18
  53. package/dist/src/LocalFileSystem/index.js.map +0 -1
  54. package/dist/src/RSSFeed/generic/AutotagRSSFeed.d.ts +0 -19
  55. package/dist/src/RSSFeed/generic/AutotagRSSFeed.d.ts.map +0 -1
  56. package/dist/src/RSSFeed/generic/AutotagRSSFeed.js +0 -168
  57. package/dist/src/RSSFeed/generic/AutotagRSSFeed.js.map +0 -1
  58. package/dist/src/RSSFeed/generic/RSS.types.d.ts +0 -13
  59. package/dist/src/RSSFeed/generic/RSS.types.d.ts.map +0 -1
  60. package/dist/src/RSSFeed/generic/RSS.types.js +0 -17
  61. package/dist/src/RSSFeed/generic/RSS.types.js.map +0 -1
  62. package/dist/src/RSSFeed/index.d.ts +0 -3
  63. package/dist/src/RSSFeed/index.d.ts.map +0 -1
  64. package/dist/src/RSSFeed/index.js +0 -19
  65. package/dist/src/RSSFeed/index.js.map +0 -1
  66. package/dist/src/Websites/generic/AutotagWebsite.d.ts +0 -33
  67. package/dist/src/Websites/generic/AutotagWebsite.d.ts.map +0 -1
  68. package/dist/src/Websites/generic/AutotagWebsite.js +0 -324
  69. package/dist/src/Websites/generic/AutotagWebsite.js.map +0 -1
  70. package/dist/src/Websites/index.d.ts +0 -2
  71. package/dist/src/Websites/index.d.ts.map +0 -1
  72. package/dist/src/Websites/index.js +0 -18
  73. package/dist/src/Websites/index.js.map +0 -1
  74. package/dist/src/index.d.ts +0 -7
  75. package/dist/src/index.d.ts.map +0 -1
  76. package/dist/src/index.js +0 -25
  77. package/dist/src/index.js.map +0 -1
  78. package/dist/tsconfig.tsbuildinfo +0 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@memberjunction/content-autotagging",
3
3
  "type": "module",
4
- "version": "5.0.0",
4
+ "version": "5.2.0",
5
5
  "description": "MemberJunction Content Autotagging Application",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -18,12 +18,12 @@
18
18
  "license": "ISC",
19
19
  "dependencies": {
20
20
  "@azure/storage-blob": "^12.30.0",
21
- "@memberjunction/ai": "5.0.0",
22
- "@memberjunction/ai-provider-bundle": "5.0.0",
23
- "@memberjunction/aiengine": "5.0.0",
24
- "@memberjunction/core": "5.0.0",
25
- "@memberjunction/core-entities": "5.0.0",
26
- "@memberjunction/global": "5.0.0",
21
+ "@memberjunction/ai": "5.2.0",
22
+ "@memberjunction/ai-provider-bundle": "5.2.0",
23
+ "@memberjunction/aiengine": "5.2.0",
24
+ "@memberjunction/core": "5.2.0",
25
+ "@memberjunction/core-entities": "5.2.0",
26
+ "@memberjunction/global": "5.2.0",
27
27
  "axios": "^1.13.4",
28
28
  "cheerio": "^1.2.0",
29
29
  "date-fns": "^3.6.0",
@@ -1,16 +0,0 @@
1
- import { AutotagBase } from "../../Core/index.js";
2
- import { AutotagBaseEngine } from "../../Engine/index.js";
3
- import { ContentSourceParams } from "../../Engine/index.js";
4
- import { UserInfo } from "@memberjunction/core";
5
- import { ContentSourceEntity, ContentItemEntity } from "@memberjunction/core-entities";
6
- export declare abstract class CloudStorageBase extends AutotagBase {
7
- protected contextUser: UserInfo;
8
- protected engine: AutotagBaseEngine;
9
- protected contentSourceTypeID: string;
10
- constructor();
11
- abstract Authenticate(): Promise<void>;
12
- abstract SetNewAndModifiedContentItems(contentSourceParams: ContentSourceParams, lastRunDate: Date, contextUser: UserInfo): Promise<ContentItemEntity[]>;
13
- Autotag(contextUser: UserInfo): Promise<void>;
14
- SetContentItemsToProcess(contentSources: ContentSourceEntity[]): Promise<ContentItemEntity[]>;
15
- }
16
- //# sourceMappingURL=CloudStorageBase.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CloudStorageBase.d.ts","sourceRoot":"","sources":["../../../../src/CloudStorage/generic/CloudStorageBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAIvF,8BAAsB,gBAAiB,SAAQ,WAAW;IACtD,SAAS,CAAC,WAAW,EAAE,QAAQ,CAAC;IAChC,SAAS,CAAC,MAAM,EAAE,iBAAiB,CAAC;IACpC,SAAS,CAAC,mBAAmB,EAAE,MAAM,CAAA;;aAUrB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;aAW7B,6BAA6B,CAAC,mBAAmB,EAAE,mBAAmB,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAElJ,OAAO,CAAC,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ7C,wBAAwB,CAAC,cAAc,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;CAyB7G"}
@@ -1,48 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.CloudStorageBase = void 0;
7
- const Core_1 = require("../../Core/index.js");
8
- const Engine_1 = require("../../Engine/index.js");
9
- const dotenv_1 = __importDefault(require("dotenv"));
10
- dotenv_1.default.config();
11
- class CloudStorageBase extends Core_1.AutotagBase {
12
- contextUser;
13
- engine;
14
- contentSourceTypeID;
15
- constructor() {
16
- super();
17
- this.engine = Engine_1.AutotagBaseEngine.Instance;
18
- }
19
- async Autotag(contextUser) {
20
- this.contextUser = contextUser;
21
- this.contentSourceTypeID = await this.engine.setSubclassContentSourceType('Cloud Storage', this.contextUser);
22
- const contentSources = await this.engine.getAllContentSources(this.contextUser, this.contentSourceTypeID) || [];
23
- const contentItemsToProcess = await this.SetContentItemsToProcess(contentSources);
24
- await this.engine.ExtractTextAndProcessWithLLM(contentItemsToProcess, this.contextUser);
25
- }
26
- async SetContentItemsToProcess(contentSources) {
27
- const contentItemsToProcess = [];
28
- for (const contentSource of contentSources) {
29
- await this.Authenticate();
30
- const contentSourceParams = {
31
- contentSourceID: contentSource.ID,
32
- name: contentSource.Name,
33
- ContentTypeID: contentSource.ContentTypeID,
34
- ContentSourceTypeID: contentSource.ContentSourceTypeID,
35
- ContentFileTypeID: contentSource.ContentFileTypeID,
36
- URL: contentSource.URL
37
- };
38
- const lastRunDate = await this.engine.getContentSourceLastRunDate(contentSourceParams.contentSourceID, this.contextUser);
39
- if (lastRunDate) {
40
- const contentItems = await this.SetNewAndModifiedContentItems(contentSourceParams, lastRunDate, this.contextUser);
41
- contentItemsToProcess.push(...contentItems);
42
- }
43
- }
44
- return contentItemsToProcess;
45
- }
46
- }
47
- exports.CloudStorageBase = CloudStorageBase;
48
- //# sourceMappingURL=CloudStorageBase.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CloudStorageBase.js","sourceRoot":"","sources":["../../../../src/CloudStorage/generic/CloudStorageBase.ts"],"names":[],"mappings":";;;;;;AAAA,qCAAyC;AACzC,yCAAiD;AAIjD,oDAA4B;AAC5B,gBAAM,CAAC,MAAM,EAAE,CAAA;AAEf,MAAsB,gBAAiB,SAAQ,kBAAW;IAC5C,WAAW,CAAW;IACtB,MAAM,CAAoB;IAC1B,mBAAmB,CAAQ;IAErC;QACI,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,0BAAiB,CAAC,QAAQ,CAAC;IAC7C,CAAC;IAkBM,KAAK,CAAC,OAAO,CAAC,WAAqB;QACtC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,mBAAmB,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,4BAA4B,CAAC,eAAe,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAC7G,MAAM,cAAc,GAA0B,MAAM,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,mBAAmB,CAAC,IAAI,EAAE,CAAC;QACvI,MAAM,qBAAqB,GAAwB,MAAM,IAAI,CAAC,wBAAwB,CAAC,cAAc,CAAC,CAAA;QACtG,MAAM,IAAI,CAAC,MAAM,CAAC,4BAA4B,CAAC,qBAAqB,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAC5F,CAAC;IAEM,KAAK,CAAC,wBAAwB,CAAC,cAAqC;QACvE,MAAM,qBAAqB,GAAwB,EAAE,CAAA;QAErD,KAAK,MAAM,aAAa,IAAI,cAAc,EAAE,CAAC;YACzC,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;YAE1B,MAAM,mBAAmB,GAAwB;gBAC7C,eAAe,EAAE,aAAa,CAAC,EAAE;gBACjC,IAAI,EAAE,aAAa,CAAC,IAAI;gBACxB,aAAa,EAAE,aAAa,CAAC,aAAa;gBAC1C,mBAAmB,EAAE,aAAa,CAAC,mBAAmB;gBACtD,iBAAiB,EAAE,aAAa,CAAC,iBAAiB;gBAClD,GAAG,EAAE,aAAa,CAAC,GAAG;aACzB,CAAA;YAED,MAAM,WAAW,GAAS,MAAM,IAAI,CAAC,MAAM,CAAC,2BAA2B,CAAC,mBAAmB,CAAC,eAAe,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;YAE/H,IAAI,WAAW,EAAE,CAAC;gBACd,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,6BAA6B,CAAC,mBAAmB,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;gBAClH,qBAAqB,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,CAAC;YAChD,CAAC;QACL,CAAC;QAED,OAAO,qBAAqB,CAAC;IACjC,CAAC;CACJ;AA3DD,4CA2DC"}
@@ -1,3 +0,0 @@
1
- export * from './generic/CloudStorageBase.js';
2
- export * from './providers/AutotagAzureBlob.js';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/CloudStorage/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,8BAA8B,CAAA"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
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 __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/CloudStorageBase.js"), exports);
18
- __exportStar(require("./providers/AutotagAzureBlob.js"), exports);
19
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/CloudStorage/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA0C;AAC1C,+DAA4C"}
@@ -1,18 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { CloudStorageBase } from "../generic/CloudStorageBase.js";
4
- import { UserInfo } from "@memberjunction/core";
5
- import { ContentItemEntity } from "@memberjunction/core-entities";
6
- import { ContentSourceParams } from "../../Engine/index.js";
7
- export declare class AutotagAzureBlob extends CloudStorageBase {
8
- private blobServiceClient;
9
- private containerClient;
10
- private connectionString;
11
- private containerName;
12
- constructor(connectionString: string, containerName: string);
13
- Authenticate(): Promise<void>;
14
- SetNewAndModifiedContentItems(contentSourceParams: ContentSourceParams, lastRunDate: Date, contextUser: UserInfo, prefix?: string): Promise<ContentItemEntity[]>;
15
- extractText(file: string): Promise<string>;
16
- streamToBuffer(readableStream: NodeJS.ReadableStream): Promise<Buffer>;
17
- }
18
- //# sourceMappingURL=AutotagAzureBlob.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AutotagAzureBlob.d.ts","sourceRoot":"","sources":["../../../../src/CloudStorage/providers/AutotagAzureBlob.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGlE,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGnD,qBAAa,gBAAiB,SAAQ,gBAAgB;IAClD,OAAO,CAAC,iBAAiB,CAAoB;IAC7C,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,aAAa,CAAS;gBAElB,gBAAgB,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;IAW9C,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAc7B,6BAA6B,CAAC,mBAAmB,EAAE,mBAAmB,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAG,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAwC1J,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAQ1C,cAAc,CAAC,cAAc,EAAE,MAAM,CAAC,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;CAYtF"}
@@ -1,91 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.AutotagAzureBlob = void 0;
7
- const CloudStorageBase_1 = require("../generic/CloudStorageBase.js");
8
- const storage_blob_1 = require("@azure/storage-blob");
9
- const dotenv_1 = __importDefault(require("dotenv"));
10
- const core_1 = require("@memberjunction/core");
11
- const path_1 = __importDefault(require("path"));
12
- dotenv_1.default.config();
13
- class AutotagAzureBlob extends CloudStorageBase_1.CloudStorageBase {
14
- blobServiceClient;
15
- containerClient;
16
- connectionString;
17
- containerName;
18
- constructor(connectionString, containerName) {
19
- super();
20
- this.connectionString = connectionString;
21
- this.containerName = containerName;
22
- }
23
- async Authenticate() {
24
- try {
25
- this.blobServiceClient = storage_blob_1.BlobServiceClient.fromConnectionString(this.connectionString);
26
- for await (const container of this.blobServiceClient.listContainers()) {
27
- console.log(`Container: ${container.name}`);
28
- }
29
- this.containerClient = this.blobServiceClient.getContainerClient(this.containerName);
30
- }
31
- catch (error) {
32
- console.error(error);
33
- throw new Error('Error authenticating to Azure Blob Storage');
34
- }
35
- }
36
- async SetNewAndModifiedContentItems(contentSourceParams, lastRunDate, contextUser, prefix = '') {
37
- const contentItemsToProcess = [];
38
- for await (const blob of this.containerClient.listBlobsFlat()) {
39
- const filePath = path_1.default.join(this.containerName, blob.name);
40
- if (blob.properties.createdOn && blob.properties.createdOn > lastRunDate) {
41
- const md = new core_1.Metadata();
42
- const contentItem = await md.GetEntityObject('Content Items', contextUser);
43
- const text = await this.extractText(blob.name);
44
- contentItem.ContentSourceID = contentSourceParams.contentSourceID;
45
- contentItem.Name = blob.name;
46
- contentItem.Description = await this.engine.getContentItemDescription(contentSourceParams, contextUser);
47
- contentItem.URL = filePath;
48
- contentItem.ContentTypeID = contentSourceParams.ContentTypeID;
49
- contentItem.ContentSourceTypeID = contentSourceParams.ContentSourceTypeID;
50
- contentItem.ContentFileTypeID = contentSourceParams.ContentFileTypeID;
51
- contentItem.Checksum = await this.engine.getChecksumFromText(text);
52
- contentItem.Text = text;
53
- await contentItem.Save();
54
- contentItemsToProcess.push(contentItem);
55
- }
56
- else if (blob.properties.lastModified && blob.properties.lastModified > lastRunDate) {
57
- const md = new core_1.Metadata();
58
- const contentItem = await md.GetEntityObject('Content Items', contextUser);
59
- const contentItemID = await this.engine.getContentItemIDFromURL(contentSourceParams, contextUser);
60
- await contentItem.Load(contentItemID);
61
- const text = await this.extractText(blob.name);
62
- contentItem.Text = text;
63
- contentItem.Checksum = await this.engine.getChecksumFromText(text);
64
- contentItem.Save();
65
- contentItemsToProcess.push(contentItem);
66
- }
67
- }
68
- return contentItemsToProcess;
69
- }
70
- async extractText(file) {
71
- const blockBlobClient = this.containerClient.getBlockBlobClient(file);
72
- const downloadBlockBlobResponse = await blockBlobClient.download();
73
- const document = await this.streamToBuffer(downloadBlockBlobResponse.readableStreamBody);
74
- const text = await this.engine.parsePDF(document);
75
- return text;
76
- }
77
- async streamToBuffer(readableStream) {
78
- return new Promise((resolve, reject) => {
79
- const chunks = [];
80
- readableStream.on("data", (data) => {
81
- chunks.push(data instanceof Buffer ? data : Buffer.from(data));
82
- });
83
- readableStream.on("end", () => {
84
- resolve(Buffer.concat(chunks));
85
- });
86
- readableStream.on("error", reject);
87
- });
88
- }
89
- }
90
- exports.AutotagAzureBlob = AutotagAzureBlob;
91
- //# sourceMappingURL=AutotagAzureBlob.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AutotagAzureBlob.js","sourceRoot":"","sources":["../../../../src/CloudStorage/providers/AutotagAzureBlob.ts"],"names":[],"mappings":";;;;;;AAAA,kEAA+D;AAE/D,sDAAyE;AACzE,oDAA4B;AAE5B,+CAAgD;AAChD,gDAAwB;AAExB,gBAAM,CAAC,MAAM,EAAE,CAAA;AAEf,MAAa,gBAAiB,SAAQ,mCAAgB;IAC1C,iBAAiB,CAAoB;IACrC,eAAe,CAAkB;IACjC,gBAAgB,CAAS;IACzB,aAAa,CAAS;IAE9B,YAAY,gBAAwB,EAAE,aAAqB;QACvD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAA;QACxC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;IACtC,CAAC;IAOM,KAAK,CAAC,YAAY;QACrB,IAAI,CAAC;YACD,IAAI,CAAC,iBAAiB,GAAG,gCAAiB,CAAC,oBAAoB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YACvF,IAAI,KAAK,EAAE,MAAM,SAAS,IAAI,IAAI,CAAC,iBAAiB,CAAC,cAAc,EAAE,EAAE,CAAC;gBACpE,OAAO,CAAC,GAAG,CAA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C,WAAW,CAAC,IAAY;QACjC,MAAM,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAA;QACrE,MAAM,yBAAyB,GAAG,MAAM,eAAe,CAAC,QAAQ,EAAE,CAAA;QAClE,MAAM,QAAQ,GAAW,MAAM,IAAI,CAAC,cAAc,CAAC,yBAAyB,CAAC,kBAAkB,CAAC,CAAA;QAChG,MAAM,IAAI,GAAW,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;QACzD,OAAO,IAAI,CAAA;IACf,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,cAAqC;QAC7D,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACnC,MAAM,MAAM,GAAa,EAAE,CAAC;YAC5B,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;gBAC/B,MAAM,CAAC,IAAI,CAAC,IAAI,YAAY,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YACnE,CAAC,CAAC,CAAC;YACH,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;gBAC1B,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;YACnC,CAAC,CAAC,CAAC;YACH,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AA3FD,4CA2FC"}
@@ -1,7 +0,0 @@
1
- import { UserInfo } from '@memberjunction/core';
2
- import { ContentSourceEntity, ContentItemEntity } from '@memberjunction/core-entities';
3
- export declare abstract class AutotagBase {
4
- abstract SetContentItemsToProcess(contentSources: ContentSourceEntity[]): Promise<ContentItemEntity[]>;
5
- abstract Autotag(contextUser: UserInfo): Promise<void>;
6
- }
7
- //# sourceMappingURL=AutotagBase.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AutotagBase.d.ts","sourceRoot":"","sources":["../../../../src/Core/generic/AutotagBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAEvF,8BAAsB,WAAW;aACb,wBAAwB,CAAC,cAAc,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;aAC7F,OAAO,CAAC,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAChE"}
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AutotagBase = void 0;
4
- class AutotagBase {
5
- }
6
- exports.AutotagBase = AutotagBase;
7
- //# sourceMappingURL=AutotagBase.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AutotagBase.js","sourceRoot":"","sources":["../../../../src/Core/generic/AutotagBase.ts"],"names":[],"mappings":";;;AAGA,MAAsB,WAAW;CAGhC;AAHD,kCAGC"}
@@ -1,2 +0,0 @@
1
- export * from './generic/AutotagBase.js';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Core/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
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 __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/AutotagBase.js"), exports);
18
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC"}
@@ -1,52 +0,0 @@
1
- /// <reference types="node" />
2
- import { UserInfo } from '@memberjunction/core';
3
- import { ContentSourceEntity, ContentItemEntity } from '@memberjunction/core-entities';
4
- import { ContentSourceParams, ContentSourceTypeParams } from './content.types.js';
5
- import { ProcessRunParams, JsonObject, ContentItemProcessParams } from './process.types.js';
6
- import { BaseLLM } from '@memberjunction/ai';
7
- import { AIEngine } from '@memberjunction/aiengine';
8
- export declare class AutotagBaseEngine extends AIEngine {
9
- constructor();
10
- static get Instance(): AutotagBaseEngine;
11
- ExtractTextAndProcessWithLLM(contentItems: ContentItemEntity[], contextUser: UserInfo): Promise<void>;
12
- ProcessContentItemText(params: ContentItemProcessParams, contextUser: UserInfo): Promise<void>;
13
- promptAndRetrieveResultsFromLLM(params: ContentItemProcessParams, contextUser: UserInfo): Promise<JsonObject>;
14
- processChunkWithLLM(llm: BaseLLM, systemPrompt: string, userPrompt: string, LLMResults: JsonObject, modelAPIName: string): Promise<JsonObject>;
15
- getLLMPrompts(params: ContentItemProcessParams, chunk: string, LLMResults: JsonObject, contextUser: UserInfo): Promise<{
16
- systemPrompt: string;
17
- userPrompt: string;
18
- }>;
19
- saveLLMResults(LLMResults: JsonObject, contextUser: UserInfo): Promise<void>;
20
- deleteInvalidContentItem(contentItemID: string, contextUser: UserInfo): Promise<void>;
21
- chunkExtractedText(text: string, tokenLimit: number): string[];
22
- saveContentItemTags(contentItemID: string, LLMResults: JsonObject, contextUser: UserInfo): Promise<void>;
23
- saveResultsToContentItemAttribute(LLMResults: JsonObject, contextUser: UserInfo): Promise<void>;
24
- getAllContentSources(contextUser: UserInfo, contentSourceTypeID: string): Promise<ContentSourceEntity[]>;
25
- setSubclassContentSourceType(subclass: string, contextUser: UserInfo): Promise<string>;
26
- getContentSourceParams(contentSource: ContentSourceEntity, contextUser: UserInfo): Promise<any>;
27
- getDefaultContentSourceTypeParams(contentSourceTypeParamID: string, contextUser: UserInfo): Promise<ContentSourceTypeParams>;
28
- castValueAsCorrectType(value: string, type: string): any;
29
- stringToBoolean(string: string): boolean;
30
- parseStringArray(value: string): string[];
31
- convertLastRunDateToTimezone(lastRunDate: Date): Promise<Date>;
32
- getContentSourceLastRunDate(contentSourceID: string, contextUser: UserInfo): Promise<Date>;
33
- getContentItemParams(contentTypeID: string, contextUser: UserInfo): Promise<{
34
- modelID: string;
35
- minTags: number;
36
- maxTags: number;
37
- }>;
38
- getContentSourceTypeName(contentSourceTypeID: string, contextUser: UserInfo): Promise<string>;
39
- getContentTypeName(contentTypeID: string, contextUser: UserInfo): Promise<string>;
40
- getContentFileTypeName(contentFileTypeID: string, contextUser: UserInfo): Promise<string>;
41
- getAdditionalContentTypePrompt(contentTypeID: string, contextUser: UserInfo): Promise<string>;
42
- getContentItemDescription(contentSourceParams: ContentSourceParams, contextUser: any): Promise<string>;
43
- getChecksumFromURL(url: string): Promise<string>;
44
- getChecksumFromText(text: string): Promise<string>;
45
- getContentItemIDFromURL(contentSourceParams: ContentSourceParams, contextUser: UserInfo): Promise<string>;
46
- saveProcessRun(processRunParams: ProcessRunParams, contextUser: UserInfo): Promise<void>;
47
- parsePDF(dataBuffer: Buffer): Promise<string>;
48
- parseDOCX(dataBuffer: Buffer): Promise<string>;
49
- parseHTML(data: string): Promise<string>;
50
- parseFileFromPath(filePath: string): Promise<string>;
51
- }
52
- //# sourceMappingURL=AutotagBaseEngine.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file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