@rootintf/protocol-2phw 1.0.36-api.1 → 1.1.5-api.1

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.
@@ -0,0 +1,48 @@
1
+ export function definitions_2PhW(data: any, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }?: {
2
+ instancePath?: string;
3
+ rootData?: any;
4
+ dynamicAnchors?: {};
5
+ }): boolean;
6
+ export namespace definitions_2PhW {
7
+ namespace evaluated {
8
+ let dynamicProps: boolean;
9
+ let dynamicItems: boolean;
10
+ }
11
+ }
12
+ export function schema_MsgWarp(data: any, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }?: {
13
+ instancePath?: string;
14
+ rootData?: any;
15
+ dynamicAnchors?: {};
16
+ }): boolean;
17
+ export namespace schema_MsgWarp {
18
+ export namespace evaluated_1 {
19
+ export let props: {
20
+ warp: boolean;
21
+ "2PhW": boolean;
22
+ };
23
+ let dynamicProps_1: boolean;
24
+ export { dynamicProps_1 as dynamicProps };
25
+ let dynamicItems_1: boolean;
26
+ export { dynamicItems_1 as dynamicItems };
27
+ }
28
+ export { evaluated_1 as evaluated };
29
+ }
30
+ export function schema_MsgEngage(data: any, { instancePath, parentData, parentDataProperty, rootData, dynamicAnchors }?: {
31
+ instancePath?: string;
32
+ rootData?: any;
33
+ dynamicAnchors?: {};
34
+ }): boolean;
35
+ export namespace schema_MsgEngage {
36
+ export namespace evaluated_2 {
37
+ let props_1: {
38
+ engage: boolean;
39
+ "2PhW": boolean;
40
+ };
41
+ export { props_1 as props };
42
+ let dynamicProps_2: boolean;
43
+ export { dynamicProps_2 as dynamicProps };
44
+ let dynamicItems_2: boolean;
45
+ export { dynamicItems_2 as dynamicItems };
46
+ }
47
+ export { evaluated_2 as evaluated };
48
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rootintf/protocol-2phw",
3
- "version": "1.0.36-api.1",
3
+ "version": "1.1.5-api.1",
4
4
  "description": "",
5
5
  "main": "dist/twoPhW.cjs.js",
6
6
  "browser": "dist/twoPhW.es.mjs",
@@ -28,16 +28,21 @@
28
28
  "dependencies": {
29
29
  "@knev/bitlogr": "^2.0.11",
30
30
  "@rootintf/json-msg": "^1.1.5",
31
- "ajv": "^8.17.1"
31
+ "ajv": "^8.17.1",
32
+ "tslib": "^2.8.1"
32
33
  },
33
34
  "devDependencies": {
34
35
  "@rollup/plugin-commonjs": "^28.0.3",
35
36
  "@rollup/plugin-json": "^6.1.0",
36
37
  "@rollup/plugin-node-resolve": "^16.0.1",
38
+ "@rollup/plugin-typescript": "^12.1.2",
39
+ "@types/ajv": "^0.0.5",
40
+ "@types/node": "^22.15.23",
37
41
  "ajv-cli": "^5.0.0",
38
42
  "del-cli": "^6.0.0",
39
43
  "jasmine": "^5.6.0",
40
44
  "rollup": "^4.39.0",
45
+ "typescript": "^5.8.3",
41
46
  "uuid": "^11.1.0"
42
47
  }
43
48
  }
package/rollup.config.mjs CHANGED
@@ -2,23 +2,34 @@
2
2
  import resolve from '@rollup/plugin-node-resolve';
3
3
  import commonjs from '@rollup/plugin-commonjs';
4
4
  import json from '@rollup/plugin-json';
5
+ import typescript from '@rollup/plugin-typescript';
5
6
 
6
7
  export default [
7
8
  {
8
- input: 'src/twoPhW.mjs',
9
+ input: 'src/twoPhW.ts',
9
10
  output: {
10
11
  file: 'dist/twoPhW.es.mjs',
11
12
  format: 'es'
12
13
  },
13
- plugins: [resolve(), commonjs(), json()]
14
+ plugins: [
15
+ resolve(),
16
+ commonjs(),
17
+ json(),
18
+ typescript({ tsconfig: './tsconfig.json' })
19
+ ]
14
20
  },
15
21
  {
16
- input: 'src/twoPhW.mjs',
22
+ input: 'src/twoPhW.ts',
17
23
  output: {
18
24
  file: 'dist/twoPhW.cjs.js',
19
25
  format: 'cjs'
20
26
  },
21
- plugins: [resolve(), commonjs(), json()]
27
+ plugins: [
28
+ resolve(),
29
+ commonjs(),
30
+ json(),
31
+ typescript({ tsconfig: './tsconfig.json' })
32
+ ]
22
33
  }
23
34
 
24
35
  ];
