@deslop/auth 0.1.1342 → 0.1.1345

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
@@ -10147,6 +10147,8 @@ const provideService$3 = function() {
10147
10147
  };
10148
10148
  const provideServiceImpl = (self, service, implementation) => updateContext$1(self, add$2(service, implementation));
10149
10149
  /** @internal */
10150
+ const provideServiceEffect$1 = /*#__PURE__*/ dual(3, (self, service, acquire) => flatMap$5(acquire, (implementation) => provideService$3(self, service, implementation)));
10151
+ /** @internal */
10150
10152
  const zipWith$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[1]), (self, that, f, options) => options?.concurrent ? map$9(all$2([self, that], { concurrency: 2 }), ([a, a2]) => f(a, a2)) : flatMap$5(self, (a) => map$9(that, (a2) => f(a, a2))));
10151
10153
  /** @internal */
10152
10154
  const filterOrFail$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, predicate, orFailWith) => filterOrElse(self, predicate, orFailWith ? (a) => fail$10(orFailWith(a)) : () => fail$10(new NoSuchElementError())));
@@ -14510,6 +14512,51 @@ const filterInterruptors = causeFilterInterruptors;
14510
14512
  */
14511
14513
  const prettyErrors = causePrettyErrors;
14512
14514
  /**
14515
+ * Formats a `Cause` as a human-readable string for logging or debugging.
14516
+ *
14517
+ * **When to use**
14518
+ *
14519
+ * Use to render a whole cause as one human-readable string for logs or
14520
+ * diagnostics.
14521
+ *
14522
+ * **Details**
14523
+ *
14524
+ * Delegates to {@link prettyErrors} to convert each reason to an `Error`,
14525
+ * then joins their stack traces with newlines. Nested `Error.cause` chains
14526
+ * are rendered inline with indentation:
14527
+ *
14528
+ * ```text
14529
+ * ErrorName: message
14530
+ * at ...
14531
+ * at ... {
14532
+ * [cause]: NestedError: message
14533
+ * at ...
14534
+ * }
14535
+ * ```
14536
+ *
14537
+ * Span annotations are appended to the relevant stack frames when available.
14538
+ *
14539
+ * **Gotchas**
14540
+ *
14541
+ * Rendering an empty cause produces an empty string because there are no
14542
+ * errors to render.
14543
+ *
14544
+ * **Example** (Rendering a cause)
14545
+ *
14546
+ * ```ts import.meta.vitest
14547
+ * import { Cause } from "effect"
14548
+ *
14549
+ * Cause.pretty(Cause.fail("something went wrong")).includes("something went wrong") // => true
14550
+ * ```
14551
+ *
14552
+ * @see {@link prettyErrors} — get the individual `Error` instances
14553
+ *
14554
+ * @stability stable
14555
+ * @category formatting
14556
+ * @since 2.0.0
14557
+ */
14558
+ const pretty = causePretty;
14559
+ /**
14513
14560
  * Checks whether an arbitrary value is a `NoSuchElementError`.
14514
14561
  *
14515
14562
  * **Example** (Checking the runtime type)
@@ -19814,6 +19861,63 @@ const updateService = updateService$1;
19814
19861
  */
19815
19862
  const provideService$2 = provideService$3;
