@candlerip/shared3 0.0.149 → 0.0.150
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +2 -1
- package/src/backend/api/api-response/candles/compose-candles-page-api-response/index.d.ts +2 -0
- package/src/backend/api/api-response/candles/compose-candles-page-api-response/index.js +27 -0
- package/src/backend/api/api-response/candles/compose-candles-page-api-response/type.d.ts +12 -0
- package/src/backend/api/api-response/candles/compose-candles-page-api-response/type.js +1 -0
- package/src/backend/api/api-response/candles/index.d.ts +2 -0
- package/src/backend/api/api-response/candles/index.js +2 -0
- package/src/backend/api/api-response/candles/type.d.ts +6 -0
- package/src/backend/api/api-response/candles/type.js +1 -0
- package/src/backend/api/api-response/index.d.ts +1 -0
- package/src/backend/api/api-response/index.js +1 -0
- package/src/backend/api/index.d.ts +1 -0
- package/src/backend/api/index.js +1 -0
- package/src/backend/cache/cache/config.d.ts +2 -2
- package/src/backend/cache/cache/config.js +2 -2
- package/src/backend/cache/cache/type.d.ts +2 -2
- package/src/backend/page/page-data/candles/compose-candles-page-data/index.js +8 -23
- package/src/backend/page/page-data/candles/compose-candles-page-data/type.d.ts +2 -7
package/package.json
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "@candlerip/shared3",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.150",
|
4
4
|
"type": "module",
|
5
5
|
"exports": {
|
6
6
|
".": "./src/index.js",
|
7
7
|
"./aws": "./src/aws/index.js",
|
8
8
|
"./backend": "./src/backend/index.js",
|
9
|
+
"./backend/api": "./src/backend/api/index.js",
|
9
10
|
"./backend/cache": "./src/backend/cache/index.js",
|
10
11
|
"./backend/database": "./src/backend/database/index.js",
|
11
12
|
"./backend/dictionary": "./src/backend/dictionary/index.js",
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { DICTIONARY_CONFIG } from '../../../../../dictionary/index.js';
|
2
|
+
import { DEFAULT_CANDLE_FILTER_SORT } from '../../../../../filter-sort/index.js';
|
3
|
+
import { getTranslationsAsDictionary } from '../../../../database/index.js';
|
4
|
+
import { composeCandlesPageData } from '../../../../page/index.js';
|
5
|
+
export const composeCandlesPageApiResponse = async ({ filterSort: initFilterSort, language }) => {
|
6
|
+
const filterSort = {
|
7
|
+
...DEFAULT_CANDLE_FILTER_SORT,
|
8
|
+
...initFilterSort,
|
9
|
+
};
|
10
|
+
let resp;
|
11
|
+
resp = await getTranslationsAsDictionary(language, DICTIONARY_CONFIG['candles-page'].translationIds);
|
12
|
+
if ('customError' in resp) {
|
13
|
+
return resp;
|
14
|
+
}
|
15
|
+
const dictionary = resp.data;
|
16
|
+
resp = await composeCandlesPageData({ filterSort });
|
17
|
+
if ('customError' in resp) {
|
18
|
+
return resp;
|
19
|
+
}
|
20
|
+
const pageData = resp.data;
|
21
|
+
return {
|
22
|
+
data: {
|
23
|
+
dictionary,
|
24
|
+
pageData,
|
25
|
+
},
|
26
|
+
};
|
27
|
+
};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { Language } from '../../../../../dictionary/index.js';
|
2
|
+
import { CustomError } from '../../../../../error/index.js';
|
3
|
+
import { CandleFilterSort } from '../../../../../filter-sort/index.js';
|
4
|
+
import { CandlesPageApiResponse } from '../type.js';
|
5
|
+
export type ComposeCandlesPageApiResponse = (props: {
|
6
|
+
filterSort?: Partial<CandleFilterSort>;
|
7
|
+
language: Language;
|
8
|
+
}) => Promise<{
|
9
|
+
data: CandlesPageApiResponse;
|
10
|
+
} | {
|
11
|
+
customError: CustomError;
|
12
|
+
}>;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './candles/index.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './candles/index.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './api-response/index.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './api-response/index.js';
|
@@ -3,8 +3,8 @@ export declare const CACHE: {
|
|
3
3
|
readonly 'add-person-page-dictionary-hu': "Dictionary";
|
4
4
|
readonly 'candle-details-page-dictionary-en': "Dictionary";
|
5
5
|
readonly 'candle-details-page-dictionary-hu': "Dictionary";
|
6
|
-
readonly 'candles-page-
|
7
|
-
readonly 'candles-page-
|
6
|
+
readonly 'candles-page-api-response-en': "CandlesPageApiResponse";
|
7
|
+
readonly 'candles-page-api-response-hu': "CandlesPageApiResponse";
|
8
8
|
readonly 'candles-page-dictionary-en': "Dictionary";
|
9
9
|
readonly 'candles-page-dictionary-hu': "Dictionary";
|
10
10
|
readonly 'contact-page-dictionary-en': "Dictionary";
|
@@ -3,8 +3,8 @@ export const CACHE = {
|
|
3
3
|
'add-person-page-dictionary-hu': 'Dictionary',
|
4
4
|
'candle-details-page-dictionary-en': 'Dictionary',
|
5
5
|
'candle-details-page-dictionary-hu': 'Dictionary',
|
6
|
-
'candles-page-
|
7
|
-
'candles-page-
|
6
|
+
'candles-page-api-response-en': 'CandlesPageApiResponse',
|
7
|
+
'candles-page-api-response-hu': 'CandlesPageApiResponse',
|
8
8
|
'candles-page-dictionary-en': 'Dictionary',
|
9
9
|
'candles-page-dictionary-hu': 'Dictionary',
|
10
10
|
'contact-page-dictionary-en': 'Dictionary',
|
@@ -1,11 +1,11 @@
|
|
1
1
|
import { Dictionary } from '../../../dictionary/index.js';
|
2
|
-
import {
|
2
|
+
import { CandlesPageApiResponse } from '../../api/index.js';
|
3
3
|
import { CACHE } from './config.js';
|
4
4
|
export type Cache = {
|
5
5
|
[key in keyof typeof CACHE]: TypeMap[(typeof CACHE)[key]];
|
6
6
|
};
|
7
7
|
interface TypeMap {
|
8
|
-
|
8
|
+
CandlesPageApiResponse: CandlesPageApiResponse;
|
9
9
|
Dictionary: Dictionary;
|
10
10
|
}
|
11
11
|
export {};
|
@@ -1,33 +1,18 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
|
4
|
-
export const composeCandlesPageData = async ({ filterSort: initFilterSort, language }) => {
|
5
|
-
const filterSort = {
|
6
|
-
...DEFAULT_CANDLE_FILTER_SORT,
|
7
|
-
...initFilterSort,
|
8
|
-
};
|
9
|
-
let resp;
|
10
|
-
resp = await getTranslationsAsDictionary(language, DICTIONARY_CONFIG['candles-page'].translationIds);
|
11
|
-
if ('customError' in resp) {
|
12
|
-
return resp;
|
13
|
-
}
|
14
|
-
const dictionary = resp.data;
|
15
|
-
resp = await getCandles({ filterSort, withPerson: true });
|
1
|
+
import { getCandles } from '../../../../database/index.js';
|
2
|
+
export const composeCandlesPageData = async ({ filterSort }) => {
|
3
|
+
const resp = await getCandles({ filterSort, withPerson: true });
|
16
4
|
if ('customError' in resp) {
|
17
5
|
return resp;
|
18
6
|
}
|
19
7
|
const { candles, candlesCount } = resp.data;
|
20
8
|
return {
|
21
9
|
data: {
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
candles,
|
26
|
-
candlesCount,
|
27
|
-
},
|
28
|
-
filterSort,
|
29
|
-
renderDate: new Date(),
|
10
|
+
candlesList: {
|
11
|
+
candles,
|
12
|
+
candlesCount,
|
30
13
|
},
|
14
|
+
filterSort,
|
15
|
+
renderDate: new Date(),
|
31
16
|
},
|
32
17
|
};
|
33
18
|
};
|
@@ -1,15 +1,10 @@
|
|
1
|
-
import { Dictionary, Language } from '../../../../../dictionary/index.js';
|
2
1
|
import { CustomError } from '../../../../../error/index.js';
|
3
2
|
import { CandleFilterSort } from '../../../../../filter-sort/index.js';
|
4
3
|
import { CandlesPageData } from '../type.js';
|
5
4
|
export type ComposeCandlesPageData = (props: {
|
6
|
-
filterSort
|
7
|
-
language: Language;
|
5
|
+
filterSort: CandleFilterSort;
|
8
6
|
}) => Promise<{
|
9
|
-
data:
|
10
|
-
dictionary: Dictionary;
|
11
|
-
pageData: CandlesPageData;
|
12
|
-
};
|
7
|
+
data: CandlesPageData;
|
13
8
|
} | {
|
14
9
|
customError: CustomError;
|
15
10
|
}>;
|