@specific.dev/spectest 0.120.1 → 0.121.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/src/index.ts CHANGED
@@ -895,7 +895,11 @@ export interface ServiceGroupInput<
895
895
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
896
896
  H extends Record<string, any> = Record<string, never>,
897
897
  Primary extends keyof P & string = keyof P & string,
898
- > {
898
+ > extends Partial<ServiceConfig> {
899
+ // ServiceConfig fields on the group override its primary container. This
900
+ // preserves the usual `{ ...component(), hostnames: [...] }` customization
901
+ // when a component expands to multiple services. Helpers/setup below are
902
+ // group hooks, not container overrides.
899
903
  /**
900
904
  * Build the group's member services, keyed by RELATIVE part name
901
905
  * (`db`, `auth`, …). Called at expansion time with the final naming
@@ -1127,14 +1131,17 @@ function expandServiceGroups(input: InputServicesMap): ServicesMap {
1127
1131
  );
1128
1132
  }
1129
1133
  }
1134
+ const { primary: _primary, services: _services, helpers: _helpers,
1135
+ setup: _setup, expectKey: _expectKey, [SERVICE_GROUP]: _marker,
1136
+ ...primaryOverrides } = entry;
1130
1137
  for (const [part, svc] of Object.entries(parts)) {
1131
1138
  const finalKey = naming.key(part);
1132
1139
  claim(finalKey, owner);
1133
1140
  // Rewrite relative dependsOn to final keys; a spread keeps function
1134
1141
  // fields (helpers/setup) and the enumerable-symbol ingress decls.
1135
- const final: ServiceConfig = { ...svc };
1136
- if (svc.dependsOn?.length) {
1137
- final.dependsOn = svc.dependsOn.map((d) =>
1142
+ const final: ServiceConfig = { ...svc, ...(part === entry.primary ? primaryOverrides : {}) };
1143
+ if (final.dependsOn?.length) {
1144
+ final.dependsOn = final.dependsOn.map((d) =>
1138
1145
  partKeys.has(d) ? naming.key(d) : d,
1139
1146
  );
1140
1147
  }