@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.
Files changed (27) hide show
  1. package/package.json +2 -2
  2. package/src/index.d.ts +9 -0
  3. package/src/index.js +12 -1
  4. package/src/lib/app-platform.d.ts +16 -0
  5. package/src/lib/app-platform.js +59 -38
  6. package/src/lib/domains/leap-document-data/index.d.ts +8 -0
  7. package/src/lib/domains/leap-document-data/index.js +11 -0
  8. package/src/lib/domains/leap-document-data/leap-document-data.model.d.ts +7 -0
  9. package/src/lib/domains/leap-document-data/leap-document-data.model.js +11 -0
  10. package/src/lib/domains/leap-document-data/leap-document-data.normalizer.d.ts +19 -0
  11. package/src/lib/domains/leap-document-data/leap-document-data.normalizer.js +101 -0
  12. package/src/lib/domains/leap-document-data/leap-document-data.service.d.ts +90 -0
  13. package/src/lib/domains/leap-document-data/leap-document-data.service.js +156 -0
  14. package/src/lib/ports/adapters/excel-custom-xml-part.adapter.d.ts +15 -0
  15. package/src/lib/ports/adapters/excel-custom-xml-part.adapter.js +113 -0
  16. package/src/lib/ports/adapters/in-memory-custom-xml-part.adapter.d.ts +22 -0
  17. package/src/lib/ports/adapters/in-memory-custom-xml-part.adapter.js +52 -0
  18. package/src/lib/ports/adapters/word-custom-xml-part.adapter.d.ts +16 -0
  19. package/src/lib/ports/adapters/word-custom-xml-part.adapter.js +118 -0
  20. package/src/lib/ports/custom-xml-part.port.d.ts +44 -0
  21. package/src/lib/ports/custom-xml-part.port.js +2 -0
  22. package/src/lib/ports/index.d.ts +7 -0
  23. package/src/lib/ports/index.js +10 -0
  24. package/src/lib/services/signalr/signalr.service.d.ts +7 -0
  25. package/src/lib/services/signalr/signalr.service.js +77 -76
  26. package/src/types.d.ts +3 -2
  27. 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
- if (!tslib_1.__classPrivateFieldGet(this, _SignalRService_connection, "f")) {
20
- tslib_1.__classPrivateFieldGet(this, _SignalRService_instances, "m", _SignalRService_createConnection).call(this, tslib_1.__classPrivateFieldGet(this, _SignalRService_sessionId, "f"));
21
- return new Promise((resolve) => {
22
- if (tslib_1.__classPrivateFieldGet(this, _SignalRService_connection, "f")) {
23
- tslib_1.__classPrivateFieldGet(this, _SignalRService_connection, "f")
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
- else {
25
+ if (!tslib_1.__classPrivateFieldGet(this, _SignalRService_connection, "f")) {
34
26
  console.log('Unable to connect to signalR: no connection');
35
- resolve('');
27
+ return '';
36
28
  }
37
- });
38
- }
39
- else {
40
- return new Promise((resolve) => resolve(tslib_1.__classPrivateFieldGet(this, _SignalRService_sessionId, "f")));
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 payload = {
88
+ const message = {
51
89
  source: 'automationCore',
52
90
  sessionId: tslib_1.__classPrivateFieldGet(this, _SignalRService_sessionId, "f"),
53
91
  requestId,
54
- action: 'init_data',
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', handler);
99
+ connection.off('ProcessMessage', onMessage);
63
100
  };
64
- const handler = (message) => {
65
- if (message.sessionId === tslib_1.__classPrivateFieldGet(this, _SignalRService_sessionId, "f") &&
66
- message.requestId === requestId) {
101
+ const onMessage = (response) => {
102
+ if (response.sessionId === tslib_1.__classPrivateFieldGet(this, _SignalRService_sessionId, "f") &&
103
+ response.requestId === requestId) {
67
104
  cleanup();
68
- resolve(message.payload);
105
+ resolve(response.payload);
69
106
  }
70
107
  };
71
108
  const timeoutId = setTimeout(() => {
72
109
  cleanup();
73
- console.warn('[SignalR] init_data timed out waiting for ProcessMessage response');
110
+ console.warn(`[SignalR] ${action} timed out waiting for ProcessMessage response`);
74
111
  resolve(null);
75
112
  }, INIT_DATA_TIMEOUT_MS);
76
- // Register before invoke so a fast response cannot be missed.
77
- connection.on('ProcessMessage', handler);
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
- openDocument(params) {
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 { LeapDocumentData, HostApplicationType } from './lib/models/leap.model';
3
- export { EvaluatePathsRequest, EvaluatePathsResponse, LeapDocumentData, HostApplicationType, };
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.HostApplicationType = exports.LeapDocumentData = exports.EvaluatePathsResponse = exports.EvaluatePathsRequest = void 0;
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; } });