@aj-shadow/z-abs-complayer-documentation-server 0.0.0-aj-beta.221

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/.gitattributes ADDED
@@ -0,0 +1,26 @@
1
+
2
+ # Set the default behavior, in case people don't have core.autocrlf set.
3
+ * text=auto
4
+
5
+ # Explicitly declare text files you want to always be normalized and converted
6
+ # to native line endings on checkout.
7
+ *.json text
8
+ *.js text
9
+ *.jsx text
10
+ *.txt text
11
+ *.md text
12
+ *.bld text
13
+ *.tsk text
14
+ *.css text
15
+ *.html text
16
+
17
+
18
+ # Declare files that will always have CRLF line endings on checkout.
19
+ #*.sln text eol=crlf
20
+
21
+ # Declare files that will always have LF line endings on checkout.
22
+ #*.txt text eol=lf
23
+
24
+ # Denote all files that are truly binary and should not be modified.
25
+ *.png binary
26
+ *.jpg binary
package/LICENSE.txt ADDED
@@ -0,0 +1,96 @@
1
+
2
+ LICENSE AGREEMENT
3
+
4
+ Effective: 1st of November 2020
5
+ This License Agreement is between Licensee and Hagnell Konsulting AB (a company incorporated in Sweden with
6
+ company registration number: 559476-0570) (“Hagnell Konsulting”) and governs the use by Licensee of ActorJs
7
+ (as defined below).
8
+ By installing the Software (as defined below), Licensee agrees to be bound by the terms of this License Agreement.
9
+
10
+ DEFENITIONS
11
+ ActorJs The test tool developed by Hagnell Konsulting, utilizing the Patent and the Software.
12
+ Derivative Works Any work, whether in source or object code, which is based on the Software and which
13
+ does not constitute a new and independent work pursuant to paragraph 2 of article 4 of
14
+ the Swedish Act (1960:729) on Copyright in Literary and Artistic Works.
15
+ Documentation The manuals and instruction materials furnished by Hagnell Konsulting in connection
16
+ with ActorJs.
17
+ Licensee The physical or legal person to which the License hereunder has been granted by
18
+ Hagnell Konsulting.
19
+ Patent The patent application for a system and method for testing of systems under test, patent
20
+ application number:19218798.7 (European Patent Office).
21
+ Software The software developed and owned by Hagnell Konsulting, identified as ActorJs.
22
+
23
+ § 1 - LICENSE
24
+ Licensee is hereby granted a limited, non-exclusive and non-transferable license to use ActorJs (including any
25
+ Derivative Works created by Licensee hereunder) (the “License”). The License is granted subject to the terms and
26
+ conditions set forth below.
27
+ The Software is licensed to Licensee on an open source basis. The License includes the right to create Derivative
28
+ Works pursuant to sub-clause 3 below.
29
+ ActorJs may be used only by Licensee himself/herself/itself, or (if, for instance, Licensee is a company), by the
30
+ employees and consultants of Licensee.
31
+ The License does not include any updates to the Software, or any support services. Notwithstanding the foregoing,
32
+ should Hagnell Konsulting furnish any updates to Licensee, such updates shall be subject to the License granted hereunder.
33
+ As regards the Documentation provided by Hagnell Konsulting, Licensee may use this Documentation for the purpose of
34
+ the License hereunder (only). Licensee shall not be entitled to distribute copies of the Documentation, or electronically
35
+ communicate the Documentation, to recipients who are not employees or consultants of Licensee.
36
+
37
+ § 2 - LICENSE RESTRICTIONS
38
+ Licensee may not:
39
+ i) Rent, lease, lend, sell, distribute, transfer or otherwise make available ActorJs (and/or a Derivative Work)
40
+ (whether for value or otherwise) to third parties without Hagnell Konsulting´s written approval. Any such approval
41
+ will be subject to the third party acknowledging in writing (vis-à-vis Hagnell Konsulting) that its use of ActorJs
42
+ (and/or the Derivative Work) shall be subject to the terms and conditions of this Agreement.
43
+
44
+ ii) Distribute copies of the Software (and/or a Derivate Work), or electronically communicate the Software
45
+ (and/or a Derivative Work), to recipients who are not employees or consultants of Licensee.
46
+
47
+ § 3 – DERITATIVE WORKS
48
+ Should Licensee, or (if applicable) any of its employees or consultants, create a Derivative Work, Licensee shall
49
+ inform Hagnell Konsulting thereof in writing (an e-mail shall be sufficient). Licensee may use the Derivative Work to the
50
+ same extent as it may use the Software hereunder, but Hagnell Konsulting shall be the sole and exclusive owner of any
51
+ and all rights in the Derivative Work, including the copyright. At the request of Hagnell Konsulting, Licensee and
52
+ Hagnell Konsulting shall formalize the rights transfer in a written contract, which shall, inter alia, confirm that all rights
53
+ in the Derivative Work have been irrevocably transferred to Hagnell Konsulting, that Hagnell Konsulting is be entitled to
54
+ exploit the Derivative Work without limitation in time or any other kind of limitation, that Hagnell Konsulting may transfer
55
+ its rights to the Derivative Work to third parties and that the rights transfer from Licensee to Hagnell Konsulting shall be
56
+ free of charge.
57
+
58
+ § 4 – IMPROVEMENTS TO THE PATENT
59
+ Any improvement to the Patent, whether patentable or not, which Licensee, or (if applicable) any of its employees or
60
+ consultants, may discover, create or develop or otherwise have at its disposal, directly or indirectly, without restraints
61
+ as to the use thereof (“Improvements”), shall be disclosed promptly to Hagnell Konsulting and Hagnell Konsulting shall
62
+ have the exclusive right of perpetual duration to use the Improvements as well as to grant the use thereof to other licensees
63
+ in the whole world without compensation to Licensee, except that Licensee shall during the life of this Agreement have
64
+ the non-exclusive right to use such Improvements including corresponding patents, if any, in accordance with the
65
+ provisions of this Agreement. If Licensee decides not to apply for a patent relating to an Improvement made by
66
+ Licensee or if Licensee no longer wishes to maintain such a patent or patent application then Hagnell Konsulting may in its
67
+ sole discretion and at its own expense apply for such a patent or maintain such a patent or patent application (as the
68
+ case may be).
69
+
70
+ § 5 - COPYRIGHT AND INTELLECTUAL PROPERTY RIGHTS
71
+ The Software, the Patent and the Documentation are protected by copyright and patent laws and international
72
+ copyright and patent treaties, as well other intellectual property laws and treaties. Any such intellectual property
73
+ rights are owned and especially reserved by Hagnell Konsulting, without limitation. For the avoidance of doubt, no
74
+ ownership rights are transferred to Licensee hereunder.
75
+ “ActorJs” is a registered trademark of Hagnell Konsulting. This Agreement does not include a license to use the
76
+ trademark “ActorJs”.
77
+
78
+ § 6 - LIMITITATION ON LIABILITY
79
+ ActorJs is licensed to Licensee “as is”. Hagnell Konsulting gives no guarantees as regards the use, functionality
80
+ or performance of ActorJs and assumes no liability (whatsoever) as regards any defaults in ActorJs or any possible
81
+ infringements on third party statutory or contractual rights. Hagnell Konsulting expressly disclaims any and all warranties
82
+ not expressly given in this Agreement, including any implied warranties of merchantability, satisfactory quality, fitness
83
+ for a particular purpose, title and non-infringement. Thus, the entire risk arising out of any use of ActorJs hereunder
84
+ remains with Licensee.
85
+ The limitation of liability hereunder shall be to the maximum extent permitted by applicable law. Under no
86
+ circumstances shall Hagnell Konsulting be liable for any cost of substitute products or services, for any indirect losses or
87
+ for any consequential damages (including any loss of profits, interruptions or loss of business information).
88
+
89
+ § 7 - MISCELLANEOUS
90
+ Licensee may not, either wholly or partly, assign or pledge its rights or obligations under this Agreement to any third
91
+ party without the prior written consent of Hagnell Konsulting.
92
+
93
+ § 8 - DISPUTES
94
+ This agreement shall be governed by Swedish law. Any dispute, controversy or claim arising out of or in connection
95
+ with this contract, or the breach, termination or invalidity thereof, shall be settled by the general courts of Sweden,
96
+ with the district court of Stockholm in the first instance.
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # README #
2
+
3
+ # ActorJs
4
+
5
+ **Library used by @actorjs/actorjs**
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "@aj-shadow/z-abs-complayer-documentation-server",
3
+ "version": "0.0.0-aj-beta.221",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "@aj-shadow/z-abs-complayer-documentation-server",
9
+ "version": "0.0.0-aj-beta.221",
10
+ "license": "SEE LICENSE IN LICENSE.txt"
11
+ }
12
+ }
13
+ }
package/package.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@aj-shadow/z-abs-complayer-documentation-server",
3
+ "version": "0.0.0-aj-beta.221",
4
+ "release-step": "delivery",
5
+ "description": "Library used by @actorjs/actorjs",
6
+ "author": "ActorJs",
7
+ "license": "SEE LICENSE IN LICENSE.txt",
8
+ "repository": "https://gitlab.com/actorjs-shadow-delivery-public/z-abs-complayer-documentation-server.git",
9
+ "dependencies": {}
10
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "layer": "Comp",
3
+ "part": "Documentation-server",
4
+ "source": {
5
+ "path": "./project/server",
6
+ "filters": ["js"]
7
+ },
8
+ "dest": "./dist/Layers/z-abs-complayer-documentation-server/server",
9
+ "replaceCondition": "(LOG_ENGINE|LOG_ERROR|LOG_DEBUG)\\(.*\\);",
10
+ "replaceHandle": "\r\n const logParametersText = match.substring(match.indexOf('(') + 1, match.lastIndexOf(')'));\r\n const logParameters = logParametersText.split(',');\r\n if('LOG_ENGINE' === parameters[0]) {\r\n return `if(Logger.isLogEngine(${logParameters[0].trim()})) {Logger.engine(${logParameters}, __filename);}`;\r\n }\r\n else if('LOG_ERROR' === parameters[0]) {\r\n return `if(Logger.isLogError(${logParameters[0].trim()})) {Logger.error(${logParameters}, __filename);}`;\r\n }\r\n else if('LOG_DEBUG' === parameters[0]) {\r\n return `if(Logger.isLogDebug(${logParameters[0].trim()})) {Logger.debug(${logParameters}, __filename);}`;\r\n }\r\n",
11
+ "dependencyNames": []
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "builds": [
3
+ {
4
+ "name": "Server:CompLayer/Documentation-server",
5
+ "type": "server",
6
+ "fileName": "Server-CompLayer-Documentation-server",
7
+ "requireName": "build-server-js",
8
+ "repo": "z-abs-complayer-documentation-server",
9
+ "repoPath": "."
10
+ }
11
+ ]
12
+ }
@@ -0,0 +1,90 @@
1
+
2
+ 'use strict';
3
+
4
+ const ActorPath = require('z-abs-corelayer-server/server/path/actor-path');
5
+ const Path = require('path');
6
+
7
+
8
+ class ActorPathDocumentation {
9
+ constructor() {
10
+ this.actorDocumentationPathLocal = ActorPath.setPath(ActorPath.getActorPath(), `${Path.sep}..${Path.sep}Documentation`);
11
+ if(ActorPath.releaseStepDelivery) {
12
+ this.actorDocumentationPathGlobal = ActorPath.setPath(ActorPath.getActorPath(), `${Path.sep}node_modules${Path.sep}${ActorPath.organization}`);
13
+ }
14
+ else if(ActorPath.releaseStepCandidate) {
15
+ this.actorDocumentationPathGlobal = ActorPath.setPath(ActorPath.getActorPath(), `${Path.sep}node_modules`);
16
+ }
17
+ else {
18
+ this.actorDocumentationPathGlobal = ActorPath.setPath(ActorPath.getActorPath(), `${Path.sep}..${Path.sep}Documentation`);
19
+ }
20
+ this.actorDocumentationGlobalBin = ActorPath.setPath(this.actorDocumentationPathGlobal, `${Path.sep}actorjs-documentation-bin`);
21
+ this.actorDocumentationGlobalText = ActorPath.setPath(this.actorDocumentationPathGlobal, `${Path.sep}actorjs-documentation-text`);
22
+
23
+ this.actorDocumentationLocalBin = ActorPath.setPath(this.actorDocumentationPathLocal, `${Path.sep}local-documentation-bin`);
24
+ this.actorDocumentationLocalText = ActorPath.setPath(this.actorDocumentationPathLocal, `${Path.sep}local-documentation-text`);
25
+ }
26
+
27
+ getDocumentationLocalBin() {
28
+ return this.actorDocumentationLocalBin;
29
+ }
30
+
31
+ getDocumentationLocalText() {
32
+ return this.actorDocumentationLocalText;
33
+ }
34
+
35
+ getDocumentationReferences(repo) {
36
+ if(!repo) {
37
+ return `${this.actorDocumentationGlobalText}${Path.sep}Documentation${Path.sep}documentation-references.json`;
38
+ }
39
+ else {
40
+ return `${this.actorDocumentationLocalText}${Path.sep}Documentation${Path.sep}documentation-references.json`;
41
+ }
42
+ }
43
+
44
+ getDocumentationGlobalFolder(documentGroup) {
45
+ return `${this.actorDocumentationGlobalText}${Path.sep}${documentGroup}`;
46
+ }
47
+
48
+ getDocumentationLocalFolder(documentGroup) {
49
+ return `${this.actorDocumentationLocalText}${Path.sep}${documentGroup}`;
50
+ }
51
+
52
+ getDocumentationNavigationFile(appName, documentGroup, repo) {
53
+ if(!repo) {
54
+ return `${this.getDocumentationGlobalFolder(documentGroup)}${Path.sep}Navigation-${documentGroup}-${appName}-global.txt`;
55
+ }
56
+ else {
57
+ return `${this.getDocumentationLocalFolder(documentGroup)}${Path.sep}Navigation-${documentGroup}-${appName}-${repo}.txt`;
58
+ }
59
+ }
60
+
61
+ getDocumentationFilePathAndFile(documentGroup, documentName, repo) {
62
+ const formattedDocumentName = Path.normalize(documentName.replace(new RegExp('[/\\\\]', 'g'), Path.sep));
63
+ const pathSplit = formattedDocumentName.split(Path.sep);
64
+ const splitteredDocumentName = pathSplit[pathSplit.length - 1];
65
+ let splitteredPath = '';
66
+ if(1 !== pathSplit.length) {
67
+ pathSplit.splice(pathSplit.length - 1, 1);
68
+ splitteredPath = pathSplit.join(Path.sep);
69
+ }
70
+ if(!repo) {
71
+ return {
72
+ path: `${this.actorDocumentationGlobalText}${Path.sep}${documentGroup}${Path.sep}${splitteredPath}`,
73
+ file: `${this.actorDocumentationGlobalText}${Path.sep}${documentGroup}${Path.sep}${splitteredPath}${Path.sep}Document-global-${splitteredDocumentName}.txt`
74
+ };
75
+ }
76
+ else {
77
+ return {
78
+ path: `${this.actorDocumentationLocalText}${Path.sep}${documentGroup}${Path.sep}${splitteredPath}`,
79
+ file: `${this.actorDocumentationLocalText}${Path.sep}${documentGroup}${Path.sep}${splitteredPath}${Path.sep}Document-${repo}-${splitteredDocumentName}.txt`
80
+ };
81
+ }
82
+ }
83
+
84
+ getDocumentationFile(documentGroup, documentName, repo) {
85
+ return this.getDocumentationFilePathAndFile(documentGroup, documentName, repo).file;
86
+ }
87
+ }
88
+
89
+
90
+ module.exports = new ActorPathDocumentation();
@@ -0,0 +1,102 @@
1
+
2
+ 'use strict';
3
+
4
+ const ActorPathDocumentation = require('../actor-path-documentation');
5
+ const ActorPathCreator = require('z-abs-corelayer-server/server/path/actor-path-creator');
6
+ const ActorPath = require('z-abs-corelayer-server/server/path/actor-path');
7
+ const Fs = require('fs');
8
+ const Path = require('path');
9
+
10
+
11
+ class ActorDocumentationPaths {
12
+ constructor() {
13
+ this.folderPaths = [];
14
+ this.filePaths = [];
15
+ if(ActorPath.releaseStepDevelopment) {
16
+ this.folderPaths.push(ActorPathDocumentation.getDocumentationLocalBin());
17
+ this.folderPaths.push(ActorPathDocumentation.getDocumentationLocalText());
18
+ this.folderPaths.push(ActorPathDocumentation.getDocumentationLocalFolder('Documentation'));
19
+
20
+ this.filePaths.push({
21
+ path: `${ActorPathDocumentation.getDocumentationLocalBin()}${Path.sep}.gitattributes`,
22
+ text: this._getGitAttributes()
23
+ });
24
+ this.filePaths.push({
25
+ path: `${ActorPathDocumentation.getDocumentationLocalBin()}${Path.sep}.gitignore`,
26
+ text: this._getGitIgnore()
27
+ });
28
+ this.filePaths.push({
29
+ path: `${ActorPathDocumentation.getDocumentationLocalText()}${Path.sep}.gitignore`,
30
+ text: this._getGitIgnore()
31
+ });
32
+ this.filePaths.push({
33
+ path: ActorPathDocumentation.getDocumentationReferences('repo'),
34
+ default: []
35
+ });
36
+ this.filePaths.push({
37
+ path: ActorPathDocumentation.getDocumentationNavigationFile('actorjs', 'Documentation', 'local'),
38
+ default: []
39
+ });
40
+ }
41
+ }
42
+
43
+ verifyOrCreate(done) {
44
+ new ActorPathCreator(this.folderPaths, this.filePaths).verifyOrCreate(done);
45
+ }
46
+
47
+ _getGitIgnore() {
48
+ return '';
49
+ }
50
+
51
+ _getGitAttributes() {
52
+ return `
53
+ # Set the default behavior, in case people don't have core.autocrlf set.
54
+ * text=auto
55
+
56
+ # Explicitly declare text files you want to always be normalized and converted
57
+ # to native line endings on checkout.
58
+ #*.c text
59
+ #*.h text
60
+
61
+ # Declare files that will always have CRLF line endings on checkout.
62
+ #*.sln text eol=crlf
63
+
64
+ # Declare files that will always have LF line endings on checkout.
65
+ *.txt text eol=lf
66
+
67
+ # Denote all files that are truly binary and should not be modified.
68
+ *.png binary
69
+ *.jpg binary
70
+ *.gif binary
71
+ *.bmp binary
72
+ *.tif binary
73
+ *.tiff binary
74
+ *.psd binary
75
+ *.mp4 binary
76
+ *.mkv binary
77
+ *.avi binary
78
+ *.mov binary
79
+ *.vob binary
80
+ *.mp3 binary
81
+ *.aac binary
82
+ *.wav binary
83
+ *.flac binary
84
+ *.ogg binary
85
+ *.mka binary
86
+ *.wma binary
87
+ *.pdf binary
88
+ *.doc binary
89
+ *.xla binary
90
+ *.ppt binary
91
+ *.docx binary
92
+ *.odt binary
93
+ *.zip binary
94
+ *.rar binary
95
+ *.7z binary
96
+ *.tar binary
97
+ *.iso binary
98
+ `;
99
+ }
100
+ }
101
+
102
+ module.exports = ActorDocumentationPaths;
@@ -0,0 +1,45 @@
1
+
2
+ 'use strict';
3
+
4
+ const StackHelper = require('./stack-helper');
5
+ const ActorPathDocumentation = require('../../path/actor-path-documentation');
6
+ const PluginBaseMulti = require('z-abs-corelayer-server/server/plugin-base-multi');
7
+
8
+
9
+ // TODO: synchronize access to the file
10
+ class DocumentationAdd extends PluginBaseMulti {
11
+ constructor() {
12
+ super(PluginBaseMulti.ADD);
13
+ }
14
+
15
+ onRequest(repo, documentGroup, documentName, documentData) {
16
+ const match = documentName ? documentName.match(/^\[\[stack\-[a-z-]+\]\]/) : null;
17
+ if(!match) {
18
+ this._save(ActorPathDocumentation.getDocumentationFilePathAndFile(documentGroup, documentName, repo), documentName, documentData);
19
+ }
20
+ else {
21
+ StackHelper.pathAndFile(match, (pathAndFile) => {
22
+ this._save(pathAndFile, documentName, documentData);
23
+ });
24
+ }
25
+ }
26
+
27
+ _save(pathAndFile, documentName, documentData) {
28
+ if(null !== pathAndFile) {
29
+ this.asynchMkdirResponse(pathAndFile.path, (err) => {
30
+ if(!err) {
31
+ this.asynchWriteTextFileResponse(pathAndFile.file, documentData);
32
+ }
33
+ else {
34
+ this.responsePartError(`Could not create document path '${documentName}'.`);
35
+ }
36
+ }, true);
37
+ }
38
+ else {
39
+ this.responsePartError(`GetStacksObject not registered'.`);
40
+ }
41
+ }
42
+ }
43
+
44
+
45
+ module.exports = DocumentationAdd;
@@ -0,0 +1,147 @@
1
+
2
+ 'use strict';
3
+
4
+ const StackHelper = require('./stack-helper');
5
+ const ActorPathDocumentation = require('../../path/actor-path-documentation');
6
+ const PluginBaseMulti = require('z-abs-corelayer-server/server/plugin-base-multi');
7
+ const Fs = require('fs');
8
+
9
+
10
+ class DocumentationGet extends PluginBaseMulti {
11
+ constructor() {
12
+ super(PluginBaseMulti.GET);
13
+ }
14
+
15
+ onRequest(repo, appName, documentGroup, documentName, embed) {
16
+ if(!embed) {
17
+ this._getNavigationAndDocument(repo, appName, documentGroup, documentName);
18
+ }
19
+ else {
20
+ if(Array.isArray(documentName)) {
21
+ this._getDocuments(repo, documentGroup, documentName, DocumentationGet.NEW_EMBEDED_LINK);
22
+ }
23
+ else {
24
+ this._getDocument(ActorPathDocumentation.getDocumentationFile(documentGroup, documentName, repo), DocumentationGet.NEW_EMBEDED_LINK);
25
+ }
26
+ }
27
+ }
28
+
29
+ _getDocument(document, notFoundText) {
30
+ const index1 = this.expectAsynchResponse();
31
+ const index2 = this.expectAsynchResponse();
32
+ Fs.readFile(document, 'utf8', (err, data) => {
33
+ if(err) {
34
+ this.asynchResponseSuccess(index1, notFoundText);
35
+ this.asynchResponseSuccess(index2, false);
36
+ }
37
+ else {
38
+ this.asynchResponseSuccess(index1, data);
39
+ this.asynchResponseSuccess(index2, true);
40
+ }
41
+ });
42
+ }
43
+
44
+ _getDocuments(repo, documentGroup, documentNames, notFoundText) {
45
+ let pendings = documentNames.length;
46
+ if(0 === pendings) {
47
+ process.nextTick(this.expectAsynchResponseSuccess.bind(this));
48
+ return;
49
+ }
50
+ const index1 = this.expectAsynchResponse();
51
+ const index2 = this.expectAsynchResponse();
52
+ const index3 = this.expectAsynchResponse();
53
+ const receivedDcuments = [];
54
+ const documentNamesFound = [];
55
+ const documentsFound = [];
56
+ documentNames.forEach((documentName) => {
57
+ const currentDocumentName = documentName;
58
+ Fs.readFile(ActorPathDocumentation.getDocumentationFile(documentGroup, documentName, repo), 'utf8', (err, data) => {
59
+ documentNamesFound.push(currentDocumentName);
60
+ if(err) {
61
+ receivedDcuments.push(notFoundText);
62
+ documentsFound.push(false);
63
+ }
64
+ else {
65
+ receivedDcuments.push(data);
66
+ documentsFound.push(true);
67
+ }
68
+ if(0 === --pendings) {
69
+ this.asynchResponseSuccess(index1, receivedDcuments);
70
+ this.asynchResponseSuccess(index2, documentNamesFound);
71
+ this.asynchResponseSuccess(index3, documentsFound);
72
+ }
73
+ });
74
+ });
75
+ }
76
+
77
+ _getNavigationAndDocument(repo, appName, documentGroup, documentName) {
78
+ const index1 = this.expectAsynchResponse();
79
+ const match = documentName ? documentName.match(/^\[\[stack\-[a-z-]+\]\]/) : null;
80
+ Fs.readFile(ActorPathDocumentation.getDocumentationNavigationFile(appName, documentGroup, repo), (err, data) => {
81
+ if(err) {
82
+ this.asynchResponseError(`Could not get DocumentationNavigationGlobalFile. '${ActorPathDocumentation.getDocumentationNavigationFile(appName, documentGroup, repo)}'`, index1);
83
+ }
84
+ else {
85
+ const navigations = JSON.parse(data);
86
+ navigations.findIndex((navigation) => {
87
+ const refIndex = navigation.refs.findIndex((ref) => {
88
+ return ref.name === '[[stack]]';
89
+ });
90
+ if(-1 !== refIndex) {
91
+ this._getStackNavigation(navigation, () => {
92
+ if(documentName && match) {
93
+ StackHelper.file(match, (file) => {
94
+ if(null !== file) {
95
+ this._getDocument(file, DocumentationGet.NEW_STACK);
96
+ }
97
+ else {
98
+ this.asynchResponseError(`GetStacksObject not registered'.`, index1);
99
+ }
100
+ });
101
+ }
102
+ });
103
+ return true;
104
+ }
105
+ else {
106
+ return false;
107
+ }
108
+ });
109
+ if(!documentName) {
110
+ if(0 !== navigations.length && navigations[0].refs.length) {
111
+ this._getDocument(ActorPathDocumentation.getDocumentationFile(documentGroup, navigations[0].refs[0].link, repo), DocumentationGet.NEW_DOCUMENT);
112
+ }
113
+ else {
114
+ this.expectAsynchResponseSuccess(DocumentationGet.NEW_DOCUMENT);
115
+ this.expectAsynchResponseSuccess(false);
116
+ }
117
+ }
118
+ this.asynchResponseSuccess(index1, navigations);
119
+ }
120
+ });
121
+ if(documentName && !match) {
122
+ this._getDocument(ActorPathDocumentation.getDocumentationFile(documentGroup, documentName, repo), DocumentationGet.NEW_DOCUMENT);
123
+ }
124
+ }
125
+
126
+ _getStackNavigation(navigation, done) {
127
+ this.expectAsynchResponseTemp();
128
+ navigation.refs = [];
129
+ StackHelper.getStacks((stacks) => {
130
+ stacks.forEach((value, key) => {
131
+ navigation.refs.push({
132
+ name: key,
133
+ link: `[[stack-${key}]]`
134
+ });
135
+ });
136
+ done();
137
+ this.unExpectAsynchResponseTemp();
138
+ });
139
+ }
140
+ }
141
+
142
+ DocumentationGet.NEW_DOCUMENT = '# **NEW DOCUMENT**\n## Please Edit: ***`TO BE DONE !!!`***\r\n';
143
+ DocumentationGet.NEW_EMBEDED_LINK = '## **EMBEDED LINK NOT CREATED YET.**\r\n';
144
+ DocumentationGet.NEW_STACK = '## **STACK DOCUMENTATION NOT CREATED YET**\n## Please Edit: ***`TO BE DONE !!!`***\r\n';
145
+
146
+
147
+ module.exports = DocumentationGet;
@@ -0,0 +1,27 @@
1
+
2
+ 'use strict';
3
+
4
+ const ActorPathData = require('z-abs-corelayer-server/server/path/actor-path-data');
5
+ const PluginBaseMulti = require('z-abs-corelayer-server/server/plugin-base-multi');
6
+
7
+
8
+ class DocumentationLocalNoteAdd extends PluginBaseMulti {
9
+ constructor() {
10
+ super(PluginBaseMulti.ADD);
11
+ }
12
+
13
+ onRequest(guid, path, document) {
14
+ let pathAndFile = ActorPathData.getDocumentationNoteLocalFileAndPath(guid, path);
15
+ this.asynchMkdirResponse(pathAndFile.path, (err) => {
16
+ if(!err) {
17
+ this.asynchWriteTextFileResponse(pathAndFile.file, document);
18
+ }
19
+ else {
20
+ this.responsePartError(`Could not create document path '${pathAndFile.file}'.`);
21
+ }
22
+ }, true);
23
+ }
24
+ }
25
+
26
+
27
+ module.exports = DocumentationLocalNoteAdd;
@@ -0,0 +1,19 @@
1
+
2
+ 'use strict';
3
+
4
+ const ActorPathData = require('z-abs-corelayer-server/server/path/actor-path-data');
5
+ const PluginBaseMulti = require('z-abs-corelayer-server/server/plugin-base-multi');
6
+
7
+
8
+ class DocumentationLocalNoteDelete extends PluginBaseMulti {
9
+ constructor() {
10
+ super(PluginBaseMulti.DELETE);
11
+ }
12
+
13
+ onRequest(guid, path) {
14
+ this.asynchRmFileResponse(ActorPathData.getDocumentationNoteLocalFile(guid, path));
15
+ }
16
+ }
17
+
18
+
19
+ module.exports = DocumentationLocalNoteDelete;
@@ -0,0 +1,67 @@
1
+
2
+ 'use strict';
3
+
4
+ const ActorPathData = require('z-abs-corelayer-server/server/path/actor-path-data');
5
+ const PluginBaseMulti = require('z-abs-corelayer-server/server/plugin-base-multi');
6
+
7
+
8
+ class DocumentationLocalNoteGet extends PluginBaseMulti {
9
+ constructor() {
10
+ super(PluginBaseMulti.GET);
11
+ }
12
+
13
+ onRequest(guids, path) {
14
+ if(!Array.isArray(guids)) {
15
+ this.asynchReadTextFile(ActorPathData.getDocumentationNoteLocalFile(guids, path), (err, data) => {
16
+ if(!err) {
17
+ this.expectAsynchResponseSuccess({
18
+ document: data,
19
+ created: true,
20
+ guid: guids
21
+ });
22
+ }
23
+ else {
24
+ this.expectAsynchResponseSuccess({
25
+ document: DocumentationLocalNoteGet.NEW_NOTE,
26
+ created: false,
27
+ guid: guids
28
+ });
29
+ }
30
+ });
31
+ }
32
+ else {
33
+ let pendings = guids.length;
34
+ if(0 === pendings) {
35
+ process.nextTick(this.expectAsynchResponseSuccess.bind(this));
36
+ return;
37
+ }
38
+ const documents = [];
39
+ guids.forEach((guid) => {
40
+ this.asynchReadTextFile(ActorPathData.getDocumentationNoteLocalFile(guid, path), (err, data) => {
41
+ if(!err) {
42
+ documents.push({
43
+ document: data,
44
+ created: true,
45
+ guid: guid
46
+ });
47
+ }
48
+ else {
49
+ documents.push({
50
+ document: DocumentationLocalNoteGet.NEW_NOTE,
51
+ created: false,
52
+ guid: guid
53
+ });
54
+ }
55
+ if(0 === --pendings) {
56
+ this.expectAsynchResponseSuccess(documents);
57
+ }
58
+ });
59
+ });
60
+ }
61
+ }
62
+ }
63
+
64
+ DocumentationLocalNoteGet.NEW_NOTE = '# NEW LOCAL NOTE\n## Please Edit: ***`TO BE DONE !!!`***\r\n';
65
+
66
+
67
+ module.exports = DocumentationLocalNoteGet;
@@ -0,0 +1,19 @@
1
+
2
+ 'use strict';
3
+
4
+ const ActorPathData = require('z-abs-corelayer-server/server/path/actor-path-data');
5
+ const PluginBaseMulti = require('z-abs-corelayer-server/server/plugin-base-multi');
6
+
7
+
8
+ class DocumentationLocalNoteUpdate extends PluginBaseMulti {
9
+ constructor() {
10
+ super(PluginBaseMulti.UPDATE);
11
+ }
12
+
13
+ onRequest(guid, path, document) {
14
+ this.asynchWriteTextFileResponse(ActorPathData.getDocumentationNoteLocalFile(guid, path), document);
15
+ }
16
+ }
17
+
18
+
19
+ module.exports = DocumentationLocalNoteUpdate;
@@ -0,0 +1,25 @@
1
+
2
+ 'use strict';
3
+
4
+ const ActorPathDocumentation = require('../../path/actor-path-documentation');
5
+ const PluginBaseMulti = require('z-abs-corelayer-server/server/plugin-base-multi');
6
+ const Fs = require('fs');
7
+
8
+
9
+ class DocumentationNavigationsUpdate extends PluginBaseMulti {
10
+ constructor() {
11
+ super(PluginBaseMulti.UPDATE);
12
+ }
13
+
14
+ onRequest(repo, appName, documentGroup, navigations) {
15
+ Fs.writeFile(ActorPathDocumentation.getDocumentationNavigationFile(appName, documentGroup, repo), JSON.stringify(navigations, null, 2), (err) => {
16
+ if(err) {
17
+ return this.responsePartError(`Could not update the Document Navigation File: ' ${ActorPathDocumentation.getDocumentationNavigationFile(appName, documentGroup, repo)} '.`);
18
+ }
19
+ return this.responsePartSuccess();
20
+ });
21
+ }
22
+ }
23
+
24
+
25
+ module.exports = DocumentationNavigationsUpdate;
@@ -0,0 +1,19 @@
1
+
2
+ 'use strict';
3
+
4
+ const ActorPathDocumentation = require('../../path/actor-path-documentation');
5
+ const PluginBaseMulti = require('z-abs-corelayer-server/server/plugin-base-multi');
6
+
7
+
8
+ class DocumentationReferencesGet extends PluginBaseMulti {
9
+ constructor() {
10
+ super(PluginBaseMulti.GET);
11
+ }
12
+
13
+ onRequest(repo) {
14
+ this.asynchReadFileResponse(ActorPathDocumentation.getDocumentationReferences(repo));
15
+ }
16
+ }
17
+
18
+
19
+ module.exports = DocumentationReferencesGet;
@@ -0,0 +1,33 @@
1
+
2
+ 'use strict';
3
+
4
+ const StackHelper = require('./stack-helper');
5
+ const ActorPathDocumentation = require('../../path/actor-path-documentation');
6
+ const PluginBaseMulti = require('z-abs-corelayer-server/server/plugin-base-multi');
7
+
8
+
9
+ class DocumentationUpdate extends PluginBaseMulti {
10
+ constructor() {
11
+ super(PluginBaseMulti.UPDATE);
12
+ }
13
+
14
+ onRequest(repo, documentGroup, documentName, documentData) {
15
+ const match = documentName ? documentName.match(/^\[\[stack\-[a-z-]+\]\]/) : null;
16
+ if(!match) {
17
+ this.asynchWriteTextFileResponse(ActorPathDocumentation.getDocumentationFile(documentGroup, documentName, repo), documentData);
18
+ }
19
+ else {
20
+ StackHelper.file(match, (file) => {
21
+ if(null !== file) {
22
+ this.asynchWriteTextFileResponse(file, documentData);
23
+ }
24
+ else {
25
+ this.responsePartError(`GetStacksObject not registered'.`);
26
+ }
27
+ });
28
+ }
29
+ }
30
+ }
31
+
32
+
33
+ module.exports = DocumentationUpdate;
@@ -0,0 +1,70 @@
1
+
2
+ 'use strict';
3
+
4
+ const StackComponentsFactory = require('z-abs-funclayer-stack-server/server/factory/stack-components-factory');
5
+ const ActorPathData = require('z-abs-corelayer-server/server/path/actor-path-data');
6
+ const ActorPathDist = require('z-abs-corelayer-server/server/path/actor-path-dist');
7
+ const Path = require('path');
8
+
9
+
10
+ class StackHelper {
11
+ static file(match, done) {
12
+ const key = match[0].substring('[[stack-'.length, match[0].length - 2);
13
+ const path = match.input.substring(match[0].length);
14
+ StackComponentsFactory.getStacks((stacks) => {
15
+ const distPath = stacks.get(key).path;
16
+ let basePath = '';
17
+ let index = distPath.indexOf(ActorPathDist.getActorDistStacksLocalPath());
18
+ if(-1 !== index) {
19
+ basePath = distPath.replace(ActorPathDist.getActorDistStacksLocalPath(), ActorPathData.getStacksLocalFolder());
20
+ }
21
+ else {
22
+ index = distPath.indexOf(ActorPathDist.getActorDistStacksGlobalPath());
23
+ if(-1 !== index) {
24
+ basePath = distPath.replace(ActorPathDist.getActorDistStacksGlobalPath(), ActorPathData.getStacksGlobalFolder());
25
+ }
26
+ else {
27
+ // TODO: handle error.
28
+ }
29
+ }
30
+ if(0 === path.length) {
31
+ done(`${basePath}${Path.sep}documentation${Path.sep}${key}.md`);
32
+ }
33
+ else if(1 === path.length) {
34
+ if('/' === path[0]) {
35
+ done(`${basePath}${Path.sep}documentation${Path.sep}${key}.md`);
36
+ }
37
+ else {
38
+ done(`${basePath}${Path.sep}documentation${Path.sep}${key}${path}.md`);
39
+ }
40
+ }
41
+ else {
42
+ done(`${basePath}${Path.sep}documentation${path.replace(new RegExp('[/\\\\]', 'g'), Path.sep)}.md`);
43
+ }
44
+ });
45
+ }
46
+
47
+ static pathAndFile(match, done) {
48
+ StackHelper.file(match, (file) => {
49
+ if(null !== file) {
50
+ const lastIndex = file.lastIndexOf(Path.sep);
51
+ done({
52
+ path: file.substring(0, lastIndex),
53
+ file: file
54
+ });
55
+ }
56
+ else {
57
+ done(null);
58
+ }
59
+ });
60
+ }
61
+
62
+ static getStacks(done) {
63
+ StackComponentsFactory.getStacks((stacks) => {
64
+ done(stacks);
65
+ });
66
+ }
67
+ }
68
+
69
+
70
+ module.exports = StackHelper;
@@ -0,0 +1,21 @@
1
+ 7ca0ac1e-9ec1-4426-9280-80e60319b793;;z-abs-complayer-documentation-server;project_folder;.;[actorjs,js,jsx,htm]
2
+ 807d7044-db47-4e7e-8104-f32fabbdfd4b;7ca0ac1e-9ec1-4426-9280-80e60319b793;server;static_folder;./z-abs-complayer-documentation-server;[js,jsx,htm]
3
+ b72bbd61-0c1b-4430-862a-461b451da8bc;807d7044-db47-4e7e-8104-f32fabbdfd4b;_build;static_folder;./z-abs-complayer-documentation-server/server;[bld]
4
+ 0a18d054-8d8e-4995-be27-e560565fa0ee;b72bbd61-0c1b-4430-862a-461b451da8bc;Server-CompLayer-Documentation-server.bld;file;./z-abs-complayer-documentation-server/server/_build;bld
5
+ 6cb6a90c-fee0-47e7-8fb5-61e6a23a9ffe;b72bbd61-0c1b-4430-862a-461b451da8bc;z-abs-complayer-documentation-server.prj;file;./z-abs-complayer-documentation-server/server/_build;prj
6
+ 6a27a104-b835-4c95-9c92-56ae98a312b4;807d7044-db47-4e7e-8104-f32fabbdfd4b;path;folder;./z-abs-complayer-documentation-server/server;[js,jsx,htm]
7
+ 5cb614d4-19b1-4be8-ba9f-045ac6fad1b1;6a27a104-b835-4c95-9c92-56ae98a312b4;paths;folder;./z-abs-complayer-documentation-server/server/path;[js]
8
+ ce282e58-9337-4534-8a77-3578f6e6c41f;5cb614d4-19b1-4be8-ba9f-045ac6fad1b1;actor-documentation-paths.js;file;./z-abs-complayer-documentation-server/server/path/paths;js
9
+ c330e0a1-c5d2-4fdf-bde9-30ff2348e9bc;6a27a104-b835-4c95-9c92-56ae98a312b4;actor-path-documentation.js;file;./z-abs-complayer-documentation-server/server/path;js
10
+ bfb9c213-798e-4e32-ac4c-15055cee7d5b;807d7044-db47-4e7e-8104-f32fabbdfd4b;plugin-data;folder;./z-abs-complayer-documentation-server/server;[js,jsx,htm]
11
+ c60049ec-7e59-4dce-b5b7-f99ce137d73b;bfb9c213-798e-4e32-ac4c-15055cee7d5b;documentation;folder;./z-abs-complayer-documentation-server/server/plugin-data;[js,jsx,htm]
12
+ a0ae5d49-3fb9-4413-af67-46edcedfc002;c60049ec-7e59-4dce-b5b7-f99ce137d73b;plugin_data_DocumentationAdd.js;file;./z-abs-complayer-documentation-server/server/plugin-data/documentation;js
13
+ 1d7e387a-9826-4292-9c22-424542969c7c;c60049ec-7e59-4dce-b5b7-f99ce137d73b;plugin_data_DocumentationGet.js;file;./z-abs-complayer-documentation-server/server/plugin-data/documentation;js
14
+ 9ac3d9ed-c7bd-4755-8f4a-d5b34b062dd0;c60049ec-7e59-4dce-b5b7-f99ce137d73b;plugin_data_DocumentationLocalNoteAdd.js;file;./z-abs-complayer-documentation-server/server/plugin-data/documentation;js
15
+ 79938099-ddc1-45e0-8d80-639932282cdf;c60049ec-7e59-4dce-b5b7-f99ce137d73b;plugin_data_DocumentationLocalNoteDelete.js;file;./z-abs-complayer-documentation-server/server/plugin-data/documentation;js
16
+ a5ea02cd-a145-4512-b2ff-1a169ade0808;c60049ec-7e59-4dce-b5b7-f99ce137d73b;plugin_data_DocumentationLocalNoteGet.js;file;./z-abs-complayer-documentation-server/server/plugin-data/documentation;js
17
+ 59bb477e-82f4-4182-bf9d-0d384e31be58;c60049ec-7e59-4dce-b5b7-f99ce137d73b;plugin_data_DocumentationLocalNoteUpdate.js;file;./z-abs-complayer-documentation-server/server/plugin-data/documentation;js
18
+ ac33c7ab-0df7-40f1-a9be-bdae3917609a;c60049ec-7e59-4dce-b5b7-f99ce137d73b;plugin_data_DocumentationNavigationsUpdate.js;file;./z-abs-complayer-documentation-server/server/plugin-data/documentation;js
19
+ 3dbd6477-608f-4525-89e5-3e4717f4faa6;c60049ec-7e59-4dce-b5b7-f99ce137d73b;plugin_data_DocumentationReferencesGet.js;file;./z-abs-complayer-documentation-server/server/plugin-data/documentation;js
20
+ 7a41a188-a866-4a27-80bb-31951a1bd959;c60049ec-7e59-4dce-b5b7-f99ce137d73b;plugin_data_DocumentationUpdate.js;file;./z-abs-complayer-documentation-server/server/plugin-data/documentation;js
21
+ 2654effe-be7f-47f1-b817-031acd00de00;c60049ec-7e59-4dce-b5b7-f99ce137d73b;stack-helper.js;file;./z-abs-complayer-documentation-server/server/plugin-data/documentation;js