@adhd/apigen-engine-naming 0.2.1 → 0.2.2

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,16 @@
1
+ ## 0.2.2 (2026-08-07)
2
+
3
+
4
+ ### 🩹 Fixes
5
+
6
+ - **apigen-cli:** restore 2768 files mass-deleted by 0117eb22 (BUG-APIGEN-052)
7
+
8
+
9
+ ### ❤️ Thank You
10
+
11
+ - parity-harness-self-test
12
+ - pseudosky
13
+
1
14
  ## 0.2.1 (2026-07-28)
2
15
 
3
16
  This was a version bump only for apigen-engine-naming to align it with other projects, there were no code changes.
package/index.js CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ts-morph");require("node:fs");require("node:path");require("ts-json-schema-generator");const y=new Set(["string","number","boolean","integer"]);function C(e){if(typeof e!="object"||e===null)return!1;const t=e;if(t.$ref!==void 0||t.oneOf||t.anyOf||t.allOf)return!1;const{type:n}=t;return typeof n=="string"?y.has(n):Array.isArray(n)?n.every(r=>y.has(r)||r==="null"):Array.isArray(t.enum)&&t.enum.length>0?t.enum.every(r=>["string","number","boolean"].includes(typeof r)):!1}function P(e){if(!e||typeof e!="object")return!1;const t=e.properties;return t===void 0||typeof t!="object"||t===null?!1:Object.values(t).every(C)}const x={"decimal.js":"Decimal"};function _(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}Object.entries(x).map(([e,t])=>({pattern:new RegExp(`import\\(["'][^"']*${_(e)}[^"']*["']\\)\\.\\w+`,"g"),key:t}));function h(e){return e.words.join("-")}function k(e){return e.words.map((t,n)=>n===0?t:E(t)).join("")}function v(e){return e.words.map(E).join("")}function $(e){return e.words.join("_")}function w(e){return e.replace(/\.[^.]+$/,"").replace(/[._]+/g,"-")}function b(e,t={}){var l,u;const n=[e.namespace,...e.path],r=e.safe||P(e.input)?"GET":"POST",a=((u=(l=t.http)==null?void 0:l.verb)==null?void 0:u[e.id])??r,p="/"+n.map(s=>h(s)).join("/"),c=n.map(s=>$(s)).join("_"),i=n.map(s=>$(s)).slice(0,-1).join("."),g=v(n[n.length-2]??n[0]),f=v(n[n.length-1]),d=n.map(s=>h(s));return{http:{verb:a,route:p},mcp:{name:c},grpc:{package:i,service:g,method:f},cli:{path:d}}}function K(e,t,n){var a,p;const r=(p=(a=n.http)==null?void 0:a.verb)==null?void 0:p[e];return r==="GET"||r==="POST"?r:t["x-apigen-safe"]?"GET":"POST"}class j extends Error{constructor(t){const n=t.map(r=>` [${r.transport}] "${r.target}" ← ${r.ids[0]} vs ${r.ids[1]}`);super(`apigen-naming: ${t.length} projection collision(s) detected:
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("ts-morph");require("node:fs");require("node:path");require("ts-json-schema-generator");const y=new Set(["string","number","boolean","integer"]);function P(e){if(typeof e!="object"||e===null)return!1;const t=e;if(t.$ref!==void 0||t.oneOf||t.anyOf||t.allOf)return!1;const{type:n}=t;return typeof n=="string"?y.has(n):Array.isArray(n)?n.every(r=>y.has(r)||r==="null"):Array.isArray(t.enum)&&t.enum.length>0?t.enum.every(r=>["string","number","boolean"].includes(typeof r)):!1}function C(e){if(!e||typeof e!="object")return!1;const t=e.properties;return t===void 0||typeof t!="object"||t===null?!1:Object.values(t).every(P)}const x={"decimal.js":"Decimal"};function _(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}Object.entries(x).map(([e,t])=>({pattern:new RegExp(`import\\(["'][^"']*${_(e)}[^"']*["']\\)\\.\\w+`,"g"),key:t}));function h(e){return e.words.join("-")}function k(e){return e.words.map((t,n)=>n===0?t:E(t)).join("")}function v(e){return e.words.map(E).join("")}function $(e){return e.words.join("_")}function w(e){return e.replace(/\.[^.]+$/,"").replace(/[._]+/g,"-")}function b(e,t={}){var l,u;const n=[e.namespace,...e.path],r=e.safe||C(e.input)?"GET":"POST",a=((u=(l=t.http)==null?void 0:l.verb)==null?void 0:u[e.id])??r,p="/"+n.map(s=>h(s)).join("/"),c=n.map(s=>$(s)).join("_"),i=n.map(s=>$(s)).slice(0,-1).join("."),g=v(n[n.length-2]??n[0]),f=v(n[n.length-1]),d=n.map(s=>h(s));return{http:{verb:a,route:p},mcp:{name:c},grpc:{package:i,service:g,method:f},cli:{path:d}}}function K(e,t,n){var a,p;const r=(p=(a=n.http)==null?void 0:a.verb)==null?void 0:p[e];return r==="GET"||r==="POST"?r:t["x-apigen-safe"]?"GET":"POST"}class j extends Error{constructor(t){const n=t.map(r=>` [${r.transport}] "${r.target}" ← ${r.ids[0]} vs ${r.ids[1]}`);super(`apigen-naming: ${t.length} projection collision(s) detected:
2
2
  ${n.join(`
3
- `)}`),this.name="CollisionDetectedError",this.collisions=t}}function M(e,t={}){const n=new Map,r=new Map,a=new Map,p=new Map,c=[];for(const o of e){const i=b(o,t),g=`${i.http.verb} ${i.http.route}`,f=n.get(g);f!==void 0&&f!==o.id?c.push({transport:"http",target:g,ids:[f,o.id]}):n.set(g,o.id);const d=r.get(i.mcp.name);d!==void 0&&d!==o.id?c.push({transport:"mcp",target:i.mcp.name,ids:[d,o.id]}):r.set(i.mcp.name,o.id);const l=`${i.grpc.package}.${i.grpc.service}/${i.grpc.method}`,u=a.get(l);u!==void 0&&u!==o.id?c.push({transport:"grpc",target:l,ids:[u,o.id]}):a.set(l,o.id);const s=i.cli.path.join(" "),m=p.get(s);m!==void 0&&m!==o.id?c.push({transport:"cli",target:s,ids:[m,o.id]}):p.set(s,o.id)}if(c.length>0)throw new j(c)}function S(e,t){return`x-${e}-${t}`}function O(e,t){return`--${e}-${t}`}function A(e,t){const n=r=>r.toUpperCase().replace(/-/g,"_");return e==="adhd"?`APIGEN_${n(t)}`:`APIGEN_${n(e)}_${n(t)}`}const T=S;function z(e){let t=e.replace(/[^a-zA-Z0-9_$]/g,"_");return(t===""||/^[0-9]/.test(t))&&(t=`_${t}`),t}function E(e){return e.length===0?e:e[0].toUpperCase()+e.slice(1)}exports.CollisionDetectedError=j;exports.checkCollisions=M;exports.envelopeCliFlag=O;exports.envelopeEnvVar=A;exports.envelopeKey=S;exports.envelopeMetaKey=T;exports.httpVerb=K;exports.normalizeFileName=w;exports.project=b;exports.sanitizeIdentifier=z;exports.toCamel=k;exports.toKebab=h;exports.toPascal=v;exports.toSnake=$;
3
+ `)}`),this.name="CollisionDetectedError",this.collisions=t}}function M(e,t={}){const n=new Map,r=new Map,a=new Map,p=new Map,c=[];for(const o of e){const i=b(o,t),g=`${i.http.verb} ${i.http.route}`,f=n.get(g);f!==void 0&&f!==o.id?c.push({transport:"http",target:g,ids:[f,o.id]}):n.set(g,o.id);const d=r.get(i.mcp.name);d!==void 0&&d!==o.id?c.push({transport:"mcp",target:i.mcp.name,ids:[d,o.id]}):r.set(i.mcp.name,o.id);const l=`${i.grpc.package}.${i.grpc.service}/${i.grpc.method}`,u=a.get(l);u!==void 0&&u!==o.id?c.push({transport:"grpc",target:l,ids:[u,o.id]}):a.set(l,o.id);const s=i.cli.path.join(" "),m=p.get(s);m!==void 0&&m!==o.id?c.push({transport:"cli",target:s,ids:[m,o.id]}):p.set(s,o.id)}if(c.length>0)throw new j(c)}function S(e,t){return`x-${e}-${t}`}function O(e,t){return`--${e}-${t}`}function z(e,t){const n=r=>r.toUpperCase().replace(/-/g,"_");return e==="adhd"?`APIGEN_${n(t)}`:`APIGEN_${n(e)}_${n(t)}`}const A=S;function T(e){let t=e.replace(/[^a-zA-Z0-9_$]/g,"_");return(t===""||/^[0-9]/.test(t))&&(t=`_${t}`),t}function E(e){return e.length===0?e:e[0].toUpperCase()+e.slice(1)}exports.CollisionDetectedError=j;exports.checkCollisions=M;exports.envelopeCliFlag=O;exports.envelopeEnvVar=z;exports.envelopeKey=S;exports.envelopeMetaKey=A;exports.httpVerb=K;exports.normalizeFileName=w;exports.project=b;exports.sanitizeIdentifier=T;exports.toCamel=k;exports.toKebab=h;exports.toPascal=v;exports.toSnake=$;
package/index.mjs CHANGED
@@ -12,7 +12,7 @@ function j(e) {
12
12
  const { type: n } = t;
13
13
  return typeof n == "string" ? h.has(n) : Array.isArray(n) ? n.every((r) => h.has(r) || r === "null") : Array.isArray(t.enum) && t.enum.length > 0 ? t.enum.every((r) => ["string", "number", "boolean"].includes(typeof r)) : !1;
14
14
  }
