@memberjunction/content-autotagging 5.23.0 → 5.25.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 (48) hide show
  1. package/dist/CloudStorage/generic/CloudStorageBase.d.ts +1 -1
  2. package/dist/CloudStorage/generic/CloudStorageBase.d.ts.map +1 -1
  3. package/dist/CloudStorage/generic/CloudStorageBase.js +2 -1
  4. package/dist/CloudStorage/generic/CloudStorageBase.js.map +1 -1
  5. package/dist/CloudStorage/index.d.ts +5 -0
  6. package/dist/CloudStorage/index.d.ts.map +1 -1
  7. package/dist/CloudStorage/index.js +5 -0
  8. package/dist/CloudStorage/index.js.map +1 -1
  9. package/dist/CloudStorage/providers/AutotagCloudStorage.d.ts +61 -0
  10. package/dist/CloudStorage/providers/AutotagCloudStorage.d.ts.map +1 -0
  11. package/dist/CloudStorage/providers/AutotagCloudStorage.js +257 -0
  12. package/dist/CloudStorage/providers/AutotagCloudStorage.js.map +1 -0
  13. package/dist/Core/generic/AutotagBase.d.ts +10 -1
  14. package/dist/Core/generic/AutotagBase.d.ts.map +1 -1
  15. package/dist/Core/generic/AutotagBase.js.map +1 -1
  16. package/dist/Engine/generic/AutotagBaseEngine.d.ts +324 -18
  17. package/dist/Engine/generic/AutotagBaseEngine.d.ts.map +1 -1
  18. package/dist/Engine/generic/AutotagBaseEngine.js +1036 -178
  19. package/dist/Engine/generic/AutotagBaseEngine.js.map +1 -1
  20. package/dist/Engine/generic/RateLimiter.d.ts +49 -0
  21. package/dist/Engine/generic/RateLimiter.d.ts.map +1 -0
  22. package/dist/Engine/generic/RateLimiter.js +98 -0
  23. package/dist/Engine/generic/RateLimiter.js.map +1 -0
  24. package/dist/Engine/index.d.ts +1 -0
  25. package/dist/Engine/index.d.ts.map +1 -1
  26. package/dist/Engine/index.js +1 -0
  27. package/dist/Engine/index.js.map +1 -1
  28. package/dist/Entity/generic/AutotagEntity.d.ts +68 -14
  29. package/dist/Entity/generic/AutotagEntity.d.ts.map +1 -1
  30. package/dist/Entity/generic/AutotagEntity.js +396 -83
  31. package/dist/Entity/generic/AutotagEntity.js.map +1 -1
  32. package/dist/LocalFileSystem/generic/AutotagLocalFileSystem.d.ts +1 -1
  33. package/dist/LocalFileSystem/generic/AutotagLocalFileSystem.d.ts.map +1 -1
  34. package/dist/LocalFileSystem/generic/AutotagLocalFileSystem.js +2 -1
  35. package/dist/LocalFileSystem/generic/AutotagLocalFileSystem.js.map +1 -1
  36. package/dist/RSSFeed/generic/AutotagRSSFeed.d.ts +47 -16
  37. package/dist/RSSFeed/generic/AutotagRSSFeed.d.ts.map +1 -1
  38. package/dist/RSSFeed/generic/AutotagRSSFeed.js +239 -120
  39. package/dist/RSSFeed/generic/AutotagRSSFeed.js.map +1 -1
  40. package/dist/Websites/generic/AutotagWebsite.d.ts +1 -1
  41. package/dist/Websites/generic/AutotagWebsite.d.ts.map +1 -1
  42. package/dist/Websites/generic/AutotagWebsite.js +2 -1
  43. package/dist/Websites/generic/AutotagWebsite.js.map +1 -1
  44. package/dist/index.d.ts +1 -0
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +1 -0
  47. package/dist/index.js.map +1 -1
  48. package/package.json +16 -11
