@cloudcare/guance-front-tools 1.0.18 → 1.0.19

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 (170) hide show
  1. package/README.md +32 -23
  2. package/lib/cjs/package.json +3 -0
  3. package/lib/cjs/scripts/convert-grafana-dashboard.js +6 -12
  4. package/lib/esm/package.json +3 -0
  5. package/lib/esm/scripts/convert-grafana-dashboard.js +0 -9
  6. package/lib/scripts/convert-grafana-dashboard.js +0 -10
  7. package/package.json +5 -3
  8. package/scripts/write-module-package-json.mjs +24 -0
  9. package/skills/grafana-to-guance-dashboard/SKILL.md +390 -33
  10. package/skills/grafana-to-guance-dashboard/agents/openai.yaml +2 -2
  11. package/skills/grafana-to-guance-dashboard/fixtures/grafana-dashboard.guance.json +1029 -0
  12. package/skills/grafana-to-guance-dashboard/fixtures/grafana-dashboard.json +878 -0
  13. package/skills/grafana-to-guance-dashboard/package.json +16 -0
  14. package/skills/grafana-to-guance-dashboard/references/conversion-audit-checklist.md +183 -0
  15. package/skills/grafana-to-guance-dashboard/references/converter-notes.md +114 -4
  16. package/skills/grafana-to-guance-dashboard/references/promql-compatibility-cheatsheet.md +172 -0
  17. package/skills/grafana-to-guance-dashboard/references/unit-inference-cheatsheet.md +174 -0
  18. package/skills/grafana-to-guance-dashboard/schemas/charts/chart-schema.json +84 -0
  19. package/skills/grafana-to-guance-dashboard/schemas/charts/common/chart-link-item-schema.json +48 -0
  20. package/skills/grafana-to-guance-dashboard/schemas/charts/common/chart-links-schema.json +9 -0
  21. package/skills/grafana-to-guance-dashboard/schemas/charts/common/common-chart-types-schema.json +39 -0
  22. package/skills/grafana-to-guance-dashboard/schemas/charts/common/common-vars-item-schema.json +117 -0
  23. package/skills/grafana-to-guance-dashboard/schemas/charts/common/common-vars-schema.json +10 -0
  24. package/skills/grafana-to-guance-dashboard/schemas/charts/dashboard-schema.json +80 -0
  25. package/skills/grafana-to-guance-dashboard/schemas/charts/query/queries-schema.json +10 -0
  26. package/skills/grafana-to-guance-dashboard/schemas/charts/query/query-item-schema.json +60 -0
  27. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/_common-settings-connect-null-schema.json +7 -0
  28. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/_common-settings-gradual-color-schema.json +72 -0
  29. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/_common-settings-groupby-schema.json +22 -0
  30. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/_common-settings-legend-position-schema.json +14 -0
  31. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/_common-settings-legend-values-schema.json +19 -0
  32. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/_common-settings-open-stack-schema.json +8 -0
  33. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/_common-settings-show-label-schema.json +8 -0
  34. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/_common-settings-show-line-schema.json +8 -0
  35. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/_common-settings-stack-content-schema.json +12 -0
  36. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/_common-settings-stack-type-schema.json +11 -0
  37. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-alarm-settings-schema.json +48 -0
  38. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-bar-settings-schema.json +69 -0
  39. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-chinamap-settings-schema.json +102 -0
  40. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-funnel-settings-schema.json +34 -0
  41. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-gauge-settings-schema.json +65 -0
  42. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-heatmap-settings-schema.json +50 -0
  43. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-hexgon-settings-schema.json +90 -0
  44. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-histogram-settings-schema.json +47 -0
  45. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-iframe-settings-schema.json +24 -0
  46. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-log-settings-schema.json +84 -0
  47. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-object-settings-schema.json +52 -0
  48. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-picture-settings-schema.json +46 -0
  49. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-pie-settings-schema.json +90 -0
  50. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-sankey-settings-schema.json +34 -0
  51. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-scatter-bubble-settings-schema.json +31 -0
  52. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-sequence-settings-schema.json +76 -0
  53. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-singlestat-settings-schema.json +163 -0
  54. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-table-settings-schema.json +184 -0
  55. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-text-settings-schema.json +20 -0
  56. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-toplist-settings-schema.json +117 -0
  57. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-topology-settings-schema.json +71 -0
  58. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-treemap-settings-schema.json +66 -0
  59. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/chart-worldmap-settings-schema.json +102 -0
  60. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/common-settings-schema.json +82 -0
  61. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/settings-alias-schema.json +47 -0
  62. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/settings-chart-type-schema.json +27 -0
  63. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/settings-colors-schema.json +46 -0
  64. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/settings-compare-schema.json +58 -0
  65. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/settings-fixed-time-schema.json +49 -0
  66. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/settings-levels-schema.json +33 -0
  67. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/settings-schema.json +79 -0
  68. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/settings-time-schema.json +43 -0
  69. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/settings-unit-items-schema.json +228 -0
  70. package/skills/grafana-to-guance-dashboard/schemas/charts/settings/settings-units-schema.json +59 -0
  71. package/skills/grafana-to-guance-dashboard/schemas/dashboard-schema.json +5 -0
  72. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/attribute-mutation-schema.json +21 -0
  73. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/attributes-schema.json +10 -0
  74. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/cdata-node-schema.json +19 -0
  75. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/creation-reason-schema.json +17 -0
  76. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/document-fragment-node-schema.json +35 -0
  77. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/document-node-schema.json +30 -0
  78. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/document-type-node-schema.json +28 -0
  79. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/element-node-schema.json +33 -0
  80. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/frustration-record-schema.json +49 -0
  81. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/full-snapshot-record-schema.json +26 -0
  82. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/incremental-data-schema.json +36 -0
  83. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/incremental-snapshot-record-schema.json +29 -0
  84. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/input-data-schema.json +27 -0
  85. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/input-state-schema.json +27 -0
  86. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/media-interaction-data-schema.json +23 -0
  87. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/media-interaction-schema.json +20 -0
  88. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/mouse-interaction-data-schema.json +23 -0
  89. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/mouse-interaction-schema.json +47 -0
  90. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/mouse-move-data-schema.json +23 -0
  91. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/mouse-position-schema.json +26 -0
  92. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/mutation-data-schema.json +23 -0
  93. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/mutation-payload-schema.json +42 -0
  94. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/node-added-mutation-schema.json +41 -0
  95. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/node-removed-mutation-schema.json +18 -0
  96. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/node-schema.json +28 -0
  97. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/record-schema.json +30 -0
  98. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/scroll-data-schema.json +23 -0
  99. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/scroll-position-schema.json +22 -0
  100. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/segment-metadata-schema.json +28 -0
  101. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/segment-schema.json +25 -0
  102. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/serialized-node-schema.json +15 -0
  103. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/serialized-node-with-id-schema.json +21 -0
  104. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/stylesheet-rule-add-schema.json +28 -0
  105. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/stylesheet-rule-data-schema.json +23 -0
  106. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/stylesheet-rule-delete-schema.json +24 -0
  107. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/stylesheet-rule-schema.json +29 -0
  108. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/stylesheet-schema.json +30 -0
  109. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/text-mutation-schema.json +27 -0
  110. package/skills/grafana-to-guance-dashboard/schemas/session-replay/browser/text-node-schema.json +23 -0
  111. package/skills/grafana-to-guance-dashboard/schemas/session-replay/common/_common-record-schema.json +14 -0
  112. package/skills/grafana-to-guance-dashboard/schemas/session-replay/common/_common-segment-metadata-schema.json +30 -0
  113. package/skills/grafana-to-guance-dashboard/schemas/session-replay/common/_slot-supported-common-record-schema.json +21 -0
  114. package/skills/grafana-to-guance-dashboard/schemas/session-replay/common/focus-record-schema.json +34 -0
  115. package/skills/grafana-to-guance-dashboard/schemas/session-replay/common/meta-record-schema.json +42 -0
  116. package/skills/grafana-to-guance-dashboard/schemas/session-replay/common/pointer-interaction-data-schema.json +23 -0
  117. package/skills/grafana-to-guance-dashboard/schemas/session-replay/common/pointer-interaction-schema.json +34 -0
  118. package/skills/grafana-to-guance-dashboard/schemas/session-replay/common/segment-context-schema.json +46 -0
  119. package/skills/grafana-to-guance-dashboard/schemas/session-replay/common/view-end-record-schema.json +23 -0
  120. package/skills/grafana-to-guance-dashboard/schemas/session-replay/common/viewport-resize-data-schema.json +23 -0
  121. package/skills/grafana-to-guance-dashboard/schemas/session-replay/common/viewport-resize-dimension-schema.json +18 -0
  122. package/skills/grafana-to-guance-dashboard/schemas/session-replay/common/visual-viewport-record-schema.json +50 -0
  123. package/skills/grafana-to-guance-dashboard/schemas/session-replay/full-snapshot-record-schema.json +14 -0
  124. package/skills/grafana-to-guance-dashboard/schemas/session-replay/incremental-data-schema.json +14 -0
  125. package/skills/grafana-to-guance-dashboard/schemas/session-replay/incremental-snapshot-record-schema.json +14 -0
  126. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/_common-shape-wireframe-schema.json +22 -0
  127. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/_common-shape-wireframe-update-schema.json +22 -0
  128. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/_common-wireframe-schema.json +38 -0
  129. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/_common-wireframe-update-schema.json +38 -0
  130. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/full-snapshot-record-schema.json +38 -0
  131. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/image-wireframe-schema.json +43 -0
  132. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/image-wireframe-update-schema.json +43 -0
  133. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/incremental-data-schema.json +21 -0
  134. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/incremental-snapshot-record-schema.json +26 -0
  135. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/mutation-data-schema.json +23 -0
  136. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/mutation-payload-schema.json +55 -0
  137. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/placeholder-wireframe-schema.json +28 -0
  138. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/placeholder-wireframe-update-schema.json +28 -0
  139. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/record-schema.json +27 -0
  140. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/segment-metadata-schema.json +25 -0
  141. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/segment-schema.json +25 -0
  142. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/shape-border-schema.json +25 -0
  143. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/shape-style-schema.json +29 -0
  144. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/shape-wireframe-schema.json +23 -0
  145. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/shape-wireframe-update-schema.json +23 -0
  146. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/text-position-schema.json +57 -0
  147. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/text-style-schema.json +31 -0
  148. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/text-wireframe-schema.json +34 -0
  149. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/text-wireframe-update-schema.json +34 -0
  150. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/touch-data-schema.json +51 -0
  151. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/webview-wireframe-schema.json +33 -0
  152. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/webview-wireframe-update-schema.json +33 -0
  153. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/wireframe-clip-schema.json +29 -0
  154. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/wireframe-schema.json +24 -0
  155. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mobile/wireframe-update-mutation-schema.json +24 -0
  156. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mutation-data-schema.json +14 -0
  157. package/skills/grafana-to-guance-dashboard/schemas/session-replay/mutation-payload-schema.json +14 -0
  158. package/skills/grafana-to-guance-dashboard/schemas/session-replay/record-schema.json +14 -0
  159. package/skills/grafana-to-guance-dashboard/schemas/session-replay/segment-metadata-schema.json +14 -0
  160. package/skills/grafana-to-guance-dashboard/schemas/session-replay/segment-schema.json +15 -0
  161. package/skills/grafana-to-guance-dashboard/schemas/session-replay-browser-schema.json +5 -0
  162. package/skills/grafana-to-guance-dashboard/schemas/session-replay-mobile-schema.json +5 -0
  163. package/skills/grafana-to-guance-dashboard/schemas/session-replay-schema.json +33 -0
  164. package/skills/grafana-to-guance-dashboard/scripts/convert-grafana-dashboard.mjs +8 -13
  165. package/skills/grafana-to-guance-dashboard/scripts/validate-file.mjs +62 -0
  166. package/skills/grafana-to-guance-dashboard/test/convert.test.mjs +54 -0
  167. package/test/cli.test.mjs +27 -1
  168. package/tsconfig.cjs.scripts.json +19 -0
  169. package/tsconfig.esm.scripts.json +19 -0
  170. package/scripts/sync-converter.mjs +0 -57
