@datacamp/learn-vm-scripts 1.11.0 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.cjs +28 -25
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -366678,6 +366678,28 @@ var waitForStableBox = async (page, selector, stableMs = 200) => {
366678
366678
  );
366679
366679
  };
366680
366680
 
366681
+ // src/retryWithExponentialBackoff.ts
366682
+ var retryWithExponentialBackoff = async ({
366683
+ fn,
366684
+ maxRetries,
366685
+ initialDelay
366686
+ }) => {
366687
+ let retries = 0;
366688
+ while (retries < maxRetries) {
366689
+ try {
366690
+ await fn();
366691
+ return;
366692
+ } catch (e) {
366693
+ console.error(`Error in exponential backoff iteration ${retries}:`, e);
366694
+ await new Promise(
366695
+ (resolve5) => setTimeout(resolve5, 2 ** retries * initialDelay)
366696
+ );
366697
+ retries++;
366698
+ }
366699
+ }
366700
+ throw new Error("Max retries exceeded");
366701
+ };
366702
+
366681
366703
  // src/setInput.ts
366682
366704
  var setInput = async ({
366683
366705
  page,
@@ -366694,12 +366716,17 @@ var setInput = async ({
366694
366716
  } catch (error) {
366695
366717
  log(`Error typing in input: ${error}`);
366696
366718
  }
366697
- return page.evaluate(
366719
+ const fn = () => page.evaluate(
366698
366720
  ({ querySelector: querySelector2, value: value2 }) => {
366699
366721
  document.querySelector(querySelector2).value = value2;
366700
366722
  },
366701
366723
  { querySelector, value }
366702
366724
  );
366725
+ return retryWithExponentialBackoff({
366726
+ fn,
366727
+ initialDelay: 100,
366728
+ maxRetries: 3
366729
+ });
366703
366730
  };
366704
366731
 
366705
366732
  // src/azureLogin.ts
@@ -366825,30 +366852,6 @@ async function loginToDatabricks({
366825
366852
  // src/resetChrome.ts
366826
366853
  var import_node_child_process = require("node:child_process");
366827
366854
  var import_promises = require("node:fs/promises");
366828
-
366829
- // src/retryWithExponentialBackoff.ts
366830
- var retryWithExponentialBackoff = async ({
366831
- fn,
366832
- maxRetries,
366833
- initialDelay
366834
- }) => {
366835
- let retries = 0;
366836
- while (retries < maxRetries) {
366837
- try {
366838
- await fn();
366839
- return;
366840
- } catch (e) {
366841
- console.error(`Error in exponential backoff iteration ${retries}:`, e);
366842
- await new Promise(
366843
- (resolve5) => setTimeout(resolve5, 2 ** retries * initialDelay)
366844
- );
366845
- retries++;
366846
- }
366847
- }
366848
- throw new Error("Max retries exceeded");
366849
- };
366850
-
366851
- // src/resetChrome.ts
366852
366855
  var resetChrome = async ({ userDataDir }) => {
366853
366856
  try {
366854
366857
  const stdout = (0, import_node_child_process.execSync)("taskkill /IM chrome.exe /F");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datacamp/learn-vm-scripts",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "repository": "git@github.com:datacamp-engineering/learn-vm-scripts.git",
5
5
  "description": "Scripts used by VMs in learn.",
6
6
  "main": "./dist/index.cjs",