geonix 1.8.1 → 1.8.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geonix",
3
- "version": "1.8.1",
3
+ "version": "1.8.3",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "bin": {
package/src/Connection.js CHANGED
@@ -103,7 +103,16 @@ class Connection {
103
103
  payload = codec.encode(Stream(JSON.stringify({ $r: respondTo, p: json })))
104
104
 
105
105
  await this.#nc.publish(subject, payload)
106
- const response = await this.#nc.subscribe(respondTo, { max: 1, ...options })
106
+
107
+ let response
108
+ try {
109
+ response = await this.#nc.subscribe(respondTo, { max: 1, ...options })
110
+ } catch (e) {
111
+ console.debug('GxDebug -----')
112
+ console.log({ subject, json })
113
+ console.debug('-------------')
114
+ throw e
115
+ }
107
116
 
108
117
  for await (let event of response)
109
118
  return codec.decode(event.data)
package/src/Request.js CHANGED
@@ -77,15 +77,20 @@ export async function Request(service, method, args = [], context = [], options)
77
77
  if (!identifier)
78
78
  throw Error(`Request: requested instance of ${service} not found`)
79
79
 
80
- let response = await connection.request(
81
- `gx2.service.${hash(identifier)}`,
82
- {
83
- m: method,
84
- a: args,
85
- c: context,
86
- o: getOriginator()
87
- },
88
- options)
80
+ try {
81
+ const originator = getOriginator()
82
+ let response = await connection.request(
83
+ `gx2.service.${hash(identifier)}`,
84
+ {
85
+ m: method,
86
+ a: args,
87
+ c: context,
88
+ o: originator
89
+ },
90
+ options)
91
+ } catch (e) {
92
+
93
+ }
89
94
 
90
95
  // automatically process streamed response
91
96
  if (isStream(response))
@@ -0,0 +1,33 @@
1
+ export function serialize(input) {
2
+ const process = (value) => {
3
+ if (value instanceof Buffer) {
4
+ console.log('this is buffer')
5
+ }
6
+
7
+ if (typeof value === 'object')
8
+ for (let prop in value)
9
+ serialize()
10
+
11
+ return value
12
+ }
13
+
14
+ let state = input
15
+
16
+ process(state)
17
+
18
+ return JSON.stringify(state)
19
+ }
20
+
21
+ export function deserialize(input) {
22
+
23
+ }
24
+
25
+ const input = {
26
+
27
+ }
28
+
29
+ const s = serialize(input)
30
+ const ds = deserialize(s)
31
+
32
+ console.log(' serialized =', s)
33
+ console.log('deserialized =', ds)