nx 19.8.0-canary.20240912-b6140d4 → 19.8.0-canary.20240913-5bbaffb

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. package/package.json +12 -12
  2. package/src/command-line/add/add.js +2 -2
  3. package/src/command-line/affected/command-object.js +6 -6
  4. package/src/command-line/deprecated/command-objects.js +3 -3
  5. package/src/command-line/generate/generate.js +2 -1
  6. package/src/command-line/generate/generator-utils.d.ts +2 -1
  7. package/src/command-line/import/command-object.js +3 -3
  8. package/src/command-line/login/login.js +2 -2
  9. package/src/command-line/logout/logout.js +2 -2
  10. package/src/command-line/migrate/migrate.js +2 -2
  11. package/src/command-line/new/new.js +2 -1
  12. package/src/command-line/release/changelog.js +2 -2
  13. package/src/command-line/release/plan-check.js +2 -2
  14. package/src/command-line/release/plan.js +2 -2
  15. package/src/command-line/release/publish.js +2 -2
  16. package/src/command-line/release/release.js +2 -2
  17. package/src/command-line/release/version.js +2 -1
  18. package/src/command-line/repair/repair.js +2 -2
  19. package/src/command-line/run/command-object.js +3 -3
  20. package/src/command-line/run/run.js +3 -2
  21. package/src/command-line/run-many/command-object.js +2 -2
  22. package/src/command-line/show/command-object.js +3 -3
  23. package/src/command-line/sync/command-object.js +2 -2
  24. package/src/command-line/sync/sync.js +2 -2
  25. package/src/daemon/client/client.d.ts +2 -1
  26. package/src/daemon/client/client.js +7 -0
  27. package/src/daemon/message-types/task-history.d.ts +9 -3
  28. package/src/daemon/message-types/task-history.js +10 -2
  29. package/src/daemon/server/handle-task-history.d.ts +5 -1
  30. package/src/daemon/server/handle-task-history.js +11 -9
  31. package/src/daemon/server/server.js +5 -2
  32. package/src/native/index.d.ts +1 -0
  33. package/src/native/nx.wasi.cjs +20 -20
  34. package/src/native/nx.wasm32-wasi.wasm +0 -0
  35. package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +0 -1
  36. package/src/nx-cloud/utilities/get-cloud-options.d.ts +1 -0
  37. package/src/nx-cloud/utilities/get-cloud-options.js +4 -0
  38. package/src/nx-cloud/utilities/is-workspace-claimed.d.ts +1 -1
  39. package/src/nx-cloud/utilities/is-workspace-claimed.js +6 -5
  40. package/src/nx-cloud/utilities/onboarding.js +2 -2
  41. package/src/plugins/js/utils/register.js +7 -0
  42. package/src/project-graph/error-types.d.ts +1 -1
  43. package/src/project-graph/error-types.js +19 -5
  44. package/src/tasks-runner/life-cycles/task-history-life-cycle.js +1 -1
  45. package/src/tasks-runner/run-command.js +2 -2
  46. package/src/tasks-runner/task-orchestrator.js +4 -1
  47. package/src/tasks-runner/tasks-schedule.d.ts +3 -0
  48. package/src/tasks-runner/tasks-schedule.js +22 -4
  49. package/src/utils/handle-errors.d.ts +1 -0
  50. package/src/utils/handle-errors.js +71 -0
  51. package/src/utils/nx-cloud-utils.d.ts +0 -1
  52. package/src/utils/nx-cloud-utils.js +0 -10
  53. package/src/utils/params.d.ts +0 -1
  54. package/src/utils/params.js +0 -50
  55. package/src/utils/plugins/plugin-capabilities.js +4 -1
  56. package/src/utils/task-history.d.ts +12 -1
  57. package/src/utils/task-history.js +23 -0
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TaskHistory = void 0;
4
+ exports.getTaskHistory = getTaskHistory;
4
5
  const client_1 = require("../daemon/client/client");
5
6
  const is_on_daemon_1 = require("../daemon/is-on-daemon");
6
7
  const native_1 = require("../native");
@@ -9,6 +10,17 @@ class TaskHistory {
9
10
  constructor() {
10
11
  this.taskHistory = new native_1.NxTaskHistory((0, db_connection_1.getDbConnection)());
11
12
  }
13
+ /**
14
+ * This function returns estimated timings per task
15
+ * @param targets
16
+ * @returns a map where key is task id (project:target:configuration), value is average time of historical runs
17
+ */
18
+ async getEstimatedTaskTimings(targets) {
19
+ if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
20
+ return this.taskHistory.getEstimatedTaskTimings(targets);
21
+ }
22
+ return await client_1.daemonClient.getEstimatedTaskTimings(targets);
23
+ }
12
24
  async getFlakyTasks(hashes) {
13
25
  if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
14
26
  return this.taskHistory.getFlakyTasks(hashes);
@@ -23,3 +35,14 @@ class TaskHistory {
23
35
  }
24
36
  }
25
37
  exports.TaskHistory = TaskHistory;
38
+ let taskHistory;
39
+ /**
40
+ * This function returns the singleton instance of TaskHistory
41
+ * @returns singleton instance of TaskHistory
42
+ */
43
+ function getTaskHistory() {
44
+ if (!taskHistory) {
45
+ taskHistory = new TaskHistory();
46
+ }
47
+ return taskHistory;
48
+ }