@adhd/apigen-plugin-health 0.2.3 → 0.2.5
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 +15 -0
- package/index.js +1 -1
- package/index.mjs +459 -103
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## 0.2.4 (2026-09-26)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- **vite-plugins:** absorb perf/test-resolve-fix — test-time @adhd/* source resolution ([3e344506](https://github.com/PseudoSky/adhd/commit/3e344506))
|
|
6
|
+
|
|
7
|
+
### 🩹 Fixes
|
|
8
|
+
|
|
9
|
+
- **vite:** restore import.meta.url in CJS output under vite 8 ([7916e639](https://github.com/PseudoSky/adhd/commit/7916e639))
|
|
10
|
+
- **nx:** finish the ESLint v9 flat-config migration and unblock the gate ([53f4ff3e](https://github.com/PseudoSky/adhd/commit/53f4ff3e))
|
|
11
|
+
|
|
12
|
+
### ❤️ Thank You
|
|
13
|
+
|
|
14
|
+
- pseudosky
|
|
15
|
+
|
|
1
16
|
## 0.2.3 (2026-09-24)
|
|
2
17
|
|
|
3
18
|
This was a version bump only for apigen-plugin-health to align it with other projects, there were no code changes.
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require("node:fs");let e=require("node:module");require("node:path");function t(e){return{raw:e,words:e.split(/(?=[A-Z])|[-_]/).map(e=>e.toLowerCase()).filter(Boolean)}}function n(e,n,r={}){let i=e.split(`/`);if(i.length<2||i.some(e=>e.length===0))throw Error(`syntheticOp: id "${e}" must be "<namespace>/<path...>" with non-empty segments`);let[a,...o]=i,s=a.replace(/^_+/,``),c=r.kind??`action`,l={id:e,host:n.host,namespace:t(s),path:o.map(t),kind:c,async:r.async??!1,streaming:r.streaming??!1,safe:r.safe??c===`query`,input:r.input??{},output:r.output??{},envelope:r.envelope??{},typeText:r.typeText??null};return r.hasCtx!==void 0&&(l.hasCtx=r.hasCtx),r.transports!==void 0&&(l.transports=r.transports),l}(0,e.createRequire)(require("node:url").pathToFileURL(__filename).href);var r={id:`date-time`,kind:`scalar`,schema:{type:`string`,format:`date-time`},matches(e){return e.type===`string`&&e.format===`date-time`},ownsValue(e){return e instanceof Date},encode(e,t,n){return e.toISOString()},decode(e,t,n){if(typeof e!=`string`){if(n.mode===`strict`)throw TypeError(`[date-time] expected a string on the wire at "${n.path}", got ${typeof e}`);return new Date(String(e))}if(n.mode===`strict`&&Number.isNaN(new Date(e).getTime()))throw TypeError(`[date-time] invalid date-time string at "${n.path}": ${JSON.stringify(e)}`);return new Date(e)}},i={id:`int64`,kind:`scalar`,schema:{type:`string`,format:`int64`},matches(e){return e.type===`string`&&e.format===`int64`},ownsValue(e){return typeof e==`bigint`},encode(e,t,n){return String(e)},decode(e,t,n){if(typeof e!=`string`){if(n.mode===`strict`)throw TypeError(`[int64] expected a string on the wire at "${n.path}", got ${typeof e}`);try{return BigInt(Math.trunc(Number(e)))}catch{return BigInt(0)}}if(n.mode===`strict`)return BigInt(e);if(/^-?\d+$/.test(e))try{return BigInt(e)}catch{return BigInt(0)}return BigInt(0)}};function a(e){return e}var o={id:`decimal`,kind:`scalar`,schema:{type:`string`,format:`decimal`},matches(e){return e.type===`string`&&e.format===`decimal`},encode(e,t,n){return e},decode(e,t,n){if(typeof e!=`string`){if(n.mode===`strict`)throw TypeError(`[decimal] expected a string on the wire at "${n.path}", got ${typeof e}`);return a(String(e))}if(n.mode===`strict`&&!/^-?\d+(\.\d+)?$/.test(e))throw TypeError(`[decimal] wire value "${e}" at "${n.path}" is not a valid decimal string`);return a(e)}},s={id:`byte`,kind:`scalar`,schema:{type:`string`,format:`byte`},matches(e){return e.type===`string`&&e.format===`byte`},ownsValue(e){return e instanceof Uint8Array},encode(e,t,n){return Buffer.from(e).toString(`base64`)},decode(e,t,n){if(typeof e!=`string`){if(n.mode===`strict`)throw TypeError(`[byte] expected a base64 string on the wire at "${n.path}", got ${typeof e}`);return new Uint8Array}if(n.mode===`strict`&&!/^[A-Za-z0-9+/]*={0,2}$/.test(e))throw TypeError(`[byte] wire value at "${n.path}" is not standard base64 (format:byte): "${e}"`);return new Uint8Array(Buffer.from(e,`base64`))}},c=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,l={id:`uuid`,kind:`scalar`,schema:{type:`string`,format:`uuid`},matches(e){return e.type===`string`&&e.format===`uuid`},encode(e,t,n){return e.toLowerCase()},decode(e,t,n){if(typeof e!=`string`){if(n.mode===`strict`)throw TypeError(`[uuid] expected a string on the wire at "${n.path}", got ${typeof e}`);return String(e).toLowerCase()}if(n.mode===`strict`&&!c.test(e))throw TypeError(`[uuid] wire value "${e}" at "${n.path}" is not a lowercase-hyphenated RFC 4122 UUID`);return e}},u=`NaN`,d=`Infinity`,f=`-Infinity`,p=new Set([u,d,f]);r.id,i.id,o.id,s.id,l.id,{id:`number-special`,kind:`scalar`,schema:{type:`number`},matches(e){return e.type===`number`&&e.format===void 0},ownsValue(e){return typeof e==`number`&&!Number.isFinite(e)},encode(e,t,n){return Number.isNaN(e)?u:e===1/0?d:e===-1/0?f:e},decode(e,t,n){if(typeof e==`number`)return e;if(typeof e==`string`){if(e===u)return NaN;if(e===d)return 1/0;if(e===f)return-1/0;let t=Number(e);if(!Number.isNaN(t))return t}if(n.mode===`strict`)throw TypeError(`[number-special] unrecognized wire value at "${n.path}": ${JSON.stringify(e)}. Expected a number or one of ${[...p].join(`, `)}.`);return NaN}}.id,Object.freeze({typescript:{"date-time":{encode:`$.toISOString()`,decode:`new Date($)`,mode:`native`},int64:{encode:`String($)`,decode:`BigInt($)`,mode:`native`},decimal:{encode:`$.toString()`,decode:`new Decimal($)`,imports:[],dep:{name:`decimal.js`,version:`^10`},mode:`branded`},byte:{encode:`Buffer.from($).toString('base64')`,decode:`new Uint8Array(Buffer.from($, 'base64'))`,mode:`native`},uuid:{encode:`$.toLowerCase()`,decode:`$`,mode:`native`},"number-special":{encode:`numToWire($)`,decode:`wireToNum($)`,mode:`native`}},python:{"date-time":{encode:`$.isoformat()`,decode:`datetime.fromisoformat($)`,imports:[`from datetime import datetime`],mode:`native`},int64:{encode:`str($)`,decode:`int($)`,mode:`native`},decimal:{encode:`str($)`,decode:`Decimal($)`,imports:[`from decimal import Decimal`],mode:`native`},byte:{encode:`b64encode($).decode()`,decode:`b64decode($)`,imports:[`from base64 import b64encode, b64decode`],mode:`native`},uuid:{encode:`str($)`,decode:`UUID($)`,imports:[`from uuid import UUID`],mode:`native`},"number-special":{encode:`num_to_wire($)`,decode:`wire_to_num($)`,mode:`native`}},rust:{"date-time":{encode:`__SCAFFOLD_RUST_DATETIME_ENCODE__`,decode:`__SCAFFOLD_RUST_DATETIME_DECODE__`,imports:[`use chrono::{DateTime, Utc};`],dep:{name:`chrono`,version:`^0.4`},mode:`lib`},int64:{encode:`__SCAFFOLD_RUST_INT64_ENCODE__`,decode:`__SCAFFOLD_RUST_INT64_DECODE__`,imports:[`use serde_with::DisplayFromStr;`],dep:{name:`serde_with`,version:`^3`},mode:`lib`},decimal:{encode:`__SCAFFOLD_RUST_DECIMAL_ENCODE__`,decode:`__SCAFFOLD_RUST_DECIMAL_DECODE__`,imports:[`use rust_decimal::Decimal;`],dep:{name:`rust_decimal`,version:`^1`},mode:`lib`},byte:{encode:`__SCAFFOLD_RUST_BYTE_ENCODE__`,decode:`__SCAFFOLD_RUST_BYTE_DECODE__`,imports:[`use serde_with::base64::Base64;`],dep:{name:`serde_with`,version:`^3`},mode:`lib`},uuid:{encode:`__SCAFFOLD_RUST_UUID_ENCODE__`,decode:`__SCAFFOLD_RUST_UUID_DECODE__`,imports:[`use uuid::Uuid;`],dep:{name:`uuid`,version:`^1`},mode:`lib`},"number-special":{encode:`__SCAFFOLD_RUST_NUMSPECIAL_ENCODE__`,decode:`__SCAFFOLD_RUST_NUMSPECIAL_DECODE__`,mode:`native`}},go:{"date-time":{encode:`__SCAFFOLD_GO_DATETIME_ENCODE__`,decode:`__SCAFFOLD_GO_DATETIME_DECODE__`,imports:[`"time"`],mode:`native`},int64:{encode:`__SCAFFOLD_GO_INT64_ENCODE__`,decode:`__SCAFFOLD_GO_INT64_DECODE__`,imports:[`"strconv"`],mode:`native`},decimal:{encode:`__SCAFFOLD_GO_DECIMAL_ENCODE__`,decode:`__SCAFFOLD_GO_DECIMAL_DECODE__`,imports:[`"github.com/shopspring/decimal"`],dep:{name:`github.com/shopspring/decimal`,version:`v1`},mode:`lib`},byte:{encode:`__SCAFFOLD_GO_BYTE_ENCODE__`,decode:`__SCAFFOLD_GO_BYTE_DECODE__`,imports:[`"encoding/base64"`],mode:`native`},uuid:{encode:`__SCAFFOLD_GO_UUID_ENCODE__`,decode:`__SCAFFOLD_GO_UUID_DECODE__`,imports:[`"github.com/google/uuid"`],dep:{name:`github.com/google/uuid`,version:`v1`},mode:`lib`},"number-special":{encode:`__SCAFFOLD_GO_NUMSPECIAL_ENCODE__`,decode:`__SCAFFOLD_GO_NUMSPECIAL_DECODE__`,mode:`native`}},java:{"date-time":{encode:`$.toString()`,decode:`Instant.parse($)`,imports:[`import java.time.Instant;`],dep:{name:`jackson-datatype-jsr310`,version:`2.x`},mode:`lib`},int64:{encode:`@JsonFormat(shape = JsonFormat.Shape.STRING)`,decode:`@JsonFormat(shape = JsonFormat.Shape.STRING)`,imports:[`import com.fasterxml.jackson.annotation.JsonFormat;`],mode:`native`},decimal:{encode:`@JsonSerialize(using = ToStringSerializer.class)`,decode:`new BigDecimal($)`,imports:[`import java.math.BigDecimal;`,`import com.fasterxml.jackson.databind.annotation.JsonSerialize;`,`import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;`],mode:`native`},byte:{encode:`$`,decode:`$`,mode:`native`},uuid:{encode:`$.toString()`,decode:`UUID.fromString($)`,imports:[`import java.util.UUID;`],mode:`native`},"number-special":{encode:`@JsonSerialize(using = NumberSpecialSerializer.class)`,decode:`@JsonDeserialize(using = NumberSpecialDeserializer.class)`,imports:[`import com.fasterxml.jackson.databind.annotation.JsonSerialize;`,`import com.fasterxml.jackson.databind.annotation.JsonDeserialize;`],mode:`native`}}});var m={"decimal.js":`Decimal`};function h(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}Object.entries(m).map(([e,t])=>({pattern:RegExp(`import\\(["'][^"']*${h(e)}[^"']*["']\\)\\.\\w+`,`g`),key:t}));function g(e,t={}){return[{...n(`_meta/health`,e,{kind:`query`,safe:!0,output:{type:`object`,required:[`status`,`host`],properties:{status:{const:`ok`},host:{type:`string`},meta:{type:`object`}}},transports:[`http`,`grpc`]}),handler:n=>{let r={status:`ok`,host:e.host};return t.meta!==void 0&&Object.keys(t.meta).length>0&&(r.meta=t.meta),r}}]}var _={id:`health`,description:`Mount plugin: exposes GET /meta/health for gateway readiness (SPEC §13.1)`,language:`ts`,optionsSchema:{type:`object`,properties:{meta:{type:`object`,description:`Extra metadata included in the health response`}},additionalProperties:!1},capabilities:{mount:{operations(e,t){return g(e,t)}}}};exports.default=_,exports.healthPlugin=_;
|
package/index.mjs
CHANGED
|
@@ -1,112 +1,468 @@
|
|
|
1
1
|
import "node:fs";
|
|
2
|
-
import { createRequire as
|
|
2
|
+
import { createRequire as e } from "node:module";
|
|
3
3
|
import "node:path";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
//#region ../apigen-core-client/src/lib/plugin.ts
|
|
5
|
+
function t(e) {
|
|
6
|
+
return {
|
|
7
|
+
raw: e,
|
|
8
|
+
words: e.split(/(?=[A-Z])|[-_]/).map((e) => e.toLowerCase()).filter(Boolean)
|
|
9
|
+
};
|
|
9
10
|
}
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
typeText: e.typeText ?? null
|
|
29
|
-
};
|
|
30
|
-
return e.hasCtx !== void 0 && (n.hasCtx = e.hasCtx), e.transports !== void 0 && (n.transports = e.transports), n;
|
|
11
|
+
function n(e, n, r = {}) {
|
|
12
|
+
let i = e.split("/");
|
|
13
|
+
if (i.length < 2 || i.some((e) => e.length === 0)) throw Error(`syntheticOp: id "${e}" must be "<namespace>/<path...>" with non-empty segments`);
|
|
14
|
+
let [a, ...o] = i, s = a.replace(/^_+/, ""), c = r.kind ?? "action", l = {
|
|
15
|
+
id: e,
|
|
16
|
+
host: n.host,
|
|
17
|
+
namespace: t(s),
|
|
18
|
+
path: o.map(t),
|
|
19
|
+
kind: c,
|
|
20
|
+
async: r.async ?? !1,
|
|
21
|
+
streaming: r.streaming ?? !1,
|
|
22
|
+
safe: r.safe ?? c === "query",
|
|
23
|
+
input: r.input ?? {},
|
|
24
|
+
output: r.output ?? {},
|
|
25
|
+
envelope: r.envelope ?? {},
|
|
26
|
+
typeText: r.typeText ?? null
|
|
27
|
+
};
|
|
28
|
+
return r.hasCtx !== void 0 && (l.hasCtx = r.hasCtx), r.transports !== void 0 && (l.transports = r.transports), l;
|
|
31
29
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
e(import.meta.url);
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region ../apigen-base-logical/src/lib/codecs/date-time.ts
|
|
33
|
+
var r = {
|
|
34
|
+
id: "date-time",
|
|
35
|
+
kind: "scalar",
|
|
36
|
+
schema: {
|
|
37
|
+
type: "string",
|
|
38
|
+
format: "date-time"
|
|
39
|
+
},
|
|
40
|
+
matches(e) {
|
|
41
|
+
return e.type === "string" && e.format === "date-time";
|
|
42
|
+
},
|
|
43
|
+
ownsValue(e) {
|
|
44
|
+
return e instanceof Date;
|
|
45
|
+
},
|
|
46
|
+
encode(e, t, n) {
|
|
47
|
+
return e.toISOString();
|
|
48
|
+
},
|
|
49
|
+
decode(e, t, n) {
|
|
50
|
+
if (typeof e != "string") {
|
|
51
|
+
if (n.mode === "strict") throw TypeError(`[date-time] expected a string on the wire at "${n.path}", got ${typeof e}`);
|
|
52
|
+
return new Date(String(e));
|
|
53
|
+
}
|
|
54
|
+
if (n.mode === "strict" && Number.isNaN(new Date(e).getTime())) throw TypeError(`[date-time] invalid date-time string at "${n.path}": ${JSON.stringify(e)}`);
|
|
55
|
+
return new Date(e);
|
|
56
|
+
}
|
|
57
|
+
}, i = {
|
|
58
|
+
id: "int64",
|
|
59
|
+
kind: "scalar",
|
|
60
|
+
schema: {
|
|
61
|
+
type: "string",
|
|
62
|
+
format: "int64"
|
|
63
|
+
},
|
|
64
|
+
matches(e) {
|
|
65
|
+
return e.type === "string" && e.format === "int64";
|
|
66
|
+
},
|
|
67
|
+
ownsValue(e) {
|
|
68
|
+
return typeof e == "bigint";
|
|
69
|
+
},
|
|
70
|
+
encode(e, t, n) {
|
|
71
|
+
return String(e);
|
|
72
|
+
},
|
|
73
|
+
decode(e, t, n) {
|
|
74
|
+
if (typeof e != "string") {
|
|
75
|
+
if (n.mode === "strict") throw TypeError(`[int64] expected a string on the wire at "${n.path}", got ${typeof e}`);
|
|
76
|
+
try {
|
|
77
|
+
return BigInt(Math.trunc(Number(e)));
|
|
78
|
+
} catch {
|
|
79
|
+
return BigInt(0);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (n.mode === "strict") return BigInt(e);
|
|
83
|
+
if (/^-?\d+$/.test(e)) try {
|
|
84
|
+
return BigInt(e);
|
|
85
|
+
} catch {
|
|
86
|
+
return BigInt(0);
|
|
87
|
+
}
|
|
88
|
+
return BigInt(0);
|
|
89
|
+
}
|
|
35
90
|
};
|
|
36
|
-
|
|
37
|
-
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region ../apigen-base-logical/src/lib/codecs/decimal.ts
|
|
93
|
+
function a(e) {
|
|
94
|
+
return e;
|
|
38
95
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
96
|
+
var o = {
|
|
97
|
+
id: "decimal",
|
|
98
|
+
kind: "scalar",
|
|
99
|
+
schema: {
|
|
100
|
+
type: "string",
|
|
101
|
+
format: "decimal"
|
|
102
|
+
},
|
|
103
|
+
matches(e) {
|
|
104
|
+
return e.type === "string" && e.format === "decimal";
|
|
105
|
+
},
|
|
106
|
+
encode(e, t, n) {
|
|
107
|
+
return e;
|
|
108
|
+
},
|
|
109
|
+
decode(e, t, n) {
|
|
110
|
+
if (typeof e != "string") {
|
|
111
|
+
if (n.mode === "strict") throw TypeError(`[decimal] expected a string on the wire at "${n.path}", got ${typeof e}`);
|
|
112
|
+
return a(String(e));
|
|
113
|
+
}
|
|
114
|
+
if (n.mode === "strict" && !/^-?\d+(\.\d+)?$/.test(e)) throw TypeError(`[decimal] wire value "${e}" at "${n.path}" is not a valid decimal string`);
|
|
115
|
+
return a(e);
|
|
116
|
+
}
|
|
117
|
+
}, s = {
|
|
118
|
+
id: "byte",
|
|
119
|
+
kind: "scalar",
|
|
120
|
+
schema: {
|
|
121
|
+
type: "string",
|
|
122
|
+
format: "byte"
|
|
123
|
+
},
|
|
124
|
+
matches(e) {
|
|
125
|
+
return e.type === "string" && e.format === "byte";
|
|
126
|
+
},
|
|
127
|
+
ownsValue(e) {
|
|
128
|
+
return e instanceof Uint8Array;
|
|
129
|
+
},
|
|
130
|
+
encode(e, t, n) {
|
|
131
|
+
return Buffer.from(e).toString("base64");
|
|
132
|
+
},
|
|
133
|
+
decode(e, t, n) {
|
|
134
|
+
if (typeof e != "string") {
|
|
135
|
+
if (n.mode === "strict") throw TypeError(`[byte] expected a base64 string on the wire at "${n.path}", got ${typeof e}`);
|
|
136
|
+
return /* @__PURE__ */ new Uint8Array();
|
|
137
|
+
}
|
|
138
|
+
if (n.mode === "strict" && !/^[A-Za-z0-9+/]*={0,2}$/.test(e)) throw TypeError(`[byte] wire value at "${n.path}" is not standard base64 (format:byte): "${e}"`);
|
|
139
|
+
return new Uint8Array(Buffer.from(e, "base64"));
|
|
140
|
+
}
|
|
141
|
+
}, c = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/, l = {
|
|
142
|
+
id: "uuid",
|
|
143
|
+
kind: "scalar",
|
|
144
|
+
schema: {
|
|
145
|
+
type: "string",
|
|
146
|
+
format: "uuid"
|
|
147
|
+
},
|
|
148
|
+
matches(e) {
|
|
149
|
+
return e.type === "string" && e.format === "uuid";
|
|
150
|
+
},
|
|
151
|
+
encode(e, t, n) {
|
|
152
|
+
return e.toLowerCase();
|
|
153
|
+
},
|
|
154
|
+
decode(e, t, n) {
|
|
155
|
+
if (typeof e != "string") {
|
|
156
|
+
if (n.mode === "strict") throw TypeError(`[uuid] expected a string on the wire at "${n.path}", got ${typeof e}`);
|
|
157
|
+
return String(e).toLowerCase();
|
|
158
|
+
}
|
|
159
|
+
if (n.mode === "strict" && !c.test(e)) throw TypeError(`[uuid] wire value "${e}" at "${n.path}" is not a lowercase-hyphenated RFC 4122 UUID`);
|
|
160
|
+
return e;
|
|
161
|
+
}
|
|
162
|
+
}, u = "NaN", d = "Infinity", f = "-Infinity", p = /* @__PURE__ */ new Set([
|
|
163
|
+
u,
|
|
164
|
+
d,
|
|
165
|
+
f
|
|
166
|
+
]);
|
|
167
|
+
r.id, i.id, o.id, s.id, l.id, {
|
|
168
|
+
id: "number-special",
|
|
169
|
+
kind: "scalar",
|
|
170
|
+
schema: { type: "number" },
|
|
171
|
+
matches(e) {
|
|
172
|
+
return e.type === "number" && e.format === void 0;
|
|
173
|
+
},
|
|
174
|
+
ownsValue(e) {
|
|
175
|
+
return typeof e == "number" && !Number.isFinite(e);
|
|
176
|
+
},
|
|
177
|
+
encode(e, t, n) {
|
|
178
|
+
return Number.isNaN(e) ? u : e === Infinity ? d : e === -Infinity ? f : e;
|
|
179
|
+
},
|
|
180
|
+
decode(e, t, n) {
|
|
181
|
+
if (typeof e == "number") return e;
|
|
182
|
+
if (typeof e == "string") {
|
|
183
|
+
if (e === u) return NaN;
|
|
184
|
+
if (e === d) return Infinity;
|
|
185
|
+
if (e === f) return -Infinity;
|
|
186
|
+
let t = Number(e);
|
|
187
|
+
if (!Number.isNaN(t)) return t;
|
|
188
|
+
}
|
|
189
|
+
if (n.mode === "strict") throw TypeError(`[number-special] unrecognized wire value at "${n.path}": ${JSON.stringify(e)}. Expected a number or one of ${[...p].join(", ")}.`);
|
|
190
|
+
return NaN;
|
|
191
|
+
}
|
|
192
|
+
}.id, Object.freeze({
|
|
193
|
+
typescript: {
|
|
194
|
+
"date-time": {
|
|
195
|
+
encode: "$.toISOString()",
|
|
196
|
+
decode: "new Date($)",
|
|
197
|
+
mode: "native"
|
|
198
|
+
},
|
|
199
|
+
int64: {
|
|
200
|
+
encode: "String($)",
|
|
201
|
+
decode: "BigInt($)",
|
|
202
|
+
mode: "native"
|
|
203
|
+
},
|
|
204
|
+
decimal: {
|
|
205
|
+
encode: "$.toString()",
|
|
206
|
+
decode: "new Decimal($)",
|
|
207
|
+
imports: [],
|
|
208
|
+
dep: {
|
|
209
|
+
name: "decimal.js",
|
|
210
|
+
version: "^10"
|
|
211
|
+
},
|
|
212
|
+
mode: "branded"
|
|
213
|
+
},
|
|
214
|
+
byte: {
|
|
215
|
+
encode: "Buffer.from($).toString('base64')",
|
|
216
|
+
decode: "new Uint8Array(Buffer.from($, 'base64'))",
|
|
217
|
+
mode: "native"
|
|
218
|
+
},
|
|
219
|
+
uuid: {
|
|
220
|
+
encode: "$.toLowerCase()",
|
|
221
|
+
decode: "$",
|
|
222
|
+
mode: "native"
|
|
223
|
+
},
|
|
224
|
+
"number-special": {
|
|
225
|
+
encode: "numToWire($)",
|
|
226
|
+
decode: "wireToNum($)",
|
|
227
|
+
mode: "native"
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
python: {
|
|
231
|
+
"date-time": {
|
|
232
|
+
encode: "$.isoformat()",
|
|
233
|
+
decode: "datetime.fromisoformat($)",
|
|
234
|
+
imports: ["from datetime import datetime"],
|
|
235
|
+
mode: "native"
|
|
236
|
+
},
|
|
237
|
+
int64: {
|
|
238
|
+
encode: "str($)",
|
|
239
|
+
decode: "int($)",
|
|
240
|
+
mode: "native"
|
|
241
|
+
},
|
|
242
|
+
decimal: {
|
|
243
|
+
encode: "str($)",
|
|
244
|
+
decode: "Decimal($)",
|
|
245
|
+
imports: ["from decimal import Decimal"],
|
|
246
|
+
mode: "native"
|
|
247
|
+
},
|
|
248
|
+
byte: {
|
|
249
|
+
encode: "b64encode($).decode()",
|
|
250
|
+
decode: "b64decode($)",
|
|
251
|
+
imports: ["from base64 import b64encode, b64decode"],
|
|
252
|
+
mode: "native"
|
|
253
|
+
},
|
|
254
|
+
uuid: {
|
|
255
|
+
encode: "str($)",
|
|
256
|
+
decode: "UUID($)",
|
|
257
|
+
imports: ["from uuid import UUID"],
|
|
258
|
+
mode: "native"
|
|
259
|
+
},
|
|
260
|
+
"number-special": {
|
|
261
|
+
encode: "num_to_wire($)",
|
|
262
|
+
decode: "wire_to_num($)",
|
|
263
|
+
mode: "native"
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
rust: {
|
|
267
|
+
"date-time": {
|
|
268
|
+
encode: "__SCAFFOLD_RUST_DATETIME_ENCODE__",
|
|
269
|
+
decode: "__SCAFFOLD_RUST_DATETIME_DECODE__",
|
|
270
|
+
imports: ["use chrono::{DateTime, Utc};"],
|
|
271
|
+
dep: {
|
|
272
|
+
name: "chrono",
|
|
273
|
+
version: "^0.4"
|
|
274
|
+
},
|
|
275
|
+
mode: "lib"
|
|
276
|
+
},
|
|
277
|
+
int64: {
|
|
278
|
+
encode: "__SCAFFOLD_RUST_INT64_ENCODE__",
|
|
279
|
+
decode: "__SCAFFOLD_RUST_INT64_DECODE__",
|
|
280
|
+
imports: ["use serde_with::DisplayFromStr;"],
|
|
281
|
+
dep: {
|
|
282
|
+
name: "serde_with",
|
|
283
|
+
version: "^3"
|
|
284
|
+
},
|
|
285
|
+
mode: "lib"
|
|
286
|
+
},
|
|
287
|
+
decimal: {
|
|
288
|
+
encode: "__SCAFFOLD_RUST_DECIMAL_ENCODE__",
|
|
289
|
+
decode: "__SCAFFOLD_RUST_DECIMAL_DECODE__",
|
|
290
|
+
imports: ["use rust_decimal::Decimal;"],
|
|
291
|
+
dep: {
|
|
292
|
+
name: "rust_decimal",
|
|
293
|
+
version: "^1"
|
|
294
|
+
},
|
|
295
|
+
mode: "lib"
|
|
296
|
+
},
|
|
297
|
+
byte: {
|
|
298
|
+
encode: "__SCAFFOLD_RUST_BYTE_ENCODE__",
|
|
299
|
+
decode: "__SCAFFOLD_RUST_BYTE_DECODE__",
|
|
300
|
+
imports: ["use serde_with::base64::Base64;"],
|
|
301
|
+
dep: {
|
|
302
|
+
name: "serde_with",
|
|
303
|
+
version: "^3"
|
|
304
|
+
},
|
|
305
|
+
mode: "lib"
|
|
306
|
+
},
|
|
307
|
+
uuid: {
|
|
308
|
+
encode: "__SCAFFOLD_RUST_UUID_ENCODE__",
|
|
309
|
+
decode: "__SCAFFOLD_RUST_UUID_DECODE__",
|
|
310
|
+
imports: ["use uuid::Uuid;"],
|
|
311
|
+
dep: {
|
|
312
|
+
name: "uuid",
|
|
313
|
+
version: "^1"
|
|
314
|
+
},
|
|
315
|
+
mode: "lib"
|
|
316
|
+
},
|
|
317
|
+
"number-special": {
|
|
318
|
+
encode: "__SCAFFOLD_RUST_NUMSPECIAL_ENCODE__",
|
|
319
|
+
decode: "__SCAFFOLD_RUST_NUMSPECIAL_DECODE__",
|
|
320
|
+
mode: "native"
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
go: {
|
|
324
|
+
"date-time": {
|
|
325
|
+
encode: "__SCAFFOLD_GO_DATETIME_ENCODE__",
|
|
326
|
+
decode: "__SCAFFOLD_GO_DATETIME_DECODE__",
|
|
327
|
+
imports: ["\"time\""],
|
|
328
|
+
mode: "native"
|
|
329
|
+
},
|
|
330
|
+
int64: {
|
|
331
|
+
encode: "__SCAFFOLD_GO_INT64_ENCODE__",
|
|
332
|
+
decode: "__SCAFFOLD_GO_INT64_DECODE__",
|
|
333
|
+
imports: ["\"strconv\""],
|
|
334
|
+
mode: "native"
|
|
335
|
+
},
|
|
336
|
+
decimal: {
|
|
337
|
+
encode: "__SCAFFOLD_GO_DECIMAL_ENCODE__",
|
|
338
|
+
decode: "__SCAFFOLD_GO_DECIMAL_DECODE__",
|
|
339
|
+
imports: ["\"github.com/shopspring/decimal\""],
|
|
340
|
+
dep: {
|
|
341
|
+
name: "github.com/shopspring/decimal",
|
|
342
|
+
version: "v1"
|
|
343
|
+
},
|
|
344
|
+
mode: "lib"
|
|
345
|
+
},
|
|
346
|
+
byte: {
|
|
347
|
+
encode: "__SCAFFOLD_GO_BYTE_ENCODE__",
|
|
348
|
+
decode: "__SCAFFOLD_GO_BYTE_DECODE__",
|
|
349
|
+
imports: ["\"encoding/base64\""],
|
|
350
|
+
mode: "native"
|
|
351
|
+
},
|
|
352
|
+
uuid: {
|
|
353
|
+
encode: "__SCAFFOLD_GO_UUID_ENCODE__",
|
|
354
|
+
decode: "__SCAFFOLD_GO_UUID_DECODE__",
|
|
355
|
+
imports: ["\"github.com/google/uuid\""],
|
|
356
|
+
dep: {
|
|
357
|
+
name: "github.com/google/uuid",
|
|
358
|
+
version: "v1"
|
|
359
|
+
},
|
|
360
|
+
mode: "lib"
|
|
361
|
+
},
|
|
362
|
+
"number-special": {
|
|
363
|
+
encode: "__SCAFFOLD_GO_NUMSPECIAL_ENCODE__",
|
|
364
|
+
decode: "__SCAFFOLD_GO_NUMSPECIAL_DECODE__",
|
|
365
|
+
mode: "native"
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
java: {
|
|
369
|
+
"date-time": {
|
|
370
|
+
encode: "$.toString()",
|
|
371
|
+
decode: "Instant.parse($)",
|
|
372
|
+
imports: ["import java.time.Instant;"],
|
|
373
|
+
dep: {
|
|
374
|
+
name: "jackson-datatype-jsr310",
|
|
375
|
+
version: "2.x"
|
|
376
|
+
},
|
|
377
|
+
mode: "lib"
|
|
378
|
+
},
|
|
379
|
+
int64: {
|
|
380
|
+
encode: "@JsonFormat(shape = JsonFormat.Shape.STRING)",
|
|
381
|
+
decode: "@JsonFormat(shape = JsonFormat.Shape.STRING)",
|
|
382
|
+
imports: ["import com.fasterxml.jackson.annotation.JsonFormat;"],
|
|
383
|
+
mode: "native"
|
|
384
|
+
},
|
|
385
|
+
decimal: {
|
|
386
|
+
encode: "@JsonSerialize(using = ToStringSerializer.class)",
|
|
387
|
+
decode: "new BigDecimal($)",
|
|
388
|
+
imports: [
|
|
389
|
+
"import java.math.BigDecimal;",
|
|
390
|
+
"import com.fasterxml.jackson.databind.annotation.JsonSerialize;",
|
|
391
|
+
"import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;"
|
|
392
|
+
],
|
|
393
|
+
mode: "native"
|
|
394
|
+
},
|
|
395
|
+
byte: {
|
|
396
|
+
encode: "$",
|
|
397
|
+
decode: "$",
|
|
398
|
+
mode: "native"
|
|
399
|
+
},
|
|
400
|
+
uuid: {
|
|
401
|
+
encode: "$.toString()",
|
|
402
|
+
decode: "UUID.fromString($)",
|
|
403
|
+
imports: ["import java.util.UUID;"],
|
|
404
|
+
mode: "native"
|
|
405
|
+
},
|
|
406
|
+
"number-special": {
|
|
407
|
+
encode: "@JsonSerialize(using = NumberSpecialSerializer.class)",
|
|
408
|
+
decode: "@JsonDeserialize(using = NumberSpecialDeserializer.class)",
|
|
409
|
+
imports: ["import com.fasterxml.jackson.databind.annotation.JsonSerialize;", "import com.fasterxml.jackson.databind.annotation.JsonDeserialize;"],
|
|
410
|
+
mode: "native"
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
//#endregion
|
|
415
|
+
//#region ../apigen-core-client/src/lib/schema-builders/ts-json-schema.ts
|
|
416
|
+
var m = { "decimal.js": "Decimal" };
|
|
417
|
+
function h(e) {
|
|
418
|
+
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
419
|
+
}
|
|
420
|
+
Object.entries(m).map(([e, t]) => ({
|
|
421
|
+
pattern: RegExp(`import\\(["'][^"']*${h(e)}[^"']*["']\\)\\.\\w+`, "g"),
|
|
422
|
+
key: t
|
|
51
423
|
}));
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
};
|
|
79
|
-
return a.meta !== void 0 && Object.keys(a.meta).length > 0 && (s.meta = a.meta), s;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
];
|
|
424
|
+
//#endregion
|
|
425
|
+
//#region src/lib/plugin.ts
|
|
426
|
+
function g(e, t = {}) {
|
|
427
|
+
return [{
|
|
428
|
+
...n("_meta/health", e, {
|
|
429
|
+
kind: "query",
|
|
430
|
+
safe: !0,
|
|
431
|
+
output: {
|
|
432
|
+
type: "object",
|
|
433
|
+
required: ["status", "host"],
|
|
434
|
+
properties: {
|
|
435
|
+
status: { const: "ok" },
|
|
436
|
+
host: { type: "string" },
|
|
437
|
+
meta: { type: "object" }
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
transports: ["http", "grpc"]
|
|
441
|
+
}),
|
|
442
|
+
handler: (n) => {
|
|
443
|
+
let r = {
|
|
444
|
+
status: "ok",
|
|
445
|
+
host: e.host
|
|
446
|
+
};
|
|
447
|
+
return t.meta !== void 0 && Object.keys(t.meta).length > 0 && (r.meta = t.meta), r;
|
|
448
|
+
}
|
|
449
|
+
}];
|
|
83
450
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
mount: {
|
|
100
|
-
operations(t, a) {
|
|
101
|
-
return g(
|
|
102
|
-
t,
|
|
103
|
-
a
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
export {
|
|
110
|
-
w as default,
|
|
111
|
-
w as healthPlugin
|
|
451
|
+
var _ = {
|
|
452
|
+
id: "health",
|
|
453
|
+
description: "Mount plugin: exposes GET /meta/health for gateway readiness (SPEC §13.1)",
|
|
454
|
+
language: "ts",
|
|
455
|
+
optionsSchema: {
|
|
456
|
+
type: "object",
|
|
457
|
+
properties: { meta: {
|
|
458
|
+
type: "object",
|
|
459
|
+
description: "Extra metadata included in the health response"
|
|
460
|
+
} },
|
|
461
|
+
additionalProperties: !1
|
|
462
|
+
},
|
|
463
|
+
capabilities: { mount: { operations(e, t) {
|
|
464
|
+
return g(e, t);
|
|
465
|
+
} } }
|
|
112
466
|
};
|
|
467
|
+
//#endregion
|
|
468
|
+
export { _ as default, _ as healthPlugin };
|
package/package.json
CHANGED