@qoretechnologies/reqraft 0.1.0 → 0.2.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.
Files changed (133) hide show
  1. package/__tests__/ mock.ts +44 -0
  2. package/__tests__/utils.ts +11 -0
  3. package/dist/__tests__/ mock.d.ts +23 -0
  4. package/dist/__tests__/ mock.d.ts.map +1 -0
  5. package/dist/__tests__/ mock.js +44 -0
  6. package/dist/__tests__/ mock.js.map +1 -0
  7. package/dist/__tests__/utils.d.ts +3 -0
  8. package/dist/__tests__/utils.d.ts.map +1 -0
  9. package/dist/__tests__/utils.js +60 -0
  10. package/dist/__tests__/utils.js.map +1 -0
  11. package/dist/mock/interfaceCategories.json +155 -0
  12. package/dist/mock/menu.d.ts +70 -0
  13. package/dist/mock/menu.d.ts.map +1 -0
  14. package/dist/mock/menu.js +301 -0
  15. package/dist/mock/menu.js.map +1 -0
  16. package/dist/src/components/form/fields/Field.d.ts.map +1 -0
  17. package/dist/src/components/form/fields/Field.js.map +1 -0
  18. package/dist/src/components/form/fields/string/String.d.ts.map +1 -0
  19. package/dist/src/components/form/fields/string/String.js.map +1 -0
  20. package/dist/src/components/form/fields/string/String.stories.d.ts.map +1 -0
  21. package/dist/src/components/form/fields/string/String.stories.js.map +1 -0
  22. package/dist/src/components/menu/Menu.d.ts +31 -0
  23. package/dist/src/components/menu/Menu.d.ts.map +1 -0
  24. package/dist/src/components/menu/Menu.js +130 -0
  25. package/dist/src/components/menu/Menu.js.map +1 -0
  26. package/dist/src/components/menu/Menu.stories.d.ts +12 -0
  27. package/dist/src/components/menu/Menu.stories.d.ts.map +1 -0
  28. package/dist/src/components/menu/Menu.stories.js +159 -0
  29. package/dist/src/components/menu/Menu.stories.js.map +1 -0
  30. package/dist/src/contexts/FetchContext.d.ts +10 -0
  31. package/dist/src/contexts/FetchContext.d.ts.map +1 -0
  32. package/dist/src/contexts/FetchContext.js +63 -0
  33. package/dist/src/contexts/FetchContext.js.map +1 -0
  34. package/dist/src/contexts/ReqraftContext.d.ts +9 -0
  35. package/dist/src/contexts/ReqraftContext.d.ts.map +1 -0
  36. package/dist/src/contexts/ReqraftContext.js +11 -0
  37. package/dist/src/contexts/ReqraftContext.js.map +1 -0
  38. package/dist/src/contexts/StorageContext.d.ts +11 -0
  39. package/dist/src/contexts/StorageContext.d.ts.map +1 -0
  40. package/dist/src/contexts/StorageContext.js +17 -0
  41. package/dist/src/contexts/StorageContext.js.map +1 -0
  42. package/dist/src/hooks/useFetch/useFetch.d.ts +21 -0
  43. package/dist/src/hooks/useFetch/useFetch.d.ts.map +1 -0
  44. package/dist/src/hooks/useFetch/useFetch.js +106 -0
  45. package/dist/src/hooks/useFetch/useFetch.js.map +1 -0
  46. package/dist/src/hooks/useFetch/useFetch.stories.d.ts +9 -0
  47. package/dist/src/hooks/useFetch/useFetch.stories.d.ts.map +1 -0
  48. package/dist/src/hooks/useFetch/useFetch.stories.js +177 -0
  49. package/dist/src/hooks/useFetch/useFetch.stories.js.map +1 -0
  50. package/dist/src/hooks/useReqraftProperty.d.ts +3 -0
  51. package/dist/src/hooks/useReqraftProperty.d.ts.map +1 -0
  52. package/dist/src/hooks/useReqraftProperty.js +16 -0
  53. package/dist/src/hooks/useReqraftProperty.js.map +1 -0
  54. package/dist/src/hooks/useStorage/useStorage.d.ts +8 -0
  55. package/dist/src/hooks/useStorage/useStorage.d.ts.map +1 -0
  56. package/dist/src/hooks/useStorage/useStorage.js +22 -0
  57. package/dist/src/hooks/useStorage/useStorage.js.map +1 -0
  58. package/dist/src/hooks/useStorage/useStorage.stories.d.ts +9 -0
  59. package/dist/src/hooks/useStorage/useStorage.stories.d.ts.map +1 -0
  60. package/dist/src/hooks/useStorage/useStorage.stories.js +162 -0
  61. package/dist/src/hooks/useStorage/useStorage.stories.js.map +1 -0
  62. package/dist/src/hooks/useValidation.d.ts.map +1 -0
  63. package/dist/src/hooks/useValidation.js.map +1 -0
  64. package/dist/src/index.d.ts +6 -0
  65. package/dist/src/index.d.ts.map +1 -0
  66. package/dist/src/index.js +15 -0
  67. package/dist/src/index.js.map +1 -0
  68. package/dist/src/providers/FetchProvider.d.ts +6 -0
  69. package/dist/src/providers/FetchProvider.d.ts.map +1 -0
  70. package/dist/src/providers/FetchProvider.js +112 -0
  71. package/dist/src/providers/FetchProvider.js.map +1 -0
  72. package/dist/src/providers/ReqraftProvider.d.ts +10 -0
  73. package/dist/src/providers/ReqraftProvider.d.ts.map +1 -0
  74. package/dist/src/providers/ReqraftProvider.js +15 -0
  75. package/dist/src/providers/ReqraftProvider.js.map +1 -0
  76. package/dist/src/providers/StorageProvider.d.ts +6 -0
  77. package/dist/src/providers/StorageProvider.d.ts.map +1 -0
  78. package/dist/src/providers/StorageProvider.js +55 -0
  79. package/dist/src/providers/StorageProvider.js.map +1 -0
  80. package/dist/src/types/Form.d.ts.map +1 -0
  81. package/dist/{types → src/types}/Form.js.map +1 -1
  82. package/dist/src/types.d.ts.map +1 -0
  83. package/dist/src/types.js.map +1 -0
  84. package/dist/src/utils/fetch.d.ts +22 -0
  85. package/dist/src/utils/fetch.d.ts.map +1 -0
  86. package/dist/src/utils/fetch.js +140 -0
  87. package/dist/src/utils/fetch.js.map +1 -0
  88. package/mock/interfaceCategories.json +155 -0
  89. package/mock/menu.ts +301 -0
  90. package/package.json +8 -3
  91. package/src/components/menu/Menu.stories.tsx +73 -0
  92. package/src/components/menu/Menu.tsx +244 -0
  93. package/src/contexts/FetchContext.tsx +25 -0
  94. package/src/contexts/ReqraftContext.tsx +16 -0
  95. package/src/contexts/StorageContext.tsx +33 -0
  96. package/src/hooks/useFetch/useFetch.stories.tsx +123 -0
  97. package/src/hooks/useFetch/useFetch.tsx +71 -0
  98. package/src/hooks/useReqraftProperty.ts +16 -0
  99. package/src/hooks/useStorage/useStorage.stories.tsx +84 -0
  100. package/src/hooks/useStorage/useStorage.ts +30 -0
  101. package/src/index.tsx +11 -0
  102. package/src/providers/FetchProvider.tsx +62 -0
  103. package/src/providers/ReqraftProvider.tsx +33 -0
  104. package/src/providers/StorageProvider.tsx +80 -0
  105. package/src/utils/fetch.ts +121 -0
  106. package/tests.json +1 -1
  107. package/dist/components/form/fields/Field.d.ts.map +0 -1
  108. package/dist/components/form/fields/Field.js.map +0 -1
  109. package/dist/components/form/fields/string/String.d.ts.map +0 -1
  110. package/dist/components/form/fields/string/String.js.map +0 -1
  111. package/dist/components/form/fields/string/String.stories.d.ts.map +0 -1
  112. package/dist/components/form/fields/string/String.stories.js.map +0 -1
  113. package/dist/hooks/useValidation.d.ts.map +0 -1
  114. package/dist/hooks/useValidation.js.map +0 -1
  115. package/dist/index.d.ts +0 -2
  116. package/dist/index.d.ts.map +0 -1
  117. package/dist/index.js +0 -6
  118. package/dist/index.js.map +0 -1
  119. package/dist/types/Form.d.ts.map +0 -1
  120. package/dist/types.d.ts.map +0 -1
  121. package/dist/types.js.map +0 -1
  122. /package/dist/{components → src/components}/form/fields/Field.d.ts +0 -0
  123. /package/dist/{components → src/components}/form/fields/Field.js +0 -0
  124. /package/dist/{components → src/components}/form/fields/string/String.d.ts +0 -0
  125. /package/dist/{components → src/components}/form/fields/string/String.js +0 -0
  126. /package/dist/{components → src/components}/form/fields/string/String.stories.d.ts +0 -0
  127. /package/dist/{components → src/components}/form/fields/string/String.stories.js +0 -0
  128. /package/dist/{hooks → src/hooks}/useValidation.d.ts +0 -0
  129. /package/dist/{hooks → src/hooks}/useValidation.js +0 -0
  130. /package/dist/{types → src/types}/Form.d.ts +0 -0
  131. /package/dist/{types → src/types}/Form.js +0 -0
  132. /package/dist/{types.d.ts → src/types.d.ts} +0 -0
  133. /package/dist/{types.js → src/types.js} +0 -0
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.query = exports.setupFetch = void 0;
40
+ var ReqraftProvider_1 = require("../providers/ReqraftProvider");
41
+ var fetchConfig = {
42
+ instance: window.location.origin + '/',
43
+ instanceToken: '',
44
+ unauthorizedRedirect: function (pathname) { return "/?next=".concat(pathname); },
45
+ };
46
+ var CACHE_EXPIRATION_TIME = 5 * 60 * 1000; // 5 minutes
47
+ var setupFetch = function (_a) {
48
+ var instance = _a.instance, instanceToken = _a.instanceToken, unauthorizedRedirect = _a.unauthorizedRedirect;
49
+ fetchConfig.instance = instance;
50
+ fetchConfig.instanceToken = instanceToken;
51
+ if (unauthorizedRedirect) {
52
+ fetchConfig.unauthorizedRedirect = unauthorizedRedirect;
53
+ }
54
+ };
55
+ exports.setupFetch = setupFetch;
56
+ function doFetchData(url_1) {
57
+ return __awaiter(this, arguments, void 0, function (url, method, body) {
58
+ if (method === void 0) { method = 'GET'; }
59
+ return __generator(this, function (_a) {
60
+ if (!fetchConfig.instanceToken) {
61
+ return [2 /*return*/, new Response(JSON.stringify({}), {
62
+ status: 401,
63
+ statusText: 'Unauthorized',
64
+ })];
65
+ }
66
+ return [2 /*return*/, fetch("".concat(fetchConfig.instance, "api/latest/").concat(url), {
67
+ method: method,
68
+ headers: {
69
+ 'Content-Type': 'application/json',
70
+ Authorization: "Bearer ".concat(fetchConfig.instanceToken),
71
+ },
72
+ body: JSON.stringify(body),
73
+ }).catch(function (error) {
74
+ return new Response(JSON.stringify({}), {
75
+ status: 500,
76
+ statusText: "Request failed ".concat(error.message),
77
+ });
78
+ })];
79
+ });
80
+ });
81
+ }
82
+ function query(_a) {
83
+ return __awaiter(this, arguments, void 0, function (_b) {
84
+ var shouldCache, cacheKey, requestData;
85
+ var _this = this;
86
+ var url = _b.url, _c = _b.method, method = _c === void 0 ? 'GET' : _c, body = _b.body, _d = _b.cache, cache = _d === void 0 ? true : _d, _e = _b.queryClient, queryClient = _e === void 0 ? ReqraftProvider_1.ReqraftQueryClient : _e;
87
+ return __generator(this, function (_f) {
88
+ switch (_f.label) {
89
+ case 0:
90
+ shouldCache = method === 'DELETE' || method === 'POST' ? false : cache;
91
+ cacheKey = "".concat(url, ":").concat(method, ":").concat(JSON.stringify(body || {}));
92
+ return [4 /*yield*/, queryClient.fetchQuery({
93
+ queryKey: [cacheKey],
94
+ queryFn: function () { return __awaiter(_this, void 0, void 0, function () {
95
+ var response, clone, json;
96
+ return __generator(this, function (_a) {
97
+ switch (_a.label) {
98
+ case 0: return [4 /*yield*/, doFetchData(url, method, body)];
99
+ case 1:
100
+ response = _a.sent();
101
+ clone = response.clone();
102
+ return [4 /*yield*/, clone.json()];
103
+ case 2:
104
+ json = _a.sent();
105
+ if (response.status === 401) {
106
+ window.location.href = fetchConfig.unauthorizedRedirect(window.location.pathname);
107
+ }
108
+ return [2 /*return*/, {
109
+ data: json,
110
+ ok: response.ok,
111
+ status: response.status,
112
+ statusText: response.statusText,
113
+ }];
114
+ }
115
+ });
116
+ }); },
117
+ staleTime: shouldCache ? CACHE_EXPIRATION_TIME : 0,
118
+ })];
119
+ case 1:
120
+ requestData = _f.sent();
121
+ if (!requestData.ok) {
122
+ queryClient.invalidateQueries({ queryKey: [cacheKey] });
123
+ return [2 /*return*/, {
124
+ data: null,
125
+ ok: false,
126
+ code: requestData.status,
127
+ error: requestData.statusText,
128
+ }];
129
+ }
130
+ return [2 /*return*/, {
131
+ data: requestData.data,
132
+ ok: true,
133
+ code: requestData.status,
134
+ }];
135
+ }
136
+ });
137
+ });
138
+ }
139
+ exports.query = query;
140
+ //# sourceMappingURL=fetch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../src/utils/fetch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,gEAAkE;AAelE,IAAM,WAAW,GAAwB;IACvC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,GAAG;IACtC,aAAa,EA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,CAAC,CAAC;yBACnD,CAAC,EAAA;;oBApBI,WAAW,GAAG,SAoBlB;oBAEF,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC;wBACpB,WAAW,CAAC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;wBAExD,sBAAO;gCACL,IAAI,EAAE,IAAI;gCACV,EAAE,EAAE,KAAK;gCACT,IAAI,EAAE,WAAW,CAAC,MAAM;gCACxB,KAAK,EAAE,WAAW,CAAC,UAAU;6BAC9B,EAAC;oBACJ,CAAC;oBAED,sBAAO;4BACL,IAAI,EAAE,WAAW,CAAC,IAAI;4BACtB,EAAE,EAAE,IAAI;4BACR,IAAI,EAAE,WAAW,CAAC,MAAM;yBACzB,EAAC;;;;CACH;AAhDD,sBAgDC"}
@@ -0,0 +1,155 @@
1
+ {
2
+ "fsm": {
3
+ "singular_display_name": "Qog",
4
+ "display_name": "Qogs",
5
+ "short_desc": "Qogs are no-code logic elements based on finite state machines; they can be used anywhere in Qorus as an alternative to coding",
6
+ "supports_code": false,
7
+ "url_root": "fsms",
8
+ "drafts": 2,
9
+ "items": 49
10
+ },
11
+ "connection": {
12
+ "singular_display_name": "Connection",
13
+ "display_name": "Connections",
14
+ "short_desc": "Connections to remote systems",
15
+ "supports_code": false,
16
+ "url_root": "connections",
17
+ "drafts": 0,
18
+ "items": 25
19
+ },
20
+ "class": {
21
+ "singular_display_name": "Class",
22
+ "display_name": "Classes",
23
+ "short_desc": "Classes that can be used in Qorus interface code",
24
+ "supports_code": true,
25
+ "url_root": "classes",
26
+ "drafts": 0,
27
+ "items": 192
28
+ },
29
+ "errors": {
30
+ "singular_display_name": "Error",
31
+ "display_name": "Errors",
32
+ "short_desc": "Workflow error set definitions",
33
+ "supports_code": false,
34
+ "url_root": "error-sets",
35
+ "drafts": 0,
36
+ "items": 14
37
+ },
38
+ "event": {
39
+ "singular_display_name": "Workflow Sync Event",
40
+ "display_name": "Workflow Sync Events",
41
+ "short_desc": "Workflow synchronization events",
42
+ "supports_code": false,
43
+ "url_root": "events",
44
+ "drafts": 0,
45
+ "items": 9
46
+ },
47
+ "group": {
48
+ "singular_display_name": "Interface Group",
49
+ "display_name": "Interface Groups",
50
+ "short_desc": "Interface groups allow interfaces to be enabled and disabled together as well as enabling views on interfaces to be restricted for certain users",
51
+ "supports_code": false,
52
+ "url_root": "groups",
53
+ "drafts": 0,
54
+ "items": 102
55
+ },
56
+ "job": {
57
+ "singular_display_name": "Scheduled Job",
58
+ "display_name": "Scheduled Jobs",
59
+ "short_desc": "Jobs execute logic on a user-defined schedule",
60
+ "supports_code": true,
61
+ "url_root": "jobs",
62
+ "drafts": 0,
63
+ "items": 91
64
+ },
65
+ "mapper": {
66
+ "singular_display_name": "Mapper",
67
+ "display_name": "Mappers",
68
+ "short_desc": "Mappers are visual data transformation elements",
69
+ "supports_code": false,
70
+ "url_root": "mappers",
71
+ "drafts": 0,
72
+ "items": 37
73
+ },
74
+ "mapper-code": {
75
+ "singular_display_name": "Mapper Code Object",
76
+ "display_name": "Mapper Code",
77
+ "short_desc": "Mapper code elements are classes with methods that can be directly used in mappers for complex data transformation logic",
78
+ "supports_code": true,
79
+ "url_root": "classes",
80
+ "drafts": 0,
81
+ "items": 3
82
+ },
83
+ "pipeline": {
84
+ "singular_display_name": "Data Pipeline",
85
+ "display_name": "Data Pipelines",
86
+ "short_desc": "Data pipelines enable large volumes of data to be processed efficiently",
87
+ "supports_code": false,
88
+ "url_root": "pipelines",
89
+ "drafts": 0,
90
+ "items": 15
91
+ },
92
+ "queue": {
93
+ "singular_display_name": "Asynchronous Step Queue",
94
+ "display_name": "Asynchronous Step Queues",
95
+ "short_desc": "Asynchronous step queues connect the front end to the back end of asynchronous workflow steps",
96
+ "supports_code": false,
97
+ "url_root": "queues",
98
+ "drafts": 0,
99
+ "items": 13
100
+ },
101
+ "service": {
102
+ "singular_display_name": "Service",
103
+ "display_name": "Services",
104
+ "short_desc": "Services are a top-level interfacing object in Qorus",
105
+ "supports_code": true,
106
+ "url_root": "services",
107
+ "drafts": 0,
108
+ "items": 117
109
+ },
110
+ "sla": {
111
+ "singular_display_name": "SLA",
112
+ "display_name": "SLAs",
113
+ "short_desc": "SLAs track technical performance metrics with business impact",
114
+ "supports_code": false,
115
+ "url_root": "slas",
116
+ "drafts": 0,
117
+ "items": 5
118
+ },
119
+ "step": {
120
+ "singular_display_name": "Step",
121
+ "display_name": "Steps",
122
+ "short_desc": "Steps are an atomic execution element in a workflow",
123
+ "supports_code": true,
124
+ "url_root": "steps",
125
+ "drafts": 0,
126
+ "items": 233
127
+ },
128
+ "type": {
129
+ "singular_display_name": "Type",
130
+ "display_name": "Types",
131
+ "short_desc": "Data types",
132
+ "supports_code": false,
133
+ "url_root": "types",
134
+ "drafts": 0,
135
+ "items": 97
136
+ },
137
+ "value-map": {
138
+ "singular_display_name": "Value Map",
139
+ "display_name": "Value Maps",
140
+ "short_desc": "Value maps provide simple mappings from one value to another",
141
+ "supports_code": false,
142
+ "url_root": "valuemaps",
143
+ "drafts": 0,
144
+ "items": 10
145
+ },
146
+ "workflow": {
147
+ "singular_display_name": "Workflow",
148
+ "display_name": "Workflows",
149
+ "short_desc": "Workflows are the primary stateful orchestration interface type in Qorus",
150
+ "supports_code": true,
151
+ "url_root": "workflows",
152
+ "drafts": 0,
153
+ "items": 112
154
+ }
155
+ }
package/mock/menu.ts ADDED
@@ -0,0 +1,301 @@
1
+ import { IReqoreIconName } from '@qoretechnologies/reqore/dist/types/icons';
2
+ import { map } from 'lodash';
3
+ import { TReqraftMenuItem } from '../src';
4
+ import interfaces from './interfaceCategories.json';
5
+
6
+ export const interfaceIcons: Record<string, IReqoreIconName> = {
7
+ service: 'ServerLine',
8
+ step: 'StickyNoteLine',
9
+ 'mapper-code': 'FunctionLine',
10
+ errors: 'ErrorWarningLine',
11
+ workflow: 'GitBranchLine',
12
+ job: 'CalendarLine',
13
+ mapper: 'MindMap',
14
+ group: 'GridFill',
15
+ event: 'GitCommitLine',
16
+ 'sync-event': 'GitCommitLine',
17
+ queue: 'StackLine',
18
+ connection: 'Plug2Line',
19
+ fsm: 'DashboardLine',
20
+ pipeline: 'NodeTree',
21
+ 'value-map': 'BringToFront',
22
+ type: 'Asterisk',
23
+ class: 'CodeSLine',
24
+ 'schema-modules': 'Database2Line',
25
+ scripts: 'FileCodeLine',
26
+ tests: 'FilterLine',
27
+ sla: 'TimerLine',
28
+ };
29
+
30
+ export default [
31
+ {
32
+ label: 'Developer Portal',
33
+ icon: 'CodeBoxLine',
34
+ to: '/',
35
+ activePaths: ['', '/ide'],
36
+ id: 'ide',
37
+ as: 'a',
38
+ submenu: map(
39
+ interfaces,
40
+ (item, id): TReqraftMenuItem => ({
41
+ label: item.display_name,
42
+ icon: interfaceIcons[id],
43
+ minimal: false,
44
+ to: `/Interfaces/${id}`,
45
+ badge: [{ label: item.items + item.drafts, align: 'right' }],
46
+ tooltip: {
47
+ content: item.short_desc,
48
+ maxWidth: '400px',
49
+ delay: 300,
50
+ },
51
+ wrap: false,
52
+ activePaths: [`/Interfaces/${id}`, `/CreateInterface/${id}`],
53
+ as: 'a',
54
+ id: id,
55
+ rightIcon: 'AddLine',
56
+ })
57
+ ),
58
+ },
59
+ {
60
+ divider: true,
61
+ },
62
+ {
63
+ label: 'Operational Dashboard',
64
+ icon: 'Home2Fill',
65
+ href: '/dashboard',
66
+ activePaths: ['/dashboard'],
67
+ id: 'dashboard',
68
+ as: 'a',
69
+ },
70
+ {
71
+ label: 'Operational Interfaces',
72
+ id: 'interfaces',
73
+ icon: 'LayoutMasonryFill',
74
+ submenu: [
75
+ {
76
+ label: 'Workflows',
77
+ icon: 'ExchangeLine',
78
+ href: '/workflows',
79
+ activePaths: ['/workflow', '/order'],
80
+ id: 'workflows',
81
+ as: 'a',
82
+ },
83
+ {
84
+ label: 'Services',
85
+ icon: 'GitMergeLine',
86
+ href: '/services',
87
+ activePaths: ['/service'],
88
+ id: 'services',
89
+ as: 'a',
90
+ },
91
+ {
92
+ label: 'Jobs',
93
+ icon: 'CalendarLine',
94
+ href: '/jobs',
95
+ activePaths: ['/job'],
96
+ id: 'jobs',
97
+ as: 'a',
98
+ },
99
+ {
100
+ label: 'Groups',
101
+ icon: 'BubbleChartFill',
102
+ href: '/groups',
103
+ activePaths: ['/groups'],
104
+ id: 'groups',
105
+ as: 'a',
106
+ },
107
+ {
108
+ label: 'Connections',
109
+ icon: 'StackshareLine',
110
+ href: '/remote',
111
+ activePaths: ['/remote'],
112
+ id: 'remote',
113
+ as: 'a',
114
+ },
115
+ {
116
+ label: 'Search',
117
+ icon: 'SearchLine',
118
+ href: '/search',
119
+ activePaths: ['/search'],
120
+ id: 'search',
121
+ as: 'a',
122
+ },
123
+ ],
124
+ },
125
+ {
126
+ label: 'Global',
127
+ icon: 'LayoutGridFill',
128
+ activePaths: ['/rbac', '/valuemaps', '/slas', '/sla', '/releases', '/errors'],
129
+ id: 'global',
130
+ submenu: [
131
+ {
132
+ label: 'RBAC',
133
+ icon: 'GroupLine',
134
+ href: '/rbac',
135
+ activePaths: ['/rbac'],
136
+ id: 'rbac',
137
+ as: 'a',
138
+ },
139
+ {
140
+ label: 'Valuemaps',
141
+ icon: 'MapLine',
142
+ href: '/valuemaps',
143
+ activePaths: ['/valuemaps'],
144
+ id: 'valuemaps',
145
+ as: 'a',
146
+ },
147
+ {
148
+ label: 'SLAs',
149
+ icon: 'TimeLine',
150
+ href: '/slas',
151
+ activePaths: ['/slas', '/sla'],
152
+ id: 'slas',
153
+ as: 'a',
154
+ },
155
+ {
156
+ label: 'Releases',
157
+ icon: 'InstallLine',
158
+ href: '/releases',
159
+ activePaths: ['/releases'],
160
+ id: 'releases',
161
+ as: 'a',
162
+ },
163
+ {
164
+ label: 'Errors',
165
+ icon: 'ErrorWarningLine',
166
+ href: '/errors',
167
+ activePaths: ['/errors'],
168
+ id: 'errors',
169
+ as: 'a',
170
+ },
171
+ {
172
+ label: 'Types',
173
+ icon: 'Key2Fill',
174
+ href: '/types',
175
+ activePaths: ['/types'],
176
+ id: 'types',
177
+ as: 'a',
178
+ },
179
+ ],
180
+ },
181
+ {
182
+ label: 'System',
183
+ icon: 'Settings2Line',
184
+ activePaths: ['/system'],
185
+ id: 'system',
186
+ submenu: [
187
+ {
188
+ label: 'Alerts',
189
+ icon: 'AlarmWarningLine',
190
+ href: '/system/alerts',
191
+ activePaths: ['/system/alerts'],
192
+ id: 'alerts',
193
+ as: 'a',
194
+ },
195
+ {
196
+ label: 'Cluster',
197
+ icon: 'GridFill',
198
+ href: '/system/cluster',
199
+ activePaths: ['/system/cluster'],
200
+ id: 'cluster',
201
+ as: 'a',
202
+ },
203
+ {
204
+ label: 'Order Stats',
205
+ icon: 'PieChartLine',
206
+ href: '/system/orderStats',
207
+ activePaths: ['/system/orderStats'],
208
+ id: 'orderstats',
209
+ as: 'a',
210
+ },
211
+ {
212
+ label: 'Options',
213
+ icon: 'SettingsLine',
214
+ href: '/system/options',
215
+ activePaths: ['/system/options'],
216
+ id: 'options',
217
+ as: 'a',
218
+ },
219
+ {
220
+ label: 'Properties',
221
+ icon: 'StackLine',
222
+ href: '/system/props',
223
+ activePaths: ['/system/props'],
224
+ id: 'props',
225
+ as: 'a',
226
+ },
227
+ {
228
+ label: 'Cache',
229
+ icon: 'DatabaseLine',
230
+ href: '/system/sqlcache',
231
+ activePaths: ['/system/sqlcache'],
232
+ id: 'sqlcache',
233
+ as: 'a',
234
+ },
235
+ {
236
+ label: 'HTTP Services',
237
+ icon: 'GlobeLine',
238
+ href: '/system/http',
239
+ activePaths: ['/system/http'],
240
+ id: 'http',
241
+ as: 'a',
242
+ },
243
+ {
244
+ label: 'Config Items',
245
+ icon: 'Settings6Line',
246
+ href: '/system/config-items',
247
+ activePaths: ['/system/config-items'],
248
+ id: 'config-items',
249
+ as: 'a',
250
+ },
251
+ ],
252
+ },
253
+ {
254
+ label: 'More',
255
+ icon: 'MoreFill',
256
+ activePaths: ['/ocmd', '/library', '/extensions', '/logs', '/info'],
257
+ id: 'more',
258
+ submenu: [
259
+ {
260
+ label: 'OCMD',
261
+ icon: 'TerminalLine',
262
+ href: '/ocmd',
263
+ activePaths: ['/ocmd'],
264
+ id: 'ocmd',
265
+ as: 'a',
266
+ },
267
+ {
268
+ label: 'Library',
269
+ icon: 'Book3Line',
270
+ href: '/library',
271
+ activePaths: ['/library'],
272
+ id: 'library',
273
+ as: 'a',
274
+ },
275
+ {
276
+ label: 'Extensions',
277
+ icon: 'AppsLine',
278
+ href: '/extensions',
279
+ activePaths: ['/extensions'],
280
+ id: 'extensions',
281
+ as: 'a',
282
+ },
283
+ {
284
+ label: 'Logs',
285
+ icon: 'FileTextLine',
286
+ href: '/logs',
287
+ activePaths: ['/logs'],
288
+ id: 'logs',
289
+ as: 'a',
290
+ },
291
+ {
292
+ label: 'Info',
293
+ icon: 'InformationLine',
294
+ href: '/info',
295
+ activePaths: ['/info'],
296
+ id: 'info',
297
+ as: 'a',
298
+ },
299
+ ],
300
+ },
301
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qoretechnologies/reqraft",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "ReQraft is a collection of React components and hooks that are used across Qore Technologies' products made using the ReQore component library from Qore.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -9,11 +9,13 @@
9
9
  "test": "./node_modules/.bin/jest --passWithNoTests",
10
10
  "test:watch": "./node_modules/.bin/jest --watch --passWithNoTests",
11
11
  "test:ci": "./node_modules/.bin/jest --silent --json --outputFile=tests.json --passWithNoTests",
12
+ "precheck": "yarn run lint && yarn run test && yarn build:test:prod",
12
13
  "build": "./node_modules/typescript/bin/tsc --project tsconfig.prod.json",
13
14
  "build:test": "./node_modules/typescript/bin/tsc --noEmit",
14
15
  "build:test:prod": "./node_modules/typescript/bin/tsc --project tsconfig.prod.json --noEmit",
15
16
  "lint": "yarn run eslint ./src/",
16
17
  "storybook": "storybook dev -p 6008",
18
+ "update-reqore": "yarn add @qoretechnologies/reqore@beta",
17
19
  "test-storybook": "DEBUG_PRINT_LIMIT=0 test-storybook --url http://localhost:6008",
18
20
  "install-playwright": "npx playwright install --with-deps",
19
21
  "build-storybook": "storybook build",
@@ -32,7 +34,6 @@
32
34
  "qorus"
33
35
  ],
