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