@moostjs/swagger 0.6.1 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -208,7 +208,7 @@ function jsonToYaml(value) {
208
208
  const globalSchemas = {};
209
209
  let schemaRefs = /* @__PURE__ */ new WeakMap();
210
210
  const nameToType = /* @__PURE__ */ new Map();
211
- function mapToSwaggerSpec(metadata, options, logger) {
211
+ function mapToSwaggerSpec(metadata, options) {
212
212
  resetSchemaRegistry();
213
213
  const is31 = options?.openapiVersion === "3.1";
214
214
  const collectedSecuritySchemes = { ...options?.securitySchemes };
@@ -986,11 +986,9 @@ var SwaggerController = class {
986
986
  async resolveSpec() {
987
987
  if (!this.spec) {
988
988
  const ctx = (0, moost.current)();
989
- const l = (0, moost.useLogger)(ctx);
990
- const logger = typeof l.topic === "function" ? l.topic("@moostjs/swagger") : l;
991
989
  const { instantiate } = (0, moost.useControllerContext)(ctx);
992
990
  const moost$1 = await instantiate(moost.Moost);
993
- this.spec = mapToSwaggerSpec(moost$1.getControllersOverview(), this.opts, logger);
991
+ this.spec = mapToSwaggerSpec(moost$1.getControllersOverview(), this.opts);
994
992
  }
995
993
  return this.spec;
996
994
  }
@@ -1029,13 +1027,13 @@ _ts_decorate([
1029
1027
  (0, __moostjs_event_http.Get)("index.html"),
1030
1028
  (0, __moostjs_event_http.SetHeader)("content-type", "text/html"),
1031
1029
  _ts_param(0, (0, __moostjs_event_http.Url)()),
1032
- _ts_param(1, (0, __moostjs_event_http.HeaderHook)("location")),
1033
- _ts_param(2, (0, __moostjs_event_http.StatusHook)()),
1030
+ _ts_param(1, (0, __moostjs_event_http.HeaderRef)("location")),
1031
+ _ts_param(2, (0, __moostjs_event_http.StatusRef)()),
1034
1032
  _ts_metadata("design:type", Function),
1035
1033
  _ts_metadata("design:paramtypes", [
1036
1034
  String,
1037
- typeof THeaderHook === "undefined" ? Object : THeaderHook,
1038
- typeof TStatusHook === "undefined" ? Object : TStatusHook
1035
+ typeof THeaderRef === "undefined" ? Object : THeaderRef,
1036
+ typeof TStatusRef === "undefined" ? Object : TStatusRef
1039
1037
  ]),
1040
1038
  _ts_metadata("design:returntype", void 0)
1041
1039
  ], SwaggerController.prototype, "serveIndex", null);
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Mate, TMoostMetadata, TMateParamMeta } from 'moost';
2
- import { THeaderHook, TStatusHook } from '@moostjs/event-http';
2
+ import { THeaderRef, TStatusRef } from '@moostjs/event-http';
3
3
 
4
4
  type TFunction = Function;
5
5
 
@@ -355,7 +355,7 @@ declare class SwaggerController {
355
355
  constructor(opts?: TSwaggerOptions);
356
356
  'assetPath': string;
357
357
  protected processCors(): void;
358
- serveIndex(url: string, location: THeaderHook, status: TStatusHook): string;
358
+ serveIndex(url: string, location: THeaderRef, status: TStatusRef): string;
359
359
  'swagger-initializer.js'(): string;
360
360
  'spec'?: Record<string, unknown>;
361
361
  protected resolveSpec(): Promise<Record<string, unknown>>;
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { Const, Controller, Moost, current, getMoostMate, useControllerContext, useLogger } from "moost";
2
- import { Get, HeaderHook, SetHeader, StatusHook, Url } from "@moostjs/event-http";
1
+ import { Const, Controller, Moost, current, getMoostMate, useControllerContext } from "moost";
2
+ import { Get, HeaderRef, SetHeader, StatusRef, Url } from "@moostjs/event-http";
3
3
  import { useResponse } from "@wooksjs/event-http";
4
4
  import { serveFile } from "@wooksjs/http-static";
5
5
  import Path from "path";
@@ -185,7 +185,7 @@ function jsonToYaml(value) {
185
185
  const globalSchemas = {};
186
186
  let schemaRefs = /* @__PURE__ */ new WeakMap();
187
187
  const nameToType = /* @__PURE__ */ new Map();
188
- function mapToSwaggerSpec(metadata, options, logger) {
188
+ function mapToSwaggerSpec(metadata, options) {
189
189
  resetSchemaRegistry();
190
190
  const is31 = options?.openapiVersion === "3.1";
191
191
  const collectedSecuritySchemes = { ...options?.securitySchemes };
@@ -963,11 +963,9 @@ var SwaggerController = class {
963
963
  async resolveSpec() {
964
964
  if (!this.spec) {
965
965
  const ctx = current();
966
- const l = useLogger(ctx);
967
- const logger = typeof l.topic === "function" ? l.topic("@moostjs/swagger") : l;
968
966
  const { instantiate } = useControllerContext(ctx);
969
967
  const moost = await instantiate(Moost);
970
- this.spec = mapToSwaggerSpec(moost.getControllersOverview(), this.opts, logger);
968
+ this.spec = mapToSwaggerSpec(moost.getControllersOverview(), this.opts);
971
969
  }
972
970
  return this.spec;
973
971
  }
@@ -1006,13 +1004,13 @@ _ts_decorate([
1006
1004
  Get("index.html"),
1007
1005
  SetHeader("content-type", "text/html"),
1008
1006
  _ts_param(0, Url()),
1009
- _ts_param(1, HeaderHook("location")),
1010
- _ts_param(2, StatusHook()),
1007
+ _ts_param(1, HeaderRef("location")),
1008
+ _ts_param(2, StatusRef()),
1011
1009
  _ts_metadata("design:type", Function),
1012
1010
  _ts_metadata("design:paramtypes", [
1013
1011
  String,
1014
- typeof THeaderHook === "undefined" ? Object : THeaderHook,
1015
- typeof TStatusHook === "undefined" ? Object : TStatusHook
1012
+ typeof THeaderRef === "undefined" ? Object : THeaderRef,
1013
+ typeof TStatusRef === "undefined" ? Object : TStatusRef
1016
1014
  ]),
1017
1015
  _ts_metadata("design:returntype", void 0)
1018
1016
  ], SwaggerController.prototype, "serveIndex", null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moostjs/swagger",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "description": "@moostjs/swagger",
5
5
  "keywords": [
6
6
  "composables",
@@ -41,15 +41,14 @@
41
41
  "swagger-ui-dist": "^5.31.2"
42
42
  },
43
43
  "devDependencies": {
44
- "@atscript/typescript": "^0.1.27",
45
44
  "@types/swagger-ui-dist": "3.30.5",
46
45
  "vitest": "3.2.4"
47
46
  },
48
47
  "peerDependencies": {
49
- "@wooksjs/event-http": "^0.7.3",
50
- "@wooksjs/http-static": "^0.7.3",
51
- "@moostjs/event-http": "^0.6.1",
52
- "moost": "^0.6.1"
48
+ "@wooksjs/event-http": "^0.7.7",
49
+ "@wooksjs/http-static": "^0.7.7",
50
+ "@moostjs/event-http": "^0.6.3",
51
+ "moost": "^0.6.3"
53
52
  },
54
53
  "scripts": {
55
54
  "pub": "pnpm publish --access public",