@rootintf/protocol-subverseinfo 0.0.4-api-0.1 → 1.0.7-api.1.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.
@@ -12,26 +12,53 @@ Object.defineProperty(globalThis, 'crypto', {
12
12
 
13
13
  // import { JSON_Msg, JSON_Msg_msg } from '@rootintf/json-msg';
14
14
  import {
15
- JSON_MsgSubverseInfo_discovery,
16
- JSON_MsgSubverseInfo_expanse,
15
+ JSON_MsgSubverseInfo_query,
16
+ JSON_MsgSubverseInfo_expanse,
17
+ l as l_
17
18
  } from '../src/subverseinfo.mjs';
18
19
 
19
- const kstr_VERSION = "0.1"
20
+ import { LOGR, l_LL } from '@knev/bitlogr';
21
+
22
+ const kstr_VERSION = "1.0"
23
+
24
+ const LOGR_= LOGR.get_instance();
25
+ LOGR_.toggled= {
26
+ VALIDATION : true
27
+ }
20
28
 
21
29
  //-------------------------------------------------------------------------------------------------
22
30
 
23
- const json_msgSubverseInfo_discovery_merge = JSON_MsgSubverseInfo_discovery.merge({
24
- "discovery": {
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",
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_discovery_merge.referer = [ "karr_referer", "" ];
43
+ "subverse_info": kstr_VERSION
44
+ }
31
45
 
32
- describe("Validation", function () {
33
- it("JSON_MsgSubverseInfo_discovery.validate(json_msgSubverseInfo_discovery_merge)", function () {
34
- expect(JSON_MsgSubverseInfo_discovery.validate(json_msgSubverseInfo_discovery_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
 
@@ -50,90 +77,132 @@ describe("Validation", function () {
50
77
 
51
78
  //-------------------------------------------------------------------------------------------------
52
79
 
53
- const json_msgAnnouncement_expanse = {
54
- "id": "53C2A451-D3E7-4657-932D-22EBF4A823D8",
55
- "_msg": { "id": "15169a65-94fe-449a-9164-a2e2bdd78c56", "discovery": { "graphql": "query { subverse { name logo(width: 200, height: 200) protocols integrations } }", "ttl_msec": 5000 }, "referer": ["subverse-protocol-map", "4b1ad967-8154-416f-a744-989db452bd76"], "dt": "2023-04-28T10:13:11.642Z" },
56
- "referer": ["tx-sl", "D41EDF64-6BF9-40D0-B30C-CC6A798B67F2"],
57
- "dt": "2023-04-28T10:13:11Z",
58
- "announcement": {
59
- // "expanse": {
60
- // "integrations": [
61
- // { "pkg": "tx-sl", "ppa": "https://root-interface.se/depot", "sha2-384": "c3f3e373de97e8d7f5d9c47096c128fcdcb07fbbb4581d6ab7d32913fe301edec0abb48a0bcf585f167c473b45a24634", "sha3-224": "", "version": "0.2.9" }
62
- // ],
63
- // "logo": "http://root-interface.se/depot/tx-sl/img-SL_DLbackground.png",
64
- // "name": "Second Life",
65
- // "protocols": ["QuerySubverse", "2PhW", "Discovery"]
66
- // }
67
- },
68
- "_v" : kstr_VERSION
69
- }
80
+ // const json_msgAnnouncement_expanse = {
81
+ // "id": "53C2A451-D3E7-4657-932D-22EBF4A823D8",
82
+ // "_msg": { "id": "15169a65-94fe-449a-9164-a2e2bdd78c56", "discovery": { "graphql": "query { subverse { name logo(width: 200, height: 200) protocols integrations } }", "ttl_msec": 5000 }, "referer": ["subverse-protocol-map", "4b1ad967-8154-416f-a744-989db452bd76"], "dt": "2023-04-28T10:13:11.642Z" },
83
+ // "referer": ["tx-sl", "D41EDF64-6BF9-40D0-B30C-CC6A798B67F2"],
84
+ // "dt": "2023-04-28T10:13:11Z",
85
+ // "announcement": {
86
+ // // "expanse": {
87
+ // // "integrations": [
88
+ // // { "pkg": "tx-sl", "ppa": "https://root-interface.se/depot", "sha2-384": "c3f3e373de97e8d7f5d9c47096c128fcdcb07fbbb4581d6ab7d32913fe301edec0abb48a0bcf585f167c473b45a24634", "sha3-224": "", "version": "0.2.9" }
89
+ // // ],
90
+ // // "logo": "http://root-interface.se/depot/tx-sl/img-SL_DLbackground.png",
91
+ // // "name": "Second Life",
92
+ // // "protocols": ["QuerySubverse", "2PhW", "Discovery"]
93
+ // // }
94
+ // },
95
+ // "_v" : kstr_VERSION
96
+ // }
97
+
70
98
 
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
- },
79
- protocols: [
80
- { name: "Second Life protocol", attr: "0r" }
81
- ]
82
- }
83
- });
84
- json_SubverseInfo_expanse_OpenSim.referer = [ "karr_referer", "" ];
85
99
  // console.log('json_msgAnnouncement_OpenSim', json_msgAnnouncement_OpenSim)
86
100
 
87
- describe("Validation", function () {
88
- it("JSON_MsgSubverseInfo_expanse.validate(json_SubverseInfo_expanse_OpenSim)", function () {
89
- 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);
90
120
  });
91
- });
92
121
 
93
- const json_msgSubverseInfo_expanse_DCL = {
94
- "id": "02f5e7b0-140c-496d-a3b5-4fd4023a5e94",
95
- "referer": [
96
- "subverse-protocol-map",
97
- "c8961cab-1aeb-4d9e-9cf2-ce94e6b3ef7f"
98
- ],
99
- "dt": "2025-03-05T07:52:01.212Z",
100
- "expanse": {
101
- "subverse": {
102
- "name": "Decentraland",
103
- "uri": "https://genesis.city",
104
- "favicon": "https://cryptologos.cc/logos/decentraland-mana-logo.png",
105
- "map_url": "https://genesis.city"
106
- },
107
- "protocols": [
108
- {
109
- "name": "Ethereum",
110
- "attr": "0rw"
111
- }
112
- ]
113
- },
114
- "_msg": {
115
- "id": "611aeb54-9d2c-4dd9-9a39-e5d95627cc82",
116
- "referer": [
117
- "subverse-protocol-map",
118
- "c8961cab-1aeb-4d9e-9cf2-ce94e6b3ef7f"
119
- ],
120
- "dt": "2025-03-05T07:52:01.209Z",
121
- "discovery": {
122
- "name": "discovery-expanse",
123
- "graphql": "query { expanse { name map logo(width: 200, height: 200) { link } platforms { name archs agents } protocols { name attr } } }",
124
- "ttl_msec": 5000
125
- },
126
- "_v": "0.8"
127
- },
128
- "subverse_info": "0.1"
129
- }
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
+ "map-uri" : "http://opensimulator.org/wiki/Grid_List",
131
+ instances : [
132
+ {
133
+ name : "",
134
+ uri : "",
135
+ favicon : "",
136
+ "hyperport" : {},
137
+ info : {
138
+ "key" : "value"
139
+ }
140
+ }
141
+ ],
142
+ info : {
143
+ "key" : "value"
144
+ }
145
+ },
146
+ protocols: [
147
+ {
148
+ id: "secondlife://",
149
+ name : "Second Life protocol",
150
+ attr: "0r"
151
+ }
152
+ ]
153
+ }
154
+ });
155
+ json.referer = [ "karr_referer", "" ];
156
+
157
+ expect(JSON_MsgSubverseInfo_expanse.validate(json)).toBe(true);
158
+ });
130
159
 
131
- describe("Validation", function () {
132
- it("JSON_MsgSubverseInfo_expanse.validate(json_msgSubverseInfo_expanse_DCL)", function () {
133
- expect(JSON_MsgSubverseInfo_expanse.validate(json_msgSubverseInfo_expanse_DCL)).toBe(true);
160
+ it("raw DCL", function () {
161
+ const json = {
162
+ "id": "02f5e7b0-140c-496d-a3b5-4fd4023a5e94",
163
+ "referer": [
164
+ "subverse-protocol-map",
165
+ "c8961cab-1aeb-4d9e-9cf2-ce94e6b3ef7f"
166
+ ],
167
+ "dt": "2025-03-05T07:52:01.212Z",
168
+ "expanse": {
169
+ "subverse": {
170
+ "name": "Decentraland",
171
+ "uri": "https://genesis.city",
172
+ "favicon": "https://cryptologos.cc/logos/decentraland-mana-logo.png",
173
+ "map-uri": "https://genesis.city"
174
+ },
175
+ "protocols": [
176
+ {
177
+ "id" : "",
178
+ "name": "Ethereum",
179
+ "attr": "0rw"
180
+ }
181
+ ]
182
+ },
183
+ "_msg": {
184
+ "id": "611aeb54-9d2c-4dd9-9a39-e5d95627cc82",
185
+ "referer": [
186
+ "subverse-protocol-map",
187
+ "c8961cab-1aeb-4d9e-9cf2-ce94e6b3ef7f"
188
+ ],
189
+ "dt": "2025-03-05T07:52:01.209Z",
190
+ "query": {
191
+ "name": "discovery-expanse",
192
+ "graphql": "query { expanse { name map logo(width: 200, height: 200) { link } platforms { name archs agents } protocols { name attr } } }",
193
+ "ttl_msec": 5000
194
+ },
195
+ "subverse_info": kstr_VERSION
196
+ },
197
+ "subverse_info": kstr_VERSION
198
+ }
199
+
200
+ expect(JSON_MsgSubverseInfo_expanse.validate(json)).toBe(true);
134
201
  });
202
+
135
203
  });
136
204
 
205
+
137
206
  /*
138
207
  describe("Validation", function () {
139
208
  it("JSON_MsgDiscovery.validate(json_msgDiscovery)", function () {
@@ -333,14 +402,14 @@ const json_instance_ = {
333
402
  "expanse" : {
334
403
  instances : [
335
404
  {
336
- name : "",
337
405
  uri : "",
406
+ name : "",
338
407
  favicon : "",
339
408
  info : {}
340
409
  },
341
410
  {
342
- name : "",
343
411
  uri : "",
412
+ name : "",
344
413
  },
345
414
  ],
346
415
  subverse : {
@@ -365,13 +434,14 @@ describe("Validation", function () {
365
434
  });
366
435
  });
367
436
 
368
- describe("Validation", function () {
369
- it("JSON_instances.validate(json_instance_)", function () {
370
- expect(JSON_instances.validate(json_instance_)).toBe(true);
371
- });
372
- });
373
437
  */
374
438
 
439
+ // describe("Validation", function () {
440
+ // it("JSON_MsgSubverseInfo_expanse.validate(json_instance_)", function () {
441
+ // expect(JSON_MsgSubverseInfo_expanse.validate(json_instance_)).toBe(true);
442
+ // });
443
+ // });
444
+
375
445
  //-------------------------------------------------------------------------------------------------
376
446
 
377
447