From 4bfa0b91ad7645b348879b0aa86a585f494fe190 Mon Sep 17 00:00:00 2001 From: jalas167 Date: Mon, 23 Oct 2023 17:21:10 +0200 Subject: [PATCH 01/17] Create defaults.md --- .../creators/javascript/guides/defaults.md | 177 ++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 src/pages/docs/creators/javascript/guides/defaults.md diff --git a/src/pages/docs/creators/javascript/guides/defaults.md b/src/pages/docs/creators/javascript/guides/defaults.md new file mode 100644 index 000000000..cea9169c5 --- /dev/null +++ b/src/pages/docs/creators/javascript/guides/defaults.md @@ -0,0 +1,177 @@ +--- +description: Golem JS default value for TaskExecutor options +title: Golem JS default value for TaskExecutor options +type: Guide +--- + +# Introduction + +To simplify the requestor code, JS SDK uses default values for some of the options. These values are sufficient to run typical use cases, however, in some cases, a user needs to override them to complete his tasks. Here is the list of defaults that are used, their meaning, and the names of related parameters. + +## executorOptions + +### taskTimeout + + **Meaning:** Timeout for executing one task in ms. + + **Default value:** 5 * 60 * 1000 = 5 min. + +### logger + + Logger module to handle SDK logs. + + **Default value:** pinoLogger for Node.js, null for browsers. + +### logLevel + + Log level: `debug`, `info`, `warn`, `log`, `error`. + + **Default value:** 'info'. + +### enableLogging + + This option enables logging, set to `false` to completely disable logging (even if a logger is provided). + + **Default value:** `true`. + +## yagnaOptions + +### apiKey + + `apiKey` enables access to yagna rest API. + + **Default value:** as read from 'process.env.YAGNA_APPKEY' for node.js, null for browser. + +### basePath + + URL of yagna REST API. + + **Default value:** `http://127.0.0.1:7465`. + +### maxTaskRetries + + The maximum number of retries when the job failed on the provider. + + **Default value:** 3. + +### activityPreparingTimeout + + Timeout for preparing activity - creating and deploying commands in ms. + + **Default value:** 5 * 60 * 1000 = 5 min. + +## packagePackageOptions + +### engine + + Type of the payload (`vm`, `wasm`). + + **Default value:** `vm`, + +### minMemGib + + Minimum size of RAM in GB. + + **Default value:** : 0.5. + +### minStorageGib: + + Minimum size of storage in GB. + + **Default value:** 2, + +### minCpuThreads: + + Minimum no of threads. + + **Default value:** 1. + +### minCpuCores: + + Minimum no of CPU cores. + + **Default value:** 1. + +### capabilities: + + Set of capabilities providers offer, see manifest and demand documentation of details. + + **Default** value []. + +## MarketOptions + +### debitNotesAcceptanceTimeout + + Minimal time we reserve to accept debit notes, prosales with shorter time will be rejected in min. + + **Default value:** 30. + +### proposalFilter: + + Filter to decide what proposal to accept (from these that match the demand). + + **Default value:** `acceptAllProposalFilter()`. + +## TaskServiceOptions + +### maxParallelTasks + + Max no of parallel tasks when the TaskExecutor is running tasks from a list (see `map()` and `forEach()`). + + **Default value:** 5. + +## PaymentOptions + +### payment + +#### network + + Defines on that blockchain the payment will be performed, `goerli` is a test network where test GLM is used, `polygon`. + + **Default value**: `goerli`. + +### budget: + + The amount that is allocated for all tasks scheduled by an executor in GLM/tGLM. + + **Default value:** 1.0. + +### paymentTimeout + + Max time the executor script will await invoices from providers after tasks are complete in ms. + + **Default value:** 60 * 1000 = 1 min. + +### allocationExpires + + Duration after which allocation expires in msec, valid allocation is required to accept invoices. + + **Default value:** 60 mins. + +### debitNoteFilter + + Filter containing rules for debitNotes acceptance. + + **Default value:** acceptAllDebitNotesFilter(). + +### invoiceFilter + + Filter containing rules for Invoice acceptance. + + **Default value:** acceptAllInvoicesFilter(). + +## AgreementServiceOptions + +### agreementSelector + + Decide which agreements will be used for the next task provided by the iterator, pool contains existing agreements and potential new agreements from available proposals. + + **Default value:** `randomAgreementSelectorWithPriorityForExistingOnes()`, + +## Activity + +### activityExecuteTimeout: + + Execution time for script (one command or batch) in ms. + + **Default value:** 5*60*1000 = 5 min. From e43323541561ad06118d957170a28e227be493c2 Mon Sep 17 00:00:00 2001 From: Phillip Jensen Date: Tue, 24 Oct 2023 15:15:33 +0200 Subject: [PATCH 02/17] Add defaults to reference navigation --- generateTypedoc.mjs | 158 ++++++++++-------- .../customPages/default-values.md} | 0 2 files changed, 85 insertions(+), 73 deletions(-) rename src/{pages/docs/creators/javascript/guides/defaults.md => navigation/customPages/default-values.md} (100%) diff --git a/generateTypedoc.mjs b/generateTypedoc.mjs index e3769c0f5..b187c2d8f 100644 --- a/generateTypedoc.mjs +++ b/generateTypedoc.mjs @@ -1,69 +1,81 @@ #!/usr/bin/env node -import * as fs from "fs"; +import * as fs from 'fs' -import * as path from "path"; -import { createRequire } from "module"; // built-in module -const require = createRequire(import.meta.url); // construct the require function for this ES module +import * as path from 'path' +import { createRequire } from 'module' // built-in module +const require = createRequire(import.meta.url) // construct the require function for this ES module -const docsPath = path.resolve("./src/pages/docs/golem-js/reference"); +const docsPath = path.resolve('./src/pages/docs/golem-js/reference') -const branchPrefix = process.argv[2]; +const branchPrefix = process.argv[2] + +import { dirname } from 'path' // Importing dirname + +import { fileURLToPath } from 'url' // Importing fileURLToPath +// Retrieve the current file's absolute path +const __filename = fileURLToPath(import.meta.url) +const __dirname = dirname(__filename) if (!branchPrefix) { - console.error("Please provide branch name as argument."); - process.exit(1); + console.error('Please provide branch name as argument.') + process.exit(1) } async function main() { - console.log(`Switching to branch ${branchPrefix} ...`); + console.log(`Switching to branch ${branchPrefix} ...`) - try { - console.log("Generating typedoc ..."); - await generateTypedoc(branchPrefix); - - const navigation = await generateNavigation([branchPrefix]); - await fs.promises.writeFile( - "./src/navigation/jsreference.js", - "export const navigation = " + navigation - ); - } catch (error) { - console.error(`Error with branch ${branchPrefix}:`, error.message); - } + console.log('Generating typedoc ...') + await generateTypedoc(branchPrefix) + + const navigation = await generateNavigation([branchPrefix]) + await fs.promises.writeFile( + './src/navigation/jsreference.js', + 'export const navigation = ' + navigation + ) + + // Move default-values.md to the correct location, so we don't overwrite it with reference generation + const sourcePath = `${__dirname}/src/navigation/customPages/default-values.md` + const destPath = `${__dirname}/src/pages/docs/golem-js/reference/default-values.md` + await fs.promises.copyFile(sourcePath, destPath) } -const util = require("util"); -const glob = util.promisify(require("glob")); +const util = require('util') +const glob = util.promisify(require('glob')) async function generateTypedoc(branchPrefix) { - const outputPath = "./src/pages/docs/golem-js/reference"; + const outputPath = './src/pages/docs/golem-js/reference' // Once typedoc is done, start looking for .md files and remove ".md" mentions. - const files = await glob(outputPath + "/**/*.md"); + const files = await glob(outputPath + '/**/*.md') - console.log("Starting to remove '.md' mentions from files."); + console.log("Starting to remove '.md' mentions from files.") await Promise.all( files.map(async (file) => { - let data = await fs.promises.readFile(file, "utf8"); - const result = data.replace(/\.md/g, ""); - await fs.promises.writeFile(file, result, "utf8"); + let data = await fs.promises.readFile(file, 'utf8') + const result = data.replace(/\.md/g, '') + await fs.promises.writeFile(file, result, 'utf8') }) - ); + ) } async function generateNavigation(versions) { try { const navigation = await Promise.all( versions.map(async (version) => { - const title = `${version}`; - const childrenDirs = getChildrenDirectories(docsPath); + const title = `${version}` + const childrenDirs = getChildrenDirectories(docsPath) const links = await Promise.all([ { - title: "Content overview", + title: 'Content overview', href: `/docs/golem-js/reference/overview`, }, + { + title: 'Default values', + href: `/docs/golem-js/reference/default-values`, + }, ...childrenDirs.map(async (item) => { - const hrefPrefix = `/docs/golem-js/reference/${item}`; + const hrefPrefix = `/docs/golem-js/reference/${item}` return { title: item, @@ -71,105 +83,105 @@ async function generateNavigation(versions) { path.join(docsPath, item), hrefPrefix ), - }; + } }), - ]); + ]) return { title, links, - }; + } }) - ); + ) - return stringifyArray(navigation); + return stringifyArray(navigation) } catch (error) { - console.error("Error in generateNavigation:", error); + console.error('Error in generateNavigation:', error) } } function getChildrenDirectories(parentDir) { try { - const entries = fs.readdirSync(parentDir, { withFileTypes: true }); + const entries = fs.readdirSync(parentDir, { withFileTypes: true }) return entries .filter((entry) => entry.isDirectory()) - .map((entry) => entry.name); + .map((entry) => entry.name) } catch (error) { - console.error("Error in getChildrenDirectories:", error); + console.error('Error in getChildrenDirectories:', error) } } async function getMarkdownTitles(dirPath, hrefPrefix) { try { - const entries = await fs.promises.readdir(dirPath, { withFileTypes: true }); + const entries = await fs.promises.readdir(dirPath, { withFileTypes: true }) const directlyNestedMarkdownFiles = entries.filter( - (entry) => entry.isFile() && entry.name.endsWith(".md") - ); + (entry) => entry.isFile() && entry.name.endsWith('.md') + ) return directlyNestedMarkdownFiles.map((file) => { - let title = getTitleFromFile(file.name); + let title = getTitleFromFile(file.name) // If title contains a ".", return the part after it. // Otherwise, leave the title as it is. - const splitTitle = title.split("."); + const splitTitle = title.split('.') if (splitTitle.length > 1) { - title = splitTitle.slice(1).join("."); + title = splitTitle.slice(1).join('.') } - const href = path.join(hrefPrefix, file.name.replace(".md", "")); + const href = path.join(hrefPrefix, file.name.replace('.md', '')) return { title, href, - }; - }); + } + }) } catch (error) { - console.error("Error in getMarkdownTitles:", error); + console.error('Error in getMarkdownTitles:', error) } } function getTitleFromFile(filename) { try { return filename - .replace(/-/g, " ") - .replace(".md", "") - .split(" ") + .replace(/-/g, ' ') + .replace('.md', '') + .split(' ') .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) - .join(" "); + .join(' ') } catch (error) { - console.error("Error in getTitleFromFile:", error); + console.error('Error in getTitleFromFile:', error) } } -function stringifyObject(obj, indent = " ") { +function stringifyObject(obj, indent = ' ') { const entries = Object.entries(obj) .map(([key, value]) => { const formattedValue = value.constructor === Object - ? stringifyObject(value, indent + " ") + ? stringifyObject(value, indent + ' ') : Array.isArray(value) - ? stringifyArray(value, indent + " ") - : JSON.stringify(value); - return `${indent}${key}: ${formattedValue}`; + ? stringifyArray(value, indent + ' ') + : JSON.stringify(value) + return `${indent}${key}: ${formattedValue}` }) - .join(",\n"); - return `{\n${entries}\n${indent.slice(2)}}`; + .join(',\n') + return `{\n${entries}\n${indent.slice(2)}}` } -function stringifyArray(array, indent = " ") { +function stringifyArray(array, indent = ' ') { const entries = array .map((entry) => { return Array.isArray(entry) - ? stringifyArray(entry, indent + " ") + ? stringifyArray(entry, indent + ' ') : entry.constructor === Object - ? stringifyObject(entry, indent + " ") - : JSON.stringify(entry); + ? stringifyObject(entry, indent + ' ') + : JSON.stringify(entry) }) - .join(",\n"); - return `[\n${entries}\n${indent.slice(2)}]`; + .join(',\n') + return `[\n${entries}\n${indent.slice(2)}]` } -main().catch((error) => console.error(error)); +main().catch((error) => console.error(error)) -export default undefined; +export default undefined diff --git a/src/pages/docs/creators/javascript/guides/defaults.md b/src/navigation/customPages/default-values.md similarity index 100% rename from src/pages/docs/creators/javascript/guides/defaults.md rename to src/navigation/customPages/default-values.md From 40a18bc4a8f03ff26b32b0ddd3448dc2f92d96e4 Mon Sep 17 00:00:00 2001 From: Phillip Jensen Date: Tue, 24 Oct 2023 15:24:00 +0200 Subject: [PATCH 03/17] use partials for editing file --- generateTypedoc.mjs | 2 +- .../partials/customPages/default-values.md | 171 +++++++++++++++++ src/navigation/customPages/default-values.md | 172 +----------------- src/navigation/jsreference.js | 4 + .../docs/golem-js/reference/default-values.md | 7 + 5 files changed, 184 insertions(+), 172 deletions(-) create mode 100644 src/markdoc/partials/customPages/default-values.md create mode 100644 src/pages/docs/golem-js/reference/default-values.md diff --git a/generateTypedoc.mjs b/generateTypedoc.mjs index b187c2d8f..4edfe0cf8 100644 --- a/generateTypedoc.mjs +++ b/generateTypedoc.mjs @@ -34,7 +34,7 @@ async function main() { ) // Move default-values.md to the correct location, so we don't overwrite it with reference generation - const sourcePath = `${__dirname}/src/navigation/customPages/default-values.md` + const sourcePath = `${__dirname}/ ` const destPath = `${__dirname}/src/pages/docs/golem-js/reference/default-values.md` await fs.promises.copyFile(sourcePath, destPath) } diff --git a/src/markdoc/partials/customPages/default-values.md b/src/markdoc/partials/customPages/default-values.md new file mode 100644 index 000000000..ac5fd0168 --- /dev/null +++ b/src/markdoc/partials/customPages/default-values.md @@ -0,0 +1,171 @@ +# Introduction + +To simplify the requestor code, JS SDK uses default values for some of the options. These values are sufficient to run typical use cases, however, in some cases, a user needs to override them to complete his tasks. Here is the list of defaults that are used, their meaning, and the names of related parameters. + +## executorOptions + +### taskTimeout + + **Meaning:** Timeout for executing one task in ms. + + **Default value:** 5 * 60 * 1000 = 5 min. + +### logger + + Logger module to handle SDK logs. + + **Default value:** pinoLogger for Node.js, null for browsers. + +### logLevel + + Log level: `debug`, `info`, `warn`, `log`, `error`. + + **Default value:** 'info'. + +### enableLogging + + This option enables logging, set to `false` to completely disable logging (even if a logger is provided). + + **Default value:** `true`. + +## yagnaOptions + +### apiKey + + `apiKey` enables access to yagna rest API. + + **Default value:** as read from 'process.env.YAGNA_APPKEY' for node.js, null for browser. + +### basePath + + URL of yagna REST API. + + **Default value:** `http://127.0.0.1:7465`. + +### maxTaskRetries + + The maximum number of retries when the job failed on the provider. + + **Default value:** 3. + +### activityPreparingTimeout + + Timeout for preparing activity - creating and deploying commands in ms. + + **Default value:** 5 * 60 * 1000 = 5 min. + +## packagePackageOptions + +### engine + + Type of the payload (`vm`, `wasm`). + + **Default value:** `vm`, + +### minMemGib + + Minimum size of RAM in GB. + + **Default value:** : 0.5. + +### minStorageGib: + + Minimum size of storage in GB. + + **Default value:** 2, + +### minCpuThreads: + + Minimum no of threads. + + **Default value:** 1. + +### minCpuCores: + + Minimum no of CPU cores. + + **Default value:** 1. + +### capabilities: + + Set of capabilities providers offer, see manifest and demand documentation of details. + + **Default** value []. + +## MarketOptions + +### debitNotesAcceptanceTimeout + + Minimal time we reserve to accept debit notes, prosales with shorter time will be rejected in min. + + **Default value:** 30. + +### proposalFilter: + + Filter to decide what proposal to accept (from these that match the demand). + + **Default value:** `acceptAllProposalFilter()`. + +## TaskServiceOptions + +### maxParallelTasks + + Max no of parallel tasks when the TaskExecutor is running tasks from a list (see `map()` and `forEach()`). + + **Default value:** 5. + +## PaymentOptions + +### payment + +#### network + + Defines on that blockchain the payment will be performed, `goerli` is a test network where test GLM is used, `polygon`. + + **Default value**: `goerli`. + +### budget: + + The amount that is allocated for all tasks scheduled by an executor in GLM/tGLM. + + **Default value:** 1.0. + +### paymentTimeout + + Max time the executor script will await invoices from providers after tasks are complete in ms. + + **Default value:** 60 * 1000 = 1 min. + +### allocationExpires + + Duration after which allocation expires in msec, valid allocation is required to accept invoices. + + **Default value:** 60 mins. + +### debitNoteFilter + + Filter containing rules for debitNotes acceptance. + + **Default value:** acceptAllDebitNotesFilter(). + +### invoiceFilter + + Filter containing rules for Invoice acceptance. + + **Default value:** acceptAllInvoicesFilter(). + +## AgreementServiceOptions + +### agreementSelector + + Decide which agreements will be used for the next task provided by the iterator, pool contains existing agreements and potential new agreements from available proposals. + + **Default value:** `randomAgreementSelectorWithPriorityForExistingOnes()`, + +## Activity + +### activityExecuteTimeout: + + Execution time for script (one command or batch) in ms. + + **Default value:** 5*60*1000 = 5 min. diff --git a/src/navigation/customPages/default-values.md b/src/navigation/customPages/default-values.md index cea9169c5..97129905f 100644 --- a/src/navigation/customPages/default-values.md +++ b/src/navigation/customPages/default-values.md @@ -4,174 +4,4 @@ title: Golem JS default value for TaskExecutor options type: Guide --- -# Introduction - -To simplify the requestor code, JS SDK uses default values for some of the options. These values are sufficient to run typical use cases, however, in some cases, a user needs to override them to complete his tasks. Here is the list of defaults that are used, their meaning, and the names of related parameters. - -## executorOptions - -### taskTimeout - - **Meaning:** Timeout for executing one task in ms. - - **Default value:** 5 * 60 * 1000 = 5 min. - -### logger - - Logger module to handle SDK logs. - - **Default value:** pinoLogger for Node.js, null for browsers. - -### logLevel - - Log level: `debug`, `info`, `warn`, `log`, `error`. - - **Default value:** 'info'. - -### enableLogging - - This option enables logging, set to `false` to completely disable logging (even if a logger is provided). - - **Default value:** `true`. - -## yagnaOptions - -### apiKey - - `apiKey` enables access to yagna rest API. - - **Default value:** as read from 'process.env.YAGNA_APPKEY' for node.js, null for browser. - -### basePath - - URL of yagna REST API. - - **Default value:** `http://127.0.0.1:7465`. - -### maxTaskRetries - - The maximum number of retries when the job failed on the provider. - - **Default value:** 3. - -### activityPreparingTimeout - - Timeout for preparing activity - creating and deploying commands in ms. - - **Default value:** 5 * 60 * 1000 = 5 min. - -## packagePackageOptions - -### engine - - Type of the payload (`vm`, `wasm`). - - **Default value:** `vm`, - -### minMemGib - - Minimum size of RAM in GB. - - **Default value:** : 0.5. - -### minStorageGib: - - Minimum size of storage in GB. - - **Default value:** 2, - -### minCpuThreads: - - Minimum no of threads. - - **Default value:** 1. - -### minCpuCores: - - Minimum no of CPU cores. - - **Default value:** 1. - -### capabilities: - - Set of capabilities providers offer, see manifest and demand documentation of details. - - **Default** value []. - -## MarketOptions - -### debitNotesAcceptanceTimeout - - Minimal time we reserve to accept debit notes, prosales with shorter time will be rejected in min. - - **Default value:** 30. - -### proposalFilter: - - Filter to decide what proposal to accept (from these that match the demand). - - **Default value:** `acceptAllProposalFilter()`. - -## TaskServiceOptions - -### maxParallelTasks - - Max no of parallel tasks when the TaskExecutor is running tasks from a list (see `map()` and `forEach()`). - - **Default value:** 5. - -## PaymentOptions - -### payment - -#### network - - Defines on that blockchain the payment will be performed, `goerli` is a test network where test GLM is used, `polygon`. - - **Default value**: `goerli`. - -### budget: - - The amount that is allocated for all tasks scheduled by an executor in GLM/tGLM. - - **Default value:** 1.0. - -### paymentTimeout - - Max time the executor script will await invoices from providers after tasks are complete in ms. - - **Default value:** 60 * 1000 = 1 min. - -### allocationExpires - - Duration after which allocation expires in msec, valid allocation is required to accept invoices. - - **Default value:** 60 mins. - -### debitNoteFilter - - Filter containing rules for debitNotes acceptance. - - **Default value:** acceptAllDebitNotesFilter(). - -### invoiceFilter - - Filter containing rules for Invoice acceptance. - - **Default value:** acceptAllInvoicesFilter(). - -## AgreementServiceOptions - -### agreementSelector - - Decide which agreements will be used for the next task provided by the iterator, pool contains existing agreements and potential new agreements from available proposals. - - **Default value:** `randomAgreementSelectorWithPriorityForExistingOnes()`, - -## Activity - -### activityExecuteTimeout: - - Execution time for script (one command or batch) in ms. - - **Default value:** 5*60*1000 = 5 min. +{% partial file="customPages/default-values.md" /%} \ No newline at end of file diff --git a/src/navigation/jsreference.js b/src/navigation/jsreference.js index 72e058b82..c9b92e51a 100644 --- a/src/navigation/jsreference.js +++ b/src/navigation/jsreference.js @@ -6,6 +6,10 @@ export const navigation = [ title: "Content overview", href: "/docs/golem-js/reference/overview" }, +{ + title: "Default values", + href: "/docs/golem-js/reference/default-values" + }, { title: "classes", children: [ diff --git a/src/pages/docs/golem-js/reference/default-values.md b/src/pages/docs/golem-js/reference/default-values.md new file mode 100644 index 000000000..97129905f --- /dev/null +++ b/src/pages/docs/golem-js/reference/default-values.md @@ -0,0 +1,7 @@ +--- +description: Golem JS default value for TaskExecutor options +title: Golem JS default value for TaskExecutor options +type: Guide +--- + +{% partial file="customPages/default-values.md" /%} \ No newline at end of file From 37ad396c1aa407a6aae8e3423ba57519869a16cc Mon Sep 17 00:00:00 2001 From: Phillip Jensen Date: Thu, 26 Oct 2023 11:58:54 +0200 Subject: [PATCH 04/17] Style and index default values --- src/components/DefaultValue.jsx | 19 +++ .../partials/customPages/default-values.md | 158 ++++-------------- src/markdoc/search.mjs | 22 ++- src/markdoc/tags.js | 9 + src/navigation/customPages/default-values.md | 4 +- src/pages/_app.jsx | 15 +- 6 files changed, 80 insertions(+), 147 deletions(-) create mode 100644 src/components/DefaultValue.jsx diff --git a/src/components/DefaultValue.jsx b/src/components/DefaultValue.jsx new file mode 100644 index 000000000..4ca35fa7f --- /dev/null +++ b/src/components/DefaultValue.jsx @@ -0,0 +1,19 @@ +import { slugifyWithCounter } from '@sindresorhus/slugify' +const slugify = slugifyWithCounter() + +function DefaultValue({ title, description, defaultValue }) { + return ( +
+

