@leapdev/app-platform 0.1.0-beta.26 → 0.1.0-beta.28
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/package.json +2 -2
- package/src/index.d.ts +9 -0
- package/src/index.js +12 -1
- package/src/lib/app-platform.d.ts +16 -0
- package/src/lib/app-platform.js +59 -38
- package/src/lib/domains/leap-document-data/index.d.ts +8 -0
- package/src/lib/domains/leap-document-data/index.js +11 -0
- package/src/lib/domains/leap-document-data/leap-document-data.model.d.ts +7 -0
- package/src/lib/domains/leap-document-data/leap-document-data.model.js +11 -0
- package/src/lib/domains/leap-document-data/leap-document-data.normalizer.d.ts +19 -0
- package/src/lib/domains/leap-document-data/leap-document-data.normalizer.js +101 -0
- package/src/lib/domains/leap-document-data/leap-document-data.service.d.ts +90 -0
- package/src/lib/domains/leap-document-data/leap-document-data.service.js +156 -0
- package/src/lib/ports/adapters/excel-custom-xml-part.adapter.d.ts +15 -0
- package/src/lib/ports/adapters/excel-custom-xml-part.adapter.js +113 -0
- package/src/lib/ports/adapters/in-memory-custom-xml-part.adapter.d.ts +22 -0
- package/src/lib/ports/adapters/in-memory-custom-xml-part.adapter.js +52 -0
- package/src/lib/ports/adapters/word-custom-xml-part.adapter.d.ts +16 -0
- package/src/lib/ports/adapters/word-custom-xml-part.adapter.js +118 -0
- package/src/lib/ports/custom-xml-part.port.d.ts +44 -0
- package/src/lib/ports/custom-xml-part.port.js +2 -0
- package/src/lib/ports/index.d.ts +7 -0
- package/src/lib/ports/index.js +10 -0
- package/src/lib/services/signalr/signalr.service.d.ts +7 -0
- package/src/lib/services/signalr/signalr.service.js +77 -76
- package/src/types.d.ts +3 -2
- package/src/types.js +3 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _SignalRService_instances, _SignalRService_sessionId, _SignalRService_automationHubUrl, _SignalRService_connection, _SignalRService_createConnection;
|
|
2
|
+
var _SignalRService_instances, _SignalRService_sessionId, _SignalRService_automationHubUrl, _SignalRService_connection, _SignalRService_sendMessage, _SignalRService_sendMessageWithHandler, _SignalRService_createConnection;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.SignalRService = void 0;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
@@ -16,108 +16,109 @@ class SignalRService {
|
|
|
16
16
|
tslib_1.__classPrivateFieldSet(this, _SignalRService_sessionId, (0, uuid_1.v4)(), "f");
|
|
17
17
|
}
|
|
18
18
|
connectToSignalR() {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (tslib_1.__classPrivateFieldGet(this, _SignalRService_connection, "f")) {
|
|
23
|
-
tslib_1.__classPrivateFieldGet(this,
|
|
24
|
-
.start()
|
|
25
|
-
.then(() => {
|
|
26
|
-
resolve(tslib_1.__classPrivateFieldGet(this, _SignalRService_sessionId, "f"));
|
|
27
|
-
})
|
|
28
|
-
.catch((error) => {
|
|
29
|
-
console.log('Unable to connect to signalR', error);
|
|
30
|
-
resolve('');
|
|
31
|
-
});
|
|
19
|
+
var _a;
|
|
20
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
try {
|
|
22
|
+
if (!tslib_1.__classPrivateFieldGet(this, _SignalRService_connection, "f")) {
|
|
23
|
+
tslib_1.__classPrivateFieldGet(this, _SignalRService_instances, "m", _SignalRService_createConnection).call(this, tslib_1.__classPrivateFieldGet(this, _SignalRService_sessionId, "f"));
|
|
32
24
|
}
|
|
33
|
-
|
|
25
|
+
if (!tslib_1.__classPrivateFieldGet(this, _SignalRService_connection, "f")) {
|
|
34
26
|
console.log('Unable to connect to signalR: no connection');
|
|
35
|
-
|
|
27
|
+
return '';
|
|
36
28
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
if (tslib_1.__classPrivateFieldGet(this, _SignalRService_connection, "f").state === signalR.HubConnectionState.Disconnected) {
|
|
30
|
+
yield tslib_1.__classPrivateFieldGet(this, _SignalRService_connection, "f").start();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
console.log('Unable to connect to signalR', error);
|
|
35
|
+
}
|
|
36
|
+
return ((_a = tslib_1.__classPrivateFieldGet(this, _SignalRService_connection, "f")) === null || _a === void 0 ? void 0 : _a.state) === signalR.HubConnectionState.Connected
|
|
37
|
+
? tslib_1.__classPrivateFieldGet(this, _SignalRService_sessionId, "f")
|
|
38
|
+
: '';
|
|
39
|
+
});
|
|
42
40
|
}
|
|
43
41
|
getInitData(params) {
|
|
44
|
-
const connection = tslib_1.__classPrivateFieldGet(this, _SignalRService_connection, "f");
|
|
45
|
-
if (!connection) {
|
|
46
|
-
return Promise.resolve(null);
|
|
47
|
-
}
|
|
48
42
|
const { clientId } = params;
|
|
43
|
+
return tslib_1.__classPrivateFieldGet(this, _SignalRService_instances, "m", _SignalRService_sendMessageWithHandler).call(this, 'init_data', {
|
|
44
|
+
clientId,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
openDocument(params) {
|
|
48
|
+
const { documentId, matterId } = params;
|
|
49
|
+
return tslib_1.__classPrivateFieldGet(this, _SignalRService_instances, "m", _SignalRService_sendMessage).call(this, 'open_document', { documentId, matterId });
|
|
50
|
+
}
|
|
51
|
+
openMatter(params) {
|
|
52
|
+
const { matterId } = params;
|
|
53
|
+
return tslib_1.__classPrivateFieldGet(this, _SignalRService_instances, "m", _SignalRService_sendMessage).call(this, 'open_matter', { matterId });
|
|
54
|
+
}
|
|
55
|
+
setBookmark(params) {
|
|
56
|
+
const { matterId, tables } = params;
|
|
57
|
+
return tslib_1.__classPrivateFieldGet(this, _SignalRService_instances, "m", _SignalRService_sendMessage).call(this, 'set_bookmark', { matterId, tables });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.SignalRService = SignalRService;
|
|
61
|
+
_SignalRService_sessionId = new WeakMap(), _SignalRService_automationHubUrl = new WeakMap(), _SignalRService_connection = new WeakMap(), _SignalRService_instances = new WeakSet(), _SignalRService_sendMessage = function _SignalRService_sendMessage(action, payload) {
|
|
62
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
if (!(yield this.connectToSignalR()) || !tslib_1.__classPrivateFieldGet(this, _SignalRService_connection, "f")) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
const message = {
|
|
67
|
+
source: 'automationCore',
|
|
68
|
+
sessionId: tslib_1.__classPrivateFieldGet(this, _SignalRService_sessionId, "f"),
|
|
69
|
+
requestId: (0, uuid_1.v4)(),
|
|
70
|
+
action,
|
|
71
|
+
payload,
|
|
72
|
+
};
|
|
73
|
+
try {
|
|
74
|
+
yield tslib_1.__classPrivateFieldGet(this, _SignalRService_connection, "f").invoke('ProcessMessage', message, true);
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
catch (e) {
|
|
78
|
+
console.log('SignalR sendMessage error', e);
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}, _SignalRService_sendMessageWithHandler = function _SignalRService_sendMessageWithHandler(action, payload) {
|
|
83
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
if (!(yield this.connectToSignalR()) || !tslib_1.__classPrivateFieldGet(this, _SignalRService_connection, "f")) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
49
87
|
const requestId = (0, uuid_1.v4)();
|
|
50
|
-
const
|
|
88
|
+
const message = {
|
|
51
89
|
source: 'automationCore',
|
|
52
90
|
sessionId: tslib_1.__classPrivateFieldGet(this, _SignalRService_sessionId, "f"),
|
|
53
91
|
requestId,
|
|
54
|
-
action
|
|
55
|
-
payload
|
|
56
|
-
clientId,
|
|
57
|
-
},
|
|
92
|
+
action,
|
|
93
|
+
payload,
|
|
58
94
|
};
|
|
95
|
+
const connection = tslib_1.__classPrivateFieldGet(this, _SignalRService_connection, "f");
|
|
59
96
|
return new Promise((resolve) => {
|
|
60
97
|
const cleanup = () => {
|
|
61
98
|
clearTimeout(timeoutId);
|
|
62
|
-
connection.off('ProcessMessage',
|
|
99
|
+
connection.off('ProcessMessage', onMessage);
|
|
63
100
|
};
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
66
|
-
|
|
101
|
+
const onMessage = (response) => {
|
|
102
|
+
if (response.sessionId === tslib_1.__classPrivateFieldGet(this, _SignalRService_sessionId, "f") &&
|
|
103
|
+
response.requestId === requestId) {
|
|
67
104
|
cleanup();
|
|
68
|
-
resolve(
|
|
105
|
+
resolve(response.payload);
|
|
69
106
|
}
|
|
70
107
|
};
|
|
71
108
|
const timeoutId = setTimeout(() => {
|
|
72
109
|
cleanup();
|
|
73
|
-
console.warn(
|
|
110
|
+
console.warn(`[SignalR] ${action} timed out waiting for ProcessMessage response`);
|
|
74
111
|
resolve(null);
|
|
75
112
|
}, INIT_DATA_TIMEOUT_MS);
|
|
76
|
-
|
|
77
|
-
connection.
|
|
78
|
-
connection.invoke('ProcessMessage', payload, true)
|
|
79
|
-
.catch((e) => {
|
|
113
|
+
connection.on('ProcessMessage', onMessage);
|
|
114
|
+
connection.invoke('ProcessMessage', message, true).catch((e) => {
|
|
80
115
|
console.log('SignalR sendMessage error', e);
|
|
81
116
|
cleanup();
|
|
82
117
|
resolve(null);
|
|
83
118
|
});
|
|
84
119
|
});
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (tslib_1.__classPrivateFieldGet(this, _SignalRService_connection, "f")) {
|
|
88
|
-
const { documentId, matterId } = params;
|
|
89
|
-
const requestId = (0, uuid_1.v4)();
|
|
90
|
-
const payload = {
|
|
91
|
-
source: 'automationCore',
|
|
92
|
-
sessionId: tslib_1.__classPrivateFieldGet(this, _SignalRService_sessionId, "f"),
|
|
93
|
-
requestId,
|
|
94
|
-
action: 'open_document',
|
|
95
|
-
payload: {
|
|
96
|
-
documentId,
|
|
97
|
-
matterId,
|
|
98
|
-
},
|
|
99
|
-
};
|
|
100
|
-
return new Promise((resolve) => {
|
|
101
|
-
if (tslib_1.__classPrivateFieldGet(this, _SignalRService_connection, "f")) {
|
|
102
|
-
tslib_1.__classPrivateFieldGet(this, _SignalRService_connection, "f")
|
|
103
|
-
.invoke('ProcessMessage', payload, true)
|
|
104
|
-
.then(() => {
|
|
105
|
-
resolve(true);
|
|
106
|
-
})
|
|
107
|
-
.catch((e) => {
|
|
108
|
-
console.log('SignalR sendMessage error', e);
|
|
109
|
-
return resolve(false);
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
return new Promise((resolve) => resolve(false));
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
exports.SignalRService = SignalRService;
|
|
120
|
-
_SignalRService_sessionId = new WeakMap(), _SignalRService_automationHubUrl = new WeakMap(), _SignalRService_connection = new WeakMap(), _SignalRService_instances = new WeakSet(), _SignalRService_createConnection = function _SignalRService_createConnection(sessionId) {
|
|
120
|
+
});
|
|
121
|
+
}, _SignalRService_createConnection = function _SignalRService_createConnection(sessionId) {
|
|
121
122
|
if (tslib_1.__classPrivateFieldGet(this, _SignalRService_connection, "f")) {
|
|
122
123
|
return;
|
|
123
124
|
}
|
package/src/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { EvaluatePathsRequest, EvaluatePathsResponse } from './lib/models';
|
|
2
|
-
import {
|
|
3
|
-
export { EvaluatePathsRequest, EvaluatePathsResponse,
|
|
2
|
+
import { HostApplicationType } from './lib/models/leap.model';
|
|
3
|
+
export { EvaluatePathsRequest, EvaluatePathsResponse, HostApplicationType, };
|
|
4
|
+
export { LeapDocumentData } from './lib/domains/leap-document-data';
|
package/src/types.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.LeapDocumentData = exports.HostApplicationType = exports.EvaluatePathsResponse = exports.EvaluatePathsRequest = void 0;
|
|
4
4
|
const models_1 = require("./lib/models");
|
|
5
5
|
Object.defineProperty(exports, "EvaluatePathsRequest", { enumerable: true, get: function () { return models_1.EvaluatePathsRequest; } });
|
|
6
6
|
Object.defineProperty(exports, "EvaluatePathsResponse", { enumerable: true, get: function () { return models_1.EvaluatePathsResponse; } });
|
|
7
7
|
const leap_model_1 = require("./lib/models/leap.model");
|
|
8
|
-
Object.defineProperty(exports, "LeapDocumentData", { enumerable: true, get: function () { return leap_model_1.LeapDocumentData; } });
|
|
9
8
|
Object.defineProperty(exports, "HostApplicationType", { enumerable: true, get: function () { return leap_model_1.HostApplicationType; } });
|
|
9
|
+
var leap_document_data_1 = require("./lib/domains/leap-document-data");
|
|
10
|
+
Object.defineProperty(exports, "LeapDocumentData", { enumerable: true, get: function () { return leap_document_data_1.LeapDocumentData; } });
|