aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2024-02-01 14:58:36 -0300
committerSebastian <sebasjm@gmail.com>2024-02-01 14:59:04 -0300
commitfa86b6d486ff9dfe9c5072018d45eab6929215dc (patch)
tree53219af5cdab601c3c79f17e5bb0c351f8016569
parentcb342d20ffddda3eb79950a69a328e399e76817d (diff)
downloadwallet-core-fa86b6d486ff9dfe9c5072018d45eab6929215dc.tar.xz
fixes #8201
-rwxr-xr-xpackages/merchant-backend-ui/build.mjs54
-rw-r--r--packages/merchant-backend-ui/package.json5
-rw-r--r--packages/merchant-backend-ui/render-examples.ts122
-rw-r--r--packages/merchant-backend-ui/src/pages/ShowOrderDetails.examples.ts28
-rw-r--r--packages/merchant-backend-ui/src/pages/ShowOrderDetails.tsx81
-rw-r--r--packages/merchant-backend-ui/src/render-examples.ts112
-rw-r--r--packages/merchant-backend-ui/src/utils.ts41
-rw-r--r--pnpm-lock.yaml45
8 files changed, 287 insertions, 201 deletions
diff --git a/packages/merchant-backend-ui/build.mjs b/packages/merchant-backend-ui/build.mjs
index fd2a52b9e..e53c96737 100755
--- a/packages/merchant-backend-ui/build.mjs
+++ b/packages/merchant-backend-ui/build.mjs
@@ -44,7 +44,7 @@ const preactCompatPlugin = {
},
};
-const pages = ["OfferTip","OfferRefund","DepletedTip","RequestPayment","ShowOrderDetails"]
+const pages = ["OfferTip", "OfferRefund", "DepletedTip", "RequestPayment", "ShowOrderDetails"]
const entryPoints = pages.map(p => `src/pages/${p}.tsx`);
let GIT_ROOT = BASE;
@@ -87,8 +87,8 @@ function templatePlugin(options) {
setup(build) {
build.onEnd(() => {
for (const pageName of options.pages) {
- const css = fs.readFileSync(path.join(build.initialOptions.outdir, `${pageName}.css`),"utf8").toString()
- const js = fs.readFileSync(path.join(build.initialOptions.outdir, `${pageName}.js`),"utf8").toString()
+ const css = fs.readFileSync(path.join(build.initialOptions.outdir, `${pageName}.css`), "utf8").toString()
+ const js = fs.readFileSync(path.join(build.initialOptions.outdir, `${pageName}.js`), "utf8").toString()
const location = path.join(build.initialOptions.outdir, toCamelCaseName(pageName))
const render = new Function(`${js}; return page.buildTimeRendering();`)()
const html = `
@@ -113,20 +113,18 @@ function templatePlugin(options) {
};
}
-
-
export const buildConfig = {
entryPoints: [...entryPoints],
bundle: true,
outdir: "dist/pages",
- /*
- * Doing a minified version will replace templatestring to common strings
- * This app is building mustache template with placeholders that will be replaced
- * with string in runtime by the merchant-backend
- *
- * To the date, merchant backend is replacing with multiline string so
- * doing minified version will brake at runtime
- * */
+ /*
+ * Doing a minified version will replace templatestring to common strings
+ * This app is building mustache template with placeholders that will be replaced
+ * with string in runtime by the merchant-backend
+ *
+ * To the date, merchant backend is replacing with multiline string so
+ * doing minified version will brake at runtime
+ * */
minify: false,
loader: {
".svg": "file",
@@ -157,8 +155,36 @@ export const buildConfig = {
sourceMap: true,
}),
preactCompatPlugin,
- templatePlugin({pages})
+ templatePlugin({ pages })
],
};
await esbuild.build(buildConfig)
+
+export const testingConfig = {
+ entryPoints: ["src/render-examples.ts"],
+ bundle: true,
+ outdir: "dist/test",
+ minify: false,
+ loader: {
+ ".svg": "file",
+ ".png": "dataurl",
+ ".jpeg": "dataurl",
+ '.ttf': 'file',
+ '.woff': 'file',
+ '.woff2': 'file',
+ '.eot': 'file',
+ },
+ target: ["es6"],
+ format: "iife",
+ platform: "node",
+ sourcemap: true,
+ define: {
+ __VERSION__: `"${_package.version}"`,
+ __GIT_HASH__: `"${GIT_HASH}"`,
+ },
+ plugins: [
+ ],
+};
+
+await esbuild.build(testingConfig)
diff --git a/packages/merchant-backend-ui/package.json b/packages/merchant-backend-ui/package.json
index e8a72bf09..f7306baf8 100644
--- a/packages/merchant-backend-ui/package.json
+++ b/packages/merchant-backend-ui/package.json
@@ -6,7 +6,7 @@
"scripts": {
"compile": "tsc && ./build.mjs",
"build": "pnpm compile",
- "render-examples": "ts-node -O '{\"module\": \"commonjs\"}' -T render-examples.ts dist/pages dist/examples",
+ "render-examples": "node dist/test/render-examples.js dist/pages dist/examples",
"lint-check": "eslint '{src,tests}/**/*.{js,jsx,ts,tsx}'",
"lint-fix": "eslint --fix '{src,tests}/**/*.{js,jsx,ts,tsx}'",
"clean": "rm -rf dist lib tsconfig.tsbuildinfo",
@@ -50,6 +50,7 @@
"@linaria/webpack-loader": "3.0.0-beta.22",
"@types/mocha": "^8.2.2",
"@types/mustache": "^4.1.2",
+ "@types/node": "^20.11.13",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
"babel-loader": "^8.2.2",
@@ -65,4 +66,4 @@
"tslib": "2.6.2",
"typescript": "5.3.3"
}
-}
+} \ No newline at end of file
diff --git a/packages/merchant-backend-ui/render-examples.ts b/packages/merchant-backend-ui/render-examples.ts
deleted file mode 100644
index e8c4a8cd0..000000000
--- a/packages/merchant-backend-ui/render-examples.ts
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- This file is part of GNU Taler
- (C) 2021 Taler Systems S.A.
-
- GNU Taler is free software; you can redistribute it and/or modify it under the
- terms of the GNU General Public License as published by the Free Software
- Foundation; either version 3, or (at your option) any later version.
-
- GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along with
- GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
- */
-
-/**
- *
- * @author Sebastian Javier Marchano (sebasjm)
- */
-
-import mustache from "mustache";
-import fs from "fs";
-import { format, formatDuration, intervalToDuration } from "date-fns";
-
-/**
- * This script will emulate what the merchant backend will do when being requested
- *
- */
-
-const sourceDirectory = process.argv[2];
-const destDirectory = process.argv[3];
-
-if (!sourceDirectory || !destDirectory) {
- console.log("usage: render-mustache <source-directory> <dest-directory>");
- process.exit(1);
-}
-
-if (!fs.existsSync(destDirectory)) {
- fs.mkdirSync(destDirectory);
-}
-
-function fromCamelCaseName(name) {
- const result = name
- .replace(/^[a-z]/, (letter) => `${letter.toUpperCase()}`) //first letter lowercase
- .replace(/_[a-z]/g, (letter) => `${letter[1].toUpperCase()}`); //snake case
- return result;
-}
-/**
- * Load all the html files
- */
-const files = fs.readdirSync(sourceDirectory).filter((f) => /.html/.test(f));
-
-files.forEach((file) => {
- const html = fs.readFileSync(`${sourceDirectory}/${file}`, "utf8");
-
- const testName = file.replace(".en.html", "");
- const exampleFileName = `./src/pages/${fromCamelCaseName(testName)}.examples`;
- if (!fs.existsSync(exampleFileName + ".ts")) {
- console.log(`skipping ${testName}: no examples found`);
- return;
- }
- // eslint-disable-next-line @typescript-eslint/no-var-requires
- const { exampleData } = require(exampleFileName);
-
- Object.keys(exampleData).forEach((exampleName) => {
- const example = exampleData[exampleName];
-
- //enhance the example with more information
- example.contract_terms_json = () => JSON.stringify(example.contract_terms);
- example.contract_terms.timestamp_str = () =>
- example.contract_terms.timestamp &&
- format(example.contract_terms.timestamp.t_s, "dd MMM yyyy HH:mm:ss");
-
- example.contract_terms.hasProducts = () =>
- example.contract_terms.products?.length > 0;
- example.contract_terms.hasAuditors = () =>
- example.contract_terms.auditors?.length > 0;
- example.contract_terms.hasExchanges = () =>
- example.contract_terms.exchanges?.length > 0;
-
- example.contract_terms.products.forEach((p) => {
- p.delivery_date_str = () =>
- p.delivery_date && format(p.delivery_date.t_s, "dd MM yyyy HH:mm:ss");
- p.hasTaxes = () => p.taxes?.length > 0;
- });
- example.contract_terms.has_delivery_info = () =>
- example.contract_terms.delivery_date ||
- example.contract_terms.delivery_location;
-
- example.contract_terms.delivery_date_str = () =>
- example.contract_terms.delivery_date &&
- format(example.contract_terms.delivery_date.t_s, "dd MM yyyy HH:mm:ss");
- example.contract_terms.pay_deadline_str = () =>
- example.contract_terms.pay_deadline &&
- format(example.contract_terms.pay_deadline.t_s, "dd MM yyyy HH:mm:ss");
- example.contract_terms.wire_transfer_deadline_str = () =>
- example.contract_terms.wire_transfer_deadline &&
- format(
- example.contract_terms.wire_transfer_deadline.t_s,
- "dd MM yyyy HH:mm:ss",
- );
- example.contract_terms.refund_deadline_str = () =>
- example.contract_terms.refund_deadline &&
- format(example.contract_terms.refund_deadline.t_s, "dd MM yyyy HH:mm:ss");
- example.contract_terms.auto_refund_str = () =>
- example.contract_terms.auto_refund &&
- formatDuration(
- intervalToDuration({
- start: 0,
- end: example.contract_terms.auto_refund.d_us,
- }),
- );
-
- const output = mustache.render(html, example);
-
- fs.writeFileSync(
- `${destDirectory}/${testName}.${exampleName}.html`,
- output,
- );
- });
-});
diff --git a/packages/merchant-backend-ui/src/pages/ShowOrderDetails.examples.ts b/packages/merchant-backend-ui/src/pages/ShowOrderDetails.examples.ts
index d80401129..86992c9e1 100644
--- a/packages/merchant-backend-ui/src/pages/ShowOrderDetails.examples.ts
+++ b/packages/merchant-backend-ui/src/pages/ShowOrderDetails.examples.ts
@@ -61,7 +61,7 @@ const defaultContractTerms: MerchantBackend.ContractTerms = {
},
wire_method: 'x-taler-bank',
wire_transfer_deadline: {
- t_s: Math.round(new Date().getTime() / 1000) + 3 * 24 * 60 * 60
+ t_s: Math.round(new Date().getTime() / 1000) + 3 * 24 * 60 * 60
},
};
@@ -224,4 +224,30 @@ export const exampleData: { [name: string]: Props } = {
fulfillment_message: "Congratulations! You just purchased an valuable item!"
},
},
+ WithFulfillmentMessage: {
+ order_summary: 'this is the order with fulfillment message',
+ contract_terms: {
+ ...defaultContractTerms,
+ fulfillment_message: "Congratulations! You just purchased an valuable item!"
+ },
+ },
+ WithoutWireTransferDeadline: {
+ order_summary: 'this is the order without transfer deadline',
+ contract_terms: {
+ ...defaultContractTerms,
+ // @ts-ignore
+ wire_transfer_deadline: undefined,
+ },
+ },
+ ZeroFee: {
+ order_summary: 'example with zero fee',
+ contract_terms: {
+ ...defaultContractTerms,
+ // @ts-ignore
+ max_fee: undefined,
+ // @ts-ignore
+ max_wire_fee: undefined,
+ fulfillment_message: "Congratulations! You just purchased an valuable item!"
+ },
+ },
}
diff --git a/packages/merchant-backend-ui/src/pages/ShowOrderDetails.tsx b/packages/merchant-backend-ui/src/pages/ShowOrderDetails.tsx
index ca93c3f7d..c0ac07ff5 100644
--- a/packages/merchant-backend-ui/src/pages/ShowOrderDetails.tsx
+++ b/packages/merchant-backend-ui/src/pages/ShowOrderDetails.tsx
@@ -56,9 +56,9 @@ function Head({ order_summary }: { order_summary?: string }): VNode {
<Fragment>
<meta charSet="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <noscript>
+ {/* <noscript>
<meta http-equiv="refresh" content="1" />
- </noscript>
+ </noscript> */}
<title>
Status of your order for{" "}
{order_summary ? order_summary : `{{ order_summary }}`}
@@ -196,9 +196,9 @@ export function ShowOrderDetails({
{contract_terms?.timestamp
? contract_terms?.timestamp.t_s != "never"
? format(
- contract_terms?.timestamp.t_s,
- "dd MMM yyyy HH:mm:ss",
- )
+ contract_terms?.timestamp.t_s * 1000,
+ "dd MMM yyyy HH:mm:ss",
+ )
: "never"
: `{{ contract_terms.timestamp_str }}`}{" "}
</dd>
@@ -256,9 +256,9 @@ export function ShowOrderDetails({
{p.delivery_date
? p.delivery_date.t_s != "never"
? format(
- p.delivery_date.t_s,
- "dd MMM yyyy HH:mm:ss",
- )
+ p.delivery_date.t_s,
+ "dd MMM yyyy HH:mm:ss",
+ )
: "never"
: `{{ delivery_date_str }}`}{" "}
</dd>
@@ -306,9 +306,9 @@ export function ShowOrderDetails({
{contract_terms?.delivery_date
? contract_terms?.delivery_date.t_s != "never"
? format(
- contract_terms?.delivery_date.t_s,
- "dd MMM yyyy HH:mm:ss",
- )
+ contract_terms?.delivery_date.t_s,
+ "dd MMM yyyy HH:mm:ss",
+ )
: "never"
: `{{ contract_terms.delivery_date_str }}`}{" "}
</dd>
@@ -336,48 +336,47 @@ export function ShowOrderDetails({
<section>
<h2>Full payment information</h2>
<TableExpanded>
- <dt>Amount paid:</dt>
- <dd>{contract_terms?.amount || `{{ contract_terms.amount }}`}</dd>
- <dt>Wire transfer method:</dt>
- <dd>
- {contract_terms?.wire_method ||
- `{{ contract_terms.wire_method }}`}
- </dd>
- <dt>Payment deadline:</dt>
- <dd>
- {contract_terms?.pay_deadline
- ? contract_terms?.pay_deadline.t_s != "never"
- ? format(
- contract_terms?.pay_deadline.t_s,
- "dd MMM yyyy HH:mm:ss",
- )
- : "never"
- : `{{ contract_terms.pay_deadline_str }}`}{" "}
- </dd>
<dt>Exchange transfer deadline:</dt>
+ {btr && `{{` + `#contract_terms.wire_transfer_deadline_str}}`}
<dd>
{contract_terms?.wire_transfer_deadline
? contract_terms?.wire_transfer_deadline.t_s != "never"
? format(
- contract_terms?.wire_transfer_deadline.t_s,
- "dd MMM yyyy HH:mm:ss",
- )
+ contract_terms?.wire_transfer_deadline.t_s * 1000,
+ "dd MMM yyyy HH:mm:ss",
+ )
: "never"
: `{{ contract_terms.wire_transfer_deadline_str }}`}{" "}
</dd>
+ {btr && `{{` + `/contract_terms.wire_transfer_deadline_str}}`}
+
+ {btr && `{{` + `^contract_terms.wire_transfer_deadline_str}}`}
+ <dd>
+ Wire transfer settled.
+ </dd>
+ {btr && `{{` + `/contract_terms.wire_transfer_deadline_str}}`}
+
+ {btr && `{{` + `#contract_terms.max_fee}}`}
<dt>Maximum deposit fee:</dt>
<dd>{contract_terms?.max_fee || `{{ contract_terms.max_fee }}`}</dd>
+ {btr && `{{` + `/contract_terms.max_fee}}`}
+
+ {btr && `{{` + `#contract_terms.max_wire_fee}}`}
<dt>Maximum wire fee:</dt>
<dd>
{contract_terms?.max_wire_fee ||
`{{ contract_terms.max_wire_fee }}`}
</dd>
+ {btr && `{{` + `/contract_terms.max_wire_fee}}`}
+
+ {btr && `{{` + `#contract_terms.wire_fee_amortization}}`}
<dt>Wire fee amortization:</dt>
<dd>
{contract_terms?.wire_fee_amortization ||
`{{ contract_terms.wire_fee_amortization }}`}{" "}
transactions
</dd>
+ {btr && `{{` + `/contract_terms.wire_fee_amortization}}`}
</TableExpanded>
</section>
@@ -389,9 +388,9 @@ export function ShowOrderDetails({
{contract_terms?.refund_deadline
? contract_terms?.refund_deadline.t_s != "never"
? format(
- contract_terms?.refund_deadline.t_s,
- "dd MMM yyyy HH:mm:ss",
- )
+ contract_terms?.refund_deadline.t_s * 1000,
+ "dd MMM yyyy HH:mm:ss",
+ )
: "never"
: `{{ contract_terms.refund_deadline_str }}`}{" "}
</dd>
@@ -404,11 +403,11 @@ export function ShowOrderDetails({
{contract_terms?.auto_refund
? contract_terms?.auto_refund.d_us != "forever"
? formatDuration(
- intervalToDuration({
- start: 0,
- end: contract_terms?.auto_refund.d_us,
- }),
- )
+ intervalToDuration({
+ start: 0,
+ end: contract_terms?.auto_refund.d_us,
+ }),
+ )
: "forever"
: `{{ contract_terms.auto_refund_str }}`}{" "}
</dd>
@@ -539,7 +538,7 @@ export function mount(): void {
let contractTerms: MerchantBackend.ContractTerms | undefined;
try {
contractTerms = JSON.parse((window as any).contractTermsStr);
- } catch {}
+ } catch { }
render(
<ShowOrderDetails
diff --git a/packages/merchant-backend-ui/src/render-examples.ts b/packages/merchant-backend-ui/src/render-examples.ts
new file mode 100644
index 000000000..957e06a58
--- /dev/null
+++ b/packages/merchant-backend-ui/src/render-examples.ts
@@ -0,0 +1,112 @@
+/*
+ This file is part of GNU Taler
+ (C) 2021 Taler Systems S.A.
+
+ GNU Taler is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+ */
+
+/**
+ *
+ * @author Sebastian Javier Marchano (sebasjm)
+ */
+
+import fs from "fs";
+import mustache from "mustache";
+import { createDateToStringFunction, createDurationToStringFunction, createNonEmptyFunction } from "./utils.js"
+import { exampleData as ShowOrderDetailsExamples } from "./pages/ShowOrderDetails.examples.js";
+/**
+ * This script will emulate what the merchant backend will do when being requested
+ *
+ */
+
+const templateDirectory = process.argv[2];
+const destDirectory = process.argv[3];
+
+if (!templateDirectory || !destDirectory) {
+ console.log("usage: render-mustache <source-directory> <dest-directory>");
+ process.exit(1);
+}
+
+if (!fs.existsSync(destDirectory)) {
+ fs.mkdirSync(destDirectory);
+}
+
+function fromCamelCaseName(name: string) {
+ const result = name
+ .replace(/^[a-z]/, (letter) => `${letter.toUpperCase()}`) //first letter lowercase
+ .replace(/_[a-z]/g, (letter) => `${letter[1].toUpperCase()}`); //snake case
+ return result;
+}
+/**
+ * Load all the html files
+ */
+const templateFiles = fs.readdirSync(templateDirectory).filter((f) => /.html/.test(f));
+const exampleByTemplate: Record<string, any> = {
+ "show_order_details.en.html": ShowOrderDetailsExamples
+}
+
+templateFiles.forEach((templateFile) => {
+ const html = fs.readFileSync(`${templateDirectory}/${templateFile}`, "utf8");
+
+ const templateFileWithoutExt = templateFile.replace(".en.html", "");
+ // const exampleFileName = `src/pages/${fromCamelCaseName(testName)}.examples`;
+ // if (!fs.existsSync(`./${exampleFileName}.ts`)) {
+ // console.log(`- skipping ${testName}: no examples found`);
+ // return;
+ // }
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
+ // const pepe = `./${exampleFileName}.ts`
+ // const { exampleData } = require(pepe);
+
+ const exampleData = exampleByTemplate[templateFile]
+ if (!exampleData) {
+ console.log(`- skipping ${templateFile}: no examples found`);
+ return;
+ }
+ const exampleNames = Object.keys(exampleData)
+ console.log(`+ rendering ${templateFile}: ${exampleNames.length} examples`);
+ exampleNames.forEach((exampleName) => {
+ const example = exampleData[exampleName];
+
+ //enhance the example with more information
+ example.contract_terms_json = () => JSON.stringify(example.contract_terms);
+
+ example.contract_terms.timestamp_str = createDateToStringFunction(example.contract_terms.timestamp)
+
+ example.contract_terms.hasProducts = createNonEmptyFunction(example.contract_terms.products)
+ example.contract_terms.hasAuditors = createNonEmptyFunction(example.contract_terms.auditors)
+ example.contract_terms.hasExchanges = createNonEmptyFunction(example.contract_terms.exchanges)
+
+ example.contract_terms.products.forEach((p: any) => {
+ p.delivery_date_str = createDateToStringFunction(p.delivery_date)
+ p.hasTaxes = createNonEmptyFunction(p.taxes)
+ });
+
+ example.contract_terms.has_delivery_info = () =>
+ example.contract_terms.delivery_date ||
+ example.contract_terms.delivery_location;
+
+ example.contract_terms.delivery_date_str = createDateToStringFunction(example.contract_terms.delivery_date)
+ example.contract_terms.pay_deadline_str = createDateToStringFunction(example.contract_terms.pay_deadline)
+ example.contract_terms.wire_transfer_deadline_str = createDateToStringFunction(example.contract_terms.wire_transfer_deadline)
+
+ example.contract_terms.refund_deadline_str = createDateToStringFunction(example.contract_terms.refund_deadline)
+ example.contract_terms.auto_refund_str = createDurationToStringFunction(example.contract_terms.auto_refund)
+
+ const output = mustache.render(html, example);
+
+ fs.writeFileSync(
+ `${destDirectory}/${templateFileWithoutExt}.${exampleName}.html`,
+ output,
+ );
+ });
+});
diff --git a/packages/merchant-backend-ui/src/utils.ts b/packages/merchant-backend-ui/src/utils.ts
new file mode 100644
index 000000000..ecd05ff00
--- /dev/null
+++ b/packages/merchant-backend-ui/src/utils.ts
@@ -0,0 +1,41 @@
+/*
+ This file is part of GNU Taler
+ (C) 2021 Taler Systems S.A.
+
+ GNU Taler is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+ */
+
+import { format, formatDuration, intervalToDuration } from "date-fns";
+
+const TIME_DATE_FORMAT = "dd MMM yyyy HH:mm:ss"
+
+export function createDateToStringFunction(date: any) {
+ return () => {
+ if (!date) return "";
+ return format(date.t_s * 1000, TIME_DATE_FORMAT);
+ }
+}
+
+export function createDurationToStringFunction(duration: any) {
+ return () => {
+ if (!duration) return "";
+ return formatDuration(intervalToDuration({ start: 0, end: duration.d_us }));
+ }
+}
+
+export function createNonEmptyFunction(list: any) {
+ return () => {
+ if (!list) return false;
+ return list.length > 0;
+ }
+}
+
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 222c1412d..af628015b 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -521,6 +521,9 @@ importers:
'@types/mustache':
specifier: ^4.1.2
version: 4.2.1
+ '@types/node':
+ specifier: ^20.11.13
+ version: 20.11.13
'@typescript-eslint/eslint-plugin':
specifier: ^4.22.0
version: 4.33.0(@typescript-eslint/parser@4.33.0)(eslint@7.32.0)(typescript@5.3.3)
@@ -556,7 +559,7 @@ importers:
version: 1.0.14
ts-node:
specifier: ^10.9.1
- version: 10.9.1(@types/node@20.10.4)(typescript@5.3.3)
+ version: 10.9.1(@types/node@20.11.13)(typescript@5.3.3)
tslib:
specifier: 2.6.2
version: 2.6.2
@@ -5890,20 +5893,20 @@ packages:
/@types/better-sqlite3@7.6.8:
resolution: {integrity: sha512-ASndM4rdGrzk7iXXqyNC4fbwt4UEjpK0i3j4q4FyeQrLAthfB6s7EF135ZJE0qQxtKIMFwmyT6x0switET7uIw==}
dependencies:
- '@types/node': 20.4.1
+ '@types/node': 20.11.13
dev: true
/@types/body-parser@1.19.2:
resolution: {integrity: sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==}
dependencies:
'@types/connect': 3.4.35
- '@types/node': 18.11.17
+ '@types/node': 20.11.13
dev: true
/@types/bonjour@3.5.10:
resolution: {integrity: sha512-p7ienRMiS41Nu2/igbJxxLDWrSZ0WxM8UQgCeO9KhoVF7cOVFkrKsiDr1EsJIla8vV3oEEjGcz11jc5yimhzZw==}
dependencies:
- '@types/node': 18.11.17
+ '@types/node': 20.11.13
dev: true
/@types/chai@4.3.3:
@@ -5920,13 +5923,13 @@ packages:
resolution: {integrity: sha512-h8QJa8xSb1WD4fpKBDcATDNGXghFj6/3GRWG6dhmRcu0RX1Ubasur2Uvx5aeEwlf0MwblEC2bMzzMQntxnw/Cw==}
dependencies:
'@types/express-serve-static-core': 4.17.31
- '@types/node': 18.11.17
+ '@types/node': 20.11.13
dev: true
/@types/connect@3.4.35:
resolution: {integrity: sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==}
dependencies:
- '@types/node': 18.11.17
+ '@types/node': 20.11.13
dev: true
/@types/estree@0.0.39:
@@ -5936,7 +5939,7 @@ packages:
/@types/express-serve-static-core@4.17.31:
resolution: {integrity: sha512-DxMhY+NAsTwMMFHBTtJFNp5qiHKJ7TeqOo23zVEM9alT1Ml27Q3xcTH0xwxn7Q0BbMcVEJOs/7aQtUWupUQN3Q==}
dependencies:
- '@types/node': 18.11.17
+ '@types/node': 20.11.13
'@types/qs': 6.9.7
'@types/range-parser': 1.2.4
dev: true
@@ -5972,7 +5975,7 @@ packages:
/@types/http-proxy@1.17.9:
resolution: {integrity: sha512-QsbSjA/fSk7xB+UXlCT3wHBy5ai9wOcNDWwZAtud+jXhwOM3l+EYZh8Lng4+/6n8uar0J7xILzqftJdJ/Wdfkw==}
dependencies:
- '@types/node': 18.11.17
+ '@types/node': 20.11.13
dev: true
/@types/istanbul-lib-coverage@2.0.6:
@@ -5994,7 +5997,7 @@ packages:
/@types/keyv@3.1.4:
resolution: {integrity: sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==}
dependencies:
- '@types/node': 18.11.17
+ '@types/node': 20.11.13
dev: true
/@types/lodash@4.14.186:
@@ -6024,8 +6027,8 @@ packages:
/@types/node@18.11.17:
resolution: {integrity: sha512-HJSUJmni4BeDHhfzn6nF0sVmd1SMezP7/4F0Lq+aXzmp2xm9O7WXrUtHW/CHlYVtZUbByEvWidHqRtcJXGF2Ng==}
- /@types/node@20.10.4:
- resolution: {integrity: sha512-D08YG6rr8X90YB56tSIuBaddy/UXAA9RKJoFvrsnogAum/0pmjkgi4+2nx96A330FmioegBWmEYQ+syqCFaveg==}
+ /@types/node@20.11.13:
+ resolution: {integrity: sha512-5G4zQwdiQBSWYTDAH1ctw2eidqdhMJaNsiIDKHFr55ihz5Trl2qqR8fdrT732yPBho5gkNxXm67OxWFBqX9aPg==}
dependencies:
undici-types: 5.26.5
dev: true
@@ -6053,13 +6056,13 @@ packages:
/@types/resolve@1.17.1:
resolution: {integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==}
dependencies:
- '@types/node': 18.11.17
+ '@types/node': 20.11.13
dev: true
/@types/responselike@1.0.0:
resolution: {integrity: sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==}
dependencies:
- '@types/node': 18.11.17
+ '@types/node': 20.11.13
dev: true
/@types/retry@0.12.0:
@@ -6084,13 +6087,13 @@ packages:
resolution: {integrity: sha512-z5xyF6uh8CbjAu9760KDKsH2FcDxZ2tFCsA4HIMWE6IkiYMXfVoa+4f9KX+FN0ZLsaMw1WNG2ETLA6N+/YA+cg==}
dependencies:
'@types/mime': 3.0.1
- '@types/node': 18.11.17
+ '@types/node': 20.11.13
dev: true
/@types/sockjs@0.3.33:
resolution: {integrity: sha512-f0KEEe05NvUnat+boPTZ0dgaLZ4SfSouXUgv5noUiefG2ajgKjmETo9ZJyuqsl7dfl2aHlLJUiki6B4ZYldiiw==}
dependencies:
- '@types/node': 18.11.17
+ '@types/node': 20.11.13
dev: true
/@types/source-list-map@0.1.2:
@@ -6118,7 +6121,7 @@ packages:
/@types/webpack-sources@3.2.0:
resolution: {integrity: sha512-Ft7YH3lEVRQ6ls8k4Ff1oB4jN6oy/XmU6tQISKdhfh+1mR+viZFphS6WL0IrtDOzvefmJg5a0s7ZQoRXwqTEFg==}
dependencies:
- '@types/node': 18.11.17
+ '@types/node': 20.11.13
'@types/source-list-map': 0.1.2
source-map: 0.7.4
dev: true
@@ -6126,7 +6129,7 @@ packages:
/@types/webpack@4.41.33:
resolution: {integrity: sha512-PPajH64Ft2vWevkerISMtnZ8rTs4YmRbs+23c402J0INmxDKCrhZNvwZYtzx96gY2wAtXdrK1BS2fiC8MlLr3g==}
dependencies:
- '@types/node': 18.11.17
+ '@types/node': 20.11.13
'@types/tapable': 1.0.8
'@types/uglify-js': 3.17.1
'@types/webpack-sources': 3.2.0
@@ -6137,7 +6140,7 @@ packages:
/@types/ws@8.5.3:
resolution: {integrity: sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w==}
dependencies:
- '@types/node': 18.11.17
+ '@types/node': 20.11.13
dev: true
/@typescript-eslint/eslint-plugin@4.33.0(@typescript-eslint/parser@4.33.0)(eslint@7.32.0)(typescript@5.3.3):
@@ -12511,7 +12514,7 @@ packages:
resolution: {integrity: sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ==}
engines: {node: '>= 10.13.0'}
dependencies:
- '@types/node': 18.11.17
+ '@types/node': 20.11.13
merge-stream: 2.0.0
supports-color: 7.2.0
dev: true
@@ -17340,7 +17343,7 @@ packages:
tslib: 2.6.2
dev: true
- /ts-node@10.9.1(@types/node@20.10.4)(typescript@5.3.3):
+ /ts-node@10.9.1(@types/node@20.11.13)(typescript@5.3.3):
resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==}
hasBin: true
peerDependencies:
@@ -17359,7 +17362,7 @@ packages:
'@tsconfig/node12': 1.0.11
'@tsconfig/node14': 1.0.3
'@tsconfig/node16': 1.0.3
- '@types/node': 20.10.4
+ '@types/node': 20.11.13
acorn: 8.8.1
acorn-walk: 8.2.0
arg: 4.1.3