{title}

+

{description}

+
+ Default value: + {defaultValue} +
+
+ ); +} + +export default DefaultValue; diff --git a/src/markdoc/partials/customPages/default-values.md b/src/markdoc/partials/customPages/default-values.md index ac5fd0168..72a9b1dd7 100644 --- a/src/markdoc/partials/customPages/default-values.md +++ b/src/markdoc/partials/customPages/default-values.md @@ -1,171 +1,71 @@ -# Introduction +# Default Values in the JS SDK -To simplify the requestor code, JS SDK uses default values for some of the options. These values are sufficient to run typical use cases, however, in some cases, a user needs to override them to complete his tasks. Here is the list of defaults that are used, their meaning, and the names of related parameters. +The JS SDK is designed to streamline the experience for developers by providing default values for various options. These default settings cater to the majority of typical use cases. However, understanding that there may be unique scenarios where you might need to tweak these settings, the SDK allows for customization. -## executorOptions +Below is a summary of the default values, their significance, and the associated parameters that can be adjusted as per your requirements: -### taskTimeout +{% defaultvalue title="executorOptions" description="Timeout for executing one task in ms." defaultValue="5 * 60 * 1000 = 5 min." /%} - **Meaning:** Timeout for executing one task in ms. +{% defaultvalue title="taskTimeout" description="Timeout for executing one task in ms." defaultValue="5 * 60 * 1000 = 5 min." /%} - **Default value:** 5 * 60 * 1000 = 5 min. +{% defaultvalue title="logger" description="Logger module to handle SDK logs." defaultValue="pinoLogger for Node.js, null for browsers." /%} -### logger +{% defaultvalue title="logLevel" description="Log level: `debug`, `info`, `warn`, `log`, `error`." defaultValue="'info'." /%} - Logger module to handle SDK logs. - - **Default value:** pinoLogger for Node.js, null for browsers. - -### logLevel - - Log level: `debug`, `info`, `warn`, `log`, `error`. - - **Default value:** 'info'. - -### enableLogging - - This option enables logging, set to `false` to completely disable logging (even if a logger is provided). - - **Default value:** `true`. +{% defaultvalue title="enableLogging" description="This option enables logging, set to `false` to completely disable logging (even if a logger is provided)." defaultValue="`true`." /%} ## yagnaOptions -### apiKey - - `apiKey` enables access to yagna rest API. - - **Default value:** as read from 'process.env.YAGNA_APPKEY' for node.js, null for browser. - -### basePath - - URL of yagna REST API. - - **Default value:** `http://127.0.0.1:7465`. - -### maxTaskRetries +{% defaultvalue title="apiKey" description="`apiKey` enables access to yagna rest API." defaultValue="as read from 'process.env.YAGNA_APPKEY' for node.js, null for browser." /%} - The maximum number of retries when the job failed on the provider. +{% defaultvalue title="basePath" description="URL of yagna REST API." defaultValue="`http://127.0.0.1:7465`." /%} - **Default value:** 3. +{% defaultvalue title="maxTaskRetries" description="The maximum number of retries when the job failed on the provider." defaultValue="3." /%} -### activityPreparingTimeout - - Timeout for preparing activity - creating and deploying commands in ms. - - **Default value:** 5 * 60 * 1000 = 5 min. +{% defaultvalue title="activityPreparingTimeout" description="Timeout for preparing activity - creating and deploying commands in ms." defaultValue="5 * 60 * 1000 = 5 min." /%} ## packagePackageOptions -### engine - - Type of the payload (`vm`, `wasm`). - - **Default value:** `vm`, - -### minMemGib - - Minimum size of RAM in GB. - - **Default value:** : 0.5. - -### minStorageGib: - - Minimum size of storage in GB. - - **Default value:** 2, - -### minCpuThreads: - - Minimum no of threads. +{% defaultvalue title="engine" description="Type of the payload (`vm`, `wasm`)." defaultValue="`vm`," /%} - **Default value:** 1. +{% defaultvalue title="minMemGib" description="Minimum size of RAM in GB." defaultValue="0.5." /%} -### minCpuCores: +{% defaultvalue title="minStorageGib" description="Minimum size of storage in GB." defaultValue="2," /%} - Minimum no of CPU cores. +{% defaultvalue title="minCpuThreads" description="Minimum no of threads." defaultValue="1." /%} - **Default value:** 1. +{% defaultvalue title="minCpuCores" description="Minimum no of CPU cores." defaultValue="1." /%} -### capabilities: - - Set of capabilities providers offer, see manifest and demand documentation of details. - - **Default** value []. +{% defaultvalue title="capabilities" description="Set of capabilities providers offer, see manifest and demand documentation of details." defaultValue="[]" /%} ## MarketOptions -### debitNotesAcceptanceTimeout - - Minimal time we reserve to accept debit notes, prosales with shorter time will be rejected in min. - - **Default value:** 30. +{% defaultvalue title="debitNotesAcceptanceTimeout" description="Minimal time we reserve to accept debit notes, prosales with shorter time will be rejected in min." defaultValue="30." /%} -### proposalFilter: - - Filter to decide what proposal to accept (from these that match the demand). - - **Default value:** `acceptAllProposalFilter()`. +{% defaultvalue title="proposalFilter" description="Filter to decide what proposal to accept (from these that match the demand)." defaultValue="acceptAllProposalFilter()." /%} ## TaskServiceOptions -### maxParallelTasks - - Max no of parallel tasks when the TaskExecutor is running tasks from a list (see `map()` and `forEach()`). - - **Default value:** 5. +{% defaultvalue title="maxParallelTasks" description="Max no of parallel tasks when the TaskExecutor is running tasks from a list (see `map()` and `forEach()`)." defaultValue="5." /%} ## PaymentOptions -### payment - -#### network - - Defines on that blockchain the payment will be performed, `goerli` is a test network where test GLM is used, `polygon`. - - **Default value**: `goerli`. - -### budget: - - The amount that is allocated for all tasks scheduled by an executor in GLM/tGLM. +{% defaultvalue title="network" description="Defines on that blockchain the payment will be performed, `goerli` is a test network where test GLM is used, `polygon`." defaultValue="`goerli`." /%} - **Default value:** 1.0. +{% defaultvalue title="budget" description="The amount that is allocated for all tasks scheduled by an executor in GLM/tGLM." defaultValue="1.0." /%} -### paymentTimeout +{% defaultvalue title="paymentTimeout" description="Max time the executor script will await invoices from providers after tasks are complete in ms." defaultValue="60 * 1000 = 1 min." /%} - Max time the executor script will await invoices from providers after tasks are complete in ms. +{% defaultvalue title="allocationExpires" description="Duration after which allocation expires in msec, valid allocation is required to accept invoices." defaultValue="60 mins." /%} - **Default value:** 60 * 1000 = 1 min. +{% defaultvalue title="debitNoteFilter" description="Filter containing rules for debitNotes acceptance." defaultValue="acceptAllDebitNotesFilter()." /%} -### allocationExpires - - Duration after which allocation expires in msec, valid allocation is required to accept invoices. - - **Default value:** 60 mins. - -### debitNoteFilter - - Filter containing rules for debitNotes acceptance. - - **Default value:** acceptAllDebitNotesFilter(). - -### invoiceFilter - - Filter containing rules for Invoice acceptance. - - **Default value:** acceptAllInvoicesFilter(). +{% defaultvalue title="invoiceFilter" description="Filter containing rules for Invoice acceptance." defaultValue="acceptAllInvoicesFilter()." /%} ## AgreementServiceOptions -### agreementSelector - - Decide which agreements will be used for the next task provided by the iterator, pool contains existing agreements and potential new agreements from available proposals. - - **Default value:** `randomAgreementSelectorWithPriorityForExistingOnes()`, +{% defaultvalue title="agreementSelector" description="Decide which agreements will be used for the next task provided by the iterator, pool contains existing agreements and potential new agreements from available proposals." defaultValue="randomAgreementSelectorWithPriorityForExistingOnes()." /%} ## Activity -### activityExecuteTimeout: - - Execution time for script (one command or batch) in ms. - - **Default value:** 5*60*1000 = 5 min. +{% defaultvalue title="activityExecuteTimeout" description="Execution time for script (one command or batch) in ms." defaultValue="5*60*1000 = 5 min." /%} diff --git a/src/markdoc/search.mjs b/src/markdoc/search.mjs index a93367549..95cdc0f78 100644 --- a/src/markdoc/search.mjs +++ b/src/markdoc/search.mjs @@ -28,26 +28,34 @@ function extractSections(node, sections, isRoot = true) { } if (node.type === 'tag' && node.tag === 'partial' && node.attributes.file) { - const file = fs.readFileSync( + if (node.tag === 'partial') { + console.log(node) + } + const fileContent = fs.readFileSync( `./src/markdoc/partials/${node.attributes.file}`, 'utf8' ) - const partialAst = Markdoc.parse(file) - partialAst.children.forEach((child) => + const partialAst = Markdoc.parse(fileContent) + for (const child of partialAst.children) { extractSections(child, sections, false) - ) + } } - if (node.type === 'heading' || node.type === 'paragraph') { + if (node.type === 'tag' && node.tag === 'defaultvalue') { + let content = node.attributes.title + let hash = node.attributes?.id ?? slugify(content) + sections.push([content, hash, []]) + } else if (node.type === 'heading' || node.type === 'paragraph') { let content = toString(node).trim() - if (node.type === 'heading' && node.attributes.level <= 2) { let hash = node.attributes?.id ?? slugify(content) sections.push([content, hash, []]) } else { sections.at(-1)[2].push(content) } - } else if ('children' in node) { + } + + if ('children' in node) { for (let child of node.children) { extractSections(child, sections, false) } diff --git a/src/markdoc/tags.js b/src/markdoc/tags.js index 2b0cd51a7..efc212135 100644 --- a/src/markdoc/tags.js +++ b/src/markdoc/tags.js @@ -21,6 +21,7 @@ import { Troubleshooting } from '@/components/Troubleshooting' import { Solution } from '@/components/Solution' import { Problem } from '../components/Problem' import { FeedbackButtons } from '@/components/Feedback' +import DefaultValue from '../components/DefaultValue' const tags = { tabs: { render: Tabs, @@ -34,6 +35,14 @@ const tags = { return new Tag(this.render, { labels }, children); }, }, + defaultvalue: { + render: DefaultValue, + attributes: { + title: { type: String }, + description: { type: String }, + defaultValue: { type: String }, + }, + }, padding: { render: Padding, attributes: { diff --git a/src/navigation/customPages/default-values.md b/src/navigation/customPages/default-values.md index 97129905f..e555161da 100644 --- a/src/navigation/customPages/default-values.md +++ b/src/navigation/customPages/default-values.md @@ -1,6 +1,6 @@ --- -description: Golem JS default value for TaskExecutor options -title: Golem JS default value for TaskExecutor options +description: Golem JS default values for the TaskExecutor options +title: A comprehensive guide on the default values used in Golem JS's TaskExecutor options. Understand and customize them effectively. type: Guide --- diff --git a/src/pages/_app.jsx b/src/pages/_app.jsx index 3d5ad3542..68ee975bf 100644 --- a/src/pages/_app.jsx +++ b/src/pages/_app.jsx @@ -29,13 +29,13 @@ function collectHeadings( let sections = [] for (let node of nodes) { - if (node.name === 'Heading') { - let { level, id } = node.attributes - - let title = getNodeText(node) + if (node.name === 'Heading' || (node.name === 'Defaultvalue' && node.attributes && node.attributes.title)) { + let level = node.name === 'Defaultvalue' ? 3 : node.attributes.level + let title = node.name === 'Defaultvalue' ? node.attributes.title : getNodeText(node) if (title) { - let newNode = { ...node.attributes, title, children: [], level } + let id = node.attributes?.id ?? slugify(title) + let newNode = { ...node.attributes, id, title, children: [], level } if (lastNodes[level - 2]) { lastNodes[level - 2].children.push(newNode) } else { @@ -46,13 +46,10 @@ function collectHeadings( } } - sections.push( - ...collectHeadings(node.children ?? [], slugify, lastNodes, idMap) - ) + sections.push(...collectHeadings(node.children ?? [], slugify, lastNodes, idMap)) } return sections } - export default function App({ Component, pageProps }) { let title = pageProps.markdoc?.frontmatter.title if (!title) { From c4f5ba35bdb3b719bbff1f42ce3d872f2b82e5ce Mon Sep 17 00:00:00 2001 From: Phillip Jensen Date: Thu, 26 Oct 2023 12:32:17 +0200 Subject: [PATCH 05/17] Fixes to ids --- .../partials/customPages/default-values.md | 2 +- src/markdoc/tags.js | 8 ++++++++ src/pages/_app.jsx | 15 ++++++++++++--- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/markdoc/partials/customPages/default-values.md b/src/markdoc/partials/customPages/default-values.md index 72a9b1dd7..4e9dcad9c 100644 --- a/src/markdoc/partials/customPages/default-values.md +++ b/src/markdoc/partials/customPages/default-values.md @@ -4,7 +4,7 @@ The JS SDK is designed to streamline the experience for developers by providing Below is a summary of the default values, their significance, and the associated parameters that can be adjusted as per your requirements: -{% defaultvalue title="executorOptions" description="Timeout for executing one task in ms." defaultValue="5 * 60 * 1000 = 5 min." /%} +## executorOptions {% defaultvalue title="taskTimeout" description="Timeout for executing one task in ms." defaultValue="5 * 60 * 1000 = 5 min." /%} diff --git a/src/markdoc/tags.js b/src/markdoc/tags.js index efc212135..713664b37 100644 --- a/src/markdoc/tags.js +++ b/src/markdoc/tags.js @@ -22,6 +22,8 @@ import { Solution } from '@/components/Solution' import { Problem } from '../components/Problem' import { FeedbackButtons } from '@/components/Feedback' import DefaultValue from '../components/DefaultValue' +import { slugifyWithCounter } from '@sindresorhus/slugify' +const slugify = slugifyWithCounter() const tags = { tabs: { render: Tabs, @@ -42,6 +44,12 @@ const tags = { description: { type: String }, defaultValue: { type: String }, }, + transform(node, config) { + const attributes = node.transformAttributes(config) + attributes.id = slugify(attributes.title) + const children = node.transformChildren(config) + return new Tag(this.render, attributes, children) + } }, padding: { render: Padding, diff --git a/src/pages/_app.jsx b/src/pages/_app.jsx index 68ee975bf..feee72cd6 100644 --- a/src/pages/_app.jsx +++ b/src/pages/_app.jsx @@ -29,11 +29,18 @@ function collectHeadings( let sections = [] for (let node of nodes) { - if (node.name === 'Heading' || (node.name === 'Defaultvalue' && node.attributes && node.attributes.title)) { + if ( + node.name === 'Heading' || + (node.name === 'Defaultvalue' && node.attributes && node.attributes.title) + ) { let level = node.name === 'Defaultvalue' ? 3 : node.attributes.level - let title = node.name === 'Defaultvalue' ? node.attributes.title : getNodeText(node) + let title = + node.name === 'Defaultvalue' ? node.attributes.title : getNodeText(node) if (title) { + if (node.name === 'Defaultvalue') { + console.log(node) + } let id = node.attributes?.id ?? slugify(title) let newNode = { ...node.attributes, id, title, children: [], level } if (lastNodes[level - 2]) { @@ -46,7 +53,9 @@ function collectHeadings( } } - sections.push(...collectHeadings(node.children ?? [], slugify, lastNodes, idMap)) + sections.push( + ...collectHeadings(node.children ?? [], slugify, lastNodes, idMap) + ) } return sections } From c302a62f95aea3b76f32ffeb34fae9972bb3e8cc Mon Sep 17 00:00:00 2001 From: Phillip Jensen Date: Thu, 26 Oct 2023 14:27:26 +0200 Subject: [PATCH 06/17] Fix sidebar bug --- src/components/DefaultValue.jsx | 4 ++-- src/pages/_app.jsx | 16 ++++------------ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/components/DefaultValue.jsx b/src/components/DefaultValue.jsx index 4ca35fa7f..cc682a3e3 100644 --- a/src/components/DefaultValue.jsx +++ b/src/components/DefaultValue.jsx @@ -1,11 +1,11 @@ import { slugifyWithCounter } from '@sindresorhus/slugify' const slugify = slugifyWithCounter() -function DefaultValue({ title, description, defaultValue }) { +function DefaultValue({ title, description, defaultValue, id }) { return (

