@conduit-client/generator-ts 2.0.0 → 2.1.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/dist/v1/index.js CHANGED
@@ -2326,6 +2326,7 @@ function buildPropertyDestructureDeclaration(propertyName) {
2326
2326
  return { code: code`${propertyName}`, variableName: propertyName };
2327
2327
  }
2328
2328
  }
2329
+ const createdServiceProjectionNames = /* @__PURE__ */ new Set();
2329
2330
  function buildServiceProjection(model) {
2330
2331
  var _a;
2331
2332
  let name = "services";
@@ -2333,12 +2334,15 @@ function buildServiceProjection(model) {
2333
2334
  if (((_a = model.serviceDependencies) == null ? void 0 : _a.overrides) && Object.keys(model.serviceDependencies.overrides).length !== 0) {
2334
2335
  let commandName = toTypeScriptSafeIdentifier(model.commandName);
2335
2336
  name = `servicesProjection_for_${commandName}`;
2336
- overrides = `const ${name} = {
2337
+ if (!createdServiceProjectionNames.has(name)) {
2338
+ overrides = `const ${name} = {
2337
2339
  ...services,`;
2338
- for (const [alias, entry] of Object.entries(model.serviceDependencies.overrides)) {
2339
- overrides += `${alias}: services.${entry.type}_${commandName},`;
2340
+ for (const [alias, entry] of Object.entries(model.serviceDependencies.overrides)) {
2341
+ overrides += `${alias}: services.${entry.type}_${commandName},`;
2342
+ }
2343
+ overrides += `};`;
2344
+ createdServiceProjectionNames.add(name);
2340
2345
  }
2341
- overrides += `};`;
2342
2346
  }
2343
2347
  return [name, overrides];
2344
2348
  }