@hasna/cloud 0.1.7 → 0.1.9

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.
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Parse a human-friendly interval string into minutes.
3
+ *
4
+ * Supported formats:
5
+ * - `5m`, `10m`, `30m` - minutes
6
+ * - `1h`, `2h` - hours (converted to minutes)
7
+ * - `5` - plain number treated as minutes
8
+ */
9
+ export declare function parseInterval(input: string): number;
10
+ /**
11
+ * Convert minutes to a cron expression.
12
+ *
13
+ * - For intervals that divide evenly into 60: `*\/<n> * * * *`
14
+ * - For hourly multiples: `0 *\/<h> * * *`
15
+ * - Otherwise: `*\/<n> * * * *` (best-effort)
16
+ */
17
+ export declare function minutesToCron(minutes: number): string;
18
+ export interface SyncScheduleStatus {
19
+ registered: boolean;
20
+ schedule_minutes: number;
21
+ cron_expression: string | null;
22
+ }
23
+ /**
24
+ * Register a Bun.cron job that runs the scheduled sync worker on a fixed
25
+ * interval.
26
+ *
27
+ * - Persists `schedule_minutes` in `~/.hasna/cloud/config.json`.
28
+ * - Calls `Bun.cron()` to register an OS-level cron job.
29
+ */
30
+ export declare function registerSyncSchedule(intervalMinutes: number): Promise<void>;
31
+ /**
32
+ * Remove the registered sync cron job.
33
+ *
34
+ * - Calls `Bun.cron.remove()` to unregister the OS-level job.
35
+ * - Sets `schedule_minutes` to 0 in config.
36
+ */
37
+ export declare function removeSyncSchedule(): Promise<void>;
38
+ /**
39
+ * Get the current sync schedule status from config.
40
+ */
41
+ export declare function getSyncScheduleStatus(): SyncScheduleStatus;
42
+ //# sourceMappingURL=sync-schedule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync-schedule.d.ts","sourceRoot":"","sources":["../src/sync-schedule.ts"],"names":[],"mappings":"AAkCA;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAiCnD;AAED;;;;;;GAMG;AACH,w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AAM,EAAE,CAAC;IACjB,kCAAkC;IAClC,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAClC,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uEAAuE;IACvE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAChC;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAMD;;;GAGG;AACH,wBAAsB,QAAQ,CAC5B,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,UAAU,EAAE,CAAC,CAGvB;AAMD;;;GAGG;AACH,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,UAAU,EAAE,CAAC,CAGvB;AA8iBD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,SAAS,GAAG,MAAM,EAAE,CAKxD;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAKxE"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hasna/cloud",
3
- "version": "0.1.7",
4
- "description": "Shared cloud infrastructure \u2014 database adapter (SQLite + PostgreSQL), sync engine, feedback system, unified dotfile config",
3
+ "version": "0.1.9",
4
+ "description": "Shared cloud infrastructure database adapter (SQLite + PostgreSQL), sync engine, feedback system, unified dotfile config",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
@@ -21,11 +21,11 @@
21
21
  "LICENSE"
22
22
  ],
23
23
  "scripts": {
24
- "build": "bun build src/index.ts --outdir dist --target node && bun build src/cli/index.ts --outdir dist/cli --target node && bun build src/mcp/index.ts --outdir dist/mcp --target node && bun run build:types",
24
+ "build": "bun build src/index.ts --outdir dist --target node && bun build src/cli/index.ts --outdir dist/cli --target node && bun build src/mcp/index.ts --outdir dist/mcp --target node && bun build src/scheduled-sync.ts --outdir dist --target node && bun run build:types",
25
25
  "build:types": "tsc --emitDeclarationOnly --declaration --outDir dist",
26
26
  "test": "bun test",
27
27
  "prepublishOnly": "bun run build",
28
- "postinstall": "mkdir -p $HOME/.hasna/cloud 2>/dev/null || true; test -f $HOME/.hasna/cloud/config.json || printf '{\"rds\":{\"host\":\"hasnaxyz-prod-opensource.c4limg0qgqvk.us-east-1.rds.amazonaws.com\",\"port\":5432,\"username\":\"\",\"password_env\":\"HASNA_RDS_PASSWORD\",\"ssl\":true},\"mode\":\"local\",\"feedback_endpoint\":\"https://feedback.hasna.com/api/v1/feedback\",\"auto_sync_interval_minutes\":0}\\n' > $HOME/.hasna/cloud/config.json 2>/dev/null || true"
28
+ "postinstall": "mkdir -p $HOME/.hasna/cloud 2>/dev/null || true; test -f $HOME/.hasna/cloud/config.json || printf '{\"rds\":{\"host\":\"hasnaxyz-prod-opensource.c4limg0qgqvk.us-east-1.rds.amazonaws.com\",\"port\":5432,\"username\":\"\",\"password_env\":\"HASNA_RDS_PASSWORD\",\"ssl\":true},\"mode\":\"local\",\"feedback_endpoint\":\"https://feedback.hasna.com/api/v1/feedback\",\"auto_sync_interval_minutes\":0,\"sync\":{\"schedule_minutes\":0}}\\n' > $HOME/.hasna/cloud/config.json 2>/dev/null || true"
29
29
  },
30
30
  "publishConfig": {
31
31
  "registry": "https://registry.npmjs.org",
@@ -42,4 +42,4 @@
42
42
  "@types/pg": "^8.11.11",
43
43
  "typescript": "^5.7.3"
44
44
  }
45
- }
45
+ }