@simplito/privmx-webendpoint 2.1.1 → 2.2.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.
Files changed (85) hide show
  1. package/Types.d.ts +407 -0
  2. package/Types.js +27 -0
  3. package/api/Api.d.ts +20 -0
  4. package/api/Api.js +48 -0
  5. package/api/BaseNative.d.ts +20 -0
  6. package/api/BaseNative.js +35 -0
  7. package/api/ConnectionNative.d.ts +24 -0
  8. package/api/ConnectionNative.js +51 -0
  9. package/api/CryptoApiNative.d.ts +25 -0
  10. package/api/CryptoApiNative.js +54 -0
  11. package/api/EventQueueNative.d.ts +20 -0
  12. package/api/EventQueueNative.js +37 -0
  13. package/api/IdGenerator.d.ts +14 -0
  14. package/api/IdGenerator.js +21 -0
  15. package/api/InboxApiNative.d.ts +38 -0
  16. package/api/InboxApiNative.js +90 -0
  17. package/api/StoreApiNative.d.ts +37 -0
  18. package/api/StoreApiNative.js +87 -0
  19. package/api/ThreadApiNative.d.ts +31 -0
  20. package/api/ThreadApiNative.js +69 -0
  21. package/assets/endpoint-wasm-module.js +20 -0
  22. package/{webAssets → assets}/endpoint-wasm-module.wasm +0 -0
  23. package/bundle/privmx-endpoint-web.js +2 -0
  24. package/bundle/privmx-endpoint-web.js.LICENSE.txt +10 -0
  25. package/bundle.d.ts +12 -0
  26. package/bundle.js +16 -0
  27. package/extra/__tests__/__mocks__/constants.d.ts +36 -0
  28. package/extra/__tests__/__mocks__/constants.js +42 -0
  29. package/extra/__tests__/__mocks__/mockContainerSubscriber.d.ts +12 -0
  30. package/extra/__tests__/__mocks__/mockContainerSubscriber.js +25 -0
  31. package/extra/__tests__/__mocks__/mockEventAPIs.d.ts +30 -0
  32. package/extra/__tests__/__mocks__/mockEventAPIs.js +70 -0
  33. package/extra/__tests__/__mocks__/mockEventQueue.d.ts +13 -0
  34. package/extra/__tests__/__mocks__/mockEventQueue.js +45 -0
  35. package/extra/__tests__/__mocks__/utils.d.ts +8 -0
  36. package/extra/__tests__/__mocks__/utils.js +21 -0
  37. package/extra/__tests__/eventsManager.test.d.ts +1 -0
  38. package/extra/__tests__/eventsManager.test.js +73 -0
  39. package/extra/__tests__/inboxEventManager.test.d.ts +1 -0
  40. package/extra/__tests__/inboxEventManager.test.js +56 -0
  41. package/extra/__tests__/storeEventManager.test.d.ts +1 -0
  42. package/extra/__tests__/storeEventManager.test.js +56 -0
  43. package/extra/__tests__/threadEventManager.test.d.ts +1 -0
  44. package/extra/__tests__/threadEventManager.test.js +60 -0
  45. package/extra/__tests__/utils.test.d.ts +1 -0
  46. package/extra/__tests__/utils.test.js +52 -0
  47. package/extra/events.d.ts +234 -0
  48. package/extra/events.js +270 -0
  49. package/extra/files.d.ts +120 -0
  50. package/extra/files.js +216 -0
  51. package/extra/generics.d.ts +19 -0
  52. package/extra/generics.js +2 -0
  53. package/extra/inbox.d.ts +38 -0
  54. package/extra/inbox.js +35 -0
  55. package/extra/index.d.ts +8 -0
  56. package/extra/index.js +23 -0
  57. package/extra/utils.d.ts +24 -0
  58. package/extra/utils.js +68 -0
  59. package/index.d.ts +14 -0
  60. package/index.js +25 -0
  61. package/package.json +45 -3
  62. package/service/BaseApi.d.ts +16 -0
  63. package/service/BaseApi.js +29 -0
  64. package/service/Connection.d.ts +45 -0
  65. package/service/Connection.js +57 -0
  66. package/service/CryptoApi.d.ts +83 -0
  67. package/service/CryptoApi.js +113 -0
  68. package/service/EndpointFactory.d.ts +89 -0
  69. package/service/EndpointFactory.js +173 -0
  70. package/service/EventQueue.d.ts +20 -0
  71. package/service/EventQueue.js +37 -0
  72. package/service/InboxApi.d.ts +183 -0
  73. package/service/InboxApi.js +262 -0
  74. package/service/StoreApi.d.ts +170 -0
  75. package/service/StoreApi.js +246 -0
  76. package/service/ThreadApi.d.ts +124 -0
  77. package/service/ThreadApi.js +186 -0
  78. package/service/index.d.ts +9 -0
  79. package/service/index.js +19 -0
  80. package/README.md +0 -13
  81. package/webAssets/LICENSE.md +0 -76
  82. package/webAssets/endpoint-wasm-module.js +0 -20
  83. package/webAssets/privmx-endpoint-web.js +0 -2
  84. /package/{webAssets → assets}/driver-web-context.js +0 -0
  85. /package/{webAssets → assets}/endpoint-wasm-module.worker.js +0 -0
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ /*!
3
+ PrivMX Web Endpoint.
4
+ Copyright © 2024 Simplito sp. z o.o.
5
+
6
+ This file is part of the PrivMX Platform (https://privmx.dev).
7
+ This software is Licensed under the PrivMX Free License.
8
+
9
+ See the License for the specific language governing permissions and
10
+ limitations under the License.
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.CryptoApiNative = void 0;
14
+ const BaseNative_1 = require("./BaseNative");
15
+ class CryptoApiNative extends BaseNative_1.BaseNative {
16
+ async newApi() {
17
+ return this.runAsync((taskId) => this.api.lib.CryptoApi_newCryptoApi(taskId));
18
+ }
19
+ async deleteApi(ptr) {
20
+ await this.runAsync((taskId) => this.api.lib.CryptoApi_deleteCryptoApi(taskId, ptr));
21
+ this.deleteApiRef();
22
+ }
23
+ async create(ptr, args) {
24
+ return this.runAsync((taskId) => this.api.lib.CryptoApi_create(taskId, ptr, args));
25
+ }
26
+ async signData(ptr, args) {
27
+ return this.runAsync((taskId) => this.api.lib.CryptoApi_signData(taskId, ptr, args));
28
+ }
29
+ async generatePrivateKey(ptr, args) {
30
+ return this.runAsync((taskId) => this.api.lib.CryptoApi_generatePrivateKey(taskId, ptr, args));
31
+ }
32
+ async derivePrivateKey(ptr, args) {
33
+ return this.runAsync((taskId) => this.api.lib.CryptoApi_derivePrivateKey(taskId, ptr, args));
34
+ }
35
+ async derivePrivateKey2(ptr, args) {
36
+ return this.runAsync((taskId) => this.api.lib.CryptoApi_derivePrivateKey2(taskId, ptr, args));
37
+ }
38
+ async derivePublicKey(ptr, args) {
39
+ return this.runAsync((taskId) => this.api.lib.CryptoApi_derivePublicKey(taskId, ptr, args));
40
+ }
41
+ async generateKeySymmetric(ptr, args) {
42
+ return this.runAsync((taskId) => this.api.lib.CryptoApi_generateKeySymmetric(taskId, ptr, args));
43
+ }
44
+ async encryptDataSymmetric(ptr, args) {
45
+ return this.runAsync((taskId) => this.api.lib.CryptoApi_encryptDataSymmetric(taskId, ptr, args));
46
+ }
47
+ async decryptDataSymmetric(ptr, args) {
48
+ return this.runAsync((taskId) => this.api.lib.CryptoApi_decryptDataSymmetric(taskId, ptr, args));
49
+ }
50
+ async convertPEMKeytoWIFKey(ptr, args) {
51
+ return this.runAsync((taskId) => this.api.lib.CryptoApi_convertPEMKeytoWIFKey(taskId, ptr, args));
52
+ }
53
+ }
54
+ exports.CryptoApiNative = CryptoApiNative;
@@ -0,0 +1,20 @@
1
+ /*!
2
+ PrivMX Web Endpoint.
3
+ Copyright © 2024 Simplito sp. z o.o.
4
+
5
+ This file is part of the PrivMX Platform (https://privmx.dev).
6
+ This software is Licensed under the PrivMX Free License.
7
+
8
+ See the License for the specific language governing permissions and
9
+ limitations under the License.
10
+ */
11
+ import { Event } from "../Types";
12
+ import { BaseNative } from "./BaseNative";
13
+ export declare class EventQueueNative extends BaseNative {
14
+ protected newApi(_connectionPtr: number): Promise<number>;
15
+ deleteApi(ptr: number): Promise<void>;
16
+ newEventQueue(): Promise<number>;
17
+ deleteEventQueue(ptr: number): Promise<void>;
18
+ waitEvent(ptr: number, args: []): Promise<Event>;
19
+ emitBreakEvent(ptr: number, args: []): Promise<void>;
20
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ /*!
3
+ PrivMX Web Endpoint.
4
+ Copyright © 2024 Simplito sp. z o.o.
5
+
6
+ This file is part of the PrivMX Platform (https://privmx.dev).
7
+ This software is Licensed under the PrivMX Free License.
8
+
9
+ See the License for the specific language governing permissions and
10
+ limitations under the License.
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.EventQueueNative = void 0;
14
+ const BaseNative_1 = require("./BaseNative");
15
+ class EventQueueNative extends BaseNative_1.BaseNative {
16
+ async newApi(_connectionPtr) {
17
+ throw new Error("Use the newEventQueue() - specialized version of method instead.");
18
+ }
19
+ async deleteApi(ptr) {
20
+ await this.runAsync((taskId) => this.api.lib.EventQueue_deleteEventQueue(taskId, ptr));
21
+ this.deleteApiRef();
22
+ }
23
+ async newEventQueue() {
24
+ return this.runAsync((taskId) => this.api.lib.EventQueue_newEventQueue(taskId));
25
+ }
26
+ async deleteEventQueue(ptr) {
27
+ await this.runAsync((taskId) => this.api.lib.EventQueue_deleteEventQueue(taskId, ptr));
28
+ this.deleteApiRef();
29
+ }
30
+ async waitEvent(ptr, args) {
31
+ return this.runAsync((taskId) => this.api.lib.EventQueue_waitEvent(taskId, ptr, args));
32
+ }
33
+ async emitBreakEvent(ptr, args) {
34
+ return this.runAsync((taskId) => this.api.lib.EventQueue_emitBreakEvent(taskId, ptr, args));
35
+ }
36
+ }
37
+ exports.EventQueueNative = EventQueueNative;
@@ -0,0 +1,14 @@
1
+ /*!
2
+ PrivMX Web Endpoint.
3
+ Copyright © 2024 Simplito sp. z o.o.
4
+
5
+ This file is part of the PrivMX Platform (https://privmx.dev).
6
+ This software is Licensed under the PrivMX Free License.
7
+
8
+ See the License for the specific language governing permissions and
9
+ limitations under the License.
10
+ */
11
+ export declare class IdGenerator {
12
+ private _id;
13
+ generateId(): number;
14
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /*!
3
+ PrivMX Web Endpoint.
4
+ Copyright © 2024 Simplito sp. z o.o.
5
+
6
+ This file is part of the PrivMX Platform (https://privmx.dev).
7
+ This software is Licensed under the PrivMX Free License.
8
+
9
+ See the License for the specific language governing permissions and
10
+ limitations under the License.
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.IdGenerator = void 0;
14
+ class IdGenerator {
15
+ _id = 0;
16
+ generateId() {
17
+ this._id++;
18
+ return this._id;
19
+ }
20
+ }
21
+ exports.IdGenerator = IdGenerator;
@@ -0,0 +1,38 @@
1
+ /*!
2
+ PrivMX Web Endpoint.
3
+ Copyright © 2024 Simplito sp. z o.o.
4
+
5
+ This file is part of the PrivMX Platform (https://privmx.dev).
6
+ This software is Licensed under the PrivMX Free License.
7
+
8
+ See the License for the specific language governing permissions and
9
+ limitations under the License.
10
+ */
11
+ import { PagingQuery, PagingList, UserWithPubKey, Inbox, InboxPublicView, InboxEntry, FilesConfig, ContainerWithoutItemPolicy } from "../Types";
12
+ import { BaseNative } from "./BaseNative";
13
+ export declare class InboxApiNative extends BaseNative {
14
+ newApi(connectionPtr: number, threadApiPtr: number, storeApiPtr: number): Promise<number>;
15
+ deleteApi(ptr: number): Promise<void>;
16
+ create(ptr: number, args: []): Promise<void>;
17
+ createInbox(ptr: number, args: [string, UserWithPubKey[], UserWithPubKey[], Uint8Array, Uint8Array, FilesConfig | undefined, ContainerWithoutItemPolicy | undefined]): Promise<string>;
18
+ updateInbox(ptr: number, args: [string, UserWithPubKey[], UserWithPubKey[], Uint8Array, Uint8Array, FilesConfig | undefined, number, boolean, boolean, ContainerWithoutItemPolicy | undefined]): Promise<void>;
19
+ getInbox(ptr: number, args: [string]): Promise<Inbox>;
20
+ listInboxes(ptr: number, args: [string, PagingQuery]): Promise<PagingList<Inbox>>;
21
+ getInboxPublicView(ptr: number, args: [string]): Promise<InboxPublicView>;
22
+ deleteInbox(ptr: number, args: [string]): Promise<void>;
23
+ prepareEntry(ptr: number, args: [string, Uint8Array, number[], string | undefined]): Promise<number>;
24
+ sendEntry(ptr: number, args: [number]): Promise<void>;
25
+ readEntry(ptr: number, args: [string]): Promise<InboxEntry>;
26
+ deleteEntry(ptr: number, args: [string]): Promise<void>;
27
+ listEntries(ptr: number, args: [string, PagingQuery]): Promise<PagingList<InboxEntry>>;
28
+ createFileHandle(ptr: number, args: [Uint8Array, Uint8Array, number]): Promise<number>;
29
+ writeToFile(ptr: number, args: [number, number, Uint8Array]): Promise<void>;
30
+ openFile(ptr: number, args: [string]): Promise<number>;
31
+ readFromFile(ptr: number, args: [number, number]): Promise<Uint8Array>;
32
+ seekInFile(ptr: number, args: [number, number]): Promise<void>;
33
+ closeFile(ptr: number, args: [number]): Promise<string>;
34
+ subscribeForInboxEvents(ptr: number, args: []): Promise<void>;
35
+ unsubscribeFromInboxEvents(ptr: number, args: []): Promise<void>;
36
+ subscribeForEntryEvents(ptr: number, args: [string]): Promise<void>;
37
+ unsubscribeFromEntryEvents(ptr: number, args: [string]): Promise<void>;
38
+ }
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ /*!
3
+ PrivMX Web Endpoint.
4
+ Copyright © 2024 Simplito sp. z o.o.
5
+
6
+ This file is part of the PrivMX Platform (https://privmx.dev).
7
+ This software is Licensed under the PrivMX Free License.
8
+
9
+ See the License for the specific language governing permissions and
10
+ limitations under the License.
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.InboxApiNative = void 0;
14
+ const BaseNative_1 = require("./BaseNative");
15
+ class InboxApiNative extends BaseNative_1.BaseNative {
16
+ async newApi(connectionPtr, threadApiPtr, storeApiPtr) {
17
+ return this.runAsync((taskId) => this.api.lib.InboxApi_newInboxApi(taskId, connectionPtr, threadApiPtr, storeApiPtr));
18
+ }
19
+ async deleteApi(ptr) {
20
+ await this.runAsync((taskId) => this.api.lib.InboxApi_deleteInboxApi(taskId, ptr));
21
+ this.deleteApiRef();
22
+ }
23
+ async create(ptr, args) {
24
+ return this.runAsync((taskId) => this.api.lib.InboxApi_create(taskId, ptr, args));
25
+ }
26
+ async createInbox(ptr, args) {
27
+ return this.runAsync((taskId) => this.api.lib.InboxApi_createInbox(taskId, ptr, args));
28
+ }
29
+ async updateInbox(ptr, args) {
30
+ return this.runAsync((taskId) => this.api.lib.InboxApi_updateInbox(taskId, ptr, args));
31
+ }
32
+ async getInbox(ptr, args) {
33
+ return this.runAsync((taskId) => this.api.lib.InboxApi_getInbox(taskId, ptr, args));
34
+ }
35
+ async listInboxes(ptr, args) {
36
+ return this.runAsync((taskId) => this.api.lib.InboxApi_listInboxes(taskId, ptr, args));
37
+ }
38
+ async getInboxPublicView(ptr, args) {
39
+ return this.runAsync((taskId) => this.api.lib.InboxApi_getInboxPublicView(taskId, ptr, args));
40
+ }
41
+ async deleteInbox(ptr, args) {
42
+ return this.runAsync((taskId) => this.api.lib.InboxApi_deleteInbox(taskId, ptr, args));
43
+ }
44
+ async prepareEntry(ptr, args) {
45
+ return this.runAsync((taskId) => this.api.lib.InboxApi_prepareEntry(taskId, ptr, args));
46
+ }
47
+ async sendEntry(ptr, args) {
48
+ return this.runAsync((taskId) => this.api.lib.InboxApi_sendEntry(taskId, ptr, args));
49
+ }
50
+ async readEntry(ptr, args) {
51
+ return this.runAsync((taskId) => this.api.lib.InboxApi_readEntry(taskId, ptr, args));
52
+ }
53
+ async deleteEntry(ptr, args) {
54
+ return this.runAsync((taskId) => this.api.lib.InboxApi_deleteEntry(taskId, ptr, args));
55
+ }
56
+ async listEntries(ptr, args) {
57
+ return this.runAsync((taskId) => this.api.lib.InboxApi_listEntries(taskId, ptr, args));
58
+ }
59
+ async createFileHandle(ptr, args) {
60
+ return this.runAsync((taskId) => this.api.lib.InboxApi_createFileHandle(taskId, ptr, args));
61
+ }
62
+ async writeToFile(ptr, args) {
63
+ return this.runAsync((taskId) => this.api.lib.InboxApi_writeToFile(taskId, ptr, args));
64
+ }
65
+ async openFile(ptr, args) {
66
+ return this.runAsync((taskId) => this.api.lib.InboxApi_openFile(taskId, ptr, args));
67
+ }
68
+ async readFromFile(ptr, args) {
69
+ return this.runAsync((taskId) => this.api.lib.InboxApi_readFromFile(taskId, ptr, args));
70
+ }
71
+ async seekInFile(ptr, args) {
72
+ return this.runAsync((taskId) => this.api.lib.InboxApi_seekInFile(taskId, ptr, args));
73
+ }
74
+ async closeFile(ptr, args) {
75
+ return this.runAsync((taskId) => this.api.lib.InboxApi_closeFile(taskId, ptr, args));
76
+ }
77
+ async subscribeForInboxEvents(ptr, args) {
78
+ return this.runAsync((taskId) => this.api.lib.InboxApi_subscribeForInboxEvents(taskId, ptr, args));
79
+ }
80
+ async unsubscribeFromInboxEvents(ptr, args) {
81
+ return this.runAsync((taskId) => this.api.lib.InboxApi_unsubscribeFromInboxEvents(taskId, ptr, args));
82
+ }
83
+ async subscribeForEntryEvents(ptr, args) {
84
+ return this.runAsync((taskId) => this.api.lib.InboxApi_subscribeForEntryEvents(taskId, ptr, args));
85
+ }
86
+ async unsubscribeFromEntryEvents(ptr, args) {
87
+ return this.runAsync((taskId) => this.api.lib.InboxApi_unsubscribeFromEntryEvents(taskId, ptr, args));
88
+ }
89
+ }
90
+ exports.InboxApiNative = InboxApiNative;
@@ -0,0 +1,37 @@
1
+ /*!
2
+ PrivMX Web Endpoint.
3
+ Copyright © 2024 Simplito sp. z o.o.
4
+
5
+ This file is part of the PrivMX Platform (https://privmx.dev).
6
+ This software is Licensed under the PrivMX Free License.
7
+
8
+ See the License for the specific language governing permissions and
9
+ limitations under the License.
10
+ */
11
+ import { PagingQuery, PagingList, UserWithPubKey, Store, File, ContainerPolicy } from "../Types";
12
+ import { BaseNative } from "./BaseNative";
13
+ export declare class StoreApiNative extends BaseNative {
14
+ newApi(connectionPtr: number): Promise<number>;
15
+ deleteApi(ptr: number): Promise<void>;
16
+ create(ptr: number, args: []): Promise<void>;
17
+ createStore(ptr: number, args: [string, UserWithPubKey[], UserWithPubKey[], Uint8Array, Uint8Array, ContainerPolicy | undefined]): Promise<string>;
18
+ updateStore(ptr: number, args: [string, UserWithPubKey[], UserWithPubKey[], Uint8Array, Uint8Array, number, boolean, boolean, ContainerPolicy | undefined]): Promise<void>;
19
+ deleteStore(ptr: number, args: [string]): Promise<void>;
20
+ getStore(ptr: number, args: [string]): Promise<Store>;
21
+ listStores(ptr: number, args: [string, PagingQuery]): Promise<PagingList<Store>>;
22
+ createFile(ptr: number, args: [string, Uint8Array, Uint8Array, number]): Promise<number>;
23
+ updateFile(ptr: number, args: [string, Uint8Array, Uint8Array, number]): Promise<number>;
24
+ updateFileMeta(ptr: number, args: [string, Uint8Array, Uint8Array]): Promise<void>;
25
+ writeToFile(ptr: number, args: [number, Uint8Array]): Promise<void>;
26
+ deleteFile(ptr: number, args: [string]): Promise<void>;
27
+ getFile(ptr: number, args: [string]): Promise<File>;
28
+ listFiles(ptr: number, args: [string, PagingQuery]): Promise<PagingList<File>>;
29
+ openFile(ptr: number, args: [string]): Promise<number>;
30
+ readFromFile(ptr: number, args: [number, number]): Promise<Uint8Array>;
31
+ seekInFile(ptr: number, args: [number, number]): Promise<void>;
32
+ closeFile(ptr: number, args: [number]): Promise<string>;
33
+ subscribeForStoreEvents(ptr: number, args: []): Promise<void>;
34
+ unsubscribeFromStoreEvents(ptr: number, args: []): Promise<void>;
35
+ subscribeForFileEvents(ptr: number, args: [string]): Promise<void>;
36
+ unsubscribeFromFileEvents(ptr: number, args: [string]): Promise<void>;
37
+ }
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ /*!
3
+ PrivMX Web Endpoint.
4
+ Copyright © 2024 Simplito sp. z o.o.
5
+
6
+ This file is part of the PrivMX Platform (https://privmx.dev).
7
+ This software is Licensed under the PrivMX Free License.
8
+
9
+ See the License for the specific language governing permissions and
10
+ limitations under the License.
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.StoreApiNative = void 0;
14
+ const BaseNative_1 = require("./BaseNative");
15
+ class StoreApiNative extends BaseNative_1.BaseNative {
16
+ async newApi(connectionPtr) {
17
+ return this.runAsync((taskId) => this.api.lib.StoreApi_newStoreApi(taskId, connectionPtr));
18
+ }
19
+ async deleteApi(ptr) {
20
+ await this.runAsync((taskId) => this.api.lib.StoreApi_deleteStoreApi(taskId, ptr));
21
+ this.deleteApiRef();
22
+ }
23
+ async create(ptr, args) {
24
+ return this.runAsync((taskId) => this.api.lib.StoreApi_create(taskId, ptr, args));
25
+ }
26
+ async createStore(ptr, args) {
27
+ return this.runAsync((taskId) => this.api.lib.StoreApi_createStore(taskId, ptr, args));
28
+ }
29
+ async updateStore(ptr, args) {
30
+ return this.runAsync((taskId) => this.api.lib.StoreApi_updateStore(taskId, ptr, args));
31
+ }
32
+ async deleteStore(ptr, args) {
33
+ return this.runAsync((taskId) => this.api.lib.StoreApi_deleteStore(taskId, ptr, args));
34
+ }
35
+ async getStore(ptr, args) {
36
+ return this.runAsync((taskId) => this.api.lib.StoreApi_getStore(taskId, ptr, args));
37
+ }
38
+ async listStores(ptr, args) {
39
+ return this.runAsync((taskId) => this.api.lib.StoreApi_listStores(taskId, ptr, args));
40
+ }
41
+ async createFile(ptr, args) {
42
+ return this.runAsync((taskId) => this.api.lib.StoreApi_createFile(taskId, ptr, args));
43
+ }
44
+ async updateFile(ptr, args) {
45
+ return this.runAsync((taskId) => this.api.lib.StoreApi_updateFile(taskId, ptr, args));
46
+ }
47
+ async updateFileMeta(ptr, args) {
48
+ return this.runAsync((taskId) => this.api.lib.StoreApi_updateFileMeta(taskId, ptr, args));
49
+ }
50
+ async writeToFile(ptr, args) {
51
+ return this.runAsync((taskId) => this.api.lib.StoreApi_writeToFile(taskId, ptr, args));
52
+ }
53
+ async deleteFile(ptr, args) {
54
+ return this.runAsync((taskId) => this.api.lib.StoreApi_deleteFile(taskId, ptr, args));
55
+ }
56
+ async getFile(ptr, args) {
57
+ return this.runAsync((taskId) => this.api.lib.StoreApi_getFile(taskId, ptr, args));
58
+ }
59
+ async listFiles(ptr, args) {
60
+ return this.runAsync((taskId) => this.api.lib.StoreApi_listFiles(taskId, ptr, args));
61
+ }
62
+ async openFile(ptr, args) {
63
+ return this.runAsync((taskId) => this.api.lib.StoreApi_openFile(taskId, ptr, args));
64
+ }
65
+ async readFromFile(ptr, args) {
66
+ return this.runAsync((taskId) => this.api.lib.StoreApi_readFromFile(taskId, ptr, args));
67
+ }
68
+ async seekInFile(ptr, args) {
69
+ return this.runAsync((taskId) => this.api.lib.StoreApi_seekInFile(taskId, ptr, args));
70
+ }
71
+ async closeFile(ptr, args) {
72
+ return this.runAsync((taskId) => this.api.lib.StoreApi_closeFile(taskId, ptr, args));
73
+ }
74
+ async subscribeForStoreEvents(ptr, args) {
75
+ return this.runAsync((taskId) => this.api.lib.StoreApi_subscribeForStoreEvents(taskId, ptr, args));
76
+ }
77
+ async unsubscribeFromStoreEvents(ptr, args) {
78
+ return this.runAsync((taskId) => this.api.lib.StoreApi_unsubscribeFromStoreEvents(taskId, ptr, args));
79
+ }
80
+ async subscribeForFileEvents(ptr, args) {
81
+ return this.runAsync((taskId) => this.api.lib.StoreApi_subscribeForFileEvents(taskId, ptr, args));
82
+ }
83
+ async unsubscribeFromFileEvents(ptr, args) {
84
+ return this.runAsync((taskId) => this.api.lib.StoreApi_unsubscribeFromFileEvents(taskId, ptr, args));
85
+ }
86
+ }
87
+ exports.StoreApiNative = StoreApiNative;
@@ -0,0 +1,31 @@
1
+ /*!
2
+ PrivMX Web Endpoint.
3
+ Copyright © 2024 Simplito sp. z o.o.
4
+
5
+ This file is part of the PrivMX Platform (https://privmx.dev).
6
+ This software is Licensed under the PrivMX Free License.
7
+
8
+ See the License for the specific language governing permissions and
9
+ limitations under the License.
10
+ */
11
+ import { PagingQuery, PagingList, UserWithPubKey, Thread, Message, ContainerPolicy } from "../Types";
12
+ import { BaseNative } from "./BaseNative";
13
+ export declare class ThreadApiNative extends BaseNative {
14
+ newApi(connectionPtr: number): Promise<number>;
15
+ deleteApi(ptr: number): Promise<void>;
16
+ create(ptr: number, args: []): Promise<void>;
17
+ createThread(ptr: number, args: [string, UserWithPubKey[], UserWithPubKey[], Uint8Array, Uint8Array, ContainerPolicy | undefined]): Promise<string>;
18
+ updateThread(ptr: number, args: [string, UserWithPubKey[], UserWithPubKey[], Uint8Array, Uint8Array, number, boolean, boolean, ContainerPolicy | undefined]): Promise<void>;
19
+ deleteThread(ptr: number, args: [string]): Promise<void>;
20
+ getThread(ptr: number, args: [string]): Promise<Thread>;
21
+ listThreads(ptr: number, args: [string, PagingQuery]): Promise<PagingList<Thread>>;
22
+ getMessage(ptr: number, args: [string]): Promise<Message>;
23
+ listMessages(ptr: number, args: [string, PagingQuery]): Promise<PagingList<Message>>;
24
+ sendMessage(ptr: number, args: [string, Uint8Array, Uint8Array, Uint8Array]): Promise<string>;
25
+ deleteMessage(ptr: number, args: [string]): Promise<void>;
26
+ updateMessage(ptr: number, args: [string, Uint8Array, Uint8Array, Uint8Array]): Promise<void>;
27
+ subscribeForThreadEvents(ptr: number, args: []): Promise<void>;
28
+ unsubscribeFromThreadEvents(ptr: number, args: []): Promise<void>;
29
+ subscribeForMessageEvents(ptr: number, args: [string]): Promise<void>;
30
+ unsubscribeFromMessageEvents(ptr: number, args: [string]): Promise<void>;
31
+ }
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ /*!
3
+ PrivMX Web Endpoint.
4
+ Copyright © 2024 Simplito sp. z o.o.
5
+
6
+ This file is part of the PrivMX Platform (https://privmx.dev).
7
+ This software is Licensed under the PrivMX Free License.
8
+
9
+ See the License for the specific language governing permissions and
10
+ limitations under the License.
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.ThreadApiNative = void 0;
14
+ const BaseNative_1 = require("./BaseNative");
15
+ class ThreadApiNative extends BaseNative_1.BaseNative {
16
+ async newApi(connectionPtr) {
17
+ return this.runAsync((taskId) => this.api.lib.ThreadApi_newThreadApi(taskId, connectionPtr));
18
+ }
19
+ async deleteApi(ptr) {
20
+ await this.runAsync((taskId) => this.api.lib.ThreadApi_deleteThreadApi(taskId, ptr));
21
+ this.deleteApiRef();
22
+ }
23
+ async create(ptr, args) {
24
+ return this.runAsync((taskId) => this.api.lib.ThreadApi_create(taskId, ptr, args));
25
+ }
26
+ async createThread(ptr, args) {
27
+ return this.runAsync((taskId) => this.api.lib.ThreadApi_createThread(taskId, ptr, args));
28
+ }
29
+ async updateThread(ptr, args) {
30
+ return this.runAsync((taskId) => this.api.lib.ThreadApi_updateThread(taskId, ptr, args));
31
+ }
32
+ async deleteThread(ptr, args) {
33
+ return this.runAsync((taskId) => this.api.lib.ThreadApi_deleteThread(taskId, ptr, args));
34
+ }
35
+ async getThread(ptr, args) {
36
+ return this.runAsync((taskId) => this.api.lib.ThreadApi_getThread(taskId, ptr, args));
37
+ }
38
+ async listThreads(ptr, args) {
39
+ return this.runAsync((taskId) => this.api.lib.ThreadApi_listThreads(taskId, ptr, args));
40
+ }
41
+ async getMessage(ptr, args) {
42
+ return this.runAsync((taskId) => this.api.lib.ThreadApi_getMessage(taskId, ptr, args));
43
+ }
44
+ async listMessages(ptr, args) {
45
+ return this.runAsync((taskId) => this.api.lib.ThreadApi_listMessages(taskId, ptr, args));
46
+ }
47
+ async sendMessage(ptr, args) {
48
+ return this.runAsync((taskId) => this.api.lib.ThreadApi_sendMessage(taskId, ptr, args));
49
+ }
50
+ async deleteMessage(ptr, args) {
51
+ return this.runAsync((taskId) => this.api.lib.ThreadApi_deleteMessage(taskId, ptr, args));
52
+ }
53
+ async updateMessage(ptr, args) {
54
+ return this.runAsync((taskId) => this.api.lib.ThreadApi_updateMessage(taskId, ptr, args));
55
+ }
56
+ async subscribeForThreadEvents(ptr, args) {
57
+ return this.runAsync((taskId) => this.api.lib.ThreadApi_subscribeForThreadEvents(taskId, ptr, args));
58
+ }
59
+ async unsubscribeFromThreadEvents(ptr, args) {
60
+ return this.runAsync((taskId) => this.api.lib.ThreadApi_unsubscribeFromThreadEvents(taskId, ptr, args));
61
+ }
62
+ async subscribeForMessageEvents(ptr, args) {
63
+ return this.runAsync((taskId) => this.api.lib.ThreadApi_subscribeForMessageEvents(taskId, ptr, args));
64
+ }
65
+ async unsubscribeFromMessageEvents(ptr, args) {
66
+ return this.runAsync((taskId) => this.api.lib.ThreadApi_unsubscribeFromMessageEvents(taskId, ptr, args));
67
+ }
68
+ }
69
+ exports.ThreadApiNative = ThreadApiNative;