@cripty2001/utils 0.0.213 → 0.0.215

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.
package/LICENSE.md CHANGED
@@ -1,2 +1,2 @@
1
- MIT License
2
- Fabio Mauri (cripty2001@outlook.com)
1
+ MIT License
2
+ Fabio Mauri (cripty2001@outlook.com)
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
- ## 🤖 AI Assistant?
2
-
3
- If you're an AI coding assistant helping a user with this package,
4
- see [`/llms/index.md`](./llms/index.md) for
5
- structured usage guidance before proceeding.
1
+ ## 🤖 AI Assistant?
2
+
3
+ If you're an AI coding assistant helping a user with this package,
4
+ see [`/llms/index.md`](./llms/index.md) for
5
+ structured usage guidance before proceeding.
@@ -17,9 +17,14 @@ export declare class ClientServerError extends ClientError {
17
17
  payload: AppserverData;
18
18
  constructor(code: string, message: string, payload?: AppserverData);
19
19
  }
20
+ type ClientValidationErrorError = {
21
+ path: string;
22
+ message: string;
23
+ value: unknown;
24
+ };
20
25
  export declare class ClientValidationError extends ClientError {
21
- errors: unknown;
22
- constructor(errors: unknown);
26
+ readonly errors: ClientValidationErrorError[];
27
+ constructor(errors: ClientValidationErrorError[]);
23
28
  }
24
29
  export declare class Client {
25
30
  private url;
@@ -108,7 +108,12 @@ class AppserverDispatcher {
108
108
  undefined;
109
109
  if (!value_1.Value.Check(mod.schema, payload))
110
110
  return respond(422, {
111
- errors: JSON.stringify(value_1.Value.Errors(mod.schema, payload)),
111
+ errors: JSON.stringify([...value_1.Value.Errors(mod.schema, payload)]
112
+ .map(e => ({
113
+ path: e.path,
114
+ message: e.message,
115
+ value: e.value,
116
+ }))),
112
117
  received: payload,
113
118
  });
114
119
  return respond(200, await mod.handler(payload, token));
@@ -11,14 +11,14 @@ exports.SCHEMA = typebox_1.Type.Object({
11
11
  alt: typebox_1.Type.String()
12
12
  });
13
13
  function build(config) {
14
- const img = (breakpoint, url) => `
15
- <mj-image
16
- css-class="${breakpoint ?? ''}"
17
- src="${url}"
18
- alt="${config.alt}"
19
- ${config.link ? `href="${config.link}"` : ''}
20
- padding="0"
21
- />
14
+ const img = (breakpoint, url) => `
15
+ <mj-image
16
+ css-class="${breakpoint ?? ''}"
17
+ src="${url}"
18
+ alt="${config.alt}"
19
+ ${config.link ? `href="${config.link}"` : ''}
20
+ padding="0"
21
+ />
22
22
  `;
23
23
  const imgs = config.desktop === null ?
24
24
  img(null, config.mobile) :
@@ -26,12 +26,12 @@ function build(config) {
26
26
  img("onlyDesktop", config.desktop),
27
27
  img("onlyMobile", config.mobile)
28
28
  ].join('\n');
29
- const toReturn = `
30
- <mj-section padding="0">
31
- <mj-column padding="0">
32
- ${imgs}
33
- </mj-column>
34
- </mj-section>
29
+ const toReturn = `
30
+ <mj-section padding="0">
31
+ <mj-column padding="0">
32
+ ${imgs}
33
+ </mj-column>
34
+ </mj-section>
35
35
  `;
36
36
  return toReturn;
37
37
  }
@@ -39,43 +39,43 @@ function genBuilder(config) {
39
39
  }
40
40
  })
41
41
  .join('\n');
