@geekmidas/constructs 10.0.0-alpha.128 → 10.0.0-alpha.129

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.
Files changed (33) hide show
  1. package/dist/Endpoint-BEh-jW-f.d.cts.map +1 -1
  2. package/dist/Endpoint-BcUorcBa.cjs +576 -0
  3. package/dist/Endpoint-BcUorcBa.cjs.map +1 -0
  4. package/dist/Endpoint-BgvG36NO.mjs +547 -0
  5. package/dist/Endpoint-BgvG36NO.mjs.map +1 -0
  6. package/dist/Endpoint-DTXDggNl.d.mts.map +1 -1
  7. package/dist/{EndpointFactory-CUpqgtaH.mjs → EndpointFactory-C1NlpCAS.mjs} +2 -2
  8. package/dist/{EndpointFactory-CUpqgtaH.mjs.map → EndpointFactory-C1NlpCAS.mjs.map} +1 -1
  9. package/dist/{EndpointFactory-C6pVda4y.cjs → EndpointFactory-gqmIRVWg.cjs} +2 -2
  10. package/dist/{EndpointFactory-C6pVda4y.cjs.map → EndpointFactory-gqmIRVWg.cjs.map} +1 -1
  11. package/dist/{HonoEndpointAdaptor-BBTzbP38.cjs → HonoEndpointAdaptor-BJlj20fQ.cjs} +2 -2
  12. package/dist/{HonoEndpointAdaptor-BBTzbP38.cjs.map → HonoEndpointAdaptor-BJlj20fQ.cjs.map} +1 -1
  13. package/dist/{HonoEndpointAdaptor-BR_LyaFE.mjs → HonoEndpointAdaptor-BlbkUDNo.mjs} +2 -2
  14. package/dist/{HonoEndpointAdaptor-BR_LyaFE.mjs.map → HonoEndpointAdaptor-BlbkUDNo.mjs.map} +1 -1
  15. package/dist/adaptors/aws.cjs +8 -7
  16. package/dist/adaptors/aws.cjs.map +1 -1
  17. package/dist/adaptors/aws.d.cts.map +1 -1
  18. package/dist/adaptors/aws.d.mts.map +1 -1
  19. package/dist/adaptors/aws.mjs +8 -8
  20. package/dist/adaptors/aws.mjs.map +1 -1
  21. package/dist/adaptors/hono.cjs +1 -1
  22. package/dist/adaptors/hono.mjs +1 -1
  23. package/dist/adaptors/testing.cjs +2 -2
  24. package/dist/adaptors/testing.mjs +2 -2
  25. package/dist/endpoints/index.cjs +2 -2
  26. package/dist/endpoints/index.mjs +2 -2
  27. package/dist/rest-api.cjs +1 -1
  28. package/dist/rest-api.mjs +1 -1
  29. package/package.json +31 -35
  30. package/dist/Endpoint-BuGFNFSB.cjs +0 -1836
  31. package/dist/Endpoint-BuGFNFSB.cjs.map +0 -1
  32. package/dist/Endpoint-VdaYKc2g.mjs +0 -1800
  33. package/dist/Endpoint-VdaYKc2g.mjs.map +0 -1