{title}

{description}

diff --git a/src/pages/_app.jsx b/src/pages/_app.jsx index feee72cd6..d2f76740a 100644 --- a/src/pages/_app.jsx +++ b/src/pages/_app.jsx @@ -29,18 +29,12 @@ function collectHeadings( let sections = [] for (let node of nodes) { - if ( - node.name === 'Heading' || - (node.name === 'Defaultvalue' && node.attributes && node.attributes.title) - ) { + if (node.name === 'Heading' || (node.name === 'Defaultvalue' && node.attributes && node.attributes.title)) { let level = node.name === 'Defaultvalue' ? 3 : node.attributes.level - let title = - node.name === 'Defaultvalue' ? node.attributes.title : getNodeText(node) + let title = node.name === 'Defaultvalue' ? node.attributes.title : getNodeText(node) if (title) { - if (node.name === 'Defaultvalue') { - console.log(node) - } + let id = node.attributes?.id ?? slugify(title) let newNode = { ...node.attributes, id, title, children: [], level } if (lastNodes[level - 2]) { @@ -53,9 +47,7 @@ function collectHeadings( } } - sections.push( - ...collectHeadings(node.children ?? [], slugify, lastNodes, idMap) - ) + sections.push(...collectHeadings(node.children ?? [], slugify, lastNodes, idMap)) } return sections } From a31bdc6e870ea9311931ad99532df9489ee3c116 Mon Sep 17 00:00:00 2001 From: Phillip Jensen Date: Thu, 26 Oct 2023 14:34:54 +0200 Subject: [PATCH 07/17] Fixes to the values --- .../partials/customPages/default-values.md | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/markdoc/partials/customPages/default-values.md b/src/markdoc/partials/customPages/default-values.md index 4e9dcad9c..6f302462a 100644 --- a/src/markdoc/partials/customPages/default-values.md +++ b/src/markdoc/partials/customPages/default-values.md @@ -6,66 +6,66 @@ Below is a summary of the default values, their significance, and the associated ## executorOptions -{% defaultvalue title="taskTimeout" description="Timeout for executing one task in ms." defaultValue="5 * 60 * 1000 = 5 min." /%} +{% defaultvalue title="taskTimeout" description="Timeout for executing one task in ms." defaultValue="5 * 60 * 1000" /%} -{% defaultvalue title="logger" description="Logger module to handle SDK logs." defaultValue="pinoLogger for Node.js, null for browsers." /%} +{% defaultvalue title="logger" description="Logger module to handle SDK logs." defaultValue="pinoLogger for Node.js, null for browsers" /%} -{% defaultvalue title="logLevel" description="Log level: `debug`, `info`, `warn`, `log`, `error`." defaultValue="'info'." /%} +{% defaultvalue title="logLevel" description="Log level: `debug`, `info`, `warn`, `log`, `error`." defaultValue="info" /%} -{% defaultvalue title="enableLogging" description="This option enables logging, set to `false` to completely disable logging (even if a logger is provided)." defaultValue="`true`." /%} +{% defaultvalue title="enableLogging" description="This option enables logging, set to `false` to completely disable logging (even if a logger is provided)." defaultValue="true" /%} ## yagnaOptions -{% defaultvalue title="apiKey" description="`apiKey` enables access to yagna rest API." defaultValue="as read from 'process.env.YAGNA_APPKEY' for node.js, null for browser." /%} +{% defaultvalue title="apiKey" description="`apiKey` enables access to yagna rest API." defaultValue="as read from 'process.env.YAGNA_APPKEY' for node.js, null for browser" /%} -{% defaultvalue title="basePath" description="URL of yagna REST API." defaultValue="`http://127.0.0.1:7465`." /%} +{% defaultvalue title="basePath" description="URL of yagna REST API." defaultValue="http://127.0.0.1:7465" /%} -{% defaultvalue title="maxTaskRetries" description="The maximum number of retries when the job failed on the provider." defaultValue="3." /%} +{% defaultvalue title="maxTaskRetries" description="The maximum number of retries when the job failed on the provider." defaultValue="3" /%} -{% defaultvalue title="activityPreparingTimeout" description="Timeout for preparing activity - creating and deploying commands in ms." defaultValue="5 * 60 * 1000 = 5 min." /%} +{% defaultvalue title="activityPreparingTimeout" description="Timeout for preparing activity - creating and deploying commands in ms." defaultValue="5 * 60 * 1000" /%} ## packagePackageOptions -{% defaultvalue title="engine" description="Type of the payload (`vm`, `wasm`)." defaultValue="`vm`," /%} +{% defaultvalue title="engine" description="Type of the payload (`vm`, `wasm`)." defaultValue="vm" /%} -{% defaultvalue title="minMemGib" description="Minimum size of RAM in GB." defaultValue="0.5." /%} +{% defaultvalue title="minMemGib" description="Minimum size of RAM in GB." defaultValue="0.5" /%} -{% defaultvalue title="minStorageGib" description="Minimum size of storage in GB." defaultValue="2," /%} +{% defaultvalue title="minStorageGib" description="Minimum size of storage in GB." defaultValue="2" /%} -{% defaultvalue title="minCpuThreads" description="Minimum no of threads." defaultValue="1." /%} +{% defaultvalue title="minCpuThreads" description="Minimum no of threads." defaultValue="1" /%} -{% defaultvalue title="minCpuCores" description="Minimum no of CPU cores." defaultValue="1." /%} +{% defaultvalue title="minCpuCores" description="Minimum no of CPU cores." defaultValue="1" /%} {% defaultvalue title="capabilities" description="Set of capabilities providers offer, see manifest and demand documentation of details." defaultValue="[]" /%} ## MarketOptions -{% defaultvalue title="debitNotesAcceptanceTimeout" description="Minimal time we reserve to accept debit notes, prosales with shorter time will be rejected in min." defaultValue="30." /%} +{% defaultvalue title="debitNotesAcceptanceTimeout" description="Minimal time we reserve to accept debit notes, prosales with shorter time will be rejected in min." defaultValue="30" /%} -{% defaultvalue title="proposalFilter" description="Filter to decide what proposal to accept (from these that match the demand)." defaultValue="acceptAllProposalFilter()." /%} +{% defaultvalue title="proposalFilter" description="Filter to decide what proposal to accept (from these that match the demand)." defaultValue="acceptAllProposalFilter()" /%} ## TaskServiceOptions -{% defaultvalue title="maxParallelTasks" description="Max no of parallel tasks when the TaskExecutor is running tasks from a list (see `map()` and `forEach()`)." defaultValue="5." /%} +{% defaultvalue title="maxParallelTasks" description="Max no of parallel tasks when the TaskExecutor is running tasks from a list (see `map()` and `forEach()`)." defaultValue="5" /%} ## PaymentOptions -{% defaultvalue title="network" description="Defines on that blockchain the payment will be performed, `goerli` is a test network where test GLM is used, `polygon`." defaultValue="`goerli`." /%} +{% defaultvalue title="network" description="Defines on that blockchain the payment will be performed, `goerli` is a test network where test GLM is used, `polygon`." defaultValue="goerli" /%} -{% defaultvalue title="budget" description="The amount that is allocated for all tasks scheduled by an executor in GLM/tGLM." defaultValue="1.0." /%} +{% defaultvalue title="budget" description="The amount that is allocated for all tasks scheduled by an executor in GLM/tGLM." defaultValue="1.0" /%} -{% defaultvalue title="paymentTimeout" description="Max time the executor script will await invoices from providers after tasks are complete in ms." defaultValue="60 * 1000 = 1 min." /%} +{% defaultvalue title="paymentTimeout" description="Max time the executor script will await invoices from providers after tasks are complete in ms." defaultValue="60 * 1000" /%} -{% defaultvalue title="allocationExpires" description="Duration after which allocation expires in msec, valid allocation is required to accept invoices." defaultValue="60 mins." /%} +{% defaultvalue title="allocationExpires" description="Duration after which allocation expires in msec, valid allocation is required to accept invoices." defaultValue="60 mins" /%} -{% defaultvalue title="debitNoteFilter" description="Filter containing rules for debitNotes acceptance." defaultValue="acceptAllDebitNotesFilter()." /%} +{% defaultvalue title="debitNoteFilter" description="Filter containing rules for debitNotes acceptance." defaultValue="acceptAllDebitNotesFilter()" /%} -{% defaultvalue title="invoiceFilter" description="Filter containing rules for Invoice acceptance." defaultValue="acceptAllInvoicesFilter()." /%} +{% defaultvalue title="invoiceFilter" description="Filter containing rules for Invoice acceptance." defaultValue="acceptAllInvoicesFilter()" /%} ## AgreementServiceOptions -{% defaultvalue title="agreementSelector" description="Decide which agreements will be used for the next task provided by the iterator, pool contains existing agreements and potential new agreements from available proposals." defaultValue="randomAgreementSelectorWithPriorityForExistingOnes()." /%} +{% defaultvalue title="agreementSelector" description="Decide which agreements will be used for the next task provided by the iterator, pool contains existing agreements and potential new agreements from available proposals." defaultValue="randomAgreementSelectorWithPriorityForExistingOnes()" /%} ## Activity -{% defaultvalue title="activityExecuteTimeout" description="Execution time for script (one command or batch) in ms." defaultValue="5*60*1000 = 5 min." /%} +{% defaultvalue title="activityExecuteTimeout" description="Execution time for script (one command or batch) in ms." defaultValue="5*60*1000" /%} From 518075063a74c22757b136ee488f53eae9f92ba6 Mon Sep 17 00:00:00 2001 From: Phillip Jensen Date: Thu, 26 Oct 2023 14:47:37 +0200 Subject: [PATCH 08/17] Update tag to allow for children to render markdown --- src/components/DefaultValue.jsx | 35 +++--- .../partials/customPages/default-values.md | 100 +++++++++++++----- src/markdoc/tags.js | 1 - 3 files changed, 96 insertions(+), 40 deletions(-) diff --git a/src/components/DefaultValue.jsx b/src/components/DefaultValue.jsx index cc682a3e3..f56c82a08 100644 --- a/src/components/DefaultValue.jsx +++ b/src/components/DefaultValue.jsx @@ -1,19 +1,26 @@ import { slugifyWithCounter } from '@sindresorhus/slugify' const slugify = slugifyWithCounter() -function DefaultValue({ title, description, defaultValue, id }) { - return ( -
-

{title}

-

{description}

-
- Default value: - {defaultValue} -
-
- ); +function DefaultValue({ title, children, defaultValue, id }) { + return ( +
+

+ {title} +

+ {children} +
+ + Default value:{' '} + + + {defaultValue} + +
+
+ ) } -export default DefaultValue; +export default DefaultValue diff --git a/src/markdoc/partials/customPages/default-values.md b/src/markdoc/partials/customPages/default-values.md index 6f302462a..7b21a4995 100644 --- a/src/markdoc/partials/customPages/default-values.md +++ b/src/markdoc/partials/customPages/default-values.md @@ -6,66 +6,116 @@ Below is a summary of the default values, their significance, and the associated ## executorOptions -{% defaultvalue title="taskTimeout" description="Timeout for executing one task in ms." defaultValue="5 * 60 * 1000" /%} +{% defaultvalue title="taskTimeout" defaultValue="5 * 60 * 1000" %} +Timeout for executing one task in ms. +{% /defaultvalue %} -{% defaultvalue title="logger" description="Logger module to handle SDK logs." defaultValue="pinoLogger for Node.js, null for browsers" /%} +{% defaultvalue title="logger" defaultValue="pinoLogger for Node.js, null for browsers" %} +Logger module to handle SDK logs. +{% /defaultvalue %} -{% defaultvalue title="logLevel" description="Log level: `debug`, `info`, `warn`, `log`, `error`." defaultValue="info" /%} +{% defaultvalue title="logLevel" defaultValue="info" %} +Log level: `debug`, `info`, `warn`, `log`, `error`. +{% /defaultvalue %} -{% defaultvalue title="enableLogging" description="This option enables logging, set to `false` to completely disable logging (even if a logger is provided)." defaultValue="true" /%} +{% defaultvalue title="enableLogging" defaultValue="true" %} +This option enables logging, set to `false` to completely disable logging (even if a logger is provided). +{% /defaultvalue %} ## yagnaOptions -{% defaultvalue title="apiKey" description="`apiKey` enables access to yagna rest API." defaultValue="as read from 'process.env.YAGNA_APPKEY' for node.js, null for browser" /%} +{% defaultvalue title="apiKey" defaultValue="as read from 'process.env.YAGNA_APPKEY' for node.js, null for browser" %} +`apiKey` enables access to yagna rest API. +{% /defaultvalue %} -{% defaultvalue title="basePath" description="URL of yagna REST API." defaultValue="http://127.0.0.1:7465" /%} +{% defaultvalue title="basePath" defaultValue="http://127.0.0.1:7465" %} +URL of yagna REST API. +{% /defaultvalue %} -{% defaultvalue title="maxTaskRetries" description="The maximum number of retries when the job failed on the provider." defaultValue="3" /%} +{% defaultvalue title="maxTaskRetries" defaultValue="3" %} +The maximum number of retries when the job failed on the provider. +{% /defaultvalue %} -{% defaultvalue title="activityPreparingTimeout" description="Timeout for preparing activity - creating and deploying commands in ms." defaultValue="5 * 60 * 1000" /%} +{% defaultvalue title="activityPreparingTimeout" defaultValue="5 * 60 * 1000" %} +Timeout for preparing activity - creating and deploying commands in ms. +{% /defaultvalue %} ## packagePackageOptions -{% defaultvalue title="engine" description="Type of the payload (`vm`, `wasm`)." defaultValue="vm" /%} +{% defaultvalue title="engine" defaultValue="vm" %} +Type of the payload (`vm`, `wasm`). +{% /defaultvalue %} -{% defaultvalue title="minMemGib" description="Minimum size of RAM in GB." defaultValue="0.5" /%} +{% defaultvalue title="minMemGib" defaultValue="0.5" %} +Minimum size of RAM in GB. +{% /defaultvalue %} -{% defaultvalue title="minStorageGib" description="Minimum size of storage in GB." defaultValue="2" /%} +{% defaultvalue title="minStorageGib" defaultValue="2" %} +Minimum size of storage in GB. +{% /defaultvalue %} -{% defaultvalue title="minCpuThreads" description="Minimum no of threads." defaultValue="1" /%} +{% defaultvalue title="minCpuThreads" defaultValue="1" %} +Minimum no of threads. +{% /defaultvalue %} -{% defaultvalue title="minCpuCores" description="Minimum no of CPU cores." defaultValue="1" /%} +{% defaultvalue title="minCpuCores" defaultValue="1" %} +Minimum no of CPU cores. +{% /defaultvalue %} -{% defaultvalue title="capabilities" description="Set of capabilities providers offer, see manifest and demand documentation of details." defaultValue="[]" /%} +{% defaultvalue title="capabilities" defaultValue="[]" %} +Set of capabilities providers offer, see manifest and demand documentation of details. +{% /defaultvalue %} ## MarketOptions -{% defaultvalue title="debitNotesAcceptanceTimeout" description="Minimal time we reserve to accept debit notes, prosales with shorter time will be rejected in min." defaultValue="30" /%} +{% defaultvalue title="debitNotesAcceptanceTimeout" defaultValue="30" %} +Minimal time we reserve to accept debit notes, prosales with shorter time will be rejected in min. +{% /defaultvalue %} -{% defaultvalue title="proposalFilter" description="Filter to decide what proposal to accept (from these that match the demand)." defaultValue="acceptAllProposalFilter()" /%} +{% defaultvalue title="proposalFilter" defaultValue="acceptAllProposalFilter()" %} +Filter to decide what proposal to accept (from these that match the demand). +{% /defaultvalue %} ## TaskServiceOptions -{% defaultvalue title="maxParallelTasks" description="Max no of parallel tasks when the TaskExecutor is running tasks from a list (see `map()` and `forEach()`)." defaultValue="5" /%} +{% defaultvalue title="maxParallelTasks" defaultValue="5" %} +Max no of parallel tasks when the TaskExecutor is running tasks from a list (see `map()` and `forEach()`). +{% /defaultvalue %} ## PaymentOptions -{% defaultvalue title="network" description="Defines on that blockchain the payment will be performed, `goerli` is a test network where test GLM is used, `polygon`." defaultValue="goerli" /%} +{% defaultvalue title="network" defaultValue="goerli" %} +Defines on that blockchain the payment will be performed, `goerli` is a test network where test GLM is used, `polygon`. +{% /defaultvalue %} -{% defaultvalue title="budget" description="The amount that is allocated for all tasks scheduled by an executor in GLM/tGLM." defaultValue="1.0" /%} +{% defaultvalue title="budget" defaultValue="1.0" %} +The amount that is allocated for all tasks scheduled by an executor in GLM/tGLM. +{% /defaultvalue %} -{% defaultvalue title="paymentTimeout" description="Max time the executor script will await invoices from providers after tasks are complete in ms." defaultValue="60 * 1000" /%} +{% defaultvalue title="paymentTimeout" defaultValue="60 * 1000" %} +Max time the executor script will await invoices from providers after tasks are complete in ms. +{% /defaultvalue %} -{% defaultvalue title="allocationExpires" description="Duration after which allocation expires in msec, valid allocation is required to accept invoices." defaultValue="60 mins" /%} +{% defaultvalue title="allocationExpires" defaultValue="60 mins" %} +Duration after which allocation expires in msec, valid allocation is required to accept invoices. +{% /defaultvalue %} -{% defaultvalue title="debitNoteFilter" description="Filter containing rules for debitNotes acceptance." defaultValue="acceptAllDebitNotesFilter()" /%} +{% defaultvalue title="debitNoteFilter" defaultValue="acceptAllDebitNotesFilter()" %} +Filter containing rules for debitNotes acceptance. +{% /defaultvalue %} -{% defaultvalue title="invoiceFilter" description="Filter containing rules for Invoice acceptance." defaultValue="acceptAllInvoicesFilter()" /%} +{% defaultvalue title="invoiceFilter" defaultValue="acceptAllInvoicesFilter()" %} +Filter containing rules for Invoice acceptance. +{% /defaultvalue %} ## AgreementServiceOptions -{% defaultvalue title="agreementSelector" description="Decide which agreements will be used for the next task provided by the iterator, pool contains existing agreements and potential new agreements from available proposals." defaultValue="randomAgreementSelectorWithPriorityForExistingOnes()" /%} +{% defaultvalue title="agreementSelector" defaultValue="randomAgreementSelectorWithPriorityForExistingOnes()" %} +Decide which agreements will be used for the next task provided by the iterator, pool contains existing agreements and potential new agreements from available proposals. +{% /defaultvalue %} ## Activity -{% defaultvalue title="activityExecuteTimeout" description="Execution time for script (one command or batch) in ms." defaultValue="5*60*1000" /%} +{% defaultvalue title="activityExecuteTimeout" defaultValue="5*60*1000" %} +Execution time for script (one command or batch) in ms. +{% /defaultvalue %} \ No newline at end of file diff --git a/src/markdoc/tags.js b/src/markdoc/tags.js index 713664b37..0a03df7e6 100644 --- a/src/markdoc/tags.js +++ b/src/markdoc/tags.js @@ -41,7 +41,6 @@ const tags = { render: DefaultValue, attributes: { title: { type: String }, - description: { type: String }, defaultValue: { type: String }, }, transform(node, config) { From 5dc423d35b88de7e75d52b5899af79fa1fbaf449 Mon Sep 17 00:00:00 2001 From: Phillip Jensen Date: Thu, 26 Oct 2023 14:58:38 +0200 Subject: [PATCH 09/17] Rephrase descriptions to be more clear --- .../partials/customPages/default-values.md | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/markdoc/partials/customPages/default-values.md b/src/markdoc/partials/customPages/default-values.md index 7b21a4995..421b86005 100644 --- a/src/markdoc/partials/customPages/default-values.md +++ b/src/markdoc/partials/customPages/default-values.md @@ -7,115 +7,115 @@ Below is a summary of the default values, their significance, and the associated ## executorOptions {% defaultvalue title="taskTimeout" defaultValue="5 * 60 * 1000" %} -Timeout for executing one task in ms. +Specifies the timeout for executing a single task, measured in milliseconds (ms). {% /defaultvalue %} {% defaultvalue title="logger" defaultValue="pinoLogger for Node.js, null for browsers" %} -Logger module to handle SDK logs. +Determines the logger module responsible for handling SDK logs. {% /defaultvalue %} {% defaultvalue title="logLevel" defaultValue="info" %} -Log level: `debug`, `info`, `warn`, `log`, `error`. +Defines the log level. Available options: `debug`, `info`, `warn`, `log`, `error`. {% /defaultvalue %} {% defaultvalue title="enableLogging" defaultValue="true" %} -This option enables logging, set to `false` to completely disable logging (even if a logger is provided). +Enable or disable logging. Set to `false` to turn off all logging, even if a logger module is specified. {% /defaultvalue %} ## yagnaOptions {% defaultvalue title="apiKey" defaultValue="as read from 'process.env.YAGNA_APPKEY' for node.js, null for browser" %} -`apiKey` enables access to yagna rest API. +The `apiKey` facilitates access to the yagna REST API. {% /defaultvalue %} {% defaultvalue title="basePath" defaultValue="http://127.0.0.1:7465" %} -URL of yagna REST API. +The base URL of the yagna REST API. {% /defaultvalue %} {% defaultvalue title="maxTaskRetries" defaultValue="3" %} -The maximum number of retries when the job failed on the provider. +Designates the maximum number of retry attempts for a job if it fails on the provider's side. {% /defaultvalue %} {% defaultvalue title="activityPreparingTimeout" defaultValue="5 * 60 * 1000" %} -Timeout for preparing activity - creating and deploying commands in ms. +Timeout for activity preparation, which includes the creation and deployment of commands, in ms. {% /defaultvalue %} ## packagePackageOptions {% defaultvalue title="engine" defaultValue="vm" %} -Type of the payload (`vm`, `wasm`). +Specifies the type of the payload. Options include: `vm`, `wasm`. {% /defaultvalue %} {% defaultvalue title="minMemGib" defaultValue="0.5" %} -Minimum size of RAM in GB. +Minimum required RAM size, denoted in gigabytes (GB). {% /defaultvalue %} {% defaultvalue title="minStorageGib" defaultValue="2" %} -Minimum size of storage in GB. +Minimum required storage size, denoted in gigabytes (GB). {% /defaultvalue %} {% defaultvalue title="minCpuThreads" defaultValue="1" %} -Minimum no of threads. +Minimum number of CPU threads required. {% /defaultvalue %} {% defaultvalue title="minCpuCores" defaultValue="1" %} -Minimum no of CPU cores. +Minimum number of CPU cores required. {% /defaultvalue %} {% defaultvalue title="capabilities" defaultValue="[]" %} -Set of capabilities providers offer, see manifest and demand documentation of details. +List of capabilities that providers can offer. Refer to the manifest and demand documentation for more details. {% /defaultvalue %} ## MarketOptions {% defaultvalue title="debitNotesAcceptanceTimeout" defaultValue="30" %} -Minimal time we reserve to accept debit notes, prosales with shorter time will be rejected in min. +Sets the minimal time reserved for accepting debit notes. Proposals with shorter times will be rejected, measured in minutes. {% /defaultvalue %} {% defaultvalue title="proposalFilter" defaultValue="acceptAllProposalFilter()" %} -Filter to decide what proposal to accept (from these that match the demand). +This filter determines which proposals to accept, based on their compatibility with the demand. {% /defaultvalue %} ## TaskServiceOptions {% defaultvalue title="maxParallelTasks" defaultValue="5" %} -Max no of parallel tasks when the TaskExecutor is running tasks from a list (see `map()` and `forEach()`). +Sets the maximum number of tasks that can be executed concurrently when the TaskExecutor processes tasks from a list (refer to `map()` and `forEach()` methods). {% /defaultvalue %} ## PaymentOptions {% defaultvalue title="network" defaultValue="goerli" %} -Defines on that blockchain the payment will be performed, `goerli` is a test network where test GLM is used, `polygon`. +Defines the blockchain network for processing payments. The `goerli` option indicates a test network that utilizes test GLM. Other options include `polygon`. {% /defaultvalue %} {% defaultvalue title="budget" defaultValue="1.0" %} -The amount that is allocated for all tasks scheduled by an executor in GLM/tGLM. +Specifies the total budget allocated for all tasks scheduled by an executor, measured in GLM/tGLM. {% /defaultvalue %} {% defaultvalue title="paymentTimeout" defaultValue="60 * 1000" %} -Max time the executor script will await invoices from providers after tasks are complete in ms. +Max waiting time for the executor script to receive invoices from providers post task completion, in ms. {% /defaultvalue %} -{% defaultvalue title="allocationExpires" defaultValue="60 mins" %} -Duration after which allocation expires in msec, valid allocation is required to accept invoices. +{% defaultvalue title="allocationExpires" defaultValue="60000 * 60" %} +Specifies the duration after which an allocation expires, in milliseconds. A valid allocation is essential for accepting invoices. {% /defaultvalue %} {% defaultvalue title="debitNoteFilter" defaultValue="acceptAllDebitNotesFilter()" %} -Filter containing rules for debitNotes acceptance. +This filter outlines the rules for debit note acceptance. {% /defaultvalue %} {% defaultvalue title="invoiceFilter" defaultValue="acceptAllInvoicesFilter()" %} -Filter containing rules for Invoice acceptance. +This filter outlines the rules for invoice acceptance. {% /defaultvalue %} ## AgreementServiceOptions {% defaultvalue title="agreementSelector" defaultValue="randomAgreementSelectorWithPriorityForExistingOnes()" %} -Decide which agreements will be used for the next task provided by the iterator, pool contains existing agreements and potential new agreements from available proposals. +This selector determines which agreements will be chosen for the next task, provided by the iterator. The pool comprises existing agreements and potential new agreements sourced from available proposals. {% /defaultvalue %} ## Activity {% defaultvalue title="activityExecuteTimeout" defaultValue="5*60*1000" %} -Execution time for script (one command or batch) in ms. -{% /defaultvalue %} \ No newline at end of file +Sets the maximum execution time for a script, either a single command or a batch, in ms. +{% /defaultvalue %} From fd3fedbaae09523fc7a7e31b9bdeebd268c5099d Mon Sep 17 00:00:00 2001 From: Phillip Jensen Date: Thu, 26 Oct 2023 15:41:43 +0200 Subject: [PATCH 10/17] Add component example to the demo template --- src/pages/docs/templates/demo.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/pages/docs/templates/demo.md b/src/pages/docs/templates/demo.md index 284b259f5..0a1873a0c 100644 --- a/src/pages/docs/templates/demo.md +++ b/src/pages/docs/templates/demo.md @@ -190,3 +190,20 @@ syntax. Keep in mind that this partial syntax root is in the directory specified above. {% partial file="demo.md" /%} + +# How to use the default values component + +We came across the need to create a page with all the default values in the SDK, so it was easy for the users +to find them. The page looked blank, so what we came up with was a custom component to make it easier on the eyes. + +The component accepts a title and a default value, and everything inside will be rendered as the description, and in here its possible to markdown syntax to for example highlight code. + +```markdown {% process=false %} +{% defaultvalue title="allocationExpires" defaultValue="60000 * 60" %} +Specifies the duration after which an allocation expires, in milliseconds. A valid allocation is essential for accepting invoices. +{% /defaultvalue %} +``` + +{% defaultvalue title="allocationExpires" defaultValue="60000 * 60" %} +Specifies the duration after which an allocation expires, in milliseconds. A valid allocation is essential for accepting invoices. +{% /defaultvalue %} \ No newline at end of file From 6c51068401f09b9250461275db8c95a62fcc1923 Mon Sep 17 00:00:00 2001 From: Phillip Jensen Date: Thu, 26 Oct 2023 15:58:04 +0200 Subject: [PATCH 11/17] Fix partials not being indexed on the right sidebar --- src/pages/_app.jsx | 49 +++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/src/pages/_app.jsx b/src/pages/_app.jsx index d2f76740a..b9771ee4e 100644 --- a/src/pages/_app.jsx +++ b/src/pages/_app.jsx @@ -20,37 +20,38 @@ function getNodeText(node) { return text } -function collectHeadings( - nodes, - slugify = slugifyWithCounter(), - lastNodes = [], - idMap = {} -) { - let sections = [] +function collectHeadings(nodes, slugify = slugifyWithCounter(), lastNodes = [], idMap = {}) { + let sections = []; for (let node of nodes) { - if (node.name === 'Heading' || (node.name === 'Defaultvalue' && node.attributes && node.attributes.title)) { - let level = node.name === 'Defaultvalue' ? 3 : node.attributes.level - let title = node.name === 'Defaultvalue' ? node.attributes.title : getNodeText(node) - - if (title) { - - let id = node.attributes?.id ?? slugify(title) - let newNode = { ...node.attributes, id, title, children: [], level } - if (lastNodes[level - 2]) { - lastNodes[level - 2].children.push(newNode) - } else { - sections.push(newNode) + if (Array.isArray(node)) { + sections.push(...collectHeadings(node, slugify, lastNodes, idMap)); + } + else { + if (node.name === 'Heading' || (node.name === 'Defaultvalue' && node.attributes && node.attributes.title)) { + let level = node.name === 'Defaultvalue' ? 3 : node.attributes.level; + let title = node.name === 'Defaultvalue' ? node.attributes.title : getNodeText(node); + + if (title) { + let id = node.attributes?.id ?? slugify(title); + let newNode = { ...node.attributes, id, title, children: [], level }; + if (lastNodes[level - 2]) { + lastNodes[level - 2].children.push(newNode); + } else { + sections.push(newNode); + } + lastNodes[level - 1] = newNode; + lastNodes.length = level; } - lastNodes[level - 1] = newNode - lastNodes.length = level } + + sections.push(...collectHeadings(node.children ?? [], slugify, lastNodes, idMap)); } - - sections.push(...collectHeadings(node.children ?? [], slugify, lastNodes, idMap)) } - return sections + + return sections; } + export default function App({ Component, pageProps }) { let title = pageProps.markdoc?.frontmatter.title if (!title) { From bbfdbaa914ec71334e19017cbe6b74d299e8317c Mon Sep 17 00:00:00 2001 From: Phillip Jensen Date: Thu, 26 Oct 2023 16:04:18 +0200 Subject: [PATCH 12/17] Remove console.log --- src/markdoc/search.mjs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/markdoc/search.mjs b/src/markdoc/search.mjs index 95cdc0f78..a947b30af 100644 --- a/src/markdoc/search.mjs +++ b/src/markdoc/search.mjs @@ -28,9 +28,6 @@ function extractSections(node, sections, isRoot = true) { } if (node.type === 'tag' && node.tag === 'partial' && node.attributes.file) { - if (node.tag === 'partial') { - console.log(node) - } const fileContent = fs.readFileSync( `./src/markdoc/partials/${node.attributes.file}`, 'utf8' From 5dc5328a7c417de03ee21c4ec6784e156dab1ab9 Mon Sep 17 00:00:00 2001 From: Phillip Jensen <33448819+cryptobench@users.noreply.github.com> Date: Thu, 26 Oct 2023 16:05:06 +0200 Subject: [PATCH 13/17] Update src/markdoc/partials/customPages/default-values.md Co-authored-by: Marcin Gordel --- src/markdoc/partials/customPages/default-values.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/markdoc/partials/customPages/default-values.md b/src/markdoc/partials/customPages/default-values.md index 421b86005..f127852b9 100644 --- a/src/markdoc/partials/customPages/default-values.md +++ b/src/markdoc/partials/customPages/default-values.md @@ -37,7 +37,7 @@ Designates the maximum number of retry attempts for a job if it fails on the pro {% /defaultvalue %} {% defaultvalue title="activityPreparingTimeout" defaultValue="5 * 60 * 1000" %} -Timeout for activity preparation, which includes the creation and deployment of commands, in ms. +Timeout for activity preparation, which includes the creation and deployment commands, in ms. {% /defaultvalue %} ## packagePackageOptions From a10a5bd230e7616008af3d4e95d4061effbc3ac9 Mon Sep 17 00:00:00 2001 From: Phillip Jensen <33448819+cryptobench@users.noreply.github.com> Date: Thu, 26 Oct 2023 16:05:14 +0200 Subject: [PATCH 14/17] Update src/markdoc/partials/customPages/default-values.md Co-authored-by: Marcin Gordel --- src/markdoc/partials/customPages/default-values.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/markdoc/partials/customPages/default-values.md b/src/markdoc/partials/customPages/default-values.md index f127852b9..68192f452 100644 --- a/src/markdoc/partials/customPages/default-values.md +++ b/src/markdoc/partials/customPages/default-values.md @@ -4,7 +4,7 @@ The JS SDK is designed to streamline the experience for developers by providing Below is a summary of the default values, their significance, and the associated parameters that can be adjusted as per your requirements: -## executorOptions +## ExecutorOptions {% defaultvalue title="taskTimeout" defaultValue="5 * 60 * 1000" %} Specifies the timeout for executing a single task, measured in milliseconds (ms). From 333fb1843de8aec99995ce682909bc9b83bd69c7 Mon Sep 17 00:00:00 2001 From: Phillip Jensen Date: Thu, 26 Oct 2023 16:08:39 +0200 Subject: [PATCH 15/17] Reordering and naming --- .../partials/customPages/default-values.md | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/markdoc/partials/customPages/default-values.md b/src/markdoc/partials/customPages/default-values.md index 68192f452..464c1437f 100644 --- a/src/markdoc/partials/customPages/default-values.md +++ b/src/markdoc/partials/customPages/default-values.md @@ -22,7 +22,11 @@ Defines the log level. Available options: `debug`, `info`, `warn`, `log`, `error Enable or disable logging. Set to `false` to turn off all logging, even if a logger module is specified. {% /defaultvalue %} -## yagnaOptions +{% defaultvalue title="maxTaskRetries" defaultValue="3" %} +Designates the maximum number of retry attempts for a job if it fails on the provider's side. +{% /defaultvalue %} + +## YagnaOptions {% defaultvalue title="apiKey" defaultValue="as read from 'process.env.YAGNA_APPKEY' for node.js, null for browser" %} The `apiKey` facilitates access to the yagna REST API. @@ -32,13 +36,7 @@ The `apiKey` facilitates access to the yagna REST API. The base URL of the yagna REST API. {% /defaultvalue %} -{% defaultvalue title="maxTaskRetries" defaultValue="3" %} -Designates the maximum number of retry attempts for a job if it fails on the provider's side. -{% /defaultvalue %} -{% defaultvalue title="activityPreparingTimeout" defaultValue="5 * 60 * 1000" %} -Timeout for activity preparation, which includes the creation and deployment commands, in ms. -{% /defaultvalue %} ## packagePackageOptions @@ -82,6 +80,14 @@ This filter determines which proposals to accept, based on their compatibility w Sets the maximum number of tasks that can be executed concurrently when the TaskExecutor processes tasks from a list (refer to `map()` and `forEach()` methods). {% /defaultvalue %} +{% defaultvalue title="activityPreparingTimeout" defaultValue="5 * 60 * 1000" %} +Timeout for activity preparation, which includes the creation and deployment commands, in ms. +{% /defaultvalue %} + +{% defaultvalue title="activityExecuteTimeout" defaultValue="5*60*1000" %} +Sets the maximum execution time for a script, either a single command or a batch, in ms. +{% /defaultvalue %} + ## PaymentOptions {% defaultvalue title="network" defaultValue="goerli" %} @@ -113,9 +119,3 @@ This filter outlines the rules for invoice acceptance. {% defaultvalue title="agreementSelector" defaultValue="randomAgreementSelectorWithPriorityForExistingOnes()" %} This selector determines which agreements will be chosen for the next task, provided by the iterator. The pool comprises existing agreements and potential new agreements sourced from available proposals. {% /defaultvalue %} - -## Activity - -{% defaultvalue title="activityExecuteTimeout" defaultValue="5*60*1000" %} -Sets the maximum execution time for a script, either a single command or a batch, in ms. -{% /defaultvalue %} From a66ffee50452724ffab2bacac0f02d782bb3f79b Mon Sep 17 00:00:00 2001 From: Phillip Jensen Date: Thu, 26 Oct 2023 16:14:39 +0200 Subject: [PATCH 16/17] Add support for links in default value component --- src/components/DefaultValue.jsx | 14 ++++++++++++-- src/markdoc/partials/customPages/default-values.md | 8 ++++---- src/markdoc/tags.js | 1 + 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/components/DefaultValue.jsx b/src/components/DefaultValue.jsx index f56c82a08..eccfa91f0 100644 --- a/src/components/DefaultValue.jsx +++ b/src/components/DefaultValue.jsx @@ -1,7 +1,8 @@ import { slugifyWithCounter } from '@sindresorhus/slugify' +import Link from 'next/link' const slugify = slugifyWithCounter() -function DefaultValue({ title, children, defaultValue, id }) { +function DefaultValue({ title, children, defaultValue, id, referenceLink = null }) { return (

Default value:{' '} - + {referenceLink ? ( + + {defaultValue} + + ) : ( + {defaultValue} + ) }

) diff --git a/src/markdoc/partials/customPages/default-values.md b/src/markdoc/partials/customPages/default-values.md index 464c1437f..5f881e206 100644 --- a/src/markdoc/partials/customPages/default-values.md +++ b/src/markdoc/partials/customPages/default-values.md @@ -70,7 +70,7 @@ List of capabilities that providers can offer. Refer to the manifest and demand Sets the minimal time reserved for accepting debit notes. Proposals with shorter times will be rejected, measured in minutes. {% /defaultvalue %} -{% defaultvalue title="proposalFilter" defaultValue="acceptAllProposalFilter()" %} +{% defaultvalue title="proposalFilter" referenceLink="https://github.com/golemfactory/golem-js/blob/00d03aedd4d1c239d3b6833c6c89b61348ab50af/src/market/strategy.ts#L4" defaultValue="acceptAllProposalFilter()" %} This filter determines which proposals to accept, based on their compatibility with the demand. {% /defaultvalue %} @@ -106,16 +106,16 @@ Max waiting time for the executor script to receive invoices from providers post Specifies the duration after which an allocation expires, in milliseconds. A valid allocation is essential for accepting invoices. {% /defaultvalue %} -{% defaultvalue title="debitNoteFilter" defaultValue="acceptAllDebitNotesFilter()" %} +{% defaultvalue title="debitNoteFilter" defaultValue="acceptAllDebitNotesFilter()" referenceLink="https://github.com/golemfactory/golem-js/blob/00d03aedd4d1c239d3b6833c6c89b61348ab50af/src/payment/strategy.ts#L5" %} This filter outlines the rules for debit note acceptance. {% /defaultvalue %} -{% defaultvalue title="invoiceFilter" defaultValue="acceptAllInvoicesFilter()" %} +{% defaultvalue title="invoiceFilter" defaultValue="acceptAllInvoicesFilter()" referenceLink="https://github.com/golemfactory/golem-js/blob/00d03aedd4d1c239d3b6833c6c89b61348ab50af/src/payment/strategy.ts#L7" %} This filter outlines the rules for invoice acceptance. {% /defaultvalue %} ## AgreementServiceOptions -{% defaultvalue title="agreementSelector" defaultValue="randomAgreementSelectorWithPriorityForExistingOnes()" %} +{% defaultvalue title="agreementSelector" defaultValue="randomAgreementSelectorWithPriorityForExistingOnes()" referenceLink="https://github.com/golemfactory/golem-js/blob/00d03aedd4d1c239d3b6833c6c89b61348ab50af/src/agreement/strategy.ts#L8" %} This selector determines which agreements will be chosen for the next task, provided by the iterator. The pool comprises existing agreements and potential new agreements sourced from available proposals. {% /defaultvalue %} diff --git a/src/markdoc/tags.js b/src/markdoc/tags.js index 0a03df7e6..5e7eb6b98 100644 --- a/src/markdoc/tags.js +++ b/src/markdoc/tags.js @@ -42,6 +42,7 @@ const tags = { attributes: { title: { type: String }, defaultValue: { type: String }, + referenceLink: { type: String }, }, transform(node, config) { const attributes = node.transformAttributes(config) From 4761ba246761b5410b1e9448ec1e68b3f065646e Mon Sep 17 00:00:00 2001 From: jalas167 <42438166+jalas167@users.noreply.github.com> Date: Fri, 27 Oct 2023 10:28:04 +0200 Subject: [PATCH 17/17] Update default-values.md --- src/markdoc/partials/customPages/default-values.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/markdoc/partials/customPages/default-values.md b/src/markdoc/partials/customPages/default-values.md index 5f881e206..173f776dc 100644 --- a/src/markdoc/partials/customPages/default-values.md +++ b/src/markdoc/partials/customPages/default-values.md @@ -38,7 +38,7 @@ The base URL of the yagna REST API. -## packagePackageOptions +## PackageOptions {% defaultvalue title="engine" defaultValue="vm" %} Specifies the type of the payload. Options include: `vm`, `wasm`. @@ -92,6 +92,7 @@ Sets the maximum execution time for a script, either a single command or a batch {% defaultvalue title="network" defaultValue="goerli" %} Defines the blockchain network for processing payments. The `goerli` option indicates a test network that utilizes test GLM. Other options include `polygon`. +Important: the `nework` is a property of payment object: `payment: { network: "goerli", driver: "erc20" }`. {% /defaultvalue %} {% defaultvalue title="budget" defaultValue="1.0" %}