habits 0.1.6 → 0.1.23

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.
package/app/main.cjs CHANGED
@@ -144927,7 +144927,7 @@ ${lanes.join("\n")}
144927
144927
  }
144928
144928
  }
144929
144929
  function createImportCallExpressionAMD(arg, containsLexicalThis) {
144930
- const resolve6 = factory22.createUniqueName("resolve");
144930
+ const resolve7 = factory22.createUniqueName("resolve");
144931
144931
  const reject = factory22.createUniqueName("reject");
144932
144932
  const parameters = [
144933
144933
  factory22.createParameterDeclaration(
@@ -144936,7 +144936,7 @@ ${lanes.join("\n")}
144936
144936
  /*dotDotDotToken*/
144937
144937
  void 0,
144938
144938
  /*name*/
144939
- resolve6
144939
+ resolve7
144940
144940
  ),
144941
144941
  factory22.createParameterDeclaration(
144942
144942
  /*modifiers*/
@@ -144953,7 +144953,7 @@ ${lanes.join("\n")}
144953
144953
  factory22.createIdentifier("require"),
144954
144954
  /*typeArguments*/
144955
144955
  void 0,
144956
- [factory22.createArrayLiteralExpression([arg || factory22.createOmittedExpression()]), resolve6, reject]
144956
+ [factory22.createArrayLiteralExpression([arg || factory22.createOmittedExpression()]), resolve7, reject]
144957
144957
  )
144958
144958
  )
144959
144959
  ]);
