@dooboostore/simple-boot-http-server 1.0.26 → 1.0.28

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 (71) hide show
  1. package/README.md +138 -17
  2. package/dist/cjs/SimpleBootHttpServer.js +33 -16
  3. package/dist/cjs/SimpleBootHttpServer.js.map +2 -2
  4. package/dist/cjs/codes/Mimes.js +2 -0
  5. package/dist/cjs/codes/Mimes.js.map +2 -2
  6. package/dist/cjs/decorators/MethodMapping.js +2 -2
  7. package/dist/cjs/decorators/MethodMapping.js.map +2 -2
  8. package/dist/cjs/filters/ResourceFilter.js +0 -1
  9. package/dist/cjs/filters/ResourceFilter.js.map +2 -2
  10. package/dist/cjs/models/RequestResponse.js +52 -0
  11. package/dist/cjs/models/RequestResponse.js.map +3 -3
  12. package/dist/cjs/proxy/RequestResponseInjectProxy.js +35 -0
  13. package/dist/cjs/proxy/RequestResponseInjectProxy.js.map +7 -0
  14. package/dist/cjs/proxy/SymbolIntentApiServiceProxy.js +1 -1
  15. package/dist/cjs/proxy/SymbolIntentApiServiceProxy.js.map +2 -2
  16. package/dist/cjs/proxy/index.js +3 -1
  17. package/dist/cjs/proxy/index.js.map +2 -2
  18. package/dist/cjs/resolvers/Resolver.js.map +1 -1
  19. package/dist/cjs/websocket/WebSocketManager.js +68 -40
  20. package/dist/cjs/websocket/WebSocketManager.js.map +2 -2
  21. package/dist/esm/SimpleBootHttpServer.js +34 -17
  22. package/dist/esm/SimpleBootHttpServer.js.map +2 -2
  23. package/dist/esm/codes/Mimes.js +2 -0
  24. package/dist/esm/codes/Mimes.js.map +2 -2
  25. package/dist/esm/decorators/MethodMapping.js +2 -2
  26. package/dist/esm/decorators/MethodMapping.js.map +2 -2
  27. package/dist/esm/filters/ResourceFilter.js +0 -1
  28. package/dist/esm/filters/ResourceFilter.js.map +2 -2
  29. package/dist/esm/models/RequestResponse.js +52 -0
  30. package/dist/esm/models/RequestResponse.js.map +2 -2
  31. package/dist/esm/proxy/RequestResponseInjectProxy.js +12 -0
  32. package/dist/esm/proxy/RequestResponseInjectProxy.js.map +7 -0
  33. package/dist/esm/proxy/SymbolIntentApiServiceProxy.js +1 -1
  34. package/dist/esm/proxy/SymbolIntentApiServiceProxy.js.map +2 -2
  35. package/dist/esm/proxy/index.js +1 -0
  36. package/dist/esm/proxy/index.js.map +2 -2
  37. package/dist/esm/websocket/WebSocketManager.js +68 -40
  38. package/dist/esm/websocket/WebSocketManager.js.map +2 -2
  39. package/dist/esm-bundle/dooboostore-simple-boot-http-server.esm.js +572 -387
  40. package/dist/esm-bundle/dooboostore-simple-boot-http-server.esm.js.map +4 -4
  41. package/dist/types/SimpleBootHttpServer.d.ts.map +1 -1
  42. package/dist/types/codes/Mimes.d.ts +2 -0
  43. package/dist/types/codes/Mimes.d.ts.map +1 -1
  44. package/dist/types/decorators/MethodMapping.d.ts +13 -8
  45. package/dist/types/decorators/MethodMapping.d.ts.map +1 -1
  46. package/dist/types/filters/ResourceFilter.d.ts.map +1 -1
  47. package/dist/types/models/RequestResponse.d.ts +9 -0
  48. package/dist/types/models/RequestResponse.d.ts.map +1 -1
  49. package/dist/types/proxy/RequestResponseInjectProxy.d.ts +22 -0
  50. package/dist/types/proxy/RequestResponseInjectProxy.d.ts.map +1 -0
  51. package/dist/types/proxy/index.d.ts +1 -0
  52. package/dist/types/proxy/index.d.ts.map +1 -1
  53. package/dist/types/resolvers/Resolver.d.ts +2 -1
  54. package/dist/types/resolvers/Resolver.d.ts.map +1 -1
  55. package/dist/types/websocket/WebSocketManager.d.ts +3 -1
  56. package/dist/types/websocket/WebSocketManager.d.ts.map +1 -1
  57. package/dist/umd-bundle/dooboostore-simple-boot-http-server.umd.js +572 -387
  58. package/dist/umd-bundle/dooboostore-simple-boot-http-server.umd.js.map +4 -4
  59. package/dist/umd-bundle/websocket-client.umd.js +315 -149
  60. package/dist/umd-bundle/websocket-client.umd.js.map +4 -4
  61. package/package.json +9 -9
  62. package/src/SimpleBootHttpServer.ts +38 -17
  63. package/src/codes/Mimes.ts +2 -0
  64. package/src/decorators/MethodMapping.ts +151 -152
  65. package/src/filters/ResourceFilter.ts +0 -1
  66. package/src/models/RequestResponse.ts +50 -0
  67. package/src/proxy/RequestResponseInjectProxy.ts +30 -0
  68. package/src/proxy/SymbolIntentApiServiceProxy.ts +1 -1
  69. package/src/proxy/index.ts +1 -0
  70. package/src/resolvers/Resolver.ts +2 -1
  71. package/src/websocket/WebSocketManager.ts +69 -41
