underpost 2.8.64 → 2.8.67

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 (51) hide show
  1. package/.vscode/extensions.json +3 -2
  2. package/.vscode/settings.json +2 -0
  3. package/CHANGELOG.md +24 -4
  4. package/README.md +39 -2
  5. package/bin/deploy.js +1205 -131
  6. package/bin/file.js +8 -0
  7. package/bin/index.js +1 -233
  8. package/cli.md +451 -0
  9. package/docker-compose.yml +1 -1
  10. package/jsdoc.json +1 -1
  11. package/manifests/calico-custom-resources.yaml +25 -0
  12. package/manifests/deployment/adminer/deployment.yaml +32 -0
  13. package/manifests/deployment/adminer/kustomization.yaml +7 -0
  14. package/manifests/deployment/adminer/service.yaml +13 -0
  15. package/manifests/mongodb-4.4/service-deployment.yaml +1 -1
  16. package/manifests/postgresql/configmap.yaml +9 -0
  17. package/manifests/postgresql/kustomization.yaml +10 -0
  18. package/manifests/postgresql/pv.yaml +15 -0
  19. package/manifests/postgresql/pvc.yaml +13 -0
  20. package/manifests/postgresql/service.yaml +10 -0
  21. package/manifests/postgresql/statefulset.yaml +37 -0
  22. package/manifests/valkey/statefulset.yaml +6 -4
  23. package/package.json +3 -9
  24. package/src/api/user/user.service.js +13 -10
  25. package/src/cli/cluster.js +113 -11
  26. package/src/cli/db.js +18 -8
  27. package/src/cli/deploy.js +157 -58
  28. package/src/cli/fs.js +14 -3
  29. package/src/cli/image.js +0 -68
  30. package/src/cli/index.js +312 -0
  31. package/src/cli/monitor.js +170 -26
  32. package/src/cli/repository.js +5 -2
  33. package/src/client/components/core/Account.js +3 -3
  34. package/src/client/components/core/CalendarCore.js +0 -1
  35. package/src/client/components/core/Css.js +0 -1
  36. package/src/client/components/core/CssCore.js +2 -0
  37. package/src/client/components/core/EventsUI.js +1 -1
  38. package/src/client/components/core/JoyStick.js +2 -2
  39. package/src/client/components/core/Modal.js +1 -0
  40. package/src/client/components/core/RichText.js +1 -11
  41. package/src/index.js +9 -8
  42. package/src/mailer/MailerProvider.js +3 -0
  43. package/src/server/client-build.js +13 -0
  44. package/src/server/conf.js +48 -0
  45. package/src/server/dns.js +47 -17
  46. package/src/server/json-schema.js +77 -0
  47. package/src/server/peer.js +2 -2
  48. package/src/server/proxy.js +4 -4
  49. package/src/server/runtime.js +24 -9
  50. package/src/server/start.js +122 -0
  51. package/src/server/valkey.js +25 -11
@@ -5,12 +5,24 @@ import { loggerFactory } from './logger.js';
5
5
 
6
6
  const logger = loggerFactory(import.meta);
7
7
 
8
+ const ValkeyInstances = {};
9
+
8
10
  let valkeyEnabled = true;
9
11
 
10
12
  const disableValkeyErrorMessage = 'valkey is not enabled';
11
13
 
12
14
  const isValkeyEnable = () => valkeyEnabled;
13
15
 
16
+ const createValkeyConnection = async (
17
+ instance = { host: '', port: 0 },
18
+ valkeyServerConnectionOptions = { host: '', port: 0 },
19
+ ) => {
20
+ ValkeyInstances[`${instance.host}${instance.path}`] = await ValkeyAPI.valkeyClientFactory(
21
+ valkeyServerConnectionOptions,
22
+ );
23
+ return ValkeyInstances[`${instance.host}${instance.path}`];
24
+ };
25
+
14
26
  const selectDtoFactory = (payload, select) => {
15
27
  const result = {};
16
28
  for (const key of Object.keys(select)) {
@@ -19,10 +31,12 @@ const selectDtoFactory = (payload, select) => {
19
31
  return result;
20
32
  };
21
33
 
22
- const valkeyClientFactory = async () => {
34
+ const valkeyClientFactory = async (options) => {
23
35
  const valkey = new Valkey({
24
36
  // port: 6379,
25
37
  // host: 'service-valkey.default.svc.cluster.local',
38
+ port: options?.port ? options.port : undefined,
39
+ host: options?.port ? options.host : undefined,
26
40
  retryStrategy: (attempt) => {
27
41
  if (attempt === 1) {
28
42
  valkey.disconnect();
@@ -46,12 +60,12 @@ const valkeyClientFactory = async () => {
46
60
  return valkey;
47
61
  };
48
62
 
49
- const getValkeyObject = async (key = '') => {
63
+ const getValkeyObject = async (options = { host: '', port: 0 }, key = '') => {
50
64
  if (!valkeyEnabled) {
51
65
  logger.warn(disableValkeyErrorMessage + ' get', key);
52
66
  return null;
53
67
  }
54
- const object = await valkey.get(key);
68
+ const object = await ValkeyInstances[`${options.host}${options.path}`].get(key);
55
69
  try {
56
70
  return JSON.parse(object);
57
71
  } catch (error) {
@@ -60,19 +74,19 @@ const getValkeyObject = async (key = '') => {
60
74
  }
61
75
  };
62
76
 
63
- const setValkeyObject = async (key = '', payload = {}) => {
77
+ const setValkeyObject = async (options = { host: '', port: 0 }, key = '', payload = {}) => {
64
78
  if (!valkeyEnabled) throw new Error(disableValkeyErrorMessage);
65
- return await valkey.set(key, JSON.stringify(payload));
79
+ return await ValkeyInstances[`${options.host}${options.path}`].set(key, JSON.stringify(payload));
66
80
  };
67
81
 
68
- const updateValkeyObject = async (key = '', payload = {}) => {
82
+ const updateValkeyObject = async (options = { host: '', port: 0 }, key = '', payload = {}) => {
69
83
  if (!valkeyEnabled) throw new Error(disableValkeyErrorMessage);
70
- const object = await getValkeyObject(key, valkey);
84
+ const object = await getValkeyObject(key);
71
85
  object.updatedAt = new Date().toISOString();
72
- return await valkey.set(key, JSON.stringify({ ...object, ...payload }));
86
+ return await ValkeyInstances[`${options.host}${options.path}`].set(key, JSON.stringify({ ...object, ...payload }));
73
87
  };
74
88
 
75
- const valkeyObjectFactory = async (module = '', options = { host: 'localhost', object: {} }) => {
89
+ const valkeyObjectFactory = async (options = { host: 'localhost', object: {} }, module = '') => {
76
90
  if (!valkeyEnabled) throw new Error(disableValkeyErrorMessage);
77
91
  const idoDate = new Date().toISOString();
78
92
  options.object = options.object || {};
@@ -112,10 +126,9 @@ const ValkeyAPI = {
112
126
  setValkeyObject,
113
127
  valkeyObjectFactory,
114
128
  updateValkeyObject,
129
+ createValkeyConnection,
115
130
  };
116
131
 
117
- const valkey = await ValkeyAPI.valkeyClientFactory();
118
-
119
132
  export {
120
133
  valkeyClientFactory,
121
134
  selectDtoFactory,
@@ -124,5 +137,6 @@ export {
124
137
  valkeyObjectFactory,
125
138
  updateValkeyObject,
126
139
  isValkeyEnable,
140
+ createValkeyConnection,
127
141
  ValkeyAPI,
128
142
  };