@zeroxsolutions/response 0.14.3 → 0.14.4
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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## 0.14.4 (2026-10-06)
|
|
2
|
+
|
|
3
|
+
### 🩹 Fixes
|
|
4
|
+
|
|
5
|
+
- **response:** publish the link and error document as components ([645a8a6](https://github.com/zeroxsolutions/zeroxsolutions/commit/645a8a6))
|
|
6
|
+
|
|
7
|
+
### ❤️ Thank You
|
|
8
|
+
|
|
9
|
+
- Claude Opus 5.5
|
|
10
|
+
- Lương Văn Tú
|
|
11
|
+
|
|
1
12
|
## 0.14.3 (2026-09-30)
|
|
2
13
|
|
|
3
14
|
### 🚀 Features
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-document.d.ts","sourceRoot":"","sources":["../../src/errors/error-document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,sFAAsF;AACtF,eAAO,MAAM,iBAAiB;;;;iBAMlB,CAAC;AACb,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,qGAAqG;AACrG,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA8D,CAAC;AAC5F,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,6FAA6F;AAC7F,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAYoF,CAAC;AACnH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"error-document.d.ts","sourceRoot":"","sources":["../../src/errors/error-document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,sFAAsF;AACtF,eAAO,MAAM,iBAAiB;;;;iBAMlB,CAAC;AACb,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,qGAAqG;AACrG,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA8D,CAAC;AAC5F,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,6FAA6F;AAC7F,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAYoF,CAAC;AACnH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAQA,CAAC;AACjC,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -33,9 +33,12 @@ export const errorObjectSchema = z
|
|
|
33
33
|
* Nothing here renders the top-level `meta` or `links`. They are declared so the schema `errorResponse` publishes is
|
|
34
34
|
* the whole document, and a client parsing another server's document keeps them.
|
|
35
35
|
*/
|
|
36
|
-
export const errorDocumentSchema = z
|
|
36
|
+
export const errorDocumentSchema = z
|
|
37
|
+
.strictObject({
|
|
37
38
|
errors: z.array(errorObjectSchema).min(1),
|
|
38
39
|
meta: metaSchema.optional(),
|
|
39
40
|
links: z.object({ self: linkSchema, describedby: linkSchema }).partial().optional(),
|
|
40
41
|
jsonapi: jsonApiObjectSchema.optional(),
|
|
41
|
-
})
|
|
42
|
+
})
|
|
43
|
+
// Every failure status of every route answers this document, so it is published once, as a component.
|
|
44
|
+
.meta({ id: 'ErrorDocument' });
|
package/dist/primitives.d.ts
CHANGED
|
@@ -3,7 +3,12 @@ import { z } from 'zod';
|
|
|
3
3
|
export declare const metaSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
4
4
|
/** A free-form `meta` member - inferred from {@link metaSchema}. */
|
|
5
5
|
export type Meta = z.infer<typeof metaSchema>;
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* A JSON:API link - a URI-reference, a link object, or `null` where the link does not exist.
|
|
8
|
+
*
|
|
9
|
+
* Published as the component `Link`. Inlined, it was 87% of the schema nodes in a gateway's OpenAPI document, and
|
|
10
|
+
* building that document took seconds.
|
|
11
|
+
*/
|
|
7
12
|
export declare const linkSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
8
13
|
rel: z.ZodOptional<z.ZodString>;
|
|
9
14
|
title: z.ZodOptional<z.ZodString>;
|
package/dist/primitives.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../src/primitives.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,8DAA8D;AAC9D,eAAO,MAAM,UAAU,wCAAoC,CAAC;AAC5D,oEAAoE;AACpE,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAsB9C
|
|
1
|
+
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../src/primitives.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,C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;;;;;;;;;;;;;;;;;;;;;;;;iBAKlC,CAAC;AACH,8EAA8E;AAC9E,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,iGAAiG;AACjG,eAAO,MAAM,wBAAwB;;;iBAAiD,CAAC;AACvF,0FAA0F;AAC1F,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,uHAAuH;AACvH,eAAO,MAAM,mBAAmB;;;;;iBAK9B,CAAC;AACH,kFAAkF;AAClF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
package/dist/primitives.js
CHANGED
|
@@ -19,12 +19,19 @@ const linkTarget = {
|
|
|
19
19
|
* (@hono/zod-openapi@1.4.0) - so the cycle stops at one level, which is every document anyone writes.
|
|
20
20
|
*/
|
|
21
21
|
const describedbySchema = z.union([z.string(), z.object({ href: z.string(), ...linkTarget }), z.null()]);
|
|
22
|
-
/**
|
|
23
|
-
|
|
22
|
+
/**
|
|
23
|
+
* A JSON:API link - a URI-reference, a link object, or `null` where the link does not exist.
|
|
24
|
+
*
|
|
25
|
+
* Published as the component `Link`. Inlined, it was 87% of the schema nodes in a gateway's OpenAPI document, and
|
|
26
|
+
* building that document took seconds.
|
|
27
|
+
*/
|
|
28
|
+
export const linkSchema = z
|
|
29
|
+
.union([
|
|
24
30
|
z.string(),
|
|
25
31
|
z.object({ href: z.string(), describedby: describedbySchema.optional(), ...linkTarget }),
|
|
26
32
|
z.null(),
|
|
27
|
-
])
|
|
33
|
+
])
|
|
34
|
+
.meta({ id: 'Link' });
|
|
28
35
|
/** The `self`/`related` pair a resource object and a relationship both carry. */
|
|
29
36
|
export const resourceLinksSchema = z.object({
|
|
30
37
|
self: linkSchema.optional(),
|