@lucaapp/service-utils 1.54.4 → 1.55.0

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.
@@ -37,7 +37,7 @@ export declare class Api {
37
37
  patch<TResponseSchemas extends ReadonlyArray<EndpointResponseSchema>, TRequestBodySchema extends ZodObjectSchemaOrUndefined = undefined, TRequestParamsSchema extends ZodObjectSchemaOrUndefined = undefined, TRequestQuerySchema extends ZodObjectSchemaOrUndefined = undefined, TRequestHeadersSchema extends ZodObjectSchemaOrUndefined = undefined, TMiddlewares extends ReadonlyArray<Middleware<any, any, any, any, any, any>> | undefined = undefined>(path: string, summary: string, options: EndpointOptions<TResponseSchemas, TRequestBodySchema, TRequestParamsSchema, TRequestQuerySchema, TRequestHeadersSchema, TMiddlewares>, handler: EndpointHandler<TResponseSchemas, TRequestBodySchema, TRequestParamsSchema, TRequestQuerySchema, TRequestHeadersSchema, TMiddlewares>): void;
38
38
  put<TResponseSchemas extends ReadonlyArray<EndpointResponseSchema>, TRequestBodySchema extends ZodObjectSchemaOrUndefined = undefined, TRequestParamsSchema extends ZodObjectSchemaOrUndefined = undefined, TRequestQuerySchema extends ZodObjectSchemaOrUndefined = undefined, TRequestHeadersSchema extends ZodObjectSchemaOrUndefined = undefined, TMiddlewares extends ReadonlyArray<Middleware<any, any, any, any, any, any>> | undefined = undefined>(path: string, summary: string, options: EndpointOptions<TResponseSchemas, TRequestBodySchema, TRequestParamsSchema, TRequestQuerySchema, TRequestHeadersSchema, TMiddlewares>, handler: EndpointHandler<TResponseSchemas, TRequestBodySchema, TRequestParamsSchema, TRequestQuerySchema, TRequestHeadersSchema, TMiddlewares>): void;
39
39
  delete<TResponseSchemas extends ReadonlyArray<EndpointResponseSchema>, TRequestBodySchema extends ZodObjectSchemaOrUndefined = undefined, TRequestParamsSchema extends ZodObjectSchemaOrUndefined = undefined, TRequestQuerySchema extends ZodObjectSchemaOrUndefined = undefined, TRequestHeadersSchema extends ZodObjectSchemaOrUndefined = undefined, TMiddlewares extends ReadonlyArray<Middleware<any, any, any, any, any, any>> | undefined = undefined>(path: string, summary: string, options: EndpointOptions<TResponseSchemas, TRequestBodySchema, TRequestParamsSchema, TRequestQuerySchema, TRequestHeadersSchema, TMiddlewares>, handler: EndpointHandler<TResponseSchemas, TRequestBodySchema, TRequestParamsSchema, TRequestQuerySchema, TRequestHeadersSchema, TMiddlewares>): void;
40
- generateOpenAPISpec(): import("openapi3-ts").OpenAPIObject;
40
+ generateOpenAPISpec(): import("openapi3-ts/oas30").OpenAPIObject | import("openapi3-ts/oas31").OpenAPIObject;
41
41
  mountSwaggerMiddlewares(): void;
42
42
  }
43
43
  export {};
@@ -54,8 +54,15 @@ class Api {
54
54
  (0, openapi_1.registerEndpoint)(this.registry, 'delete', this.prefixPath, path, summary, options, this.tags, this.debug);
55
55
  }
