@terrantula/sdk 0.0.1
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/LICENSE +201 -0
- package/README.md +26 -0
- package/dist/audit-export-BJSNZ9ic.d.mts +56 -0
- package/dist/audit-export-BJSNZ9ic.d.ts +56 -0
- package/dist/chunk-NTU2AEMP.mjs +1507 -0
- package/dist/index.d.mts +22569 -0
- package/dist/index.d.ts +22569 -0
- package/dist/index.js +1530 -0
- package/dist/index.mjs +10 -0
- package/dist/local.d.mts +16806 -0
- package/dist/local.d.ts +16806 -0
- package/dist/local.js +1549 -0
- package/dist/local.mjs +27 -0
- package/package.json +80 -0
package/dist/local.mjs
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createClient
|
|
3
|
+
} from "./chunk-NTU2AEMP.mjs";
|
|
4
|
+
|
|
5
|
+
// src/local.ts
|
|
6
|
+
import { createLocalApp, openLocalDb } from "@terrantula/local";
|
|
7
|
+
import { homedir } from "os";
|
|
8
|
+
import { join } from "path";
|
|
9
|
+
import { mkdirSync } from "fs";
|
|
10
|
+
function defaultLocalDbPath() {
|
|
11
|
+
const dir = join(homedir(), ".config", "terrantula");
|
|
12
|
+
mkdirSync(dir, { recursive: true });
|
|
13
|
+
return join(dir, "local.db");
|
|
14
|
+
}
|
|
15
|
+
var createLocalClient = (options = {}) => {
|
|
16
|
+
const opened = openLocalDb({ path: options.dbPath ?? defaultLocalDbPath() });
|
|
17
|
+
const app = createLocalApp({ db: opened.db });
|
|
18
|
+
const localFetch = ((input, init) => {
|
|
19
|
+
const req = input instanceof Request ? input : new Request(input, init);
|
|
20
|
+
return Promise.resolve(app.fetch(req));
|
|
21
|
+
});
|
|
22
|
+
const client = createClient("http://local/api", { fetch: localFetch });
|
|
23
|
+
return Object.assign(client, { close: opened.close });
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
createLocalClient
|
|
27
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@terrantula/sdk",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "TypeScript SDK for Terrantula — the multi-tenant entity-graph control plane that herds Terraform/OpenTofu cattle.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"terrantula",
|
|
7
|
+
"terraform",
|
|
8
|
+
"opentofu",
|
|
9
|
+
"iac",
|
|
10
|
+
"multi-tenancy",
|
|
11
|
+
"platform-engineering",
|
|
12
|
+
"sdk"
|
|
13
|
+
],
|
|
14
|
+
"license": "Apache-2.0",
|
|
15
|
+
"homepage": "https://github.com/brcourt/terrantula#readme",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/brcourt/terrantula.git",
|
|
19
|
+
"directory": "packages/sdk"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/brcourt/terrantula/issues"
|
|
23
|
+
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public",
|
|
26
|
+
"registry": "https://registry.npmjs.org"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"README.md",
|
|
31
|
+
"LICENSE"
|
|
32
|
+
],
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"bun": "./src/index.ts",
|
|
36
|
+
"import": {
|
|
37
|
+
"types": "./dist/index.d.mts",
|
|
38
|
+
"default": "./dist/index.mjs"
|
|
39
|
+
},
|
|
40
|
+
"require": {
|
|
41
|
+
"types": "./dist/index.d.ts",
|
|
42
|
+
"default": "./dist/index.js"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"./local": {
|
|
46
|
+
"bun": "./src/local.ts",
|
|
47
|
+
"import": {
|
|
48
|
+
"types": "./dist/local.d.mts",
|
|
49
|
+
"default": "./dist/local.mjs"
|
|
50
|
+
},
|
|
51
|
+
"require": {
|
|
52
|
+
"types": "./dist/local.d.ts",
|
|
53
|
+
"default": "./dist/local.js"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"main": "./dist/index.js",
|
|
58
|
+
"types": "./dist/index.d.ts",
|
|
59
|
+
"scripts": {
|
|
60
|
+
"build": "tsup src/index.ts src/local.ts --format esm,cjs --dts --clean --tsconfig tsconfig.json",
|
|
61
|
+
"prepublishOnly": "bun run build",
|
|
62
|
+
"test": "bun test"
|
|
63
|
+
},
|
|
64
|
+
"dependencies": {
|
|
65
|
+
"@terrantula/local": "1.0.0",
|
|
66
|
+
"@terrantula/types": "1.0.0",
|
|
67
|
+
"hono": "^4.4.0",
|
|
68
|
+
"zod": "^3.22.0"
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"@terrantula/api": "0.1.0",
|
|
72
|
+
"@terrantula/auth": "0.1.0",
|
|
73
|
+
"@terrantula/orgs": "0.1.0",
|
|
74
|
+
"@terrantula/projects": "0.1.0",
|
|
75
|
+
"@terrantula/github": "0.1.0",
|
|
76
|
+
"bun-types": "latest",
|
|
77
|
+
"tsup": "^8.0.0",
|
|
78
|
+
"typescript": "^5.4.0"
|
|
79
|
+
}
|
|
80
|
+
}
|