@memberjunction/actions-content-autotag 5.21.0 → 5.23.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.
@@ -1,13 +1,15 @@
1
- import { VectorizeEntityAction } from "@memberjunction/core-actions";
1
+ import { BaseAction } from "@memberjunction/actions";
2
2
  import { ActionResultSimple, RunActionParams } from "@memberjunction/actions-base";
3
3
  /**
4
- *
5
4
  * Params:
6
- * * Autotag: Bit, if set to true, will autotag the content.
7
- * * Vectorize: Bit, if set to true, will vectorize the content.
8
- * * EntityNames: Comma separated list of entity names to vectorize.
9
- */
10
- export declare class AutotagAndVectorizeContentAction extends VectorizeEntityAction {
5
+ * * Autotag: Bit, if set to 1, will autotag content from all source types.
6
+ * * Vectorize: Bit, if set to 1, will embed tagged content items directly into the vector index.
7
+ */
8
+ export declare class AutotagAndVectorizeContentAction extends BaseAction {
11
9
  protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
10
+ /** Run each autotag source type, catching per-provider errors */
11
+ private runAutotagProviders;
12
+ /** Embed all content items directly into the vector index */
13
+ private runDirectVectorization;
12
14
  }
13
15
  //# sourceMappingURL=content-autotag-and-vectorize.action.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"content-autotag-and-vectorize.action.d.ts","sourceRoot":"","sources":["../../src/generic/content-autotag-and-vectorize.action.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,OAAO,EAAe,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEhG;;;;;;EAME;AACF,qBACa,gCAAiC,SAAQ,qBAAqB;cACvD,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAwC1F"}
1
+ {"version":3,"file":"content-autotag-and-vectorize.action.d.ts","sourceRoot":"","sources":["../../src/generic/content-autotag-and-vectorize.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGrD,OAAO,EAAe,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAIhG;;;;GAIG;AACH,qBACa,gCAAiC,SAAQ,UAAU;cAC5C,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAoCvF,iEAAiE;YACnD,mBAAmB;IAyBjC,6DAA6D;YAC/C,sBAAsB;CAkBvC"}
@@ -6,49 +6,86 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { BaseAction } from "@memberjunction/actions";
8
8
  import { RegisterClass } from "@memberjunction/global";
9
- import { VectorizeEntityAction } from "@memberjunction/core-actions";
10
- import { AutotagLocalFileSystem, AutotagRSSFeed, AutotagWebsite } from '@memberjunction/content-autotagging';
9
+ import { AutotagLocalFileSystem, AutotagRSSFeed, AutotagWebsite, AutotagBaseEngine } from '@memberjunction/content-autotagging';
10
+ import { LogError, LogStatus, RunView } from "@memberjunction/core";
11
11
  /**
12
- *
13
12
  * Params:
14
- * * Autotag: Bit, if set to true, will autotag the content.
15
- * * Vectorize: Bit, if set to true, will vectorize the content.
16
- * * EntityNames: Comma separated list of entity names to vectorize.
17
- */
18
- let AutotagAndVectorizeContentAction = class AutotagAndVectorizeContentAction extends VectorizeEntityAction {
13
+ * * Autotag: Bit, if set to 1, will autotag content from all source types.
14
+ * * Vectorize: Bit, if set to 1, will embed tagged content items directly into the vector index.
15
+ */
16
+ let AutotagAndVectorizeContentAction = class AutotagAndVectorizeContentAction extends BaseAction {
19
17
  async InternalRunAction(params) {
20
18
  const autotagParam = params.Params.find(p => p.Name === 'Autotag');
21
19
  const vectorizeParam = params.Params.find(p => p.Name === 'Vectorize');
22
20
  if (!autotagParam || !vectorizeParam) {
23
21
  throw new Error('Autotag and Vectorize params are required.');
24
22
  }
23
+ // Extract optional progress callback from params (injected by resolver)
24
+ const progressParam = params.Params.find(p => p.Name === '__progressCallback');
25
+ const onProgress = progressParam?.Value;
25
26
  try {
27
+ // Initialize the autotagging engine (loads cached metadata)
28
+ await AutotagBaseEngine.Instance.Config(false, params.ContextUser);
29
+ // Run autotagging and vectorization in parallel when both are enabled
30
+ const promises = [];
26
31
  if (autotagParam.Value === 1) {
27
- const FileAutotag = new AutotagLocalFileSystem();
28
- await FileAutotag.Autotag(params.ContextUser);
29
- const RSSAutotag = new AutotagRSSFeed();
30
- await RSSAutotag.Autotag(params.ContextUser);
31
- const WebsiteAutotag = new AutotagWebsite();
32
- await WebsiteAutotag.Autotag(params.ContextUser);
33
- console.log('Autotagging complete.');
32
+ promises.push(this.runAutotagProviders(params, onProgress));
34
33
  }
35
34
  if (vectorizeParam.Value === 1) {
36
- const vectorize = await super.InternalRunAction(params);
37
- console.log('Vectorization complete.');
35
+ promises.push(this.runDirectVectorization(params));
38
36
  }
39
- return {
40
- Success: true,
41
- ResultCode: "SUCCESS"
42
- };
37
+ await Promise.all(promises);
38
+ return { Success: true, ResultCode: "SUCCESS" };
43
39
  }
44
40
  catch (error) {
45
41
  return {
46
42
  Success: false,
47
- Message: error,
43
+ Message: error instanceof Error ? error.message : String(error),
48
44
  ResultCode: "FAILED"
49
45
  };
50
46
  }
51
47
  }
48
+ /** Run each autotag source type, catching per-provider errors */
49
+ async runAutotagProviders(params, onProgress) {
50
+ const providers = [
51
+ { name: 'LocalFileSystem', instance: new AutotagLocalFileSystem() },
52
+ { name: 'RSSFeed', instance: new AutotagRSSFeed() },
53
+ { name: 'Website', instance: new AutotagWebsite() },
54
+ ];
55
+ for (const provider of providers) {
56
+ try {
57
+ await provider.instance.Autotag(params.ContextUser, onProgress);
58
+ LogStatus(`Autotag provider ${provider.name} completed successfully`);
59
+ }
60
+ catch (providerError) {
61
+ // "No content sources found" is expected when a source type has no configured sources — log as info, not error
62
+ const msg = providerError instanceof Error ? providerError.message : String(providerError);
63
+ if (msg.includes('No content sources found')) {
64
+ LogStatus(`Autotag provider ${provider.name}: no sources configured, skipping`);
65
+ }
66
+ else {
67
+ LogError(`Autotag provider ${provider.name} failed: ${msg}`);
68
+ }
69
+ }
70
+ }
71
+ LogStatus('Autotagging complete.');
72
+ }
73
+ /** Embed all content items directly into the vector index */
74
+ async runDirectVectorization(params) {
75
+ const rv = new RunView();
76
+ const result = await rv.RunView({
77
+ EntityName: 'MJ: Content Items',
78
+ ResultType: 'entity_object'
79
+ }, params.ContextUser);
80
+ if (!result.Success) {
81
+ LogError('VectorizeContentItems: failed to load content items');
82
+ return;
83
+ }
84
+ const items = result.Results;
85
+ LogStatus(`VectorizeContentItems: ${items.length} content items loaded for vectorization`);
86
+ const stats = await AutotagBaseEngine.Instance.VectorizeContentItems(items, params.ContextUser);
87
+ LogStatus(`VectorizeContentItems: ${stats.vectorized} vectorized, ${stats.skipped} skipped`);
88
+ }
52
89
  };
53
90
  AutotagAndVectorizeContentAction = __decorate([
54
91
  RegisterClass(BaseAction, "__AutotagAndVectorizeContent")
@@ -1 +1 @@
1
- {"version":3,"file":"content-autotag-and-vectorize.action.js","sourceRoot":"","sources":["../../src/generic/content-autotag-and-vectorize.action.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAG7G;;;;;;EAME;AAEK,IAAM,gCAAgC,GAAtC,MAAM,gCAAiC,SAAQ,qBAAqB;IAC7D,KAAK,CAAC,iBAAiB,CAAC,MAAuB;QACrD,MAAM,YAAY,GAA4B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;QAC5F,MAAM,cAAc,GAA4B,MAAM,CAAC,MAA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gCAAgC;IAD5C,aAAa,CAAC,UAAU,EAAE,8BAA8B,CAAC;GAC7C,gCAAgC,CAkF5C"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@memberjunction/actions-content-autotag",
3
3
  "type": "module",
4
- "version": "5.21.0",
4
+ "version": "5.23.0",
5
5
  "description": "Action classes that execute the content autotagging and vectorization actions.",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -20,13 +20,13 @@
20
20
  "typescript": "^5.9.3"
21
21
  },
22
22
  "dependencies": {
23
- "@memberjunction/actions": "5.21.0",
24
- "@memberjunction/actions-base": "5.21.0",
25
- "@memberjunction/content-autotagging": "5.21.0",
26
- "@memberjunction/core": "5.21.0",
27
- "@memberjunction/core-actions": "5.21.0",
28
- "@memberjunction/core-entities": "5.21.0",
29
- "@memberjunction/global": "5.21.0",
23
+ "@memberjunction/actions": "5.23.0",
24
+ "@memberjunction/actions-base": "5.23.0",
25
+ "@memberjunction/content-autotagging": "5.23.0",
26
+ "@memberjunction/core": "5.23.0",
27
+ "@memberjunction/core-actions": "5.23.0",
28
+ "@memberjunction/core-entities": "5.23.0",
29
+ "@memberjunction/global": "5.23.0",
30
30
  "axios": "^1.13.4"
31
31
  },
32
32
  "repository": {