@@ -0,0 +1,57 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "session-replay/mobile/text-position-schema.json",
4
+ "title": "TextPosition",
5
+ "type": "object",
6
+ "description": "Schema of all properties of a TextPosition.",
7
+ "allOf": [
8
+ {
9
+ "properties": {
10
+ "padding": {
11
+ "type": "object",
12
+ "properties": {
13
+ "top": {
14
+ "type": "integer",
15
+ "description": "The top padding in pixels. The default value is 0.",
16
+ "readOnly": true
17
+ },
18
+ "bottom": {
19
+ "type": "integer",
20
+ "description": "The bottom padding in pixels. The default value is 0.",
21
+ "readOnly": true
22
+ },
23
+ "left": {
24
+ "type": "integer",
25
+ "description": "The left padding in pixels. The default value is 0.",
26
+ "readOnly": true
27
+ },
28
+ "right": {
29
+ "type": "integer",
30
+ "description": "The right padding in pixels. The default value is 0.",
31
+ "readOnly": true
32
+ }
33
+ },
34
+ "readOnly": true
35
+ },
36
+ "alignment": {
37
+ "type": "object",
38
+ "properties": {
39
+ "horizontal": {
40
+ "type": "string",
41
+ "description": "The horizontal text alignment. The default value is `left`.",
42
+ "enum": ["left", "right", "center"],
43
+ "readOnly": true
44
+ },
45
+ "vertical": {
46
+ "type": "string",
47
+ "description": "The vertical text alignment. The default value is `top`.",
48
+ "enum": ["top", "bottom", "center"],
49
+ "readOnly": true
50
+ }
51
+ },
52
+ "readOnly": true
53
+ }
54
+ }
55
+ }
56
+ ]
57
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "session-replay/mobile/text-style-schema.json",
4
+ "title": "TextStyle",
5
+ "type": "object",
6
+ "description": "Schema of all properties of a TextStyle.",
7
+ "allOf": [
8
+ {
9
+ "required": ["color", "family", "size"],
10
+ "properties": {
11
+ "family": {
12
+ "type": "string",
13
+ "description": "The preferred font family collection, ordered by preference and formatted as a String list: e.g. Century Gothic, Verdana, sans-serif",
14
+ "readOnly": true
15
+ },
16
+ "size": {
17
+ "type": "integer",
18
+ "description": "The font size in pixels.",
19
+ "readOnly": true
20
+ },
21
+ "color": {
22
+ "type": "string",
23
+ "pattern": "^#[A-Fa-f0-9]{6}([A-Fa-f0-9]{2})?$",
24
+ "description": "The font color as a string hexadecimal. Follows the #RRGGBBAA color format with the alpha value as optional.",
25
+ "readOnly": true
26
+ }
27
+ },
28
+ "readOnly": true
29
+ }
30
+ ]
31
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "session-replay/mobile/text-wireframe-schema.json",
4
+ "title": "TextWireframe",
5
+ "type": "object",
6
+ "description": "Schema of all properties of a TextWireframe.",
7
+ "allOf": [
8
+ {
9
+ "$ref": "_common-shape-wireframe-schema.json"
10
+ },
11
+ {
12
+ "required": ["text", "type", "textStyle"],
13
+ "properties": {
14
+ "type": {
15
+ "type": "string",
16
+ "description": "The type of the wireframe.",
17
+ "const": "text",
18
+ "readOnly": true
19
+ },
20
+ "text": {
21
+ "type": "string",
22
+ "description": "The text value of the wireframe.",
23
+ "readOnly": false
24
+ },
25
+ "textStyle": {
26
+ "$ref": "text-style-schema.json"
27
+ },
28
+ "textPosition": {
29
+ "$ref": "text-position-schema.json"
30
+ }
31
+ }
32
+ }
33
+ ]
34
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "session-replay/mobile/text-wireframe-update-schema.json",
4
+ "title": "TextWireframeUpdate",
5
+ "type": "object",
6
+ "description": "Schema of all properties of a TextWireframeUpdate.",
7
+ "allOf": [
8
+ {
9
+ "$ref": "_common-shape-wireframe-update-schema.json"
10
+ },
11
+ {
12
+ "required": ["type"],
13
+ "properties": {
14
+ "type": {
15
+ "type": "string",
16
+ "description": "The type of the wireframe.",
17
+ "const": "text",
18
+ "readOnly": true
19
+ },
20
+ "text": {
21
+ "type": "string",
22
+ "description": "The text value of the wireframe.",
23
+ "readOnly": false
24
+ },
25
+ "textStyle": {
26
+ "$ref": "text-style-schema.json"
27
+ },
28
+ "textPosition": {
29
+ "$ref": "text-position-schema.json"
30
+ }
31
+ }
32
+ }
33
+ ]
34
+ }
@@ -0,0 +1,51 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "session-replay/mobile/touch-data-schema.json",
4
+ "title": "TouchData",
5
+ "type": "object",
6
+ "description": "Schema of a TouchData.",
7
+ "allOf": [
8
+ {
9
+ "required": ["source"],
10
+ "properties": {
11
+ "source": {
12
+ "type": "integer",
13
+ "const": 2,
14
+ "description": "The source of this type of incremental data.",
15
+ "readOnly": true
16
+ },
17
+ "positions": {
18
+ "type": "array",
19
+ "readOnly": true,
20
+ "items": {
21
+ "type": "object",
22
+ "required": ["id", "x", "y", "timestamp"],
23
+ "properties": {
24
+ "id": {
25
+ "type": "integer",
26
+ "description": "The touch id of the touch event this position corresponds to. In mobile it is possible to have multiple touch events (fingers touching the screen) happening at the same time.",
27
+ "readOnly": true
28
+ },
29
+ "x": {
30
+ "type": "integer",
31
+ "description": "The x coordinate value of the position.",
32
+ "readOnly": true
33
+ },
34
+ "y": {
35
+ "type": "integer",
36
+ "description": "The y coordinate value of the position.",
37
+ "readOnly": true
38
+ },
39
+ "timestamp": {
40
+ "type": "integer",
41
+ "description": "The UTC timestamp in milliseconds corresponding to the moment the position change was recorded. Each timestamp is computed as the UTC interval since 00:00:00.000 01.01.1970.",
42
+ "readOnly": true
43
+ }
44
+ }
45
+ },
46
+ "description": "Contains the positions of the finger on the screen during the touchDown/touchUp event lifecycle."
47
+ }
48
+ }
49
+ }
50
+ ]
51
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "session-replay/mobile/webview-wireframe-schema.json",
4
+ "title": "WebviewWireframe",
5
+ "type": "object",
6
+ "description": "Schema of all properties of a WebviewWireframe.",
7
+ "allOf": [
8
+ {
9
+ "$ref": "_common-shape-wireframe-schema.json"
10
+ },
11
+ {
12
+ "required": ["type", "slotId"],
13
+ "properties": {
14
+ "type": {
15
+ "type": "string",
16
+ "description": "The type of the wireframe.",
17
+ "const": "webview",
18
+ "readOnly": true
19
+ },
20
+ "slotId": {
21
+ "type": "string",
22
+ "description": "Unique Id of the slot containing this webview.",
23
+ "readOnly": true
24
+ },
25
+ "isVisible": {
26
+ "type": "boolean",
27
+ "description": "Whether this webview is visible or not.",
28
+ "readOnly": true
29
+ }
30
+ }
31
+ }
32
+ ]
33
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "session-replay/mobile/webview-wireframe-update-schema.json",
4
+ "title": "WebviewWireframeUpdate",
5
+ "type": "object",
6
+ "description": "Schema of all properties of a WebviewWireframeUpdate.",
7
+ "allOf": [
8
+ {
9
+ "$ref": "_common-shape-wireframe-update-schema.json"
10
+ },
11
+ {
12
+ "required": ["type", "slotId"],
13
+ "properties": {
14
+ "type": {
15
+ "type": "string",
16
+ "description": "The type of the wireframe.",
17
+ "const": "webview",
18
+ "readOnly": true
19
+ },
20
+ "slotId": {
21
+ "type": "string",
22
+ "description": "Unique Id of the slot containing this webview.",
23
+ "readOnly": true
24
+ },
25
+ "isVisible": {
26
+ "type": "boolean",
27
+ "description": "Whether this webview is visible or not.",
28
+ "readOnly": true
29
+ }
30
+ }
31
+ }
32
+ ]
33
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "session-replay/mobile/wireframe-clip-schema.json",
4
+ "title": "WireframeClip",
5
+ "type": "object",
6
+ "description": "Schema of clipping information for a Wireframe.",
7
+ "properties": {
8
+ "top": {
9
+ "type": "integer",
10
+ "description": "The amount of space in pixels that needs to be clipped (masked) at the top of the wireframe.",
11
+ "readOnly": true
12
+ },
13
+ "bottom": {
14
+ "type": "integer",
15
+ "description": "The amount of space in pixels that needs to be clipped (masked) at the bottom of the wireframe.",
16
+ "readOnly": true
17
+ },
18
+ "left": {
19
+ "type": "integer",
20
+ "description": "The amount of space in pixels that needs to be clipped (masked) at the left of the wireframe.",
21
+ "readOnly": true
22
+ },
23
+ "right": {
24
+ "type": "integer",
25
+ "description": "The amount of space in pixels that needs to be clipped (masked) at the right of the wireframe.",
26
+ "readOnly": true
27
+ }
28
+ }
29
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "session-replay/mobile/wireframe-schema.json",
4
+ "title": "Wireframe",
5
+ "type": "object",
6
+ "description": "Schema of a Wireframe type.",
7
+ "oneOf": [
8
+ {
9
+ "$ref": "shape-wireframe-schema.json"
10
+ },
11
+ {
12
+ "$ref": "text-wireframe-schema.json"
13
+ },
14
+ {
15
+ "$ref": "image-wireframe-schema.json"
16
+ },
17
+ {
18
+ "$ref": "placeholder-wireframe-schema.json"
19
+ },
20
+ {
21
+ "$ref": "webview-wireframe-schema.json"
22
+ }
23
+ ]
24
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "session-replay/mobile/wireframe-update-mutation-schema.json",
4
+ "title": "WireframeUpdateMutation",
5
+ "type": "object",
6
+ "description": "Schema of a WireframeUpdateMutation type.",
7
+ "oneOf": [
8
+ {
9
+ "$ref": "text-wireframe-update-schema.json"
10
+ },
11
+ {
12
+ "$ref": "shape-wireframe-update-schema.json"
13
+ },
14
+ {
15
+ "$ref": "image-wireframe-update-schema.json"
16
+ },
17
+ {
18
+ "$ref": "placeholder-wireframe-update-schema.json"
19
+ },
20
+ {
21
+ "$ref": "webview-wireframe-update-schema.json"
22
+ }
23
+ ]
24
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "session-replay/mutation-data-schema.json",
4
+ "title": "MutationData",
5
+ "description": "Schema of a MutationData.",
6
+ "oneOf": [
7
+ {
8
+ "$ref": "browser/mutation-data-schema.json"
9
+ },
10
+ {
11
+ "$ref": "mobile/mutation-data-schema.json"
12
+ }
13
+ ]
14
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "session-replay/mutation-payload-schema.json",
4
+ "title": "MutationPayload",
5
+ "description": "Schema of a MutationPayload.",
6
+ "oneOf": [
7
+ {
8
+ "$ref": "browser/mutation-payload-schema.json"
9
+ },
10
+ {
11
+ "$ref": "mobile/mutation-payload-schema.json"
12
+ }
13
+ ]
14
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "session-replay/record-schema.json",
4
+ "title": "Record",
5
+ "description": "Schema of a Session Replay Record.",
6
+ "oneOf": [
7
+ {
8
+ "$ref": "browser/record-schema.json"
9
+ },
10
+ {
11
+ "$ref": "mobile/record-schema.json"
12
+ }
13
+ ]
14
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "session-replay/segment-metadata-schema.json",
4
+ "title": "SegmentMetadata",
5
+ "description": "Schema of a Session Replay SegmentMetadata.",
6
+ "oneOf": [
7
+ {
8
+ "$ref": "browser/segment-metadata-schema.json"
9
+ },
10
+ {
11
+ "$ref": "mobile/segment-metadata-schema.json"
12
+ }
13
+ ]
14
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "session-replay/segment-schema.json",
4
+ "title": "Segment",
5
+ "type": "object",
6
+ "description": "Schema of a Session Replay data Segment.",
7
+ "oneOf": [
8
+ {
9
+ "$ref": "browser/segment-schema.json"
10
+ },
11
+ {
12
+ "$ref": "mobile/segment-schema.json"
13
+ }
14
+ ]
15
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "session-replay-browser-schema.json",
4
+ "$ref": "session-replay/browser/segment-schema.json"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "session-replay-mobile-schema.json",
4
+ "$ref": "session-replay/mobile/segment-schema.json"
5
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "session-replay-schema.json",
4
+ "title": "SessionReplay",
5
+ "type": "object",
6
+ "description": "Schema of all properties of Session Replay",
7
+ "allOf": [
8
+ {
9
+ "$ref": "session-replay/segment-schema.json"
10
+ },
11
+ {
12
+ "$ref": "session-replay/segment-metadata-schema.json"
13
+ },
14
+ {
15
+ "$ref": "session-replay/record-schema.json"
16
+ },
17
+ {
18
+ "$ref": "session-replay/full-snapshot-record-schema.json"
19
+ },
20
+ {
21
+ "$ref": "session-replay/incremental-snapshot-record-schema.json"
22
+ },
23
+ {
24
+ "$ref": "session-replay/incremental-data-schema.json"
25
+ },
26
+ {
27
+ "$ref": "session-replay/mutation-data-schema.json"
28
+ },
29
+ {
30
+ "$ref": "session-replay/mutation-payload-schema.json"
31
+ }
32
+ ]
33
+ }
@@ -4,6 +4,8 @@ import path from 'path';
4
4
  import { pathToFileURL } from 'url';
