@gnar-engine/cli 1.0.2 → 1.0.4

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 (161) hide show
  1. package/bootstrap/deploy.localdev.yml +18 -31
  2. package/bootstrap/secrets.localdev.yml +7 -12
  3. package/bootstrap/services/user/Dockerfile +1 -1
  4. package/install.sh +32 -0
  5. package/package.json +1 -1
  6. package/src/config.js +2 -1
  7. package/src/dev/dev.service.js +44 -16
  8. package/src/scaffolder/commands.js +11 -4
  9. package/src/scaffolder/scaffolder.handler.js +228 -55
  10. package/templates/service/Dockerfile.hbs +4 -1
  11. package/templates/service/package.json.hbs +14 -16
  12. package/templates/service/{app.js.hbs → src/app.js.hbs} +8 -4
  13. package/templates/service/{commands → src/commands}/{{serviceName}}.handler.js.hbs +1 -2
  14. package/{bootstrap/services/agent/src/config.js → templates/service/src/mongodb.config.js.hbs} +11 -18
  15. package/templates/service/{config.js.hbs → src/mysql.config.js.hbs} +6 -0
  16. package/{bootstrap/services/agent/src/schema/Agent.schema.js → templates/service/src/schema/{{serviceName}}.schema.js.hbs} +3 -3
  17. package/templates/service/src/services/mongodb.{{serviceName}}.service.js.hbs +70 -0
  18. package/bootstrap/services/agent/Dockerfile +0 -23
  19. package/bootstrap/services/agent/notes.md +0 -28
  20. package/bootstrap/services/agent/package.json +0 -16
  21. package/bootstrap/services/agent/src/app.js +0 -52
  22. package/bootstrap/services/agent/src/commands/agent.handler.js +0 -104
  23. package/bootstrap/services/agent/src/controllers/http.controller.js +0 -44
  24. package/bootstrap/services/agent/src/controllers/message.controller.js +0 -51
  25. package/bootstrap/services/agent/src/db/migrations/01-init.js +0 -50
  26. package/bootstrap/services/agent/src/db/migrations/02-agent-service-init.js +0 -36
  27. package/bootstrap/services/agent/src/policies/agent.policy.js +0 -13
  28. package/bootstrap/services/agent/src/services/agent.service.js +0 -259
  29. package/bootstrap/services/agent/src/services/chatgpt.service.js +0 -46
  30. package/bootstrap/services/agent/src/services/manifest.service.js +0 -21
  31. package/bootstrap/services/portal/Dockerfile +0 -23
  32. package/bootstrap/services/portal/Dockerfile.remote +0 -40
  33. package/bootstrap/services/portal/README.md +0 -22
  34. package/bootstrap/services/portal/nginx.conf +0 -12
  35. package/bootstrap/services/portal/package.json +0 -59
  36. package/bootstrap/services/portal/public/favicon.ico +0 -0
  37. package/bootstrap/services/portal/public/gnar-white.png +0 -0
  38. package/bootstrap/services/portal/public/gnarengine-logo-black.png +0 -0
  39. package/bootstrap/services/portal/public/index.html +0 -43
  40. package/bootstrap/services/portal/public/logo192.png +0 -0
  41. package/bootstrap/services/portal/public/logo512.png +0 -0
  42. package/bootstrap/services/portal/public/manifest.json +0 -25
  43. package/bootstrap/services/portal/public/robots.txt +0 -3
  44. package/bootstrap/services/portal/src/App.js +0 -56
  45. package/bootstrap/services/portal/src/assets/Logo_Anchord_Black.svg +0 -1
  46. package/bootstrap/services/portal/src/assets/Logo_Anchord_Black_Green.svg +0 -1
  47. package/bootstrap/services/portal/src/assets/Logo_Anchord_White_Green.svg +0 -1
  48. package/bootstrap/services/portal/src/assets/activity.svg +0 -3
  49. package/bootstrap/services/portal/src/assets/arrow.svg +0 -3
  50. package/bootstrap/services/portal/src/assets/bin-white.svg +0 -3
  51. package/bootstrap/services/portal/src/assets/bin.svg +0 -3
  52. package/bootstrap/services/portal/src/assets/check.svg +0 -3
  53. package/bootstrap/services/portal/src/assets/chevron.svg +0 -3
  54. package/bootstrap/services/portal/src/assets/contact.svg +0 -3
  55. package/bootstrap/services/portal/src/assets/dots-vertical.svg +0 -5
  56. package/bootstrap/services/portal/src/assets/eye-off.svg +0 -3
  57. package/bootstrap/services/portal/src/assets/eye.svg +0 -4
  58. package/bootstrap/services/portal/src/assets/gnar-engine-black.svg +0 -47
  59. package/bootstrap/services/portal/src/assets/gnar-engine-white.svg +0 -47
  60. package/bootstrap/services/portal/src/assets/gnar_engine.svg +0 -3
  61. package/bootstrap/services/portal/src/assets/gnarengine-logo-black.png +0 -0
  62. package/bootstrap/services/portal/src/assets/home.svg +0 -3
  63. package/bootstrap/services/portal/src/assets/link.svg +0 -3
  64. package/bootstrap/services/portal/src/assets/lock.svg +0 -3
  65. package/bootstrap/services/portal/src/assets/package.svg +0 -4
  66. package/bootstrap/services/portal/src/assets/raffle.svg +0 -3
  67. package/bootstrap/services/portal/src/assets/settings.svg +0 -4
  68. package/bootstrap/services/portal/src/assets/shopping-bag.svg +0 -3
  69. package/bootstrap/services/portal/src/assets/user-black.svg +0 -3
  70. package/bootstrap/services/portal/src/assets/user.svg +0 -3
  71. package/bootstrap/services/portal/src/assets/users.svg +0 -3
  72. package/bootstrap/services/portal/src/assets/wallet.svg +0 -3
  73. package/bootstrap/services/portal/src/css/style.css +0 -1007
  74. package/bootstrap/services/portal/src/data/data.js +0 -70
  75. package/bootstrap/services/portal/src/features/attributeFormRow/AttributeFormRow.jsx +0 -32
  76. package/bootstrap/services/portal/src/features/billingShipping/BillingShipping.jsx +0 -160
  77. package/bootstrap/services/portal/src/features/crud/crudEdit.less +0 -230
  78. package/bootstrap/services/portal/src/features/crud/crudList.less +0 -134
  79. package/bootstrap/services/portal/src/features/crud/crudPage.less +0 -31
  80. package/bootstrap/services/portal/src/features/crudContact/CrudContactList.jsx +0 -108
  81. package/bootstrap/services/portal/src/features/crudContact/CrudContactSingle.jsx +0 -243
  82. package/bootstrap/services/portal/src/features/crudOrder/CrudOrderList.jsx +0 -109
  83. package/bootstrap/services/portal/src/features/crudOrder/CrudOrderSingle.jsx +0 -315
  84. package/bootstrap/services/portal/src/features/crudProducts/CrudProductList.jsx +0 -104
  85. package/bootstrap/services/portal/src/features/crudProducts/CrudProductSingle.jsx +0 -388
  86. package/bootstrap/services/portal/src/features/crudRaffles/CrudRafflesList.jsx +0 -104
  87. package/bootstrap/services/portal/src/features/crudRaffles/CrudRafflesSingle.jsx +0 -208
  88. package/bootstrap/services/portal/src/features/crudSubscription/CrudSubscriptionList.jsx +0 -110
  89. package/bootstrap/services/portal/src/features/crudSubscription/CrudSubscriptionSingle.jsx +0 -261
  90. package/bootstrap/services/portal/src/features/crudUser/CrudUserList.jsx +0 -107
  91. package/bootstrap/services/portal/src/features/crudUser/CrudUserSingle.jsx +0 -402
  92. package/bootstrap/services/portal/src/features/inventoryFormRow/InventoryFormRow.jsx +0 -30
  93. package/bootstrap/services/portal/src/features/lineItems/LineItems.jsx +0 -113
  94. package/bootstrap/services/portal/src/features/loginForm/LoginForm.jsx +0 -56
  95. package/bootstrap/services/portal/src/features/loginForm/loginForm.less +0 -56
  96. package/bootstrap/services/portal/src/features/notes/Notes.jsx +0 -18
  97. package/bootstrap/services/portal/src/features/passwordReset/PasswordResetForm.jsx +0 -96
  98. package/bootstrap/services/portal/src/features/passwordReset/PasswordResetRequestForm.jsx +0 -74
  99. package/bootstrap/services/portal/src/features/priceFormRow/PriceFormRow.jsx +0 -102
  100. package/bootstrap/services/portal/src/features/priceFormRow/priceFormRow.less +0 -24
  101. package/bootstrap/services/portal/src/features/raffleEntriesList/RaffleEntriesList.jsx +0 -99
  102. package/bootstrap/services/portal/src/features/raffleProductFormRow/RaffleProductFormRow.jsx +0 -46
  103. package/bootstrap/services/portal/src/features/sidebar/Sidebar.jsx +0 -64
  104. package/bootstrap/services/portal/src/features/sidebar/sidebar.less +0 -49
  105. package/bootstrap/services/portal/src/features/skus/Skus.jsx +0 -109
  106. package/bootstrap/services/portal/src/features/subscriptionSchedule/SubscriptionSchedule.jsx +0 -44
  107. package/bootstrap/services/portal/src/features/taxonomyFormRow/TaxonomyFormRow.jsx +0 -32
  108. package/bootstrap/services/portal/src/features/user/User.jsx +0 -54
  109. package/bootstrap/services/portal/src/features/user/user.less +0 -57
  110. package/bootstrap/services/portal/src/includes/utilities.js +0 -259
  111. package/bootstrap/services/portal/src/index.js +0 -14
  112. package/bootstrap/services/portal/src/layouts/CrudLayout.jsx +0 -50
  113. package/bootstrap/services/portal/src/layouts/LoginLayout.jsx +0 -17
  114. package/bootstrap/services/portal/src/layouts/PortalLayout.jsx +0 -48
  115. package/bootstrap/services/portal/src/layouts/loginLayout.less +0 -33
  116. package/bootstrap/services/portal/src/layouts/portalLayout.less +0 -67
  117. package/bootstrap/services/portal/src/pages/contacts/Contacts.jsx +0 -199
  118. package/bootstrap/services/portal/src/pages/dashboard/Dashboard.jsx +0 -17
  119. package/bootstrap/services/portal/src/pages/integrations/Integrations.jsx +0 -10
  120. package/bootstrap/services/portal/src/pages/login/Login.jsx +0 -15
  121. package/bootstrap/services/portal/src/pages/login/login.less +0 -10
  122. package/bootstrap/services/portal/src/pages/orders/Orders.jsx +0 -199
  123. package/bootstrap/services/portal/src/pages/passwordReset/PasswordResetPage.jsx +0 -15
  124. package/bootstrap/services/portal/src/pages/passwordResetRequest/PasswordResetRequestPage.jsx +0 -15
  125. package/bootstrap/services/portal/src/pages/payments/Payments.jsx +0 -10
  126. package/bootstrap/services/portal/src/pages/portal/Portal.jsx +0 -43
  127. package/bootstrap/services/portal/src/pages/products/Products.jsx +0 -212
  128. package/bootstrap/services/portal/src/pages/raffleEntries/RaffleEntries.jsx +0 -124
  129. package/bootstrap/services/portal/src/pages/raffles/Raffles.jsx +0 -186
  130. package/bootstrap/services/portal/src/pages/reports/Reports.jsx +0 -10
  131. package/bootstrap/services/portal/src/pages/settings/Settings.jsx +0 -10
  132. package/bootstrap/services/portal/src/pages/subscriptions/Subscriptions.jsx +0 -199
  133. package/bootstrap/services/portal/src/pages/users/Users.jsx +0 -193
  134. package/bootstrap/services/portal/src/pages/users/users.less +0 -25
  135. package/bootstrap/services/portal/src/slices/authSlice.js +0 -71
  136. package/bootstrap/services/portal/src/store/configureStore.js +0 -12
  137. package/bootstrap/services/portal/src/styles/global.less +0 -159
  138. package/bootstrap/services/portal/src/styles/inputs.less +0 -157
  139. package/bootstrap/services/portal/src/styles/main.less +0 -26
  140. package/bootstrap/services/portal/src/ui/collapsible/Collapsible.jsx +0 -97
  141. package/bootstrap/services/portal/src/ui/collapsible/collapsible.less +0 -23
  142. package/bootstrap/services/portal/src/ui/customCheckbox/CustomCheckbox.jsx +0 -17
  143. package/bootstrap/services/portal/src/ui/customCheckbox/customCheckbox.less +0 -42
  144. package/bootstrap/services/portal/src/ui/customMultiSelect/CustomMultiSelect.jsx +0 -63
  145. package/bootstrap/services/portal/src/ui/customMultiSelect/CustomMultiSelectPeriod.jsx +0 -63
  146. package/bootstrap/services/portal/src/ui/customSelect/CustomSelect.jsx +0 -63
  147. package/bootstrap/services/portal/src/ui/customSelect/customSelect.less +0 -92
  148. package/bootstrap/services/portal/src/ui/goBack/GoBack.jsx +0 -19
  149. package/bootstrap/services/portal/src/ui/loader/Loader.jsx +0 -12
  150. package/bootstrap/services/portal/src/ui/pagination/Pagination.jsx +0 -23
  151. package/bootstrap/services/portal/src/ui/repeater/Repeater.jsx +0 -29
  152. package/bootstrap/services/portal/src/ui/saveButton/SaveButton.jsx +0 -69
  153. package/bootstrap/services/portal/src/ui/saveButton/saveButton.less +0 -0
  154. package/bootstrap/services/user/src/db/seeders/development/02-portal-admin-user.js +0 -27
  155. package/templates/service/schema/{{serviceName}}.schema.js.hbs +0 -14
  156. /package/templates/service/{controllers → src/controllers}/http.controller.js.hbs +0 -0
  157. /package/templates/service/{controllers → src/controllers}/message.controller.js.hbs +0 -0
  158. /package/templates/service/{db → src/mysql.db}/migrations/01-init.js.hbs +0 -0
  159. /package/templates/service/{db → src/mysql.db}/migrations/02-{{lowerCase serviceName}}-service-init.js.hbs +0 -0
  160. /package/templates/service/{policies → src/policies}/{{serviceName}}.policy.js.hbs +0 -0
  161. /package/templates/service/{services/{{serviceName}}.service.js.hbs → src/services/mysql.{{serviceName}}.service.js.hbs} +0 -0
