@deslop/opm 0.1.1227 → 0.1.1231
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/server.js +47 -5
- package/package.json +4 -4
package/dist/server.js
CHANGED
|
@@ -44833,6 +44833,23 @@ const compressBody = /*#__PURE__*/ dual((args) => isHttpClientRequest(args[0]),
|
|
|
44833
44833
|
*/
|
|
44834
44834
|
const bodyJson = /*#__PURE__*/ dual(2, (self, body) => map$6(json$1(body), (body) => setBody$1(self, body)));
|
|
44835
44835
|
/**
|
|
44836
|
+
* Sets a JSON request body using unsafe JSON encoding.
|
|
44837
|
+
*
|
|
44838
|
+
* **When to use**
|
|
44839
|
+
*
|
|
44840
|
+
* Use when the request body is known to be JSON-serializable and a synchronous
|
|
44841
|
+
* `HttpClientRequest` result is needed.
|
|
44842
|
+
*
|
|
44843
|
+
* **Gotchas**
|
|
44844
|
+
*
|
|
44845
|
+
* JSON encoding may throw instead of failing in the Effect error channel.
|
|
44846
|
+
*
|
|
44847
|
+
* @stability unstable
|
|
44848
|
+
* @category combinators
|
|
44849
|
+
* @since 4.0.0
|
|
44850
|
+
*/
|
|
44851
|
+
const bodyJsonUnsafe = /*#__PURE__*/ dual(2, (self, body) => setBody$1(self, jsonUnsafe$1(body)));
|
|
44852
|
+
/**
|
|
44836
44853
|
* Builds a `URL` from the request URL, query parameters, and hash, returning `Option.none()` if the URL is invalid.
|
|
44837
44854
|
*
|
|
44838
44855
|
* @stability unstable
|
|
@@ -70926,6 +70943,8 @@ const SecureOrigin = Origin.check(makeFilter((value) => {
|
|
|
70926
70943
|
const Port = String$6.check(isPattern(/^\d{1,5}$/u), makeFilter((value) => exists(parse$9(value), (port) => port >= 1 && port <= 65535), { expected: "a port between 1 and 65535" }));
|
|
70927
70944
|
const AppVersion = String$6.check(isPattern(/^0\.1\.\d+$/u));
|
|
70928
70945
|
const RuntimeConfig = Struct({
|
|
70946
|
+
auth: optionalKey(String$6),
|
|
70947
|
+
name: String$6,
|
|
70929
70948
|
traces: String$6,
|
|
70930
70949
|
version: AppVersion
|
|
70931
70950
|
});
|
|
@@ -71835,10 +71854,17 @@ const layerRoutes = use((router) => gen(function* () {
|
|
|
71835
71854
|
})
|
|
71836
71855
|
});
|
|
71837
71856
|
});
|
|
71838
|
-
yield* router.add("GET", "/api/runtime",
|
|
71839
|
-
|
|
71840
|
-
|
|
71841
|
-
|
|
71857
|
+
yield* router.add("GET", "/api/runtime", gen(function* () {
|
|
71858
|
+
return yield* schemaJson(RuntimeConfig)({
|
|
71859
|
+
...match$8(issuer, {
|
|
71860
|
+
onNone: () => ({}),
|
|
71861
|
+
onSome: (origin) => ({ auth: origin })
|
|
71862
|
+
}),
|
|
71863
|
+
name: yield* appName,
|
|
71864
|
+
traces,
|
|
71865
|
+
version: (yield* packageMetadata).version
|
|
71866
|
+
});
|
|
71867
|
+
}));
|
|
71842
71868
|
yield* router.add("GET", "/auth/sign-in", toIssuer({}));
|
|
71843
71869
|
yield* router.add("GET", "/auth/sign-out", toIssuer({ "sign-out": "" }));
|
|
71844
71870
|
yield* router.add("GET", "/auth/user", gen(function* () {
|
|
@@ -71850,6 +71876,22 @@ const layerRoutes = use((router) => gen(function* () {
|
|
|
71850
71876
|
}, { headers: { "cache-control": "no-store" } });
|
|
71851
71877
|
}));
|
|
71852
71878
|
}));
|
|
71879
|
+
const layerAnnounce = effectDiscard(gen(function* () {
|
|
71880
|
+
const origin = new URL(yield* String$5("APP_URL")).origin;
|
|
71881
|
+
const client = filterStatusOk(yield* HttpClient);
|
|
71882
|
+
yield* match$8(yield* option(String$5("AUTH_URL")), {
|
|
71883
|
+
onNone: () => void_$1,
|
|
71884
|
+
onSome: fnUntraced(function* (issuer) {
|
|
71885
|
+
yield* pipe(post(new URL("/api/apps", issuer).href), bodyJsonUnsafe({ origin }), client.execute, delay("2 seconds"), retry({
|
|
71886
|
+
schedule: spaced("1 minute"),
|
|
71887
|
+
times: 60
|
|
71888
|
+
}), ignore$1({
|
|
71889
|
+
log: "Warn",
|
|
71890
|
+
message: "Auth did not list this app"
|
|
71891
|
+
}), forkScoped);
|
|
71892
|
+
})
|
|
71893
|
+
});
|
|
71894
|
+
}));
|
|
71853
71895
|
function layerIcon(icon) {
|
|
71854
71896
|
return add$1("GET", "/icon", succeed$5(text$2(icon, {
|
|
71855
71897
|
contentType: "image/svg+xml",
|
|
@@ -72062,7 +72104,7 @@ const provider = fnUntraced(function* (given) {
|
|
|
72062
72104
|
});
|
|
72063
72105
|
const layerPlatform = mergeAll$1(layer$4, layer$12, layer$15);
|
|
72064
72106
|
function server(app) {
|
|
72065
|
-
return pipe(serve(pipe(mergeAll$1(app.routes, layerRoutes, layerIcon(app.icon), layerWeb), provide$2(Auth.layer)), {
|
|
72107
|
+
return pipe(serve(pipe(mergeAll$1(app.routes, layerRoutes, layerIcon(app.icon), layerWeb, layerAnnounce), provide$2(Auth.layer)), {
|
|
72066
72108
|
disableLogger: true,
|
|
72067
72109
|
middleware: (http) => guard(app.middleware?.(http) ?? http)
|
|
72068
72110
|
}), provide$2(mergeAll$1(layerProtocol, match$1(app.telemetry === false, {
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deslop/opm",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1231",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
|
-
"url": "https://github.com/MP281X/deslop",
|
|
6
|
+
"url": "git+https://github.com/MP281X/deslop.git",
|
|
7
7
|
"directory": "apps/opm"
|
|
8
8
|
},
|
|
9
9
|
"bin": {
|
|
10
|
-
"opm": "
|
|
10
|
+
"opm": "dist/server.js"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"dist",
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"engines": {
|
|
32
32
|
"node": ">=26"
|
|
33
33
|
},
|
|
34
|
-
"fingerprint": "
|
|
34
|
+
"fingerprint": "fb15983e56f9cb9a9a57f682bf0b001b8a7d92996a090c069924141833606289"
|
|
35
35
|
}
|