@navios/openapi 0.9.0 → 1.0.0-alpha.2

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/CHANGELOG.md +44 -0
  2. package/dist/legacy-compat/__type-tests__/legacy-decorators.spec-d.d.mts +2 -0
  3. package/dist/legacy-compat/__type-tests__/legacy-decorators.spec-d.d.mts.map +1 -0
  4. package/dist/legacy-compat/__type-tests__/tsconfig.tsbuildinfo +1 -0
  5. package/dist/src/legacy-compat/decorators/api-deprecated.decorator.d.mts +35 -0
  6. package/dist/src/legacy-compat/decorators/api-deprecated.decorator.d.mts.map +1 -0
  7. package/dist/src/legacy-compat/decorators/api-exclude.decorator.d.mts +28 -0
  8. package/dist/src/legacy-compat/decorators/api-exclude.decorator.d.mts.map +1 -0
  9. package/dist/src/legacy-compat/decorators/api-operation.decorator.d.mts +60 -0
  10. package/dist/src/legacy-compat/decorators/api-operation.decorator.d.mts.map +1 -0
  11. package/dist/src/legacy-compat/decorators/api-security.decorator.d.mts +38 -0
  12. package/dist/src/legacy-compat/decorators/api-security.decorator.d.mts.map +1 -0
  13. package/dist/src/legacy-compat/decorators/api-stream.decorator.d.mts +52 -0
  14. package/dist/src/legacy-compat/decorators/api-stream.decorator.d.mts.map +1 -0
  15. package/dist/src/legacy-compat/decorators/api-summary.decorator.d.mts +26 -0
  16. package/dist/src/legacy-compat/decorators/api-summary.decorator.d.mts.map +1 -0
  17. package/dist/src/legacy-compat/decorators/api-tag.decorator.d.mts +44 -0
  18. package/dist/src/legacy-compat/decorators/api-tag.decorator.d.mts.map +1 -0
  19. package/dist/src/legacy-compat/decorators/index.d.mts +8 -0
  20. package/dist/src/legacy-compat/decorators/index.d.mts.map +1 -0
  21. package/dist/src/legacy-compat/index.d.mts +24 -0
  22. package/dist/src/legacy-compat/index.d.mts.map +1 -0
  23. package/dist/src/services/endpoint-scanner.service.d.mts +2 -2
  24. package/dist/src/services/endpoint-scanner.service.d.mts.map +1 -1
  25. package/dist/src/services/path-builder.service.d.mts +13 -1
  26. package/dist/src/services/path-builder.service.d.mts.map +1 -1
  27. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  28. package/dist/tsconfig.spec.tsbuildinfo +1 -1
  29. package/dist/tsconfig.tsbuildinfo +1 -1
  30. package/dist/vitest.config.d.mts.map +1 -1
  31. package/lib/index-COmVnnSM.d.mts +606 -0
  32. package/lib/index-COmVnnSM.d.mts.map +1 -0
  33. package/lib/index-Dz-4huer.d.cts +606 -0
  34. package/lib/index-Dz-4huer.d.cts.map +1 -0
  35. package/lib/index.cjs +20 -1840
  36. package/lib/index.cjs.map +1 -1
  37. package/lib/index.d.cts +2 -594
  38. package/lib/index.d.mts +2 -594
  39. package/lib/index.mjs +2 -1822
  40. package/lib/index.mjs.map +1 -1
  41. package/lib/legacy-compat/index.cjs +314 -0
  42. package/lib/legacy-compat/index.cjs.map +1 -0
  43. package/lib/legacy-compat/index.d.cts +285 -0
  44. package/lib/legacy-compat/index.d.cts.map +1 -0
  45. package/lib/legacy-compat/index.d.mts +285 -0
  46. package/lib/legacy-compat/index.d.mts.map +1 -0
  47. package/lib/legacy-compat/index.mjs +271 -0
  48. package/lib/legacy-compat/index.mjs.map +1 -0
  49. package/lib/services-B16xN1Kh.cjs +1928 -0
  50. package/lib/services-B16xN1Kh.cjs.map +1 -0
  51. package/lib/services-B7UR1D1X.mjs +1857 -0
  52. package/lib/services-B7UR1D1X.mjs.map +1 -0
  53. package/package.json +15 -5
  54. package/src/legacy-compat/__type-tests__/legacy-decorators.spec-d.mts +347 -0
  55. package/src/legacy-compat/__type-tests__/tsconfig.json +15 -0
  56. package/src/legacy-compat/decorators/api-deprecated.decorator.mts +46 -0
  57. package/src/legacy-compat/decorators/api-exclude.decorator.mts +31 -0
  58. package/src/legacy-compat/decorators/api-operation.decorator.mts +60 -0
  59. package/src/legacy-compat/decorators/api-security.decorator.mts +45 -0
  60. package/src/legacy-compat/decorators/api-stream.decorator.mts +56 -0
  61. package/src/legacy-compat/decorators/api-summary.decorator.mts +34 -0
  62. package/src/legacy-compat/decorators/api-tag.decorator.mts +52 -0
  63. package/src/legacy-compat/decorators/index.mts +7 -0
  64. package/src/legacy-compat/index.mts +58 -0
  65. package/src/services/endpoint-scanner.service.mts +14 -8
  66. package/src/services/path-builder.service.mts +85 -27
  67. package/tsconfig.spec.json +4 -1
  68. package/tsdown.config.mts +2 -2
  69. package/vitest.config.mts +5 -1
  70. package/lib/index.d.cts.map +0 -1
  71. package/lib/index.d.mts.map +0 -1
