@deslop/auth 0.1.1343 → 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 +105 -22
- package/package.json +2 -2
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())));
|
|
@@ -19859,6 +19861,63 @@ const updateService = updateService$1;
|
|
|
19859
19861
|
*/
|
|
19860
19862
|
const provideService$2 = provideService$3;
|
|
19861
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
|
+
/**
|
|
19862
19921
|
* Returns the current scope for resource management.
|
|
19863
19922
|
*
|
|
19864
19923
|
* **Example** (Accessing the current scope)
|
|
@@ -66280,7 +66339,7 @@ const fromDuplex = (open, options) => withFiber((fiber) => {
|
|
|
66280
66339
|
writer
|
|
66281
66340
|
}));
|
|
66282
66341
|
});
|
|
66283
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
66342
|
+
// ../../node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/constants.js
|
|
66284
66343
|
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
66285
66344
|
const BINARY_TYPES = [
|
|
66286
66345
|
"nodebuffer",
|
|
@@ -66302,7 +66361,7 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
66302
66361
|
NOOP: () => {}
|
|
66303
66362
|
};
|
|
66304
66363
|
}));
|
|
66305
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
66364
|
+
// ../../node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/buffer-util.js
|
|
66306
66365
|
var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
66307
66366
|
const { websocketMask, websocketUnmask } = __require("http");
|
|
66308
66367
|
const { EMPTY_BUFFER } = require_constants();
|
|
@@ -66410,7 +66469,7 @@ var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
66410
66469
|
};
|
|
66411
66470
|
} catch (e) {}
|
|
66412
66471
|
}));
|
|
66413
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
66472
|
+
// ../../node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/limiter.js
|
|
66414
66473
|
var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
66415
66474
|
const kDone = Symbol("kDone");
|
|
66416
66475
|
const kRun = Symbol("kRun");
|
|
@@ -66460,7 +66519,7 @@ var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
66460
66519
|
};
|
|
66461
66520
|
module.exports = Limiter;
|
|
66462
66521
|
}));
|
|
66463
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
66522
|
+
// ../../node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/permessage-deflate.js
|
|
66464
66523
|
var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
66465
66524
|
const zlib = __require("zlib");
|
|
66466
66525
|
const bufferUtil = require_buffer_util();
|
|
@@ -66795,7 +66854,7 @@ var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module
|
|
|
66795
66854
|
this[kCallback](err);
|
|
66796
66855
|
}
|
|
66797
66856
|
}));
|
|
66798
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
66857
|
+
// ../../node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/validation.js
|
|
66799
66858
|
var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
66800
66859
|
const { isUtf8 } = __require("buffer");
|
|
66801
66860
|
const { hasBlob } = require_constants();
|
|
@@ -66990,7 +67049,7 @@ var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
66990
67049
|
};
|
|
66991
67050
|
} catch (e) {}
|
|
66992
67051
|
}));
|
|
66993
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
67052
|
+
// ../../node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/receiver.js
|
|
66994
67053
|
var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
66995
67054
|
const { Writable } = __require("stream");
|
|
66996
67055
|
const PerMessageDeflate = require_permessage_deflate();
|
|
@@ -67453,7 +67512,7 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
67453
67512
|
};
|
|
67454
67513
|
module.exports = Receiver;
|
|
67455
67514
|
}));
|
|
67456
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
67515
|
+
// ../../node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/sender.js
|
|
67457
67516
|
var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
67458
67517
|
const { Duplex } = __require("stream");
|
|
67459
67518
|
const { randomFillSync } = __require("crypto");
|
|
@@ -67951,7 +68010,7 @@ var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
67951
68010
|
sender.onerror(err);
|
|
67952
68011
|
}
|
|
67953
68012
|
}));
|
|
67954
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
68013
|
+
// ../../node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/event-target.js
|
|
67955
68014
|
var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
67956
68015
|
const { kForOnEventAttribute, kListener } = require_constants();
|
|
67957
68016
|
const kCode = Symbol("kCode");
|
|
@@ -68181,7 +68240,7 @@ var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
68181
68240
|
else listener.call(thisArg, event);
|
|
68182
68241
|
}
|
|
68183
68242
|
}));
|
|
68184
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
68243
|
+
// ../../node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/extension.js
|
|
68185
68244
|
var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
68186
68245
|
const { tokenChars } = require_validation();
|
|
68187
68246
|
/**
|
|
@@ -68326,7 +68385,7 @@ var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
68326
68385
|
parse
|
|
68327
68386
|
};
|
|
68328
68387
|
}));
|
|
68329
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
68388
|
+
// ../../node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/websocket.js
|
|
68330
68389
|
var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
68331
68390
|
const EventEmitter = __require("events");
|
|
68332
68391
|
const https = __require("https");
|
|
@@ -68399,12 +68458,15 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
68399
68458
|
else protocols = [options.protocols];
|
|
68400
68459
|
} else protocols = [protocols];
|
|
68401
68460
|
}
|
|
68402
|
-
initAsClient(this, address, protocols, options);
|
|
68403
|
-
} else
|
|
68404
|
-
|
|
68405
|
-
this.
|
|
68406
|
-
this.
|
|
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;
|
|
68407
68468
|
}
|
|
68469
|
+
this._closeTimeout = options.closeTimeout;
|
|
68408
68470
|
}
|
|
68409
68471
|
/**
|
|
68410
68472
|
* For historical reasons, the custom "nodebuffer" type is used by the default
|
|
@@ -68845,6 +68907,8 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
68845
68907
|
* fragments
|
|
68846
68908
|
* @param {Number} [options.maxPayload=104857600] The maximum allowed message
|
|
68847
68909
|
* size
|
|
68910
|
+
* @param {Number} [options.maxPendingAutoPongs=60] The maximum number of
|
|
68911
|
+
* pending automatic pongs
|
|
68848
68912
|
* @param {Number} [options.maxRedirects=10] The maximum number of redirects
|
|
68849
68913
|
* allowed
|
|
68850
68914
|
* @param {String} [options.origin] Value of the `Origin` or
|
|
@@ -68855,6 +68919,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
68855
68919
|
* `Sec-WebSocket-Version` header
|
|
68856
68920
|
* @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
|
|
68857
68921
|
* not to skip UTF-8 validation for text and close messages
|
|
68922
|
+
* @return {Object} The resolved options object used for initialization
|
|
68858
68923
|
* @private
|
|
68859
68924
|
*/
|
|
68860
68925
|
function initAsClient(websocket, address, protocols, options) {
|
|
@@ -68866,6 +68931,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
68866
68931
|
maxBufferedChunks: 262144,
|
|
68867
68932
|
maxFragments: 16384,
|
|
68868
68933
|
maxPayload: 104857600,
|
|
68934
|
+
maxPendingAutoPongs: 60,
|
|
68869
68935
|
skipUTF8Validation: false,
|
|
68870
68936
|
perMessageDeflate: true,
|
|
68871
68937
|
followRedirects: false,
|
|
@@ -68881,8 +68947,6 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
68881
68947
|
path: void 0,
|
|
68882
68948
|
port: void 0
|
|
68883
68949
|
};
|
|
68884
|
-
websocket._autoPong = opts.autoPong;
|
|
68885
|
-
websocket._closeTimeout = opts.closeTimeout;
|
|
68886
68950
|
if (!protocolVersions.includes(opts.protocolVersion)) throw new RangeError(`Unsupported protocol version: ${opts.protocolVersion} (supported versions: ${protocolVersions.join(", ")})`);
|
|
68887
68951
|
let parsedUrl;
|
|
68888
68952
|
if (address instanceof URL) parsedUrl = address;
|
|
@@ -69072,6 +69136,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
69072
69136
|
});
|
|
69073
69137
|
if (opts.finishRequest) opts.finishRequest(req, websocket);
|
|
69074
69138
|
else req.end();
|
|
69139
|
+
return opts;
|
|
69075
69140
|
}
|
|
69076
69141
|
/**
|
|
69077
69142
|
* Emit the `'error'` and `'close'` events.
|
|
@@ -69228,10 +69293,25 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
69228
69293
|
*/
|
|
69229
69294
|
function receiverOnPing(data) {
|
|
69230
69295
|
const websocket = this[kWebSocket];
|
|
69231
|
-
if (websocket._autoPong
|
|
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
|
+
}
|
|
69232
69303
|
websocket.emit("ping", data);
|
|
69233
69304
|
}
|
|
69234
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
|
+
/**
|
|
69235
69315
|
* The listener of the `Receiver` `'pong'` event.
|
|
69236
69316
|
*
|
|
69237
69317
|
* @param {Buffer} data The data included in the pong frame
|
|
@@ -69336,7 +69416,7 @@ var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
69336
69416
|
}
|
|
69337
69417
|
}
|
|
69338
69418
|
}));
|
|
69339
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
69419
|
+
// ../../node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/stream.js
|
|
69340
69420
|
var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
69341
69421
|
require_websocket();
|
|
69342
69422
|
const { Duplex } = __require("stream");
|
|
@@ -69451,7 +69531,7 @@ var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
69451
69531
|
}
|
|
69452
69532
|
module.exports = createWebSocketStream;
|
|
69453
69533
|
}));
|
|
69454
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
69534
|
+
// ../../node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/subprotocol.js
|
|
69455
69535
|
var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
69456
69536
|
const { tokenChars } = require_validation();
|
|
69457
69537
|
/**
|
|
@@ -69489,7 +69569,7 @@ var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
69489
69569
|
}
|
|
69490
69570
|
module.exports = { parse };
|
|
69491
69571
|
}));
|
|
69492
|
-
// ../../node_modules/.pnpm/ws@8.
|
|
69572
|
+
// ../../node_modules/.pnpm/ws@8.23.0/node_modules/ws/lib/websocket-server.js
|
|
69493
69573
|
var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
69494
69574
|
const EventEmitter = __require("events");
|
|
69495
69575
|
const http = __require("http");
|
|
@@ -69534,6 +69614,8 @@ var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
69534
69614
|
* fragments
|
|
69535
69615
|
* @param {Number} [options.maxPayload=104857600] The maximum allowed message
|
|
69536
69616
|
* size
|
|
69617
|
+
* @param {Number} [options.maxPendingAutoPongs=60] The maximum number of
|
|
69618
|
+
* pending automatic pongs
|
|
69537
69619
|
* @param {Boolean} [options.noServer=false] Enable no server mode
|
|
69538
69620
|
* @param {String} [options.path] Accept only connections matching this path
|
|
69539
69621
|
* @param {(Boolean|Object)} [options.perMessageDeflate=false] Enable/disable
|
|
@@ -69556,6 +69638,7 @@ var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
69556
69638
|
maxBufferedChunks: 262144,
|
|
69557
69639
|
maxFragments: 16384,
|
|
69558
69640
|
maxPayload: 104857600,
|
|
69641
|
+
maxPendingAutoPongs: 60,
|
|
69559
69642
|
skipUTF8Validation: false,
|
|
69560
69643
|
perMessageDeflate: false,
|
|
69561
69644
|
handleProtocols: null,
|
|
@@ -109110,7 +109193,7 @@ function runApp(app) {
|
|
|
109110
109193
|
return pipe(String$1(setting.flag), withSchema(setting.schema), withFallbackConfig(schema(setting.schema, env)), withDescription(`${setting.description} [${env}]`), optional);
|
|
109111
109194
|
}));
|
|
109112
109195
|
const given = map$7(root, (input) => getSomes$1(input));
|
|
109113
|
-
return yield* pipe(root, withHandler((input) =>
|
|
109196
|
+
return yield* pipe(root, withHandler((input) => provideServiceEffect(server(app), ConfigProvider, configProvider(getSomes$1(input), metadata.config.port))), withSubcommands([withSubcommands(make$11("service"), [
|
|
109114
109197
|
make$11("install", {}, fnUntraced(function* () {
|
|
109115
109198
|
const fs = yield* FileSystem;
|
|
109116
109199
|
const path = yield* Path$1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deslop/auth",
|
|
3
|
-
"version": "0.1.
|
|
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": "
|
|
36
|
+
"fingerprint": "09447988532e6ae559750249c8447a4853b64d92082d8b09c2ce0d1ee325fb48"
|
|
37
37
|
}
|