@open-mercato/shared 0.6.1-develop.3219.1.ae5c8a5935 → 0.6.1-develop.3246.1.dbef9d7392
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/lib/openapi/crud.js
CHANGED
|
@@ -125,7 +125,8 @@ function createCrudOpenApiFactory(config) {
|
|
|
125
125
|
description: `${resourceName} deleted`,
|
|
126
126
|
schema: del.responseSchema ?? fallbackOkResponseSchema
|
|
127
127
|
}
|
|
128
|
-
]
|
|
128
|
+
],
|
|
129
|
+
...del.errors && del.errors.length > 0 ? { errors: del.errors } : {}
|
|
129
130
|
};
|
|
130
131
|
}
|
|
131
132
|
return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/openapi/crud.ts"],
|
|
4
|
-
"sourcesContent": ["import { z, type ZodTypeAny } from 'zod'\nimport type { OpenApiRouteDoc } from './types'\n\nexport const defaultCreateResponseSchema = z.object({ id: z.string().uuid().nullable() })\nexport const defaultOkResponseSchema = z.object({ ok: z.literal(true) })\n\nexport type PagedListResponseOptions = {\n paginationMetaOptional?: boolean\n}\n\nexport function createPagedListResponseSchema(itemSchema: ZodTypeAny, options: PagedListResponseOptions = {}) {\n const paginationMetaOptional = options.paginationMetaOptional ?? false\n\n return z.object({\n items: z.array(itemSchema),\n total: z.number(),\n page: paginationMetaOptional ? z.number().optional() : z.number(),\n pageSize: paginationMetaOptional ? z.number().optional() : z.number(),\n totalPages: z.number(),\n })\n}\n\ntype CrudMethodConfig = {\n schema: ZodTypeAny\n description?: string\n responseSchema?: ZodTypeAny\n}\n\ntype CrudCreateConfig = CrudMethodConfig & {\n status?: number\n}\n\ntype CrudDeleteConfig = {\n schema?: ZodTypeAny\n description?: string\n responseSchema?: ZodTypeAny\n}\n\nexport type CrudOpenApiOptions = {\n tag?: string\n resourceName: string\n pluralName?: string\n description?: string\n querySchema?: ZodTypeAny\n listResponseSchema: ZodTypeAny\n create?: CrudCreateConfig\n update?: CrudMethodConfig\n del?: CrudDeleteConfig\n}\n\nexport type CrudTextContext = {\n resourceName: string\n resourceLower: string\n pluralName: string\n pluralLower: string\n}\n\nexport type CrudOpenApiFactoryConfig = {\n defaultTag: string\n defaultCreateResponseSchema?: ZodTypeAny\n defaultOkResponseSchema?: ZodTypeAny\n makeListDescription?: (ctx: CrudTextContext) => string\n makeCreateDescription?: (ctx: CrudTextContext) => string\n makeCreateRequestBodyDescription?: (ctx: CrudTextContext) => string\n makeUpdateDescription?: (ctx: CrudTextContext) => string\n makeUpdateRequestBodyDescription?: (ctx: CrudTextContext) => string\n makeDeleteDescription?: (ctx: CrudTextContext) => string\n makeDeleteRequestBodyDescription?: (ctx: CrudTextContext) => string\n}\n\nfunction withIdsQueryParam(schema: ZodTypeAny | undefined): ZodTypeAny | undefined {\n if (!schema) return schema\n if (!(schema instanceof z.ZodObject)) return schema\n return schema.extend({\n ids: z\n .string()\n .optional()\n .describe('Comma-separated list of record UUIDs to filter by (max 200).'),\n })\n}\n\nfunction resolveDefault(\n factory: ((ctx: CrudTextContext) => string) | undefined,\n ctx: CrudTextContext,\n fallback: string,\n) {\n if (typeof factory === 'function') return factory(ctx)\n return fallback\n}\n\nexport function createCrudOpenApiFactory(config: CrudOpenApiFactoryConfig) {\n return function createCrudOpenApi(options: CrudOpenApiOptions): OpenApiRouteDoc {\n const {\n resourceName,\n pluralName,\n tag,\n description,\n querySchema,\n listResponseSchema,\n create,\n update,\n del,\n } = options\n\n const plural = pluralName ?? `${resourceName}s`\n const resourceLower = resourceName.toLowerCase()\n const pluralLower = plural.toLowerCase()\n const context: CrudTextContext = {\n resourceName,\n resourceLower,\n pluralName: plural,\n pluralLower,\n }\n\n const fallbackCreateResponseSchema = config.defaultCreateResponseSchema ?? defaultCreateResponseSchema\n const fallbackOkResponseSchema = config.defaultOkResponseSchema ?? defaultOkResponseSchema\n\n const methods: NonNullable<OpenApiRouteDoc['methods']> = {}\n\n methods.GET = {\n summary: `List ${pluralLower}`,\n description:\n description ?? resolveDefault(config.makeListDescription, context, `Returns a paginated collection of ${pluralLower}.`),\n query: withIdsQueryParam(querySchema),\n responses: [\n {\n status: 200,\n description: `Paginated ${pluralLower}`,\n schema: listResponseSchema,\n },\n ],\n }\n\n if (create) {\n const createDescription =\n create.description ??\n resolveDefault(config.makeCreateDescription, context, `Creates a new ${resourceLower}.`)\n\n const createBodyDescription =\n resolveDefault(\n config.makeCreateRequestBodyDescription,\n context,\n create.description ?? `Payload describing the ${resourceLower} to create.`,\n )\n\n methods.POST = {\n summary: `Create ${resourceLower}`,\n description: createDescription,\n requestBody: {\n schema: create.schema,\n description: createBodyDescription,\n },\n responses: [\n {\n status: create.status ?? 201,\n description: `${resourceName} created`,\n schema: create.responseSchema ?? fallbackCreateResponseSchema,\n },\n ],\n }\n }\n\n if (update) {\n const updateDescription =\n update.description ??\n resolveDefault(config.makeUpdateDescription, context, `Updates an existing ${resourceLower} by id.`)\n\n const updateBodyDescription =\n resolveDefault(\n config.makeUpdateRequestBodyDescription,\n context,\n update.description ?? `Fields to update on the ${resourceLower}.`,\n )\n\n methods.PUT = {\n summary: `Update ${resourceLower}`,\n description: updateDescription,\n requestBody: {\n schema: update.schema,\n description: updateBodyDescription,\n },\n responses: [\n {\n status: 200,\n description: `${resourceName} updated`,\n schema: update.responseSchema ?? fallbackOkResponseSchema,\n },\n ],\n }\n }\n\n if (del) {\n const deleteDescription =\n del.description ??\n resolveDefault(config.makeDeleteDescription, context, `Deletes a ${resourceLower} identified by id.`)\n\n const deleteBodyDescription =\n resolveDefault(\n config.makeDeleteRequestBodyDescription,\n context,\n del.description ?? 'Identifier payload.',\n )\n\n methods.DELETE = {\n summary: `Delete ${resourceLower}`,\n description: deleteDescription,\n requestBody: del.schema\n ? {\n schema: del.schema,\n description: deleteBodyDescription,\n }\n : undefined,\n responses: [\n {\n status: 200,\n description: `${resourceName} deleted`,\n schema: del.responseSchema ?? fallbackOkResponseSchema,\n },\n ],\n }\n }\n\n return {\n tag: tag ?? config.defaultTag,\n summary: `${resourceName} management`,\n methods,\n }\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,SAA0B;AAG5B,MAAM,8BAA8B,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AACjF,MAAM,0BAA0B,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,IAAI,EAAE,CAAC;AAMhE,SAAS,8BAA8B,YAAwB,UAAoC,CAAC,GAAG;AAC5G,QAAM,yBAAyB,QAAQ,0BAA0B;AAEjE,SAAO,EAAE,OAAO;AAAA,IACd,OAAO,EAAE,MAAM,UAAU;AAAA,IACzB,OAAO,EAAE,OAAO;AAAA,IAChB,MAAM,yBAAyB,EAAE,OAAO,EAAE,SAAS,IAAI,EAAE,OAAO;AAAA,IAChE,UAAU,yBAAyB,EAAE,OAAO,EAAE,SAAS,IAAI,EAAE,OAAO;AAAA,IACpE,YAAY,EAAE,OAAO;AAAA,EACvB,CAAC;AACH;
|
|
4
|
+
"sourcesContent": ["import { z, type ZodTypeAny } from 'zod'\nimport type { OpenApiResponseDoc, OpenApiRouteDoc } from './types'\n\nexport const defaultCreateResponseSchema = z.object({ id: z.string().uuid().nullable() })\nexport const defaultOkResponseSchema = z.object({ ok: z.literal(true) })\n\nexport type PagedListResponseOptions = {\n paginationMetaOptional?: boolean\n}\n\nexport function createPagedListResponseSchema(itemSchema: ZodTypeAny, options: PagedListResponseOptions = {}) {\n const paginationMetaOptional = options.paginationMetaOptional ?? false\n\n return z.object({\n items: z.array(itemSchema),\n total: z.number(),\n page: paginationMetaOptional ? z.number().optional() : z.number(),\n pageSize: paginationMetaOptional ? z.number().optional() : z.number(),\n totalPages: z.number(),\n })\n}\n\ntype CrudMethodConfig = {\n schema: ZodTypeAny\n description?: string\n responseSchema?: ZodTypeAny\n}\n\ntype CrudCreateConfig = CrudMethodConfig & {\n status?: number\n}\n\ntype CrudDeleteConfig = {\n schema?: ZodTypeAny\n description?: string\n responseSchema?: ZodTypeAny\n errors?: OpenApiResponseDoc[]\n}\n\nexport type CrudOpenApiOptions = {\n tag?: string\n resourceName: string\n pluralName?: string\n description?: string\n querySchema?: ZodTypeAny\n listResponseSchema: ZodTypeAny\n create?: CrudCreateConfig\n update?: CrudMethodConfig\n del?: CrudDeleteConfig\n}\n\nexport type CrudTextContext = {\n resourceName: string\n resourceLower: string\n pluralName: string\n pluralLower: string\n}\n\nexport type CrudOpenApiFactoryConfig = {\n defaultTag: string\n defaultCreateResponseSchema?: ZodTypeAny\n defaultOkResponseSchema?: ZodTypeAny\n makeListDescription?: (ctx: CrudTextContext) => string\n makeCreateDescription?: (ctx: CrudTextContext) => string\n makeCreateRequestBodyDescription?: (ctx: CrudTextContext) => string\n makeUpdateDescription?: (ctx: CrudTextContext) => string\n makeUpdateRequestBodyDescription?: (ctx: CrudTextContext) => string\n makeDeleteDescription?: (ctx: CrudTextContext) => string\n makeDeleteRequestBodyDescription?: (ctx: CrudTextContext) => string\n}\n\nfunction withIdsQueryParam(schema: ZodTypeAny | undefined): ZodTypeAny | undefined {\n if (!schema) return schema\n if (!(schema instanceof z.ZodObject)) return schema\n return schema.extend({\n ids: z\n .string()\n .optional()\n .describe('Comma-separated list of record UUIDs to filter by (max 200).'),\n })\n}\n\nfunction resolveDefault(\n factory: ((ctx: CrudTextContext) => string) | undefined,\n ctx: CrudTextContext,\n fallback: string,\n) {\n if (typeof factory === 'function') return factory(ctx)\n return fallback\n}\n\nexport function createCrudOpenApiFactory(config: CrudOpenApiFactoryConfig) {\n return function createCrudOpenApi(options: CrudOpenApiOptions): OpenApiRouteDoc {\n const {\n resourceName,\n pluralName,\n tag,\n description,\n querySchema,\n listResponseSchema,\n create,\n update,\n del,\n } = options\n\n const plural = pluralName ?? `${resourceName}s`\n const resourceLower = resourceName.toLowerCase()\n const pluralLower = plural.toLowerCase()\n const context: CrudTextContext = {\n resourceName,\n resourceLower,\n pluralName: plural,\n pluralLower,\n }\n\n const fallbackCreateResponseSchema = config.defaultCreateResponseSchema ?? defaultCreateResponseSchema\n const fallbackOkResponseSchema = config.defaultOkResponseSchema ?? defaultOkResponseSchema\n\n const methods: NonNullable<OpenApiRouteDoc['methods']> = {}\n\n methods.GET = {\n summary: `List ${pluralLower}`,\n description:\n description ?? resolveDefault(config.makeListDescription, context, `Returns a paginated collection of ${pluralLower}.`),\n query: withIdsQueryParam(querySchema),\n responses: [\n {\n status: 200,\n description: `Paginated ${pluralLower}`,\n schema: listResponseSchema,\n },\n ],\n }\n\n if (create) {\n const createDescription =\n create.description ??\n resolveDefault(config.makeCreateDescription, context, `Creates a new ${resourceLower}.`)\n\n const createBodyDescription =\n resolveDefault(\n config.makeCreateRequestBodyDescription,\n context,\n create.description ?? `Payload describing the ${resourceLower} to create.`,\n )\n\n methods.POST = {\n summary: `Create ${resourceLower}`,\n description: createDescription,\n requestBody: {\n schema: create.schema,\n description: createBodyDescription,\n },\n responses: [\n {\n status: create.status ?? 201,\n description: `${resourceName} created`,\n schema: create.responseSchema ?? fallbackCreateResponseSchema,\n },\n ],\n }\n }\n\n if (update) {\n const updateDescription =\n update.description ??\n resolveDefault(config.makeUpdateDescription, context, `Updates an existing ${resourceLower} by id.`)\n\n const updateBodyDescription =\n resolveDefault(\n config.makeUpdateRequestBodyDescription,\n context,\n update.description ?? `Fields to update on the ${resourceLower}.`,\n )\n\n methods.PUT = {\n summary: `Update ${resourceLower}`,\n description: updateDescription,\n requestBody: {\n schema: update.schema,\n description: updateBodyDescription,\n },\n responses: [\n {\n status: 200,\n description: `${resourceName} updated`,\n schema: update.responseSchema ?? fallbackOkResponseSchema,\n },\n ],\n }\n }\n\n if (del) {\n const deleteDescription =\n del.description ??\n resolveDefault(config.makeDeleteDescription, context, `Deletes a ${resourceLower} identified by id.`)\n\n const deleteBodyDescription =\n resolveDefault(\n config.makeDeleteRequestBodyDescription,\n context,\n del.description ?? 'Identifier payload.',\n )\n\n methods.DELETE = {\n summary: `Delete ${resourceLower}`,\n description: deleteDescription,\n requestBody: del.schema\n ? {\n schema: del.schema,\n description: deleteBodyDescription,\n }\n : undefined,\n responses: [\n {\n status: 200,\n description: `${resourceName} deleted`,\n schema: del.responseSchema ?? fallbackOkResponseSchema,\n },\n ],\n ...(del.errors && del.errors.length > 0 ? { errors: del.errors } : {}),\n }\n }\n\n return {\n tag: tag ?? config.defaultTag,\n summary: `${resourceName} management`,\n methods,\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,SAA0B;AAG5B,MAAM,8BAA8B,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AACjF,MAAM,0BAA0B,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,IAAI,EAAE,CAAC;AAMhE,SAAS,8BAA8B,YAAwB,UAAoC,CAAC,GAAG;AAC5G,QAAM,yBAAyB,QAAQ,0BAA0B;AAEjE,SAAO,EAAE,OAAO;AAAA,IACd,OAAO,EAAE,MAAM,UAAU;AAAA,IACzB,OAAO,EAAE,OAAO;AAAA,IAChB,MAAM,yBAAyB,EAAE,OAAO,EAAE,SAAS,IAAI,EAAE,OAAO;AAAA,IAChE,UAAU,yBAAyB,EAAE,OAAO,EAAE,SAAS,IAAI,EAAE,OAAO;AAAA,IACpE,YAAY,EAAE,OAAO;AAAA,EACvB,CAAC;AACH;AAmDA,SAAS,kBAAkB,QAAwD;AACjF,MAAI,CAAC,OAAQ,QAAO;AACpB,MAAI,EAAE,kBAAkB,EAAE,WAAY,QAAO;AAC7C,SAAO,OAAO,OAAO;AAAA,IACnB,KAAK,EACF,OAAO,EACP,SAAS,EACT,SAAS,8DAA8D;AAAA,EAC5E,CAAC;AACH;AAEA,SAAS,eACP,SACA,KACA,UACA;AACA,MAAI,OAAO,YAAY,WAAY,QAAO,QAAQ,GAAG;AACrD,SAAO;AACT;AAEO,SAAS,yBAAyB,QAAkC;AACzE,SAAO,SA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 -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/lib/version.ts"],
|
|
4
|
-
"sourcesContent": ["// Build-time generated version\nexport const APP_VERSION = '0.6.1-develop.
|
|
4
|
+
"sourcesContent": ["// Build-time generated version\nexport const APP_VERSION = '0.6.1-develop.3246.1.dbef9d7392'\nexport const appVersion = APP_VERSION\n"],
|
|
5
5
|
"mappings": "AACO,MAAM,cAAc;AACpB,MAAM,aAAa;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-mercato/shared",
|
|
3
|
-
"version": "0.6.1-develop.
|
|
3
|
+
"version": "0.6.1-develop.3246.1.dbef9d7392",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"@mikro-orm/core": "^7.0.15",
|
|
93
93
|
"@mikro-orm/decorators": "^7.0.15",
|
|
94
94
|
"@mikro-orm/postgresql": "^7.0.15",
|
|
95
|
-
"@open-mercato/cache": "0.6.1-develop.
|
|
95
|
+
"@open-mercato/cache": "0.6.1-develop.3246.1.dbef9d7392",
|
|
96
96
|
"dotenv": "^17.4.2",
|
|
97
97
|
"rate-limiter-flexible": "^11.1.0",
|
|
98
98
|
"reflect-metadata": "^0.2.2",
|
package/src/lib/openapi/crud.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z, type ZodTypeAny } from 'zod'
|
|
2
|
-
import type { OpenApiRouteDoc } from './types'
|
|
2
|
+
import type { OpenApiResponseDoc, OpenApiRouteDoc } from './types'
|
|
3
3
|
|
|
4
4
|
export const defaultCreateResponseSchema = z.object({ id: z.string().uuid().nullable() })
|
|
5
5
|
export const defaultOkResponseSchema = z.object({ ok: z.literal(true) })
|
|
@@ -34,6 +34,7 @@ type CrudDeleteConfig = {
|
|
|
34
34
|
schema?: ZodTypeAny
|
|
35
35
|
description?: string
|
|
36
36
|
responseSchema?: ZodTypeAny
|
|
37
|
+
errors?: OpenApiResponseDoc[]
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
export type CrudOpenApiOptions = {
|
|
@@ -217,6 +218,7 @@ export function createCrudOpenApiFactory(config: CrudOpenApiFactoryConfig) {
|
|
|
217
218
|
schema: del.responseSchema ?? fallbackOkResponseSchema,
|
|
218
219
|
},
|
|
219
220
|
],
|
|
221
|
+
...(del.errors && del.errors.length > 0 ? { errors: del.errors } : {}),
|
|
220
222
|
}
|
|
221
223
|
}
|
|
222
224
|
|