@@ -1,1800 +0,0 @@
1
- import { a as __commonJSMin, o as __toESM } from "./Construct-CGuc_Ijk.mjs";
2
- import { t as identifyUser } from "./tracing-Bbj1uoFJ.mjs";
3
- import { n as Function$1 } from "./functions-BvIDQKAA.mjs";
4
- import { convertSchemaWithComponents, convertStandardSchemaToJsonSchema } from "@geekmidas/schema/conversion";
5
- import { buildOpenApiSchema } from "@geekmidas/schema/openapi";
6
- //#region ../../node_modules/.pnpm/lodash.pick@4.4.0/node_modules/lodash.pick/index.js
7
- var require_lodash_pick = /* @__PURE__ */ __commonJSMin(((exports, module) => {
8
- /**
9
- * lodash (Custom Build) <https://lodash.com/>
10
- * Build: `lodash modularize exports="npm" -o ./`
11
- * Copyright jQuery Foundation and other contributors <https://jquery.org/>
12
- * Released under MIT license <https://lodash.com/license>
13
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
14
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
15
- */
16
- /** Used as references for various `Number` constants. */
17
- var MAX_SAFE_INTEGER = 9007199254740991;
18
- /** `Object#toString` result references. */
19
- var argsTag = "[object Arguments]";
20
- var funcTag = "[object Function]";
21
- var genTag = "[object GeneratorFunction]";
22
- var symbolTag = "[object Symbol]";
23
- /** Detect free variable `global` from Node.js. */
24
- var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
25
- /** Detect free variable `self`. */
26
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
27
- /** Used as a reference to the global object. */
28
- var root = freeGlobal || freeSelf || Function("return this")();
29
- /**
30
- * A faster alternative to `Function#apply`, this function invokes `func`
31
- * with the `this` binding of `thisArg` and the arguments of `args`.
32
- *
33
- * @private
34
- * @param {Function} func The function to invoke.
35
- * @param {*} thisArg The `this` binding of `func`.
36
- * @param {Array} args The arguments to invoke `func` with.
37
- * @returns {*} Returns the result of `func`.
38
- */
39
- function apply(func, thisArg, args) {
40
- switch (args.length) {
41
- case 0: return func.call(thisArg);
42
- case 1: return func.call(thisArg, args[0]);
43
- case 2: return func.call(thisArg, args[0], args[1]);
44
- case 3: return func.call(thisArg, args[0], args[1], args[2]);
45
- }
46
- return func.apply(thisArg, args);
47
- }
48
- /**
49
- * A specialized version of `_.map` for arrays without support for iteratee
50
- * shorthands.
51
- *
52
- * @private
53
- * @param {Array} [array] The array to iterate over.
54
- * @param {Function} iteratee The function invoked per iteration.
55
- * @returns {Array} Returns the new mapped array.
56
- */
57
- function arrayMap(array, iteratee) {
58
- var index = -1, length = array ? array.length : 0, result = Array(length);
59
- while (++index < length) result[index] = iteratee(array[index], index, array);
60
- return result;
61
- }
62
- /**
63
- * Appends the elements of `values` to `array`.
64
- *
65
- * @private
66
- * @param {Array} array The array to modify.
67
- * @param {Array} values The values to append.
68
- * @returns {Array} Returns `array`.
69
- */
70
- function arrayPush(array, values) {
71
- var index = -1, length = values.length, offset = array.length;
72
- while (++index < length) array[offset + index] = values[index];
73
- return array;
74
- }
75
- /** Used for built-in method references. */
76
- var objectProto = Object.prototype;
77
- /** Used to check objects for own properties. */
78
- var hasOwnProperty = objectProto.hasOwnProperty;
79
- /**
80
- * Used to resolve the
81
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
82
- * of values.
83
- */
84
- var objectToString = objectProto.toString;
85
- /** Built-in value references. */
86
- var Symbol = root.Symbol;
87
- var propertyIsEnumerable = objectProto.propertyIsEnumerable;
88
- var spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : void 0;
89
- var nativeMax = Math.max;
90
- /**
91
- * The base implementation of `_.flatten` with support for restricting flattening.
92
- *
93
- * @private
94
- * @param {Array} array The array to flatten.
95
- * @param {number} depth The maximum recursion depth.
96
- * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
97
- * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
98
- * @param {Array} [result=[]] The initial result value.
99
- * @returns {Array} Returns the new flattened array.
100
- */
101
- function baseFlatten(array, depth, predicate, isStrict, result) {
102
- var index = -1, length = array.length;
103
- predicate || (predicate = isFlattenable);
104
- result || (result = []);
105
- while (++index < length) {
106
- var value = array[index];
107
- if (depth > 0 && predicate(value)) {
108
- if (depth > 1) baseFlatten(value, depth - 1, predicate, isStrict, result);
109
- else arrayPush(result, value);
110
- } else if (!isStrict) result[result.length] = value;
111
- }
112
- return result;
113
- }
114
- /**
115
- * The base implementation of `_.pick` without support for individual
116
- * property identifiers.
117
- *
118
- * @private
119
- * @param {Object} object The source object.
120
- * @param {string[]} props The property identifiers to pick.
121
- * @returns {Object} Returns the new object.
122
- */
123
- function basePick(object, props) {
124
- object = Object(object);
125
- return basePickBy(object, props, function(value, key) {
126
- return key in object;
127
- });
128
- }
129
- /**
130
- * The base implementation of `_.pickBy` without support for iteratee shorthands.
131
- *
132
- * @private
133
- * @param {Object} object The source object.
134
- * @param {string[]} props The property identifiers to pick from.
135
- * @param {Function} predicate The function invoked per property.
136
- * @returns {Object} Returns the new object.
137
- */
138
- function basePickBy(object, props, predicate) {
139
- var index = -1, length = props.length, result = {};
140
- while (++index < length) {
141
- var key = props[index], value = object[key];
142
- if (predicate(value, key)) result[key] = value;
143
- }
144
- return result;
145
- }
146
- /**
147
- * The base implementation of `_.rest` which doesn't validate or coerce arguments.
148
- *
149
- * @private
150
- * @param {Function} func The function to apply a rest parameter to.
151
- * @param {number} [start=func.length-1] The start position of the rest parameter.
152
- * @returns {Function} Returns the new function.
153
- */
154
- function baseRest(func, start) {
155
- start = nativeMax(start === void 0 ? func.length - 1 : start, 0);
156
- return function() {
157
- var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length);
158
- while (++index < length) array[index] = args[start + index];
159
- index = -1;
160
- var otherArgs = Array(start + 1);
161
- while (++index < start) otherArgs[index] = args[index];
162
- otherArgs[start] = array;
163
- return apply(func, this, otherArgs);
164
- };
165
- }
166
- /**
167
- * Checks if `value` is a flattenable `arguments` object or array.
168
- *
169
- * @private
170
- * @param {*} value The value to check.
171
- * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
172
- */
173
- function isFlattenable(value) {
174
- return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
175
- }
176
- /**
177
- * Converts `value` to a string key if it's not a string or symbol.
178
- *
179
- * @private
180
- * @param {*} value The value to inspect.
181
- * @returns {string|symbol} Returns the key.
182
- */
183
- function toKey(value) {
184
- if (typeof value == "string" || isSymbol(value)) return value;
185
- var result = value + "";
186
- return result == "0" && 1 / value == -Infinity ? "-0" : result;
187
- }
188
- /**
189
- * Checks if `value` is likely an `arguments` object.
190
- *
191
- * @static
192
- * @memberOf _
193
- * @since 0.1.0
194
- * @category Lang
195
- * @param {*} value The value to check.
196
- * @returns {boolean} Returns `true` if `value` is an `arguments` object,
197
- * else `false`.
198
- * @example
199
- *
200
- * _.isArguments(function() { return arguments; }());
201
- * // => true
202
- *
203
- * _.isArguments([1, 2, 3]);
204
- * // => false
205
- */
206
- function isArguments(value) {
207
- return isArrayLikeObject(value) && hasOwnProperty.call(value, "callee") && (!propertyIsEnumerable.call(value, "callee") || objectToString.call(value) == argsTag);
208
- }
209
- /**
210
- * Checks if `value` is classified as an `Array` object.
211
- *
212
- * @static
213
- * @memberOf _
214
- * @since 0.1.0
215
- * @category Lang
216
- * @param {*} value The value to check.
217
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
218
- * @example
219
- *
220
- * _.isArray([1, 2, 3]);
221
- * // => true
222
- *
223
- * _.isArray(document.body.children);
224
- * // => false
225
- *
226
- * _.isArray('abc');
227
- * // => false
228
- *
229
- * _.isArray(_.noop);
230
- * // => false
231
- */
232
- var isArray = Array.isArray;
233
- /**
234
- * Checks if `value` is array-like. A value is considered array-like if it's
235
- * not a function and has a `value.length` that's an integer greater than or
236
- * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
237
- *
238
- * @static
239
- * @memberOf _
240
- * @since 4.0.0
241
- * @category Lang
242
- * @param {*} value The value to check.
243
- * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
244
- * @example
245
- *
246
- * _.isArrayLike([1, 2, 3]);
247
- * // => true
248
- *
249
- * _.isArrayLike(document.body.children);
250
- * // => true
251
- *
252
- * _.isArrayLike('abc');
253
- * // => true
254
- *
255
- * _.isArrayLike(_.noop);
256
- * // => false
257
- */
258
- function isArrayLike(value) {
259
- return value != null && isLength(value.length) && !isFunction(value);
260
- }
261
- /**
262
- * This method is like `_.isArrayLike` except that it also checks if `value`
263
- * is an object.
264
- *
265
- * @static
266
- * @memberOf _
267
- * @since 4.0.0
268
- * @category Lang
269
- * @param {*} value The value to check.
270
- * @returns {boolean} Returns `true` if `value` is an array-like object,
271
- * else `false`.
272
- * @example
273
- *
274
- * _.isArrayLikeObject([1, 2, 3]);
275
- * // => true
276
- *
277
- * _.isArrayLikeObject(document.body.children);
278
- * // => true
279
- *
280
- * _.isArrayLikeObject('abc');
281
- * // => false
282
- *
283
- * _.isArrayLikeObject(_.noop);
284
- * // => false
285
- */
286
- function isArrayLikeObject(value) {
287
- return isObjectLike(value) && isArrayLike(value);
288
- }
289
- /**
290
- * Checks if `value` is classified as a `Function` object.
291
- *
292
- * @static
293
- * @memberOf _
294
- * @since 0.1.0
295
- * @category Lang
296
- * @param {*} value The value to check.
297
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
298
- * @example
299
- *
300
- * _.isFunction(_);
301
- * // => true
302
- *
303
- * _.isFunction(/abc/);
304
- * // => false
305
- */
306
- function isFunction(value) {
307
- var tag = isObject(value) ? objectToString.call(value) : "";
308
- return tag == funcTag || tag == genTag;
309
- }
310
- /**
311
- * Checks if `value` is a valid array-like length.
312
- *
313
- * **Note:** This method is loosely based on
314
- * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
315
- *
316
- * @static
317
- * @memberOf _
318
- * @since 4.0.0
319
- * @category Lang
320
- * @param {*} value The value to check.
321
- * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
322
- * @example
323
- *
324
- * _.isLength(3);
325
- * // => true
326
- *
327
- * _.isLength(Number.MIN_VALUE);
328
- * // => false
329
- *
330
- * _.isLength(Infinity);
331
- * // => false
332
- *
333
- * _.isLength('3');
334
- * // => false
335
- */
336
- function isLength(value) {
337
- return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
338
- }
339
- /**
340
- * Checks if `value` is the
341
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
342
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
343
- *
344
- * @static
345
- * @memberOf _
346
- * @since 0.1.0
347
- * @category Lang
348
- * @param {*} value The value to check.
349
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
350
- * @example
351
- *
352
- * _.isObject({});
353
- * // => true
354
- *
355
- * _.isObject([1, 2, 3]);
356
- * // => true
357
- *
358
- * _.isObject(_.noop);
359
- * // => true
360
- *
361
- * _.isObject(null);
362
- * // => false
363
- */
364
- function isObject(value) {
365
- var type = typeof value;
366
- return !!value && (type == "object" || type == "function");
367
- }
368
- /**
369
- * Checks if `value` is object-like. A value is object-like if it's not `null`
370
- * and has a `typeof` result of "object".
371
- *
372
- * @static
373
- * @memberOf _
374
- * @since 4.0.0
375
- * @category Lang
376
- * @param {*} value The value to check.
377
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
378
- * @example
379
- *
380
- * _.isObjectLike({});
381
- * // => true
382
- *
383
- * _.isObjectLike([1, 2, 3]);
384
- * // => true
385
- *
386
- * _.isObjectLike(_.noop);
387
- * // => false
388
- *
389
- * _.isObjectLike(null);
390
- * // => false
391
- */
392
- function isObjectLike(value) {
393
- return !!value && typeof value == "object";
394
- }
395
- /**
396
- * Checks if `value` is classified as a `Symbol` primitive or object.
397
- *
398
- * @static
399
- * @memberOf _
400
- * @since 4.0.0
401
- * @category Lang
402
- * @param {*} value The value to check.
403
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
404
- * @example
405
- *
406
- * _.isSymbol(Symbol.iterator);
407
- * // => true
408
- *
409
- * _.isSymbol('abc');
410
- * // => false
411
- */
412
- function isSymbol(value) {
413
- return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag;
414
- }
415
- module.exports = baseRest(function(object, props) {
416
- return object == null ? {} : basePick(object, arrayMap(baseFlatten(props, 1), toKey));
417
- });
418
- }));
419
- //#endregion
420
- //#region ../../node_modules/.pnpm/lodash.set@4.3.2/node_modules/lodash.set/index.js
421
- var require_lodash_set = /* @__PURE__ */ __commonJSMin(((exports, module) => {
422
- /**
423
- * lodash (Custom Build) <https://lodash.com/>
424
- * Build: `lodash modularize exports="npm" -o ./`
425
- * Copyright jQuery Foundation and other contributors <https://jquery.org/>
426
- * Released under MIT license <https://lodash.com/license>
427
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
428
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
429
- */
430
- /** Used as the `TypeError` message for "Functions" methods. */
431
- var FUNC_ERROR_TEXT = "Expected a function";
432
- /** Used to stand-in for `undefined` hash values. */
433
- var HASH_UNDEFINED = "__lodash_hash_undefined__";
434
- var MAX_SAFE_INTEGER = 9007199254740991;
435
- /** `Object#toString` result references. */
436
- var funcTag = "[object Function]";
437
- var genTag = "[object GeneratorFunction]";
438
- var symbolTag = "[object Symbol]";
439
- /** Used to match property names within property paths. */
440
- var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
441
- var reIsPlainProp = /^\w*$/;
442
- var reLeadingDot = /^\./;
443
- var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
444
- /**
445
- * Used to match `RegExp`
446
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
447
- */
448
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
449
- /** Used to match backslashes in property paths. */
450
- var reEscapeChar = /\\(\\)?/g;
451
- /** Used to detect host constructors (Safari). */
452
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
453
- /** Used to detect unsigned integer values. */
454
- var reIsUint = /^(?:0|[1-9]\d*)$/;
455
- /** Detect free variable `global` from Node.js. */
456
- var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
457
- /** Detect free variable `self`. */
458
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
459
- /** Used as a reference to the global object. */
460
- var root = freeGlobal || freeSelf || Function("return this")();
461
- /**
462
- * Gets the value at `key` of `object`.
463
- *
464
- * @private
465
- * @param {Object} [object] The object to query.
466
- * @param {string} key The key of the property to get.
467
- * @returns {*} Returns the property value.
468
- */
469
- function getValue(object, key) {
470
- return object == null ? void 0 : object[key];
471
- }
472
- /**
473
- * Checks if `value` is a host object in IE < 9.
474
- *
475
- * @private
476
- * @param {*} value The value to check.
477
- * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
478
- */
479
- function isHostObject(value) {
480
- var result = false;
481
- if (value != null && typeof value.toString != "function") try {
482
- result = !!(value + "");
483
- } catch (e) {}
484
- return result;
485
- }
486
- /** Used for built-in method references. */
487
- var arrayProto = Array.prototype;
488
- var funcProto = Function.prototype;
489
- var objectProto = Object.prototype;
490
- /** Used to detect overreaching core-js shims. */
491
- var coreJsData = root["__core-js_shared__"];
492
- /** Used to detect methods masquerading as native. */
493
- var maskSrcKey = function() {
494
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
495
- return uid ? "Symbol(src)_1." + uid : "";
496
- }();
497
- /** Used to resolve the decompiled source of functions. */
498
- var funcToString = funcProto.toString;
499
- /** Used to check objects for own properties. */
500
- var hasOwnProperty = objectProto.hasOwnProperty;
501
- /**
502
- * Used to resolve the
503
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
504
- * of values.
505
- */
506
- var objectToString = objectProto.toString;
507
- /** Used to detect if a method is native. */
508
- var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
509
- /** Built-in value references. */
510
- var Symbol = root.Symbol;
511
- var splice = arrayProto.splice;
512
- var Map = getNative(root, "Map");
513
- var nativeCreate = getNative(Object, "create");
514
- /** Used to convert symbols to primitives and strings. */
515
- var symbolProto = Symbol ? Symbol.prototype : void 0;
516
- var symbolToString = symbolProto ? symbolProto.toString : void 0;
517
- /**
518
- * Creates a hash object.
519
- *
520
- * @private
521
- * @constructor
522
- * @param {Array} [entries] The key-value pairs to cache.
523
- */
524
- function Hash(entries) {
525
- var index = -1, length = entries ? entries.length : 0;
526
- this.clear();
527
- while (++index < length) {
528
- var entry = entries[index];
529
- this.set(entry[0], entry[1]);
530
- }
531
- }
532
- /**
533
- * Removes all key-value entries from the hash.
534
- *
535
- * @private
536
- * @name clear
537
- * @memberOf Hash
538
- */
539
- function hashClear() {
540
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
541
- }
542
- /**
543
- * Removes `key` and its value from the hash.
544
- *
545
- * @private
546
- * @name delete
547
- * @memberOf Hash
548
- * @param {Object} hash The hash to modify.
549
- * @param {string} key The key of the value to remove.
550
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
551
- */
552
- function hashDelete(key) {
553
- return this.has(key) && delete this.__data__[key];
554
- }
555
- /**
556
- * Gets the hash value for `key`.
557
- *
558
- * @private
559
- * @name get
560
- * @memberOf Hash
561
- * @param {string} key The key of the value to get.
562
- * @returns {*} Returns the entry value.
563
- */
564
- function hashGet(key) {
565
- var data = this.__data__;
566
- if (nativeCreate) {
567
- var result = data[key];
568
- return result === HASH_UNDEFINED ? void 0 : result;
569
- }
570
- return hasOwnProperty.call(data, key) ? data[key] : void 0;
571
- }
572
- /**
573
- * Checks if a hash value for `key` exists.
574
- *
575
- * @private
576
- * @name has
577
- * @memberOf Hash
578
- * @param {string} key The key of the entry to check.
579
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
580
- */
581
- function hashHas(key) {
582
- var data = this.__data__;
583
- return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key);
584
- }
585
- /**
586
- * Sets the hash `key` to `value`.
587
- *
588
- * @private
589
- * @name set
590
- * @memberOf Hash
591
- * @param {string} key The key of the value to set.
592
- * @param {*} value The value to set.
593
- * @returns {Object} Returns the hash instance.
594
- */
595
- function hashSet(key, value) {
596
- var data = this.__data__;
597
- data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
598
- return this;
599
- }
600
- Hash.prototype.clear = hashClear;
601
- Hash.prototype["delete"] = hashDelete;
602
- Hash.prototype.get = hashGet;
603
- Hash.prototype.has = hashHas;
604
- Hash.prototype.set = hashSet;
605
- /**
606
- * Creates an list cache object.
607
- *
608
- * @private
609
- * @constructor
610
- * @param {Array} [entries] The key-value pairs to cache.
611
- */
612
- function ListCache(entries) {
613
- var index = -1, length = entries ? entries.length : 0;
614
- this.clear();
615
- while (++index < length) {
616
- var entry = entries[index];
617
- this.set(entry[0], entry[1]);
618
- }
619
- }
620
- /**
621
- * Removes all key-value entries from the list cache.
622
- *
623
- * @private
624
- * @name clear
625
- * @memberOf ListCache
626
- */
627
- function listCacheClear() {
628
- this.__data__ = [];
629
- }
630
- /**
631
- * Removes `key` and its value from the list cache.
632
- *
633
- * @private
634
- * @name delete
635
- * @memberOf ListCache
636
- * @param {string} key The key of the value to remove.
637
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
638
- */
639
- function listCacheDelete(key) {
640
- var data = this.__data__, index = assocIndexOf(data, key);
641
- if (index < 0) return false;
642
- if (index == data.length - 1) data.pop();
643
- else splice.call(data, index, 1);
644
- return true;
645
- }
646
- /**
647
- * Gets the list cache value for `key`.
648
- *
649
- * @private
650
- * @name get
651
- * @memberOf ListCache
652
- * @param {string} key The key of the value to get.
653
- * @returns {*} Returns the entry value.
654
- */
655
- function listCacheGet(key) {
656
- var data = this.__data__, index = assocIndexOf(data, key);
657
- return index < 0 ? void 0 : data[index][1];
658
- }
659
- /**
660
- * Checks if a list cache value for `key` exists.
661
- *
662
- * @private
663
- * @name has
664
- * @memberOf ListCache
665
- * @param {string} key The key of the entry to check.
666
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
667
- */
668
- function listCacheHas(key) {
669
- return assocIndexOf(this.__data__, key) > -1;
670
- }
671
- /**
672
- * Sets the list cache `key` to `value`.
673
- *
674
- * @private
675
- * @name set
676
- * @memberOf ListCache
677
- * @param {string} key The key of the value to set.
678
- * @param {*} value The value to set.
679
- * @returns {Object} Returns the list cache instance.
680
- */
681
- function listCacheSet(key, value) {
682
- var data = this.__data__, index = assocIndexOf(data, key);
683
- if (index < 0) data.push([key, value]);
684
- else data[index][1] = value;
685
- return this;
686
- }
687
- ListCache.prototype.clear = listCacheClear;
688
- ListCache.prototype["delete"] = listCacheDelete;
689
- ListCache.prototype.get = listCacheGet;
690
- ListCache.prototype.has = listCacheHas;
691
- ListCache.prototype.set = listCacheSet;
692
- /**
693
- * Creates a map cache object to store key-value pairs.
694
- *
695
- * @private
696
- * @constructor
697
- * @param {Array} [entries] The key-value pairs to cache.
698
- */
699
- function MapCache(entries) {
700
- var index = -1, length = entries ? entries.length : 0;
701
- this.clear();
702
- while (++index < length) {
703
- var entry = entries[index];
704
- this.set(entry[0], entry[1]);
705
- }
706
- }
707
- /**
708
- * Removes all key-value entries from the map.
709
- *
710
- * @private
711
- * @name clear
712
- * @memberOf MapCache
713
- */
714
- function mapCacheClear() {
715
- this.__data__ = {
716
- "hash": new Hash(),
717
- "map": new (Map || ListCache)(),
718
- "string": new Hash()
719
- };
720
- }
721
- /**
722
- * Removes `key` and its value from the map.
723
- *
724
- * @private
725
- * @name delete
726
- * @memberOf MapCache
727
- * @param {string} key The key of the value to remove.
728
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
729
- */
730
- function mapCacheDelete(key) {
731
- return getMapData(this, key)["delete"](key);
732
- }
733
- /**
734
- * Gets the map value for `key`.
735
- *
736
- * @private
737
- * @name get
738
- * @memberOf MapCache
739
- * @param {string} key The key of the value to get.
740
- * @returns {*} Returns the entry value.
741
- */
742
- function mapCacheGet(key) {
743
- return getMapData(this, key).get(key);
744
- }
745
- /**
746
- * Checks if a map value for `key` exists.
747
- *
748
- * @private
749
- * @name has
750
- * @memberOf MapCache
751
- * @param {string} key The key of the entry to check.
752
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
753
- */
754
- function mapCacheHas(key) {
755
- return getMapData(this, key).has(key);
756
- }
757
- /**
758
- * Sets the map `key` to `value`.
759
- *
760
- * @private
761
- * @name set
762
- * @memberOf MapCache
763
- * @param {string} key The key of the value to set.
764
- * @param {*} value The value to set.
765
- * @returns {Object} Returns the map cache instance.
766
- */
767
- function mapCacheSet(key, value) {
768
- getMapData(this, key).set(key, value);
769
- return this;
770
- }
771
- MapCache.prototype.clear = mapCacheClear;
772
- MapCache.prototype["delete"] = mapCacheDelete;
773
- MapCache.prototype.get = mapCacheGet;
774
- MapCache.prototype.has = mapCacheHas;
775
- MapCache.prototype.set = mapCacheSet;
776
- /**
777
- * Assigns `value` to `key` of `object` if the existing value is not equivalent
778
- * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
779
- * for equality comparisons.
780
- *
781
- * @private
782
- * @param {Object} object The object to modify.
783
- * @param {string} key The key of the property to assign.
784
- * @param {*} value The value to assign.
785
- */
786
- function assignValue(object, key, value) {
787
- var objValue = object[key];
788
- if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) object[key] = value;
789
- }
790
- /**
791
- * Gets the index at which the `key` is found in `array` of key-value pairs.
792
- *
793
- * @private
794
- * @param {Array} array The array to inspect.
795
- * @param {*} key The key to search for.
796
- * @returns {number} Returns the index of the matched value, else `-1`.
797
- */
798
- function assocIndexOf(array, key) {
799
- var length = array.length;
800
- while (length--) if (eq(array[length][0], key)) return length;
801
- return -1;
802
- }
803
- /**
804
- * The base implementation of `_.isNative` without bad shim checks.
805
- *
806
- * @private
807
- * @param {*} value The value to check.
808
- * @returns {boolean} Returns `true` if `value` is a native function,
809
- * else `false`.
810
- */
811
- function baseIsNative(value) {
812
- if (!isObject(value) || isMasked(value)) return false;
813
- return (isFunction(value) || isHostObject(value) ? reIsNative : reIsHostCtor).test(toSource(value));
814
- }
815
- /**
816
- * The base implementation of `_.set`.
817
- *
818
- * @private
819
- * @param {Object} object The object to modify.
820
- * @param {Array|string} path The path of the property to set.
821
- * @param {*} value The value to set.
822
- * @param {Function} [customizer] The function to customize path creation.
823
- * @returns {Object} Returns `object`.
824
- */
825
- function baseSet(object, path, value, customizer) {
826
- if (!isObject(object)) return object;
827
- path = isKey(path, object) ? [path] : castPath(path);
828
- var index = -1, length = path.length, lastIndex = length - 1, nested = object;
829
- while (nested != null && ++index < length) {
830
- var key = toKey(path[index]), newValue = value;
831
- if (index != lastIndex) {
832
- var objValue = nested[key];
833
- newValue = customizer ? customizer(objValue, key, nested) : void 0;
834
- if (newValue === void 0) newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
835
- }
836
- assignValue(nested, key, newValue);
837
- nested = nested[key];
838
- }
839
- return object;
840
- }
841
- /**
842
- * The base implementation of `_.toString` which doesn't convert nullish
843
- * values to empty strings.
844
- *
845
- * @private
846
- * @param {*} value The value to process.
847
- * @returns {string} Returns the string.
848
- */
849
- function baseToString(value) {
850
- if (typeof value == "string") return value;
851
- if (isSymbol(value)) return symbolToString ? symbolToString.call(value) : "";
852
- var result = value + "";
853
- return result == "0" && 1 / value == -Infinity ? "-0" : result;
854
- }
855
- /**
856
- * Casts `value` to a path array if it's not one.
857
- *
858
- * @private
859
- * @param {*} value The value to inspect.
860
- * @returns {Array} Returns the cast property path array.
861
- */
862
- function castPath(value) {
863
- return isArray(value) ? value : stringToPath(value);
864
- }
865
- /**
866
- * Gets the data for `map`.
867
- *
868
- * @private
869
- * @param {Object} map The map to query.
870
- * @param {string} key The reference key.
871
- * @returns {*} Returns the map data.
872
- */
873
- function getMapData(map, key) {
874
- var data = map.__data__;
875
- return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
876
- }
877
- /**
878
- * Gets the native function at `key` of `object`.
879
- *
880
- * @private
881
- * @param {Object} object The object to query.
882
- * @param {string} key The key of the method to get.
883
- * @returns {*} Returns the function if it's native, else `undefined`.
884
- */
885
- function getNative(object, key) {
886
- var value = getValue(object, key);
887
- return baseIsNative(value) ? value : void 0;
888
- }
889
- /**
890
- * Checks if `value` is a valid array-like index.
891
- *
892
- * @private
893
- * @param {*} value The value to check.
894
- * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
895
- * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
896
- */
897
- function isIndex(value, length) {
898
- length = length == null ? MAX_SAFE_INTEGER : length;
899
- return !!length && (typeof value == "number" || reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length;
900
- }
901
- /**
902
- * Checks if `value` is a property name and not a property path.
903
- *
904
- * @private
905
- * @param {*} value The value to check.
906
- * @param {Object} [object] The object to query keys on.
907
- * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
908
- */
909
- function isKey(value, object) {
910
- if (isArray(value)) return false;
911
- var type = typeof value;
912
- if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) return true;
913
- return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
914
- }
915
- /**
916
- * Checks if `value` is suitable for use as unique object key.
917
- *
918
- * @private
919
- * @param {*} value The value to check.
920
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
921
- */
922
- function isKeyable(value) {
923
- var type = typeof value;
924
- return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
925
- }
926
- /**
927
- * Checks if `func` has its source masked.
928
- *
929
- * @private
930
- * @param {Function} func The function to check.
931
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
932
- */
933
- function isMasked(func) {
934
- return !!maskSrcKey && maskSrcKey in func;
935
- }
936
- /**
937
- * Converts `string` to a property path array.
938
- *
939
- * @private
940
- * @param {string} string The string to convert.
941
- * @returns {Array} Returns the property path array.
942
- */
943
- var stringToPath = memoize(function(string) {
944
- string = toString(string);
945
- var result = [];
946
- if (reLeadingDot.test(string)) result.push("");
947
- string.replace(rePropName, function(match, number, quote, string) {
948
- result.push(quote ? string.replace(reEscapeChar, "$1") : number || match);
949
- });
950
- return result;
951
- });
952
- /**
953
- * Converts `value` to a string key if it's not a string or symbol.
954
- *
955
- * @private
956
- * @param {*} value The value to inspect.
957
- * @returns {string|symbol} Returns the key.
958
- */
959
- function toKey(value) {
960
- if (typeof value == "string" || isSymbol(value)) return value;
961
- var result = value + "";
962
- return result == "0" && 1 / value == -Infinity ? "-0" : result;
963
- }
964
- /**
965
- * Converts `func` to its source code.
966
- *
967
- * @private
968
- * @param {Function} func The function to process.
969
- * @returns {string} Returns the source code.
970
- */
971
- function toSource(func) {
972
- if (func != null) {
973
- try {
974
- return funcToString.call(func);
975
- } catch (e) {}
976
- try {
977
- return func + "";
978
- } catch (e) {}
979
- }
980
- return "";
981
- }
982
- /**
983
- * Creates a function that memoizes the result of `func`. If `resolver` is
984
- * provided, it determines the cache key for storing the result based on the
985
- * arguments provided to the memoized function. By default, the first argument
986
- * provided to the memoized function is used as the map cache key. The `func`
987
- * is invoked with the `this` binding of the memoized function.
988
- *
989
- * **Note:** The cache is exposed as the `cache` property on the memoized
990
- * function. Its creation may be customized by replacing the `_.memoize.Cache`
991
- * constructor with one whose instances implement the
992
- * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
993
- * method interface of `delete`, `get`, `has`, and `set`.
994
- *
995
- * @static
996
- * @memberOf _
997
- * @since 0.1.0
998
- * @category Function
999
- * @param {Function} func The function to have its output memoized.
1000
- * @param {Function} [resolver] The function to resolve the cache key.
1001
- * @returns {Function} Returns the new memoized function.
1002
- * @example
1003
- *
1004
- * var object = { 'a': 1, 'b': 2 };
1005
- * var other = { 'c': 3, 'd': 4 };
1006
- *
1007
- * var values = _.memoize(_.values);
1008
- * values(object);
1009
- * // => [1, 2]
1010
- *
1011
- * values(other);
1012
- * // => [3, 4]
1013
- *
1014
- * object.a = 2;
1015
- * values(object);
1016
- * // => [1, 2]
1017
- *
1018
- * // Modify the result cache.
1019
- * values.cache.set(object, ['a', 'b']);
1020
- * values(object);
1021
- * // => ['a', 'b']
1022
- *
1023
- * // Replace `_.memoize.Cache`.
1024
- * _.memoize.Cache = WeakMap;
1025
- */
1026
- function memoize(func, resolver) {
1027
- if (typeof func != "function" || resolver && typeof resolver != "function") throw new TypeError(FUNC_ERROR_TEXT);
1028
- var memoized = function() {
1029
- var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
1030
- if (cache.has(key)) return cache.get(key);
1031
- var result = func.apply(this, args);
1032
- memoized.cache = cache.set(key, result);
1033
- return result;
1034
- };
1035
- memoized.cache = new (memoize.Cache || MapCache)();
1036
- return memoized;
1037
- }
1038
- memoize.Cache = MapCache;
1039
- /**
1040
- * Performs a
1041
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
1042
- * comparison between two values to determine if they are equivalent.
1043
- *
1044
- * @static
1045
- * @memberOf _
1046
- * @since 4.0.0
1047
- * @category Lang
1048
- * @param {*} value The value to compare.
1049
- * @param {*} other The other value to compare.
1050
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1051
- * @example
1052
- *
1053
- * var object = { 'a': 1 };
1054
- * var other = { 'a': 1 };
1055
- *
1056
- * _.eq(object, object);
1057
- * // => true
1058
- *
1059
- * _.eq(object, other);
1060
- * // => false
1061
- *
1062
- * _.eq('a', 'a');
1063
- * // => true
1064
- *
1065
- * _.eq('a', Object('a'));
1066
- * // => false
1067
- *
1068
- * _.eq(NaN, NaN);
1069
- * // => true
1070
- */
1071
- function eq(value, other) {
1072
- return value === other || value !== value && other !== other;
1073
- }
1074
- /**
1075
- * Checks if `value` is classified as an `Array` object.
1076
- *
1077
- * @static
1078
- * @memberOf _
1079
- * @since 0.1.0
1080
- * @category Lang
1081
- * @param {*} value The value to check.
1082
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
1083
- * @example
1084
- *
1085
- * _.isArray([1, 2, 3]);
1086
- * // => true
1087
- *
1088
- * _.isArray(document.body.children);
1089
- * // => false
1090
- *
1091
- * _.isArray('abc');
1092
- * // => false
1093
- *
1094
- * _.isArray(_.noop);
1095
- * // => false
1096
- */
1097
- var isArray = Array.isArray;
1098
- /**
1099
- * Checks if `value` is classified as a `Function` object.
1100
- *
1101
- * @static
1102
- * @memberOf _
1103
- * @since 0.1.0
1104
- * @category Lang
1105
- * @param {*} value The value to check.
1106
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
1107
- * @example
1108
- *
1109
- * _.isFunction(_);
1110
- * // => true
1111
- *
1112
- * _.isFunction(/abc/);
1113
- * // => false
1114
- */
1115
- function isFunction(value) {
1116
- var tag = isObject(value) ? objectToString.call(value) : "";
1117
- return tag == funcTag || tag == genTag;
1118
- }
1119
- /**
1120
- * Checks if `value` is the
1121
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
1122
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
1123
- *
1124
- * @static
1125
- * @memberOf _
1126
- * @since 0.1.0
1127
- * @category Lang
1128
- * @param {*} value The value to check.
1129
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
1130
- * @example
1131
- *
1132
- * _.isObject({});
1133
- * // => true
1134
- *
1135
- * _.isObject([1, 2, 3]);
1136
- * // => true
1137
- *
1138
- * _.isObject(_.noop);
1139
- * // => true
1140
- *
1141
- * _.isObject(null);
1142
- * // => false
1143
- */
1144
- function isObject(value) {
1145
- var type = typeof value;
1146
- return !!value && (type == "object" || type == "function");
1147
- }
1148
- /**
1149
- * Checks if `value` is object-like. A value is object-like if it's not `null`
1150
- * and has a `typeof` result of "object".
1151
- *
1152
- * @static
1153
- * @memberOf _
1154
- * @since 4.0.0
1155
- * @category Lang
1156
- * @param {*} value The value to check.
1157
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
1158
- * @example
1159
- *
1160
- * _.isObjectLike({});
1161
- * // => true
1162
- *
1163
- * _.isObjectLike([1, 2, 3]);
1164
- * // => true
1165
- *
1166
- * _.isObjectLike(_.noop);
1167
- * // => false
1168
- *
1169
- * _.isObjectLike(null);
1170
- * // => false
1171
- */
1172
- function isObjectLike(value) {
1173
- return !!value && typeof value == "object";
1174
- }
1175
- /**
1176
- * Checks if `value` is classified as a `Symbol` primitive or object.
1177
- *
1178
- * @static
1179
- * @memberOf _
1180
- * @since 4.0.0
1181
- * @category Lang
1182
- * @param {*} value The value to check.
1183
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
1184
- * @example
1185
- *
1186
- * _.isSymbol(Symbol.iterator);
1187
- * // => true
1188
- *
1189
- * _.isSymbol('abc');
1190
- * // => false
1191
- */
1192
- function isSymbol(value) {
1193
- return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag;
1194
- }
1195
- /**
1196
- * Converts `value` to a string. An empty string is returned for `null`
1197
- * and `undefined` values. The sign of `-0` is preserved.
1198
- *
1199
- * @static
1200
- * @memberOf _
1201
- * @since 4.0.0
1202
- * @category Lang
1203
- * @param {*} value The value to process.
1204
- * @returns {string} Returns the string.
1205
- * @example
1206
- *
1207
- * _.toString(null);
1208
- * // => ''
1209
- *
1210
- * _.toString(-0);
1211
- * // => '-0'
1212
- *
1213
- * _.toString([1, 2, 3]);
1214
- * // => '1,2,3'
1215
- */
1216
- function toString(value) {
1217
- return value == null ? "" : baseToString(value);
1218
- }
1219
- /**
1220
- * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
1221
- * it's created. Arrays are created for missing index properties while objects
1222
- * are created for all other missing properties. Use `_.setWith` to customize
1223
- * `path` creation.
1224
- *
1225
- * **Note:** This method mutates `object`.
1226
- *
1227
- * @static
1228
- * @memberOf _
1229
- * @since 3.7.0
1230
- * @category Object
1231
- * @param {Object} object The object to modify.
1232
- * @param {Array|string} path The path of the property to set.
1233
- * @param {*} value The value to set.
1234
- * @returns {Object} Returns `object`.
1235
- * @example
1236
- *
1237
- * var object = { 'a': [{ 'b': { 'c': 3 } }] };
1238
- *
1239
- * _.set(object, 'a[0].b.c', 4);
1240
- * console.log(object.a[0].b.c);
1241
- * // => 4
1242
- *
1243
- * _.set(object, ['x', '0', 'y', 'z'], 5);
1244
- * console.log(object.x[0].y.z);
1245
- * // => 5
1246
- */
1247
- function set(object, path, value) {
1248
- return object == null ? object : baseSet(object, path, value);
1249
- }
1250
- module.exports = set;
1251
- }));
1252
- //#endregion
1253
- //#region src/endpoints/sessionAuth.ts
1254
- var import_lodash_pick = /* @__PURE__ */ __toESM(require_lodash_pick(), 1);
1255
- var import_lodash_set = /* @__PURE__ */ __toESM(require_lodash_set(), 1);
1256
- /**
1257
- * What is forwarded to the auth server: the headers a session travels in, and
1258
- * whose request it is — nothing else.
1259
- *
1260
- * The client's address goes with the session because the auth server
1261
- * rate-limits by it, `/get-session` included. Without it every user's session
1262
- * check arrived from the surface itself — one shared bucket, so enough
1263
- * traffic from anyone turned every session check into a 429 — and in tests,
1264
- * concurrent tests queued on the same rate-limit row.
1265
- */
1266
- const SESSION_HEADERS = [
1267
- "cookie",
1268
- "authorization",
1269
- "x-forwarded-for"
1270
- ];
1271
- /** `auth` for one request on one surface. */
1272
- function sessionAuth(surface, header) {
1273
- return { async getSession() {
1274
- const authenticator = surface?.auth;
1275
- if (!surface || !authenticator) throw new NoAuthenticator(surface?.id);
1276
- const headers = new Headers();
1277
- for (const name of SESSION_HEADERS) {
1278
- const value = header(name);
1279
- if (value) headers.set(name, value);
1280
- }
1281
- const session = await authenticator.verify(headers, surface.envParser);
1282
- const identity = session;
1283
- if (typeof identity?.user?.id === "string") identifyUser({
1284
- id: identity.user.id,
1285
- ...typeof identity.session?.id === "string" ? { sessionId: identity.session.id } : {}
1286
- });
1287
- return session;
1288
- } };
1289
- }
1290
- /** `auth.getSession()` was called on a surface that names no authenticator. */
1291
- var NoAuthenticator = class extends Error {
1292
- surface;
1293
- constructor(surface) {
1294
- super(`auth.getSession() needs an authenticator, and ${surface ? `the surface '${surface}'` : "this endpoint"} declares none: declare one on the surface with .auth(construct).`);
1295
- this.surface = surface;
1296
- this.name = "NoAuthenticator";
1297
- }
1298
- };
1299
- //#endregion
1300
- //#region src/endpoints/Endpoint.ts
1301
- /**
1302
- * Represents an HTTP endpoint that can handle requests with type-safe input/output validation,
1303
- * dependency injection, session management, and authorization.
1304
- *
1305
- * @template TRoute - The route path string with parameter placeholders (e.g., '/users/:id')
1306
- * @template TMethod - The HTTP method (GET, POST, PUT, DELETE, PATCH)
1307
- * @template TInput - The input schema definition for body, query, and path parameters
1308
- * @template OutSchema - The output schema for response validation
1309
- * @template TServices - Array of service dependencies to inject
1310
- * @template TLogger - The logger instance type
1311
- * @template TSession - The session data type
1312
- *
1313
- * @extends Function - Base function construct for handler execution
1314
- *
1315
- * @example
1316
- * ```typescript
1317
- * const endpoint = new Endpoint({
1318
- * route: '/users/:id',
1319
- * method: 'GET',
1320
- * input: { params: userIdSchema },
1321
- * output: userSchema,
1322
- * fn: async ({ params }) => getUserById(params.id)
1323
- * });
1324
- * ```
1325
- */
1326
- var Endpoint = class Endpoint extends Function$1 {
1327
- operationId;
1328
- /** The route path pattern with parameter placeholders */
1329
- route;
1330
- /** The HTTP method for this endpoint */
1331
- method;
1332
- /**
1333
- * The surface that serves it, when it was built from one.
1334
- *
1335
- * Carries the env parser the adaptors need, so a generated handler needs no
1336
- * import written for it — and the surface's id, so the build attributes the
1337
- * route to the API that serves it rather than inferring it by exclusion.
1338
- */
1339
- surface;
1340
- /** Optional description for OpenAPI documentation */
1341
- description;
1342
- /** Optional tags for OpenAPI documentation */
1343
- tags;
1344
- /** The HTTP status code to return (default: 200) */
1345
- status;
1346
- /**
1347
- * Response content type for this endpoint. Defaults to `'application/json'`.
1348
- * Non-JSON types cause adaptors to emit the body as-is with the declared
1349
- * Content-Type header instead of JSON-serializing.
1350
- */
1351
- responseType;
1352
- /**
1353
- * This route's telemetry — `.telemetry({ ignore, attributes })` — read by
1354
- * the build, which hands it to the request middleware.
1355
- */
1356
- telemetry;
1357
- /** Default headers to apply to all responses */
1358
- defaultHeaders = {};
1359
- /** Function to extract session data from the request context */
1360
- getSession = () => ({});
1361
- /**
1362
- * Whether a session callback was given — `.session()` on the factory it was
1363
- * built from. A generated handler reads the session only when it is, so
1364
- * an endpoint with a session and no authorizer must say so: it used to be
1365
- * handed `undefined` in a production build and its session in `gkm dev`.
1366
- */
1367
- hasSession = false;
1368
- /** Function to determine if the request is authorized */
1369
- authorize = () => true;
1370
- /** Optional rate limiting configuration */
1371
- rateLimit;
1372
- /** Optional authorizer for this endpoint */
1373
- authorizer;
1374
- /** Optional actor extractor for audit records */
1375
- actorExtractor;
1376
- /** Declarative audit definitions */
1377
- audits = [];
1378
- /** RLS configuration for this endpoint */
1379
- rlsConfig;
1380
- /** Whether to bypass RLS for this endpoint */
1381
- rlsBypass;
1382
- /** The endpoint handler function */
1383
- endpointFn;
1384
- /**
1385
- * Builds a complete OpenAPI 3.1 schema from an array of endpoints.
1386
- *
1387
- * @param endpoints - Array of endpoint instances to document
1388
- * @param options - Optional configuration for OpenAPI generation
1389
- * @returns OpenAPI 3.1 specification object
1390
- *
1391
- * @example
1392
- * ```typescript
1393
- * const schema = await Endpoint.buildOpenApiSchema([
1394
- * getUserEndpoint,
1395
- * createUserEndpoint
1396
- * ], {
1397
- * title: 'User API',
1398
- * version: '1.0.0'
1399
- * });
1400
- * ```
1401
- */
1402
- static async buildOpenApiSchema(endpoints, options) {
1403
- return buildOpenApiSchema(endpoints, options);
1404
- }
1405
- /**
1406
- * Gets the full path including HTTP method and route.
1407
- * @returns Formatted string like 'GET /users/{id}'
1408
- */
1409
- get fullPath() {
1410
- return `${this.method} ${this._path}`;
1411
- }
1412
- /**
1413
- * Parses and validates input data for a specific input type (body, query, params).
1414
- *
1415
- * @param input - The raw input data to validate
1416
- * @param key - The input type key ('body', 'query', or 'params')
1417
- * @returns The validated input data for the specified key
1418
- * @throws {UnprocessableEntityError} When validation fails
1419
- */
1420
- async parseInput(input, key) {
1421
- const schema = this.input?.[key];
1422
- return Endpoint.parseSchema(schema, input);
1423
- }
1424
- /**
1425
- * Parses and validates the request body against the body schema.
1426
- *
1427
- * @param body - The raw request body to validate
1428
- * @returns The validated body data
1429
- * @throws {UnprocessableEntityError} When body validation fails
1430
- */
1431
- async parseBody(body) {
1432
- return this.parseInput(body, "body");
1433
- }
1434
- static isSuccessStatus(status) {
1435
- return status >= 200 && status < 300;
1436
- }
1437
- /**
1438
- * Whether `status` sends the client elsewhere. A redirect has no body, so
1439
- * its response is not checked against the output schema, and what is
1440
- * derived from the output — declared events and audits — is not sent.
1441
- */
1442
- static isRedirectStatus(status) {
1443
- return status !== void 0 && status >= 300 && status < 400;
1444
- }
1445
- /**
1446
- * Creates a case-insensitive header lookup function from a headers object.
1447
- *
1448
- * @param headers - Object containing header key-value pairs
1449
- * @returns Function to retrieve header values by case-insensitive key, or all headers
1450
- *
1451
- * @example
1452
- * ```typescript
1453
- * const headerFn = Endpoint.createHeaders({ 'Content-Type': 'application/json' });
1454
- * headerFn('content-type'); // Returns 'application/json'
1455
- * headerFn(); // Returns { 'content-type': 'application/json' }
1456
- * ```
1457
- */
1458
- static createHeaders(headers) {
1459
- const headerMap = /* @__PURE__ */ new Map();
1460
- for (const [k, v] of Object.entries(headers)) {
1461
- const key = k.toLowerCase();
1462
- headerMap.set(key, v);
1463
- }
1464
- function get(key) {
1465
- if (key === void 0) return Object.fromEntries(headerMap.entries());
1466
- return headerMap.get(key.toLowerCase());
1467
- }
1468
- return get;
1469
- }
1470
- /**
1471
- * Parses cookie string and creates a cookie lookup function.
1472
- *
1473
- * @param cookieHeader - The Cookie header value
1474
- * @returns Function to retrieve cookie values by name, or all cookies
1475
- *
1476
- * @example
1477
- * ```typescript
1478
- * const cookieFn = Endpoint.createCookies('session=abc123; theme=dark');
1479
- * cookieFn('session'); // Returns 'abc123'
1480
- * cookieFn(); // Returns { session: 'abc123', theme: 'dark' }
1481
- * ```
1482
- */
1483
- static createCookies(cookieHeader) {
1484
- const cookieMap = /* @__PURE__ */ new Map();
1485
- if (cookieHeader) {
1486
- const cookies = cookieHeader.split(";");
1487
- for (const cookie of cookies) {
1488
- const [name, ...valueParts] = cookie.trim().split("=");
1489
- if (name) {
1490
- const value = valueParts.join("=");
1491
- cookieMap.set(name, decodeURIComponent(value));
1492
- }
1493
- }
1494
- }
1495
- function get(name) {
1496
- if (name === void 0) return Object.fromEntries(cookieMap.entries());
1497
- return cookieMap.get(name);
1498
- }
1499
- return get;
1500
- }
1501
- /**
1502
- * Formats a cookie as a Set-Cookie header string.
1503
- *
1504
- * @param name - Cookie name
1505
- * @param value - Cookie value
1506
- * @param options - Cookie options (httpOnly, secure, sameSite, etc.)
1507
- * @returns Formatted Set-Cookie header string
1508
- *
1509
- * @example
1510
- * ```typescript
1511
- * const header = Endpoint.formatCookieHeader('session', 'abc123', {
1512
- * httpOnly: true,
1513
- * secure: true,
1514
- * sameSite: 'strict',
1515
- * maxAge: 3600
1516
- * });
1517
- * // Returns: "session=abc123; Max-Age=3600; HttpOnly; Secure; SameSite=Strict"
1518
- * ```
1519
- */
1520
- static formatCookieHeader(name, value, options) {
1521
- let cookie = `${name}=${value}`;
1522
- if (options) {
1523
- if (options.domain) cookie += `; Domain=${options.domain}`;
1524
- if (options.path) cookie += `; Path=${options.path}`;
1525
- if (options.expires) cookie += `; Expires=${options.expires.toUTCString()}`;
1526
- if (options.maxAge !== void 0) cookie += `; Max-Age=${options.maxAge}`;
1527
- if (options.httpOnly) cookie += "; HttpOnly";
1528
- if (options.secure) cookie += "; Secure";
1529
- if (options.sameSite) cookie += `; SameSite=${options.sameSite.charAt(0).toUpperCase() + options.sameSite.slice(1)}`;
1530
- }
1531
- return cookie;
1532
- }
1533
- /**
1534
- * Extracts and refines input data from the endpoint context.
1535
- *
1536
- * @param ctx - The endpoint execution context
1537
- * @returns Object containing only the input data (body, query, params)
1538
- * @internal
1539
- */
1540
- refineInput(ctx) {
1541
- return (0, import_lodash_pick.default)(ctx, [
1542
- "body",
1543
- "query",
1544
- "params"
1545
- ]);
1546
- }
1547
- handler = (ctx, response) => {
1548
- for (const [key, value] of Object.entries(this.defaultHeaders)) response.header(key, value);
1549
- const handlerCtx = {
1550
- ...this.refineInput(ctx),
1551
- services: ctx.services,
1552
- logger: ctx.logger,
1553
- header: ctx.header,
1554
- cookie: ctx.cookie,
1555
- session: ctx.session,
1556
- ..."auditor" in ctx && { auditor: ctx.auditor },
1557
- ..."db" in ctx && { db: ctx.db }
1558
- };
1559
- return this.endpointFn(handlerCtx, response);
1560
- };
1561
- /**
1562
- * Type guard to check if an object is an Endpoint instance.
1563
- *
1564
- * @param obj - The object to check
1565
- * @returns True if the object is an Endpoint
1566
- */
1567
- static isEndpoint(obj) {
1568
- return Boolean(obj && obj.__IS_FUNCTION__ === true && obj.type === "dev.geekmidas.function.endpoint");
1569
- }
1570
- /**
1571
- * Helper to check if response has metadata
1572
- */
1573
- static hasMetadata(response) {
1574
- return response !== null && typeof response === "object" && "data" in response && "metadata" in response;
1575
- }
1576
- /**
1577
- * Converts Express-style route params to OpenAPI format.
1578
- * @returns Route with ':param' converted to '{param}'
1579
- * @internal
1580
- */
1581
- get _path() {
1582
- return this.route.replace(/:(\w+)/g, "{$1}");
1583
- }
1584
- /**
1585
- * Generates OpenAPI 3.1 schema for this endpoint.
1586
- *
1587
- * @returns OpenAPI route definition with operation details
1588
- */
1589
- async toOpenApi3Route(componentCollector) {
1590
- const status = String(this.status);
1591
- const operation = {
1592
- operationId: this.operationId,
1593
- ...this.description && { description: this.description },
1594
- ...this.tags && this.tags.length > 0 && { tags: this.tags },
1595
- responses: { [status]: { description: "Successful response" } }
1596
- };
1597
- const scheme = this.authorizer?.securityScheme;
1598
- if (this.authorizer && scheme && componentCollector) {
1599
- componentCollector.addSecurityScheme(this.authorizer.name, scheme);
1600
- operation.security = [{ [this.authorizer.name]: [] }];
1601
- }
1602
- if (this.outputSchema) {
1603
- const responseSchema = await convertSchemaWithComponents(this.outputSchema, componentCollector);
1604
- if (responseSchema) (0, import_lodash_set.default)(operation, [
1605
- "responses",
1606
- status,
1607
- "content",
1608
- this.responseType,
1609
- "schema"
1610
- ], responseSchema);
1611
- }
1612
- const pathParameters = [];
1613
- const queryParameters = [];
1614
- if (this.input && typeof this.input === "object") {
1615
- if ([
1616
- "POST",
1617
- "PUT",
1618
- "PATCH"
1619
- ].includes(this.method) && "body" in this.input && this.input.body) {
1620
- const bodySchema = await convertSchemaWithComponents(this.input.body, componentCollector);
1621
- if (bodySchema) (0, import_lodash_set.default)(operation, ["requestBody"], {
1622
- required: true,
1623
- content: { "application/json": { schema: bodySchema } }
1624
- });
1625
- }
1626
- if ("params" in this.input && this.input.params) {
1627
- const paramsSchema = await convertStandardSchemaToJsonSchema(this.input.params);
1628
- if (paramsSchema && paramsSchema.type === "object" && paramsSchema.properties) for (const [name, schema] of Object.entries(paramsSchema.properties)) pathParameters.push({
1629
- name,
1630
- in: "path",
1631
- required: paramsSchema.required?.includes(name) ?? true,
1632
- schema
1633
- });
1634
- }
1635
- if ("query" in this.input && this.input.query) {
1636
- const querySchema = await convertStandardSchemaToJsonSchema(this.input.query);
1637
- if (querySchema && querySchema.type === "object" && querySchema.properties) for (const [name, schema] of Object.entries(querySchema.properties)) queryParameters.push({
1638
- name,
1639
- in: "query",
1640
- required: querySchema.required?.includes(name) ?? false,
1641
- schema
1642
- });
1643
- }
1644
- }
1645
- if (queryParameters.length > 0) operation.parameters = queryParameters;
1646
- const routeObject = {};
1647
- if (pathParameters.length > 0) routeObject.parameters = pathParameters;
1648
- routeObject[this.method.toLowerCase()] = operation;
1649
- return { [this._path]: routeObject };
1650
- }
1651
- /**
1652
- * Creates a new Endpoint instance.
1653
- *
1654
- * @param options - Configuration options for the endpoint
1655
- * @param options.fn - The handler function to execute
1656
- * @param options.method - HTTP method
1657
- * @param options.route - Route path with parameter placeholders
1658
- * @param options.description - Optional description for documentation
1659
- * @param options.input - Input schemas for validation
1660
- * @param options.logger - Logger instance
1661
- * @param options.output - Output schema for response validation
1662
- * @param options.services - Service dependencies
1663
- * @param options.timeout - Execution timeout in milliseconds
1664
- * @param options.getSession - Session extraction function
1665
- * @param options.authorize - Authorization check function
1666
- * @param options.status - Success HTTP status code (default: 200)
1667
- * @param options.authorizer - Optional authorizer configuration
1668
- */
1669
- constructor({ fn, method, route, description, tags, input, logger, output: outputSchema, services, constructs, timeout, memorySize, getSession, authorize, rateLimit, status = 200, events, authorizer, surface, auditorStorageService, actorExtractor, audits, databaseService, rlsConfig, rlsBypass, responseType, telemetry }) {
1670
- super(fn, timeout, "dev.geekmidas.function.endpoint", input, outputSchema, services, logger, events, memorySize, auditorStorageService, void 0, constructs);
1671
- this.route = route;
1672
- this.method = method;
1673
- this.description = description;
1674
- this.tags = tags;
1675
- this.status = status;
1676
- this.responseType = responseType ?? "application/json";
1677
- this.endpointFn = fn;
1678
- if (telemetry) this.telemetry = telemetry;
1679
- if (getSession) {
1680
- this.hasSession = true;
1681
- this.getSession = (ctx) => getSession({
1682
- ...ctx,
1683
- auth: sessionAuth(surface, ctx.header)
1684
- });
1685
- }
1686
- if (authorize) this.authorize = authorize;
1687
- if (rateLimit) this.rateLimit = rateLimit;
1688
- if (authorizer) this.authorizer = authorizer;
1689
- this.surface = surface;
1690
- if (actorExtractor) this.actorExtractor = actorExtractor;
1691
- if (audits) this.audits = audits;
1692
- if (databaseService) this.databaseService = databaseService;
1693
- if (rlsConfig) this.rlsConfig = rlsConfig;
1694
- if (rlsBypass) this.rlsBypass = rlsBypass;
1695
- }
1696
- };
1697
- /**
1698
- * Response builder for fluent API in handlers
1699
- */
1700
- var ResponseBuilder = class {
1701
- metadata = {
1702
- headers: {},
1703
- cookies: /* @__PURE__ */ new Map()
1704
- };
1705
- header(key, value) {
1706
- this.metadata.headers[key] = value;
1707
- return this;
1708
- }
1709
- cookie(name, value, options) {
1710
- this.metadata.cookies?.set(name, {
1711
- value,
1712
- options
1713
- });
1714
- return this;
1715
- }
1716
- deleteCookie(name, options) {
1717
- this.metadata.cookies?.set(name, {
1718
- value: "",
1719
- options: {
1720
- ...options,
1721
- maxAge: 0,
1722
- expires: /* @__PURE__ */ new Date(0)
1723
- }
1724
- });
1725
- return this;
1726
- }
1727
- status(code) {
1728
- this.metadata.status = code;
1729
- return this;
1730
- }
1731
- /**
1732
- * Send the client to `url` — `Location` and a 3xx, with no body. 303 by
1733
- * default: after a form post, the browser follows it with a GET, so a
1734
- * reload does not post the form again.
1735
- *
1736
- * A redirect is not checked against the endpoint's `.output()` schema, so
1737
- * an endpoint that renders a page can redirect instead.
1738
- *
1739
- * @example
1740
- * ```typescript
1741
- * return response.cookie('session', token).redirect('/dashboard');
1742
- * ```
1743
- */
1744
- redirect(url, status = 303) {
1745
- this.metadata.headers.location = url;
1746
- this.metadata.status = status;
1747
- return {
1748
- data: void 0,
1749
- metadata: this.metadata
1750
- };
1751
- }
1752
- send(data) {
1753
- return {
1754
- data,
1755
- metadata: this.metadata
1756
- };
1757
- }
1758
- getMetadata() {
1759
- return this.metadata;
1760
- }
1761
- };
1762
- /**
1763
- * HTTP success status codes that can be returned by endpoints.
1764
- */
1765
- let SuccessStatus = /* @__PURE__ */ function(SuccessStatus) {
1766
- /** Standard response for successful HTTP requests */
1767
- SuccessStatus[SuccessStatus["OK"] = 200] = "OK";
1768
- /** Request has been fulfilled and resulted in a new resource being created */
1769
- SuccessStatus[SuccessStatus["Created"] = 201] = "Created";
1770
- /** Request has been accepted for processing, but processing is not complete */
1771
- SuccessStatus[SuccessStatus["Accepted"] = 202] = "Accepted";
1772
- /** Server successfully processed the request but is not returning any content */
1773
- SuccessStatus[SuccessStatus["NoContent"] = 204] = "NoContent";
1774
- /** Server successfully processed the request and is not returning any content, client should reset the document view */
1775
- SuccessStatus[SuccessStatus["ResetContent"] = 205] = "ResetContent";
1776
- /** Server is delivering only part of the resource due to a range header */
1777
- SuccessStatus[SuccessStatus["PartialContent"] = 206] = "PartialContent";
1778
- return SuccessStatus;
1779
- }({});
1780
- /**
1781
- * HTTP redirect status codes an endpoint can answer with —
1782
- * `response.redirect(url, status)`, or `.status()` with a `Location` header.
1783
- */
1784
- let RedirectStatus = /* @__PURE__ */ function(RedirectStatus) {
1785
- /** The resource has moved for good; a POST may become a GET */
1786
- RedirectStatus[RedirectStatus["MovedPermanently"] = 301] = "MovedPermanently";
1787
- /** The resource is elsewhere for now; a POST may become a GET */
1788
- RedirectStatus[RedirectStatus["Found"] = 302] = "Found";
1789
- /** See the resource elsewhere, with a GET — the answer to a form post */
1790
- RedirectStatus[RedirectStatus["SeeOther"] = 303] = "SeeOther";
1791
- /** The resource is elsewhere for now; the method and body are kept */
1792
- RedirectStatus[RedirectStatus["TemporaryRedirect"] = 307] = "TemporaryRedirect";
1793
- /** The resource has moved for good; the method and body are kept */
1794
- RedirectStatus[RedirectStatus["PermanentRedirect"] = 308] = "PermanentRedirect";
1795
- return RedirectStatus;
1796
- }({});
1797
- //#endregion
1798
- export { NoAuthenticator as a, SuccessStatus as i, RedirectStatus as n, require_lodash_set as o, ResponseBuilder as r, Endpoint as t };
1799
-
1800
- //# sourceMappingURL=Endpoint-VdaYKc2g.mjs.map