@@ -22,7 +22,7 @@ export declare abstract class CloudStorageBase extends AutotagBase {
22
22
  * @returns - An array of content source items that have been modified or added after the most recent process run for that content source
23
23
  */
24
24
  abstract SetNewAndModifiedContentItems(contentSourceParams: ContentSourceParams, lastRunDate: Date, contextUser: UserInfo): Promise<MJContentItemEntity[]>;
25
- Autotag(contextUser: UserInfo, onProgress?: AutotagProgressCallback): Promise<void>;
25
+ Autotag(contextUser: UserInfo, onProgress?: AutotagProgressCallback): Promise<number>;
26
26
  SetContentItemsToProcess(contentSources: MJContentSourceEntity[]): Promise<MJContentItemEntity[]>;
27
27
  }
28
28
  //# sourceMappingURL=CloudStorageBase.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CloudStorageBase.d.ts","sourceRoot":"","sources":["../../../src/CloudStorage/generic/CloudStorageBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAClE,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,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAI3F,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;;IAOrC;;MAEE;aACc,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAE7C;;;;;;;;MAQE;aACc,6BAA6B,CAAC,mBAAmB,EAAE,mBAAmB,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAEpJ,OAAO,CAAC,WAAW,EAAE,QAAQ,EAAE,UAAU,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;IAQnF,wBAAwB,CAAC,cAAc,EAAE,qBAAqB,EAAE,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;CAyBjH"}