34
36
  "pre-push": [
35
- "source",
36
37
  "build:test:prod",
37
38
  "lint",
38
39
  "test"
@@ -51,7 +52,7 @@
51
52
  "@babel/preset-react": "^7.12.10",
52
53
  "@babel/preset-typescript": "^7.12.7",
53
54
  "@chromatic-com/storybook": "^1",
54
- "@qoretechnologies/reqore": "^0.41.0",
55
+ "@qoretechnologies/reqore": "^0.43.0",
55
56
  "@storybook/addon-actions": "^8.0.9",
56
57
  "@storybook/addon-essentials": "^8.0.9",
57
58
  "@storybook/addon-interactions": "^8.0.9",
@@ -71,6 +72,7 @@
71
72
  "@types/node": "^14.14.14",
72
73
  "@types/react": "^18.3.1",
73
74
  "@types/react-dom": "^18.3.0",
75
+ "@types/react-query": "^1.2.9",
74
76
  "@typescript-eslint/eslint-plugin": "^7.8.0",
75
77
  "@typescript-eslint/parser": "^7.8.0",
76
78
  "babel-jest": "^29.7.0",
@@ -89,8 +91,10 @@
89
91
  "react-intersection-observer": "^9.4.2",
90
92
  "react-test-renderer": "^18.2.0",
91
93
  "storybook": "^8.0.9",
94
+ "storybook-addon-mock": "^5.0.0",
92
95
  "ts-jest": "^29.1.2",
93
96
  "ts-node": "^9.1.1",
97
+ "type-fest": "^4.18.2",
94
98
  "typescript": "^5.4.5"
95
99
  },
96
100
  "peerDependencies": {
@@ -99,6 +103,7 @@
99
103
  "react-dom": "^18.3.1"
100
104
  },
101
105
  "dependencies": {
106
+ "@tanstack/react-query": "^5.35.5",
102
107
  "classnames": "^2.2.6",
103
108
  "epoch-timeago": "^1.1.9",
104
109
  "lodash": "^4.17.21",