@@ -231671,8 +231671,8 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
231671
231671
  installPackage(options) {
231672
231672
  this.packageInstallId++;
231673
231673
  const request = { kind: "installPackage", ...options, id: this.packageInstallId };
231674
- const promise = new Promise((resolve6, reject) => {
231675
- (this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve: resolve6, reject });
231674
+ const promise = new Promise((resolve7, reject) => {
231675
+ (this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve: resolve7, reject });
231676
231676
  });
231677
231677
  this.installer.send(request);
231678
231678
  return promise;
@@ -233950,10 +233950,10 @@ utils_default.inherits(CanceledError, AxiosError_default, {
233950
233950
  var CanceledError_default = CanceledError;
233951
233951
 
233952
233952
  // node_modules/.pnpm/axios@1.13.2/node_modules/axios/lib/core/settle.js
233953
- function settle(resolve6, reject, response) {
233953
+ function settle(resolve7, reject, response) {
233954
233954
  const validateStatus2 = response.config.validateStatus;
233955
233955
  if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
233956
- resolve6(response);
233956
+ resolve7(response);
233957
233957
  } else {
233958
233958
  reject(new AxiosError_default(
233959
233959
  "Request failed with status code " + response.status,
@@ -234576,7 +234576,7 @@ function setProxy(options, configProxy, location) {
234576
234576
  }
234577
234577
  var isHttpAdapterSupported = typeof process !== "undefined" && utils_default.kindOf(process) === "process";
234578
234578
  var wrapAsync = (asyncExecutor) => {
234579
- return new Promise((resolve6, reject) => {
234579
+ return new Promise((resolve7, reject) => {
234580
234580
  let onDone;
234581
234581
  let isDone;
234582
234582
  const done = (value, isRejected) => {
@@ -234586,7 +234586,7 @@ var wrapAsync = (asyncExecutor) => {
234586
234586
  };
234587
234587
  const _resolve = (value) => {
234588
234588
  done(value);
234589
- resolve6(value);
234589
+ resolve7(value);
234590
234590
  };
234591
234591
  const _reject = (reason) => {
234592
234592
  done(reason, true);
@@ -234638,7 +234638,7 @@ var http2Transport = {
234638
234638
  }
234639
234639
  };
234640
234640
  var http_default = isHttpAdapterSupported && function httpAdapter(config) {
234641
- return wrapAsync(async function dispatchHttpRequest(resolve6, reject, onDone) {
234641
+ return wrapAsync(async function dispatchHttpRequest(resolve7, reject, onDone) {
234642
234642
  let { data, lookup, family, httpVersion = 1, http2Options } = config;
234643
234643
  const { responseType, responseEncoding } = config;
234644
234644
  const method = config.method.toUpperCase();
@@ -234723,7 +234723,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
234723
234723
  }
234724
234724
  let convertedData;
234725
234725
  if (method !== "GET") {
234726
- return settle(resolve6, reject, {
234726
+ return settle(resolve7, reject, {
234727
234727
  status: 405,
234728
234728
  statusText: "method not allowed",
234729
234729
  headers: {},
@@ -234745,7 +234745,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
234745
234745
  } else if (responseType === "stream") {
234746
234746
  convertedData = import_stream4.default.Readable.from(convertedData);
234747
234747
  }
234748
- return settle(resolve6, reject, {
234748
+ return settle(resolve7, reject, {
234749
234749
  data: convertedData,
234750
234750
  status: 200,
234751
234751
  statusText: "OK",
@@ -234964,7 +234964,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
234964
234964
  };
234965
234965
  if (responseType === "stream") {
234966
234966
  response.data = responseStream;
234967
- settle(resolve6, reject, response);
234967
+ settle(resolve7, reject, response);
234968
234968
  } else {
234969
234969
  const responseBuffer = [];
234970
234970
  let totalResponseBytes = 0;
@@ -235012,7 +235012,7 @@ var http_default = isHttpAdapterSupported && function httpAdapter(config) {
235012
235012
  } catch (err) {
235013
235013
  return reject(AxiosError_default.from(err, null, config, response.request, response));
235014
235014
  }
235015
- settle(resolve6, reject, response);
235015
+ settle(resolve7, reject, response);
235016
235016
  });
235017
235017
  }
235018
235018
  abortEmitter.once("abort", (err) => {
@@ -235261,7 +235261,7 @@ var resolveConfig_default = (config) => {
235261
235261
  // node_modules/.pnpm/axios@1.13.2/node_modules/axios/lib/adapters/xhr.js
235262
235262
  var isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
235263
235263
  var xhr_default = isXHRAdapterSupported && function(config) {
235264
- return new Promise(function dispatchXhrRequest(resolve6, reject) {
235264
+ return new Promise(function dispatchXhrRequest(resolve7, reject) {
235265
235265
  const _config = resolveConfig_default(config);
235266
235266
  let requestData = _config.data;
235267
235267
  const requestHeaders = AxiosHeaders_default.from(_config.headers).normalize();
@@ -235295,7 +235295,7 @@ var xhr_default = isXHRAdapterSupported && function(config) {
235295
235295
  request
235296
235296
  };
235297
235297
  settle(function _resolve(value) {
235298
- resolve6(value);
235298
+ resolve7(value);
235299
235299
  done();
235300
235300
  }, function _reject(err) {
235301
235301
  reject(err);
@@ -235666,8 +235666,8 @@ var factory = (env) => {
235666
235666
  responseType = responseType || "text";
235667
235667
  let responseData = await resolvers[utils_default.findKey(resolvers, responseType) || "text"](response, config);
235668
235668
  !isStreamResponse && unsubscribe && unsubscribe();
235669
- return await new Promise((resolve6, reject) => {
235670
- settle(resolve6, reject, {
235669
+ return await new Promise((resolve7, reject) => {
235670
+ settle(resolve7, reject, {
235671
235671
  data: responseData,
235672
235672
  headers: AxiosHeaders_default.from(response.headers),
235673
235673
  status: response.status,
@@ -236063,8 +236063,8 @@ var CancelToken = class _CancelToken {
236063
236063
  throw new TypeError("executor must be a function.");
236064
236064
  }
236065
236065
  let resolvePromise;
236066
- this.promise = new Promise(function promiseExecutor(resolve6) {
236067
- resolvePromise = resolve6;
236066
+ this.promise = new Promise(function promiseExecutor(resolve7) {
236067
+ resolvePromise = resolve7;
236068
236068
  });
236069
236069
  const token = this;
236070
236070
  this.promise.then((cancel) => {
@@ -236077,9 +236077,9 @@ var CancelToken = class _CancelToken {
236077
236077
  });
236078
236078
  this.promise.then = (onfulfilled) => {
236079
236079
  let _resolve;
236080
- const promise = new Promise((resolve6) => {
236081
- token.subscribe(resolve6);
236082
- _resolve = resolve6;
236080
+ const promise = new Promise((resolve7) => {
236081
+ token.subscribe(resolve7);
236082
+ _resolve = resolve7;
236083
236083
  }).then(onfulfilled);
236084
236084
  promise.cancel = function reject() {
236085
236085
  token.unsubscribe(_resolve);
@@ -236805,13 +236805,13 @@ function createExecutionContext(node, params, options) {
236805
236805
  },
236806
236806
  // Create deferred promise
236807
236807
  createDeferredPromise: () => {
236808
- let resolve6;
236808
+ let resolve7;
236809
236809
  let reject;
236810
236810
  const promise = new Promise((res, rej) => {
236811
- resolve6 = res;
236811
+ resolve7 = res;
236812
236812
  reject = rej;
236813
236813
  });
236814
- return { promise, resolve: resolve6, reject };
236814
+ return { promise, resolve: resolve7, reject };
236815
236815
  }
236816
236816
  },
236817
236817
  // Node helpers
@@ -237962,7 +237962,7 @@ if __name__ == "__main__":
237962
237962
  sys.exit(1)
237963
237963
  `;
237964
237964
  fs6.writeFileSync(scriptPath, wrappedCode);
237965
- return new Promise((resolve6, reject) => {
237965
+ return new Promise((resolve7, reject) => {
237966
237966
  const pythonCmd = process.platform === "win32" ? "python" : "python3";
237967
237967
  const proc = (0, import_child_process3.spawn)(pythonCmd, [scriptPath], {
237968
237968
  env: { ...process.env },
@@ -237990,12 +237990,12 @@ if __name__ == "__main__":
237990
237990
  const lastLine = lines[lines.length - 1];
237991
237991
  const result = JSON.parse(lastLine);
237992
237992
  if (result.success) {
237993
- resolve6(result.result);
237993
+ resolve7(result.result);
237994
237994
  } else {
237995
237995
  reject(new Error(result.error));
237996
237996
  }
237997
237997
  } catch (parseError) {
237998
- resolve6(stdout.trim());
237998
+ resolve7(stdout.trim());
237999
237999
  }
238000
238000
  });
238001
238001
  proc.on("error", (error) => {
@@ -238041,7 +238041,7 @@ func main() {
238041
238041
  }
238042
238042
  `;
238043
238043
  fs6.writeFileSync(scriptPath, wrappedCode);
238044
- return new Promise((resolve6, reject) => {
238044
+ return new Promise((resolve7, reject) => {
238045
238045
  try {
238046
238046
  (0, import_child_process3.execSync)(`go build -o main`, { cwd: scriptDir, stdio: "pipe" });
238047
238047
  const proc = (0, import_child_process3.spawn)("./main", [], {
@@ -238070,12 +238070,12 @@ func main() {
238070
238070
  const lastLine = lines[lines.length - 1];
238071
238071
  const result = JSON.parse(lastLine);
238072
238072
  if (result.success) {
238073
- resolve6(result.result);
238073
+ resolve7(result.result);
238074
238074
  } else {
238075
238075
  reject(new Error(result.error));
238076
238076
  }
238077
238077
  } catch {
238078
- resolve6(stdout.trim());
238078
+ resolve7(stdout.trim());
238079
238079
  }
238080
238080
  });
238081
238081
  proc.on("error", (error) => {
@@ -238115,7 +238115,7 @@ export PREVIOUS_RESULT='${JSON.stringify(context.previous_result)}'
238115
238115
  ${code}
238116
238116
  `;
238117
238117
  fs6.writeFileSync(scriptPath, wrappedCode, { mode: 493 });
238118
- return new Promise((resolve6, reject) => {
238118
+ return new Promise((resolve7, reject) => {
238119
238119
  const proc = (0, import_child_process3.spawn)("bash", [scriptPath], {
238120
238120
  env: { ...process.env },
238121
238121
  cwd: tmpDir
@@ -238138,9 +238138,9 @@ ${code}
238138
238138
  return;
238139
238139
  }
238140
238140
  try {
238141
- resolve6(JSON.parse(stdout.trim()));
238141
+ resolve7(JSON.parse(stdout.trim()));
238142
238142
  } catch {
238143
- resolve6(stdout.trim());
238143
+ resolve7(stdout.trim());
238144
238144
  }
238145
238145
  });
238146
238146
  proc.on("error", (error) => {
@@ -238409,7 +238409,7 @@ var WebhookTriggerServer = class {
238409
238409
  */
238410
238410
  waitForWebhook(nodeId, timeout = 3e5, workflowId) {
238411
238411
  const webhookKey = workflowId ? `${workflowId}:${nodeId}` : nodeId;
238412
- return new Promise((resolve6, reject) => {
238412
+ return new Promise((resolve7, reject) => {
238413
238413
  this.logger.log(`\u{1F514} Registering webhook listener for: ${webhookKey}`);
238414
238414
  const timeoutId = setTimeout(() => {
238415
238415
  this.pendingWebhooks.delete(webhookKey);
@@ -238418,7 +238418,7 @@ var WebhookTriggerServer = class {
238418
238418
  this.pendingWebhooks.set(webhookKey, {
238419
238419
  resolve: (payload) => {
238420
238420
  clearTimeout(timeoutId);
238421
- resolve6(payload);
238421
+ resolve7(payload);
238422
238422
  },
238423
238423
  reject: (error) => {
238424
238424
  clearTimeout(timeoutId);
@@ -238439,13 +238439,13 @@ var WebhookTriggerServer = class {
238439
238439
  }
238440
238440
  }
238441
238441
  async start(options) {
238442
- return new Promise((resolve6, reject) => {
238442
+ return new Promise((resolve7, reject) => {
238443
238443
  try {
238444
238444
  this.server = this.app.listen(options.port, options.host, () => {
238445
238445
  const url2 = `http://${options.host === "0.0.0.0" ? "localhost" : options.host}:${options.port}`;
238446
238446
  this.logger.log(`
238447
238447
  \u{1F310} Webhook Trigger Server started on ${url2}`);
238448
- resolve6(url2);
238448
+ resolve7(url2);
238449
238449
  });
238450
238450
  } catch (error) {
238451
238451
  reject(error);
@@ -238457,14 +238457,14 @@ var WebhookTriggerServer = class {
238457
238457
  pending.reject(new Error("Server shutting down"));
238458
238458
  }
238459
238459
  this.pendingWebhooks.clear();
238460
- return new Promise((resolve6) => {
238460
+ return new Promise((resolve7) => {
238461
238461
  if (this.server) {
238462
238462
  this.server.close(() => {
238463
238463
  this.logger.log("\u{1F6D1} Webhook Trigger Server stopped");
238464
- resolve6();
238464
+ resolve7();
238465
238465
  });
238466
238466
  } else {
238467
- resolve6();
238467
+ resolve7();
238468
238468
  }
238469
238469
  });
238470
238470
  }
@@ -238957,7 +238957,7 @@ var WorkflowExecutor = class {
238957
238957
  }
238958
238958
  });
238959
238959
  await Promise.all(nodeExecutionPromises);
238960
- await new Promise((resolve6) => setTimeout(resolve6, 1e3));
238960
+ await new Promise((resolve7) => setTimeout(resolve7, 1e3));
238961
238961
  }
238962
238962
  if (this.webhookServer) {
238963
238963
  await this.stopWebhookServer();
@@ -241880,10 +241880,9 @@ var WorkflowExecutorServer = class {
241880
241880
  if (fs10.existsSync(frontendPath)) {
241881
241881
  console.log(`\u{1F310} Serving frontend from: ${frontendPath}`);
241882
241882
  this.app.use(import_express3.default.static(frontendPath));
241883
- this.app.get("{*splat}", (req, res) => {
241884
- if (req.path.startsWith("/api") || req.path.startsWith("/webhook") || req.path === "/health") {
241885
- console.log(`\u26A0\uFE0F Path not found: ${req.method} ${req.path}`);
241886
- return res.status(404).json({ error: "Not found" });
241883
+ this.app.get("{*splat}", (req, res, next) => {
241884
+ if (req.path.startsWith("/api") || req.path.startsWith("/webhook") || req.path === "/health" || req.path.startsWith("/habits")) {
241885
+ return next();
241887
241886
  }
241888
241887
  const indexPath = path15.join(frontendPath, "index.html");
241889
241888
  if (fs10.existsSync(indexPath)) {
@@ -241917,7 +241916,7 @@ Health: /health`);
241917
241916
  */
241918
241917
  waitForWebhook(nodeId, timeout = 3e5, workflowId) {
241919
241918
  const webhookKey = workflowId ? `${workflowId}:${nodeId}` : nodeId;
241920
- return new Promise((resolve6, reject) => {
241919
+ return new Promise((resolve7, reject) => {
241921
241920
  console.log(`\u{1F514} Registering webhook listener for: ${webhookKey}`);
241922
241921
  const timeoutId = setTimeout(() => {
241923
241922
  this.pendingWebhooks.delete(webhookKey);
@@ -241926,7 +241925,7 @@ Health: /health`);
241926
241925
  this.pendingWebhooks.set(webhookKey, {
241927
241926
  resolve: (payload) => {
241928
241927
  clearTimeout(timeoutId);
241929
- resolve6(payload);
241928
+ resolve7(payload);
241930
241929
  },
241931
241930
  reject: (error) => {
241932
241931
  clearTimeout(timeoutId);
@@ -241948,7 +241947,7 @@ Health: /health`);
241948
241947
  }
241949
241948
  async start(port = 3e3, host = "0.0.0.0") {
241950
241949
  this.setupRoutes();
241951
- return new Promise((resolve6, reject) => {
241950
+ return new Promise((resolve7, reject) => {
241952
241951
  try {
241953
241952
  this.server = this.app.listen(port, host, () => {
241954
241953
  const config = this.executor.getConfig();
@@ -241982,7 +241981,7 @@ Health: /health`);
241982
241981
  console.log(` - ${w.reference.id}: ${w.workflow.name}`);
241983
241982
  }
241984
241983
  }
241985
- resolve6();
241984
+ resolve7();
241986
241985
  });
241987
241986
  this.server.on("error", (error) => {
241988
241987
  if (error.code === "EADDRINUSE") {
@@ -242007,14 +242006,14 @@ Health: /health`);
242007
242006
  pending.reject(new Error("Server shutting down"));
242008
242007
  }
242009
242008
  this.pendingWebhooks.clear();
242010
- return new Promise((resolve6) => {
242009
+ return new Promise((resolve7) => {
242011
242010
  if (this.server) {
242012
242011
  this.server.close(() => {
242013
242012
  console.log("\u{1F6D1} Workflow Executor Server stopped");
242014
- resolve6();
242013
+ resolve7();
242015
242014
  });
242016
242015
  } else {
242017
- resolve6();
242016
+ resolve7();
242018
242017
  }
242019
242018
  });
242020
242019
  }
@@ -242134,6 +242133,10 @@ async function startBaseServer(options) {
242134
242133
  process.env.PORT = String(options.port);
242135
242134
  }
242136
242135
  const baseServerDir = path16.dirname(baseServerPath);
242136
+ const examplesPath = path16.resolve(baseServerDir, "../examples");
242137
+ if (fs11.existsSync(examplesPath)) {
242138
+ process.env.HABITS_TEMPLATES_PATH = examplesPath;
242139
+ }
242137
242140
  customRequire(baseServerPath, baseServerDir);
242138
242141
  const port = options.port || 3e3;
242139
242142
  console.log(`