@adhd/apigen-plugin-health 0.2.0 → 0.2.1

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,7 @@
1
+ ## 0.2.1 (2026-07-28)
2
+
3
+ This was a version bump only for apigen-plugin-health to align it with other projects, there were no code changes.
4
+
1
5
  ## 0.1.7 (2026-07-25)
2
6
 
3
7
 
package/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function s(e){return{raw:e,words:[e]}}function o(e,t={}){return[{id:"_meta/health",host:e.host,namespace:s("meta"),path:[s("health")],kind:"query",async:!1,streaming:!1,safe:!0,input:{},output:{type:"object",required:["status","host"],properties:{status:{const:"ok"},host:{type:"string"},meta:{type:"object"}}},envelope:{},typeText:null,transports:["http","grpc"],handler:i=>{const a={status:"ok",host:e.host};return t.meta!==void 0&&Object.keys(t.meta).length>0&&(a.meta=t.meta),a}}]}const n={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 o(e,t)}}}};exports.default=n;exports.healthPlugin=n;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("ts-morph");require("node:fs");require("node:path");require("ts-json-schema-generator");function i(e){return{raw:e,words:e.split(/(?=[A-Z])|[-_]/).map(a=>a.toLowerCase()).filter(Boolean)}}function h(e,a,t={}){const s=e.split("/");if(s.length<2||s.some(c=>c.length===0))throw new Error(`syntheticOp: id "${e}" must be "<namespace>/<path...>" with non-empty segments`);const[p,...u]=s,l=p.replace(/^_+/,""),o=t.kind??"action",r={id:e,host:a.host,namespace:i(l),path:u.map(i),kind:o,async:t.async??!1,streaming:t.streaming??!1,safe:t.safe??o==="query",input:t.input??{},output:t.output??{},envelope:t.envelope??{},typeText:t.typeText??null};return t.hasCtx!==void 0&&(r.hasCtx=t.hasCtx),t.transports!==void 0&&(r.transports=t.transports),r}const m={"decimal.js":"Decimal"};function d(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}Object.entries(m).map(([e,a])=>({pattern:new RegExp(`import\\(["'][^"']*${d(e)}[^"']*["']\\)\\.\\w+`,"g"),key:a}));function g(e,a={}){return[{...h("_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:t=>{const s={status:"ok",host:e.host};return a.meta!==void 0&&Object.keys(a.meta).length>0&&(s.meta=a.meta),s}}]}const n={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,a){return g(e,a)}}}};exports.default=n;exports.healthPlugin=n;
package/index.mjs CHANGED
@@ -1,48 +1,87 @@
1
- function s(t) {
2
- return { raw: t, words: [t] };
1
+ import "ts-morph";
2
+ import "node:fs";
3
+ import "node:path";
4
+ import "ts-json-schema-generator";
5
+ function n(t) {
6
+ return {
7
+ raw: t,
8
+ words: t.split(/(?=[A-Z])|[-_]/).map((a) => a.toLowerCase()).filter(Boolean)
9
+ };
3
10
  }
4
- function n(t, e = {}) {
11
+ function c(t, a, e = {}) {
12
+ const s = t.split("/");
13
+ if (s.length < 2 || s.some((u) => u.length === 0))
14
+ throw new Error(
15
+ `syntheticOp: id "${t}" must be "<namespace>/<path...>" with non-empty segments`
16
+ );
17
+ const [i, ...p] = s, l = i.replace(/^_+/, ""), r = e.kind ?? "action", o = {
18
+ id: t,
19
+ host: a.host,
20
+ namespace: n(l),
21
+ path: p.map(n),
22
+ kind: r,
23
+ async: e.async ?? !1,
24
+ streaming: e.streaming ?? !1,
25
+ safe: e.safe ?? r === "query",
26
+ input: e.input ?? {},
27
+ output: e.output ?? {},
28
+ envelope: e.envelope ?? {},
29
+ typeText: e.typeText ?? null
30
+ };
31
+ return e.hasCtx !== void 0 && (o.hasCtx = e.hasCtx), e.transports !== void 0 && (o.transports = e.transports), o;
32
+ }
33
+ const h = {
34
+ "decimal.js": "Decimal"
35
+ };
36
+ function m(t) {
37
+ return t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
38
+ }
39
+ Object.entries(h).map(([t, a]) => ({
40
+ // Matches: import("...{modSpec}...").<anyMemberName> (single or double quotes)
41
+ // The module specifier appears inside an absolute path, so we allow any
42
+ // characters between the quote and the specifier, and between the specifier
43
+ // and the closing quote. The trailing member accessor (`.default`, `.Decimal`,
44
+ // …) is matched generically (`\w+`) rather than anchored to one spelling —
45
+ // see the doc comment above for why.
46
+ pattern: new RegExp(
47
+ `import\\(["'][^"']*${m(t)}[^"']*["']\\)\\.\\w+`,
48
+ "g"
49
+ ),
50
+ key: a
51
+ }));
52
+ function d(t, a = {}) {
5
53
  return [
6
54
  {
7
- // Canonical id — `_meta` prefix convention for meta-endpoints.
8
- id: "_meta/health",
9
- host: t.host,
10
- namespace: s("meta"),
11
- path: [s("health")],
12
- // query + safe → GET /meta/health; gRPC also useful for load-balancer probes.
13
- kind: "query",
14
- async: !1,
15
- streaming: !1,
16
- safe: !0,
17
- // Input: no domain params.
18
- input: {},
19
- // Output: the HealthResponse shape (inlined for zero extra dependencies).
20
- output: {
21
- type: "object",
22
- required: ["status", "host"],
23
- properties: {
24
- status: { const: "ok" },
25
- host: { type: "string" },
26
- meta: { type: "object" }
27
- }
28
- },
29
- envelope: {},
30
- typeText: null,
31
- // Expose on HTTP and gRPC — useful for both HTTP health checks and
32
- // gRPC-native load-balancer probes (SPEC §7.2c / §13.1).
33
- transports: ["http", "grpc"],
55
+ ...c("_meta/health", t, {
56
+ // query + safe → GET /meta/health; gRPC also useful for load-balancer probes.
57
+ kind: "query",
58
+ safe: !0,
59
+ // Output: the HealthResponse shape (inlined for zero extra dependencies).
60
+ output: {
61
+ type: "object",
62
+ required: ["status", "host"],
63
+ properties: {
64
+ status: { const: "ok" },
65
+ host: { type: "string" },
66
+ meta: { type: "object" }
67
+ }
68
+ },
69
+ // Expose on HTTP and gRPC — useful for both HTTP health checks and
70
+ // gRPC-native load-balancer probes (SPEC §7.2c / §13.1).
71
+ transports: ["http", "grpc"]
72
+ }),
34
73
  // Handler: always returns ready when the runtime can answer.
35
- handler: (o) => {
36
- const a = {
74
+ handler: (e) => {
75
+ const s = {
37
76
  status: "ok",
38
77
  host: t.host
39
78
  };
40
- return e.meta !== void 0 && Object.keys(e.meta).length > 0 && (a.meta = e.meta), a;
79
+ return a.meta !== void 0 && Object.keys(a.meta).length > 0 && (s.meta = a.meta), s;
41
80
  }
42
81
  }
43
82
  ];
44
83
  }
45
- const r = {
84
+ const b = {
46
85
  id: "health",
47
86
  description: "Mount plugin: exposes GET /meta/health for gateway readiness (SPEC §13.1)",
48
87
  language: "ts",
@@ -58,16 +97,16 @@ const r = {
58
97
  },
59
98
  capabilities: {
60
99
  mount: {
61
- operations(t, e) {
62
- return n(
100
+ operations(t, a) {
101
+ return d(
63
102
  t,
64
- e
103
+ a
65
104
  );
66
105
  }
67
106
  }
68
107
  }
69
108
  };
70
109
  export {
71
- r as default,
72
- r as healthPlugin
110
+ b as default,
111
+ b as healthPlugin
73
112
  };
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@adhd/apigen-plugin-health",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "main": "./index.js",
5
5
  "dependencies": {
6
- "@adhd/apigen-core-client": "^0.2.0"
6
+ "@adhd/apigen-core-client": "^0.2.1"
7
7
  },
8
8
  "publishConfig": {
9
9
  "access": "public"