19816
19863
  /**
19864
+ * Provides one service to an effect using an effectful acquisition.
19865
+ *
19866
+ * **When to use**
19867
+ *
19868
+ * Use when the service implementation must be created by an effect and its
19869
+ * acquisition failure should remain in the returned effect.
19870
+ *
19871
+ * **Details**
19872
+ *
19873
+ * `provideServiceEffect` runs the acquisition effect to produce the service
19874
+ * implementation, removes that service from the wrapped effect's requirements,
19875
+ * and leaves any other requirements to be provided later. Acquisition failures
19876
+ * are included in the returned effect's error channel.
19877
+ *
19878
+ * **Example** (Providing a service with an effect)
19879
+ *
19880
+ * ```ts import.meta.vitest
19881
+ * import { Context, Effect } from "effect"
19882
+ * const output: Array<unknown> = []
19883
+ *
19884
+ * // Define a database connection service
19885
+ * interface DatabaseConnection {
19886
+ * readonly query: (sql: string) => Effect.Effect<string>
19887
+ * }
19888
+ * const Database = Context.Service<DatabaseConnection>("Database")
19889
+ *
19890
+ * // Effect that creates a database connection
19891
+ * const createConnection = Effect.gen(function*() {
19892
+ * yield* Effect.sync(() => { output.push("Establishing database connection...") })
19893
+ * yield* Effect.sync(() => { output.push("Database connected!") })
19894
+ * return {
19895
+ * query: (sql: string) => Effect.succeed(`Result for: ${sql}`)
19896
+ * }
19897
+ * })
19898
+ *
19899
+ * const program = Effect.gen(function*() {
19900
+ * const db = yield* Effect.service(Database)
19901
+ * return yield* db.query("SELECT * FROM users")
19902
+ * })
19903
+ *
19904
+ * // Provide the service through an effect
19905
+ * const withDatabase = Effect.provideServiceEffect(
19906
+ * program,
19907
+ * Database,
19908
+ * createConnection
19909
+ * )
19910
+ *
19911
+ * void output.push(await Effect.runPromise(withDatabase))
19912
+ * output // => ["Establishing database connection...", "Database connected!", "Result for: SELECT * FROM users"]
19913
+ * ```
19914
+ *
19915
+ * @stability stable
19916
+ * @category providing services
19917
+ * @since 2.0.0
19918
+ */
19919
+ const provideServiceEffect = provideServiceEffect$1;
19920
+ /**
19817
19921
  * Returns the current scope for resource management.
19818
19922
  *
19819
19923
  * **Example** (Accessing the current scope)
@@ -66235,7 +66339,7 @@ const fromDuplex = (open, options) => withFiber((fiber) => {
66235
66339
  writer
66236
66340
  }));
66237
66341
  });
66238
- // ../../node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/constants.js
66342
+ // ../../node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/constants.js
66239
66343
  var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
66240
66344
  const BINARY_TYPES = [
66241
66345
  "nodebuffer",
@@ -66257,7 +66361,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
66257
66361
  NOOP: () => {}
66258
66362
  };
66259
66363
  }));
66260
- // ../../node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/buffer-util.js
66364
+ // ../../node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/buffer-util.js
66261
66365
  var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
66262
66366
  const { websocketMask, websocketUnmask } = __require("http");
66263
66367
  const { EMPTY_BUFFER } = require_constants();
@@ -66365,7 +66469,7 @@ var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
66365
66469
  };
66366
66470
  } catch (e) {}
66367
66471
  }));
66368
- // ../../node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/limiter.js
66472
+ // ../../node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/limiter.js
66369
66473
  var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
66370
66474
  const kDone = Symbol("kDone");
66371
66475
  const kRun = Symbol("kRun");
@@ -66415,7 +66519,7 @@ var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
66415
66519
  };
66416
66520
  module.exports = Limiter;
66417
66521
  }));
66418
- // ../../node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/permessage-deflate.js
66522
+ // ../../node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/permessage-deflate.js
66419
66523
  var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
66420
66524
  const zlib = __require("zlib");
66421
66525
  const bufferUtil = require_buffer_util();
@@ -66750,7 +66854,7 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module
66750
66854
  this[kCallback](err);
66751
66855
  }
66752
66856
  }));
66753
- // ../../node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/validation.js
66857
+ // ../../node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/validation.js
66754
66858
  var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
66755
66859
  const { isUtf8 } = __require("buffer");
66756
66860
  const { hasBlob } = require_constants();
@@ -66945,7 +67049,7 @@ var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
66945
67049
  };
66946
67050
  } catch (e) {}
66947
67051
  }));
66948
- // ../../node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/receiver.js
67052
+ // ../../node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/receiver.js
66949
67053
  var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
66950
67054
  const { Writable } = __require("stream");
66951
67055
  const PerMessageDeflate = require_permessage_deflate();
@@ -67408,7 +67512,7 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
67408
67512
  };
67409
67513
  module.exports = Receiver;
67410
67514
  }));
67411
- // ../../node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/sender.js
67515
+ // ../../node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/sender.js
67412
67516
  var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
67413
67517
  const { Duplex } = __require("stream");
67414
67518
  const { randomFillSync } = __require("crypto");
@@ -67906,7 +68010,7 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
67906
68010
  sender.onerror(err);
67907
68011
  }
67908
68012
  }));
67909
- // ../../node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/event-target.js
68013
+ // ../../node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/event-target.js
67910
68014
  var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
67911
68015
  const { kForOnEventAttribute, kListener } = require_constants();
67912
68016
  const kCode = Symbol("kCode");
@@ -68136,7 +68240,7 @@ var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
68136
68240
  else listener.call(thisArg, event);
68137
68241
  }
68138
68242
  }));
68139
- // ../../node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/extension.js
68243
+ // ../../node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/extension.js
68140
68244
  var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
68141
68245
  const { tokenChars } = require_validation();
68142
68246
  /**
@@ -68281,7 +68385,7 @@ var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
68281
68385
  parse
68282
68386
  };
68283
68387
  }));
68284
- // ../../node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/websocket.js
68388
+ // ../../node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/websocket.js
68285
68389
  var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
68286
68390
  const EventEmitter = __require("events");
68287
68391
  const https = __require("https");
@@ -68354,12 +68458,15 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
68354
68458
  else protocols = [options.protocols];
68355
68459
  } else protocols = [protocols];
68356
68460
  }
68357
- initAsClient(this, address, protocols, options);
68358
- } else {
68359
- this._autoPong = options.autoPong;
68360
- this._closeTimeout = options.closeTimeout;
68361
- this._isServer = true;
68461
+ options = initAsClient(this, address, protocols, options);
68462
+ } else this._isServer = true;
68463
+ if (options.autoPong) {
68464
+ this._autoPong = true;
68465
+ this._autoPongComplete = () => autoPongComplete(this);
68466
+ this._pendingAutoPongs = 0;
68467
+ this._maxPendingAutoPongs = options.maxPendingAutoPongs | 0;
68362
68468
  }
68469
+ this._closeTimeout = options.closeTimeout;
68363
68470
  }
68364
68471
  /**
68365
68472
  * For historical reasons, the custom "nodebuffer" type is used by the default
@@ -68800,6 +68907,8 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
68800
68907
  * fragments
68801
68908
  * @param {Number} [options.maxPayload=104857600] The maximum allowed message
68802
68909
  * size
68910
+ * @param {Number} [options.maxPendingAutoPongs=60] The maximum number of
68911
+ * pending automatic pongs
68803
68912
  * @param {Number} [options.maxRedirects=10] The maximum number of redirects
68804
68913
  * allowed
68805
68914
  * @param {String} [options.origin] Value of the `Origin` or
@@ -68810,6 +68919,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
68810
68919
  * `Sec-WebSocket-Version` header
68811
68920
  * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
68812
68921
  * not to skip UTF-8 validation for text and close messages
68922
+ * @return {Object} The resolved options object used for initialization
68813
68923
  * @private
68814
68924
  */
68815
68925
  function initAsClient(websocket, address, protocols, options) {
@@ -68821,6 +68931,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
68821
68931
  maxBufferedChunks: 262144,
68822
68932
  maxFragments: 16384,
68823
68933
  maxPayload: 104857600,
68934
+ maxPendingAutoPongs: 60,
68824
68935
  skipUTF8Validation: false,
68825
68936
  perMessageDeflate: true,
68826
68937
  followRedirects: false,
@@ -68836,8 +68947,6 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
68836
68947
  path: void 0,
68837
68948
  port: void 0
68838
68949
  };
68839
- websocket._autoPong = opts.autoPong;
68840
- websocket._closeTimeout = opts.closeTimeout;
68841
68950
  if (!protocolVersions.includes(opts.protocolVersion)) throw new RangeError(`Unsupported protocol version: ${opts.protocolVersion} (supported versions: ${protocolVersions.join(", ")})`);
68842
68951
  let parsedUrl;
68843
68952
  if (address instanceof URL) parsedUrl = address;
@@ -69027,6 +69136,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
69027
69136
  });
69028
69137
  if (opts.finishRequest) opts.finishRequest(req, websocket);
69029
69138
  else req.end();
69139
+ return opts;
69030
69140
  }
