@memberjunction/doc-utils 1.7.1 → 1.8.1
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/Engine.d.ts +9 -5
- package/dist/Engine.d.ts.map +1 -1
- package/dist/Engine.js +43 -15
- package/dist/Engine.js.map +1 -1
- package/package.json +6 -12
package/dist/Engine.d.ts
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { BaseEngine, UserInfo } from "@memberjunction/core";
|
|
2
|
-
import { LibraryEntity } from "@memberjunction/core-entities";
|
|
2
|
+
import { LibraryEntity, LibraryItemEntity } from "@memberjunction/core-entities";
|
|
3
3
|
/**
|
|
4
4
|
* Represents a single item within a library/package that is used to provide documentation for the MemberJunction system. For example a library would be something like
|
|
5
5
|
* @memberjunction/core and an item within that library might be the BaseEntity or BaseEngine class.
|
|
6
6
|
*/
|
|
7
|
-
export declare class
|
|
8
|
-
Name: string;
|
|
7
|
+
export declare class LibraryItemEntityExtended extends LibraryItemEntity {
|
|
9
8
|
URL: string;
|
|
10
9
|
HTMLContent: string;
|
|
11
|
-
|
|
10
|
+
get TypeURLSegment(): string;
|
|
12
11
|
}
|
|
13
12
|
export declare class LibraryEntityExtended extends LibraryEntity {
|
|
14
13
|
private _items;
|
|
15
|
-
get Items():
|
|
14
|
+
get Items(): LibraryItemEntityExtended[];
|
|
16
15
|
}
|
|
17
16
|
/**
|
|
18
17
|
* Provides utility functionality for documentation of the MemberJunction system using external website content from the MemberJunction project.
|
|
@@ -20,6 +19,7 @@ export declare class LibraryEntityExtended extends LibraryEntity {
|
|
|
20
19
|
export declare class DocumentationEngine extends BaseEngine<DocumentationEngine> {
|
|
21
20
|
static get Instance(): DocumentationEngine;
|
|
22
21
|
private _Libraries;
|
|
22
|
+
private _LibraryItems;
|
|
23
23
|
/**
|
|
24
24
|
* This method is called to configure the ActionEngine. It loads the metadata for the actions, filters, and result codes and caches them in the GlobalObjectStore. You must call this method before running any actions.
|
|
25
25
|
* If this method was previously run on the instance of the ActionEngine, it will return immediately without re-loading the metadata. If you want to force a reload of the metadata, you can pass true for the forceReload parameter.
|
|
@@ -36,5 +36,9 @@ export declare class DocumentationEngine extends BaseEngine<DocumentationEngine>
|
|
|
36
36
|
* List of all the Entity Action objects that are available for use in the system. Make sure you call Config() before any other methods on this class.
|
|
37
37
|
*/
|
|
38
38
|
get Libraries(): LibraryEntityExtended[];
|
|
39
|
+
/**
|
|
40
|
+
* List of all the Entity Action objects that are available for use in the system. Make sure you call Config() before any other methods on this class.
|
|
41
|
+
*/
|
|
42
|
+
get LibraryItems(): LibraryItemEntityExtended[];
|
|
39
43
|
}
|
|
40
44
|
//# sourceMappingURL=Engine.d.ts.map
|
package/dist/Engine.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Engine.d.ts","sourceRoot":"","sources":["../src/Engine.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAsC,QAAQ,
|
|
1
|
+
{"version":3,"file":"Engine.d.ts","sourceRoot":"","sources":["../src/Engine.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAsC,QAAQ,EAAc,MAAM,sBAAsB,CAAC;AAC5G,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAIjF;;;GAGG;AACH,qBACa,yBAA0B,SAAQ,iBAAiB;IAC5D,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IAEpB,IAAW,cAAc,IAAI,MAAM,CAiBlC;CACJ;AAED,qBACa,qBAAsB,SAAQ,aAAa;IACpD,OAAO,CAAC,MAAM,CAAmC;IACjD,IAAW,KAAK,IAAI,yBAAyB,EAAE,CAE9C;CACJ;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,UAAU,CAAC,mBAAmB,CAAC;IACpE,WAAkB,QAAQ,IAAI,mBAAmB,CAEhD;IAID,OAAO,CAAC,UAAU,CAA+B;IACjD,OAAO,CAAC,aAAa,CAAmC;IAExD;;;;;OAKG;IACU,MAAM,CAAC,YAAY,GAAE,OAAe,EAAE,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAczF,OAAO,CAAC,QAAQ,CAAkD;cACzC,iBAAiB,CAAC,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;cAejE,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;cAI/D,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAchE,SAAS,CAAE,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM;IAO1E;;OAEG;IACH,IAAW,SAAS,IAAI,qBAAqB,EAAE,CAE9C;IAEA;;MAEE;IACF,IAAW,YAAY,IAAI,yBAAyB,EAAE,CAEtD;CACJ"}
|
package/dist/Engine.js
CHANGED
|
@@ -9,20 +9,40 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
9
9
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.DocumentationEngine = exports.LibraryEntityExtended = exports.
|
|
12
|
+
exports.DocumentationEngine = exports.LibraryEntityExtended = exports.LibraryItemEntityExtended = void 0;
|
|
13
13
|
const axios_1 = __importDefault(require("axios"));
|
|
14
14
|
const jsdom_1 = require("jsdom");
|
|
15
15
|
const core_1 = require("@memberjunction/core");
|
|
16
16
|
const core_entities_1 = require("@memberjunction/core-entities");
|
|
17
17
|
const global_1 = require("@memberjunction/global");
|
|
18
|
-
const typeorm_1 = require("typeorm");
|
|
19
18
|
/**
|
|
20
19
|
* Represents a single item within a library/package that is used to provide documentation for the MemberJunction system. For example a library would be something like
|
|
21
20
|
* @memberjunction/core and an item within that library might be the BaseEntity or BaseEngine class.
|
|
22
21
|
*/
|
|
23
|
-
class
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
let LibraryItemEntityExtended = class LibraryItemEntityExtended extends core_entities_1.LibraryItemEntity {
|
|
23
|
+
get TypeURLSegment() {
|
|
24
|
+
switch (this.Type) {
|
|
25
|
+
case 'Class':
|
|
26
|
+
return "classes";
|
|
27
|
+
case "Interface":
|
|
28
|
+
return "interfaces";
|
|
29
|
+
case "Function":
|
|
30
|
+
return "functions";
|
|
31
|
+
case 'Module':
|
|
32
|
+
return "modules";
|
|
33
|
+
case 'Type':
|
|
34
|
+
return "types";
|
|
35
|
+
case 'Variable':
|
|
36
|
+
return "variables";
|
|
37
|
+
default:
|
|
38
|
+
throw new Error("Unknown type " + this.Type);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
exports.LibraryItemEntityExtended = LibraryItemEntityExtended;
|
|
43
|
+
exports.LibraryItemEntityExtended = LibraryItemEntityExtended = __decorate([
|
|
44
|
+
(0, global_1.RegisterClass)(core_1.BaseEntity, "Library Items")
|
|
45
|
+
], LibraryItemEntityExtended);
|
|
26
46
|
let LibraryEntityExtended = class LibraryEntityExtended extends core_entities_1.LibraryEntity {
|
|
27
47
|
constructor() {
|
|
28
48
|
super(...arguments);
|
|
@@ -34,7 +54,7 @@ let LibraryEntityExtended = class LibraryEntityExtended extends core_entities_1.
|
|
|
34
54
|
};
|
|
35
55
|
exports.LibraryEntityExtended = LibraryEntityExtended;
|
|
36
56
|
exports.LibraryEntityExtended = LibraryEntityExtended = __decorate([
|
|
37
|
-
(0, global_1.RegisterClass)(
|
|
57
|
+
(0, global_1.RegisterClass)(core_1.BaseEntity, "Libraries")
|
|
38
58
|
], LibraryEntityExtended);
|
|
39
59
|
/**
|
|
40
60
|
* Provides utility functionality for documentation of the MemberJunction system using external website content from the MemberJunction project.
|
|
@@ -44,7 +64,8 @@ class DocumentationEngine extends core_1.BaseEngine {
|
|
|
44
64
|
super(...arguments);
|
|
45
65
|
// internal instance properties used for the singleton pattern
|
|
46
66
|
this._Libraries = [];
|
|
47
|
-
this.
|
|
67
|
+
this._LibraryItems = [];
|
|
68
|
+
this._baseURL = 'https://memberjunction.github.io/MJ/';
|
|
48
69
|
}
|
|
49
70
|
static get Instance() {
|
|
50
71
|
return super.getInstance();
|
|
@@ -61,22 +82,23 @@ class DocumentationEngine extends core_1.BaseEngine {
|
|
|
61
82
|
EntityName: 'Libraries',
|
|
62
83
|
PropertyName: '_Libraries'
|
|
63
84
|
},
|
|
85
|
+
{
|
|
86
|
+
EntityName: 'Library Items',
|
|
87
|
+
PropertyName: '_LibraryItems'
|
|
88
|
+
},
|
|
64
89
|
];
|
|
65
90
|
await this.Load(configs, forceRefresh, contextUser);
|
|
66
91
|
}
|
|
67
92
|
async AdditionalLoading(contextUser) {
|
|
68
93
|
// Load the items for each library using the comma delimited list of included items in the Library metadata
|
|
69
94
|
for (const library of this.Libraries) {
|
|
70
|
-
const items =
|
|
95
|
+
const items = this.LibraryItems.filter((item) => item.LibraryID === library.ID);
|
|
71
96
|
for (const item of items) {
|
|
72
|
-
const libraryItem = new LibraryItem();
|
|
73
97
|
// lib code name is replace all instances of @ . and / or \ in the library name with _
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
libraryItem.Library = library;
|
|
79
|
-
library.Items.push(libraryItem);
|
|
98
|
+
const URLSegment = library.Name.replace(/[@.\/\\]/g, '_');
|
|
99
|
+
item.URL = `${this._baseURL}${item.TypeURLSegment}/${URLSegment}.${item.Name}.html`;
|
|
100
|
+
item.HTMLContent = await this.GetContent(item.URL);
|
|
101
|
+
library.Items.push(item);
|
|
80
102
|
}
|
|
81
103
|
}
|
|
82
104
|
}
|
|
@@ -111,6 +133,12 @@ class DocumentationEngine extends core_1.BaseEngine {
|
|
|
111
133
|
get Libraries() {
|
|
112
134
|
return this._Libraries;
|
|
113
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* List of all the Entity Action objects that are available for use in the system. Make sure you call Config() before any other methods on this class.
|
|
138
|
+
*/
|
|
139
|
+
get LibraryItems() {
|
|
140
|
+
return this._LibraryItems;
|
|
141
|
+
}
|
|
114
142
|
}
|
|
115
143
|
exports.DocumentationEngine = DocumentationEngine;
|
|
116
144
|
//# sourceMappingURL=Engine.js.map
|
package/dist/Engine.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Engine.js","sourceRoot":"","sources":["../src/Engine.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA0B;AAC1B,iCAA8B;AAE9B,+
|
|
1
|
+
{"version":3,"file":"Engine.js","sourceRoot":"","sources":["../src/Engine.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAA0B;AAC1B,iCAA8B;AAE9B,+CAA4G;AAC5G,iEAAiF;AACjF,mDAAuD;AAGvD;;;GAGG;AAEI,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,iCAAiB;IAI5D,IAAW,cAAc;QACrB,QAAO,IAAI,CAAC,IAAI,EAAC,CAAC;YACd,KAAK,OAAO;gBACR,OAAO,SAAS,CAAA;YACpB,KAAK,WAAW;gBACZ,OAAO,YAAY,CAAC;YACxB,KAAK,UAAU;gBACX,OAAO,WAAW,CAAC;YACvB,KAAK,QAAQ;gBACT,OAAO,SAAS,CAAC;YACrB,KAAK,MAAM;gBACP,OAAO,OAAO,CAAC;YACnB,KAAK,UAAU;gBACX,OAAO,WAAW,CAAC;YACvB;gBACI,MAAM,IAAI,KAAK,CAAC,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;QACrD,CAAC;IACL,CAAC;CACJ,CAAA;AAtBY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,sBAAa,EAAC,iBAAU,EAAE,eAAe,CAAC;GAC9B,yBAAyB,CAsBrC;AAGM,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,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2B,CAAC;IAClD,CAAC;IAED;;OAEG;IACH,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAEA;;MAEE;IACF,IAAW,YAAY;QACpB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;CACJ;AApFD,kDAoFC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/doc-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "This library provides functionality for dynamically retreiving documentation from the official MemberJunction object model documentation site, parsing it, and caching elements in memory for performance. Use this whenever you need dynamic access to the MJ documentation to feed to AI models and for any other similar purpose.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,16 +19,10 @@
|
|
|
19
19
|
"typescript": "^5.4.5"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@memberjunction/
|
|
23
|
-
"@memberjunction/core": "1.
|
|
24
|
-
"@memberjunction/
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"@memberjunction/sqlserver-dataprovider": "1.7.1",
|
|
28
|
-
"env-var": "^7.4.1",
|
|
29
|
-
"fs-extra": "^11.2.0",
|
|
30
|
-
"glob": "^10.3.10",
|
|
31
|
-
"typeorm": "^0.3.20",
|
|
32
|
-
"jsdom": "^24.1.0"
|
|
22
|
+
"@memberjunction/core": "1.8.1",
|
|
23
|
+
"@memberjunction/core-entities": "1.8.1",
|
|
24
|
+
"@memberjunction/global": "1.8.1",
|
|
25
|
+
"jsdom": "^24.1.0",
|
|
26
|
+
"axios": "^1.6.7"
|
|
33
27
|
}
|
|
34
28
|
}
|