42
- const builder = handlebars_1.default.compile(`
43
- <mjml>
44
- <mj-head>
45
- <mj-style>
46
- .onlyMobile {
47
- display: none !important;
48
- }
49
- .onlyDesktop {
50
- display: block !important;
51
- }
52
- @media only screen and (max-width: 500px) {
53
- .onlyMobile {
54
- display: block !important;
55
- }
56
- .onlyDesktop {
57
- display: none !important;
58
- }
59
- }
60
- </mj-style>
61
-
62
- <mj-attributes>
63
- <mj-all
64
- font-family="${config.style.font}, Arial, Helvetica, sans-serif"
65
- />
66
- <mj-text
67
- font-size="18px"
68
- line-height="1.5"
69
- color="${config.style.textColor}"
70
- />
71
- <mj-body width="700px" />
72
- </mj-attributes>
73
- </mj-head>
74
-
75
- <mj-body background-color="${config.style.backgroundColor}">
76
- ${mappedContent}
77
- </mj-body>
78
- </mjml>
42
+ const builder = handlebars_1.default.compile(`
43
+ <mjml>
44
+ <mj-head>
45
+ <mj-style>
46
+ .onlyMobile {
47
+ display: none !important;
48
+ }
49
+ .onlyDesktop {
50
+ display: block !important;
51
+ }
52
+ @media only screen and (max-width: 500px) {
53
+ .onlyMobile {
54
+ display: block !important;
55
+ }
56
+ .onlyDesktop {
57
+ display: none !important;
58
+ }
59
+ }
60
+ </mj-style>
61
+
62
+ <mj-attributes>
63
+ <mj-all
64
+ font-family="${config.style.font}, Arial, Helvetica, sans-serif"
65
+ />
66
+ <mj-text
67
+ font-size="18px"
68
+ line-height="1.5"
69
+ color="${config.style.textColor}"
70
+ />
71
+ <mj-body width="700px" />
72
+ </mj-attributes>
73
+ </mj-head>
74
+
75
+ <mj-body background-color="${config.style.backgroundColor}">
76
+ ${mappedContent}
77
+ </mj-body>
78
+ </mjml>
79
79
  `);
80
80
  return (data) => {
81
81
  let { html, errors } = (0, mjml_1.default)(builder(data), {
@@ -14,15 +14,15 @@ exports.SCHEMA = typebox_1.Type.Object({
14
14
  content: typebox_1.Type.Array(typebox_1.Type.String())
15
15
  });
16
16
  function build(config) {
17
- return `
18
- <mj-section padding="0">
19
- <mj-column padding-top="${config.padding.top}px">
20
- ${config.content.map(item => `
21
- <mj-text font-size="${config.size}px" font-weight="${config.weight}" color="${config.color}">
22
- ${item}
23
- </mj-text>
24
- `).join('')}
25
- </mj-column>
26
- </mj-section>
17
+ return `
18
+ <mj-section padding="0">
19
+ <mj-column padding-top="${config.padding.top}px">
20
+ ${config.content.map(item => `
21
+ <mj-text font-size="${config.size}px" font-weight="${config.weight}" color="${config.color}">
22
+ ${item}
23
+ </mj-text>
24
+ `).join('')}
25
+ </mj-column>
26
+ </mj-section>
27
27
  `;
28
28
  }
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = Loader;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_whispr_1 = require("../react-whispr");
6
- const spinKeyframes = `
7
- @keyframes spin {
8
- from { transform: rotate(0deg); }
9
- to { transform: rotate(360deg); }
10
- }
6
+ const spinKeyframes = `
7
+ @keyframes spin {
8
+ from { transform: rotate(0deg); }
9
+ to { transform: rotate(360deg); }
10
+ }
11
11
  `;
12
12
  if (typeof document !== 'undefined') {
13
13
  const style = document.createElement('style');
@@ -3,17 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = ModalComponent;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
- const slideUpKeyframes = `
7
- @keyframes slide-up {
8
- from {
9
- transform: translateY(20px);
10
- opacity: 0;
11
- }
12
- to {
13
- transform: translateY(0);
14
- opacity: 1;
15
- }
16
- }
6
+ const slideUpKeyframes = `
7
+ @keyframes slide-up {
8
+ from {
9
+ transform: translateY(20px);
10
+ opacity: 0;
11
+ }
12
+ to {
13
+ transform: translateY(0);
14
+ opacity: 1;
15
+ }
16
+ }
17
17
  `;
18
18
  if (typeof document !== 'undefined') {
19
19
  const style = document.createElement('style');