@@ -0,0 +1,61 @@
1
+ {
2
+ "$id" : "https://root-interface.se/protocols/2PhW",
3
+ "$schema": "https://json-schema.org/draft/2019-09/schema",
4
+ "schemas": {
5
+ "https://root-interface.se/protocols/2PhW/definitions" : {
6
+ "$id" : "https://root-interface.se/protocols/2PhW/definitions",
7
+ "$schema" : "https://json-schema.org/draft/2019-09/schema",
8
+ "definitions" : {
9
+ "2PhW" : {
10
+ "const": "1"
11
+ },
12
+ "warp_id" : {
13
+ "type" : "string"
14
+ }
15
+ }
16
+ },
17
+ "https://root-interface.se/protocols/2PhW/MsgWarp" : {
18
+ "$id" : "https://root-interface.se/protocols/2PhW/MsgWarp",
19
+ "$schema": "https://json-schema.org/draft/2019-09/schema",
20
+ "type" : "object",
21
+ "required" : ["warp"],
22
+ "properties" : {
23
+ "warp" : {
24
+ "type" : "object",
25
+ "required" : ["id", "user", "hyperport", "ttl_msec"],
26
+ "properties": {
27
+ "id" : { "$ref": "definitions#/definitions/warp_id" },
28
+ "ttl_msec" : {
29
+ "type" : "integer"
30
+ },
31
+ "instantaneous" : {
32
+ "type" : "boolean"
33
+ }
34
+ }
35
+ },
36
+ "2PhW" : { "$ref": "definitions#/definitions/2PhW" }
37
+ }
38
+ },
39
+ "https://root-interface.se/protocols/2PhW/MsgEngage" : {
40
+ "$id" : "https://root-interface.se/protocols/2PhW/MsgEngage",
41
+ "$schema": "https://json-schema.org/draft/2019-09/schema",
42
+ "type" : "object",
43
+ "required" : ["engage"],
44
+ "properties" : {
45
+ "engage" : {
46
+ "type" : "object",
47
+ "required" : [ "ok", "rtt_msec" ],
48
+ "properties": {
49
+ "ok" : {
50
+ "type" : "boolean"
51
+ },
52
+ "rtt_msec" : {
53
+ "type" : "integer"
54
+ }
55
+ }
56
+ },
57
+ "2PhW" : { "$ref": "definitions#/definitions/2PhW" }
58
+ }
59
+ }
60
+ }
61
+ }
@@ -83,7 +83,7 @@ class EventLog {
83
83
  this.map_timeouts.clear();
84
84
  }
85
85
 
86
- getEventById(id, lookback_ms = null) {
86
+ getEventsById(id, lookback_ms = null) {
87
87
  const arr_indices = this.map_index_id.get(id);
88
88
  if (!arr_indices?.length) return [];
89
89
 
@@ -1,12 +1,6 @@
1
1
 
2
-
3
- var json_definitions_2PhW_= require('../schema/definitions_2PhW.json');
4
- var json_schema_msgWarp_= require('../schema/schema_MsgWarp.json');
5
- var json_schema_msgEngage_= require('../schema/schema_MsgEngage.json');
6
- var json_schema_msgOptions_= require('../schema/schema_MsgOptions.json');
7
- var json_schema_options_delay_= require('../schema/schema_Options_delay.json');
8
-
9
2
  // https://ajv.js.org/standalone.html
3
+ // https://ajv.js.org/guide/schema-language.html
10
4
 
11
5
  const fs = require("fs")
12
6
  const path = require("path")
@@ -19,21 +13,27 @@ const standaloneCode = require("ajv/dist/standalone").default
19
13
  // This mapping would not have been needed if the `$ids` was just `Bar` and `Foo` instead of `#/definitions/Foo`
20
14
  // and `#/definitions/Bar` respectfully
21
15
  const ajv = new Ajv2019({
22
- schemas: [
23
- json_definitions_2PhW_,
24
- json_schema_msgWarp_,
25
- json_schema_msgEngage_,
26
- json_schema_msgOptions_,
27
- json_schema_options_delay_
28
- ],
16
+ // schemas: [
17
+ // json_definitions_2PhW_,
18
+ // json_schema_msgWarp_,
19
+ // json_schema_msgEngage_,
20
+ // json_schema_msgOptions_,
21
+ // json_schema_options_delay_
22
+ // ],
29
23
  code: {source: true, esm: true}
30
24
  });
25
+
26
+ var schema_2PhW_= require('../schema/schema_2PhW.json');
27
+ Object.values(schema_2PhW_.schemas).forEach(schema => {
28
+ ajv.addSchema(schema);
29
+ });
30
+
31
31
  let moduleCode = standaloneCode(ajv, {
32
- "definitions_2PhW": "https://root-interface.se/protocols/2PhW/definitions_2PhW",
33
- "schema_MsgWarp": "https://root-interface.se/protocols/2PhW/schema_MsgWarp",
34
- "schema_MsgEngage": "https://root-interface.se/protocols/2PhW/schema_MsgEngage",
35
- "schema_MsgOptions": "https://root-interface.se/protocols/2PhW/schema_MsgOptions",
36
- "schema_Options_delay": "https://root-interface.se/protocols/2PhW/schema_Options_delay",
32
+ "definitions_2PhW": "https://root-interface.se/protocols/2PhW/definitions",
33
+ "schema_MsgWarp": "https://root-interface.se/protocols/2PhW/MsgWarp",
34
+ "schema_MsgEngage": "https://root-interface.se/protocols/2PhW/MsgEngage",
35
+ // "schema_MsgOptions": "https://root-interface.se/protocols/2PhW/schema_MsgOptions",
36
+ // "schema_Options_delay": "https://root-interface.se/protocols/2PhW/schema_Options_delay",
37
37
  })
38
38
 
39
39
  // Now you can write the module code to file
@@ -0,0 +1 @@
1
+ declare module '@knev/bitlogr';