@@ -55,6 +55,7 @@ var dooboostoreSimpleBootHttpServerWebSocketClient = (() => {
55
55
  Fetcher: () => Fetcher,
56
56
  FormValidator: () => FormValidator,
57
57
  FunctionUtils: () => FunctionUtils,
58
+ HashUtils: () => HashUtils,
58
59
  HttpFetcher: () => HttpFetcher,
59
60
  HttpJsonFetcher: () => HttpJsonFetcher,
60
61
  HttpResponseError: () => HttpResponseError,
@@ -135,6 +136,7 @@ var dooboostoreSimpleBootHttpServerWebSocketClient = (() => {
135
136
  isCssCommentItem: () => isCssCommentItem,
136
137
  isCssDeclarationItem: () => isCssDeclarationItem,
137
138
  isCssRuleItem: () => isCssRuleItem,
139
+ isDefined: () => isDefined,
138
140
  isHttpResponseError: () => isHttpResponseError,
139
141
  isPoint2DType: () => isPoint2DType,
140
142
  isPoint3DType: () => isPoint3DType,
@@ -180,6 +182,12 @@ var dooboostoreSimpleBootHttpServerWebSocketClient = (() => {
180
182
  return false;
181
183
  }
182
184
  };
185
+ ValidUtils2.isGenerator = (value) => {
186
+ return value !== null && typeof value === "object" && typeof value.next === "function" && typeof value[Symbol.iterator] === "function";
187
+ };
188
+ ValidUtils2.isAsyncGenerator = (value) => {
189
+ return value !== null && typeof value === "object" && typeof value.next === "function" && typeof value[Symbol.asyncIterator] === "function";
190
+ };
183
191
  ValidUtils2.isFrozen = (obj) => {
184
192
  return Object.isFrozen(obj);
185
193
  };
@@ -2094,6 +2102,12 @@ var dooboostoreSimpleBootHttpServerWebSocketClient = (() => {
2094
2102
  this.z = z ?? 0;
2095
2103
  }
2096
2104
  }
2105
+ /**
2106
+ * 성분 대입 (파괴적). 벡터 전달 시 그 성분을 복사.
2107
+ * @example
2108
+ * v.set(1, 2, 3); // v = (1, 2, 3)
2109
+ * v.set(otherVector); // v = other와 동일 성분
2110
+ */
2097
2111
  set(v, y = 0, z = 0) {
2098
2112
  if (v instanceof _Vector || v instanceof Point3D) {
2099
2113
  this.set(v.x || 0, v.y || 0, v.z || 0);
@@ -2104,16 +2118,45 @@ var dooboostoreSimpleBootHttpServerWebSocketClient = (() => {
2104
2118
  }
2105
2119
  return this;
2106
2120
  }
2121
+ /**
2122
+ * 복사본 반환 (비파괴). 파괴적 메서드와 조합해 원본 보존용.
2123
+ * @example
2124
+ * const s = a.get(); s.add(b); // s = a+b, a는 그대로
2125
+ */
2107
2126
  get() {
2108
2127
  return new _Vector(this.x, this.y, this.z);
2109
2128
  }
2110
- // 피타고라스의 정리는 a의 제곱 더하기 b 의 제곱은 c 의 제곱과 같다는 것을 정의합니다.
2111
- mag() {
2129
+ /**
2130
+ * 노름(norm). 평평한 공간(유클리드 공간)에서의 직선 거리.
2131
+ * - 수식: ‖v‖ = √(x² + y² + z²)
2132
+ * - 2D에서는 피타고라스 정리 그 자체. 3D는 두 번 적용한 것과 같음.
2133
+ * (바닥 대각선 √(x²+y²) → 공간 대각선 √((바닥)²+z²))
2134
+ * - "유클리드"는 평평한 공간의 기하학을 말함 (좌표계는 데카르트의 것, 유클리드는 좌표 없이 기하학을 세움).
2135
+ * 휘어진 공간(구면·쌍곡)에서는 이 공식이 성립하지 않음.
2136
+ * @example
2137
+ * new Vector(3, 4, 0).norm(); // 5
2138
+ * new Vector(6, 8, 0).norm(); // 10
2139
+ */
2140
+ norm() {
2112
2141
  const x = this.x;
2113
2142
  const y = this.y;
2114
2143
  const z = this.z;
2115
2144
  return Math.sqrt(x * x + y * y + z * z);
2116
2145
  }
2146
+ /**
2147
+ * norm()의 별칭 (p5.js 호환).
2148
+ * @example
2149
+ * new Vector(3, 4, 0).mag(); // 5
2150
+ */
2151
+ mag() {
2152
+ return this.norm();
2153
+ }
2154
+ /**
2155
+ * 덧셈 (파괴적). 성분별 합. 기하학적으로 평행사변형의 대각선.
2156
+ * - 수식: a + b = (ax+bx, ay+by, az+bz)
2157
+ * @example
2158
+ * const a = new Vector(4, 2); a.add(new Vector(-2, 3)); // a = (2, 5)
2159
+ */
2117
2160
  add(v, y = 0, z = 0) {
2118
2161
  if (v instanceof _Vector || v instanceof Point3D) {
2119
2162
  this.x += v.x;
@@ -2125,12 +2168,24 @@ var dooboostoreSimpleBootHttpServerWebSocketClient = (() => {
2125
2168
  this.z += z;
2126
2169
  }
2127
2170
  }
2171
+ /**
2172
+ * 덧셈 결과의 새 벡터 반환 (비파괴).
2173
+ * - 수식: a + b = (ax+bx, ay+by, az+bz)
2174
+ * @example
2175
+ * const s = a.toAdd(a, b); // s = a+b, a·b는 그대로
2176
+ */
2128
2177
  toAdd(v1, v2) {
2129
2178
  return new _Vector(v1.x + v2.x, v1.y + v2.y, v1.x + v2.y);
2130
2179
  }
2131
2180
  // public static add(v1: Vector, v2: Vector): Vector {
2132
2181
  // return new Vector(v1.x + v2.x, v1.y + v2.y, v1.x + v2.y);
2133
2182
  // }
2183
+ /**
2184
+ * 뺄셈 (파괴적). a - b는 "a에서 b를 되돌리는" 벡터.
2185
+ * - 수식: a - b = (ax-bx, ay-by, az-bz)
2186
+ * @example
2187
+ * const a = new Vector(4, 2); a.sub(new Vector(1, 1)); // a = (3, 1)
2188
+ */
2134
2189
  sub(v, y = 0, z = 0) {
2135
2190
  if (v instanceof _Vector || v instanceof Point3D) {
2136
2191
  this.x -= v.x;
@@ -2142,6 +2197,12 @@ var dooboostoreSimpleBootHttpServerWebSocketClient = (() => {
2142
2197
  this.z -= z;
2143
2198
  }
2144
2199
  }
2200
+ /**
2201
+ * 뺄셈 결과의 새 벡터 반환 (비파괴).
2202
+ * - 수식: a - b = (ax-bx, ay-by, az-bz)
2203
+ * @example
2204
+ * const d = a.toSub(b); // d = a-b, a·b는 그대로
2205
+ */
2145
2206
  toSub(v2) {
2146
2207
  const v1 = this;
2147
2208
  return new _Vector(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z);
@@ -2150,6 +2211,12 @@ var dooboostoreSimpleBootHttpServerWebSocketClient = (() => {
2150
2211
  // public static sub(v1: Vector, v2: Vector): Vector {
2151
2212
  // return new Vector(v1.x - v2.x, v1.y - v2.y, v1.z - v2.z);
2152
2213
  // }
2214
+ /**
2215
+ * 스칼라배 또는 성분별 곱 (파괴적). 스칼라 k>1이면 늘어나고, 0<k<1이면 줄어듦. k<0이면 반대 방향.
2216
+ * - 수식(스칼라): k·v = (k·x, k·y, k·z)
2217
+ * @example
2218
+ * const v = new Vector(1, 2); v.mult(3); // v = (3, 6)
2219
+ */
2153
2220
  mult(v) {
2154
2221
  if (v instanceof _Vector || v instanceof Point3D) {
2155
2222
  this.x *= v.x;
@@ -2162,6 +2229,12 @@ var dooboostoreSimpleBootHttpServerWebSocketClient = (() => {
2162
2229
  }
2163
2230
  return this;
2164
2231
  }
2232
+ /**
2233
+ * 성분별 곱 결과의 새 벡터 반환 (비파괴).
2234
+ * - 수식: (ax·bx, ay·by, az·bz)
2235
+ * @example
2236
+ * const m = a.toMult(b); // m = 성분별 곱, a·b는 그대로
2237
+ */
2165
2238
  toMult(v2) {
2166
2239
  const v1 = this;
2167
2240
  return new _Vector(v1.x *= v2.x, v1.y *= v2.y, v1.z *= v2.z);
@@ -2169,6 +2242,12 @@ var dooboostoreSimpleBootHttpServerWebSocketClient = (() => {
2169
2242
  // public static mult(v1: Vector, v2: Vector) {
2170
2243
  // return new Vector(v1.x *= v2.x, v1.y *= v2.y, v1.z *= v2.z);
2171
2244
  // }
2245
+ /**
2246
+ * 스칼라 나눗셈 또는 성분별 나눗셈 (파괴적). 정규화의 핵심 연산.
2247
+ * - 수식(스칼라): v/k = (x/k, y/k, z/k)
2248
+ * @example
2249
+ * const v = new Vector(6, 8); v.div(2); // v = (3, 4)
2250
+ */
2172
2251
  div(v) {
2173
2252
  if (v instanceof _Vector || v instanceof Point3D) {
2174
2253
  this.x /= v.x;
@@ -2181,6 +2260,12 @@ var dooboostoreSimpleBootHttpServerWebSocketClient = (() => {
2181
2260
  }
2182
2261
  return this;
2183
2262
  }
2263
+ /**
2264
+ * 스칼라 나눗셈 결과의 새 벡터 반환 (비파괴).
2265
+ * - 수식: v/k = (x/k, y/k, z/k)
2266
+ * @example
2267
+ * const h = v.toDiv(2); // h = v/2, v는 그대로
2268
+ */
2184
2269
  toDiv(d) {
2185
2270
  const v = this;
2186
2271
  const rv = v.get();
@@ -2196,10 +2281,22 @@ var dooboostoreSimpleBootHttpServerWebSocketClient = (() => {
2196
2281
  // rv.z /= d;
2197
2282
  // return rv;
2198
2283
  // }
2284
+ /**
2285
+ * 두 점(벡터) 사이 거리. 차 벡터의 크기.
2286
+ * - 수식: d = √((dx)² + (dy)² + (dz)²)
2287
+ * @example
2288
+ * new Vector(0, 0).dist(new Vector(3, 4)); // 5
2289
+ */
2199
2290
  dist(v) {
2200
2291
  const dx = this.x - v.x, dy = this.y - v.y, dz = this.z - v.z;
2201
2292
  return Math.sqrt(dx * dx + dy * dy + dz * dz);
2202
2293
  }
2294
+ /**
2295
+ * 두 점(벡터) 사이 거리 (toDist는 dist와 동일, 비파괴).
2296
+ * - 수식: d = √((dx)² + (dy)² + (dz)²)
2297
+ * @example
2298
+ * a.toDist(b); // a와 b 사이 거리
2299
+ */
2203
2300
  toDist(v2) {
2204
2301
  const v1 = this;
2205
2302
  const dx = v1.x - v2.x, dy = v1.y - v2.y, dz = v1.z - v2.z;
@@ -2211,36 +2308,90 @@ var dooboostoreSimpleBootHttpServerWebSocketClient = (() => {
2211
2308
  // dz = v1.z - v2.z;
2212
2309
  // return Math.sqrt(dx * dx + dy * dy + dz * dz);
2213
2310
  // }
2214
- dot(v, y, z) {
2311
+ /**
2312
+ * 내적(dot product). 두 벡터가 같은 방향을 향하는 정도.
2313
+ * - 수식: a·b = ax·bx + ay·by + az·bz = |a||b|cosθ
2314
+ * - θ=90°면 0(직교), 0°면 최대(같은 방향).
2315
+ * - 벡터 전달 시 y·z 생략 가능, 스칼라(x) 전달 시 y·z와 함께 사용.
2316
+ * @example
2317
+ * new Vector(5, 12).dot(new Vector(-5, 12)); // -25+144 = 119
2318
+ * new Vector(1, 0).dot(new Vector(0, 1)); // 0 (직각)
2319
+ * new Vector(1, 2).dot(3, 4); // 1*3+2*4 = 11
2320
+ */
2321
+ dot(v, y = 0, z = 0) {
2215
2322
  if (v instanceof _Vector || v instanceof Point3D) {
2216
2323
  return this.x * v.x + this.y * v.y + this.z * v.z;
2217
2324
  }
2218
2325
  ;
2219
2326
  return this.x * v + this.y * y + this.z * z;
2220
2327
  }
2328
+ /**
2329
+ * 외적(cross product). 두 벡터에 수직인 벡터. 오른손 법칙 방향.
2330
+ * - 수식: a×b = (ay·bz − az·by, az·bx − ax·bz, ax·by − ay·bx)
2331
+ * - 2D에서는 z값 = ax·by − ay·bx (부호 있는 면적, 회전 방향 판정용).
2332
+ * @example
2333
+ * new Vector(1, 0, 0).cross(new Vector(0, 1, 0)); // (0, 0, 1)
2334
+ */
2221
2335
  cross(v) {
2222
2336
  const x = this.x, y = this.y, z = this.z;
2223
2337
  return new _Vector(y * v.z - v.y * z, z * v.x - v.z * x, x * v.y - v.x * y);
2224
2338
  }
2339
+ /**
2340
+ * 정규화 (파괴적). 방향은 그대로, 크기를 1로. 단위벡터 v̂ 생성.
2341
+ * - 수식: v̂ = v / |v|
2342
+ * - 영벡터(|v|=0)는 0으로 나누지 않고 그대로 둠.
2343
+ * @example
2344
+ * const v = new Vector(6, 8); v.normalize(); // v = (0.6, 0.8), |v| = 1
2345
+ */
2225
2346
  normalize() {
2226
- const m = this.mag();
2347
+ const m = this.norm();
2227
2348
  if (m > 0) this.div(m);
2228
2349
  }
2350
+ /**
2351
+ * 크기 상한 (파괴적). 속도가 high를 넘으면 방향 유지한 채 high로 자름. 물리 시뮬레이션 최고속도용.
2352
+ * - 수식: |v| > high → v = v̂ · high
2353
+ * @example
2354
+ * const v = new Vector(6, 8); v.limit(5); // |v|=10 → 5, v = (3, 4)
2355
+ */
2229
2356
  limit(high) {
2230
- if (this.mag() > high) {
2357
+ if (this.norm() > high) {
2231
2358
  this.normalize();
2232
2359
  this.mult(high);
2233
2360
  }
2234
2361
  }
2362
+ /**
2363
+ * 2D 방향각. +x축 기준 반시계 방향 라디안 (-π ~ π).
2364
+ * - 수식: θ = atan2(y, x)
2365
+ * @example
2366
+ * new Vector(1, 1).heading2D(); // π/4 (45°)
2367
+ * new Vector(-1, 0).heading2D(); // π (180°)
2368
+ */
2235
2369
  heading2D() {
2236
2370
  return -Math.atan2(-this.y, this.x);
2237
2371
  }
2372
+ /**
2373
+ * 무작위 방향 단위벡터 반환 (새 Vector, 자신은 변경 안 함).
2374
+ * @example
2375
+ * const r = new Vector().random2D(); // |r| = 1, 방향 랜덤
2376
+ */
2238
2377
  random2D() {
2239
2378
  return this.fromAngle(Math.random() * (2 * Math.PI));
2240
2379
  }
2380
+ /**
2381
+ * 각도→벡터. 각도 θ, 길이 L인 2D 벡터 반환 (새 Vector).
2382
+ * - 수식: (L·cosθ, L·sinθ, 0)
2383
+ * @example
2384
+ * new Vector().fromAngle(Math.PI / 3, 2); // (1, 1.73, 0)
2385
+ */
2241
2386
  fromAngle(angle, length = 1) {
2242
2387
  return new _Vector(length * Math.cos(angle), length * Math.sin(angle), 0);
2243
2388
  }
2389
+ /**
2390
+ * 구면좌표→3D 벡터 (새 Vector 반환, p5.js 컨벤션).
2391
+ * - 수식: (L·sinθ·sinφ, −L·cosθ, L·sinθ·cosφ)
2392
+ * @example
2393
+ * new Vector().fromAngles(Math.PI / 2, Math.PI / 2, 1); // (1, 0, 0)
2394
+ */
2244
2395
  fromAngles(theta, phi, length = 1) {
2245
2396
  const cosPhi = Math.cos(phi);
2246
2397
  const sinPhi = Math.sin(phi);
@@ -2252,18 +2403,43 @@ var dooboostoreSimpleBootHttpServerWebSocketClient = (() => {
2252
2403
  length * sinTheta * cosPhi
2253
2404
  );
2254
2405
  }
2406
+ /**
2407
+ * 성분 배열 반환. [x, y, z] 순서.
2408
+ * @example
2409
+ * new Vector(1, 2, 3).array(); // [1, 2, 3]
2410
+ */
2255
2411
  array() {
2256
2412
  return [this.x, this.y, this.z];
2257
2413
  }
2414
+ /**
2415
+ * Point3D로 변환 (위치 의미로 바꿀 때).
2416
+ * @example
2417
+ * new Vector(1, 2, 3).toPoint3D(); // Point3D(1, 2, 3)
2418
+ */
2258
2419
  toPoint3D() {
2259
2420
  return new Point3D(this.x, this.y, this.z);
2260
2421
  }
2422
+ /**
2423
+ * Point2D로 변환 (z 버림).
2424
+ * @example
2425
+ * new Vector(1, 2, 3).toPoint2D(); // Point2D(1, 2)
2426
+ */
2261
2427
  toPoint2D() {
2262
2428
  return new Point2D(this.x, this.y);
2263
2429
  }
2430
+ /**
2431
+ * 복사본 반환 (get()과 동일, 비파괴).
2432
+ * @example
2433
+ * const c = v.copy(); // v와 같은 성분의 새 벡터
2434
+ */
2264
2435
  copy() {
2265
2436
  return new _Vector(this.x, this.y, this.z);
2266
2437
  }
2438
+ /**
2439
+ * 문자열 표현. "[x, y, z]" 형식.
2440
+ * @example
2441
+ * new Vector(1, 2).toString(); // "[1, 2, 0]"
2442
+ */
2267
2443
  toString() {
2268
2444
  return "[" + this.x + ", " + this.y + ", " + this.z + "]";
2269
2445
  }
@@ -4456,87 +4632,64 @@ var dooboostoreSimpleBootHttpServerWebSocketClient = (() => {
4456
4632
  // ../core/dist/esm/promise/AbortablePromise.js
4457
4633
  var AbortablePromise = class _AbortablePromise {
4458
4634
  constructor(executor, signal) {
4459
- this.steps = [];
4460
- this.initialExecutor = executor;
4461
4635
  this.signal = signal;
4636
+ if (typeof executor !== "function") {
4637
+ this.source = Promise.resolve(executor);
4638
+ } else if (signal?.aborted) {
4639
+ this.source = Promise.reject(signal.reason);
4640
+ } else {
4641
+ this.source = Promise.resolve().then(executor);
4642
+ }
4643
+ }
4644
+ /**
4645
+ * source 를 abort 와 경쟁시킨 promise. 실제로 소비될 때(then/toPromise) 한 번만 만든다 —
4646
+ * await 는 then() 이 돌려준 새 인스턴스를 버리므로, 미리 만들면 아무도 안 받는 reject 가 unhandled 로 남는다.
4647
+ */
4648
+ get promise() {
4649
+ if (this.guarded) return this.guarded;
4650
+ const signal = this.signal;
4651
+ if (!signal) return this.guarded = this.source;
4652
+ if (signal.aborted) {
4653
+ this.source.catch(() => {
4654
+ });
4655
+ return this.guarded = Promise.reject(signal.reason);
4656
+ }
4657
+ return this.guarded = new Promise((resolve, reject) => {
4658
+ const cleanup = () => signal.removeEventListener("abort", onAbort);
4659
+ const onAbort = () => reject(signal.reason);
4660
+ signal.addEventListener("abort", onAbort, { once: true });
4661
+ this.source.then(
4662
+ (value) => {
4663
+ cleanup();
4664
+ resolve(value);
4665
+ },
4666
+ (reason) => {
4667
+ cleanup();
4668
+ reject(reason);
4669
+ }
4670
+ );
4671
+ });
4462
4672
  }
4463
4673
  then(onfulfilled, onrejected) {
4464
- const newPromise = new _AbortablePromise(
4465
- this.initialExecutor,
4466
- this.signal
4674
+ const signal = this.signal;
4675
+ const next = this.promise.then(
4676
+ onfulfilled ? (value) => {
4677
+ if (signal?.aborted) throw signal.reason;
4678
+ return onfulfilled(value);
4679
+ } : void 0,
4680
+ onrejected
4467
4681
  );
4468
- newPromise.steps = [...this.steps];
4469
- if (onfulfilled) {
4470
- newPromise.steps.push(onfulfilled);
4471
- }
4472
- if (onrejected) {
4473
- newPromise.errorHandler = onrejected;
4474
- } else if (this.errorHandler) {
4475
- newPromise.errorHandler = this.errorHandler;
4476
- }
4477
- return newPromise;
4682
+ return new _AbortablePromise(next, signal);
4478
4683
  }
4479
4684
  catch(onrejected) {
4480
4685
  return this.then(void 0, onrejected);
4481
4686
  }
4482
4687
  finally(onfinally) {
4483
- return this.then(
4484
- (value) => {
4485
- onfinally?.();
4486
- return value;
4487
- },
4488
- (reason) => {
4489
- onfinally?.();
4490
- throw reason;
4491
- }
4492
- );
4493
- }
4494
- async execute() {
4495
- try {
4496
- if (this.signal?.aborted) {
4497
- throw new Error(this.signal.reason || "Aborted");
4498
- }
4499
- const abortPromise = new Promise((_, reject) => {
4500
- if (this.signal?.aborted) {
4501
- return reject(new Error(this.signal.reason || "Aborted"));
4502
- }
4503
- const callback = (e) => {
4504
- const target = e.target;
4505
- this.signal?.removeEventListener("abort", callback);
4506
- reject(new Error(target.reason || "Aborted"));
4507
- };
4508
- this.signal?.addEventListener("abort", callback, { once: true });
4509
- });
4510
- const pipelineRunner = async () => {
4511
- let lastResult;
4512
- if (typeof this.initialExecutor === "function") {
4513
- if (this.signal?.aborted) {
4514
- throw new Error(this.signal.reason || "Aborted");
4515
- }
4516
- lastResult = await this.initialExecutor();
4517
- } else {
4518
- lastResult = await this.initialExecutor;
4519
- }
4520
- for (let i = 0; i < this.steps.length; i++) {
4521
- if (this.signal?.aborted) {
4522
- throw new Error(this.signal.reason || "Aborted");
4523
- }
4524
- const step = this.steps[i];
4525
- lastResult = await step(lastResult);
4526
- }
4527
- return lastResult;
4528
- };
4529
- return await Promise.race([pipelineRunner(), abortPromise]);
4530
- } catch (error) {
4531
- if (this.errorHandler) {
4532
- return await this.errorHandler(error);
4533
- }
4534
- throw error;
4535
- }
4688
+ return new _AbortablePromise(this.promise.finally(onfinally), this.signal);
4536
4689
  }
4537
- // Convert to native Promise
4690
+ // 네이티브 Promise 로 변환 (그냥 await 해도 된다)
4538
4691
  toPromise() {
4539
- return this.execute();
4692
+ return this.promise;
4540
4693
  }
4541
4694
  };
4542
4695
 
@@ -5409,11 +5562,15 @@ var dooboostoreSimpleBootHttpServerWebSocketClient = (() => {
5409
5562
  resolve(gdata);
5410
5563
  }).catch(async (e) => {
5411
5564
  this.error(config, pipe, e);
5412
- config?.error?.();
5565
+ config?.error?.(e);
5413
5566
  if (config?.errorTransform) {
5414
5567
  e = await config.errorTransform(e);
5415
5568
  }
5416
- e = await this.errorTransform(e);
5569
+ try {
5570
+ e = await this.errorTransform(e);
5571
+ } catch (ee) {
5572
+ e = ee;
5573
+ }
5417
5574
  reject(e);
5418
5575
  }).finally(() => {
5419
5576
  this.finally(config, pipe);
@@ -5430,41 +5587,30 @@ var dooboostoreSimpleBootHttpServerWebSocketClient = (() => {
5430
5587
  return data instanceof HttpResponseError;
5431
5588
  };
5432
5589
  var HttpFetcher = class extends Fetcher {
5590
+ // get/post/put/patch/head/delete가 전부 config.config.fetch.method를 세팅하려고 caller가
5591
+ // 넘긴 config(.fetch) 객체를 직접 mutate했다 - 같은 config 객체를 여러 호출이 공유하면
5592
+ // (예: Promise.all로 동시에 get/post) 서로의 method를 덮어쓰는 레이스가 생겼다. caller의
5593
+ // 객체는 절대 건드리지 않고, 얕은 복사본 위에 method만 얹어서 반환한다.
5594
+ withMethod(config, method) {
5595
+ return { ...config, config: { ...config.config, fetch: { ...config.config?.fetch, method } } };
5596
+ }
5433
5597
  get(config) {
5434
- config.config ?? (config.config = {});
5435
- config.config.fetch = config.config?.fetch ?? {};
5436
- config.config.fetch.method = "GET";
5437
- return this.fetch(config);
5598
+ return this.fetch(this.withMethod(config, "GET"));
5438
5599
  }
5439
5600
  post(config) {
5440
- config.config ?? (config.config = {});
5441
- config.config.fetch = config.config?.fetch ?? {};
5442
- config.config.fetch.method = "POST";
5443
- return this.fetch(config);
5601
+ return this.fetch(this.withMethod(config, "POST"));
5444
5602
  }
5445
5603
  patch(config) {
5446
- config.config ?? (config.config = {});
5447
- config.config.fetch = config.config?.fetch ?? {};
5448
- config.config.fetch.method = "PATCH";
5449
- return this.fetch(config);
5604
+ return this.fetch(this.withMethod(config, "PATCH"));
5450
5605
  }
5451
5606
  put(config) {
5452
- config.config ?? (config.config = {});
5453
- config.config.fetch = config.config?.fetch ?? {};
5454
- config.config.fetch.method = "PUT";
5455
- return this.fetch(config);
5607
+ return this.fetch(this.withMethod(config, "PUT"));
5456
5608
  }
5457
5609
  head(config) {
5458
- config.config ?? (config.config = {});
5459
- config.config.fetch = config.config?.fetch ?? {};
5460
- config.config.fetch.method = "HEAD";
5461
- return this.fetch(config);
5610
+ return this.fetch(this.withMethod(config, "HEAD"));
5462
5611
  }
5463
5612
  delete(config) {
5464
- config.config ?? (config.config = {});
5465
- config.config.fetch = config.config?.fetch ?? {};
5466
- config.config.fetch.method = "DELETE";
5467
- return this.fetch(config);
5613
+ return this.fetch(this.withMethod(config, "DELETE"));
5468
5614
  }
5469
5615
  async beforeProxyFetch(config) {
5470
5616
  return config;
@@ -5501,7 +5647,7 @@ var dooboostoreSimpleBootHttpServerWebSocketClient = (() => {
5501
5647
  }
5502
5648
  } else {
5503
5649
  httpResponseError.body = e;
5504
- httpResponseError.message = e.message;
5650
+ httpResponseError.message = e?.message;
5505
5651
  }
5506
5652
  return httpResponseError;
5507
5653
  }
@@ -5511,7 +5657,7 @@ var dooboostoreSimpleBootHttpServerWebSocketClient = (() => {
5511
5657
  if (!(target instanceof URL) && typeof target !== "string") {
5512
5658
  const searchParams = ConvertUtils.toURLSearchParams(target.searchParams ?? {});
5513
5659
  try {
5514
- const url = typeof target.url === "string" ? new URL(target.url) : target.url;
5660
+ const url = new URL(target.url);
5515
5661
  searchParams.forEach((value, key) => {
5516
5662
  url.searchParams.append(key, value);
5517
5663
  });
@@ -5526,43 +5672,30 @@ var dooboostoreSimpleBootHttpServerWebSocketClient = (() => {
5526
5672
  }
5527
5673
  }
5528
5674
  const beforeProxyData = { requestInfo: target, init: config?.fetch };
5529
- let beforeData = config?.beforeProxyFetch ? await config?.beforeProxyFetch(config) : beforeProxyData.requestInfo;
5530
- beforeData = config?.skipGlobalBeforeProxyFetch ? beforeProxyData : await this.beforeProxyFetch(beforeProxyData);
5675
+ let beforeData = config?.beforeProxyFetch ? await config?.beforeProxyFetch(beforeProxyData) : beforeProxyData;
5676
+ beforeData = config?.skipGlobalBeforeProxyFetch ? beforeData : await this.beforeProxyFetch(beforeData);
5531
5677
  target = beforeData.requestInfo;
5532
5678
  if (beforeData.init) {
5533
5679
  config ?? (config = {});
5534
5680
  config.fetch = beforeData.init;
5535
5681
  }
5536
- let abortedTimeout;
5682
+ let requestInit = config?.fetch;
5537
5683
  if (config?.fetch && "timeout" in config.fetch) {
5538
- const abortController = new AbortController();
5539
- abortedTimeout = setTimeout(() => {
5540
- if (config?.fetch?.signal) {
5541
- const inputSignal = config.fetch.signal;
5542
- const listener = () => {
5543
- if (!abortController.signal.aborted) {
5544
- abortController.abort();
5545
- }
5546
- inputSignal.removeEventListener("abort", listener);
5547
- };
5548
- inputSignal.addEventListener("abort", listener);
5549
- }
5550
- if (!abortController.signal.aborted) {
5551
- abortController.abort();
5552
- }
5553
- }, config.fetch.timeout);
5554
- config.fetch.signal = abortController.signal;
5684
+ const timeoutSignal = AbortSignal.timeout(config.fetch.timeout);
5685
+ const signal = config.fetch.signal ? AbortSignal.any([timeoutSignal, config.fetch.signal]) : timeoutSignal;
5686
+ requestInit = { ...config.fetch, signal };
5555
5687
  }
5556
- this.beforeFetch({ target, requestInit: config?.fetch });
5557
- return (config.fetcher ?? fetch)(target, config?.fetch).then(async (it) => {
5558
- this.afterFetch({ target, requestInit: config?.fetch }, it);
5688
+ this.beforeFetch({ target, requestInit });
5689
+ return (config.fetcher ?? fetch)(target, requestInit).then(async (it) => {
5690
+ this.afterFetch({ target, requestInit }, it);
5559
5691
  const afterProxyData = {
5560
- fetch: { target, requestInit: config.fetch },
5692
+ fetch: { target, requestInit },
5561
5693
  config: beforeData,
5562
5694
  response: it
5563
5695
  };
5564
- it = config?.afterProxyFetch ? await config.afterProxyFetch(afterProxyData) : it;
5565
- it = config?.skipGlobalAfterProxyFetch ? it : await this.afterProxyFetch(afterProxyData);
5696
+ afterProxyData.response = config?.afterProxyFetch ? await config.afterProxyFetch(afterProxyData) : it;
5697
+ afterProxyData.response = config?.skipGlobalAfterProxyFetch ? afterProxyData.response : await this.afterProxyFetch(afterProxyData);
5698
+ it = afterProxyData.response;
5566
5699
  config?.fetchResponseAfterCallBack?.(it, config);
5567
5700
  if (!config?.allowedResponseNotOk && !it.ok) {
5568
5701
  throw it;
@@ -5572,30 +5705,31 @@ var dooboostoreSimpleBootHttpServerWebSocketClient = (() => {
5572
5705
  throw data;
5573
5706
  }
5574
5707
  return it;
5575
- }).finally(() => {
5576
- if (abortedTimeout) {
5577
- clearTimeout(abortedTimeout);
5578
- }
5579
5708
  });
5580
5709
  }
5581
5710
  };
5582
5711
 
5583
5712
  // ../core/dist/esm/fetch/HttpJsonFetcher.js
5584
5713
  var HttpJsonFetcher = class extends HttpFetcher {
5714
+ // config.config/config.config.fetch를 직접 mutate하면(예전처럼) 같은 config 객체를 여러
5715
+ // postJson/patchJson/putJson 호출이 동시에 공유할 때 서로의 headers/body를 덮어쓰는 레이스가
5716
+ // 생긴다(HttpFetcher.get/post의 method 레이스랑 같은 문제). caller의 객체는 안 건드리고,
5717
+ // 얕은 복사본을 만들어서 새 config 객체를 리턴한다.
5585
5718
  updateJsonFetchConfigAndData(config) {
5586
- var _a, _b;
5587
5719
  const headers = {
5588
5720
  "Content-Type": "application/json",
5589
5721
  Accept: "application/json, text/plain, */*"
5590
5722
  };
5591
- config.config ?? (config.config = {});
5592
- (_a = config.config).fetch ?? (_a.fetch = {});
5593
- (_b = config.config.fetch).headers ?? (_b.headers = {});
5594
- config.config.fetch.headers = { ...headers, ...config.config.fetch?.headers };
5595
- if (config.config?.fetch?.body && typeof config.config?.fetch?.body !== "string") {
5596
- config.config.fetch.body = JSON.stringify(config.config.fetch.body);
5723
+ const fetchInit = { ...config.config?.fetch };
5724
+ const merged = new Headers(headers);
5725
+ if (fetchInit.headers) {
5726
+ new Headers(fetchInit.headers).forEach((value, key) => merged.set(key, value));
5597
5727
  }
5598
- return config;
5728
+ fetchInit.headers = merged;
5729
+ if (fetchInit.body && typeof fetchInit.body !== "string") {
5730
+ fetchInit.body = JSON.stringify(fetchInit.body);
5731
+ }
5732
+ return { ...config, config: { ...config.config, fetch: fetchInit } };
5599
5733
  }
5600
5734
  get(config) {
5601
5735
  return super.get(config);
@@ -7109,7 +7243,7 @@ var dooboostoreSimpleBootHttpServerWebSocketClient = (() => {
7109
7243
 
7110
7244
  // ../core/dist/esm/url/UrlUtils.js
7111
7245
  var UrlUtils;
7112
- ((UrlUtils2) => {
7246
+ (function(UrlUtils2) {
7113
7247
  UrlUtils2.origin = (fullurl) => {
7114
7248
  return new URL(fullurl).origin;
7115
7249
  };
@@ -7147,15 +7281,28 @@ var dooboostoreSimpleBootHttpServerWebSocketClient = (() => {
7147
7281
  });
7148
7282
  return searchParams;
7149
7283
  };
7284
+ UrlUtils2.toAbsoluteUrl = (relative, base) => {
7285
+ return new URL(relative, base);
7286
+ };
7287
+ function toAbsoluteRequest(input, base) {
7288
+ if (input instanceof URL) {
7289
+ return UrlUtils2.toAbsoluteUrl(input.href, base);
7290
+ }
7291
+ if (typeof input === "string") {
7292
+ return UrlUtils2.toAbsoluteUrl(input, base).href;
7293
+ }
7294
+ return new Request(UrlUtils2.toAbsoluteUrl(input.url, base).href, input);
7295
+ }
7296
+ UrlUtils2.toAbsoluteRequest = toAbsoluteRequest;
7150
7297
  UrlUtils2.manipulateSearchParams = (searchParams, options) => {
7151
7298
  if (options?.delete) {
7152
- (0, UrlUtils2.deleteSearchParam)(searchParams, options.delete);
7299
+ UrlUtils2.deleteSearchParam(searchParams, options.delete);
7153
7300
  }
7154
7301
  if (options?.append) {
7155
- (0, UrlUtils2.appendSearchParam)(searchParams, options.append);
7302
+ UrlUtils2.appendSearchParam(searchParams, options.append);
7156
7303
  }
7157
7304
  if (options?.upsert) {
7158
- (0, UrlUtils2.upsertSearchParam)(searchParams, options.upsert);
7305
+ UrlUtils2.upsertSearchParam(searchParams, options.upsert);
7159
7306
  }
7160
7307
  return searchParams;
7161
7308
  };
@@ -7406,12 +7553,13 @@ var dooboostoreSimpleBootHttpServerWebSocketClient = (() => {
7406
7553
  ReflectUtils2.findMetadata = (metadataKey, target, propertyKey) => {
7407
7554
  if (target == null) return void 0;
7408
7555
  let searchTarget = typeof target === "object" && typeof target !== "function" ? target.constructor : target;
7409
- while (searchTarget && searchTarget !== Object) {
7556
+ const seen = /* @__PURE__ */ new Set();
7557
+ while (searchTarget && searchTarget !== Object && !seen.has(searchTarget)) {
7558
+ seen.add(searchTarget);
7410
7559
  const data = propertyKey ? Reflect.getOwnMetadata(metadataKey, searchTarget, propertyKey) : Reflect.getOwnMetadata(metadataKey, searchTarget);
7411
7560
  if (data !== void 0) return data;
7412
7561
  const proto = Object.getPrototypeOf(searchTarget);
7413
7562
  searchTarget = proto && typeof proto === "function" ? proto : proto?.constructor || null;
7414
- if (searchTarget === target) break;
7415
7563
  }
7416
7564
  return void 0;
7417
7565
  };
@@ -7419,12 +7567,13 @@ var dooboostoreSimpleBootHttpServerWebSocketClient = (() => {
7419
7567
  const results = [];
7420
7568
  if (target == null) return results;
7421
7569
  let searchTarget = typeof target === "object" && typeof target !== "function" ? target.constructor : target;
7422
- while (searchTarget && searchTarget !== Object) {
7570
+ const seen = /* @__PURE__ */ new Set();
7571
+ while (searchTarget && searchTarget !== Object && !seen.has(searchTarget)) {
7572
+ seen.add(searchTarget);
7423
7573
  const data = propertyKey ? Reflect.getOwnMetadata(metadataKey, searchTarget, propertyKey) : Reflect.getOwnMetadata(metadataKey, searchTarget);
7424
7574
  if (data !== void 0) results.unshift(data);
7425
7575
  const proto = Object.getPrototypeOf(searchTarget);
7426
7576
  searchTarget = proto && typeof proto === "function" ? proto : proto?.constructor || null;
7427
- if (searchTarget === target) break;
7428
7577
  }
7429
7578
  return results;
7430
7579
  };
@@ -9549,6 +9698,23 @@ ${indentStr}}`;
9549
9698
  };
9550
9699
  }
9551
9700
 
9701
+ // ../core/dist/esm/hash/HashUtils.js
9702
+ var HashUtils;
9703
+ ((HashUtils2) => {
9704
+ const core53 = (str, seed) => {
9705
+ let h1 = 3735928559 ^ seed, h2 = 1103547991 ^ seed;
9706
+ for (let i = 0; i < str.length; i++) {
9707
+ const ch = str.charCodeAt(i);
9708
+ h1 = Math.imul(h1 ^ ch, 2654435761);
9709
+ h2 = Math.imul(h2 ^ ch, 1597334677);
9710
+ }
9711
+ h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507) ^ Math.imul(h2 ^ h2 >>> 13, 3266489909);
9712
+ h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507) ^ Math.imul(h1 ^ h1 >>> 13, 3266489909);
9713
+ return (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString(16).padStart(14, "0");
9714
+ };
9715
+ HashUtils2.hash53 = (str, seed = 0, xyz = 16) => `${core53(str, seed)}${core53(str, seed + 1)}`.slice(0, Math.max(1, xyz));
9716
+ })(HashUtils || (HashUtils = {}));
9717
+
9552
9718
  // ../core/dist/esm/message/operators/filter.js
9553
9719
  function filter(predicate) {
9554
9720
  return (source) => {