1
+ {"version":3,"file":"CloudStorageBase.d.ts","sourceRoot":"","sources":["../../../src/CloudStorage/generic/CloudStorageBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAClE,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,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAI3F,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;;IAOrC;;MAEE;aACc,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAE7C;;;;;;;;MAQE;aACc,6BAA6B,CAAC,mBAAmB,EAAE,mBAAmB,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAEpJ,OAAO,CAAC,WAAW,EAAE,QAAQ,EAAE,UAAU,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC;IASrF,wBAAwB,CAAC,cAAc,EAAE,qBAAqB,EAAE,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;CAyBjH"}
@@ -12,7 +12,8 @@ export class CloudStorageBase extends AutotagBase {
12
12
  this.contentSourceTypeID = this.engine.SetSubclassContentSourceType('Cloud Storage');
13
13
  const contentSources = await this.engine.getAllContentSources(this.contextUser, this.contentSourceTypeID) || [];
14
14
  const contentItemsToProcess = await this.SetContentItemsToProcess(contentSources);
15
- await this.engine.ExtractTextAndProcessWithLLM(contentItemsToProcess, this.contextUser, undefined, onProgress);
15
+ await this.engine.ExtractTextAndProcessWithLLM(contentItemsToProcess, this.contextUser, undefined, undefined, onProgress);
16
+ return contentItemsToProcess.length;
16
17
  }
17
18
  async SetContentItemsToProcess(contentSources) {
18
19
  const contentItemsToProcess = [];
@@ -1 +1 @@
1
- {"version":3,"file":"CloudStorageBase.js","sourceRoot":"","sources":["../../../src/CloudStorage/generic/CloudStorageBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA2B,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,M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AAwB,CAAC,cAAc,CAAC,CAAA;QACxG,MAAM,IAAI,CAAC,MAAM,CAAC,4BAA4B,CAAC,qBAAqB,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;QAC1H,OAAO,qBAAqB,CAAC,MAAM,CAAC;IACxC,CAAC;IAEM,KAAK,CAAC,wBAAwB,CAAC,cAAuC;QACzE,MAAM,qBAAqB,GAA0B,EAAE,CAAA;QAEvD,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"}
@@ -1,3 +1,8 @@
1
1
  export * from './generic/CloudStorageBase.js';
2
+ export * from './providers/AutotagCloudStorage.js';
3
+ /**
4
+ * @deprecated Use AutotagCloudStorage instead, which works with any MJ Storage provider.
5
+ * AutotagAzureBlob is retained for backward compatibility but will be removed in a future version.
6
+ */
2
7
  export * from './providers/AutotagAzureBlob.js';
3
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/CloudStorage/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,8BAA8B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/CloudStorage/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,iCAAiC,CAAA;AAE/C;;;GAGG;AACH,cAAc,8BAA8B,CAAA"}
@@ -1,3 +1,8 @@
1
1
  export * from './generic/CloudStorageBase.js';
2
+ export * from './providers/AutotagCloudStorage.js';
3
+ /**
4
+ * @deprecated Use AutotagCloudStorage instead, which works with any MJ Storage provider.
5
+ * AutotagAzureBlob is retained for backward compatibility but will be removed in a future version.
6
+ */
2
7
  export * from './providers/AutotagAzureBlob.js';
3
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/CloudStorage/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,8BAA8B,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/CloudStorage/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,iCAAiC,CAAA;AAE/C;;;GAGG;AACH,cAAc,8BAA8B,CAAA"}
@@ -0,0 +1,61 @@
1
+ import { UserInfo } from '@memberjunction/core';
2
+ import { MJContentItemEntity } from '@memberjunction/core-entities';
3
+ import { AutotagBase, AutotagProgressCallback } from '../../Core/index.js';
4
+ import { MJContentSourceEntity } from '@memberjunction/core-entities';
5
+ /**
6
+ * Generic cloud storage autotag provider that works with ANY MJ Storage driver.
7
+ *
8
+ * Replaces the previous Azure-specific AutotagAzureBlob by delegating file listing
9
+ * and reading to the MJ Storage abstraction layer (FileStorageBase). This means it
10
+ * works with Azure Blob, AWS S3, Google Cloud Storage, SharePoint, Dropbox, Box, etc.
11
+ *
12
+ * Configuration is driven by ContentSource.Configuration JSON which must include
13
+ * a `FileStorageProviderKey` matching a registered MJ Storage driver.
14
+ *
15
+ * The storage driver is initialized via environment-based config (e.g.,
16
+ * STORAGE_AZURE_ACCOUNT_NAME, STORAGE_AZURE_ACCOUNT_KEY) which the MJ Storage
17
+ * drivers read automatically on construction.
18
+ */
19
+ export declare class AutotagCloudStorage extends AutotagBase {
20
+ private contextUser;
21
+ private engine;
22
+ protected contentSourceTypeID: string;
23
+ Autotag(contextUser: UserInfo, onProgress?: AutotagProgressCallback): Promise<number>;
24
+ SetContentItemsToProcess(contentSources: MJContentSourceEntity[]): Promise<MJContentItemEntity[]>;
25
+ /**
26
+ * Process a single content source: initialize the storage driver, list files,
27
+ * detect new/modified files, download and extract text, create ContentItems.
28
+ */
29
+ private ProcessContentSource;
30
+ /**
31
+ * Parse the ContentSource.Configuration JSON to extract cloud storage config.
32
+ */
33
+ private ParseSourceConfig;
34
+ /**
35
+ * Create and return a storage driver via ClassFactory using the provider key.
36
+ */
37
+ private CreateStorageDriver;
38
+ /**
39
+ * List all objects in the storage driver that were modified after lastRunDate.
40
+ * Optionally filter by file extension.
41
+ */
42
+ private ListModifiedObjects;
43
+ /**
44
+ * Download a file, extract text, and create/update a ContentItem.
45
+ */
46
+ private ProcessSingleFile;
47
+ /**
48
+ * Load existing ContentItems for a source, keyed by lowercase URL for upsert lookups.
49
+ */
50
+ private LoadExistingContentItems;
51
+ /**
52
+ * Extract text from a file buffer based on file extension.
53
+ * Delegates to the engine's built-in parsers for PDF and Office documents.
54
+ */
55
+ private ExtractTextFromBuffer;
56
+ /**
57
+ * Get the lowercase file extension including the dot (e.g., '.pdf').
58
+ */
59
+ private GetFileExtension;
60
+ }
61
+ //# sourceMappingURL=AutotagCloudStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutotagCloudStorage.d.ts","sourceRoot":"","sources":["../../../src/CloudStorage/providers/AutotagCloudStorage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAA0C,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEpE,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAElE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAgBtE;;;;;;;;;;;;;GAaG;AACH,qBACa,mBAAoB,SAAQ,WAAW;IAChD,OAAO,CAAC,WAAW,CAAY;IAC/B,OAAO,CAAC,MAAM,CAAqB;IACnC,SAAS,CAAC,mBAAmB,EAAG,MAAM,CAAC;IAE1B,OAAO,CAAC,WAAW,EAAE,QAAQ,EAAE,UAAU,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC;IAiBrF,wBAAwB,CAAC,cAAc,EAAE,qBAAqB,EAAE,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAgB9G;;;OAGG;YACW,oBAAoB;IA4ClC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAsBzB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAgB3B;;;OAGG;YACW,mBAAmB;IAsBjC;;OAEG;YACW,iBAAiB;IAsD/B;;OAEG;YACW,wBAAwB;IAmBtC;;;OAGG;YACW,qBAAqB;IAoBnC;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAK3B"}
@@ -0,0 +1,257 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { RegisterClass } from '@memberjunction/global';
8
+ import { MJGlobal } from '@memberjunction/global';
9
+ import { Metadata, RunView, LogStatus, LogError } from '@memberjunction/core';
10
+ import { FileStorageBase } from '@memberjunction/storage';
11
+ import { AutotagBase } from '../../Core/index.js';
12
+ import { AutotagBaseEngine } from '../../Engine/index.js';
13
+ /**
14
+ * Generic cloud storage autotag provider that works with ANY MJ Storage driver.
15
+ *
16
+ * Replaces the previous Azure-specific AutotagAzureBlob by delegating file listing
17
+ * and reading to the MJ Storage abstraction layer (FileStorageBase). This means it
18
+ * works with Azure Blob, AWS S3, Google Cloud Storage, SharePoint, Dropbox, Box, etc.
19
+ *
20
+ * Configuration is driven by ContentSource.Configuration JSON which must include
21
+ * a `FileStorageProviderKey` matching a registered MJ Storage driver.
22
+ *
23
+ * The storage driver is initialized via environment-based config (e.g.,
24
+ * STORAGE_AZURE_ACCOUNT_NAME, STORAGE_AZURE_ACCOUNT_KEY) which the MJ Storage
25
+ * drivers read automatically on construction.
26
+ */
27
+ let AutotagCloudStorage = class AutotagCloudStorage extends AutotagBase {
28
+ async Autotag(contextUser, onProgress) {
29
+ this.contextUser = contextUser;
30
+ this.engine = AutotagBaseEngine.Instance;
31
+ this.contentSourceTypeID = this.engine.SetSubclassContentSourceType('Cloud Storage');
32
+ const contentSources = await this.engine.getAllContentSources(this.contextUser, this.contentSourceTypeID);
33
+ const contentItemsToProcess = await this.SetContentItemsToProcess(contentSources);
34
+ if (contentItemsToProcess.length > 0) {
35
+ await this.engine.ExtractTextAndProcessWithLLM(contentItemsToProcess, this.contextUser, undefined, undefined, onProgress);
36
+ }
37
+ else {
38
+ LogStatus('AutotagCloudStorage: no new or modified files to process');
39
+ }
40
+ return contentItemsToProcess.length;
41
+ }
42
+ async SetContentItemsToProcess(contentSources) {
43
+ const contentItemsToProcess = [];
44
+ for (const contentSource of contentSources) {
45
+ try {
46
+ const items = await this.ProcessContentSource(contentSource);
47
+ contentItemsToProcess.push(...items);
48
+ }
49
+ catch (e) {
50
+ const msg = e instanceof Error ? e.message : String(e);
51
+ LogError(`AutotagCloudStorage: failed to process source "${contentSource.Name}": ${msg}`);
52
+ }
53
+ }
54
+ return contentItemsToProcess;
55
+ }
56
+ /**
57
+ * Process a single content source: initialize the storage driver, list files,
58
+ * detect new/modified files, download and extract text, create ContentItems.
59
+ */
60
+ async ProcessContentSource(contentSource) {
61
+ const config = this.ParseSourceConfig(contentSource);
62
+ if (!config)
63
+ return [];
64
+ const driver = this.CreateStorageDriver(config.FileStorageProviderKey);
65
+ if (!driver)
66
+ return [];
67
+ const lastRunDate = await this.engine.getContentSourceLastRunDate(contentSource.ID, this.contextUser);
68
+ const prefix = config.PathPrefix ?? '';
69
+ const objects = await this.ListModifiedObjects(driver, prefix, lastRunDate, config.IncludeExtensions);
70
+ if (objects.length === 0) {
71
+ LogStatus(`AutotagCloudStorage: no modified files in source "${contentSource.Name}" since ${lastRunDate.toISOString()}`);
72
+ return [];
73
+ }
74
+ LogStatus(`AutotagCloudStorage: found ${objects.length} new/modified files in source "${contentSource.Name}"`);
75
+ // Load existing content items for this source to enable upsert by URL
76
+ const existingItems = await this.LoadExistingContentItems(contentSource.ID);
77
+ const contentSourceParams = {
78
+ contentSourceID: contentSource.ID,
79
+ name: contentSource.Name ?? '',
80
+ ContentTypeID: contentSource.ContentTypeID,
81
+ ContentSourceTypeID: contentSource.ContentSourceTypeID,
82
+ ContentFileTypeID: contentSource.ContentFileTypeID,
83
+ URL: contentSource.URL
84
+ };
85
+ const items = [];
86
+ for (const obj of objects) {
87
+ try {
88
+ const item = await this.ProcessSingleFile(driver, obj, contentSourceParams, existingItems);
89
+ if (item)
90
+ items.push(item);
91
+ }
92
+ catch (e) {
93
+ const msg = e instanceof Error ? e.message : String(e);
94
+ LogError(`AutotagCloudStorage: failed to process file "${obj.fullPath}": ${msg}`);
95
+ }
96
+ }
97
+ return items;
98
+ }
99
+ /**
100
+ * Parse the ContentSource.Configuration JSON to extract cloud storage config.
101
+ */
102
+ ParseSourceConfig(contentSource) {
103
+ const configObj = contentSource.ConfigurationObject;
104
+ if (!configObj) {
105
+ // Fall back: try to infer from URL or legacy setup
106
+ LogError(`AutotagCloudStorage: source "${contentSource.Name}" has no Configuration JSON. Set FileStorageProviderKey in the Configuration field.`);
107
+ return null;
108
+ }
109
+ const raw = configObj;
110
+ const providerKey = raw['FileStorageProviderKey'];
111
+ if (!providerKey) {
112
+ LogError(`AutotagCloudStorage: source "${contentSource.Name}" Configuration is missing FileStorageProviderKey`);
113
+ return null;
114
+ }
115
+ return {
116
+ FileStorageProviderKey: providerKey,
117
+ PathPrefix: raw['PathPrefix'] ?? undefined,
118
+ IncludeExtensions: raw['IncludeExtensions'] ?? undefined,
119
+ };
120
+ }
121
+ /**
122
+ * Create and return a storage driver via ClassFactory using the provider key.
123
+ */
124
+ CreateStorageDriver(providerKey) {
125
+ const driver = MJGlobal.Instance.ClassFactory.CreateInstance(FileStorageBase, providerKey);
126
+ if (!driver) {
127
+ LogError(`AutotagCloudStorage: no storage driver registered for key "${providerKey}". Ensure the driver is loaded (e.g., import '@memberjunction/storage').`);
128
+ return null;
129
+ }
130
+ if (!driver.IsConfigured) {
131
+ LogError(`AutotagCloudStorage: storage driver "${providerKey}" is not configured. Check environment variables or mj.config.cjs storage settings.`);
132
+ return null;
133
+ }
134
+ return driver;
135
+ }
136
+ /**
137
+ * List all objects in the storage driver that were modified after lastRunDate.
138
+ * Optionally filter by file extension.
139
+ */
140
+ async ListModifiedObjects(driver, prefix, lastRunDate, includeExtensions) {
141
+ const result = await driver.ListObjects(prefix);
142
+ const extSet = includeExtensions?.length
143
+ ? new Set(includeExtensions.map(ext => ext.toLowerCase()))
144
+ : null;
145
+ return result.objects.filter(obj => {
146
+ if (obj.isDirectory)
147
+ return false;
148
+ if (obj.lastModified <= lastRunDate)
149
+ return false;
150
+ if (extSet) {
151
+ const ext = this.GetFileExtension(obj.name);
152
+ if (!extSet.has(ext))
153
+ return false;
154
+ }
155
+ return true;
156
+ });
157
+ }
158
+ /**
159
+ * Download a file, extract text, and create/update a ContentItem.
160
+ */
161
+ async ProcessSingleFile(driver, obj, contentSourceParams, existingItems) {
162
+ // Download the file content
163
+ const buffer = await driver.GetObject({ fullPath: obj.fullPath });
164
+ // Extract text using the engine's built-in parsers (PDF, DOCX, etc.)
165
+ const text = await this.ExtractTextFromBuffer(buffer, obj.name);
166
+ if (!text || text.trim().length === 0) {
167
+ LogStatus(`AutotagCloudStorage: no extractable text from "${obj.fullPath}", skipping`);
168
+ return null;
169
+ }
170
+ const checksum = await this.engine.getChecksumFromText(text);
171
+ const urlKey = obj.fullPath.toLowerCase();
172
+ // Check for existing content item by URL
173
+ const existing = existingItems.get(urlKey);
174
+ if (existing && existing.Checksum === checksum) {
175
+ return null; // Content unchanged
176
+ }
177
+ const md = new Metadata();
178
+ let contentItem;
179
+ if (existing) {
180
+ contentItem = existing;
181
+ }
182
+ else {
183
+ contentItem = await md.GetEntityObject('MJ: Content Items', this.contextUser);
184
+ contentItem.NewRecord();
185
+ contentItem.ContentSourceID = contentSourceParams.contentSourceID;
186
+ contentItem.ContentTypeID = contentSourceParams.ContentTypeID;
187
+ contentItem.ContentSourceTypeID = contentSourceParams.ContentSourceTypeID;
188
+ contentItem.ContentFileTypeID = contentSourceParams.ContentFileTypeID;
189
+ }
190
+ contentItem.Name = obj.name;
191
+ contentItem.Description = this.engine.GetContentItemDescription(contentSourceParams);
192
+ contentItem.URL = obj.fullPath;
193
+ contentItem.Text = text;
194
+ contentItem.Checksum = checksum;
195
+ const saved = await contentItem.Save();
196
+ if (!saved) {
197
+ throw new Error(`Failed to save ContentItem for "${obj.fullPath}"`);
198
+ }
199
+ existingItems.set(urlKey, contentItem);
200
+ return contentItem;
201
+ }
202
+ /**
203
+ * Load existing ContentItems for a source, keyed by lowercase URL for upsert lookups.
204
+ */
205
+ async LoadExistingContentItems(contentSourceID) {
206
+ const rv = new RunView();
207
+ const result = await rv.RunView({
208
+ EntityName: 'MJ: Content Items',
209
+ ExtraFilter: `ContentSourceID='${contentSourceID}'`,
210
+ ResultType: 'entity_object'
211
+ }, this.contextUser);
212
+ const map = new Map();
213
+ if (result.Success) {
214
+ for (const ci of result.Results) {
215
+ if (ci.URL) {
216
+ map.set(ci.URL.toLowerCase(), ci);
217
+ }
218
+ }
219
+ }
220
+ return map;
221
+ }
222
+ /**
223
+ * Extract text from a file buffer based on file extension.
224
+ * Delegates to the engine's built-in parsers for PDF and Office documents.
225
+ */
226
+ async ExtractTextFromBuffer(buffer, fileName) {
227
+ const ext = this.GetFileExtension(fileName);
228
+ if (ext === '.pdf' || ext === '.docx' || ext === '.doc' || ext === '.pptx' || ext === '.xlsx') {
229
+ return this.engine.parsePDF(buffer);
230
+ }
231
+ if (ext === '.txt' || ext === '.md' || ext === '.csv' || ext === '.json' || ext === '.xml' || ext === '.html') {
232
+ return buffer.toString('utf-8');
233
+ }
234
+ // Attempt parsePDF as fallback for unknown formats (officeparser handles many formats)
235
+ try {
236
+ return await this.engine.parsePDF(buffer);
237
+ }
238
+ catch {
239
+ LogStatus(`AutotagCloudStorage: unsupported file format "${ext}" for "${fileName}"`);
240
+ return '';
241
+ }
242
+ }
243
+ /**
244
+ * Get the lowercase file extension including the dot (e.g., '.pdf').
245
+ */
246
+ GetFileExtension(fileName) {
247
+ const lastDot = fileName.lastIndexOf('.');
248
+ if (lastDot < 0)
249
+ return '';
250
+ return fileName.substring(lastDot).toLowerCase();
251
+ }
252
+ };
253
+ AutotagCloudStorage = __decorate([
254
+ RegisterClass(AutotagBase, 'AutotagCloudStorage')
255
+ ], AutotagCloudStorage);
256
+ export { AutotagCloudStorage };
257
+ //# sourceMappingURL=AutotagCloudStorage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutotagCloudStorage.js","sourceRoot":"","sources":["../../../src/CloudStorage/providers/AutotagCloudStorage.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,aAAa,EA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,IAAI,GAAG,KAAK,OAAO,EAAE,CAAC;YAC5G,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACpC,CAAC;QAED,uFAAuF;QACvF,IAAI,CAAC;YACD,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC9C,CAAC;QAAC,MAAM,CAAC;YACL,SAAS,CAAC,iDAAiD,GAAG,UAAU,QAAQ,GAAG,CAAC,CAAC;YACrF,OAAO,EAAE,CAAC;QACd,CAAC;IACL,CAAC;IAED;;OAEG;IACK,gBAAgB,CAAC,QAAgB;QACrC,MAAM,OAAO,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAC1C,IAAI,OAAO,GAAG,CAAC;YAAE,OAAO,EAAE,CAAC;QAC3B,OAAO,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;IACrD,CAAC;CACJ,CAAA;AA3QY,mBAAmB;IAD/B,aAAa,CAAC,WAAW,EAAE,qBAAqB,CAAC;GACrC,mBAAmB,CA2Q/B"}
@@ -4,6 +4,15 @@ import { MJContentSourceEntity, MJContentItemEntity } from '@memberjunction/core
4
4
  export type AutotagProgressCallback = (processed: number, total: number, currentItem?: string) => void;
5
5
  export declare abstract class AutotagBase {
6
6
  abstract SetContentItemsToProcess(contentSources: MJContentSourceEntity[]): Promise<MJContentItemEntity[]>;
7
- abstract Autotag(contextUser: UserInfo, onProgress?: AutotagProgressCallback): Promise<void>;
7
+ /**
8
+ * Run autotagging for this source type.
9
+ * @param contextUser - The user context for server-side operations
10
+ * @param onProgress - Optional progress callback
11
+ * @param contentSourceIDs - Optional filter: only process these specific source IDs. If omitted, processes all sources for this type.
12
+ */
13
+ /**
14
+ * @returns the number of content items processed (new + retried)
15
+ */
16
+ abstract Autotag(contextUser: UserInfo, onProgress?: AutotagProgressCallback, contentSourceIDs?: string[]): Promise<number>;
8
17
  }
9
18
  //# sourceMappingURL=AutotagBase.d.ts.map
@@ -1 +1 @@
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,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAE3F,gEAAgE;AAChE,MAAM,MAAM,uBAAuB,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;AAEvG,8BAAsB,WAAW;aACb,wBAAwB,CAAC,cAAc,EAAE,qBAAqB,EAAE,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;aACjG,OAAO,CAAC,WAAW,EAAE,QAAQ,EAAE,UAAU,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;CACtG"}
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,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAE3F,gEAAgE;AAChE,MAAM,MAAM,uBAAuB,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;AAEvG,8BAAsB,WAAW;aACb,wBAAwB,CAAC,cAAc,EAAE,qBAAqB,EAAE,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IACjH;;;;;OAKG;IACH;;OAEG;aACa,OAAO,CAAC,WAAW,EAAE,QAAQ,EAAE,UAAU,CAAC,EAAE,uBAAuB,EAAE,gBAAgB,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;CACrI"}
@@ -1 +1 @@
1
- {"version":3,"file":"AutotagBase.js","sourceRoot":"","sources":["../../../src/Core/generic/AutotagBase.ts"],"names":[],"mappings":"AAMA,MAAM,OAAgB,WAAW;CAGhC"}
1
+ {"version":3,"file":"AutotagBase.js","sourceRoot":"","sources":["../../../src/Core/generic/AutotagBase.ts"],"names":[],"mappings":"AAMA,MAAM,OAAgB,WAAW;CAYhC"}