@deslop/gateway 0.1.1223 → 0.1.1228
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/dist/client/index.html
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<link rel="manifest" href="/manifest.webmanifest" />
|
|
16
16
|
|
|
17
17
|
<title>Gateway</title>
|
|
18
|
-
<script type="module" crossorigin src="/assets/index-
|
|
18
|
+
<script type="module" crossorigin src="/assets/index-BJcI2a-l.js"></script>
|
|
19
19
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-WkwZ5CU-.js">
|
|
20
20
|
<link rel="stylesheet" crossorigin href="/assets/index-JWBKvPy0.css">
|
|
21
21
|
</head>
|
package/dist/server.js
CHANGED
|
@@ -50708,6 +50708,23 @@ const compressBody = /*#__PURE__*/ dual((args) => isHttpClientRequest(args[0]),
|
|
|
50708
50708
|
*/
|
|
50709
50709
|
const bodyJson = /*#__PURE__*/ dual(2, (self, body) => map$5(json$1(body), (body) => setBody$1(self, body)));
|
|
50710
50710
|
/**
|
|
50711
|
+
* Sets a JSON request body using unsafe JSON encoding.
|
|
50712
|
+
*
|
|
50713
|
+
* **When to use**
|
|
50714
|
+
*
|
|
50715
|
+
* Use when the request body is known to be JSON-serializable and a synchronous
|
|
50716
|
+
* `HttpClientRequest` result is needed.
|
|
50717
|
+
*
|
|
50718
|
+
* **Gotchas**
|
|
50719
|
+
*
|
|
50720
|
+
* JSON encoding may throw instead of failing in the Effect error channel.
|
|
50721
|
+
*
|
|
50722
|
+
* @stability unstable
|
|
50723
|
+
* @category combinators
|
|
50724
|
+
* @since 4.0.0
|
|
50725
|
+
*/
|
|
50726
|
+
const bodyJsonUnsafe = /*#__PURE__*/ dual(2, (self, body) => setBody$1(self, jsonUnsafe$1(body)));
|
|
50727
|
+
/**
|
|
50711
50728
|
* Sets an `application/x-www-form-urlencoded` request body from URL parameter input.
|
|
50712
50729
|
*
|
|
50713
50730
|
* @stability unstable
|
|
@@ -77273,6 +77290,8 @@ const SecureOrigin = Origin.check(makeFilter((value) => {
|
|
|
77273
77290
|
const Port = String$6.check(isPattern(/^\d{1,5}$/u), makeFilter((value) => exists(parse$3(value), (port) => port >= 1 && port <= 65535), { expected: "a port between 1 and 65535" }));
|
|
77274
77291
|
const AppVersion = String$6.check(isPattern(/^0\.1\.\d+$/u));
|
|
77275
77292
|
const RuntimeConfig = Struct({
|
|
77293
|
+
auth: optionalKey(String$6),
|
|
77294
|
+
name: String$6,
|
|
77276
77295
|
traces: String$6,
|
|
77277
77296
|
version: AppVersion
|
|
77278
77297
|
});
|
|
@@ -87906,7 +87925,7 @@ function layerKeyValueStore(directory) {
|
|
|
87906
87925
|
const layerDataStore = unwrap$7(map$5(dataDirectory, layerKeyValueStore));
|
|
87907
87926
|
const layerProtocol = mergeAll$1(layerSchemaBinary(), succeed$6(MaxBodySize)(mebibytes(10)));
|
|
87908
87927
|
const layerTelemetry = unwrap$7(gen(function* () {
|
|
87909
|
-
const name = yield*
|
|
87928
|
+
const name = (yield* packageMetadata).name;
|
|
87910
87929
|
return match$8(yield* option(String$5("OTEL_URL")), {
|
|
87911
87930
|
onNone: () => empty$12,
|
|
87912
87931
|
onSome: (url) => layerOtlp(`${name}-server`, url, "server")
|
|
@@ -87931,10 +87950,17 @@ const layerRoutes = use((router) => gen(function* () {
|
|
|
87931
87950
|
})
|
|
87932
87951
|
});
|
|
87933
87952
|
});
|
|
87934
|
-
yield* router.add("GET", "/api/runtime",
|
|
87935
|
-
|
|
87936
|
-
|
|
87937
|
-
|
|
87953
|
+
yield* router.add("GET", "/api/runtime", gen(function* () {
|
|
87954
|
+
return yield* schemaJson(RuntimeConfig)({
|
|
87955
|
+
...match$8(issuer, {
|
|
87956
|
+
onNone: () => ({}),
|
|
87957
|
+
onSome: (origin) => ({ auth: origin })
|
|
87958
|
+
}),
|
|
87959
|
+
name: yield* appName,
|
|
87960
|
+
traces,
|
|
87961
|
+
version: (yield* packageMetadata).version
|
|
87962
|
+
});
|
|
87963
|
+
}));
|
|
87938
87964
|
yield* router.add("GET", "/auth/sign-in", toIssuer({}));
|
|
87939
87965
|
yield* router.add("GET", "/auth/sign-out", toIssuer({ "sign-out": "" }));
|
|
87940
87966
|
yield* router.add("GET", "/auth/user", gen(function* () {
|
|
@@ -87946,6 +87972,22 @@ const layerRoutes = use((router) => gen(function* () {
|
|
|
87946
87972
|
}, { headers: { "cache-control": "no-store" } });
|
|
87947
87973
|
}));
|
|
87948
87974
|
}));
|
|
87975
|
+
const layerAnnounce = effectDiscard(gen(function* () {
|
|
87976
|
+
const origin = new URL(yield* String$5("APP_URL")).origin;
|
|
87977
|
+
const client = filterStatusOk(yield* HttpClient);
|
|
87978
|
+
yield* match$8(yield* option(String$5("AUTH_URL")), {
|
|
87979
|
+
onNone: () => void_$1,
|
|
87980
|
+
onSome: fnUntraced(function* (issuer) {
|
|
87981
|
+
yield* pipe$1(post(new URL("/api/apps", issuer).href), bodyJsonUnsafe({ origin }), client.execute, delay("2 seconds"), retry({
|
|
87982
|
+
schedule: spaced("1 minute"),
|
|
87983
|
+
times: 60
|
|
87984
|
+
}), ignore$1({
|
|
87985
|
+
log: "Warn",
|
|
87986
|
+
message: "Auth did not list this app"
|
|
87987
|
+
}), forkScoped);
|
|
87988
|
+
})
|
|
87989
|
+
});
|
|
87990
|
+
}));
|
|
87949
87991
|
function layerIcon(icon) {
|
|
87950
87992
|
return add("GET", "/icon", succeed$5(text(icon, {
|
|
87951
87993
|
contentType: "image/svg+xml",
|
|
@@ -88052,17 +88094,20 @@ function systemctl(...args) {
|
|
|
88052
88094
|
const unitDirectory = gen(function* () {
|
|
88053
88095
|
return (yield* Path$1).join(yield* String$5("HOME"), ".config", "systemd", "user");
|
|
88054
88096
|
});
|
|
88055
|
-
const install = fnUntraced(function* (name, command) {
|
|
88097
|
+
const install = fnUntraced(function* (name, command, options) {
|
|
88056
88098
|
const fs = yield* FileSystem;
|
|
88057
88099
|
const path = yield* Path$1;
|
|
88058
88100
|
const home = yield* String$5("HOME");
|
|
88059
88101
|
const directory = yield* unitDirectory;
|
|
88060
88102
|
const unit = `deslop-${name}.service`;
|
|
88061
88103
|
yield* fs.makeDirectory(directory, { recursive: true });
|
|
88062
|
-
yield* fs.writeFileString(path.join(directory, unit), `[Unit]\nDescription=Deslop ${name}\nAfter=network-online.target\n\n[Service]\nType=simple\nEnvironment=NODE_ENV=production\nEnvironment=${systemdArgument(`PATH=${home}/.vite-plus/bin:/usr/local/bin:/usr/bin:/bin`)}\nEnvironmentFile=-${
|
|
88104
|
+
yield* fs.writeFileString(path.join(directory, unit), `[Unit]\nDescription=Deslop ${name}\nAfter=network-online.target\n\n[Service]\nType=simple\nEnvironment=NODE_ENV=production\nEnvironment=${systemdArgument(`PATH=${home}/.vite-plus/bin:/usr/local/bin:/usr/bin:/bin`)}\nEnvironmentFile=-${replaceAll("%", "%%")(`${home}/.deslop/${name}.env`)}\nExecStart=${join$2(map$8(command, systemdArgument), " ")}\nRestart=on-failure\nRestartSec=3\nUMask=0077\n\n[Install]\nWantedBy=default.target\n`, { mode: 384 });
|
|
88063
88105
|
yield* systemctl("daemon-reload");
|
|
88064
88106
|
yield* systemctl("enable", unit);
|
|
88065
|
-
yield* systemctl(
|
|
88107
|
+
yield* systemctl(match$1(options?.restart === false, {
|
|
88108
|
+
onFalse: () => "restart",
|
|
88109
|
+
onTrue: () => "start"
|
|
88110
|
+
}), unit);
|
|
88066
88111
|
return `${unit} installed\n`;
|
|
88067
88112
|
});
|
|
88068
88113
|
const installUpdates = fnUntraced(function* (name, command) {
|
|
@@ -88189,7 +88234,7 @@ const provider = fnUntraced(function* (given) {
|
|
|
88189
88234
|
});
|
|
88190
88235
|
const layerPlatform = mergeAll$1(layer$5, layer$13, layer$16);
|
|
88191
88236
|
function server(app) {
|
|
88192
|
-
return pipe$1(serve(pipe$1(mergeAll$1(app.routes, layerRoutes, layerIcon(app.icon), layerWeb), provide$2(Auth.layer)), {
|
|
88237
|
+
return pipe$1(serve(pipe$1(mergeAll$1(app.routes, layerRoutes, layerIcon(app.icon), layerWeb, layerAnnounce), provide$2(Auth.layer)), {
|
|
88193
88238
|
disableLogger: true,
|
|
88194
88239
|
middleware: (http) => guard(app.middleware?.(http) ?? http)
|
|
88195
88240
|
}), provide$2(mergeAll$1(layerProtocol, match$1(app.telemetry === false, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deslop/gateway",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1228",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/MP281X/deslop",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"engines": {
|
|
33
33
|
"node": ">=26"
|
|
34
34
|
},
|
|
35
|
-
"fingerprint": "
|
|
35
|
+
"fingerprint": "e186eed4666dc10312a1ec045b4618be5dbbaf170dfae59bb59c836731493fcd"
|
|
36
36
|
}
|