69031
69141
  /**
69032
69142
  * Emit the `'error'` and `'close'` events.
@@ -69183,10 +69293,25 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
69183
69293
  */
69184
69294
  function receiverOnPing(data) {
69185
69295
  const websocket = this[kWebSocket];
69186
- if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP);
69296
+ if (websocket._autoPong && websocket.readyState === WebSocket.OPEN) {
69297
+ if (websocket._maxPendingAutoPongs > 0 && websocket._pendingAutoPongs >= websocket._maxPendingAutoPongs) websocket.terminate();
69298
+ else {
69299
+ websocket._pendingAutoPongs++;
69300
+ websocket.pong(data, !this._isServer, websocket._autoPongComplete);
69301
+ }
69302
+ }
69187
69303
  websocket.emit("ping", data);
69188
69304
  }
69189
69305
  /**
69306
+ * The callback for automatic pong responses.
69307
+ *
69308
+ * @param {WebSocket} websocket The WebSocket instance
69309
+ * @private
69310
+ */
69311
+ function autoPongComplete(websocket) {
69312
+ websocket._pendingAutoPongs--;
69313
+ }
69314
+ /**
69190
69315
  * The listener of the `Receiver` `'pong'` event.
69191
69316
  *
69192
69317
  * @param {Buffer} data The data included in the pong frame
@@ -69291,7 +69416,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
69291
69416
  }
69292
69417
  }
69293
69418
  }));
69294
- // ../../node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/stream.js
69419
+ // ../../node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/stream.js
69295
69420
  var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
69296
69421
  require_websocket();
69297
69422
  const { Duplex } = __require("stream");
@@ -69406,7 +69531,7 @@ var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
69406
69531
  }
69407
69532
  module.exports = createWebSocketStream;
69408
69533
  }));
69409
- // ../../node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/subprotocol.js
69534
+ // ../../node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/subprotocol.js
69410
69535
  var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
69411
69536
  const { tokenChars } = require_validation();
69412
69537
  /**
@@ -69444,7 +69569,7 @@ var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
69444
69569
  }
69445
69570
  module.exports = { parse };
69446
69571
  }));
69447
- // ../../node_modules/.pnpm/ws@8.22.2/node_modules/ws/lib/websocket-server.js
69572
+ // ../../node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/websocket-server.js
69448
69573
  var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module) => {
69449
69574
  const EventEmitter = __require("events");
69450
69575
  const http = __require("http");
@@ -69489,6 +69614,8 @@ var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module)
69489
69614
  * fragments
69490
69615
  * @param {Number} [options.maxPayload=104857600] The maximum allowed message
69491
69616
  * size
69617
+ * @param {Number} [options.maxPendingAutoPongs=60] The maximum number of
69618
+ * pending automatic pongs
69492
69619
  * @param {Boolean} [options.noServer=false] Enable no server mode
69493
69620
  * @param {String} [options.path] Accept only connections matching this path
69494
69621
  * @param {(Boolean|Object)} [options.perMessageDeflate=false] Enable/disable
@@ -69511,6 +69638,7 @@ var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module)
69511
69638
  maxBufferedChunks: 262144,
69512
69639
  maxFragments: 16384,
69513
69640
  maxPayload: 104857600,
69641
+ maxPendingAutoPongs: 60,
69514
69642
  skipUTF8Validation: false,
69515
69643
  perMessageDeflate: false,
69516
69644
  handleProtocols: null,
@@ -108670,7 +108798,7 @@ const findOneOption = (options) => {
108670
108798
  // ../../packages/runtime/src/server/store.ts
108671
108799
  const checkoutRoot = fnUntraced(function* (directory) {
108672
108800
  const path = yield* Path$1;
108673
- if (getOrElse(yield* option$1((yield* FileSystem).exists(path.join(directory, "pnpm-workspace.yaml"))), constFalse$1)) return some$1(directory);
108801
+ if (yield* (yield* FileSystem).exists(path.join(directory, "pnpm-workspace.yaml"))) return some$1(directory);
108674
108802
  if (path.dirname(directory) === directory) return none();
108675
108803
  return yield* checkoutRoot(path.dirname(directory));
108676
108804
  });
@@ -108961,16 +109089,27 @@ const updateRelease = fnUntraced(function* (name) {
108961
109089
  "--registry=https://registry.npmjs.org",
108962
109090
  `@deslop/${name}@${latest}`
108963
109091
  ]), "5 minutes");
108964
- const previous = yield* option$1(fs.readLink(path.join(root, "current")));
108965
- yield* activateRelease(name, path.join(directory, "node_modules", "@deslop", name));
108966
- yield* restartService(name);
108967
- const kept = [latest, ...toArray(map$13(previous, (link) => path.basename(path.resolve(link, "../../.."))))];
109092
+ const previous = yield* fs.readLink(path.join(root, "current"));
109093
+ yield* uninterruptible(gen(function* () {
109094
+ yield* activateRelease(name, path.join(directory, "node_modules", "@deslop", name));
109095
+ const restarted = yield* exit(restartService(name));
109096
+ if (isSuccess(restarted)) return;
109097
+ const restored = yield* exit(activateRelease(name, previous));
109098
+ return yield* AppError.make({
109099
+ cause: restarted.cause,
109100
+ message: `Restart failed: ${pretty(restarted.cause)}. ${match$3(restored, {
109101
+ onFailure: (cause) => `The previous current link could not be restored: ${pretty(cause)}`,
109102
+ onSuccess: constant("The previous current link was restored; service state is unknown")
109103
+ })}`
109104
+ });
109105
+ }));
109106
+ const kept = [latest, path.basename(path.resolve(root, previous, "../../.."))];
108968
109107
  yield* pipe(yield* fs.readDirectory(path.join(root, "releases")), difference(kept), forEach$1((entry) => fs.remove(path.join(root, "releases", entry), { recursive: true }), { concurrency: 1 }));
108969
109108
  return `Updated ${name} from ${running} to ${latest}\n`;
108970
109109
  });
108971
109110
  // ../../packages/runtime/src/server/cli.ts
108972
109111
  const DEFAULT_HOST = "127.0.0.1";
108973
- const TailnetSelf = Struct$2({ Self: Struct$2({ DNSName: String$6 }) });
109112
+ const TailnetSelf = Struct$2({ Self: Struct$2({ DNSName: NonEmptyString }) });
108974
109113
  const SETTINGS = {
108975
109114
  DOMAIN: {
108976
109115
  description: "Parent domain for Deslop apps; without it every caller is the developer",
@@ -108986,13 +109125,9 @@ const SETTINGS = {
108986
109125
  const configProvider = fnUntraced(function* (given, defaultPort) {
108987
109126
  const port = given["PORT"] ?? `${defaultPort}`;
108988
109127
  const name = yield* appName;
108989
- const tailnet = yield* pipe(executeProcess("tailscale", ["status", "--json"]), flatMap$3(decodeUnknownEffect(fromJsonString(TailnetSelf))), map$7((status) => replace(/\.$/u, "")(status.Self.DNSName)), timeout("5 seconds"), option$1);
108990
- const urls = match$8(fromUndefinedOr(given["DOMAIN"]), {
108991
- onNone: () => ({ APP_URL: pipe(tailnet, filter$9(isNonEmpty$1), match$8({
108992
- onNone: () => `http://localhost:${port}`,
108993
- onSome: (host) => `https://${host}:${port}`
108994
- })) }),
108995
- onSome: (domain) => ({
109128
+ const urls = yield* match$8(fromUndefinedOr(given["DOMAIN"]), {
109129
+ onNone: () => pipe(executeProcess("tailscale", ["status", "--json"]), flatMap$3(decodeUnknownEffect(fromJsonString(TailnetSelf))), map$7((status) => ({ APP_URL: `https://${replace(/\.$/u, "")(status.Self.DNSName)}:${port}` })), timeout("5 seconds")),
109130
+ onSome: (domain) => succeed$5({
108996
109131
  APP_URL: `https://${name}.${domain}`,
108997
109132
  AUTH_URL: `https://auth.${domain}`,
108998
109133
  GATEWAY_URL: `https://gateway.${domain}`,
@@ -109058,7 +109193,7 @@ function runApp(app) {
109058
109193
  return pipe(String$1(setting.flag), withSchema(setting.schema), withFallbackConfig(schema(setting.schema, env)), withDescription(`${setting.description} [${env}]`), optional);
109059
109194
  }));
109060
109195
  const given = map$7(root, (input) => getSomes$1(input));
109061
- return yield* pipe(root, withHandler((input) => flatMap$3(configProvider(getSomes$1(input), metadata.config.port), (values) => provideService$2(server(app), ConfigProvider, values))), withSubcommands([withSubcommands(make$11("service"), [
109196
+ return yield* pipe(root, withHandler((input) => provideServiceEffect(server(app), ConfigProvider, configProvider(getSomes$1(input), metadata.config.port))), withSubcommands([withSubcommands(make$11("service"), [
109062
109197
  make$11("install", {}, fnUntraced(function* () {
109063
109198
  const fs = yield* FileSystem;
109064
109199
  const path = yield* Path$1;
@@ -109623,6 +109758,31 @@ const ROLE_ORDER = {
109623
109758
  function isAdmin(admins, id) {
109624
109759
  return some(admins, (admin) => `github:${admin}` === id);
109625
109760
  }
109761
+ const authorizeMember = fnUntraced(function* (admins, id, row) {
109762
+ if (isAdmin(admins, id)) return {
109763
+ admin: true,
109764
+ id,
109765
+ name: match$8(row, {
109766
+ onNone: () => id,
109767
+ onSome: (member) => member.name
109768
+ })
109769
+ };
109770
+ if (!exists(row, (member) => member.status === "Allowed")) return yield* AuthError.make({
109771
+ error: "access_denied",
109772
+ message: "An admin has not allowed this account yet"
109773
+ });
109774
+ return yield* match$8(row, {
109775
+ onNone: () => fail$6(AuthError.make({
109776
+ error: "access_denied",
109777
+ message: "This account was removed"
109778
+ })),
109779
+ onSome: (member) => succeed$5({
109780
+ admin: false,
109781
+ id: member.id,
109782
+ name: member.name
109783
+ })
109784
+ });
109785
+ });
109626
109786
  function roleOf(admins, id, row) {
109627
109787
  if (isAdmin(admins, id)) return "Admin";
109628
109788
  if (exists(row, (found) => found.status === "Allowed")) return "Member";
@@ -109719,30 +109879,7 @@ var People = class People extends Service$1()("@deslop/auth/services/people/serv
109719
109879
  }));
109720
109880
  }, mutate, sql.withTransaction, asAuthError("Cannot answer the access request")),
109721
109881
  allowed: fn("People.allowed")(function* (id) {
109722
- const row = yield* find(id);
109723
- if (isAdmin(admins, id)) return {
109724
- admin: true,
109725
- id,
109726
- name: match$8(row, {
109727
- onNone: () => id,
109728
- onSome: (member) => member.name
109729
- })
109730
- };
109731
- if (!exists(row, (member) => member.status === "Allowed")) return yield* AuthError.make({
109732
- error: "access_denied",
109733
- message: "An admin has not allowed this account yet"
109734
- });
109735
- return yield* match$8(row, {
109736
- onNone: () => fail$6(AuthError.make({
109737
- error: "access_denied",
109738
- message: "This account was removed"
109739
- })),
109740
- onSome: (member) => succeed$5({
109741
- admin: false,
109742
- id: member.id,
109743
- name: member.name
109744
- })
109745
- });
109882
+ return yield* authorizeMember(admins, id, yield* find(id));
109746
109883
  }, asAuthError("Cannot read the account")),
109747
109884
  find,
109748
109885
  list: fn("People.list")(function* (user) {
@@ -109761,7 +109898,8 @@ var People = class People extends Service$1()("@deslop/auth/services/people/serv
109761
109898
  onFalse: constant("Waiting"),
109762
109899
  onTrue: constant("Allowed")
109763
109900
  });
109764
- if (exists(yield* find(user.id), (member) => member.name === user.name && getOrUndefined$1(member.fullName) === getOrUndefined$1(fullName) && (status === "Waiting" || member.status === "Allowed"))) return yield* existing(user.id);
109901
+ const row = yield* find(user.id);
109902
+ if (exists(row, (member) => member.name === user.name && getOrUndefined$1(member.fullName) === getOrUndefined$1(fullName) && (status === "Waiting" || member.status === "Allowed"))) return yield* fromOption(row);
109765
109903
  yield* mutate(sql`INSERT INTO ${table} (id, name, fullName, since, status) VALUES (${user.id}, ${user.name}, ${getOrUndefined$1(filter$9(fullName, isNonEmpty$1))}, ${toEpochMillis(yield* now)}, ${status}) ON CONFLICT (id) DO UPDATE SET name = excluded.name, fullName = excluded.fullName, status = CASE WHEN excluded.status = 'Allowed' THEN 'Allowed' ELSE ${table}.status END`);
109766
109904
  return yield* existing(user.id);
109767
109905
  }, sql.withTransaction, asAuthError("Cannot register the person")),
@@ -109851,7 +109989,7 @@ var Identity = class Identity extends Service$1()("@deslop/auth/services/identit
109851
109989
  onSome: tailnet
109852
109990
  }));
109853
109991
  }),
109854
- onSome: people.allowed
109992
+ onSome: (id) => succeed$5({ id })
109855
109993
  });
109856
109994
  if (!isTailnet(address)) return yield* AuthError.make({ message: "Sign in first" });
109857
109995
  const found = yield* get(whois, address);
@@ -109871,13 +110009,13 @@ var Identity = class Identity extends Service$1()("@deslop/auth/services/identit
109871
110009
  const role = roleOf(admins, identified.id, row);
109872
110010
  return {
109873
110011
  ...yield* match$8(row, {
109874
- onNone: () => people.allowed(identified.id),
110012
+ onNone: () => authorizeMember(admins, identified.id, row),
109875
110013
  onSome: (member) => {
109876
110014
  if (waiting && identified.signOut) return succeed$5({
109877
110015
  id: member.id,
109878
110016
  name: member.name
109879
110017
  });
109880
- return people.allowed(identified.id);
110018
+ return authorizeMember(admins, identified.id, row);
109881
110019
  }
109882
110020
  }),
109883
110021
  admin: role === "Admin",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deslop/auth",
3
- "version": "0.1.1342",
3
+ "version": "0.1.1345",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/MP281X/deslop.git",
@@ -33,5 +33,5 @@
33
33
  "engines": {
34
34
  "node": ">=26"
35
35
  },
36
- "fingerprint": "dac7315f76ee597393dd52d3bf865c79aff6479014fb4f64898b35f81877e05f"
36
+ "fingerprint": "09447988532e6ae559750249c8447a4853b64d92082d8b09c2ce0d1ee325fb48"
37
37
  }
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{a as t,i as n,o as r,r as i}from"./react-DLGSahv8.js";import{$ as a,$n as o,A as s,An as c,Ar as l,At as ee,Bn as te,Bt as u,C as d,Cr as f,D as ne,Dt as re,En as ie,Er as ae,Et as oe,Fn as p,Fr as m,Ft as se,G as ce,Gn as le,Hn as ue,Ht as de,In as fe,It as pe,J as me,Jn as he,Jt as ge,K as h,L as _e,Ln as ve,Lt as g,M as ye,Mn as be,Mt as xe,N as Se,Nn as Ce,Nr as we,Nt as Te,O as Ee,Ot as De,P as Oe,Pn as ke,Pr as Ae,Pt as je,Q as _,Qn as Me,R as Ne,Rn as Pe,Rt as Fe,S as Ie,Sn as Le,Sr as v,St as Re,T as y,Tr as b,Tt as ze,U as Be,Un as Ve,Ut as He,Vn as Ue,Vt as We,W as x,Wn as S,Wt as Ge,X as Ke,Xn as qe,Y as Je,Yn as Ye,Z as C,Zt as w,_ as T,_n as Xe,_r as Ze,_t as Qe,a as $e,an as et,at as tt,b as nt,bn as rt,br as it,c as at,cr as ot,ct as E,d as D,dr as O,dt as st,en as k,et as A,f as ct,fr as j,ft as lt,g as ut,gt as M,h as dt,hn as ft,ht as pt,i as N,in as mt,ir as ht,it as gt,jn as _t,jt as vt,k as yt,kn as bt,kt as xt,l as St,ln as Ct,lr as wt,lt as Tt,m as Et,mn as Dt,mr as Ot,n as kt,nn as At,nt as P,o as jt,ot as Mt,p as Nt,pn as F,pr as Pt,q as Ft,qn as It,qt as Lt,r as Rt,rn as zt,rt as I,s as Bt,sn as Vt,sr as L,t as R,tn as Ht,tt as Ut,u as Wt,ur as Gt,ut as z,v as Kt,vn as qt,vr as Jt,w as Yt,wr as Xt,wt as Zt,x as Qt,xn as $t,xr as en,y as tn,yn as nn,yr as rn,z as an,zn as on,zt as B}from"./effect-BD4CYwmk.js";import{l as sn,r as cn,t as ln}from"./dist-BPRUA1hI.js";var V=e(r(),1),un=e(n(),1);function dn(e){let t=un.unstable_scheduleCallback(4,e);return()=>un.unstable_cancelCallback(t)}var H=V.createContext(Oe({scheduleTask:dn,defaultIdleTTL:400})),fn=new WeakMap,U=0,W=new Set;function pn(e){U++;try{return e()}finally{U--}}function mn(e){if(U===0)return e();W.size===0&&queueMicrotask(G),W.add(e)}function G(){for(let e of W)W.delete(e),e()}function hn(e,t){let n=fn.get(e);n===void 0&&(n=new WeakMap,fn.set(e,n));let r=n.get(t);if(r!==void 0)return r;let i=0,a,o={subscribe(n){i++;let r=e.subscribe(t,()=>mn(n));return()=>{i--,W.delete(n),r()}},snapshot(){return pn(()=>e.get(t))},getServerSnapshot(){return(i===0||a===void 0)&&(a={value:pn(()=>yt(t,e))}),a.value}};return n.set(t,o),o}function K(e,t){let n=hn(e,t);return V.useEffect(G),V.useSyncExternalStore(n.subscribe,n.snapshot,n.getServerSnapshot)}function gn(e,t,n){let r=hn(e,t),i=V.useMemo(()=>{let e;return t=>(e!==void 0&&Object.is(e.source,t)||(e={source:t,value:n(t)}),e.value)},[n]);return V.useEffect(G),V.useSyncExternalStore(r.subscribe,()=>i(r.snapshot()),()=>i(r.getServerSnapshot()))}var _n=(e,t)=>{let n=V.useContext(H);return t?gn(n,e,t):K(n,e)};function vn(e,t){V.useEffect(()=>e.mount(t),[t,e])}function yn(e,t,n){return n?.mode===`promise`||n?.mode===`promiseExit`?V.useCallback(r=>{e.set(t,r);let i=Ct(Se(e,t,{suspendOnWaiting:!0}));return n.mode===`promise`?i.then(bn):i},[e,t,n.mode]):V.useCallback(n=>{e.set(t,typeof n==`function`?n(e.get(t)):n)},[e,t])}var bn=e=>{if(te(e))return e.value;throw le(e.cause)},xn=e=>{vn(V.useContext(H),e)},Sn=e=>{let t=V.useContext(H);return vn(t,e),V.useCallback(()=>{t.refresh(e)},[t,e])},Cn=(e,t)=>{let n=V.useContext(H);return[K(n,e),yn(n,e,t)]},wn={suspendOnWaiting:new WeakMap,default:new WeakMap};function Tn(e,t,n){let r=n?wn.suspendOnWaiting:wn.default,i=r.get(e);i===void 0&&(i=new WeakMap,r.set(e,i));let a=i.get(t);return a===void 0&&(a=new Promise(r=>{let a=e.subscribe(t,e=>{e._tag===`Initial`||n&&e.waiting||(setTimeout(a,1e3),r(),i.delete(t))})}),i.set(t,a)),a}function En(e,t,n){let r=K(e,t);if(r._tag===`Initial`||n&&r.waiting)throw Tn(e,t,n);return r}var Dn=(e,t)=>{let n=En(V.useContext(H),e,t?.suspendOnWaiting??!1);if(n._tag===`Failure`&&!t?.includeFailure)throw le(n.cause);return n},On=t(),kn=i(),q=class extends gt()(`AuthError`,{cause:st(Ft()),error:lt(C([`access_denied`,`temporarily_unavailable`])),message:P}){get name(){return this.error===`temporarily_unavailable`?`AuthUnavailable`:`AuthError`}},J=m(_,tt(`UserId`)),An=m(Ke,tt(`GitHubId`));m(Je,Mt(An));var Y=I({admin:x,id:J,name:_});I({address:A(_),onBehalfOf:A(J),session:A(_)}),J.make(`github:0`);function jn(e){return`${new URL(e).origin}/auth/sign-in?${new URLSearchParams({next:e})}`}function Mn(e){return E(q)(e)&&e.error===void 0}function X(e){return E(q)(e)&&e.error!==`temporarily_unavailable`}wt()(`@deslop/runtime/shared/auth/CurrentUser`);var Nn=class extends N()(`@deslop/runtime/shared/auth/RpcAuth`,{error:q}){},Pn=P.check(z(e=>O(L(y(e)),e=>It([`http:`,`https:`],e.protocol)&&e.username===``&&e.password===``&&e.hash===``),{expected:`an HTTP(S) URL without credentials or a fragment`})).check(z(e=>O(L(y(e)),e=>e.pathname===`/`&&e.search===``),{expected:`an HTTP(S) origin without a path or query`}));Pn.check(z(e=>O(L(y(e)),e=>e.protocol===`https:`||It([`localhost`,`127.0.0.1`,`[::1]`],e.hostname)),{expected:`HTTPS outside loopback`})),P.check(Tt(/^\d{1,5}$/u),z(e=>O(bt(e),e=>e>=1&&e<=65535),{expected:`a port between 1 and 65535`}));var Fn=P.check(Tt(/^0\.1\.\d+$/u)),In=`/api/runtime`,Ln=I({auth:A(Pn),name:P,traces:P,version:Fn}),Rn=`/api/rpc`,zn=I({...Y.fields,signOut:x});I({config:I({port:Ke}),name:P,version:Fn}),C([`web`,`mobile`,`server`]);function Bn(e,t,n,r){return _t(on(k(function*(){let i=`${yield*c}`,a=yield*Qe,o={attributes:{"scope.run.started_unix_nano":i,"scope.runtime":n,"service.instance.id":i},serviceName:e,serviceVersion:Ze(it(r,e=>e!==`0.1.0`))};return p(ke(Bt({resource:o,url:new URL(`/v1/traces`,t).href}),at({resource:o,url:new URL(`/v1/logs`,t).href}),ve(Qe,[...a,`code`,`state`,`request`,`access_token`,`refresh_token`,`id_token`,`client_secret`,`client_assertion`,`code_verifier`,`session`,`token`])),[St,D])})),e=>Ve(e)?be(Ht):be(zt(`Telemetry is unavailable`)))}function Vn(e){return on(k(function*(){let t=yield*m((yield*Qt).get(In),w(d),w(Yt(Ln)),ft(`3 seconds`),Dt(e=>zt(`Telemetry is off: the runtime config did not load`,e)),et);return v(t,{onNone:()=>Ce,onSome:t=>t.traces===``?Ce:Bn(`${e}-client`,t.traces,`web`,t.version)})}))}var Z=class extends N()(`@deslop/runtime/shared/rpc/RpcStream`){};ve(Z,Z.of((e,t)=>Kt(t.rpc.successSchema)?He(Ge(`rpc.stream`,!0),e):e));var Hn=$e(Z,e=>k(function*(){return Kt(e.rpc.successSchema)&&(yield*Ge(`rpc.stream`,!0)),yield*e.next(e.request)}));function Un(e,t=nt){return m(Nt({pingTimeout:`15 seconds`,retryTransientErrors:!0}),p(p(tn(e),t)),fe(Et()),fe(Hn))}var Q=B(f());C([`route`,`caught`,`uncaught`]);var Wn=Ee(e=>{let t=At(`Web error`,Ue(e.error),...ae(Ot(e.stack)));return v(g(Q),{onNone:()=>t,onSome:n=>Vt(m(t,He(Lt(e.error)),qt(`Web.error`,{attributes:{"web.error.source":e.source,"web.route.id":e.route},root:!0}),ge),n)})}),Gn=ye(D).atom(m(Ie(`/api/account`),w(d),w(Yt(zn)))),Kn=Un(F(()=>`${location.origin}${Rn}`));function qn(e){ye.addGlobalLayer(m(Vn(e),p(D),Pe(e=>Jt(Gt(e,Wt))?Xe:de(F(()=>u(Q,b(e))),()=>F(()=>We(Q,j(t=>t!==e)))))))}function Jn(e){return ht(e.reasons,e=>S(e)&&X(e.error))}function Yn(e){return!an(e)||!Jn(e.cause)&&rn(e.previousSuccess)?f():b(e.cause)}function Xn(e,t,n=Ae){function r(e){let t=Ye(e.reasons,e=>S(e)&&X(e.error));return Me(t)?f():b(ue(t))}let i=B(m(e.self(),j(an),Pt(e=>r(e.cause))));function a(e){return v(g(i),{onNone:()=>e,onSome:t=>ue([...t.reasons,...Ye(e.reasons,e=>!S(e)||!X(e.error))])})}let o=B(0),s=se(t,t=>F(()=>{We(i,e=>Xt(r(t),()=>e));let n=a(t);rn(g(i))?e.setSelf(_e(n)):Fe(o)<2||e.setSelf(Ne(n,{previous:e.self()}))}));return m(n(s),je(()=>F(()=>{u(i,f()),u(o,0)})),ze(e=>xt(a(e))),re(Te(()=>v(g(i),{onNone:()=>De,onSome:xt}))))}function Zn(e){return xe(e,e=>rt(e(nn(`1 second`)),e=>E(q)(e.input)?e.input.error===`temporarily_unavailable`:E(ut)(e.input)&&!E(dt)(e.input.reason)))}function Qn(e,t,n){return pe(mt(e,e=>e(t,n)))}function $n(e,t,n){return e.runtime.atom(r=>Xn(r,pe(mt(e,e=>e(t,n))),Zn))}var er=V.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:ee}=sn({disabled:i,focusableWhenDisabled:a,native:o});return cn(`button`,e,{state:{disabled:i},ref:[t,ee],props:[c,l]})});function tr(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=tr(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function nr(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=tr(e))&&(r&&(r+=` `),r+=t);return r}var rr=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,ir=nr,ar=(e,t)=>n=>{if(t?.variants==null)return ir(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=rr(t)||rr(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return ir(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},or=ar(`group/button inline-flex shrink-0 items-center justify-center rounded-none border border-transparent bg-clip-padding text-xs font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-none px-2 text-xs has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-7 gap-1 rounded-none px-2.5 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-8`,"icon-xs":`size-6 rounded-none [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-7 rounded-none`,"icon-lg":`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function sr(e){let t=(0,On.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,variant:i,size:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`default`:i,s=a===void 0?`default`:a,c;t[5]!==n||t[6]!==s||t[7]!==o?(c=ln(or({variant:o,size:s,className:n})),t[5]=n,t[6]=s,t[7]=o,t[8]=c):c=t[8];let l;return t[9]!==r||t[10]!==c?(l=(0,kn.jsx)(er,{"data-slot":`button`,className:c,...r}),t[9]=r,t[10]=c,t[11]=l):l=t[11],l}C([`iPhone`,`iPad`,`Android`,`Mac`,`Windows`,`Linux`]);var cr=class extends R(`CookieSession`)({address:kt(P),browser:P,createdAt:h,id:P,lastSeenAt:h,userId:J}){static table=`cookie_sessions`},lr=class extends R(`ListedSession`)({...pt(Rt(cr),[`address`,`browser`,`id`,`lastSeenAt`]),current:x}){},ur=C([`Admin`,`Member`,`Waiting`]),dr=I({...Y.fields,fullName:A(P),role:ur}),fr=I({...dr.fields,signOut:x}),pr=I({...dr.fields,since:m(me,Mt(a(ce),{decode:M(e=>m(e,it(e=>e!==0),en(Re))),encode:M(e=>v(e,{onNone:we(0),onSome:Zt}))}))}),mr=C([`Waiting`,`Allowed`]);R(`Member`)({fullName:kt(P),id:Y.fields.id,name:Y.fields.name,since:h,status:mr}),I({id:An,login:_,name:Ut(P)});var hr=I({allow:x,id:J}),gr=class extends jt(T(`people.watch`,{error:q,stream:!0,success:Be(pr)}),T(`people.admit`,{error:q,payload:hr,success:pr}),T(`sessions.watch`,{error:q,stream:!0,success:Be(lr)})).middleware(Nn).merge(jt(T(`people.account`,{error:q,stream:!0,success:fr}))){},_r=[{name:`iPhone`,token:`iPhone`},{name:`iPad`,token:`iPad`},{name:`Android`,token:`Android`},{name:`Mac`,token:`Macintosh`},{name:`Windows`,token:`Windows`},{name:`Linux`,token:`Linux`}],vr=[{name:`Edge`,tokens:[`Edg/`,`EdgA/`,`EdgiOS/`]},{name:`Opera`,tokens:[`OPR/`]},{name:`Firefox`,tokens:[`Firefox/`,`FxiOS/`]},{name:`Chrome`,tokens:[`Chrome/`,`CriOS/`]},{name:`Safari`,tokens:[`Safari/`]}];function yr(e){return m(new URL(e).hostname,ie(`.`),he(1),o(`.`))}function br(e,t,n){return ot(y(e),{onFailure:l,onSuccess:e=>e.username!==``||e.password!==``?!1:n?e.origin===new URL(t).origin:e.protocol===`https:`&&(e.hostname===yr(t)||$t(`.${yr(t)}`)(e.hostname))})}function xr(e){return m(_r,qe(t=>Le(t.token)(e)),en(e=>e.name))}function Sr(e){return m(vr,qe(t=>ht(t.tokens,t=>Le(t)(e))),v({onNone:we(`Browser`),onSome:e=>e.name}))}var Cr=I({error:A(P),next:A(P)});qn(`@deslop/auth`);var $=class extends ct()(`@deslop/auth/lib/auth/RpcClient`,{group:gr.middleware(Z),protocol:Kn}){},wr=s($.runtime.atom(m(Qn($,`people.account`),Zn,je(e=>F(()=>{let t=new URL(location.href).searchParams.get(`next`);e.role!==`Waiting`&&t!==null&&br(t,location.origin,location.protocol===`http:`)&&location.assign(t)})),vt(b),oe(`AuthError`,()=>ee(f()))))),Tr=s($n($,`people.watch`)),Er=s($n($,`sessions.watch`)),Dr=ne(e=>$.runtime.fn(t=>w($,n=>n(`people.admit`,{allow:t,id:e}))));export{dn as C,H as S,Cn as _,Er as a,Dn as b,sr as c,Gn as d,Wn as f,jn as g,Mn as h,Tr as i,ar as l,X as m,wr as n,Sr as o,zn as p,Dr as r,xr as s,Cr as t,Yn as u,xn as v,_n as x,Sn as y};
@@ -1 +0,0 @@
1
- import"./rolldown-runtime-XKyaHtl9.js";import{a as e,o as t,r as n}from"./react-DLGSahv8.js";import{Kn as r,Mr as i,Nr as a,On as o,Sr as s,Z as c,bt as l,hr as u,rr as d,tr as f,vt as p,xt as m,yt as h}from"./effect-BD4CYwmk.js";import{t as g}from"./dist-BPRUA1hI.js";var _=e(),v=n();function y(e){let t=(0,_.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=g(`animate-pulse rounded-none bg-muted`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,v.jsx)(`div`,{"data-slot":`skeleton`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}t();function b(e){let t=(0,_.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=g(`w-full caption-bottom text-xs`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,v.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,v.jsx)(`table`,{"data-slot":`table`,className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function x(e){let t=(0,_.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=g(`[&_tr:last-child]:border-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,v.jsx)(`tbody`,{"data-slot":`table-body`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function S(e){let t=(0,_.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=g(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,v.jsx)(`tr`,{"data-slot":`table-row`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function C(e){let t=(0,_.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=g(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,v.jsx)(`td`,{"data-slot":`table-cell`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function w(e){let t=(0,_.c)(6),n;t[0]===e.label?n=t[1]:(n=s(u(e.label),{onNone:i,onSome:a(`img`)}),t[0]=e.label,t[1]=n);let r;return t[2]!==e.children||t[3]!==e.label||t[4]!==n?(r=(0,v.jsx)(`span`,{role:n,"aria-label":e.label,title:e.label,className:`flex size-6 shrink-0 items-center justify-center`,children:e.children}),t[2]=e.children,t[3]=e.label,t[4]=n,t[5]=r):r=t[5],r}function T(e){let t=(0,_.c)(16),n=`${(e.depth??0)*.75}rem`,r;t[0]===n?r=t[1]:(r={"--indent":n},t[0]=n,t[1]=r);let i;t[2]!==e.mark||t[3]!==e.markLabel?(i=e.mark!==void 0&&(0,v.jsx)(w,{label:e.markLabel,children:e.mark}),t[2]=e.mark,t[3]=e.markLabel,t[4]=i):i=t[4];let a;t[5]===e.children?a=t[6]:(a=(0,v.jsx)(`span`,{className:`truncate`,children:e.children}),t[5]=e.children,t[6]=a);let o;t[7]===e.detail?o=t[8]:(o=e.detail!==void 0&&(0,v.jsx)(`span`,{className:`text-muted-foreground grow basis-0 truncate`,children:e.detail}),t[7]=e.detail,t[8]=o);let s;return t[9]!==e.after||t[10]!==e.title||t[11]!==r||t[12]!==i||t[13]!==a||t[14]!==o?(s=(0,v.jsx)(C,{className:`w-full`,children:(0,v.jsxs)(`span`,{className:`flex h-6 w-0 min-w-full items-center gap-2 ps-(--indent)`,style:r,title:e.title,children:[i,a,e.after,o]})}),t[9]=e.after,t[10]=e.title,t[11]=r,t[12]=i,t[13]=a,t[14]=o,t[15]=s):s=t[15],s}function E(e){let t=(0,_.c)(6),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,v.jsxs)(`span`,{className:`flex w-full items-center gap-2`,children:[(0,v.jsx)(y,{className:`size-6`}),(0,v.jsx)(y,{className:`h-4 w-1/3`})]}),t[0]=n):n=t[0];let r;t[1]===e.columns?r=t[2]:(r=(0,v.jsx)(C,{colSpan:e.columns,children:n}),t[1]=e.columns,t[2]=r);let i;return t[3]!==e.label||t[4]!==r?(i=(0,v.jsx)(S,{"aria-busy":`true`,"aria-label":e.label,children:r}),t[3]=e.label,t[4]=r,t[5]=i):i=t[5],i}function D(e){let t=(0,_.c)(10),n=e.label,r;if(t[0]!==e.label||t[1]!==e.rows){let n;t[3]===e.label?n=t[4]:(n=t=>(0,v.jsx)(E,{label:e.label},t),t[3]=e.label,t[4]=n),r=f(d(1,e.rows),n),t[0]=e.label,t[1]=e.rows,t[2]=r}else r=t[2];let i;t[5]===r?i=t[6]:(i=(0,v.jsx)(x,{children:r}),t[5]=r,t[6]=i);let a;return t[7]!==e.label||t[8]!==i?(a=(0,v.jsx)(b,{"aria-busy":`true`,"aria-label":n,children:i}),t[7]=e.label,t[8]=i,t[9]=a):a=t[9],a}var O=`en-GB`,k=`en`;c([`millisecond`,`minute`,`second`]),new Intl.NumberFormat(k,{maximumFractionDigits:0}),new Intl.NumberFormat(k,{maximumFractionDigits:1,notation:`compact`}),new Intl.NumberFormat(k,{maximumFractionDigits:1}),new Intl.NumberFormat(k,{currency:`USD`,maximumFractionDigits:2,minimumFractionDigits:2,style:`currency`});function A(e,t){return m(e)?h(e,{...t,locale:O}):l(e,{...t,locale:O})}function j(e,t){let n=o(0,Math.floor(r(p(e,t))));return n<1?`now`:n<60?`${n}m`:n<1440?`${Math.floor(n/60)}h`:`${Math.floor(n/1440)}d`}function M(e){return A(e,{month:`short`,year:`numeric`})}export{b as a,S as c,T as i,M as n,x as o,D as r,C as s,j as t};