Skip to content

Commit

Permalink
chore: add node-fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
tquocanvn committed May 14, 2024
1 parent aa61745 commit e55e010
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"jest-junit": "16.0.0",
"node-fetch": "^2.7.0",
"prettier": "3.2.5",
"prettier-plugin-tailwindcss": "0.5.14",
"remark-frontmatter": "5.0.0",
Expand Down
6 changes: 3 additions & 3 deletions scripts/orama-search/sync-orama-cloud.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { siteContent } from './get-documents.mjs';
import { ORAMA_SYNC_BATCH_SIZE } from '../../next.constants.mjs';

Check failure on line 2 in scripts/orama-search/sync-orama-cloud.mjs

View workflow job for this annotation

GitHub Actions / Quality checks

There should be at least one empty line between import groups
import fetch from 'node-fetch';

Check failure on line 3 in scripts/orama-search/sync-orama-cloud.mjs

View workflow job for this annotation

GitHub Actions / Quality checks

`node-fetch` import should occur before import of `./get-documents.mjs`

// The following follows the instructions at https://docs.oramasearch.com/cloud/data-sources/custom-integrations/webhooks

Expand Down Expand Up @@ -35,19 +36,18 @@ const insertBatch = async batch => {
headers: oramaHeaders,
body: JSON.stringify({ upsert: batch }),
});
}
};

// We call the "deploy" API to trigger a deployment of the index, which will process all the documents in the queue.
// Full docs on the "deploy" API: https://docs.oramasearch.com/cloud/data-sources/custom-integrations/webhooks#deploying-the-index
const triggerDeployment = async () => {

await fetch(`${ORAMA_API_BASE_URL}/deploy`, {
method: 'POST',
headers: oramaHeaders,
});

console.log('Deploy done');
}
};

// We call the "snapshot" API to empty the index before inserting the new documents.
// The "snapshot" API is typically used to replace the entire index with a fresh set of documents, but we use it here to empty the index.
Expand Down

0 comments on commit e55e010

Please sign in to comment.