yamchart 0.3.4 → 0.3.5

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.
@@ -6,7 +6,7 @@ import {
6
6
  ScheduleSchema,
7
7
  loadEnvFile,
8
8
  validateProject
9
- } from "./chunk-A24KVXJQ.js";
9
+ } from "./chunk-5WGSK46G.js";
10
10
  import {
11
11
  AuthDatabase,
12
12
  generateSessionToken,
@@ -37,7 +37,7 @@ import {
37
37
  resolveMySQLAuth,
38
38
  resolvePostgresAuth,
39
39
  resolveSnowflakeAuth
40
- } from "./chunk-LL3VKMZM.js";
40
+ } from "./chunk-ETDBPE2A.js";
41
41
  import "./chunk-DGUM43GV.js";
42
42
 
43
43
  // src/commands/dev.ts
@@ -1107,15 +1107,31 @@ import { simpleGit } from "simple-git";
1107
1107
  var GitService = class {
1108
1108
  git;
1109
1109
  projectDir;
1110
+ gitAvailable = null;
1110
1111
  constructor(projectDir) {
1111
1112
  this.projectDir = projectDir;
1112
1113
  this.git = simpleGit(projectDir);
1113
1114
  }
1115
+ async isGitRepo() {
1116
+ if (this.gitAvailable !== null)
1117
+ return this.gitAvailable;
1118
+ try {
1119
+ await this.git.revparse(["--git-dir"]);
1120
+ this.gitAvailable = true;
1121
+ } catch {
1122
+ this.gitAvailable = false;
1123
+ }
1124
+ return this.gitAvailable;
1125
+ }
1114
1126
  async getBranches() {
1127
+ if (!await this.isGitRepo())
1128
+ return [];
1115
1129
  const result = await this.git.branchLocal();
1116
1130
  return result.all;
1117
1131
  }
1118
1132
  async getBranchesWithCurrent() {
1133
+ if (!await this.isGitRepo())
1134
+ return { current: "", branches: [] };
1119
1135
  const result = await this.git.branchLocal();
1120
1136
  return {
1121
1137
  current: result.current,
@@ -1123,10 +1139,15 @@ var GitService = class {
1123
1139
  };
1124
1140
  }
1125
1141
  async getCurrentBranch() {
1142
+ if (!await this.isGitRepo())
1143
+ return "";
1126
1144
  const result = await this.git.branchLocal();
1127
1145
  return result.current;
1128
1146
  }
1129
1147
  async createBranch(name, from) {
1148
+ if (!await this.isGitRepo()) {
1149
+ throw new Error('Not a git repository. Run "git init" to enable branch management.');
1150
+ }
1130
1151
  if (from) {
1131
1152
  await this.git.checkoutBranch(name, from);
1132
1153
  } else {
@@ -1134,9 +1155,15 @@ var GitService = class {
1134
1155
  }
1135
1156
  }
1136
1157
  async checkout(branch) {
1158
+ if (!await this.isGitRepo()) {
1159
+ throw new Error('Not a git repository. Run "git init" to enable branch management.');
1160
+ }
1137
1161
  await this.git.checkout(branch);
1138
1162
  }
1139
1163
  async commitAndPush(message) {
1164
+ if (!await this.isGitRepo()) {
1165
+ return { success: false, error: "Not a git repository" };
1166
+ }
1140
1167
  try {
1141
1168
  const status = await this.git.status();
1142
1169
  if (status.files.length === 0) {
@@ -1161,10 +1188,14 @@ var GitService = class {
1161
1188
  }
1162
1189
  }
1163
1190
  async hasUncommittedChanges() {
1191
+ if (!await this.isGitRepo())
1192
+ return false;
1164
1193
  const status = await this.git.status();
1165
1194
  return status.files.length > 0;
1166
1195
  }
1167
1196
  async pull() {
1197
+ if (!await this.isGitRepo())
1198
+ return;
1168
1199
  await this.git.pull();
1169
1200
  }
1170
1201
  };
@@ -8650,7 +8681,7 @@ var GoTrueAdminApi = class {
8650
8681
  });
8651
8682
  if (response.error)
8652
8683
  throw response.error;
8653
- const clients = await response.json();
8684
+ const clients2 = await response.json();
8654
8685
  const total = (_e = response.headers.get("x-total-count")) !== null && _e !== void 0 ? _e : 0;
8655
8686
  const links = (_g = (_f = response.headers.get("link")) === null || _f === void 0 ? void 0 : _f.split(",")) !== null && _g !== void 0 ? _g : [];
8656
8687
  if (links.length > 0) {
@@ -8661,7 +8692,7 @@ var GoTrueAdminApi = class {
8661
8692
  });
8662
8693
  pagination.total = parseInt(total);
8663
8694
  }
8664
- return { data: Object.assign(Object.assign({}, clients), pagination), error: null };
8695
+ return { data: Object.assign(Object.assign({}, clients2), pagination), error: null };
8665
8696
  } catch (error2) {
8666
8697
  if (isAuthError(error2)) {
8667
8698
  return { data: { clients: [] }, error: error2 };
@@ -13221,6 +13252,38 @@ async function publicRoutes(fastify, options) {
13221
13252
  });
13222
13253
  }
13223
13254
 
13255
+ // ../server/dist/routes/events.js
13256
+ var clients = /* @__PURE__ */ new Set();
13257
+ async function eventsRoute(fastify) {
13258
+ fastify.get("/api/events", (request, reply) => {
13259
+ const raw = reply.raw;
13260
+ raw.writeHead(200, {
13261
+ "Content-Type": "text/event-stream",
13262
+ "Cache-Control": "no-cache",
13263
+ "Connection": "keep-alive"
13264
+ });
13265
+ raw.write(":\n\n");
13266
+ clients.add(raw);
13267
+ const keepalive = setInterval(() => {
13268
+ raw.write(":\n\n");
13269
+ }, 3e4);
13270
+ request.raw.on("close", () => {
13271
+ clearInterval(keepalive);
13272
+ clients.delete(raw);
13273
+ });
13274
+ });
13275
+ }
13276
+ function broadcastConfigChange() {
13277
+ const data = JSON.stringify({ type: "config-change", timestamp: Date.now() });
13278
+ const message = `event: config-change
13279
+ data: ${data}
13280
+
13281
+ `;
13282
+ for (const client of clients) {
13283
+ client.write(message);
13284
+ }
13285
+ }
13286
+
13224
13287
  // ../server/dist/server.js
13225
13288
  import { join as join4, dirname } from "path";
13226
13289
  import { fileURLToPath } from "url";
@@ -13424,6 +13487,7 @@ async function createServer(options) {
13424
13487
  return { models: models2, refs: refs2 };
13425
13488
  }
13426
13489
  if (watch2) {
13490
+ await fastify.register(eventsRoute);
13427
13491
  configLoader.startWatching();
13428
13492
  configLoader.onChange(() => {
13429
13493
  fastify.log.info("Config reloaded");
@@ -13435,6 +13499,7 @@ async function createServer(options) {
13435
13499
  if (newSchedules.length > 0) {
13436
13500
  schedulerService.start(newSchedules);
13437
13501
  }
13502
+ broadcastConfigChange();
13438
13503
  });
13439
13504
  }
13440
13505
  return {
@@ -13554,4 +13619,4 @@ async function runDevServer(projectDir, options) {
13554
13619
  export {
13555
13620
  runDevServer
13556
13621
  };
13557
- //# sourceMappingURL=dev-PTVNJI7G.js.map
13622
+ //# sourceMappingURL=dev-YY7NMNI6.js.map