Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ const schema = a.schema({

## Assign default values for fields

You can use the `.default(...)` modifier to specify a default value for optional [scalar type fields and enums](https://docs.aws.amazon.com/appsync/latest/devguide/scalars.html). The `.default(...)` modifier is not available for custom types, arrays, or relationships.
You can use the `.default(...)` modifier to specify a default value for optional [scalar type fields](https://docs.aws.amazon.com/appsync/latest/devguide/scalars.html). The `.default(...)` modifier is not available for custom types, arrays, or relationships.

```ts
const schema = a.schema({
Expand Down
25 changes: 19 additions & 6 deletions tasks/console-errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,28 @@ const checkPage = async (url) => {
return errorsFound;
};

function chunkArray(array, chunkSize) {
const result = [];
for (let i = 0; i < array.length; i += chunkSize) {
result.push(array.slice(i, i + chunkSize));
}
return result;
}

const consoleErrors = async (domain) => {
const pagesToCheck = await getSitemapUrls(domain);
const pagesToCheckChunks = chunkArray(pagesToCheck, 20);
let errorMessage = '';
for (let i = 0; i < pagesToCheck.length; i++) {
const url = pagesToCheck[i];
console.log(`checking page ${url}`);
const errorsFound = await checkPage(url);
errorsFound.forEach((error) => {
errorMessage += `${error.message} found on ${error.page}\n`;
for (let i = 0; i < pagesToCheckChunks.length; i++) {
const urls = pagesToCheckChunks[i];
const errorsFoundGroups = urls.map((url) => {
console.log(`checking page ${url}`);
return checkPage(url);
});
await Promise.all(errorsFoundGroups).then((errorsFound) => {
errorsFound.forEach((error) => {
errorMessage += `${error.message} found on ${error.page}\n`;
});
});
}
if (errorMessage != '') {
Expand Down
Loading