@hasna/configs-sdk 0.1.0 → 0.1.2

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.
Files changed (2) hide show
  1. package/dist/index.js +24 -0
  2. package/package.json +21 -18
package/dist/index.js CHANGED
@@ -58,15 +58,39 @@ class ConfigsClient {
58
58
  async getProfile(idOrSlug) {
59
59
  return this.req("GET", `/api/profiles/${idOrSlug}`);
60
60
  }
61
+ async createProfile(name, description) {
62
+ return this.req("POST", "/api/profiles", { name, description });
63
+ }
64
+ async updateProfile(idOrSlug, input) {
65
+ return this.req("PUT", `/api/profiles/${idOrSlug}`, input);
66
+ }
67
+ async deleteProfile(idOrSlug) {
68
+ await this.req("DELETE", `/api/profiles/${idOrSlug}`);
69
+ }
61
70
  async applyProfile(idOrSlug, dryRun = false) {
62
71
  return this.req("POST", `/api/profiles/${idOrSlug}/apply`, { dry_run: dryRun });
63
72
  }
64
73
  async listMachines() {
65
74
  return this.req("GET", "/api/machines");
66
75
  }
76
+ async registerMachine(hostname, os) {
77
+ return this.req("POST", "/api/machines", { hostname, os });
78
+ }
67
79
  async getStats() {
68
80
  return this.req("GET", "/api/stats");
69
81
  }
82
+ async getStatus() {
83
+ return this.req("GET", "/api/status");
84
+ }
85
+ async syncKnown(opts) {
86
+ return this.req("POST", "/api/sync-known", opts);
87
+ }
88
+ async createSnapshot(configId) {
89
+ return this.req("POST", `/api/configs/${configId}/snapshot`);
90
+ }
91
+ async getSnapshots(configId) {
92
+ return this.req("GET", `/api/configs/${configId}/snapshots`);
93
+ }
70
94
  async health() {
71
95
  return this.req("GET", "/health");
72
96
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/configs-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Zero-dependency TypeScript client for @hasna/configs REST API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -11,22 +11,25 @@
11
11
  "import": "./dist/index.js"
12
12
  }
13
13
  },
14
- "files": ["dist", "README.md"],
14
+ "files": [
15
+ "dist",
16
+ "README.md"
17
+ ],
15
18
  "publishConfig": {
16
- "access": "public"
17
- },
18
- "repository": {
19
- "type": "git",
20
- "url": "https://github.com/hasna/open-configs.git"
21
- },
22
- "author": "Andrei Hasna <andrei@hasna.com>",
23
- "license": "Apache-2.0",
24
- "devDependencies": {
25
- "typescript": "^5.7.3",
26
- "@types/bun": "^1.2.4"
27
- },
28
- "scripts": {
29
- "build": "bun build src/index.ts --outdir dist --target browser && tsc --emitDeclarationOnly --outDir dist",
30
- "typecheck": "tsc --noEmit"
31
- }
19
+ "access": "public"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/hasna/open-configs.git"
24
+ },
25
+ "author": "Andrei Hasna <andrei@hasna.com>",
26
+ "license": "Apache-2.0",
27
+ "devDependencies": {
28
+ "typescript": "^5.7.3",
29
+ "@types/bun": "^1.2.4"
30
+ },
31
+ "scripts": {
32
+ "build": "bun build src/index.ts --outdir dist --target browser && tsc --emitDeclarationOnly --outDir dist",
33
+ "typecheck": "tsc --noEmit"
34
+ }
32
35
  }