@deslop/deploy 0.1.1227 → 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/server.js CHANGED
@@ -51469,6 +51469,23 @@ const compressBody = /*#__PURE__*/ dual((args) => isHttpClientRequest(args[0]),
51469
51469
  return map$5(compressBody$1(self.body, algorithm, options), (body) => body === self.body ? self : makeWith$1(self.method, self.url, self.urlParams, self.hash, set$3(updateContentLength(self.headers, body), "content-encoding", algorithm), body));
51470
51470
  });
51471
51471
  /**
51472
+ * Sets a JSON request body using unsafe JSON encoding.
51473
+ *
51474
+ * **When to use**
51475
+ *
51476
+ * Use when the request body is known to be JSON-serializable and a synchronous
51477
+ * `HttpClientRequest` result is needed.
51478
+ *
51479
+ * **Gotchas**
51480
+ *
51481
+ * JSON encoding may throw instead of failing in the Effect error channel.
51482
+ *
51483
+ * @stability unstable
51484
+ * @category combinators
51485
+ * @since 4.0.0
51486
+ */
51487
+ const bodyJsonUnsafe = /*#__PURE__*/ dual(2, (self, body) => setBody$1(self, jsonUnsafe$1(body)));
51488
+ /**
51472
51489
  * Builds a `URL` from the request URL, query parameters, and hash, returning `Option.none()` if the URL is invalid.
51473
51490
  *
51474
51491
  * @stability unstable
@@ -86056,6 +86073,8 @@ const SecureOrigin = Origin.check(makeFilter((value) => {
86056
86073
  const Port = String$6.check(isPattern(/^\d{1,5}$/u), makeFilter((value) => exists(parse$2(value), (port) => port >= 1 && port <= 65535), { expected: "a port between 1 and 65535" }));
86057
86074
  const AppVersion = String$6.check(isPattern(/^0\.1\.\d+$/u));
86058
86075
  const RuntimeConfig = Struct({
86076
+ auth: optionalKey(String$6),
86077
+ name: String$6,
86059
86078
  traces: String$6,
86060
86079
  version: AppVersion
86061
86080
  });
@@ -86988,10 +87007,17 @@ const layerRoutes = use((router) => gen(function* () {
86988
87007
  })
86989
87008
  });
86990
87009
  });
86991
- yield* router.add("GET", "/api/runtime", flatMap$2(packageMetadata, (metadata) => schemaJson(RuntimeConfig)({
86992
- traces,
86993
- version: metadata.version
86994
- })));
87010
+ yield* router.add("GET", "/api/runtime", gen(function* () {
87011
+ return yield* schemaJson(RuntimeConfig)({
87012
+ ...match$8(issuer, {
87013
+ onNone: () => ({}),
87014
+ onSome: (origin) => ({ auth: origin })
87015
+ }),
87016
+ name: yield* appName,
87017
+ traces,
87018
+ version: (yield* packageMetadata).version
87019
+ });
87020
+ }));
86995
87021
  yield* router.add("GET", "/auth/sign-in", toIssuer({}));
86996
87022
  yield* router.add("GET", "/auth/sign-out", toIssuer({ "sign-out": "" }));
86997
87023
  yield* router.add("GET", "/auth/user", gen(function* () {
@@ -87003,6 +87029,22 @@ const layerRoutes = use((router) => gen(function* () {
87003
87029
  }, { headers: { "cache-control": "no-store" } });
87004
87030
  }));
87005
87031
  }));
87032
+ const layerAnnounce = effectDiscard(gen(function* () {
87033
+ const origin = new URL(yield* String$5("APP_URL")).origin;
87034
+ const client = filterStatusOk(yield* HttpClient);
87035
+ yield* match$8(yield* option(String$5("AUTH_URL")), {
87036
+ onNone: () => void_$1,
87037
+ onSome: fnUntraced(function* (issuer) {
87038
+ yield* pipe(post(new URL("/api/apps", issuer).href), bodyJsonUnsafe({ origin }), client.execute, delay("2 seconds"), retry({
87039
+ schedule: spaced("1 minute"),
87040
+ times: 60
87041
+ }), ignore$1({
87042
+ log: "Warn",
87043
+ message: "Auth did not list this app"
87044
+ }), forkScoped);
87045
+ })
87046
+ });
87047
+ }));
87006
87048
  function layerIcon(icon) {
87007
87049
  return add("GET", "/icon", succeed$5(text(icon, {
87008
87050
  contentType: "image/svg+xml",
@@ -87245,7 +87287,7 @@ const provider = fnUntraced(function* (given) {
87245
87287
  });
87246
87288
  const layerPlatform = mergeAll$1(layer$4, layer$12, layer$15);
87247
87289
  function server(app) {
87248
- return pipe(serve(pipe(mergeAll$1(app.routes, layerRoutes, layerIcon(app.icon), layerWeb), provide$2(Auth.layer)), {
87290
+ return pipe(serve(pipe(mergeAll$1(app.routes, layerRoutes, layerIcon(app.icon), layerWeb, layerAnnounce), provide$2(Auth.layer)), {
87249
87291
  disableLogger: true,
87250
87292
  middleware: (http) => guard(app.middleware?.(http) ?? http)
87251
87293
  }), provide$2(mergeAll$1(layerProtocol, match$1(app.telemetry === false, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deslop/deploy",
3
- "version": "0.1.1227",
3
+ "version": "0.1.1228",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/MP281X/deslop",
@@ -37,5 +37,5 @@
37
37
  "engines": {
38
38
  "node": ">=26"
39
39
  },
40
- "fingerprint": "d70ad3ca627d90894fc1f756e99a4ec31db3bc49919b217c71d0cc953d06afda"
40
+ "fingerprint": "3a9f0b52357143d8e4017003df06ee58d6bfc52f8a912eed666ea17daefb887c"
41
41
  }