remult 0.22.7-exp.0 → 0.22.7

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 (249) hide show
  1. package/SseSubscriptionServer.d.ts +25 -25
  2. package/SseSubscriptionServer.js +145 -145
  3. package/ably.d.ts +13 -13
  4. package/ably.js +59 -59
  5. package/assign.d.ts +1 -1
  6. package/assign.js +9 -9
  7. package/classType.d.ts +3 -3
  8. package/classType.js +2 -2
  9. package/esm/SseSubscriptionServer.d.ts +25 -25
  10. package/esm/SseSubscriptionServer.js +107 -104
  11. package/esm/ably.d.ts +13 -13
  12. package/esm/ably.js +30 -28
  13. package/esm/assign.d.ts +1 -1
  14. package/esm/assign.js +5 -5
  15. package/esm/classType.d.ts +3 -3
  16. package/esm/classType.js +1 -1
  17. package/esm/graphql.d.ts +14 -14
  18. package/esm/graphql.js +785 -785
  19. package/esm/index.d.ts +31 -31
  20. package/esm/index.js +25 -25
  21. package/esm/inputTypes.d.ts +9 -9
  22. package/esm/inputTypes.js +9 -9
  23. package/esm/live-query/data-provider-live-query-storage.d.ts +23 -23
  24. package/esm/live-query/data-provider-live-query-storage.js +91 -93
  25. package/esm/myLog.d.ts +1 -1
  26. package/esm/myLog.js +5 -5
  27. package/esm/postgres/index.d.ts +2 -2
  28. package/esm/postgres/index.js +2 -2
  29. package/esm/postgres/postgres-data-provider.d.ts +36 -36
  30. package/esm/postgres/postgres-data-provider.js +126 -122
  31. package/esm/postgres/schema-builder.d.ts +19 -19
  32. package/esm/postgres/schema-builder.js +197 -196
  33. package/esm/remult-express.d.ts +9 -9
  34. package/esm/remult-express.js +26 -25
  35. package/esm/remult-fastify.d.ts +6 -6
  36. package/esm/remult-fastify.js +68 -68
  37. package/esm/remult-fresh.d.ts +17 -17
  38. package/esm/remult-fresh.js +26 -26
  39. package/esm/remult-knex/index.d.ts +30 -30
  40. package/esm/remult-knex/index.js +466 -460
  41. package/esm/remult-mongo.d.ts +24 -24
  42. package/esm/remult-mongo.js +269 -262
  43. package/esm/remult-next.d.ts +25 -25
  44. package/esm/remult-next.js +114 -114
  45. package/esm/remult-sveltekit.d.ts +4 -4
  46. package/esm/remult-sveltekit.js +71 -71
  47. package/esm/server/JsonEntityFileStorage.d.ts +11 -11
  48. package/esm/server/JsonEntityFileStorage.js +27 -26
  49. package/esm/server/core.d.ts +4 -4
  50. package/esm/server/core.js +4 -4
  51. package/esm/server/expressBridge.d.ts +128 -128
  52. package/esm/server/expressBridge.js +988 -971
  53. package/esm/server/index.d.ts +6 -6
  54. package/esm/server/index.js +12 -12
  55. package/esm/server/initAsyncHooks.d.ts +1 -1
  56. package/esm/server/initAsyncHooks.js +9 -9
  57. package/esm/server/initDataProvider.d.ts +2 -2
  58. package/esm/server/initDataProvider.js +14 -14
  59. package/esm/src/CompoundIdField.d.ts +27 -27
  60. package/esm/src/CompoundIdField.js +54 -41
  61. package/esm/src/__EntityValueProvider.d.ts +11 -11
  62. package/esm/src/__EntityValueProvider.js +1 -1
  63. package/esm/src/__RowsOfDataForTesting.d.ts +3 -3
  64. package/esm/src/__RowsOfDataForTesting.js +1 -1
  65. package/esm/src/buildRestDataProvider.d.ts +31 -31
  66. package/esm/src/buildRestDataProvider.js +121 -120
  67. package/esm/src/column-interfaces.d.ts +160 -160
  68. package/esm/src/column-interfaces.js +7 -7
  69. package/esm/src/column.d.ts +31 -31
  70. package/esm/src/column.js +108 -101
  71. package/esm/src/context.d.ts +134 -134
  72. package/esm/src/context.js +287 -282
  73. package/esm/src/data-api.d.ts +38 -38
  74. package/esm/src/data-api.js +281 -279
  75. package/esm/src/data-interfaces.d.ts +41 -41
  76. package/esm/src/data-interfaces.js +12 -12
  77. package/esm/src/data-providers/array-entity-data-provider.d.ts +22 -22
  78. package/esm/src/data-providers/array-entity-data-provider.js +252 -249
  79. package/esm/src/data-providers/in-memory-database.d.ts +9 -9
  80. package/esm/src/data-providers/in-memory-database.js +16 -18
  81. package/esm/src/data-providers/json-data-provider.d.ts +12 -12
  82. package/esm/src/data-providers/json-data-provider.js +55 -52
  83. package/esm/src/data-providers/rest-data-provider.d.ts +39 -39
  84. package/esm/src/data-providers/rest-data-provider.js +272 -267
  85. package/esm/src/data-providers/sql-database.d.ts +33 -33
  86. package/esm/src/data-providers/sql-database.js +401 -394
  87. package/esm/src/data-providers/web-sql-data-provider.d.ts +21 -21
  88. package/esm/src/data-providers/web-sql-data-provider.js +145 -137
  89. package/esm/src/entity.d.ts +95 -95
  90. package/esm/src/entity.js +1 -1
  91. package/esm/src/filter/filter-consumer-bridge-to-sql-request.d.ts +50 -50
  92. package/esm/src/filter/filter-consumer-bridge-to-sql-request.js +165 -162
  93. package/esm/src/filter/filter-interfaces.d.ts +86 -86
  94. package/esm/src/filter/filter-interfaces.js +524 -515
  95. package/esm/src/live-query/LiveQueryClient.d.ts +1 -1
  96. package/esm/src/live-query/LiveQueryClient.js +196 -192
  97. package/esm/src/live-query/SseSubscriptionClient.d.ts +5 -5
  98. package/esm/src/live-query/SseSubscriptionClient.js +86 -86
  99. package/esm/src/live-query/SubscriptionChannel.d.ts +41 -41
  100. package/esm/src/live-query/SubscriptionChannel.js +126 -121
  101. package/esm/src/live-query/SubscriptionServer.d.ts +38 -38
  102. package/esm/src/live-query/SubscriptionServer.js +114 -112
  103. package/esm/src/remult-proxy.d.ts +2 -2
  104. package/esm/src/remult-proxy.js +177 -178
  105. package/esm/src/remult3/DecoratorReplacer.d.ts +10 -10
  106. package/esm/src/remult3/DecoratorReplacer.js +20 -20
  107. package/esm/src/remult3/RepositoryImplementation.d.ts +332 -332
  108. package/esm/src/remult3/RepositoryImplementation.js +2122 -2051
  109. package/esm/src/remult3/__updateEntityBasedOnWhere.d.ts +2 -2
  110. package/esm/src/remult3/__updateEntityBasedOnWhere.js +24 -24
  111. package/esm/src/remult3/entity.d.ts +28 -28
  112. package/esm/src/remult3/entity.js +70 -70
  113. package/esm/src/remult3/getEntityRef.d.ts +9 -9
  114. package/esm/src/remult3/getEntityRef.js +27 -27
  115. package/esm/src/remult3/remult3.d.ts +397 -397
  116. package/esm/src/remult3/remult3.js +1 -1
  117. package/esm/src/resultCompoundIdFilter.d.ts +3 -3
  118. package/esm/src/resultCompoundIdFilter.js +16 -16
  119. package/esm/src/server-action-info.d.ts +10 -10
  120. package/esm/src/server-action-info.js +12 -12
  121. package/esm/src/server-action.d.ts +79 -79
  122. package/esm/src/server-action.js +397 -387
  123. package/esm/src/sort.d.ts +16 -16
  124. package/esm/src/sort.js +105 -104
  125. package/esm/src/sql-command.d.ts +19 -19
  126. package/esm/src/sql-command.js +1 -1
  127. package/esm/src/validators.d.ts +14 -14
  128. package/esm/src/validators.js +36 -36
  129. package/esm/src/valueConverters.d.ts +13 -13
  130. package/esm/src/valueConverters.js +210 -210
  131. package/esm/urlBuilder.d.ts +6 -6
  132. package/esm/urlBuilder.js +20 -19
  133. package/graphql.d.ts +14 -14
  134. package/graphql.js +953 -953
  135. package/index.d.ts +31 -31
  136. package/index.js +67 -67
  137. package/inputTypes.d.ts +9 -9
  138. package/inputTypes.js +16 -16
  139. package/live-query/data-provider-live-query-storage.d.ts +23 -23
  140. package/live-query/data-provider-live-query-storage.js +263 -263
  141. package/myLog.d.ts +1 -1
  142. package/myLog.js +20 -20
  143. package/package.json +1 -1
  144. package/postgres/index.d.ts +2 -2
  145. package/postgres/index.js +5 -5
  146. package/postgres/postgres-data-provider.d.ts +36 -36
  147. package/postgres/postgres-data-provider.js +191 -191
  148. package/postgres/schema-builder.d.ts +19 -19
  149. package/postgres/schema-builder.js +369 -369
  150. package/remult-express.d.ts +9 -9
  151. package/remult-express.js +34 -33
  152. package/remult-fastify.d.ts +6 -6
  153. package/remult-fastify.js +79 -79
  154. package/remult-fresh.d.ts +17 -17
  155. package/remult-fresh.js +41 -41
  156. package/remult-knex/index.d.ts +30 -30
  157. package/remult-knex/index.js +917 -915
  158. package/remult-mongo.d.ts +24 -24
  159. package/remult-mongo.js +515 -515
  160. package/remult-next.d.ts +25 -25
  161. package/remult-next.js +171 -171
  162. package/remult-sveltekit.d.ts +4 -4
  163. package/remult-sveltekit.js +110 -110
  164. package/server/JsonEntityFileStorage.d.ts +11 -11
  165. package/server/JsonEntityFileStorage.js +35 -35
  166. package/server/core.d.ts +4 -4
  167. package/server/core.js +12 -12
  168. package/server/expressBridge.d.ts +128 -128
  169. package/server/expressBridge.js +1401 -1402
  170. package/server/index.d.ts +6 -6
  171. package/server/index.js +24 -24
  172. package/server/initAsyncHooks.d.ts +1 -1
  173. package/server/initAsyncHooks.js +13 -13
  174. package/server/initDataProvider.d.ts +2 -2
  175. package/server/initDataProvider.js +26 -26
  176. package/src/CompoundIdField.d.ts +27 -27
  177. package/src/CompoundIdField.js +54 -54
  178. package/src/__EntityValueProvider.d.ts +11 -11
  179. package/src/__EntityValueProvider.js +2 -2
  180. package/src/__RowsOfDataForTesting.d.ts +3 -3
  181. package/src/__RowsOfDataForTesting.js +2 -2
  182. package/src/buildRestDataProvider.d.ts +31 -31
  183. package/src/buildRestDataProvider.js +177 -174
  184. package/src/column-interfaces.d.ts +160 -160
  185. package/src/column-interfaces.js +11 -11
  186. package/src/column.d.ts +31 -31
  187. package/src/column.js +132 -132
  188. package/src/context.d.ts +134 -134
  189. package/src/context.js +451 -451
  190. package/src/data-api.d.ts +38 -38
  191. package/src/data-api.js +524 -524
  192. package/src/data-interfaces.d.ts +41 -41
  193. package/src/data-interfaces.js +16 -16
  194. package/src/data-providers/array-entity-data-provider.d.ts +22 -22
  195. package/src/data-providers/array-entity-data-provider.js +364 -364
  196. package/src/data-providers/in-memory-database.d.ts +9 -9
  197. package/src/data-providers/in-memory-database.js +33 -33
  198. package/src/data-providers/json-data-provider.d.ts +12 -12
  199. package/src/data-providers/json-data-provider.js +106 -106
  200. package/src/data-providers/rest-data-provider.d.ts +39 -39
  201. package/src/data-providers/rest-data-provider.js +388 -388
  202. package/src/data-providers/sql-database.d.ts +33 -33
  203. package/src/data-providers/sql-database.js +653 -653
  204. package/src/data-providers/web-sql-data-provider.d.ts +21 -21
  205. package/src/data-providers/web-sql-data-provider.js +229 -229
  206. package/src/entity.d.ts +95 -95
  207. package/src/entity.js +2 -2
  208. package/src/filter/filter-consumer-bridge-to-sql-request.d.ts +50 -50
  209. package/src/filter/filter-consumer-bridge-to-sql-request.js +307 -307
  210. package/src/filter/filter-interfaces.d.ts +86 -86
  211. package/src/filter/filter-interfaces.js +693 -685
  212. package/src/live-query/LiveQueryClient.d.ts +1 -1
  213. package/src/live-query/LiveQueryClient.js +293 -293
  214. package/src/live-query/SseSubscriptionClient.d.ts +5 -5
  215. package/src/live-query/SseSubscriptionClient.js +154 -154
  216. package/src/live-query/SubscriptionChannel.d.ts +41 -41
  217. package/src/live-query/SubscriptionChannel.js +189 -189
  218. package/src/live-query/SubscriptionServer.d.ts +38 -38
  219. package/src/live-query/SubscriptionServer.js +264 -264
  220. package/src/remult-proxy.d.ts +2 -2
  221. package/src/remult-proxy.js +307 -307
  222. package/src/remult3/DecoratorReplacer.d.ts +10 -10
  223. package/src/remult3/DecoratorReplacer.js +24 -24
  224. package/src/remult3/RepositoryImplementation.d.ts +332 -332
  225. package/src/remult3/RepositoryImplementation.js +3391 -3373
  226. package/src/remult3/__updateEntityBasedOnWhere.d.ts +2 -2
  227. package/src/remult3/__updateEntityBasedOnWhere.js +28 -28
  228. package/src/remult3/entity.d.ts +28 -28
  229. package/src/remult3/entity.js +88 -88
  230. package/src/remult3/getEntityRef.d.ts +9 -9
  231. package/src/remult3/getEntityRef.js +35 -35
  232. package/src/remult3/remult3.d.ts +397 -397
  233. package/src/remult3/remult3.js +2 -2
  234. package/src/resultCompoundIdFilter.d.ts +3 -3
  235. package/src/resultCompoundIdFilter.js +20 -20
  236. package/src/server-action-info.d.ts +10 -10
  237. package/src/server-action-info.js +15 -15
  238. package/src/server-action.d.ts +79 -79
  239. package/src/server-action.js +632 -632
  240. package/src/sort.d.ts +16 -16
  241. package/src/sort.js +161 -161
  242. package/src/sql-command.d.ts +19 -19
  243. package/src/sql-command.js +2 -2
  244. package/src/validators.d.ts +14 -14
  245. package/src/validators.js +71 -69
  246. package/src/valueConverters.d.ts +13 -13
  247. package/src/valueConverters.js +213 -213
  248. package/urlBuilder.d.ts +6 -6
  249. package/urlBuilder.js +25 -25