@@ -0,0 +1,1928 @@
1
+ let _navios_core = require("@navios/core");
2
+ let zod_openapi = require("zod-openapi");
3
+
4
+ //#region src/tokens/index.mts
5
+ /**
6
+ * Tokens for OpenAPI metadata attributes
7
+ */
8
+ /** Token for @ApiTag decorator */ const ApiTagToken = Symbol.for("navios:openapi:tag");
9
+ /** Token for @ApiOperation decorator */ const ApiOperationToken = Symbol.for("navios:openapi:operation");
10
+ /** Token for @ApiSummary decorator */ const ApiSummaryToken = Symbol.for("navios:openapi:summary");
11
+ /** Token for @ApiDeprecated decorator */ const ApiDeprecatedToken = Symbol.for("navios:openapi:deprecated");
12
+ /** Token for @ApiSecurity decorator */ const ApiSecurityToken = Symbol.for("navios:openapi:security");
13
+ /** Token for @ApiExclude decorator */ const ApiExcludeToken = Symbol.for("navios:openapi:exclude");
14
+ /** Token for @ApiStream decorator */ const ApiStreamToken = Symbol.for("navios:openapi:stream");
15
+
16
+ //#endregion
17
+ //#region src/services/metadata-extractor.service.mts
18
+ function applyDecs2203RFactory$4() {
19
+ function createAddInitializerMethod(initializers, decoratorFinishedRef) {
20
+ return function addInitializer(initializer) {
21
+ assertNotFinished(decoratorFinishedRef, "addInitializer");
22
+ assertCallable(initializer, "An initializer");
23
+ initializers.push(initializer);
24
+ };
25
+ }
26
+ function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
27
+ var kindStr;
28
+ switch (kind) {
29
+ case 1:
30
+ kindStr = "accessor";
31
+ break;
32
+ case 2:
33
+ kindStr = "method";
34
+ break;
35
+ case 3:
36
+ kindStr = "getter";
37
+ break;
38
+ case 4:
39
+ kindStr = "setter";
40
+ break;
41
+ default: kindStr = "field";
42
+ }
43
+ var ctx = {
44
+ kind: kindStr,
45
+ name: isPrivate ? "#" + name : name,
46
+ static: isStatic,
47
+ private: isPrivate,
48
+ metadata
49
+ };
50
+ var decoratorFinishedRef = { v: false };
51
+ ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
52
+ var get, set;
53
+ if (kind === 0) if (isPrivate) {
54
+ get = desc.get;
55
+ set = desc.set;
56
+ } else {
57
+ get = function() {
58
+ return this[name];
59
+ };
60
+ set = function(v) {
61
+ this[name] = v;
62
+ };
63
+ }
64
+ else if (kind === 2) get = function() {
65
+ return desc.value;
66
+ };
67
+ else {
68
+ if (kind === 1 || kind === 3) get = function() {
69
+ return desc.get.call(this);
70
+ };
71
+ if (kind === 1 || kind === 4) set = function(v) {
72
+ desc.set.call(this, v);
73
+ };
74
+ }
75
+ ctx.access = get && set ? {
76
+ get,
77
+ set
78
+ } : get ? { get } : { set };
79
+ try {
80
+ return dec(value, ctx);
81
+ } finally {
82
+ decoratorFinishedRef.v = true;
83
+ }
84
+ }
85
+ function assertNotFinished(decoratorFinishedRef, fnName) {
86
+ if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished");
87
+ }
88
+ function assertCallable(fn, hint) {
89
+ if (typeof fn !== "function") throw new TypeError(hint + " must be a function");
90
+ }
91
+ function assertValidReturnValue(kind, value) {
92
+ var type = typeof value;
93
+ if (kind === 1) {
94
+ if (type !== "object" || value === null) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
95
+ if (value.get !== void 0) assertCallable(value.get, "accessor.get");
96
+ if (value.set !== void 0) assertCallable(value.set, "accessor.set");
97
+ if (value.init !== void 0) assertCallable(value.init, "accessor.init");
98
+ } else if (type !== "function") {
99
+ var hint;
100
+ if (kind === 0) hint = "field";
101
+ else if (kind === 10) hint = "class";
102
+ else hint = "method";
103
+ throw new TypeError(hint + " decorators must return a function or void 0");
104
+ }
105
+ }
106
+ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
107
+ var decs = decInfo[0];
108
+ var desc, init, value;
109
+ if (isPrivate) if (kind === 0 || kind === 1) desc = {
110
+ get: decInfo[3],
111
+ set: decInfo[4]
112
+ };
113
+ else if (kind === 3) desc = { get: decInfo[3] };
114
+ else if (kind === 4) desc = { set: decInfo[3] };
115
+ else desc = { value: decInfo[3] };
116
+ else if (kind !== 0) desc = Object.getOwnPropertyDescriptor(base, name);
117
+ if (kind === 1) value = {
118
+ get: desc.get,
119
+ set: desc.set
120
+ };
121
+ else if (kind === 2) value = desc.value;
122
+ else if (kind === 3) value = desc.get;
123
+ else if (kind === 4) value = desc.set;
124
+ var newValue, get, set;
125
+ if (typeof decs === "function") {
126
+ newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
127
+ if (newValue !== void 0) {
128
+ assertValidReturnValue(kind, newValue);
129
+ if (kind === 0) init = newValue;
130
+ else if (kind === 1) {
131
+ init = newValue.init;
132
+ get = newValue.get || value.get;
133
+ set = newValue.set || value.set;
134
+ value = {
135
+ get,
136
+ set
137
+ };
138
+ } else value = newValue;
139
+ }
140
+ } else for (var i = decs.length - 1; i >= 0; i--) {
141
+ var dec = decs[i];
142
+ newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
143
+ if (newValue !== void 0) {
144
+ assertValidReturnValue(kind, newValue);
145
+ var newInit;
146
+ if (kind === 0) newInit = newValue;
147
+ else if (kind === 1) {
148
+ newInit = newValue.init;
149
+ get = newValue.get || value.get;
150
+ set = newValue.set || value.set;
151
+ value = {
152
+ get,
153
+ set
154
+ };
155
+ } else value = newValue;
156
+ if (newInit !== void 0) if (init === void 0) init = newInit;
157
+ else if (typeof init === "function") init = [init, newInit];
158
+ else init.push(newInit);
159
+ }
160
+ }
161
+ if (kind === 0 || kind === 1) {
162
+ if (init === void 0) init = function(instance, init$1) {
163
+ return init$1;
164
+ };
165
+ else if (typeof init !== "function") {
166
+ var ownInitializers = init;
167
+ init = function(instance, init$1) {
168
+ var value$1 = init$1;
169
+ for (var i$1 = 0; i$1 < ownInitializers.length; i$1++) value$1 = ownInitializers[i$1].call(instance, value$1);
170
+ return value$1;
171
+ };
172
+ } else {
173
+ var originalInitializer = init;
174
+ init = function(instance, init$1) {
175
+ return originalInitializer.call(instance, init$1);
176
+ };
177
+ }
178
+ ret.push(init);
179
+ }
180
+ if (kind !== 0) {
181
+ if (kind === 1) {
182
+ desc.get = value.get;
183
+ desc.set = value.set;
184
+ } else if (kind === 2) desc.value = value;
185
+ else if (kind === 3) desc.get = value;
186
+ else if (kind === 4) desc.set = value;
187
+ if (isPrivate) if (kind === 1) {
188
+ ret.push(function(instance, args) {
189
+ return value.get.call(instance, args);
190
+ });
191
+ ret.push(function(instance, args) {
192
+ return value.set.call(instance, args);
193
+ });
194
+ } else if (kind === 2) ret.push(value);
195
+ else ret.push(function(instance, args) {
196
+ return value.call(instance, args);
197
+ });
198
+ else Object.defineProperty(base, name, desc);
199
+ }
200
+ }
201
+ function applyMemberDecs(Class, decInfos, metadata) {
202
+ var ret = [];
203
+ var protoInitializers;
204
+ var staticInitializers;
205
+ var existingProtoNonFields = /* @__PURE__ */ new Map();
206
+ var existingStaticNonFields = /* @__PURE__ */ new Map();
207
+ for (var i = 0; i < decInfos.length; i++) {
208
+ var decInfo = decInfos[i];
209
+ if (!Array.isArray(decInfo)) continue;
210
+ var kind = decInfo[1];
211
+ var name = decInfo[2];
212
+ var isPrivate = decInfo.length > 3;
213
+ var isStatic = kind >= 5;
214
+ var base;
215
+ var initializers;
216
+ if (isStatic) {
217
+ base = Class;
218
+ kind = kind - 5;
219
+ staticInitializers = staticInitializers || [];
220
+ initializers = staticInitializers;
221
+ } else {
222
+ base = Class.prototype;
223
+ protoInitializers = protoInitializers || [];
224
+ initializers = protoInitializers;
225
+ }
226
+ if (kind !== 0 && !isPrivate) {
227
+ var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
228
+ var existingKind = existingNonFields.get(name) || 0;
229
+ if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
230
+ else if (!existingKind && kind > 2) existingNonFields.set(name, kind);
231
+ else existingNonFields.set(name, true);
232
+ }
233
+ applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
234
+ }
235
+ pushInitializers(ret, protoInitializers);
236
+ pushInitializers(ret, staticInitializers);
237
+ return ret;
238
+ }
239
+ function pushInitializers(ret, initializers) {
240
+ if (initializers) ret.push(function(instance) {
241
+ for (var i = 0; i < initializers.length; i++) initializers[i].call(instance);
242
+ return instance;
243
+ });
244
+ }
245
+ function applyClassDecs(targetClass, classDecs, metadata) {
246
+ if (classDecs.length > 0) {
247
+ var initializers = [];
248
+ var newClass = targetClass;
249
+ var name = targetClass.name;
250
+ for (var i = classDecs.length - 1; i >= 0; i--) {
251
+ var decoratorFinishedRef = { v: false };
252
+ try {
253
+ var nextNewClass = classDecs[i](newClass, {
254
+ kind: "class",
255
+ name,
256
+ addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
257
+ metadata
258
+ });
259
+ } finally {
260
+ decoratorFinishedRef.v = true;
261
+ }
262
+ if (nextNewClass !== void 0) {
263
+ assertValidReturnValue(10, nextNewClass);
264
+ newClass = nextNewClass;
265
+ }
266
+ }
267
+ return [defineMetadata(newClass, metadata), function() {
268
+ for (var i$1 = 0; i$1 < initializers.length; i$1++) initializers[i$1].call(newClass);
269
+ }];
270
+ }
271
+ }
272
+ function defineMetadata(Class, metadata) {
273
+ return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
274
+ configurable: true,
275
+ enumerable: true,
276
+ value: metadata
277
+ });
278
+ }
279
+ return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
280
+ if (parentClass !== void 0) var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
281
+ var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
282
+ var e = applyMemberDecs(targetClass, memberDecs, metadata);
283
+ if (!classDecs.length) defineMetadata(targetClass, metadata);
284
+ return {
285
+ e,
286
+ get c() {
287
+ return applyClassDecs(targetClass, classDecs, metadata);
288
+ }
289
+ };
290
+ };
291
+ }
292
+ function _apply_decs_2203_r$4(targetClass, memberDecs, classDecs, parentClass) {
293
+ return (_apply_decs_2203_r$4 = applyDecs2203RFactory$4())(targetClass, memberDecs, classDecs, parentClass);
294
+ }
295
+ var _dec$4, _initClass$4;
296
+ let _MetadataExtractorService;
297
+ _dec$4 = (0, _navios_core.Injectable)();
298
+ var MetadataExtractorService = class {
299
+ static {
300
+ ({c: [_MetadataExtractorService, _initClass$4]} = _apply_decs_2203_r$4(this, [], [_dec$4]));
301
+ }
302
+ /**
303
+ * Extracts and merges OpenAPI metadata from controller and handler.
304
+ *
305
+ * @param controller - Controller metadata
306
+ * @param handler - Handler metadata
307
+ * @returns Merged OpenAPI metadata
308
+ */ extract(controller, handler) {
309
+ const controllerTag = controller.customAttributes.get(ApiTagToken);
310
+ const handlerTag = handler.customAttributes.get(ApiTagToken);
311
+ const operation = handler.customAttributes.get(ApiOperationToken);
312
+ const summary = handler.customAttributes.get(ApiSummaryToken);
313
+ const deprecated = handler.customAttributes.get(ApiDeprecatedToken);
314
+ const security = handler.customAttributes.get(ApiSecurityToken);
315
+ const excluded = handler.customAttributes.get(ApiExcludeToken);
316
+ const stream = handler.customAttributes.get(ApiStreamToken);
317
+ const tags = [];
318
+ if (controllerTag?.name) tags.push(controllerTag.name);
319
+ if (handlerTag?.name && handlerTag.name !== controllerTag?.name) tags.push(handlerTag.name);
320
+ return {
321
+ tags,
322
+ summary: operation?.summary ?? summary,
323
+ description: operation?.description,
324
+ operationId: operation?.operationId,
325
+ deprecated: deprecated !== void 0 || operation?.deprecated === true,
326
+ externalDocs: operation?.externalDocs,
327
+ security: security ? [security] : void 0,
328
+ excluded: excluded === true,
329
+ stream
330
+ };
331
+ }
332
+ static {
333
+ _initClass$4();
334
+ }
335
+ };
336
+
337
+ //#endregion
338
+ //#region src/services/endpoint-scanner.service.mts
339
+ function applyDecs2203RFactory$3() {
340
+ function createAddInitializerMethod(initializers, decoratorFinishedRef) {
341
+ return function addInitializer(initializer) {
342
+ assertNotFinished(decoratorFinishedRef, "addInitializer");
343
+ assertCallable(initializer, "An initializer");
344
+ initializers.push(initializer);
345
+ };
346
+ }
347
+ function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
348
+ var kindStr;
349
+ switch (kind) {
350
+ case 1:
351
+ kindStr = "accessor";
352
+ break;
353
+ case 2:
354
+ kindStr = "method";
355
+ break;
356
+ case 3:
357
+ kindStr = "getter";
358
+ break;
359
+ case 4:
360
+ kindStr = "setter";
361
+ break;
362
+ default: kindStr = "field";
363
+ }
364
+ var ctx = {
365
+ kind: kindStr,
366
+ name: isPrivate ? "#" + name : name,
367
+ static: isStatic,
368
+ private: isPrivate,
369
+ metadata
370
+ };
371
+ var decoratorFinishedRef = { v: false };
372
+ ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
373
+ var get, set;
374
+ if (kind === 0) if (isPrivate) {
375
+ get = desc.get;
376
+ set = desc.set;
377
+ } else {
378
+ get = function() {
379
+ return this[name];
380
+ };
381
+ set = function(v) {
382
+ this[name] = v;
383
+ };
384
+ }
385
+ else if (kind === 2) get = function() {
386
+ return desc.value;
387
+ };
388
+ else {
389
+ if (kind === 1 || kind === 3) get = function() {
390
+ return desc.get.call(this);
391
+ };
392
+ if (kind === 1 || kind === 4) set = function(v) {
393
+ desc.set.call(this, v);
394
+ };
395
+ }
396
+ ctx.access = get && set ? {
397
+ get,
398
+ set
399
+ } : get ? { get } : { set };
400
+ try {
401
+ return dec(value, ctx);
402
+ } finally {
403
+ decoratorFinishedRef.v = true;
404
+ }
405
+ }
406
+ function assertNotFinished(decoratorFinishedRef, fnName) {
407
+ if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished");
408
+ }
409
+ function assertCallable(fn, hint) {
410
+ if (typeof fn !== "function") throw new TypeError(hint + " must be a function");
411
+ }
412
+ function assertValidReturnValue(kind, value) {
413
+ var type = typeof value;
414
+ if (kind === 1) {
415
+ if (type !== "object" || value === null) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
416
+ if (value.get !== void 0) assertCallable(value.get, "accessor.get");
417
+ if (value.set !== void 0) assertCallable(value.set, "accessor.set");
418
+ if (value.init !== void 0) assertCallable(value.init, "accessor.init");
419
+ } else if (type !== "function") {
420
+ var hint;
421
+ if (kind === 0) hint = "field";
422
+ else if (kind === 10) hint = "class";
423
+ else hint = "method";
424
+ throw new TypeError(hint + " decorators must return a function or void 0");
425
+ }
426
+ }
427
+ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
428
+ var decs = decInfo[0];
429
+ var desc, init, value;
430
+ if (isPrivate) if (kind === 0 || kind === 1) desc = {
431
+ get: decInfo[3],
432
+ set: decInfo[4]
433
+ };
434
+ else if (kind === 3) desc = { get: decInfo[3] };
435
+ else if (kind === 4) desc = { set: decInfo[3] };
436
+ else desc = { value: decInfo[3] };
437
+ else if (kind !== 0) desc = Object.getOwnPropertyDescriptor(base, name);
438
+ if (kind === 1) value = {
439
+ get: desc.get,
440
+ set: desc.set
441
+ };
442
+ else if (kind === 2) value = desc.value;
443
+ else if (kind === 3) value = desc.get;
444
+ else if (kind === 4) value = desc.set;
445
+ var newValue, get, set;
446
+ if (typeof decs === "function") {
447
+ newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
448
+ if (newValue !== void 0) {
449
+ assertValidReturnValue(kind, newValue);
450
+ if (kind === 0) init = newValue;
451
+ else if (kind === 1) {
452
+ init = newValue.init;
453
+ get = newValue.get || value.get;
454
+ set = newValue.set || value.set;
455
+ value = {
456
+ get,
457
+ set
458
+ };
459
+ } else value = newValue;
460
+ }
461
+ } else for (var i = decs.length - 1; i >= 0; i--) {
462
+ var dec = decs[i];
463
+ newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
464
+ if (newValue !== void 0) {
465
+ assertValidReturnValue(kind, newValue);
466
+ var newInit;
467
+ if (kind === 0) newInit = newValue;
468
+ else if (kind === 1) {
469
+ newInit = newValue.init;
470
+ get = newValue.get || value.get;
471
+ set = newValue.set || value.set;
472
+ value = {
473
+ get,
474
+ set
475
+ };
476
+ } else value = newValue;
477
+ if (newInit !== void 0) if (init === void 0) init = newInit;
478
+ else if (typeof init === "function") init = [init, newInit];
479
+ else init.push(newInit);
480
+ }
481
+ }
482
+ if (kind === 0 || kind === 1) {
483
+ if (init === void 0) init = function(instance, init$1) {
484
+ return init$1;
485
+ };
486
+ else if (typeof init !== "function") {
487
+ var ownInitializers = init;
488
+ init = function(instance, init$1) {
489
+ var value$1 = init$1;
490
+ for (var i$1 = 0; i$1 < ownInitializers.length; i$1++) value$1 = ownInitializers[i$1].call(instance, value$1);
491
+ return value$1;
492
+ };
493
+ } else {
494
+ var originalInitializer = init;
495
+ init = function(instance, init$1) {
496
+ return originalInitializer.call(instance, init$1);
497
+ };
498
+ }
499
+ ret.push(init);
500
+ }
501
+ if (kind !== 0) {
502
+ if (kind === 1) {
503
+ desc.get = value.get;
504
+ desc.set = value.set;
505
+ } else if (kind === 2) desc.value = value;
506
+ else if (kind === 3) desc.get = value;
507
+ else if (kind === 4) desc.set = value;
508
+ if (isPrivate) if (kind === 1) {
509
+ ret.push(function(instance, args) {
510
+ return value.get.call(instance, args);
511
+ });
512
+ ret.push(function(instance, args) {
513
+ return value.set.call(instance, args);
514
+ });
515
+ } else if (kind === 2) ret.push(value);
516
+ else ret.push(function(instance, args) {
517
+ return value.call(instance, args);
518
+ });
519
+ else Object.defineProperty(base, name, desc);
520
+ }
521
+ }
522
+ function applyMemberDecs(Class, decInfos, metadata) {
523
+ var ret = [];
524
+ var protoInitializers;
525
+ var staticInitializers;
526
+ var existingProtoNonFields = /* @__PURE__ */ new Map();
527
+ var existingStaticNonFields = /* @__PURE__ */ new Map();
528
+ for (var i = 0; i < decInfos.length; i++) {
529
+ var decInfo = decInfos[i];
530
+ if (!Array.isArray(decInfo)) continue;
531
+ var kind = decInfo[1];
532
+ var name = decInfo[2];
533
+ var isPrivate = decInfo.length > 3;
534
+ var isStatic = kind >= 5;
535
+ var base;
536
+ var initializers;
537
+ if (isStatic) {
538
+ base = Class;
539
+ kind = kind - 5;
540
+ staticInitializers = staticInitializers || [];
541
+ initializers = staticInitializers;
542
+ } else {
543
+ base = Class.prototype;
544
+ protoInitializers = protoInitializers || [];
545
+ initializers = protoInitializers;
546
+ }
547
+ if (kind !== 0 && !isPrivate) {
548
+ var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
549
+ var existingKind = existingNonFields.get(name) || 0;
550
+ if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
551
+ else if (!existingKind && kind > 2) existingNonFields.set(name, kind);
552
+ else existingNonFields.set(name, true);
553
+ }
554
+ applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
555
+ }
556
+ pushInitializers(ret, protoInitializers);
557
+ pushInitializers(ret, staticInitializers);
558
+ return ret;
559
+ }
560
+ function pushInitializers(ret, initializers) {
561
+ if (initializers) ret.push(function(instance) {
562
+ for (var i = 0; i < initializers.length; i++) initializers[i].call(instance);
563
+ return instance;
564
+ });
565
+ }
566
+ function applyClassDecs(targetClass, classDecs, metadata) {
567
+ if (classDecs.length > 0) {
568
+ var initializers = [];
569
+ var newClass = targetClass;
570
+ var name = targetClass.name;
571
+ for (var i = classDecs.length - 1; i >= 0; i--) {
572
+ var decoratorFinishedRef = { v: false };
573
+ try {
574
+ var nextNewClass = classDecs[i](newClass, {
575
+ kind: "class",
576
+ name,
577
+ addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
578
+ metadata
579
+ });
580
+ } finally {
581
+ decoratorFinishedRef.v = true;
582
+ }
583
+ if (nextNewClass !== void 0) {
584
+ assertValidReturnValue(10, nextNewClass);
585
+ newClass = nextNewClass;
586
+ }
587
+ }
588
+ return [defineMetadata(newClass, metadata), function() {
589
+ for (var i$1 = 0; i$1 < initializers.length; i$1++) initializers[i$1].call(newClass);
590
+ }];
591
+ }
592
+ }
593
+ function defineMetadata(Class, metadata) {
594
+ return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
595
+ configurable: true,
596
+ enumerable: true,
597
+ value: metadata
598
+ });
599
+ }
600
+ return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
601
+ if (parentClass !== void 0) var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
602
+ var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
603
+ var e = applyMemberDecs(targetClass, memberDecs, metadata);
604
+ if (!classDecs.length) defineMetadata(targetClass, metadata);
605
+ return {
606
+ e,
607
+ get c() {
608
+ return applyClassDecs(targetClass, classDecs, metadata);
609
+ }
610
+ };
611
+ };
612
+ }
613
+ function _apply_decs_2203_r$3(targetClass, memberDecs, classDecs, parentClass) {
614
+ return (_apply_decs_2203_r$3 = applyDecs2203RFactory$3())(targetClass, memberDecs, classDecs, parentClass);
615
+ }
616
+ var _dec$3, _initClass$3;
617
+ let _EndpointScannerService;
618
+ _dec$3 = (0, _navios_core.Injectable)();
619
+ var EndpointScannerService = class {
620
+ static {
621
+ ({c: [_EndpointScannerService, _initClass$3]} = _apply_decs_2203_r$3(this, [], [_dec$3]));
622
+ }
623
+ logger = (0, _navios_core.inject)(_navios_core.Logger, { context: _EndpointScannerService.name });
624
+ metadataExtractor = (0, _navios_core.inject)(_MetadataExtractorService);
625
+ /**
626
+ * Scans all loaded modules and discovers endpoints.
627
+ *
628
+ * @param modules - Map of loaded modules from NaviosApplication
629
+ * @returns Array of discovered endpoints
630
+ */ scan(modules) {
631
+ const endpoints = [];
632
+ for (const [moduleName, moduleMetadata] of modules) {
633
+ if (!moduleMetadata.controllers || moduleMetadata.controllers.size === 0) continue;
634
+ this.logger.debug(`Scanning module: ${moduleName}`);
635
+ for (const controllerClass of moduleMetadata.controllers) {
636
+ const controllerMeta = (0, _navios_core.extractControllerMetadata)(controllerClass);
637
+ const controllerEndpoints = this.scanController(moduleMetadata, controllerClass, controllerMeta);
638
+ endpoints.push(...controllerEndpoints);
639
+ }
640
+ }
641
+ this.logger.debug(`Discovered ${endpoints.length} endpoints`);
642
+ return endpoints;
643
+ }
644
+ /**
645
+ * Scans a controller and returns its endpoints
646
+ */ scanController(module$1, controllerClass, controllerMeta) {
647
+ const endpoints = [];
648
+ for (const handler of controllerMeta.endpoints) {
649
+ if (!handler.config) continue;
650
+ const openApiMetadata = this.metadataExtractor.extract(controllerMeta, handler);
651
+ if (openApiMetadata.excluded) {
652
+ this.logger.debug(`Skipping excluded endpoint: ${handler.classMethod}`);
653
+ continue;
654
+ }
655
+ endpoints.push({
656
+ module: module$1,
657
+ controllerClass,
658
+ controller: controllerMeta,
659
+ handler,
660
+ config: handler.config,
661
+ openApiMetadata
662
+ });
663
+ }
664
+ return endpoints;
665
+ }
666
+ static {
667
+ _initClass$3();
668
+ }
669
+ };
670
+
671
+ //#endregion
672
+ //#region src/services/schema-converter.service.mts
673
+ function applyDecs2203RFactory$2() {
674
+ function createAddInitializerMethod(initializers, decoratorFinishedRef) {
675
+ return function addInitializer(initializer) {
676
+ assertNotFinished(decoratorFinishedRef, "addInitializer");
677
+ assertCallable(initializer, "An initializer");
678
+ initializers.push(initializer);
679
+ };
680
+ }
681
+ function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
682
+ var kindStr;
683
+ switch (kind) {
684
+ case 1:
685
+ kindStr = "accessor";
686
+ break;
687
+ case 2:
688
+ kindStr = "method";
689
+ break;
690
+ case 3:
691
+ kindStr = "getter";
692
+ break;
693
+ case 4:
694
+ kindStr = "setter";
695
+ break;
696
+ default: kindStr = "field";
697
+ }
698
+ var ctx = {
699
+ kind: kindStr,
700
+ name: isPrivate ? "#" + name : name,
701
+ static: isStatic,
702
+ private: isPrivate,
703
+ metadata
704
+ };
705
+ var decoratorFinishedRef = { v: false };
706
+ ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
707
+ var get, set;
708
+ if (kind === 0) if (isPrivate) {
709
+ get = desc.get;
710
+ set = desc.set;
711
+ } else {
712
+ get = function() {
713
+ return this[name];
714
+ };
715
+ set = function(v) {
716
+ this[name] = v;
717
+ };
718
+ }
719
+ else if (kind === 2) get = function() {
720
+ return desc.value;
721
+ };
722
+ else {
723
+ if (kind === 1 || kind === 3) get = function() {
724
+ return desc.get.call(this);
725
+ };
726
+ if (kind === 1 || kind === 4) set = function(v) {
727
+ desc.set.call(this, v);
728
+ };
729
+ }
730
+ ctx.access = get && set ? {
731
+ get,
732
+ set
733
+ } : get ? { get } : { set };
734
+ try {
735
+ return dec(value, ctx);
736
+ } finally {
737
+ decoratorFinishedRef.v = true;
738
+ }
739
+ }
740
+ function assertNotFinished(decoratorFinishedRef, fnName) {
741
+ if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished");
742
+ }
743
+ function assertCallable(fn, hint) {
744
+ if (typeof fn !== "function") throw new TypeError(hint + " must be a function");
745
+ }
746
+ function assertValidReturnValue(kind, value) {
747
+ var type = typeof value;
748
+ if (kind === 1) {
749
+ if (type !== "object" || value === null) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
750
+ if (value.get !== void 0) assertCallable(value.get, "accessor.get");
751
+ if (value.set !== void 0) assertCallable(value.set, "accessor.set");
752
+ if (value.init !== void 0) assertCallable(value.init, "accessor.init");
753
+ } else if (type !== "function") {
754
+ var hint;
755
+ if (kind === 0) hint = "field";
756
+ else if (kind === 10) hint = "class";
757
+ else hint = "method";
758
+ throw new TypeError(hint + " decorators must return a function or void 0");
759
+ }
760
+ }
761
+ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
762
+ var decs = decInfo[0];
763
+ var desc, init, value;
764
+ if (isPrivate) if (kind === 0 || kind === 1) desc = {
765
+ get: decInfo[3],
766
+ set: decInfo[4]
767
+ };
768
+ else if (kind === 3) desc = { get: decInfo[3] };
769
+ else if (kind === 4) desc = { set: decInfo[3] };
770
+ else desc = { value: decInfo[3] };
771
+ else if (kind !== 0) desc = Object.getOwnPropertyDescriptor(base, name);
772
+ if (kind === 1) value = {
773
+ get: desc.get,
774
+ set: desc.set
775
+ };
776
+ else if (kind === 2) value = desc.value;
777
+ else if (kind === 3) value = desc.get;
778
+ else if (kind === 4) value = desc.set;
779
+ var newValue, get, set;
780
+ if (typeof decs === "function") {
781
+ newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
782
+ if (newValue !== void 0) {
783
+ assertValidReturnValue(kind, newValue);
784
+ if (kind === 0) init = newValue;
785
+ else if (kind === 1) {
786
+ init = newValue.init;
787
+ get = newValue.get || value.get;
788
+ set = newValue.set || value.set;
789
+ value = {
790
+ get,
791
+ set
792
+ };
793
+ } else value = newValue;
794
+ }
795
+ } else for (var i = decs.length - 1; i >= 0; i--) {
796
+ var dec = decs[i];
797
+ newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
798
+ if (newValue !== void 0) {
799
+ assertValidReturnValue(kind, newValue);
800
+ var newInit;
801
+ if (kind === 0) newInit = newValue;
802
+ else if (kind === 1) {
803
+ newInit = newValue.init;
804
+ get = newValue.get || value.get;
805
+ set = newValue.set || value.set;
806
+ value = {
807
+ get,
808
+ set
809
+ };
810
+ } else value = newValue;
811
+ if (newInit !== void 0) if (init === void 0) init = newInit;
812
+ else if (typeof init === "function") init = [init, newInit];
813
+ else init.push(newInit);
814
+ }
815
+ }
816
+ if (kind === 0 || kind === 1) {
817
+ if (init === void 0) init = function(instance, init$1) {
818
+ return init$1;
819
+ };
820
+ else if (typeof init !== "function") {
821
+ var ownInitializers = init;
822
+ init = function(instance, init$1) {
823
+ var value$1 = init$1;
824
+ for (var i$1 = 0; i$1 < ownInitializers.length; i$1++) value$1 = ownInitializers[i$1].call(instance, value$1);
825
+ return value$1;
826
+ };
827
+ } else {
828
+ var originalInitializer = init;
829
+ init = function(instance, init$1) {
830
+ return originalInitializer.call(instance, init$1);
831
+ };
832
+ }
833
+ ret.push(init);
834
+ }
835
+ if (kind !== 0) {
836
+ if (kind === 1) {
837
+ desc.get = value.get;
838
+ desc.set = value.set;
839
+ } else if (kind === 2) desc.value = value;
840
+ else if (kind === 3) desc.get = value;
841
+ else if (kind === 4) desc.set = value;
842
+ if (isPrivate) if (kind === 1) {
843
+ ret.push(function(instance, args) {
844
+ return value.get.call(instance, args);
845
+ });
846
+ ret.push(function(instance, args) {
847
+ return value.set.call(instance, args);
848
+ });
849
+ } else if (kind === 2) ret.push(value);
850
+ else ret.push(function(instance, args) {
851
+ return value.call(instance, args);
852
+ });
853
+ else Object.defineProperty(base, name, desc);
854
+ }
855
+ }
856
+ function applyMemberDecs(Class, decInfos, metadata) {
857
+ var ret = [];
858
+ var protoInitializers;
859
+ var staticInitializers;
860
+ var existingProtoNonFields = /* @__PURE__ */ new Map();
861
+ var existingStaticNonFields = /* @__PURE__ */ new Map();
862
+ for (var i = 0; i < decInfos.length; i++) {
863
+ var decInfo = decInfos[i];
864
+ if (!Array.isArray(decInfo)) continue;
865
+ var kind = decInfo[1];
866
+ var name = decInfo[2];
867
+ var isPrivate = decInfo.length > 3;
868
+ var isStatic = kind >= 5;
869
+ var base;
870
+ var initializers;
871
+ if (isStatic) {
872
+ base = Class;
873
+ kind = kind - 5;
874
+ staticInitializers = staticInitializers || [];
875
+ initializers = staticInitializers;
876
+ } else {
877
+ base = Class.prototype;
878
+ protoInitializers = protoInitializers || [];
879
+ initializers = protoInitializers;
880
+ }
881
+ if (kind !== 0 && !isPrivate) {
882
+ var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
883
+ var existingKind = existingNonFields.get(name) || 0;
884
+ if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
885
+ else if (!existingKind && kind > 2) existingNonFields.set(name, kind);
886
+ else existingNonFields.set(name, true);
887
+ }
888
+ applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
889
+ }
890
+ pushInitializers(ret, protoInitializers);
891
+ pushInitializers(ret, staticInitializers);
892
+ return ret;
893
+ }
894
+ function pushInitializers(ret, initializers) {
895
+ if (initializers) ret.push(function(instance) {
896
+ for (var i = 0; i < initializers.length; i++) initializers[i].call(instance);
897
+ return instance;
898
+ });
899
+ }
900
+ function applyClassDecs(targetClass, classDecs, metadata) {
901
+ if (classDecs.length > 0) {
902
+ var initializers = [];
903
+ var newClass = targetClass;
904
+ var name = targetClass.name;
905
+ for (var i = classDecs.length - 1; i >= 0; i--) {
906
+ var decoratorFinishedRef = { v: false };
907
+ try {
908
+ var nextNewClass = classDecs[i](newClass, {
909
+ kind: "class",
910
+ name,
911
+ addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
912
+ metadata
913
+ });
914
+ } finally {
915
+ decoratorFinishedRef.v = true;
916
+ }
917
+ if (nextNewClass !== void 0) {
918
+ assertValidReturnValue(10, nextNewClass);
919
+ newClass = nextNewClass;
920
+ }
921
+ }
922
+ return [defineMetadata(newClass, metadata), function() {
923
+ for (var i$1 = 0; i$1 < initializers.length; i$1++) initializers[i$1].call(newClass);
924
+ }];
925
+ }
926
+ }
927
+ function defineMetadata(Class, metadata) {
928
+ return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
929
+ configurable: true,
930
+ enumerable: true,
931
+ value: metadata
932
+ });
933
+ }
934
+ return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
935
+ if (parentClass !== void 0) var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
936
+ var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
937
+ var e = applyMemberDecs(targetClass, memberDecs, metadata);
938
+ if (!classDecs.length) defineMetadata(targetClass, metadata);
939
+ return {
940
+ e,
941
+ get c() {
942
+ return applyClassDecs(targetClass, classDecs, metadata);
943
+ }
944
+ };
945
+ };
946
+ }
947
+ function _apply_decs_2203_r$2(targetClass, memberDecs, classDecs, parentClass) {
948
+ return (_apply_decs_2203_r$2 = applyDecs2203RFactory$2())(targetClass, memberDecs, classDecs, parentClass);
949
+ }
950
+ var _dec$2, _initClass$2;
951
+ let _SchemaConverterService;
952
+ _dec$2 = (0, _navios_core.Injectable)();
953
+ var SchemaConverterService = class {
954
+ static {
955
+ ({c: [_SchemaConverterService, _initClass$2]} = _apply_decs_2203_r$2(this, [], [_dec$2]));
956
+ }
957
+ /**
958
+ * Converts a Zod schema to an OpenAPI schema object.
959
+ *
960
+ * @param schema - Zod schema to convert
961
+ * @returns OpenAPI schema object with any component schemas
962
+ *
963
+ * @example
964
+ * ```typescript
965
+ * const userSchema = z.object({
966
+ * id: z.string().meta({ openapi: { example: 'usr_123' } }),
967
+ * name: z.string(),
968
+ * })
969
+ *
970
+ * const result = schemaConverter.convert(userSchema)
971
+ * // { schema: { type: 'object', properties: { ... } }, components: {} }
972
+ * ```
973
+ */ convert(schema) {
974
+ return (0, zod_openapi.createSchema)(schema);
975
+ }
976
+ /**
977
+ * Checks if a schema property represents a File type.
978
+ *
979
+ * Used for multipart form handling to convert File types to binary format.
980
+ *
981
+ * @param schema - Schema object to check
982
+ * @returns true if the schema represents a file
983
+ */ isFileSchema(schema) {
984
+ return schema.type === "string" && schema.format === "binary";
985
+ }
986
+ /**
987
+ * Transforms schema properties to handle File/Blob types for multipart.
988
+ *
989
+ * Converts File types to OpenAPI binary format and handles arrays of files.
990
+ *
991
+ * @param properties - Schema properties object
992
+ * @returns Transformed properties with file types as binary
993
+ */ transformFileProperties(properties) {
994
+ const result = {};
995
+ for (const [key, prop] of Object.entries(properties)) if (this.isFileSchema(prop)) result[key] = {
996
+ type: "string",
997
+ format: "binary",
998
+ description: prop.description
999
+ };
1000
+ else if (prop.type === "array" && prop.items && this.isFileSchema(prop.items)) result[key] = {
1001
+ type: "array",
1002
+ items: {
1003
+ type: "string",
1004
+ format: "binary"
1005
+ },
1006
+ description: prop.description
1007
+ };
1008
+ else result[key] = prop;
1009
+ return result;
1010
+ }
1011
+ static {
1012
+ _initClass$2();
1013
+ }
1014
+ };
1015
+
1016
+ //#endregion
1017
+ //#region src/services/path-builder.service.mts
1018
+ function applyDecs2203RFactory$1() {
1019
+ function createAddInitializerMethod(initializers, decoratorFinishedRef) {
1020
+ return function addInitializer(initializer) {
1021
+ assertNotFinished(decoratorFinishedRef, "addInitializer");
1022
+ assertCallable(initializer, "An initializer");
1023
+ initializers.push(initializer);
1024
+ };
1025
+ }
1026
+ function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
1027
+ var kindStr;
1028
+ switch (kind) {
1029
+ case 1:
1030
+ kindStr = "accessor";
1031
+ break;
1032
+ case 2:
1033
+ kindStr = "method";
1034
+ break;
1035
+ case 3:
1036
+ kindStr = "getter";
1037
+ break;
1038
+ case 4:
1039
+ kindStr = "setter";
1040
+ break;
1041
+ default: kindStr = "field";
1042
+ }
1043
+ var ctx = {
1044
+ kind: kindStr,
1045
+ name: isPrivate ? "#" + name : name,
1046
+ static: isStatic,
1047
+ private: isPrivate,
1048
+ metadata
1049
+ };
1050
+ var decoratorFinishedRef = { v: false };
1051
+ ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
1052
+ var get, set;
1053
+ if (kind === 0) if (isPrivate) {
1054
+ get = desc.get;
1055
+ set = desc.set;
1056
+ } else {
1057
+ get = function() {
1058
+ return this[name];
1059
+ };
1060
+ set = function(v) {
1061
+ this[name] = v;
1062
+ };
1063
+ }
1064
+ else if (kind === 2) get = function() {
1065
+ return desc.value;
1066
+ };
1067
+ else {
1068
+ if (kind === 1 || kind === 3) get = function() {
1069
+ return desc.get.call(this);
1070
+ };
1071
+ if (kind === 1 || kind === 4) set = function(v) {
1072
+ desc.set.call(this, v);
1073
+ };
1074
+ }
1075
+ ctx.access = get && set ? {
1076
+ get,
1077
+ set
1078
+ } : get ? { get } : { set };
1079
+ try {
1080
+ return dec(value, ctx);
1081
+ } finally {
1082
+ decoratorFinishedRef.v = true;
1083
+ }
1084
+ }
1085
+ function assertNotFinished(decoratorFinishedRef, fnName) {
1086
+ if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished");
1087
+ }
1088
+ function assertCallable(fn, hint) {
1089
+ if (typeof fn !== "function") throw new TypeError(hint + " must be a function");
1090
+ }
1091
+ function assertValidReturnValue(kind, value) {
1092
+ var type = typeof value;
1093
+ if (kind === 1) {
1094
+ if (type !== "object" || value === null) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
1095
+ if (value.get !== void 0) assertCallable(value.get, "accessor.get");
1096
+ if (value.set !== void 0) assertCallable(value.set, "accessor.set");
1097
+ if (value.init !== void 0) assertCallable(value.init, "accessor.init");
1098
+ } else if (type !== "function") {
1099
+ var hint;
1100
+ if (kind === 0) hint = "field";
1101
+ else if (kind === 10) hint = "class";
1102
+ else hint = "method";
1103
+ throw new TypeError(hint + " decorators must return a function or void 0");
1104
+ }
1105
+ }
1106
+ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
1107
+ var decs = decInfo[0];
1108
+ var desc, init, value;
1109
+ if (isPrivate) if (kind === 0 || kind === 1) desc = {
1110
+ get: decInfo[3],
1111
+ set: decInfo[4]
1112
+ };
1113
+ else if (kind === 3) desc = { get: decInfo[3] };
1114
+ else if (kind === 4) desc = { set: decInfo[3] };
1115
+ else desc = { value: decInfo[3] };
1116
+ else if (kind !== 0) desc = Object.getOwnPropertyDescriptor(base, name);
1117
+ if (kind === 1) value = {
1118
+ get: desc.get,
1119
+ set: desc.set
1120
+ };
1121
+ else if (kind === 2) value = desc.value;
1122
+ else if (kind === 3) value = desc.get;
1123
+ else if (kind === 4) value = desc.set;
1124
+ var newValue, get, set;
1125
+ if (typeof decs === "function") {
1126
+ newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
1127
+ if (newValue !== void 0) {
1128
+ assertValidReturnValue(kind, newValue);
1129
+ if (kind === 0) init = newValue;
1130
+ else if (kind === 1) {
1131
+ init = newValue.init;
1132
+ get = newValue.get || value.get;
1133
+ set = newValue.set || value.set;
1134
+ value = {
1135
+ get,
1136
+ set
1137
+ };
1138
+ } else value = newValue;
1139
+ }
1140
+ } else for (var i = decs.length - 1; i >= 0; i--) {
1141
+ var dec = decs[i];
1142
+ newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
1143
+ if (newValue !== void 0) {
1144
+ assertValidReturnValue(kind, newValue);
1145
+ var newInit;
1146
+ if (kind === 0) newInit = newValue;
1147
+ else if (kind === 1) {
1148
+ newInit = newValue.init;
1149
+ get = newValue.get || value.get;
1150
+ set = newValue.set || value.set;
1151
+ value = {
1152
+ get,
1153
+ set
1154
+ };
1155
+ } else value = newValue;
1156
+ if (newInit !== void 0) if (init === void 0) init = newInit;
1157
+ else if (typeof init === "function") init = [init, newInit];
1158
+ else init.push(newInit);
1159
+ }
1160
+ }
1161
+ if (kind === 0 || kind === 1) {
1162
+ if (init === void 0) init = function(instance, init$1) {
1163
+ return init$1;
1164
+ };
1165
+ else if (typeof init !== "function") {
1166
+ var ownInitializers = init;
1167
+ init = function(instance, init$1) {
1168
+ var value$1 = init$1;
1169
+ for (var i$1 = 0; i$1 < ownInitializers.length; i$1++) value$1 = ownInitializers[i$1].call(instance, value$1);
1170
+ return value$1;
1171
+ };
1172
+ } else {
1173
+ var originalInitializer = init;
1174
+ init = function(instance, init$1) {
1175
+ return originalInitializer.call(instance, init$1);
1176
+ };
1177
+ }
1178
+ ret.push(init);
1179
+ }
1180
+ if (kind !== 0) {
1181
+ if (kind === 1) {
1182
+ desc.get = value.get;
1183
+ desc.set = value.set;
1184
+ } else if (kind === 2) desc.value = value;
1185
+ else if (kind === 3) desc.get = value;
1186
+ else if (kind === 4) desc.set = value;
1187
+ if (isPrivate) if (kind === 1) {
1188
+ ret.push(function(instance, args) {
1189
+ return value.get.call(instance, args);
1190
+ });
1191
+ ret.push(function(instance, args) {
1192
+ return value.set.call(instance, args);
1193
+ });
1194
+ } else if (kind === 2) ret.push(value);
1195
+ else ret.push(function(instance, args) {
1196
+ return value.call(instance, args);
1197
+ });
1198
+ else Object.defineProperty(base, name, desc);
1199
+ }
1200
+ }
1201
+ function applyMemberDecs(Class, decInfos, metadata) {
1202
+ var ret = [];
1203
+ var protoInitializers;
1204
+ var staticInitializers;
1205
+ var existingProtoNonFields = /* @__PURE__ */ new Map();
1206
+ var existingStaticNonFields = /* @__PURE__ */ new Map();
1207
+ for (var i = 0; i < decInfos.length; i++) {
1208
+ var decInfo = decInfos[i];
1209
+ if (!Array.isArray(decInfo)) continue;
1210
+ var kind = decInfo[1];
1211
+ var name = decInfo[2];
1212
+ var isPrivate = decInfo.length > 3;
1213
+ var isStatic = kind >= 5;
1214
+ var base;
1215
+ var initializers;
1216
+ if (isStatic) {
1217
+ base = Class;
1218
+ kind = kind - 5;
1219
+ staticInitializers = staticInitializers || [];
1220
+ initializers = staticInitializers;
1221
+ } else {
1222
+ base = Class.prototype;
1223
+ protoInitializers = protoInitializers || [];
1224
+ initializers = protoInitializers;
1225
+ }
1226
+ if (kind !== 0 && !isPrivate) {
1227
+ var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
1228
+ var existingKind = existingNonFields.get(name) || 0;
1229
+ if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
1230
+ else if (!existingKind && kind > 2) existingNonFields.set(name, kind);
1231
+ else existingNonFields.set(name, true);
1232
+ }
1233
+ applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
1234
+ }
1235
+ pushInitializers(ret, protoInitializers);
1236
+ pushInitializers(ret, staticInitializers);
1237
+ return ret;
1238
+ }
1239
+ function pushInitializers(ret, initializers) {
1240
+ if (initializers) ret.push(function(instance) {
1241
+ for (var i = 0; i < initializers.length; i++) initializers[i].call(instance);
1242
+ return instance;
1243
+ });
1244
+ }
1245
+ function applyClassDecs(targetClass, classDecs, metadata) {
1246
+ if (classDecs.length > 0) {
1247
+ var initializers = [];
1248
+ var newClass = targetClass;
1249
+ var name = targetClass.name;
1250
+ for (var i = classDecs.length - 1; i >= 0; i--) {
1251
+ var decoratorFinishedRef = { v: false };
1252
+ try {
1253
+ var nextNewClass = classDecs[i](newClass, {
1254
+ kind: "class",
1255
+ name,
1256
+ addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
1257
+ metadata
1258
+ });
1259
+ } finally {
1260
+ decoratorFinishedRef.v = true;
1261
+ }
1262
+ if (nextNewClass !== void 0) {
1263
+ assertValidReturnValue(10, nextNewClass);
1264
+ newClass = nextNewClass;
1265
+ }
1266
+ }
1267
+ return [defineMetadata(newClass, metadata), function() {
1268
+ for (var i$1 = 0; i$1 < initializers.length; i$1++) initializers[i$1].call(newClass);
1269
+ }];
1270
+ }
1271
+ }
1272
+ function defineMetadata(Class, metadata) {
1273
+ return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
1274
+ configurable: true,
1275
+ enumerable: true,
1276
+ value: metadata
1277
+ });
1278
+ }
1279
+ return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
1280
+ if (parentClass !== void 0) var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
1281
+ var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
1282
+ var e = applyMemberDecs(targetClass, memberDecs, metadata);
1283
+ if (!classDecs.length) defineMetadata(targetClass, metadata);
1284
+ return {
1285
+ e,
1286
+ get c() {
1287
+ return applyClassDecs(targetClass, classDecs, metadata);
1288
+ }
1289
+ };
1290
+ };
1291
+ }
1292
+ function _apply_decs_2203_r$1(targetClass, memberDecs, classDecs, parentClass) {
1293
+ return (_apply_decs_2203_r$1 = applyDecs2203RFactory$1())(targetClass, memberDecs, classDecs, parentClass);
1294
+ }
1295
+ var _dec$1, _initClass$1;
1296
+ let _PathBuilderService;
1297
+ _dec$1 = (0, _navios_core.Injectable)();
1298
+ var PathBuilderService = class {
1299
+ static {
1300
+ ({c: [_PathBuilderService, _initClass$1]} = _apply_decs_2203_r$1(this, [], [_dec$1]));
1301
+ }
1302
+ schemaConverter = (0, _navios_core.inject)(_SchemaConverterService);
1303
+ /**
1304
+ * Generates an OpenAPI path item for a discovered endpoint.
1305
+ *
1306
+ * @param endpoint - Discovered endpoint with metadata
1307
+ * @returns Path string and path item object
1308
+ */ build(endpoint) {
1309
+ const { config, handler, openApiMetadata } = endpoint;
1310
+ const path = this.convertUrlParams(config.url);
1311
+ const operation = {
1312
+ tags: openApiMetadata.tags.length > 0 ? openApiMetadata.tags : void 0,
1313
+ summary: openApiMetadata.summary,
1314
+ description: openApiMetadata.description,
1315
+ operationId: openApiMetadata.operationId,
1316
+ deprecated: openApiMetadata.deprecated || void 0,
1317
+ externalDocs: openApiMetadata.externalDocs,
1318
+ security: openApiMetadata.security,
1319
+ parameters: this.buildParameters(config),
1320
+ requestBody: this.buildRequestBody(config, handler),
1321
+ responses: this.buildResponses(endpoint)
1322
+ };
1323
+ const cleanOperation = Object.fromEntries(Object.entries(operation).filter(([, v]) => v !== void 0));
1324
+ return {
1325
+ path,
1326
+ pathItem: { [config.method.toLowerCase()]: cleanOperation }
1327
+ };
1328
+ }
1329
+ /**
1330
+ * Converts Navios URL param format ($param) to OpenAPI format ({param})
1331
+ */ convertUrlParams(url) {
1332
+ return url.replace(/\$(\w+)/g, "{$1}");
1333
+ }
1334
+ /**
1335
+ * Extracts URL parameter names from a URL pattern
1336
+ */ extractUrlParamNames(url) {
1337
+ const matches = url.matchAll(/\$(\w+)/g);
1338
+ return Array.from(matches, (m) => m[1]);
1339
+ }
1340
+ /**
1341
+ * Gets the endpoint type based on the adapter token
1342
+ */ getEndpointType(handler) {
1343
+ if (handler.adapterToken === _navios_core.EndpointAdapterToken) return "endpoint";
1344
+ if (handler.adapterToken === _navios_core.MultipartAdapterToken) return "multipart";
1345
+ if (handler.adapterToken === _navios_core.StreamAdapterToken) return "stream";
1346
+ return "unknown";
1347
+ }
1348
+ /**
1349
+ * Builds OpenAPI parameters from endpoint config
1350
+ */ buildParameters(config) {
1351
+ const params = [];
1352
+ const urlParams = this.extractUrlParamNames(config.url);
1353
+ for (const param of urlParams) params.push({
1354
+ name: param,
1355
+ in: "path",
1356
+ required: true,
1357
+ schema: { type: "string" }
1358
+ });
1359
+ if (config.querySchema) {
1360
+ const { schema: querySchema } = this.schemaConverter.convert(config.querySchema);
1361
+ const schemaObj = querySchema;
1362
+ if (schemaObj.properties) for (const [name, schema] of Object.entries(schemaObj.properties)) params.push({
1363
+ name,
1364
+ in: "query",
1365
+ required: schemaObj.required?.includes(name) ?? false,
1366
+ schema,
1367
+ description: schema.description
1368
+ });
1369
+ }
1370
+ return params;
1371
+ }
1372
+ /**
1373
+ * Builds request body based on endpoint type
1374
+ */ buildRequestBody(config, handler) {
1375
+ switch (this.getEndpointType(handler)) {
1376
+ case "multipart": return this.buildMultipartRequestBody(config);
1377
+ case "stream": return;
1378
+ case "endpoint":
1379
+ default: return this.buildJsonRequestBody(config);
1380
+ }
1381
+ }
1382
+ /**
1383
+ * Builds request body for JSON endpoints
1384
+ */ buildJsonRequestBody(config) {
1385
+ if (!config.requestSchema) return;
1386
+ const { schema } = this.schemaConverter.convert(config.requestSchema);
1387
+ return {
1388
+ required: true,
1389
+ content: { "application/json": { schema } }
1390
+ };
1391
+ }
1392
+ /**
1393
+ * Builds request body for multipart endpoints
1394
+ */ buildMultipartRequestBody(config) {
1395
+ if (!config.requestSchema) return {
1396
+ required: true,
1397
+ content: { "multipart/form-data": { schema: { type: "object" } } }
1398
+ };
1399
+ const schema = this.schemaConverter.convert(config.requestSchema).schema;
1400
+ const properties = this.schemaConverter.transformFileProperties(schema.properties || {});
1401
+ return {
1402
+ required: true,
1403
+ content: { "multipart/form-data": { schema: {
1404
+ type: "object",
1405
+ properties,
1406
+ required: schema.required
1407
+ } } }
1408
+ };
1409
+ }
1410
+ /**
1411
+ * Builds responses based on endpoint type
1412
+ */ buildResponses(endpoint) {
1413
+ const { config, handler } = endpoint;
1414
+ switch (this.getEndpointType(handler)) {
1415
+ case "stream": return this.buildStreamResponses(endpoint);
1416
+ case "multipart":
1417
+ case "endpoint": return this.buildJsonResponses(config, handler);
1418
+ case "unknown": return this.buildUnknownResponses(config);
1419
+ default: return this.buildUnknownResponses(config);
1420
+ }
1421
+ }
1422
+ /**
1423
+ * Builds error responses from errorSchema
1424
+ *
1425
+ * @param errorSchema - Optional record mapping status codes to Zod schemas
1426
+ * @returns ResponsesObject with error responses, or empty object if no errorSchema
1427
+ */ buildErrorResponses(errorSchema) {
1428
+ if (!errorSchema) return {};
1429
+ const errorResponses = {};
1430
+ for (const [statusCode, schema] of Object.entries(errorSchema)) {
1431
+ const { schema: convertedSchema } = this.schemaConverter.convert(schema);
1432
+ errorResponses[statusCode] = {
1433
+ description: `Error response (${statusCode})`,
1434
+ content: { "application/json": { schema: convertedSchema } }
1435
+ };
1436
+ }
1437
+ return errorResponses;
1438
+ }
1439
+ /**
1440
+ * Builds responses for JSON endpoints
1441
+ */ buildJsonResponses(config, handler) {
1442
+ const successCode = handler.successStatusCode?.toString() ?? "200";
1443
+ const responses = {};
1444
+ if (!config.responseSchema) responses[successCode] = { description: "Successful response" };
1445
+ else {
1446
+ const { schema } = this.schemaConverter.convert(config.responseSchema);
1447
+ responses[successCode] = {
1448
+ description: "Successful response",
1449
+ content: { "application/json": { schema } }
1450
+ };
1451
+ }
1452
+ Object.assign(responses, this.buildErrorResponses(config.errorSchema));
1453
+ return responses;
1454
+ }
1455
+ /**
1456
+ * Builds responses for stream endpoints
1457
+ */ buildStreamResponses(endpoint) {
1458
+ const { config, openApiMetadata, handler } = endpoint;
1459
+ const successCode = handler.successStatusCode?.toString() ?? "200";
1460
+ const contentType = openApiMetadata.stream?.contentType ?? "application/octet-stream";
1461
+ const description = openApiMetadata.stream?.description ?? "Stream response";
1462
+ const content = this.getStreamContent(contentType);
1463
+ const responses = { [successCode]: {
1464
+ description,
1465
+ content
1466
+ } };
1467
+ Object.assign(responses, this.buildErrorResponses(config.errorSchema));
1468
+ return responses;
1469
+ }
1470
+ /**
1471
+ * Builds responses for unknown endpoint types.
1472
+ * Unknown types have no success response but can have error responses.
1473
+ */ buildUnknownResponses(config) {
1474
+ return this.buildErrorResponses(config.errorSchema);
1475
+ }
1476
+ /**
1477
+ * Gets content object for different stream types
1478
+ */ getStreamContent(contentType) {
1479
+ switch (contentType) {
1480
+ case "text/event-stream": return { "text/event-stream": { schema: {
1481
+ type: "string",
1482
+ description: "Server-Sent Events stream"
1483
+ } } };
1484
+ case "application/octet-stream": return { "application/octet-stream": { schema: {
1485
+ type: "string",
1486
+ format: "binary",
1487
+ description: "Binary file download"
1488
+ } } };
1489
+ case "application/json": return { "application/json": { schema: {
1490
+ type: "string",
1491
+ description: "Newline-delimited JSON stream"
1492
+ } } };
1493
+ default: return { [contentType]: { schema: {
1494
+ type: "string",
1495
+ format: "binary"
1496
+ } } };
1497
+ }
1498
+ }
1499
+ static {
1500
+ _initClass$1();
1501
+ }
1502
+ };
1503
+
1504
+ //#endregion
1505
+ //#region src/services/openapi-generator.service.mts
1506
+ function applyDecs2203RFactory() {
1507
+ function createAddInitializerMethod(initializers, decoratorFinishedRef) {
1508
+ return function addInitializer(initializer) {
1509
+ assertNotFinished(decoratorFinishedRef, "addInitializer");
1510
+ assertCallable(initializer, "An initializer");
1511
+ initializers.push(initializer);
1512
+ };
1513
+ }
1514
+ function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
1515
+ var kindStr;
1516
+ switch (kind) {
1517
+ case 1:
1518
+ kindStr = "accessor";
1519
+ break;
1520
+ case 2:
1521
+ kindStr = "method";
1522
+ break;
1523
+ case 3:
1524
+ kindStr = "getter";
1525
+ break;
1526
+ case 4:
1527
+ kindStr = "setter";
1528
+ break;
1529
+ default: kindStr = "field";
1530
+ }
1531
+ var ctx = {
1532
+ kind: kindStr,
1533
+ name: isPrivate ? "#" + name : name,
1534
+ static: isStatic,
1535
+ private: isPrivate,
1536
+ metadata
1537
+ };
1538
+ var decoratorFinishedRef = { v: false };
1539
+ ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
1540
+ var get, set;
1541
+ if (kind === 0) if (isPrivate) {
1542
+ get = desc.get;
1543
+ set = desc.set;
1544
+ } else {
1545
+ get = function() {
1546
+ return this[name];
1547
+ };
1548
+ set = function(v) {
1549
+ this[name] = v;
1550
+ };
1551
+ }
1552
+ else if (kind === 2) get = function() {
1553
+ return desc.value;
1554
+ };
1555
+ else {
1556
+ if (kind === 1 || kind === 3) get = function() {
1557
+ return desc.get.call(this);
1558
+ };
1559
+ if (kind === 1 || kind === 4) set = function(v) {
1560
+ desc.set.call(this, v);
1561
+ };
1562
+ }
1563
+ ctx.access = get && set ? {
1564
+ get,
1565
+ set
1566
+ } : get ? { get } : { set };
1567
+ try {
1568
+ return dec(value, ctx);
1569
+ } finally {
1570
+ decoratorFinishedRef.v = true;
1571
+ }
1572
+ }
1573
+ function assertNotFinished(decoratorFinishedRef, fnName) {
1574
+ if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished");
1575
+ }
1576
+ function assertCallable(fn, hint) {
1577
+ if (typeof fn !== "function") throw new TypeError(hint + " must be a function");
1578
+ }
1579
+ function assertValidReturnValue(kind, value) {
1580
+ var type = typeof value;
1581
+ if (kind === 1) {
1582
+ if (type !== "object" || value === null) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
1583
+ if (value.get !== void 0) assertCallable(value.get, "accessor.get");
1584
+ if (value.set !== void 0) assertCallable(value.set, "accessor.set");
1585
+ if (value.init !== void 0) assertCallable(value.init, "accessor.init");
1586
+ } else if (type !== "function") {
1587
+ var hint;
1588
+ if (kind === 0) hint = "field";
1589
+ else if (kind === 10) hint = "class";
1590
+ else hint = "method";
1591
+ throw new TypeError(hint + " decorators must return a function or void 0");
1592
+ }
1593
+ }
1594
+ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
1595
+ var decs = decInfo[0];
1596
+ var desc, init, value;
1597
+ if (isPrivate) if (kind === 0 || kind === 1) desc = {
1598
+ get: decInfo[3],
1599
+ set: decInfo[4]
1600
+ };
1601
+ else if (kind === 3) desc = { get: decInfo[3] };
1602
+ else if (kind === 4) desc = { set: decInfo[3] };
1603
+ else desc = { value: decInfo[3] };
1604
+ else if (kind !== 0) desc = Object.getOwnPropertyDescriptor(base, name);
1605
+ if (kind === 1) value = {
1606
+ get: desc.get,
1607
+ set: desc.set
1608
+ };
1609
+ else if (kind === 2) value = desc.value;
1610
+ else if (kind === 3) value = desc.get;
1611
+ else if (kind === 4) value = desc.set;
1612
+ var newValue, get, set;
1613
+ if (typeof decs === "function") {
1614
+ newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
1615
+ if (newValue !== void 0) {
1616
+ assertValidReturnValue(kind, newValue);
1617
+ if (kind === 0) init = newValue;
1618
+ else if (kind === 1) {
1619
+ init = newValue.init;
1620
+ get = newValue.get || value.get;
1621
+ set = newValue.set || value.set;
1622
+ value = {
1623
+ get,
1624
+ set
1625
+ };
1626
+ } else value = newValue;
1627
+ }
1628
+ } else for (var i = decs.length - 1; i >= 0; i--) {
1629
+ var dec = decs[i];
1630
+ newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
1631
+ if (newValue !== void 0) {
1632
+ assertValidReturnValue(kind, newValue);
1633
+ var newInit;
1634
+ if (kind === 0) newInit = newValue;
1635
+ else if (kind === 1) {
1636
+ newInit = newValue.init;
1637
+ get = newValue.get || value.get;
1638
+ set = newValue.set || value.set;
1639
+ value = {
1640
+ get,
1641
+ set
1642
+ };
1643
+ } else value = newValue;
1644
+ if (newInit !== void 0) if (init === void 0) init = newInit;
1645
+ else if (typeof init === "function") init = [init, newInit];
1646
+ else init.push(newInit);
1647
+ }
1648
+ }
1649
+ if (kind === 0 || kind === 1) {
1650
+ if (init === void 0) init = function(instance, init$1) {
1651
+ return init$1;
1652
+ };
1653
+ else if (typeof init !== "function") {
1654
+ var ownInitializers = init;
1655
+ init = function(instance, init$1) {
1656
+ var value$1 = init$1;
1657
+ for (var i$1 = 0; i$1 < ownInitializers.length; i$1++) value$1 = ownInitializers[i$1].call(instance, value$1);
1658
+ return value$1;
1659
+ };
1660
+ } else {
1661
+ var originalInitializer = init;
1662
+ init = function(instance, init$1) {
1663
+ return originalInitializer.call(instance, init$1);
1664
+ };
1665
+ }
1666
+ ret.push(init);
1667
+ }
1668
+ if (kind !== 0) {
1669
+ if (kind === 1) {
1670
+ desc.get = value.get;
1671
+ desc.set = value.set;
1672
+ } else if (kind === 2) desc.value = value;
1673
+ else if (kind === 3) desc.get = value;
1674
+ else if (kind === 4) desc.set = value;
1675
+ if (isPrivate) if (kind === 1) {
1676
+ ret.push(function(instance, args) {
1677
+ return value.get.call(instance, args);
1678
+ });
1679
+ ret.push(function(instance, args) {
1680
+ return value.set.call(instance, args);
1681
+ });
1682
+ } else if (kind === 2) ret.push(value);
1683
+ else ret.push(function(instance, args) {
1684
+ return value.call(instance, args);
1685
+ });
1686
+ else Object.defineProperty(base, name, desc);
1687
+ }
1688
+ }
1689
+ function applyMemberDecs(Class, decInfos, metadata) {
1690
+ var ret = [];
1691
+ var protoInitializers;
1692
+ var staticInitializers;
1693
+ var existingProtoNonFields = /* @__PURE__ */ new Map();
1694
+ var existingStaticNonFields = /* @__PURE__ */ new Map();
1695
+ for (var i = 0; i < decInfos.length; i++) {
1696
+ var decInfo = decInfos[i];
1697
+ if (!Array.isArray(decInfo)) continue;
1698
+ var kind = decInfo[1];
1699
+ var name = decInfo[2];
1700
+ var isPrivate = decInfo.length > 3;
1701
+ var isStatic = kind >= 5;
1702
+ var base;
1703
+ var initializers;
1704
+ if (isStatic) {
1705
+ base = Class;
1706
+ kind = kind - 5;
1707
+ staticInitializers = staticInitializers || [];
1708
+ initializers = staticInitializers;
1709
+ } else {
1710
+ base = Class.prototype;
1711
+ protoInitializers = protoInitializers || [];
1712
+ initializers = protoInitializers;
1713
+ }
1714
+ if (kind !== 0 && !isPrivate) {
1715
+ var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
1716
+ var existingKind = existingNonFields.get(name) || 0;
1717
+ if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
1718
+ else if (!existingKind && kind > 2) existingNonFields.set(name, kind);
1719
+ else existingNonFields.set(name, true);
1720
+ }
1721
+ applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
1722
+ }
1723
+ pushInitializers(ret, protoInitializers);
1724
+ pushInitializers(ret, staticInitializers);
1725
+ return ret;
1726
+ }
1727
+ function pushInitializers(ret, initializers) {
1728
+ if (initializers) ret.push(function(instance) {
1729
+ for (var i = 0; i < initializers.length; i++) initializers[i].call(instance);
1730
+ return instance;
1731
+ });
1732
+ }
1733
+ function applyClassDecs(targetClass, classDecs, metadata) {
1734
+ if (classDecs.length > 0) {
1735
+ var initializers = [];
1736
+ var newClass = targetClass;
1737
+ var name = targetClass.name;
1738
+ for (var i = classDecs.length - 1; i >= 0; i--) {
1739
+ var decoratorFinishedRef = { v: false };
1740
+ try {
1741
+ var nextNewClass = classDecs[i](newClass, {
1742
+ kind: "class",
1743
+ name,
1744
+ addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
1745
+ metadata
1746
+ });
1747
+ } finally {
1748
+ decoratorFinishedRef.v = true;
1749
+ }
1750
+ if (nextNewClass !== void 0) {
1751
+ assertValidReturnValue(10, nextNewClass);
1752
+ newClass = nextNewClass;
1753
+ }
1754
+ }
1755
+ return [defineMetadata(newClass, metadata), function() {
1756
+ for (var i$1 = 0; i$1 < initializers.length; i$1++) initializers[i$1].call(newClass);
1757
+ }];
1758
+ }
1759
+ }
1760
+ function defineMetadata(Class, metadata) {
1761
+ return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
1762
+ configurable: true,
1763
+ enumerable: true,
1764
+ value: metadata
1765
+ });
1766
+ }
1767
+ return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
1768
+ if (parentClass !== void 0) var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
1769
+ var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
1770
+ var e = applyMemberDecs(targetClass, memberDecs, metadata);
1771
+ if (!classDecs.length) defineMetadata(targetClass, metadata);
1772
+ return {
1773
+ e,
1774
+ get c() {
1775
+ return applyClassDecs(targetClass, classDecs, metadata);
1776
+ }
1777
+ };
1778
+ };
1779
+ }
1780
+ function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) {
1781
+ return (_apply_decs_2203_r = applyDecs2203RFactory())(targetClass, memberDecs, classDecs, parentClass);
1782
+ }
1783
+ var _dec, _initClass;
1784
+ let _OpenApiGeneratorService;
1785
+ _dec = (0, _navios_core.Injectable)();
1786
+ var OpenApiGeneratorService = class {
1787
+ static {
1788
+ ({c: [_OpenApiGeneratorService, _initClass]} = _apply_decs_2203_r(this, [], [_dec]));
1789
+ }
1790
+ logger = (0, _navios_core.inject)(_navios_core.Logger, { context: _OpenApiGeneratorService.name });
1791
+ scanner = (0, _navios_core.inject)(_EndpointScannerService);
1792
+ pathBuilder = (0, _navios_core.inject)(_PathBuilderService);
1793
+ /**
1794
+ * Generates an OpenAPI document from loaded modules.
1795
+ *
1796
+ * @param modules - Map of loaded modules
1797
+ * @param options - OpenAPI generation options
1798
+ * @returns Complete OpenAPI document
1799
+ */ generate(modules, options) {
1800
+ this.logger.debug("Generating OpenAPI document");
1801
+ const endpoints = this.scanner.scan(modules);
1802
+ const paths = this.buildPaths(endpoints);
1803
+ const discoveredTags = this.collectTags(endpoints);
1804
+ const tags = this.mergeTags(discoveredTags, options.tags);
1805
+ const document = {
1806
+ openapi: "3.1.0",
1807
+ info: options.info,
1808
+ paths
1809
+ };
1810
+ if (options.servers && options.servers.length > 0) document.servers = options.servers;
1811
+ if (options.externalDocs) document.externalDocs = options.externalDocs;
1812
+ if (tags.length > 0) document.tags = tags;
1813
+ if (options.security) document.security = options.security;
1814
+ if (options.securitySchemes) document.components = {
1815
+ ...document.components,
1816
+ securitySchemes: options.securitySchemes
1817
+ };
1818
+ this.logger.debug(`Generated OpenAPI document with ${Object.keys(paths).length} paths`);
1819
+ return document;
1820
+ }
1821
+ /**
1822
+ * Builds paths object from discovered endpoints
1823
+ */ buildPaths(endpoints) {
1824
+ const paths = {};
1825
+ for (const endpoint of endpoints) {
1826
+ const { path, pathItem } = this.pathBuilder.build(endpoint);
1827
+ if (paths[path]) paths[path] = {
1828
+ ...paths[path],
1829
+ ...pathItem
1830
+ };
1831
+ else paths[path] = pathItem;
1832
+ }
1833
+ return paths;
1834
+ }
1835
+ /**
1836
+ * Collects unique tags from endpoints
1837
+ */ collectTags(endpoints) {
1838
+ const tags = /* @__PURE__ */ new Set();
1839
+ for (const endpoint of endpoints) for (const tag of endpoint.openApiMetadata.tags) tags.add(tag);
1840
+ return tags;
1841
+ }
1842
+ /**
1843
+ * Merges discovered tags with configured tags
1844
+ */ mergeTags(discoveredTags, configuredTags) {
1845
+ const tagMap = /* @__PURE__ */ new Map();
1846
+ if (configuredTags) for (const tag of configuredTags) tagMap.set(tag.name, tag);
1847
+ for (const tagName of discoveredTags) if (!tagMap.has(tagName)) tagMap.set(tagName, { name: tagName });
1848
+ return Array.from(tagMap.values());
1849
+ }
1850
+ static {
1851
+ _initClass();
1852
+ }
1853
+ };
1854
+
1855
+ //#endregion
1856
+ Object.defineProperty(exports, 'ApiDeprecatedToken', {
1857
+ enumerable: true,
1858
+ get: function () {
1859
+ return ApiDeprecatedToken;
1860
+ }
1861
+ });
1862
+ Object.defineProperty(exports, 'ApiExcludeToken', {
1863
+ enumerable: true,
1864
+ get: function () {
1865
+ return ApiExcludeToken;
1866
+ }
1867
+ });
1868
+ Object.defineProperty(exports, 'ApiOperationToken', {
1869
+ enumerable: true,
1870
+ get: function () {
1871
+ return ApiOperationToken;
1872
+ }
1873
+ });
1874
+ Object.defineProperty(exports, 'ApiSecurityToken', {
1875
+ enumerable: true,
1876
+ get: function () {
1877
+ return ApiSecurityToken;
1878
+ }
1879
+ });
1880
+ Object.defineProperty(exports, 'ApiStreamToken', {
1881
+ enumerable: true,
1882
+ get: function () {
1883
+ return ApiStreamToken;
1884
+ }
1885
+ });
1886
+ Object.defineProperty(exports, 'ApiSummaryToken', {
1887
+ enumerable: true,
1888
+ get: function () {
1889
+ return ApiSummaryToken;
1890
+ }
1891
+ });
1892
+ Object.defineProperty(exports, 'ApiTagToken', {
1893
+ enumerable: true,
1894
+ get: function () {
1895
+ return ApiTagToken;
1896
+ }
1897
+ });
1898
+ Object.defineProperty(exports, '_EndpointScannerService', {
1899
+ enumerable: true,
1900
+ get: function () {
1901
+ return _EndpointScannerService;
1902
+ }
1903
+ });
1904
+ Object.defineProperty(exports, '_MetadataExtractorService', {
1905
+ enumerable: true,
1906
+ get: function () {
1907
+ return _MetadataExtractorService;
1908
+ }
1909
+ });
1910
+ Object.defineProperty(exports, '_OpenApiGeneratorService', {
1911
+ enumerable: true,
1912
+ get: function () {
1913
+ return _OpenApiGeneratorService;
1914
+ }
1915
+ });
1916
+ Object.defineProperty(exports, '_PathBuilderService', {
1917
+ enumerable: true,
1918
+ get: function () {
1919
+ return _PathBuilderService;
1920
+ }
1921
+ });
1922
+ Object.defineProperty(exports, '_SchemaConverterService', {
1923
+ enumerable: true,
1924
+ get: function () {
1925
+ return _SchemaConverterService;
1926
+ }
1927
+ });
1928
+ //# sourceMappingURL=services-B16xN1Kh.cjs.map