@onereach/billing-dto 29.8.0 → 29.8.1-beta.9591.0

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/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@onereach/billing-dto",
3
- "version": "29.8.0",
3
+ "version": "29.8.1-beta.9591.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/esm/index.js",
7
7
  "types": "dist/types/index.d.ts",
8
8
  "dependencies": {
9
- "@onereach/billing-shared": "^29.8.0"
9
+ "@onereach/billing-shared": "^29.8.1-beta.9591.0"
10
10
  },
11
11
  "devDependencies": {
12
12
  "@types/node": "24.7.2",
@@ -98,6 +98,10 @@ export function runGenerate(config: GenerateDtoConfig) {
98
98
  return (parts[0] || '').replace(/^.*\./, '').replace(/<.*>/, '').replace(/\[\]/g, '').trim();
99
99
  }
100
100
 
101
+ function normalizeGeneratedType(type: string): string {
102
+ return type.replace(/\bCircularRelation<([^<>]+)>/g, '$1');
103
+ }
104
+
101
105
  function emitRequiredImports() {
102
106
  for (const [mod, names] of requiredImports.entries()) {
103
107
  FILE.addImportDeclaration({
@@ -161,13 +165,13 @@ export function runGenerate(config: GenerateDtoConfig) {
161
165
  if (properties?.length) {
162
166
  properties.forEach(p => {
163
167
  const propertyDec = dec.getProperty(p.name as string) as PropertyDeclaration;
164
- const typeText = `${p.type ?? propertyDec.getType().getText()}`;
165
- const importDec = findInImports(importsDeclarations, `${p.type}` as string);
168
+ const typeText = normalizeGeneratedType(`${p.type ?? propertyDec.getType().getText()}`);
169
+ const importDec = findInImports(importsDeclarations, typeText);
166
170
 
167
171
  if (importDec) {
168
172
  if (isExternalImport(importDec)) {
169
173
  // external module, ensure import exists in output
170
- const simple = cleanTypeIdent(`${p.type}`);
174
+ const simple = cleanTypeIdent(typeText);
171
175
  const named = (importDec.getStructure().namedImports as ImportSpecifierStructure[] | undefined) || [];
172
176
  const match = named.find(n => n.name === simple || n.alias === simple);
173
177
  const nameToImport = (match?.alias || match?.name || simple) as string;
@@ -176,7 +180,7 @@ export function runGenerate(config: GenerateDtoConfig) {
176
180
  const modSrc = importDec.getModuleSpecifierSourceFile() as SourceFile | undefined;
177
181
  if (modSrc) {
178
182
  // local file (via path alias or relative). Try to add referenced declaration directly.
179
- const simple = cleanTypeIdent(`${p.type}`);
183
+ const simple = cleanTypeIdent(typeText);
180
184
  const en = modSrc.getEnum(simple);
181
185
  if (en) {
182
186
  addEnum(en.getStructure());
@@ -255,7 +259,9 @@ export function runGenerate(config: GenerateDtoConfig) {
255
259
  const json = `[${m[1]}]`.replace(/'/g, '"');
256
260
  const arr = JSON.parse(json) as string[];
257
261
  return arr.map(s => `'${s}'`).join('|') || 'never';
258
- } catch {}
262
+ } catch {
263
+ // Keep the original key expression when it is not a JSON-compatible tuple.
264
+ }
259
265
  }
260
266
  return k;
261
267
  };