@@ -1,104 +1,107 @@
1
- import { v4 as uuid } from 'uuid';
2
- import { ConnectionNotFoundError } from './src/live-query/SseSubscriptionClient';
3
- export class SseSubscriptionServer {
4
- constructor(canUserConnectToChannel) {
5
- this.canUserConnectToChannel = canUserConnectToChannel;
6
- //@internal
7
- this.connections = [];
8
- //@internal
9
- this.debugMessageFileSaver = (id, channel, message) => { };
10
- //@internal
11
- this.debugFileSaver = () => { };
12
- if (!this.canUserConnectToChannel) {
13
- this.canUserConnectToChannel = () => true;
14
- }
15
- }
16
- //@internal
17
- subscribeToChannel({ channel, clientId }, res, remult, remove = false) {
18
- for (const c of this.connections) {
19
- if (c.connectionId === clientId) {
20
- if (this.canUserConnectToChannel(channel, remult)) {
21
- if (remove)
22
- delete c.channels[channel];
23
- else
24
- c.channels[channel] = true;
25
- res.success({ status: 'ok' });
26
- this.debug();
27
- return;
28
- }
29
- else {
30
- res.forbidden();
31
- this.debug();
32
- return;
33
- }
34
- }
35
- }
36
- res.success(ConnectionNotFoundError);
37
- }
38
- async publishMessage(channel, message) {
39
- const data = JSON.stringify({ channel, data: message });
40
- for (const sc of this.connections) {
41
- if (sc.channels[channel]) {
42
- this.debugMessageFileSaver(sc.connectionId, channel, message);
43
- sc.write(data);
44
- }
45
- }
46
- }
47
- //@internal
48
- openHttpServerStream(req, res) {
49
- res.writeHead(200, {
50
- 'Content-Type': 'text/event-stream',
51
- 'Cache-Control': 'no-cache',
52
- Connection: 'keep-alive',
53
- });
54
- const cc = new clientConnection(res);
55
- //const lastEventId = req.headers['last-event-id'];
56
- this.connections.push(cc);
57
- this.debug();
58
- //@ts-ignore
59
- req.on('close', () => {
60
- cc.close();
61
- this.connections = this.connections.filter((s) => s !== cc);
62
- this.debug();
63
- });
64
- return cc;
65
- }
66
- //@internal
67
- debug() {
68
- this.debugFileSaver(this.connections.map((x) => ({
69
- id: x.connectionId,
70
- channels: x.channels,
71
- })));
72
- }
73
- }
74
- export class clientConnection {
75
- constructor(response) {
76
- this.response = response;
77
- this.channels = {};
78
- this.closed = false;
79
- this.connectionId = uuid();
80
- this.write(this.connectionId, 'connectionId');
81
- this.sendLiveMessage();
82
- }
83
- close() {
84
- if (this.timeOutRef)
85
- clearTimeout(this.timeOutRef);
86
- this.closed = true;
87
- }
88
- write(eventData, eventType = 'message') {
89
- let event = 'event:' + eventType;
90
- // if (id != undefined)
91
- // event += "\nid:" + id;
92
- this.response.write(event + '\ndata:' + eventData + '\n\n');
93
- if (this.response.flush)
94
- this.response.flush();
95
- }
96
- sendLiveMessage() {
97
- if (this.closed)
98
- return;
99
- this.write('', 'keep-alive');
100
- this.timeOutRef = setTimeout(() => {
101
- this.sendLiveMessage();
102
- }, 45000);
103
- }
104
- }
1
+ import { v4 as uuid } from 'uuid';
2
+ import { ConnectionNotFoundError } from './src/live-query/SseSubscriptionClient';
3
+ export class SseSubscriptionServer {
4
+ canUserConnectToChannel;
5
+ //@internal
6
+ subscribeToChannel({ channel, clientId }, res, remult, remove = false) {
7
+ for (const c of this.connections) {
8
+ if (c.connectionId === clientId) {
9
+ if (this.canUserConnectToChannel(channel, remult)) {
10
+ if (remove)
11
+ delete c.channels[channel];
12
+ else
13
+ c.channels[channel] = true;
14
+ res.success({ status: 'ok' });
15
+ this.debug();
16
+ return;
17
+ }
18
+ else {
19
+ res.forbidden();
20
+ this.debug();
21
+ return;
22
+ }
23
+ }
24
+ }
25
+ res.success(ConnectionNotFoundError);
26
+ }
27
+ //@internal
28
+ connections = [];
29
+ constructor(canUserConnectToChannel) {
30
+ this.canUserConnectToChannel = canUserConnectToChannel;
31
+ if (!this.canUserConnectToChannel) {
32
+ this.canUserConnectToChannel = () => true;
33
+ }
34
+ }
35
+ async publishMessage(channel, message) {
36
+ const data = JSON.stringify({ channel, data: message });
37
+ for (const sc of this.connections) {
38
+ if (sc.channels[channel]) {
39
+ this.debugMessageFileSaver(sc.connectionId, channel, message);
40
+ sc.write(data);
41
+ }
42
+ }
43
+ }
44
+ //@internal
45
+ debugMessageFileSaver = (id, channel, message) => { };
46
+ //@internal
47
+ openHttpServerStream(req, res) {
48
+ res.writeHead(200, {
49
+ 'Content-Type': 'text/event-stream',
50
+ 'Cache-Control': 'no-cache',
51
+ Connection: 'keep-alive',
52
+ });
53
+ const cc = new clientConnection(res);
54
+ //const lastEventId = req.headers['last-event-id'];
55
+ this.connections.push(cc);
56
+ this.debug();
57
+ //@ts-ignore
58
+ req.on('close', () => {
59
+ cc.close();
60
+ this.connections = this.connections.filter((s) => s !== cc);
61
+ this.debug();
62
+ });
63
+ return cc;
64
+ }
65
+ //@internal
66
+ debug() {
67
+ this.debugFileSaver(this.connections.map((x) => ({
68
+ id: x.connectionId,
69
+ channels: x.channels,
70
+ })));
71
+ }
72
+ //@internal
73
+ debugFileSaver = () => { };
74
+ }
75
+ export class clientConnection {
76
+ response;
77
+ channels = {};
78
+ timeOutRef;
79
+ close() {
80
+ if (this.timeOutRef)
81
+ clearTimeout(this.timeOutRef);
82
+ this.closed = true;
83
+ }
84
+ closed = false;
85
+ write(eventData, eventType = 'message') {
86
+ let event = 'event:' + eventType;
87
+ // if (id != undefined)
88
+ // event += "\nid:" + id;
89
+ this.response.write(event + '\ndata:' + eventData + '\n\n');
90
+ if (this.response.flush)
91
+ this.response.flush();
92
+ }
93
+ connectionId = uuid();
94
+ constructor(response) {
95
+ this.response = response;
96
+ this.write(this.connectionId, 'connectionId');
97
+ this.sendLiveMessage();
98
+ }
99
+ sendLiveMessage() {
100
+ if (this.closed)
101
+ return;
102
+ this.write('', 'keep-alive');
103
+ this.timeOutRef = setTimeout(() => {
104
+ this.sendLiveMessage();
105
+ }, 45000);
106
+ }
107
+ }
package/esm/ably.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import type * as Ably from '../../node_modules/ably';
2
- import type { SubscriptionClient, SubscriptionClientConnection } from './src/live-query/SubscriptionChannel';
3
- import type { SubscriptionServer } from './src/live-query/SubscriptionServer';
4
- export declare class AblySubscriptionClient implements SubscriptionClient {
5
- private ably;
6
- constructor(ably: Ably.Types.RealtimePromise);
7
- openConnection(onReconnect: VoidFunction): Promise<SubscriptionClientConnection>;
8
- }
9
- export declare class AblySubscriptionServer implements SubscriptionServer {
10
- private ably;
11
- constructor(ably: Ably.Types.RestPromise);
12
- publishMessage<T>(channel: string, message: T): Promise<void>;
13
- }
1
+ import type * as Ably from '../../node_modules/ably';
2
+ import type { SubscriptionClient, SubscriptionClientConnection } from './src/live-query/SubscriptionChannel';
3
+ import type { SubscriptionServer } from './src/live-query/SubscriptionServer';
4
+ export declare class AblySubscriptionClient implements SubscriptionClient {
5
+ private ably;
6
+ constructor(ably: Ably.Types.RealtimePromise);
7
+ openConnection(onReconnect: VoidFunction): Promise<SubscriptionClientConnection>;
8
+ }
9
+ export declare class AblySubscriptionServer implements SubscriptionServer {
10
+ private ably;
11
+ constructor(ably: Ably.Types.RestPromise);
12
+ publishMessage<T>(channel: string, message: T): Promise<void>;
13
+ }
package/esm/ably.js CHANGED
@@ -1,28 +1,30 @@
1
- export class AblySubscriptionClient {
2
- constructor(ably) {
3
- this.ably = ably;
4
- }
5
- async openConnection(onReconnect) {
6
- return {
7
- close: () => {
8
- // Since we did not open the connection, we do not close it
9
- },
10
- subscribe: async (channel, handler) => {
11
- let myHandler = (y) => handler(y.data);
12
- await this.ably.channels.get(channel).subscribe((y) => myHandler(y));
13
- return () => {
14
- myHandler = () => { };
15
- this.ably.channels.get(channel).unsubscribe();
16
- };
17
- },
18
- };
19
- }
20
- }
21
- export class AblySubscriptionServer {
22
- constructor(ably) {
23
- this.ably = ably;
24
- }
25
- async publishMessage(channel, message) {
26
- await this.ably.channels.get(channel).publish({ data: message });
27
- }
28
- }
1
+ export class AblySubscriptionClient {
2
+ ably;
3
+ constructor(ably) {
4
+ this.ably = ably;
5
+ }
6
+ async openConnection(onReconnect) {
7
+ return {
8
+ close: () => {
9
+ // Since we did not open the connection, we do not close it
10
+ },
11
+ subscribe: async (channel, handler) => {
12
+ let myHandler = (y) => handler(y.data);
13
+ await this.ably.channels.get(channel).subscribe((y) => myHandler(y));
14
+ return () => {
15
+ myHandler = () => { };
16
+ this.ably.channels.get(channel).unsubscribe();
17
+ };
18
+ },
19
+ };
20
+ }
21
+ }
22
+ export class AblySubscriptionServer {
23
+ ably;
24
+ constructor(ably) {
25
+ this.ably = ably;
26
+ }
27
+ async publishMessage(channel, message) {
28
+ await this.ably.channels.get(channel).publish({ data: message });
29
+ }
30
+ }
package/esm/assign.d.ts CHANGED
@@ -1 +1 @@
1
- export declare function assign<T>(item: T, valuesToSet: Partial<T>): T;
1
+ export declare function assign<T>(item: T, valuesToSet: Partial<T>): T;
package/esm/assign.js CHANGED
@@ -1,5 +1,5 @@
1
- export function assign(item, valuesToSet) {
2
- if (valuesToSet)
3
- Object.assign(item, valuesToSet);
4
- return item;
5
- }
1
+ export function assign(item, valuesToSet) {
2
+ if (valuesToSet)
3
+ Object.assign(item, valuesToSet);
4
+ return item;
5
+ }
@@ -1,3 +1,3 @@
1
- export declare type ClassType<T> = {
2
- new (...args: any[]): T;
3
- };
1
+ export type ClassType<T> = {
2
+ new (...args: any[]): T;
3
+ };
package/esm/classType.js CHANGED
@@ -1 +1 @@
1
- export {};
1
+ export {};
package/esm/graphql.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- import type { ClassType } from './classType';
2
- import { Remult } from './index';
3
- export declare function remultGraphql(options: {
4
- removeComments?: boolean;
5
- entities: ClassType<any>[];
6
- getRemultFromRequest?: (req: any) => Remult;
7
- }): {
8
- resolvers: {
9
- Query: Record<string, unknown>;
10
- Mutation: Record<string, unknown>;
11
- };
12
- rootValue: Record<string, any>;
13
- typeDefs: string;
14
- };
1
+ import type { ClassType } from './classType';
2
+ import { Remult } from './index';
3
+ export declare function remultGraphql(options: {
4
+ removeComments?: boolean;
5
+ entities: ClassType<any>[];
6
+ getRemultFromRequest?: (req: any) => Remult;
7
+ }): {
8
+ resolvers: {
9
+ Query: Record<string, unknown>;
10
+ Mutation: Record<string, unknown>;
11
+ };
12
+ rootValue: Record<string, any>;
13
+ typeDefs: string;
14
+ };