56
56
  generateOpenAPISpec() {
57
- const generator = new zod_to_openapi_1.OpenAPIGenerator(this.registry.definitions, this.openApiVersion);
57
+ let generator;
58
+ if (this.openApiVersion.startsWith('3.0.')) {
59
+ generator = new zod_to_openapi_1.OpenApiGeneratorV3(this.registry.definitions);
60
+ }
61
+ else {
62
+ generator = new zod_to_openapi_1.OpenApiGeneratorV31(this.registry.definitions);
63
+ }
58
64
  const spec = generator.generateDocument({
65
+ openapi: this.openApiVersion,
59
66
  info: {
60
67
  version: this.apiVersion,
61
68
  title: this.apiTitle,
@@ -1,7 +1,6 @@
1
1
  import type { Payment } from './events/payment';
2
2
  import type { Consumer } from './events/consumer';
3
3
  import type { Operator } from './events/operator';
4
- import type { LocationMenu, MenuCategory, MenuItem } from './events/locationMenu';
5
4
  import type { LocationGroupEmployees } from './events/locationGroupEmployees';
6
5
  import type { WsEvent } from './events/wsEvent';
7
6
  import { Service } from '../serviceIdentity';
@@ -16,9 +15,6 @@ declare enum KafkaTopic {
16
15
  CONSUMERS = "consumers",
17
16
  OPERATORS = "operators",
18
17
  LOCATIONS = "locations",
19
- LOCATION_MENUS = "location_menus",
20
- LOCATION_MENU_CATEGORIES = "location_menu_categories",
21
- LOCATION_MENU_ITEMS = "location_menu_items",
22
18
  LOCATION_GROUPS = "location_groups",
23
19
  LOCATION_GROUP_EMPLOYEES = "location_group_employees",
24
20
  RESERVATIONS = "reservations",
@@ -34,9 +30,6 @@ type MessageFormats = {
34
30
  [KafkaTopic.CONSUMERS]: Consumer;
35
31
  [KafkaTopic.OPERATORS]: Operator;
36
32
  [KafkaTopic.LOCATIONS]: Location;
37
- [KafkaTopic.LOCATION_MENUS]: LocationMenu;
38
- [KafkaTopic.LOCATION_MENU_CATEGORIES]: MenuCategory;
39
- [KafkaTopic.LOCATION_MENU_ITEMS]: MenuItem;
40
33
  [KafkaTopic.LOCATION_GROUPS]: LocationGroup;
41
34
  [KafkaTopic.LOCATION_GROUP_EMPLOYEES]: LocationGroupEmployees;
42
35
  [KafkaTopic.RESERVATIONS]: Reservation;
@@ -52,9 +45,6 @@ declare const MessageIssuer: {
52
45
  consumers: Service;
53
46
  operators: Service;
54
47
  locations: Service;
55
- location_menus: Service;
56
- location_menu_categories: Service;
57
- location_menu_items: Service;
58
48
  location_groups: Service;
59
49
  location_group_employees: Service;
60
50
  reservations: Service;
@@ -8,9 +8,6 @@ var KafkaTopic;
8
8
  KafkaTopic["CONSUMERS"] = "consumers";
9
9
  KafkaTopic["OPERATORS"] = "operators";
10
10
  KafkaTopic["LOCATIONS"] = "locations";
11
- KafkaTopic["LOCATION_MENUS"] = "location_menus";
12
- KafkaTopic["LOCATION_MENU_CATEGORIES"] = "location_menu_categories";
13
- KafkaTopic["LOCATION_MENU_ITEMS"] = "location_menu_items";
14
11
  KafkaTopic["LOCATION_GROUPS"] = "location_groups";
15
12
  KafkaTopic["LOCATION_GROUP_EMPLOYEES"] = "location_group_employees";
16
13
  KafkaTopic["RESERVATIONS"] = "reservations";
@@ -27,9 +24,6 @@ const MessageIssuer = {
27
24
  [KafkaTopic.CONSUMERS]: serviceIdentity_1.Service.BACKEND,
28
25
  [KafkaTopic.OPERATORS]: serviceIdentity_1.Service.BACKEND,
29
26
  [KafkaTopic.LOCATIONS]: serviceIdentity_1.Service.BACKEND,
30
- [KafkaTopic.LOCATION_MENUS]: serviceIdentity_1.Service.BACKEND,
31
- [KafkaTopic.LOCATION_MENU_CATEGORIES]: serviceIdentity_1.Service.BACKEND,
32
- [KafkaTopic.LOCATION_MENU_ITEMS]: serviceIdentity_1.Service.BACKEND,
33
27
  [KafkaTopic.LOCATION_GROUPS]: serviceIdentity_1.Service.BACKEND,
34
28
  [KafkaTopic.LOCATION_GROUP_EMPLOYEES]: serviceIdentity_1.Service.BACKEND,
35
29
  [KafkaTopic.RESERVATIONS]: serviceIdentity_1.Service.BACKEND,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucaapp/service-utils",
3
- "version": "1.54.4",
3
+ "version": "1.55.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -18,7 +18,7 @@
18
18
  "audit": "improved-yarn-audit --ignore-dev-deps"
19
19
  },
20
20
  "dependencies": {
21
- "@asteasolutions/zod-to-openapi": "4.6.0",
21
+ "@asteasolutions/zod-to-openapi": "6.1.0",
22
22
  "@hapi/boom": "^10.0.0",
23
23
  "@tsconfig/node18": "1.0.1",
24
24
  "@types/express": "4.17.13",
@@ -45,7 +45,7 @@
45
45
  "url-value-parser": "^2.2.0",
46
46
  "uuid": "^9.0.0",
47
47
  "vitest": "0.32.0",
48
- "zod": "3.22.3"
48
+ "zod": "^3.22.3"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/express": "4.17.13",
@@ -1,41 +0,0 @@
1
- export type LocationMenu = {
2
- locationId: string;
3
- menu: object;
4
- imprint: object | null;
5
- allergensAndAdditives: object | null;
6
- createdAt: Date;
7
- updatedAt: Date;
8
- };
9
- export type MenuCategory = {
10
- uuid: string;
11
- locationId: string;
12
- name: object;
13
- isEnabled: boolean;
14
- description: object | null;
15
- imageUrl: string | null;
16
- createdAt: Date;
17
- updatedAt: Date;
18
- };
19
- declare enum ItemType {
20
- FOOD = "food",
21
- DRINK = "drink"
22
- }
23
- export type MenuItem = {
24
- uuid: string;
25
- categoryId: string;
26
- name: object;
27
- isEnabled: boolean;
28
- description: object | null;
29
- imageUrl: string | null;
30
- price: number;
31
- tax: number | null;
32
- allergensAndAdditives: string[] | null;
33
- label: string | null;
34
- pid: string | null;
35
- additionalInfo: object | null;
36
- portionSize: string | null;
37
- type: ItemType;
38
- createdAt: Date;
39
- updatedAt: Date;
40
- };
41
- export {};
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var ItemType;
4
- (function (ItemType) {
5
- ItemType["FOOD"] = "food";
6
- ItemType["DRINK"] = "drink";
7
- })(ItemType || (ItemType = {}));