5
5
  import Ajv from 'ajv';
6
6
  import { convertDashboard } from './convert-grafana-dashboard-core.js';
7
+ const SCRIPT_DIRECTORY = path.dirname(new URL(import.meta.url).pathname);
8
+ const SKILL_ROOT = path.resolve(SCRIPT_DIRECTORY, '..');
7
9
  if (isDirectExecution()) {
8
10
  main();
9
11
  }
@@ -75,8 +77,7 @@ function printHelp() {
75
77
  console.error('Usage: node convert-grafana-dashboard.mjs --input <grafana.json> [--output <guance.json>] [--validate] [--schema <schema-id>] [--guance-promql-compatible] [--keep-grafana-meta]');
76
78
  }
77
79
  export function validateDashboardFile(filePath, schemaId) {
78
- const projectRoot = findProjectRoot();
79
- const schemasDirectory = path.join(projectRoot, 'schemas');
80
+ const schemasDirectory = resolveSchemasDirectory();
80
81
  const ajv = new Ajv({ allErrors: true });
81
82
  forEachFile(schemasDirectory, (schemaPath) => {
82
83
  if (!schemaPath.endsWith('.json'))
@@ -95,18 +96,12 @@ export function validateDashboardFile(filePath, schemaId) {
95
96
  }
96
97
  process.exit(1);
97
98
  }
98
- function findProjectRoot() {
99
- let currentDirectory = process.cwd();
100
- while (true) {
101
- if (fs.existsSync(path.join(currentDirectory, 'schemas', 'dashboard-schema.json'))) {
102
- return currentDirectory;
103
- }
104
- const parentDirectory = path.dirname(currentDirectory);
105
- if (parentDirectory === currentDirectory) {
106
- throw new Error('Could not locate project root containing schemas/dashboard-schema.json');
107
- }
108
- currentDirectory = parentDirectory;
99
+ function resolveSchemasDirectory() {
100
+ const skillSchemasDirectory = path.join(SKILL_ROOT, 'schemas');
101
+ if (fs.existsSync(path.join(skillSchemasDirectory, 'dashboard-schema.json'))) {
102
+ return skillSchemasDirectory;
109
103
  }
104
+ throw new Error(`Could not locate standalone schemas at ${skillSchemasDirectory}`);
110
105
  }
111
106
  function readJson(filePath) {
112
107
  return JSON.parse(fs.readFileSync(filePath, 'utf8'));
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env node
2
+ import Ajv from 'ajv';
3
+ import fs from 'fs';
4
+ import path from 'path';
5
+
6
+ const SCRIPT_DIRECTORY = path.dirname(new URL(import.meta.url).pathname);
7
+ const SKILL_ROOT = path.resolve(SCRIPT_DIRECTORY, '..');
8
+ const SCHEMAS_DIRECTORY = path.join(SKILL_ROOT, 'schemas');
9
+
10
+ const args = process.argv.slice(2);
11
+ const schemaFlagIndex = args.indexOf('--schema');
12
+ const schemaId = schemaFlagIndex >= 0 ? args[schemaFlagIndex + 1] : 'dashboard-schema.json';
13
+ const jsonPaths = schemaFlagIndex >= 0 ? args.filter((_, index) => index !== schemaFlagIndex && index !== schemaFlagIndex + 1) : args;
14
+
15
+ if (jsonPaths.length === 0) {
16
+ console.error('Usage: node scripts/validate-file.mjs <json-path...> [--schema <schema-id>]');
17
+ process.exit(1);
18
+ }
19
+ if (!fs.existsSync(path.join(SCHEMAS_DIRECTORY, 'dashboard-schema.json'))) {
20
+ console.error(`Could not locate standalone schemas at ${SCHEMAS_DIRECTORY}`);
21
+ process.exit(1);
22
+ }
23
+
24
+ const ajv = new Ajv({ allErrors: true });
25
+ forEachFile(SCHEMAS_DIRECTORY, (schemaPath) => {
26
+ if (!schemaPath.endsWith('.json'))
27
+ return;
28
+ ajv.addSchema(readJson(schemaPath));
29
+ });
30
+
31
+ let hasError = false;
32
+ for (const jsonPath of jsonPaths) {
33
+ const valid = ajv.validate(schemaId, readJson(jsonPath));
34
+ if (valid) {
35
+ console.log(`Validated ${jsonPath} against ${schemaId}`);
36
+ continue;
37
+ }
38
+ hasError = true;
39
+ console.error(`Validation failed for ${jsonPath} against ${schemaId}:`);
40
+ for (const error of ajv.errors || []) {
41
+ const instancePath = error.instancePath || '/';
42
+ console.error(`- ${instancePath} ${error.message}`);
43
+ }
44
+ }
45
+
46
+ process.exit(hasError ? 1 : 0);
47
+
48
+ function forEachFile(directoryPath, visitor) {
49
+ const entries = fs.readdirSync(directoryPath, { withFileTypes: true });
50
+ for (const entry of entries) {
51
+ const entryPath = path.join(directoryPath, entry.name);
52
+ if (entry.isDirectory()) {
53
+ forEachFile(entryPath, visitor);
54
+ continue;
55
+ }
56
+ visitor(entryPath);
57
+ }
58
+ }
59
+
60
+ function readJson(filePath) {
61
+ return JSON.parse(fs.readFileSync(filePath, 'utf8'));
62
+ }
@@ -0,0 +1,54 @@
1
+ import test from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import fs from 'node:fs';
4
+ import os from 'node:os';
5
+ import path from 'node:path';
6
+ import { execFileSync } from 'node:child_process';
7
+
8
+ const TEST_DIRECTORY = path.dirname(new URL(import.meta.url).pathname);
9
+ const SKILL_ROOT = path.resolve(TEST_DIRECTORY, '..');
10
+ const FIXTURE_INPUT = path.join(SKILL_ROOT, 'fixtures', 'grafana-dashboard.json');
11
+ const FIXTURE_DASHBOARD = JSON.parse(fs.readFileSync(FIXTURE_INPUT, 'utf8'));
12
+
13
+ test('standalone converter produces schema-valid dashboard output', () => {
14
+ const tempDirectory = fs.mkdtempSync(path.join(os.tmpdir(), 'grafana-to-guance-skill-'));
15
+ const outputPath = path.join(tempDirectory, 'dashboard.guance.json');
16
+
17
+ execFileSync(
18
+ process.execPath,
19
+ ['scripts/convert-grafana-dashboard.mjs', '--input', FIXTURE_INPUT, '--output', outputPath, '--validate'],
20
+ {
21
+ cwd: SKILL_ROOT,
22
+ stdio: 'pipe',
23
+ }
24
+ );
25
+
26
+ const output = JSON.parse(fs.readFileSync(outputPath, 'utf8'));
27
+ assert.equal(output.title, FIXTURE_DASHBOARD.title);
28
+ assert.equal(output.main.type, 'template');
29
+ assert.ok(Array.isArray(output.main.charts));
30
+ assert.ok(output.main.charts.length > 0);
31
+ });
32
+
33
+ test('standalone validator accepts generated dashboard output', () => {
34
+ const tempDirectory = fs.mkdtempSync(path.join(os.tmpdir(), 'grafana-to-guance-skill-'));
35
+ const outputPath = path.join(tempDirectory, 'dashboard.guance.json');
36
+
37
+ execFileSync(
38
+ process.execPath,
39
+ ['scripts/convert-grafana-dashboard.mjs', '--input', FIXTURE_INPUT, '--output', outputPath],
40
+ {
41
+ cwd: SKILL_ROOT,
42
+ stdio: 'pipe',
43
+ }
44
+ );
45
+
46
+ execFileSync(
47
+ process.execPath,
48
+ ['scripts/validate-file.mjs', outputPath],
49
+ {
50
+ cwd: SKILL_ROOT,
51
+ stdio: 'pipe',
52
+ }
53
+ );
54
+ });