@rootintf/protocol-subverseinfo 0.1.3-api-0.2 → 1.0.9-api.2

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.
@@ -13,25 +13,52 @@ Object.defineProperty(globalThis, 'crypto', {
13
13
  // import { JSON_Msg, JSON_Msg_msg } from '@rootintf/json-msg';
14
14
  import {
15
15
  JSON_MsgSubverseInfo_query,
16
- JSON_MsgSubverseInfo_expanse,
16
+ JSON_MsgSubverseInfo_expanse,
17
+ l as l_
17
18
  } from '../src/subverseinfo.mjs';
18
19
 
19
- const kstr_VERSION = "0.2"
20
+ import { LOGR, l_LL } from '@knev/bitlogr';
21
+
22
+ const kstr_VERSION = "2"
23
+
24
+ const LOGR_= LOGR.get_instance();
25
+ LOGR_.toggled= {
26
+ VALIDATION : true
27
+ }
20
28
 
21
29
  //-------------------------------------------------------------------------------------------------
22
30
 
23
- const json_msgSubverseInfo_query_merge = JSON_MsgSubverseInfo_query.merge({
31
+ const json_MsgSubverseInfo_query = {
32
+ "id": "611aeb54-9d2c-4dd9-9a39-e5d95627cc82",
33
+ "referer": [
34
+ "subverse-protocol-map",
35
+ "c8961cab-1aeb-4d9e-9cf2-ce94e6b3ef7f"
36
+ ],
37
+ "dt": "2025-03-05T07:52:01.209Z",
24
38
  "query": {
25
39
  "name": "discovery-expanse",
26
40
  "graphql": "query { expanse { name map logo(width: 200, height: 200) { link } platforms { name archs agents } protocols { name attr } } }",
27
41
  "ttl_msec": 5000
28
42
  },
29
- });
30
- json_msgSubverseInfo_query_merge.referer = [ "karr_referer", "" ];
43
+ "subverse_info": kstr_VERSION
44
+ }
31
45
 
32
- describe("Validation", function () {
33
- it("JSON_MsgSubverseInfo_discovery.validate(json_msgSubverseInfo_query_merge)", function () {
34
- expect(JSON_MsgSubverseInfo_query.validate(json_msgSubverseInfo_query_merge)).toBe(true);
46
+ describe("Validate query;", function () {
47
+ it("raw", function () {
48
+ expect(JSON_MsgSubverseInfo_query.validate(json_MsgSubverseInfo_query)).toBe(true);
49
+ });
50
+
51
+ it("merge", function () {
52
+ const json = JSON_MsgSubverseInfo_query.merge({
53
+ "query": {
54
+ "name": "discovery-expanse",
55
+ "graphql": "query { expanse { name map logo(width: 200, height: 200) { link } platforms { name archs agents } protocols { name attr } } }",
56
+ "ttl_msec": 5000
57
+ },
58
+ });
59
+ json.referer = [ "karr_referer", "" ];
60
+
61
+ expect(JSON_MsgSubverseInfo_query.validate(json)).toBe(true);
35
62
  });
36
63
  });
37
64
 
@@ -68,80 +95,120 @@ describe("Validation", function () {
68
95
  // "_v" : kstr_VERSION
69
96
  // }
70
97
 
71
- let json_SubverseInfo_expanse_OpenSim= JSON_MsgSubverseInfo_expanse.create_with_msg_merge(null, {
72
- expanse : {
73
- subverse: {
74
- name : "OpenSimulator",
75
- uri : "http://opensimulator.org",
76
- favicon : "https://upload.wikimedia.org/wikipedia/commons/5/50/Opensimulator_logo200x160.png",
77
- "map-url" : "http://opensimulator.org/wiki/Grid_List",
78
- instances : [
79
- {
80
- name : "",
81
- uri : "",
82
- favicon : "",
83
- "warp-url" : ""
84
- }
85
- ]
86
- },
87
- protocols: [
88
- { name: "Second Life protocol", attr: "0r" }
89
- ]
90
- }
91
- });
92
- json_SubverseInfo_expanse_OpenSim.referer = [ "karr_referer", "" ];
98
+
93
99
  // console.log('json_msgAnnouncement_OpenSim', json_msgAnnouncement_OpenSim)
94
100
 
95
- describe("Validation", function () {
96
- it("JSON_MsgSubverseInfo_expanse.validate(json_SubverseInfo_expanse_OpenSim)", function () {
97
- expect(JSON_MsgSubverseInfo_expanse.validate(json_SubverseInfo_expanse_OpenSim)).toBe(true);
101
+ describe("Validate expanse;", function () {
102
+ it("create_with_msg_merge- minimum", function () {
103
+ let json= JSON_MsgSubverseInfo_expanse.create_with_msg_merge(null, {
104
+ expanse : {
105
+ subverse: {
106
+ name : "OpenSimulator",
107
+ uri : "http://opensimulator.org",
108
+ },
109
+ protocols: [
110
+ {
111
+ id: "secondlife://",
112
+ attr: "0r"
113
+ }
114
+ ]
115
+ }
116
+ });
117
+ json.referer = [ "karr_referer", "" ];
118
+
119
+ expect(JSON_MsgSubverseInfo_expanse.validate(json)).toBe(true);
98
120
  });
99
- });
100
121
 
101
- const json_msgSubverseInfo_expanse_DCL = {
102
- "id": "02f5e7b0-140c-496d-a3b5-4fd4023a5e94",
103
- "referer": [
104
- "subverse-protocol-map",
105
- "c8961cab-1aeb-4d9e-9cf2-ce94e6b3ef7f"
106
- ],
107
- "dt": "2025-03-05T07:52:01.212Z",
108
- "expanse": {
109
- "subverse": {
110
- "name": "Decentraland",
111
- "uri": "https://genesis.city",
112
- "favicon": "https://cryptologos.cc/logos/decentraland-mana-logo.png",
113
- "map-url": "https://genesis.city"
114
- },
115
- "protocols": [
116
- {
117
- "name": "Ethereum",
118
- "attr": "0rw"
119
- }
120
- ]
121
- },
122
- "_msg": {
123
- "id": "611aeb54-9d2c-4dd9-9a39-e5d95627cc82",
124
- "referer": [
125
- "subverse-protocol-map",
126
- "c8961cab-1aeb-4d9e-9cf2-ce94e6b3ef7f"
127
- ],
128
- "dt": "2025-03-05T07:52:01.209Z",
129
- "query": {
130
- "name": "discovery-expanse",
131
- "graphql": "query { expanse { name map logo(width: 200, height: 200) { link } platforms { name archs agents } protocols { name attr } } }",
132
- "ttl_msec": 5000
133
- },
134
- "_v": "0.8"
135
- },
136
- "subverse_info": "0.2"
137
- }
122
+ it("create_with_msg_merge- maximum", function () {
123
+ let json= JSON_MsgSubverseInfo_expanse.create_with_msg_merge(null, {
124
+ expanse : {
125
+ subverse: {
126
+ name : "OpenSimulator",
127
+ uri : "http://opensimulator.org",
128
+ favicon : "https://upload.wikimedia.org/wikipedia/commons/5/50/Opensimulator_logo200x160.png",
129
+ "hyperport" : {
130
+ "uri" : "",
131
+ "port" : {}
132
+ },
133
+ "map-uri" : "http://opensimulator.org/wiki/Grid_List",
134
+ instances : [
135
+ {
136
+ name : "",
137
+ uri : "",
138
+ favicon : "",
139
+ "hyperport" : {
140
+ "uri" : "",
141
+ "port" : {}
142
+ },
143
+ info : {
144
+ "key" : "value"
145
+ }
146
+ }
147
+ ],
148
+ info : {
149
+ "key" : "value"
150
+ }
151
+ },
152
+ protocols: [
153
+ {
154
+ id: "secondlife://",
155
+ name : "Second Life protocol",
156
+ attr: "0r"
157
+ }
158
+ ]
159
+ }
160
+ });
161
+ json.referer = [ "karr_referer", "" ];
162
+
163
+ expect(JSON_MsgSubverseInfo_expanse.validate(json)).toBe(true);
164
+ });
138
165
 
139
- describe("Validation", function () {
140
- it("JSON_MsgSubverseInfo_expanse.validate(json_msgSubverseInfo_expanse_DCL)", function () {
141
- expect(JSON_MsgSubverseInfo_expanse.validate(json_msgSubverseInfo_expanse_DCL)).toBe(true);
166
+ it("raw DCL", function () {
167
+ const json = {
168
+ "id": "02f5e7b0-140c-496d-a3b5-4fd4023a5e94",
169
+ "referer": [
170
+ "subverse-protocol-map",
171
+ "c8961cab-1aeb-4d9e-9cf2-ce94e6b3ef7f"
172
+ ],
173
+ "dt": "2025-03-05T07:52:01.212Z",
174
+ "expanse": {
175
+ "subverse": {
176
+ "name": "Decentraland",
177
+ "uri": "https://genesis.city",
178
+ "favicon": "https://cryptologos.cc/logos/decentraland-mana-logo.png",
179
+ "map-uri": "https://genesis.city"
180
+ },
181
+ "protocols": [
182
+ {
183
+ "id" : "",
184
+ "name": "Ethereum",
185
+ "attr": "0rw"
186
+ }
187
+ ]
188
+ },
189
+ "_msg": {
190
+ "id": "611aeb54-9d2c-4dd9-9a39-e5d95627cc82",
191
+ "referer": [
192
+ "subverse-protocol-map",
193
+ "c8961cab-1aeb-4d9e-9cf2-ce94e6b3ef7f"
194
+ ],
195
+ "dt": "2025-03-05T07:52:01.209Z",
196
+ "query": {
197
+ "name": "discovery-expanse",
198
+ "graphql": "query { expanse { name map logo(width: 200, height: 200) { link } platforms { name archs agents } protocols { name attr } } }",
199
+ "ttl_msec": 5000
200
+ },
201
+ "subverse_info": kstr_VERSION
202
+ },
203
+ "subverse_info": kstr_VERSION
204
+ }
205
+
206
+ expect(JSON_MsgSubverseInfo_expanse.validate(json)).toBe(true);
142
207
  });
208
+
143
209
  });
144
210
 
211
+
145
212
  /*
146
213
  describe("Validation", function () {
147
214
  it("JSON_MsgDiscovery.validate(json_msgDiscovery)", function () {
@@ -341,14 +408,14 @@ const json_instance_ = {
341
408
  "expanse" : {
342
409
  instances : [
343
410
  {
344
- name : "",
345
411
  uri : "",
412
+ name : "",
346
413
  favicon : "",
347
414
  info : {}
348
415
  },
349
416
  {
350
- name : "",
351
417
  uri : "",
418
+ name : "",
352
419
  },
353
420
  ],
354
421
  subverse : {
@@ -373,13 +440,14 @@ describe("Validation", function () {
373
440
  });
374
441
  });
375
442
 
376
- describe("Validation", function () {
377
- it("JSON_instances.validate(json_instance_)", function () {
378
- expect(JSON_instances.validate(json_instance_)).toBe(true);
379
- });
380
- });
381
443
  */
382
444
 
445
+ // describe("Validation", function () {
446
+ // it("JSON_MsgSubverseInfo_expanse.validate(json_instance_)", function () {
447
+ // expect(JSON_MsgSubverseInfo_expanse.validate(json_instance_)).toBe(true);
448
+ // });
449
+ // });
450
+
383
451
  //-------------------------------------------------------------------------------------------------
384
452
 
385
453