@celljs/ta-gateway 4.15.2 → 4.17.0
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/README.en.md +5 -2
- package/README.md +5 -2
- package/esm/node/command-sandbox.d.ts +1 -0
- package/esm/node/command-sandbox.js +10 -1
- package/esm/node/docker-engine.d.ts +10 -1
- package/esm/node/docker-engine.js +18 -1
- package/esm/node/docker-sandbox.d.ts +13 -1
- package/esm/node/docker-sandbox.js +35 -2
- package/esm/node/egress-proxy.d.ts +98 -0
- package/esm/node/egress-proxy.js +428 -0
- package/esm/node/environments.d.ts +5 -0
- package/esm/node/environments.js +7 -3
- package/esm/node/gateway-cli.js +12 -5
- package/esm/node/gateway-exec.d.ts +19 -0
- package/esm/node/gateway-exec.js +65 -0
- package/esm/node/gateway-policy.d.ts +7 -1
- package/esm/node/gateway-policy.js +12 -2
- package/esm/node/gateway-quotas.d.ts +15 -2
- package/esm/node/gateway-quotas.js +51 -3
- package/esm/node/gateway-server.d.ts +43 -1
- package/esm/node/gateway-server.js +179 -10
- package/esm/node/gateway-service-util.d.ts +41 -0
- package/esm/node/gateway-service-util.js +178 -0
- package/esm/node/gateway-service.d.ts +13 -41
- package/esm/node/gateway-service.js +41 -176
- package/esm/node/gateway-socket.d.ts +1 -1
- package/esm/node/gateway-socket.js +1 -1
- package/esm/node/index.d.ts +4 -0
- package/esm/node/index.js +4 -0
- package/esm/node/kubernetes-api.d.ts +35 -0
- package/esm/node/kubernetes-api.js +115 -0
- package/esm/node/kubernetes-sandbox.d.ts +198 -0
- package/esm/node/kubernetes-sandbox.js +279 -0
- package/esm/node/local-sandbox.d.ts +1 -0
- package/esm/node/local-sandbox.js +2 -1
- package/esm/node/model-proxy.d.ts +105 -0
- package/esm/node/model-proxy.js +435 -0
- package/esm/node/sandbox-provider.d.ts +17 -0
- package/esm/node/sandbox-provider.js +2 -1
- package/esm/node/tenant-store.d.ts +22 -0
- package/esm/node/tenant-store.js +25 -0
- package/lib/node/command-sandbox.d.ts +1 -0
- package/lib/node/command-sandbox.js +10 -1
- package/lib/node/docker-engine.d.ts +10 -1
- package/lib/node/docker-engine.js +18 -1
- package/lib/node/docker-sandbox.d.ts +13 -1
- package/lib/node/docker-sandbox.js +35 -2
- package/lib/node/egress-proxy.d.ts +99 -0
- package/lib/node/egress-proxy.js +433 -0
- package/lib/node/environments.d.ts +5 -0
- package/lib/node/environments.js +7 -3
- package/lib/node/gateway-cli.js +12 -5
- package/lib/node/gateway-exec.d.ts +20 -0
- package/lib/node/gateway-exec.js +69 -0
- package/lib/node/gateway-policy.d.ts +7 -1
- package/lib/node/gateway-policy.js +12 -2
- package/lib/node/gateway-quotas.d.ts +15 -2
- package/lib/node/gateway-quotas.js +51 -3
- package/lib/node/gateway-server.d.ts +43 -1
- package/lib/node/gateway-server.js +177 -8
- package/lib/node/gateway-service-util.d.ts +42 -0
- package/lib/node/gateway-service-util.js +182 -0
- package/lib/node/gateway-service.d.ts +13 -41
- package/lib/node/gateway-service.js +63 -199
- package/lib/node/gateway-socket.d.ts +1 -1
- package/lib/node/gateway-socket.js +10 -10
- package/lib/node/index.d.ts +4 -0
- package/lib/node/index.js +4 -0
- package/lib/node/kubernetes-api.d.ts +36 -0
- package/lib/node/kubernetes-api.js +120 -0
- package/lib/node/kubernetes-sandbox.d.ts +199 -0
- package/lib/node/kubernetes-sandbox.js +283 -0
- package/lib/node/local-sandbox.d.ts +1 -0
- package/lib/node/local-sandbox.js +2 -1
- package/lib/node/model-proxy.d.ts +106 -0
- package/lib/node/model-proxy.js +440 -0
- package/lib/node/sandbox-provider.d.ts +17 -0
- package/lib/node/sandbox-provider.js +2 -1
- package/lib/node/tenant-store.d.ts +22 -0
- package/lib/node/tenant-store.js +25 -0
- package/package.json +4 -4
package/lib/node/tenant-store.js
CHANGED
|
@@ -59,6 +59,7 @@ class TenantStore {
|
|
|
59
59
|
name: account.name,
|
|
60
60
|
avatar: account.avatar,
|
|
61
61
|
token: (0, node_crypto_1.randomBytes)(32).toString('base64url'),
|
|
62
|
+
modelKey: `tam-${(0, node_crypto_1.randomBytes)(24).toString('base64url')}`,
|
|
62
63
|
createdAt: now,
|
|
63
64
|
};
|
|
64
65
|
this.save(tenant);
|
|
@@ -73,6 +74,30 @@ class TenantStore {
|
|
|
73
74
|
this.save(next);
|
|
74
75
|
return next;
|
|
75
76
|
}
|
|
77
|
+
/** Its model key, made for a tenant of before. */
|
|
78
|
+
modelKey(id) {
|
|
79
|
+
var _a;
|
|
80
|
+
const tenant = this.get(id);
|
|
81
|
+
if (!tenant) {
|
|
82
|
+
throw new Error(`No tenant ${id}`);
|
|
83
|
+
}
|
|
84
|
+
return (_a = tenant.modelKey) !== null && _a !== void 0 ? _a : this.update(id, { modelKey: `tam-${(0, node_crypto_1.randomBytes)(24).toString('base64url')}` }).modelKey;
|
|
85
|
+
}
|
|
86
|
+
/** The credentials of its sandbox's way out: of a new epoch when `renew` (a sandbox made anew), or when it has none. */
|
|
87
|
+
egressKey(id, renew) {
|
|
88
|
+
var _a;
|
|
89
|
+
var _b;
|
|
90
|
+
const tenant = this.get(id);
|
|
91
|
+
if (!tenant) {
|
|
92
|
+
throw new Error(`No tenant ${id}`);
|
|
93
|
+
}
|
|
94
|
+
if (tenant.egress && !renew) {
|
|
95
|
+
return tenant.egress;
|
|
96
|
+
}
|
|
97
|
+
const egress = { epoch: ((_b = (_a = tenant.egress) === null || _a === void 0 ? void 0 : _a.epoch) !== null && _b !== void 0 ? _b : 0) + 1, secret: (0, node_crypto_1.randomBytes)(24).toString('base64url') };
|
|
98
|
+
this.update(id, { egress });
|
|
99
|
+
return egress;
|
|
100
|
+
}
|
|
76
101
|
list() {
|
|
77
102
|
return (0, node_fs_1.readdirSync)(this.dir)
|
|
78
103
|
.filter(name => /^[0-9a-f]{16}\.json$/.test(name))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-gateway",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.17.0",
|
|
4
4
|
"description": "ta gateway: one Ta per account, each in a sandbox of its own, behind one sign-in",
|
|
5
5
|
"homepage": "https://github.com/cellbang/ta",
|
|
6
6
|
"bugs": {
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@celljs/rpc": "4.
|
|
33
|
-
"@celljs/ta-host": "4.
|
|
34
|
-
"@celljs/ta-protocol": "4.
|
|
32
|
+
"@celljs/rpc": "4.17.0",
|
|
33
|
+
"@celljs/ta-host": "4.17.0",
|
|
34
|
+
"@celljs/ta-protocol": "4.17.0"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|