15
- function x(e) {
15
+ function E(e) {
16
16
  if (!e || typeof e != "object")
17
17
  return !1;
18
18
  const t = e.properties;
@@ -20,13 +20,13 @@ function x(e) {
20
20
  j
21
21
  );
22
22
  }
23
- const E = {
23
+ const S = {
24
24
  "decimal.js": "Decimal"
25
25
  };
26
- function S(e) {
26
+ function x(e) {
27
27
  return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
28
28
  }
29
- Object.entries(E).map(([e, t]) => ({
29
+ Object.entries(S).map(([e, t]) => ({
30
30
  // Matches: import("...{modSpec}...").<anyMemberName> (single or double quotes)
31
31
  // The module specifier appears inside an absolute path, so we allow any
32
32
  // characters between the quote and the specifier, and between the specifier
@@ -34,18 +34,18 @@ Object.entries(E).map(([e, t]) => ({
34
34
  // …) is matched generically (`\w+`) rather than anchored to one spelling —
35
35
  // see the doc comment above for why.
36
36
  pattern: new RegExp(
37
- `import\\(["'][^"']*${S(e)}[^"']*["']\\)\\.\\w+`,
37
+ `import\\(["'][^"']*${x(e)}[^"']*["']\\)\\.\\w+`,
38
38
  "g"
39
39
  ),
40
40
  key: t
41
41
  }));
42
- function v(e) {
42
+ function $(e) {
43
43
  return e.words.join("-");
44
44
  }
45
45
  function M(e) {
46
46
  return e.words.map((t, n) => n === 0 ? t : b(t)).join("");
47
47
  }
48
- function $(e) {
48
+ function v(e) {
49
49
  return e.words.map(b).join("");
50
50
  }
51
51
  function y(e) {
@@ -54,9 +54,9 @@ function y(e) {
54
54
  function G(e) {
55
55
  return e.replace(/\.[^.]+$/, "").replace(/[._]+/g, "-");
56
56
  }
57
- function _(e, t = {}) {
57
+ function P(e, t = {}) {
58
58
  var l, u;
59
- const n = [e.namespace, ...e.path], r = e.safe || x(e.input) ? "GET" : "POST", p = ((u = (l = t.http) == null ? void 0 : l.verb) == null ? void 0 : u[e.id]) ?? r, a = "/" + n.map((s) => v(s)).join("/"), c = n.map((s) => y(s)).join("_"), i = n.map((s) => y(s)).slice(0, -1).join("."), g = $(n[n.length - 2] ?? n[0]), f = $(n[n.length - 1]), m = n.map((s) => v(s));
59
+ const n = [e.namespace, ...e.path], r = e.safe || E(e.input) ? "GET" : "POST", p = ((u = (l = t.http) == null ? void 0 : l.verb) == null ? void 0 : u[e.id]) ?? r, a = "/" + n.map((s) => $(s)).join("/"), c = n.map((s) => y(s)).join("_"), i = n.map((s) => y(s)).slice(0, -1).join("."), g = v(n[n.length - 2] ?? n[0]), f = v(n[n.length - 1]), m = n.map((s) => $(s));
60
60
  return {
61
61
  http: { verb: p, route: a },
62
62
  mcp: { name: c },
@@ -69,7 +69,7 @@ function K(e, t, n) {
69
69
  const r = (a = (p = n.http) == null ? void 0 : p.verb) == null ? void 0 : a[e];
70
70
  return r === "GET" || r === "POST" ? r : t["x-apigen-safe"] ? "GET" : "POST";
71
71
  }
72
- class P extends Error {
72
+ class _ extends Error {
73
73
  constructor(t) {
74
74
  const n = t.map(
75
75
  (r) => ` [${r.transport}] "${r.target}" ← ${r.ids[0]} vs ${r.ids[1]}`
@@ -84,7 +84,7 @@ ${n.join(`
84
84
  function T(e, t = {}) {
85
85
  const n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), c = [];
86
86
  for (const o of e) {
87
- const i = _(o, t), g = `${i.http.verb} ${i.http.route}`, f = n.get(g);
87
+ const i = P(o, t), g = `${i.http.verb} ${i.http.route}`, f = n.get(g);
88
88
  f !== void 0 && f !== o.id ? c.push({
89
89
  transport: "http",
90
90
  target: g,
@@ -110,7 +110,7 @@ function T(e, t = {}) {
110
110
  }) : a.set(s, o.id);
111
111
  }
112
112
  if (c.length > 0)
113
- throw new P(c);
113
+ throw new _(c);
114
114
  }
115
115
  function w(e, t) {
116
116
  return `x-${e}-${t}`;
@@ -131,7 +131,7 @@ function b(e) {
131
131
  return e.length === 0 ? e : e[0].toUpperCase() + e.slice(1);
132
132
  }
133
133
  export {
134
- P as CollisionDetectedError,
134
+ _ as CollisionDetectedError,
135
135
  T as checkCollisions,
136
136
  z as envelopeCliFlag,
137
137
  N as envelopeEnvVar,
@@ -139,10 +139,10 @@ export {
139
139
  D as envelopeMetaKey,
140
140
  K as httpVerb,
141
141
  G as normalizeFileName,
142
- _ as project,
142
+ P as project,
143
143
  U as sanitizeIdentifier,
144
144
  M as toCamel,
145
- v as toKebab,
146
- $ as toPascal,
145
+ $ as toKebab,
146
+ v as toPascal,
147
147
  y as toSnake
148
148
  };
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@adhd/apigen-engine-naming",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "dependencies": {
5
- "@adhd/apigen-core-client": "^0.2.1"
5
+ "@adhd/apigen-core-client": "^0.3.0"
6
6
  },
7
7
  "main": "./index.js",
8
8
  "module": "./index.mjs",