@@ -1,259 +0,0 @@
1
- import { db, logger, utils } from '@gnar-engine/core';
2
- import { config } from '../config.js';
3
- import { chatGptAgent } from '../services/chatgpt.service.js';
4
-
5
- export const Agent = {
6
-
7
- client: {},
8
-
9
- /**
10
- * Initialise LLM agent
11
- *
12
- * @returns {string} response
13
- */
14
- init: async function () {
15
- switch (config.agent) {
16
- case 'chatgpt':
17
- this.client = await chatGptAgent.init()
18
- break;
19
- }
20
- },
21
-
22
- /**
23
- * Plan prompt preparation
24
- *
25
- * @param {*} inputText
26
- * @returns {string} preparedPlanInput
27
- */
28
- prepareGatherFactsPrompt: function ({inputText, manifests}) {
29
- const commandLists = [];
30
- const schemaLists = [];
31
-
32
- manifests.manifests.forEach((manifest) => {
33
- if (manifest.manifest.commandList?.[0] && manifest.manifest.commandList[0].includes('agentService')) {
34
- return;
35
- }
36
-
37
- commandLists.push(manifest.manifest.commandList);
38
- schemaLists.push(manifest.manifest.schemas);
39
- });
40
-
41
- const preparedPlanInput = JSON.stringify({
42
- clientPrompt: inputText,
43
- systemInstructions: "Respond to the clientPrompt in the format of the responseStructure JSON. Your sole aim is to confirm (using the commandsRequired response property) which commands described in the manifest you will need more information on (command signature), in order to be able to invoke the commands to fulfill the request provided in the clientPrompt. Simillarly, please ensure that you request all required information as per the schema manifest from the user in the responseText. If there aren't suitable commands, explain that you can't with no further options. If it is not yet clear, please request clarification. The responseText will be shown to the customer so ensure that responses are non-technical and don't go into detail about the rest of the response.",
44
- responseStructure: {
45
- responseText: "Customer facing message reply here",
46
- commandsRequired: [
47
- 'e.g. userService.create',
48
- 'userService.update'
49
- ]
50
- },
51
- commandManifest: commandLists,
52
- schemaManifest: schemaLists
53
- });
54
-
55
- logger.info(preparedPlanInput);
56
-
57
- return preparedPlanInput;
58
- },
59
-
60
- /**
61
- * Plan prompt preparation
62
- *
63
- * @param {*} inputText
64
- * @returns {string} preparedPlanInput
65
- */
66
- preparePlanPrompt: function ({inputText, manifests}) {
67
- const commandLists = [];
68
- const schemaLists = [];
69
-
70
- manifests.manifests.forEach((manifest) => {
71
- if (manifest.manifest.commandList?.[0] && manifest.manifest.commandList[0].includes('agentService')) {
72
- return;
73
- }
74
-
75
- commandLists.push(manifest.manifest.commandList);
76
- schemaLists.push(manifest.manifest.schema);
77
- });
78
-
79
- const preparedPlanInput = JSON.stringify({
80
- clientPrompt: inputText,
81
- systemInstructions: "Respond to the clientPrompt in the format of the responseStructure JSON. Your sole aim is to confirm using the commandsRequired response property, which commands described in the manifest you will need more information, in order to be able to invoke the commands to fulfill the request provided in the clientPrompt. If there aren't suitable commands, explain that you can't with no further options. If it is not yet clear, please request clarification. The responseText will be shown to the customer so ensure that responses are non-technical and don't go into detail about the rest of the response.",
82
- responseStructure: {
83
- responseText: "Customer facing message reply here",
84
- actionPlan: [
85
- {
86
- planDesc: "Fetch the user ID using the email address provided",
87
- commandName: "userService.getSingle"
88
- },
89
- {
90
- planDesc: "update the users first name as requested",
91
- commandName: "userService.update"
92
- }
93
- ],
94
- commandsRequired: [
95
- 'e.g. userService.create',
96
- 'userService.update'
97
- ]
98
- },
99
- commandManifest: commandLists,
100
- schemaManifest: schemaLists
101
- });
102
-
103
- logger.info(preparedPlanInput);
104
-
105
- return preparedPlanInput;
106
- },
107
-
108
-
109
- /**
110
- * Action plan step prompt preparation
111
- *
112
- * @param {*} inputText
113
- * @returns {string} preparedActionPlanStepPrompt
114
- */
115
- preparedActionPlanStepPrompt: function ({actionPlanStepDesc, manifest}) {
116
-
117
- },
118
-
119
- /**
120
- * Prompt augmentation for the agent
121
- *
122
- * @param {*} inputText
123
- * @returns {string} preparedInput
124
- */
125
- preparePrompt: function ({inputText}) {
126
- const preparedInput = JSON.stringify({
127
- clientPrompt: inputText,
128
- systemInstructions: "Respond to the clientPrompt in the the format of the responseStructure JSON. If there is an appropriate flow of actions to take based on the actions described in the registeredServices you should respond with a command otherwise don't. You should always include a customer facing message requesting clarifications or the action taken.",
129
- responseStructure: {
130
- responseText: "Your message here",
131
- action: {
132
- commandName: "e.g. userService.update",
133
- payload: {
134
- userId: "12345",
135
- data: {}
136
- }
137
- }
138
- },
139
- registeredServices: [
140
- {
141
- serviceName: "userService",
142
- actions: [
143
- {
144
- name: "update",
145
- description: "Update user information",
146
- parameters: {
147
- userId: "string",
148
- data: "object"
149
- }
150
- }
151
- ]
152
- }
153
- ]
154
- })
155
-
156
- return preparedInput;
157
- },
158
-
159
- /**
160
- * Create a new chat session
161
- *
162
- * @param {string} userId
163
- * @param {string} title
164
- * @param {string} sessionKey
165
- * @returns {string} chatId
166
- */
167
- createChat: async function ({userId, title, sessionKey}) {
168
- const chatId = utils.uuid();
169
-
170
- await db.query(
171
- 'INSERT INTO agent_chats (id, user_id, title) VALUES (?, ?, ?)',
172
- [chatId, userId, title]
173
- );
174
-
175
- return chatId;
176
- },
177
-
178
- /**
179
- * Get a chat (with all messages)
180
- *
181
- * @param {string} chatId
182
- * @returns {object} chat
183
- */
184
- getChat: async function ({chatId}) {
185
- try {
186
- // Fetch the chat
187
- const chatResult = await db.query(
188
- 'SELECT * FROM agent_chats WHERE id = ?',
189
- [chatId]
190
- );
191
-
192
- if (!chatResult || chatResult.length === 0) {
193
- throw new Error(`Chat with ID ${chatId} not found`);
194
- }
195
-
196
- const chat = chatResult[0][0];
197
-
198
- // Fetch messages for the chat
199
- const chatMessageResult = await db.query(
200
- 'SELECT id, chat_id, user_name, context, created_at FROM agent_chat_messages WHERE chat_id = ? ORDER BY created_at ASC',
201
- [chatId]
202
- );
203
-
204
- if (!chatMessageResult || chatMessageResult.length === 0) {
205
- throw new Error('No chat messages found');
206
- }
207
-
208
- chat.messages = chatMessageResult[0];
209
-
210
- return chat;
211
- } catch (err) {
212
- logger.error(`Error fetching chat ${chatId}: ${err.message}`);
213
- throw err;
214
- }
215
- },
216
-
217
- /**
218
- * Create a new chat message
219
- *
220
- * @param {string} chatId
221
- * @param {string} userName
222
- * @param {object} context
223
- */
224
- createChatMessage: async function ({chatId, userName, context}) {
225
- try {
226
- const messageId = utils.uuid();
227
- context = JSON.stringify(context);
228
-
229
- logger.info('storing context: ' + context);
230
-
231
- await db.query(
232
- 'INSERT INTO agent_chat_messages (id, chat_id, user_name, context) VALUES (?, ?, ?, ?)',
233
- [messageId, chatId, userName, context]
234
- );
235
- } catch (err) {
236
- logger.error('Error creating chat message: ' + err.message);
237
- }
238
- },
239
-
240
- /**
241
- * Infer LLM agent
242
- *
243
- * @param {string} preparedInput
244
- * @returns {string} response
245
- */
246
- infer: async function ({preparedInput}) {
247
-
248
- let response;
249
-
250
- switch (config.agent) {
251
- case 'chatgpt':
252
- response = await chatGptAgent.getResponse(preparedInput)
253
- break;
254
- }
255
-
256
- return response;
257
- }
258
-
259
- };
@@ -1,46 +0,0 @@
1
- import OpenAI from "openai";
2
- import { logger } from "@gnar-engine/core";
3
-
4
-
5
- export const chatGptAgent = {
6
-
7
- client: null,
8
-
9
- init: function () {
10
- if (this.client) {
11
- return this.client;
12
- }
13
-
14
- return this.client = new OpenAI({
15
- apiKey: process.env.OPENAI_API_KEY,
16
- baseURL: process.env.OPENAI_API_BASE_URL || 'https://api.openai.com/v1',
17
- });
18
- },
19
-
20
- getResponse: async function (preparedInput) {
21
- try {
22
- logger.info('LLM request sending...');
23
- const response = await this.client.chat.completions.create({
24
- model: "gpt-5-mini",
25
- messages: [
26
- {
27
- role: "user",
28
- content: [
29
- {
30
- type: "text",
31
- text: preparedInput
32
- }
33
- ],
34
- },
35
- ],
36
- });
37
-
38
- logger.info('LLM response returned');
39
-
40
- return response.choices[0].message.content;
41
- } catch (error) {
42
- logger.error("ChatGPT agent error:" + error);
43
- throw error;
44
- }
45
- }
46
- }
@@ -1,21 +0,0 @@
1
- import { commands, logger } from '@gnar-engine/core';
2
-
3
-
4
- export const manifestService = {
5
-
6
- commandList: {},
7
- schemaList: {},
8
-
9
- /**
10
- * Generate service manifests
11
- */
12
- generateServiceManifests: async () => {
13
- logger.info('Generating command manifest...');
14
-
15
- // Get services from control service
16
- const manifests = await commands.execute('controlService.getManifests');
17
-
18
-
19
- }
20
-
21
- }
@@ -1,23 +0,0 @@
1
- # Dockerfile for Portal Service
2
- FROM node:20-alpine
3
-
4
- # Set the working directory
5
- WORKDIR /usr/gnar_engine/app
6
-
7
- # Copy package.json and package-lock.json
8
- COPY ./services/portal/package*.json ./
9
-
10
- # Copy public directory
11
- COPY ./services/portal/public ./public
12
-
13
- # Copy local Lib packages
14
- COPY ./Lib ./Lib
15
-
16
- # Install app dependencies
17
- RUN npm install
18
-
19
- # Expose the port the service will run on
20
- EXPOSE 3000
21
-
22
- # Start the application
23
- CMD ["npm", "run", "start"]
@@ -1,40 +0,0 @@
1
- # Step 1: Build the application
2
- FROM node:20-alpine AS build
3
-
4
- # Set working directory
5
- WORKDIR /usr/gnar_engine/app
6
-
7
- # Copy package.json and package-lock.json
8
- COPY ./services/portal/package*.json ./
9
-
10
- # Copy local Lib packages
11
- COPY ./Lib ./Lib
12
-
13
- # Copy the rest of the application code
14
- COPY ./services/portal/src ./src
15
- COPY ./services/portal/public ./public
16
-
17
- # Copy front-end environment variables
18
- ARG ENV_ENV=production
19
- COPY .env.public.${ENV_ENV} ./.env
20
-
21
- # Install app dependencies
22
- RUN npm install
23
-
24
- # Build the React application
25
- RUN npm run build
26
-
27
- # Step 2: Serve the application with Nginx
28
- FROM nginx:alpine
29
-
30
- # Copy custom Nginx config
31
- COPY ./services/portal/nginx.conf /etc/nginx/conf.d/default.conf
32
-
33
- # Copy the built assets from the build step
34
- COPY --from=build /usr/gnar_engine/app/build /usr/share/nginx/html
35
-
36
- # Expose the port for the web server
37
- EXPOSE 3000
38
-
39
- # Start the Nginx server to serve the app
40
- CMD ["nginx", "-g", "daemon off;"]
@@ -1,22 +0,0 @@
1
- # School Consultancy Programme - Front End
2
-
3
- React application for student tracking.
4
-
5
- ### Deploy
6
-
7
- Build application locally and deploy with scp. Production server SSH access required.
8
-
9
- ``` bash
10
- # Checkout local production branch
11
- git branch checkout production
12
-
13
- # Build
14
- npm run build-style
15
- npm run build
16
-
17
- # Deploy
18
- npm run deploy
19
-
20
- # Clear production caches
21
-
22
- ```
@@ -1,12 +0,0 @@
1
- # nginx.conf
2
- server {
3
- listen 3000;
4
- server_name localhost;
5
-
6
- root /usr/share/nginx/html;
7
- index index.html;
8
-
9
- location / {
10
- try_files $uri /index.html;
11
- }
12
- }
@@ -1,59 +0,0 @@
1
- {
2
- "name": "gnar_engine_portal",
3
- "version": "1.0.0",
4
- "private": true,
5
- "dependencies": {
6
- "@react-pdf/renderer": "^3.4.4",
7
- "@reduxjs/toolkit": "^2.2.6",
8
- "@testing-library/jest-dom": "^5.17.0",
9
- "@testing-library/react": "^13.4.0",
10
- "@testing-library/user-event": "^13.5.0",
11
- "@gnar-engine/js-client": "file:/usr/gnar_engine/app/Lib/js-client",
12
- "chart.js": "^4.4.3",
13
- "crypto-js": "^4.2.0",
14
- "html-to-image": "^1.11.11",
15
- "react": "^18.3.1",
16
- "react-axios": "^2.0.6",
17
- "react-chartjs-2": "^5.2.0",
18
- "react-datepicker": "^7.3.0",
19
- "react-dom": "^18.3.1",
20
- "react-redux": "^9.1.2",
21
- "react-router-dom": "^6.24.0",
22
- "react-scripts": "5.0.1",
23
- "redux-toolkit": "^1.1.2",
24
- "web-vitals": "^2.1.4"
25
- },
26
- "devDependencies": {
27
- "@babel/plugin-proposal-private-property-in-object": "7.21.11",
28
- "less": "^4.2.0",
29
- "lessc": "^1.0.2"
30
- },
31
- "scripts": {
32
- "start": "react-scripts start",
33
- "build": "react-scripts build",
34
- "test": "react-scripts test",
35
- "eject": "react-scripts eject",
36
- "build-style": "lessc src/styles/main.less src/css/style.css"
37
- },
38
- "eslintConfig": {
39
- "extends": [
40
- "react-app",
41
- "react-app/jest"
42
- ]
43
- },
44
- "browserslist": {
45
- "production": [
46
- ">0.2%",
47
- "not dead",
48
- "not op_mini all"
49
- ],
50
- "development": [
51
- "last 1 chrome version",
52
- "last 1 firefox version",
53
- "last 1 safari version"
54
- ]
55
- },
56
- "workspaces": [
57
- "./Lib/*"
58
- ]
59
- }
@@ -1,43 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8" />
5
- <link rel="icon" href="#" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1" />
7
- <meta name="theme-color" content="#000000" />
8
- <title>GNAR Engine</title>
9
- <meta
10
- name="description"
11
- content="Gnar Engine."
12
- />
13
- <link rel="apple-touch-icon" href="#" />
14
- <!--
15
- manifest.json provides metadata used when your web app is installed on a
16
- user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
17
- -->
18
- <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
19
- <!--
20
- Notice the use of %PUBLIC_URL% in the tags above.
21
- It will be replaced with the URL of the `public` folder during the build.
22
- Only files inside the `public` folder can be referenced from the HTML.
23
-
24
- Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
25
- work correctly both with client-side routing and a non-root public URL.
26
- Learn how to configure a non-root public URL by running `npm run build`.
27
- -->
28
- </head>
29
- <body>
30
- <noscript>You need to enable JavaScript to run this app.</noscript>
31
- <div id="root"></div>
32
- <!--
33
- This HTML file is a template.
34
- If you open it directly in the browser, you will see an empty page.
35
-
36
- You can add webfonts, meta tags, or analytics to this file.
37
- The build step will place the bundled scripts into the <body> tag.
38
-
39
- To begin the development, run `npm start` or `yarn start`.
40
- To create a production bundle, use `npm run build` or `yarn build`.
41
- -->
42
- </body>
43
- </html>
@@ -1,25 +0,0 @@
1
- {
2
- "short_name": "React App",
3
- "name": "Create React App Sample",
4
- "icons": [
5
- {
6
- "src": "favicon.ico",
7
- "sizes": "64x64 32x32 24x24 16x16",
8
- "type": "image/x-icon"
9
- },
10
- {
11
- "src": "logo192.png",
12
- "type": "image/png",
13
- "sizes": "192x192"
14
- },
15
- {
16
- "src": "logo512.png",
17
- "type": "image/png",
18
- "sizes": "512x512"
19
- }
20
- ],
21
- "start_url": ".",
22
- "display": "standalone",
23
- "theme_color": "#000000",
24
- "background_color": "#ffffff"
25
- }
@@ -1,3 +0,0 @@
1
- # https://www.robotstxt.org/robotstxt.html
2
- User-agent: *
3
- Disallow:
@@ -1,56 +0,0 @@
1
- import React, { useEffect} from 'react';
2
- import { BrowserRouter as Router } from 'react-router-dom';
3
- import { useDispatch } from 'react-redux';
4
- import { Routes, Route } from 'react-router-dom';
5
- import LoginPage from './pages/login/Login';
6
- import Portal from './pages/portal/Portal';
7
- import './css/style.css';
8
- import PasswordResetPage from './pages/passwordReset/PasswordResetPage';
9
- import PasswordResetRequestPage from './pages/passwordResetRequest/PasswordResetRequestPage';
10
- import client, { initialiseGnarSdk } from '@gnar-engine/js-client/src/client';
11
- import { getAuthToken, getAuthUser } from '@gnar-engine/js-client/src/storage';
12
- // import NotFound from './pages/notFound/NotFound';
13
-
14
-
15
- function App() {
16
-
17
- const dispatch = useDispatch();
18
-
19
- useEffect(() => {
20
-
21
- // redirect to login if not logged in
22
- if (!window.location.pathname.includes('/login')) {
23
- let AuthToken = getAuthToken();
24
- let AuthUser = getAuthUser();
25
-
26
- if (!AuthToken || !AuthUser) {
27
- window.location.href = '/login';
28
- }
29
- }
30
-
31
- }, []);
32
-
33
- useEffect(() => {
34
- initialiseGnarSdk({
35
- baseApiUrl: client.defaults.baseURL,
36
- });
37
- }, []);
38
-
39
- return (
40
- <>
41
- {/* {authLoading ? <Loader /> : */}
42
- <Router>
43
- <Routes>
44
- <Route path="/login/password-reset/:token" element={<PasswordResetPage />} key="password-reset"/>
45
- <Route path="/login/forgotten-password" element={<PasswordResetRequestPage />} key="forgotten-password"/>
46
- <Route path="/login" element={<LoginPage />} key="login"/>
47
- <Route path="/portal/*" element={<Portal />} key="portal"/>
48
- {/* <Route path="*" element={<NotFound />} /> */}
49
- </Routes>
50
- </Router>
51
- {/* } */}
52
- </>
53
- );
54
- }
55
-
56
- export default App;
@@ -1 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?><svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 300"><path d="M115.8,56.63L30.58,243.37h51.48l16.6-36.29,91.57-44.53,36.91,80.82h53.26L195.18,56.63h-79.38ZM118.98,162.54l30.55-66.89h10.15l30.55,66.89h-71.24Z"/><polygon points="469.85 175.09 463.51 175.09 371.7 56.63 301.96 56.63 301.96 243.37 352.68 243.37 352.68 124.91 359.02 124.91 450.83 243.37 520.58 243.37 520.58 56.63 469.85 56.63 469.85 175.09"/><path d="M666.92,195.99h-7.61c-36.77,0-55.04-13.66-55.04-40.42v-11.15c0-25.92,18.26-40.42,55.04-40.42h7.61c38.04,0,54.02,12.54,54.27,26.48h54.53c0-51.29-45.4-76.65-108.8-76.65h-7.61c-60.61,0-109.56,27.04-109.56,90.59v11.15c0,62.44,48.95,90.59,109.56,90.59h7.61c63.4,0,109.82-28.15,109.82-77.49h-54.53c0,13.66-17.5,27.32-55.29,27.32Z"/><polygon points="963.66 124.08 859.17 124.08 859.17 56.63 805.91 56.63 805.91 243.37 859.17 243.37 859.17 171.46 963.66 171.46 963.66 243.37 1016.92 243.37 1016.92 56.63 963.66 56.63 963.66 124.08"/><path d="M1172.39,53.84h-12.68c-63.15,0-113.62,32.89-113.62,91.98v8.36c0,59.09,50.47,91.98,113.62,91.98h12.68c61.63,0,111.08-32.89,111.08-91.98v-8.36c0-59.09-49.45-91.98-111.08-91.98ZM1228.95,154.18c0,27.04-22.32,41.81-59.09,41.81h-10.14c-36.77,0-59.09-14.77-59.09-41.81v-8.36c0-27.32,22.32-41.81,59.09-41.81h10.14c36.77,0,59.09,14.49,59.09,41.81v8.36Z"/><path d="M1521.63,122.13v-8.36c0-31.5-21.81-57.14-60.61-57.14h-148.37v186.75h53.26v-63.83h66.19l36.27,63.83h60.61l-39.06-69.12c20.04-8.92,31.7-28.99,31.7-52.12ZM1467.1,119.62c0,10.31-5.83,15.61-20.54,15.61h-80.65v-34.84h80.65c14.71,0,20.54,6.69,20.54,16.17v3.07Z"/><path d="M1670,56.63h-119.45v186.75h119.45c62.39,0,99.42-25.09,99.42-85.01v-15.33c0-61.04-38.8-86.41-99.42-86.41ZM1714.89,158.36c0,24.53-11.16,37.63-44.89,37.63h-66.19v-91.98h66.19c34.24,0,44.89,13.94,44.89,39.02v15.33Z"/></svg>
@@ -1 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?><svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 300"><defs><style>.cls-1{fill:#9f6;}</style></defs><polygon points="195.18 56.63 115.8 56.63 30.58 243.37 82.06 243.37 149.53 95.65 159.67 95.65 227.13 243.37 280.39 243.37 195.18 56.63"/><path d="M371.7,56.63l91.81,118.46h6.34V56.63h50.72v186.75h-69.75l-91.81-118.46h-6.34v118.46h-50.72V56.63h69.75Z"/><path d="M666.92,53.84c63.4,0,108.8,25.36,108.8,76.65h-54.53c-.25-13.94-16.23-26.48-54.27-26.48h-7.61c-36.77,0-55.04,14.49-55.04,40.42v11.15c0,26.76,18.26,40.42,55.04,40.42h7.61c37.79,0,55.29-13.66,55.29-27.32h54.53c0,49.33-46.41,77.49-109.82,77.49h-7.61c-60.61,0-109.56-28.15-109.56-90.59v-11.15c0-63.55,48.95-90.59,109.56-90.59h7.61Z"/><path d="M859.17,56.63v67.45h104.49V56.63h53.26v186.75h-53.26v-71.91h-104.49v71.91h-53.26V56.63h53.26Z"/><path d="M1172.39,53.84c61.63,0,111.08,32.89,111.08,91.98v8.36c0,59.09-49.45,91.98-111.08,91.98h-12.68c-63.15,0-113.62-32.89-113.62-91.98v-8.36c0-59.09,50.47-91.98,113.62-91.98h12.68ZM1100.62,145.82v8.36c0,27.04,22.32,41.81,59.09,41.81h10.14c36.77,0,59.09-14.77,59.09-41.81v-8.36c0-27.32-22.32-41.81-59.09-41.81h-10.14c-36.77,0-59.09,14.49-59.09,41.81Z"/><path d="M1461.02,56.63c38.8,0,60.61,25.64,60.61,57.14v8.36c0,23.13-11.67,43.2-31.7,52.12l39.06,69.12h-60.61l-36.27-63.83h-66.19v63.83h-53.26V56.63h148.37ZM1365.91,135.23h80.65c14.71,0,20.54-5.3,20.54-15.61v-3.07c0-9.48-5.83-16.17-20.54-16.17h-80.65v34.84Z"/><path d="M1670,56.63c60.62,0,99.42,25.36,99.42,86.41v15.33c0,59.93-37.03,85.01-99.42,85.01h-119.45V56.63h119.45ZM1603.81,195.99h66.19c33.73,0,44.89-13.1,44.89-37.63v-15.33c0-25.09-10.65-39.02-44.89-39.02h-66.19v91.98Z"/><polygon class="cls-1" points="118.97 162.54 98.66 207.09 190.26 162.54 118.97 162.54"/></svg>
@@ -1 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?><svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 300"><defs><style>.cls-1{fill:#fff;}.cls-2{fill:#9f6;}</style></defs><polygon class="cls-1" points="195.18 56.63 115.8 56.63 30.58 243.37 82.06 243.37 149.53 95.65 159.67 95.65 227.13 243.37 280.39 243.37 195.18 56.63"/><path class="cls-1" d="M371.7,56.63l91.81,118.46h6.34V56.63h50.72v186.75h-69.75l-91.81-118.46h-6.34v118.46h-50.72V56.63h69.75Z"/><path class="cls-1" d="M666.92,53.84c63.4,0,108.8,25.36,108.8,76.65h-54.53c-.25-13.94-16.23-26.48-54.27-26.48h-7.61c-36.77,0-55.04,14.49-55.04,40.42v11.15c0,26.76,18.26,40.42,55.04,40.42h7.61c37.79,0,55.29-13.66,55.29-27.32h54.53c0,49.33-46.41,77.49-109.82,77.49h-7.61c-60.61,0-109.56-28.15-109.56-90.59v-11.15c0-63.55,48.95-90.59,109.56-90.59h7.61Z"/><path class="cls-1" d="M859.17,56.63v67.45h104.49V56.63h53.26v186.75h-53.26v-71.91h-104.49v71.91h-53.26V56.63h53.26Z"/><path class="cls-1" d="M1172.39,53.84c61.63,0,111.08,32.89,111.08,91.98v8.36c0,59.09-49.45,91.98-111.08,91.98h-12.68c-63.15,0-113.62-32.89-113.62-91.98v-8.36c0-59.09,50.47-91.98,113.62-91.98h12.68ZM1100.62,145.82v8.36c0,27.04,22.32,41.81,59.09,41.81h10.14c36.77,0,59.09-14.77,59.09-41.81v-8.36c0-27.32-22.32-41.81-59.09-41.81h-10.14c-36.77,0-59.09,14.49-59.09,41.81Z"/><path class="cls-1" d="M1461.02,56.63c38.8,0,60.61,25.64,60.61,57.14v8.36c0,23.13-11.67,43.2-31.7,52.12l39.06,69.12h-60.61l-36.27-63.83h-66.19v63.83h-53.26V56.63h148.37ZM1365.91,135.23h80.65c14.71,0,20.54-5.3,20.54-15.61v-3.07c0-9.48-5.83-16.17-20.54-16.17h-80.65v34.84Z"/><path class="cls-1" d="M1670,56.63c60.62,0,99.42,25.36,99.42,86.41v15.33c0,59.93-37.03,85.01-99.42,85.01h-119.45V56.63h119.45ZM1603.81,195.99h66.19c33.73,0,44.89-13.1,44.89-37.63v-15.33c0-25.09-10.65-39.02-44.89-39.02h-66.19v91.98Z"/><polygon class="cls-2" points="118.97 162.54 98.66 207.09 190.26 162.54 118.97 162.54"/></svg>
@@ -1,3 +0,0 @@
1
- <svg width="41" height="41" viewBox="0 0 41 41" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M37.5834 20.5H30.7501L25.6251 35.875L15.3751 5.125L10.2501 20.5H3.41675" stroke="#479E78" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
3
- </svg>
@@ -1,3 +0,0 @@
1
- <svg width="8" height="14" viewBox="0 0 8 14" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M1 13L7 7L1 1" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
3
- </svg>
@@ -1,3 +0,0 @@
1
- <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M16 6V5.2C16 4.0799 16 3.51984 15.782 3.09202C15.5903 2.71569 15.2843 2.40973 14.908 2.21799C14.4802 2 13.9201 2 12.8 2H11.2C10.0799 2 9.51984 2 9.09202 2.21799C8.71569 2.40973 8.40973 2.71569 8.21799 3.09202C8 3.51984 8 4.0799 8 5.2V6M10 11.5V16.5M14 11.5V16.5M3 6H21M19 6V17.2C19 18.8802 19 19.7202 18.673 20.362C18.3854 20.9265 17.9265 21.3854 17.362 21.673C16.7202 22 15.8802 22 14.2 22H9.8C8.11984 22 7.27976 22 6.63803 21.673C6.07354 21.3854 5.6146 20.9265 5.32698 20.362C5 19.7202 5 18.8802 5 17.2V6" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
3
- </svg>