intellitester 0.2.18 → 0.2.19

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.
@@ -9,6 +9,7 @@ var path = require('path');
9
9
  var child_process = require('child_process');
10
10
  var playwright = require('playwright');
11
11
  var prompts = require('prompts');
12
+ var uniqueNamesGenerator = require('unique-names-generator');
12
13
  var nodeAppwrite = require('node-appwrite');
13
14
  var anthropic = require('@llamaindex/anthropic');
14
15
  var openai = require('@llamaindex/openai');
@@ -485,6 +486,19 @@ var isPipelineContent = (content) => {
485
486
  return false;
486
487
  }
487
488
  };
489
+ function generateRandomUsername() {
490
+ const numberDictionary = uniqueNamesGenerator.NumberDictionary.generate({ min: 0, max: 99 });
491
+ const username = uniqueNamesGenerator.uniqueNamesGenerator({
492
+ dictionaries: [uniqueNamesGenerator.adjectives, uniqueNamesGenerator.animals, numberDictionary],
493
+ separator: "",
494
+ style: "capital",
495
+ length: 3
496
+ });
497
+ if (username.length > 30) {
498
+ return username.slice(0, 30);
499
+ }
500
+ return username;
501
+ }
488
502
 
489
503
  // src/integrations/email/inbucketClient.ts
490
504
  var InbucketClient = class {
@@ -1025,6 +1039,9 @@ function interpolateVariables(value, variables) {
1025
1039
  if (varName === "uuid") {
1026
1040
  return crypto2__default.default.randomUUID().split("-")[0];
1027
1041
  }
1042
+ if (varName === "randomUsername") {
1043
+ return generateRandomUsername();
1044
+ }
1028
1045
  return variables.get(varName) ?? match;
1029
1046
  });
1030
1047
  }
@@ -1882,6 +1899,9 @@ function interpolateWorkflowVariables(value, currentVariables, testResults) {
1882
1899
  if (path3 === "uuid") {
1883
1900
  return crypto2__default.default.randomUUID().split("-")[0];
1884
1901
  }
1902
+ if (path3 === "randomUsername") {
1903
+ return generateRandomUsername();
1904
+ }
1885
1905
  return currentVariables.get(path3) ?? match;
1886
1906
  });
1887
1907
  }
@@ -1903,6 +1923,9 @@ async function runTestInWorkflow(test, page, context, options, _workflowDir, wor
1903
1923
  if (varName === "uuid") {
1904
1924
  return crypto2__default.default.randomUUID().split("-")[0];
1905
1925
  }
1926
+ if (varName === "randomUsername") {
1927
+ return generateRandomUsername();
1928
+ }
1906
1929
  return context.variables.get(varName) ?? match;
1907
1930
  });
1908
1931
  };
@@ -2344,6 +2367,7 @@ Starting workflow: ${workflow.name}`);
2344
2367
  if (!executionContext.variables.has(key)) {
2345
2368
  const interpolated = value.replace(/\{\{(\w+)\}\}/g, (match, varName) => {
2346
2369
  if (varName === "uuid") return crypto2__default.default.randomUUID().split("-")[0];
2370
+ if (varName === "randomUsername") return generateRandomUsername();
2347
2371
  return executionContext.variables.get(varName) ?? match;
2348
2372
  });
2349
2373
  executionContext.variables.set(key, interpolated);
@@ -2379,6 +2403,9 @@ Starting workflow: ${workflow.name}`);
2379
2403
  if (varName === "uuid") {
2380
2404
  return crypto2__default.default.randomUUID().split("-")[0];
2381
2405
  }
2406
+ if (varName === "randomUsername") {
2407
+ return generateRandomUsername();
2408
+ }
2382
2409
  return executionContext.variables.get(varName) ?? match;
2383
2410
  });
2384
2411
  executionContext.variables.set(key, interpolated);
@@ -2578,6 +2605,7 @@ async function runWorkflow(workflow, workflowFilePath, options = {}) {
2578
2605
  for (const [key, value] of Object.entries(workflow.variables)) {
2579
2606
  const interpolated = value.replace(/\{\{(\w+)\}\}/g, (match, varName) => {
2580
2607
  if (varName === "uuid") return crypto2__default.default.randomUUID().split("-")[0];
2608
+ if (varName === "randomUsername") return generateRandomUsername();
2581
2609
  return executionContext.variables.get(varName) ?? match;
2582
2610
  });
2583
2611
  executionContext.variables.set(key, interpolated);
@@ -2708,6 +2736,7 @@ exports.cleanupDiscoverSchema = cleanupDiscoverSchema;
2708
2736
  exports.collectMissingEnvVars = collectMissingEnvVars;
2709
2737
  exports.createAIProvider = createAIProvider;
2710
2738
  exports.createTestContext = createTestContext;
2739
+ exports.generateRandomUsername = generateRandomUsername;
2711
2740
  exports.isPipelineContent = isPipelineContent;
2712
2741
  exports.isPipelineFile = isPipelineFile;
2713
2742
  exports.isWorkflowContent = isWorkflowContent;
@@ -2728,5 +2757,5 @@ exports.runWorkflowWithContext = runWorkflowWithContext;
2728
2757
  exports.setupAppwriteTracking = setupAppwriteTracking;
2729
2758
  exports.startTrackingServer = startTrackingServer;
2730
2759
  exports.startWebServer = startWebServer;
2731
- //# sourceMappingURL=chunk-PL3IQXLK.cjs.map
2732
- //# sourceMappingURL=chunk-PL3IQXLK.cjs.map
2760
+ //# sourceMappingURL=chunk-LFCMPHWU.cjs.map
2761
+ //# sourceMappingURL=chunk-LFCMPHWU.cjs.map