@wildo-ai/platform-config-lib 1.1.15 → 1.1.16
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/esm/project-config/provider-companion-discovery.d.ts +45 -0
- package/dist/esm/project-config/provider-companion-discovery.d.ts.map +1 -1
- package/dist/esm/project-config/provider-companion-discovery.js +52 -3
- package/dist/esm/project-config/provider-companion-discovery.js.map +1 -1
- package/dist/esm/project-config/provider-runtime-artifacts.d.ts.map +1 -1
- package/dist/esm/project-config/provider-runtime-artifacts.js +4 -1
- package/dist/esm/project-config/provider-runtime-artifacts.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +7 -7
|
@@ -145,8 +145,28 @@ export interface UnreadableProviderCompanionOwner {
|
|
|
145
145
|
readonly packageRoot: string;
|
|
146
146
|
readonly reason: string;
|
|
147
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* A contribution discovery dropped because the provider PACKAGE that owns its module contributes the same ref through
|
|
150
|
+
* the same import path (#4019): a re-statement of one module, never a second claim. See
|
|
151
|
+
* {@link collapseRedeclaredProviderContributions}.
|
|
152
|
+
*/
|
|
153
|
+
export interface RedeclaredProviderContribution {
|
|
154
|
+
readonly ref: string;
|
|
155
|
+
readonly runtimeImportPath: string;
|
|
156
|
+
/** The owner whose re-declaration was dropped: a runtime owner's own barrel, or another package. */
|
|
157
|
+
readonly redeclaredBy: ProviderContributionOwner;
|
|
158
|
+
/** The package whose own `./companion` describes the module, and whose contribution stands. */
|
|
159
|
+
readonly ownedBy: ProviderContributionOwner;
|
|
160
|
+
}
|
|
148
161
|
export interface DiscoverSaasProviderCompanionContributionsResult {
|
|
162
|
+
/** One contribution per module: a re-declaration of a package's own module is dropped ({@link redeclaredContributions}). */
|
|
149
163
|
contributions: DiscoveredProviderCompanionContribution[];
|
|
164
|
+
/**
|
|
165
|
+
* The re-declarations dropped from {@link contributions} (#4019). EMPTY is the normal state. Reported, never refused:
|
|
166
|
+
* the package and the re-declaration name the same module, so nothing is ambiguous, and `wildo config sync` prints
|
|
167
|
+
* each as an advisory so the redundant declaration can be removed.
|
|
168
|
+
*/
|
|
169
|
+
redeclaredContributions: RedeclaredProviderContribution[];
|
|
150
170
|
/**
|
|
151
171
|
* Owners whose companion door exists and threw. EMPTY is the normal state.
|
|
152
172
|
*
|
|
@@ -228,6 +248,31 @@ export declare function discoverSaasProviderCompanionContributions(input: {
|
|
|
228
248
|
saasRoot: string;
|
|
229
249
|
saasConfig: Pick<WildoSaasConfig, 'services' | 'libraries' | 'minions' | 'providers' | 'workers'> & Partial<Pick<WildoSaasConfig, 'systemsOfRecord'>>;
|
|
230
250
|
}): Promise<DiscoverSaasProviderCompanionContributionsResult>;
|
|
251
|
+
/**
|
|
252
|
+
* Which source wins when one provider ref is contributed more than once (#4019): the rule, in one place, for every reader
|
|
253
|
+
* of discovery (config sync, the artifact builder, the frontend source writer, lock check, secrets, readiness).
|
|
254
|
+
*
|
|
255
|
+
* - **The same import path**: one module, described twice. The PROVIDER PACKAGE whose name the path starts with owns the
|
|
256
|
+
* module, and its own `./companion` (derived from the module, its targets filtered by the application's scopes) is the
|
|
257
|
+
* description that stands; any other owner's contribution of that ref through that path is a re-statement, dropped and
|
|
258
|
+
* reported. Measured on reference run 44052185141: an installed PostHog module's browser facet contributed `posthog`
|
|
259
|
+
* for the application frontend, the frontend's own `provider-contributions.ts` re-projected the same facet module, and
|
|
260
|
+
* every env-file sync refused "provider "posthog" is contributed more than once for the same runtime", 66 times.
|
|
261
|
+
* - **Different import paths**: two modules claiming one ref. Nothing here decides between them; validation refuses it
|
|
262
|
+
* by name (`describeProviderRefClaimedByMoreThanOneImportPath`, #2014), which is the answer for an engine provider and
|
|
263
|
+
* an installed module sharing a ref as well.
|
|
264
|
+
* - **The same path, and no walked package owns it**: left as found, so the bootstrap's refusal names both owners.
|
|
265
|
+
*
|
|
266
|
+
* A re-declaration carries nothing the owning package's lacks that a host could use: the package's description is the
|
|
267
|
+
* one derived from the module, and a target only the re-declaration names is a runtime no scope reaches through the
|
|
268
|
+
* package, which the application's own scope decides.
|
|
269
|
+
*/
|
|
270
|
+
export declare function collapseRedeclaredProviderContributions(contributions: readonly DiscoveredProviderCompanionContribution[]): {
|
|
271
|
+
contributions: DiscoveredProviderCompanionContribution[];
|
|
272
|
+
redeclared: RedeclaredProviderContribution[];
|
|
273
|
+
};
|
|
274
|
+
/** The advisory `wildo config sync` prints for one dropped re-declaration (#4019). */
|
|
275
|
+
export declare function describeRedeclaredProviderContribution(entry: RedeclaredProviderContribution): string;
|
|
231
276
|
/**
|
|
232
277
|
* The facet module a package root declares — `<name>/systems-of-record` — or `undefined`. Read from the
|
|
233
278
|
* MANIFEST, never by loading: a build-time consumer has no business evaluating a vendor facet to learn that
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-companion-discovery.d.ts","sourceRoot":"","sources":["../../../src/project-config/provider-companion-discovery.ts"],"names":[],"mappings":"AAGA,OAAO,EAKL,KAAK,gCAAgC,EACrC,KAAK,6BAA6B,EAClC,KAAK,yBAAyB,EAGS,MAAM,uBAAuB,CAAC;AAGvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D;;;;;;;;GAQG;AACH,oBAAY,6BAA6B;IACvC,sGAAsG;IACtG,OAAO,YAAY;IACnB,mDAAmD;IACnD,OAAO,YAAY;IACnB,kDAAkD;IAClD,MAAM,WAAW;IACjB,uDAAuD;IACvD,MAAM,WAAW;IACjB;;;;OAIG;IACH,gBAAgB,oBAAoB;CACrC;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,iCAAiC,wBAAwB,CAAC;AAEvE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,iCAAiC,0CAA0C,CAAC;AAEzF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mCAAmC,gCAAgC,CAAC;AAEjF;;;;;GAKG;AACH,oBAAY,4BAA4B;IACtC,uGAAuG;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AuC,EAAE,CAAC;IACzD;;;;;;;;;;;;OAYG;IACH,gBAAgB,EAAE,gCAAgC,EAAE,CAAC;IACrD;;;;;OAKG;IACH,aAAa,EAAE,8BAA8B,EAAE,CAAC;IAChD;;;;;;;;;;OAUG;IACH,0BAA0B,EAAE,MAAM,EAAE,CAAC;IACrC;;;;OAIG;IACH,sBAAsB,EAAE,qBAAqB,EAAE,CAAC;CACjD;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,8BAA8B;IAC7C,aAAa,EAAE,uCAAuC,EAAE,CAAC;IACzD,4FAA4F;IAC5F,aAAa,EAAE,8BAA8B,EAAE,CAAC;IAChD,kIAAkI;IAClI,0BAA0B,EAAE,MAAM,EAAE,CAAC;IACrC;;;OAGG;IACH,wBAAwB,EAAE,uBAAuB,EAAE,CAAC;IACpD;;;;OAIG;IACH,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AA6DD;;;;;;;;;GASG;AACH,wBAAgB,wCAAwC,CACtD,YAAY,EAAE,IAAI,CAAC,6BAA6B,EAAE,KAAK,GAAG,gBAAgB,CAAC,EAC3E,UAAU,EAAE,IAAI,CAAC,eAAe,EAAE,WAAW,GAAG,UAAU,CAAC,GAC1D,6BAA6B,CAAC,gBAAgB,CAAC,CAejD;AAED,wBAAsB,0CAA0C,CAAC,KAAK,EAAE;IACtE,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC,CAAC;CACvJ,GAAG,OAAO,CAAC,gDAAgD,CAAC,
|
|
1
|
+
{"version":3,"file":"provider-companion-discovery.d.ts","sourceRoot":"","sources":["../../../src/project-config/provider-companion-discovery.ts"],"names":[],"mappings":"AAGA,OAAO,EAKL,KAAK,gCAAgC,EACrC,KAAK,6BAA6B,EAClC,KAAK,yBA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AAqB,EAAE,CAAC;IAC1D;;;;;OAKG;IACH,0BAA0B,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAChD,GAAG,IAAI,CAkJP;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,iCAAiC,CAAC,KAAK,EAAE;IACvD,UAAU,EAAE,IAAI,CAAC,eAAe,EAAE,WAAW,GAAG,iBAAiB,CAAC,CAAC;IACnE,uBAAuB,EAAE,SAAS,uCAAuC,EAAE,CAAC;CAC7E,GAAG;IAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,CAoF7C;AAiJD;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,uCAAuC,GAAG;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAAE,CAOlJ;AA6YD,kHAAkH;AAClH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAW1E;AAsGD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iDAAiD,CAC/D,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,SAAS,uCAAuC,EAAE,GAChE,MAAM,GAAG,SAAS,CAgBpB"}
|
|
@@ -246,14 +246,60 @@ export async function discoverSaasProviderCompanionContributions(input) {
|
|
|
246
246
|
},
|
|
247
247
|
})));
|
|
248
248
|
}
|
|
249
|
+
const collapsed = collapseRedeclaredProviderContributions(contributions);
|
|
249
250
|
return {
|
|
250
|
-
contributions,
|
|
251
|
+
contributions: collapsed.contributions,
|
|
252
|
+
redeclaredContributions: collapsed.redeclared,
|
|
251
253
|
unreadableOwners,
|
|
252
254
|
augmentations,
|
|
253
255
|
systemOfRecordFacetModules: [...systemOfRecordFacetModules].sort(),
|
|
254
256
|
listedProviderPackages: listedPackageNames.map((packageName) => describeListedProviderPackage(packageName, packageTargets, packageFindings)),
|
|
255
257
|
};
|
|
256
258
|
}
|
|
259
|
+
/**
|
|
260
|
+
* Which source wins when one provider ref is contributed more than once (#4019): the rule, in one place, for every reader
|
|
261
|
+
* of discovery (config sync, the artifact builder, the frontend source writer, lock check, secrets, readiness).
|
|
262
|
+
*
|
|
263
|
+
* - **The same import path**: one module, described twice. The PROVIDER PACKAGE whose name the path starts with owns the
|
|
264
|
+
* module, and its own `./companion` (derived from the module, its targets filtered by the application's scopes) is the
|
|
265
|
+
* description that stands; any other owner's contribution of that ref through that path is a re-statement, dropped and
|
|
266
|
+
* reported. Measured on reference run 44052185141: an installed PostHog module's browser facet contributed `posthog`
|
|
267
|
+
* for the application frontend, the frontend's own `provider-contributions.ts` re-projected the same facet module, and
|
|
268
|
+
* every env-file sync refused "provider "posthog" is contributed more than once for the same runtime", 66 times.
|
|
269
|
+
* - **Different import paths**: two modules claiming one ref. Nothing here decides between them; validation refuses it
|
|
270
|
+
* by name (`describeProviderRefClaimedByMoreThanOneImportPath`, #2014), which is the answer for an engine provider and
|
|
271
|
+
* an installed module sharing a ref as well.
|
|
272
|
+
* - **The same path, and no walked package owns it**: left as found, so the bootstrap's refusal names both owners.
|
|
273
|
+
*
|
|
274
|
+
* A re-declaration carries nothing the owning package's lacks that a host could use: the package's description is the
|
|
275
|
+
* one derived from the module, and a target only the re-declaration names is a runtime no scope reaches through the
|
|
276
|
+
* package, which the application's own scope decides.
|
|
277
|
+
*/
|
|
278
|
+
export function collapseRedeclaredProviderContributions(contributions) {
|
|
279
|
+
const ownedByPackage = (contribution) => contribution.owner.kind === ProviderContributionOwnerKind.PROVIDER_PACKAGE && contribution.owner.key === extractPackageName(contribution.runtimeImportPath);
|
|
280
|
+
const owners = new Map();
|
|
281
|
+
for (const contribution of contributions) {
|
|
282
|
+
if (ownedByPackage(contribution))
|
|
283
|
+
owners.set(`${contribution.ref}\u0000${contribution.runtimeImportPath}`, contribution);
|
|
284
|
+
}
|
|
285
|
+
const kept = [];
|
|
286
|
+
const redeclared = [];
|
|
287
|
+
for (const contribution of contributions) {
|
|
288
|
+
const owner = owners.get(`${contribution.ref}\u0000${contribution.runtimeImportPath}`);
|
|
289
|
+
if (owner === undefined || owner === contribution) {
|
|
290
|
+
kept.push(contribution);
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
redeclared.push({ ref: contribution.ref, runtimeImportPath: contribution.runtimeImportPath, redeclaredBy: contribution.owner, ownedBy: owner.owner });
|
|
294
|
+
}
|
|
295
|
+
return { contributions: kept, redeclared };
|
|
296
|
+
}
|
|
297
|
+
/** The advisory `wildo config sync` prints for one dropped re-declaration (#4019). */
|
|
298
|
+
export function describeRedeclaredProviderContribution(entry) {
|
|
299
|
+
return `Provider "${entry.ref}" is contributed by ${entry.redeclaredBy.kind} "${entry.redeclaredBy.key}" through "${entry.runtimeImportPath}", `
|
|
300
|
+
+ `which is the module of ${entry.ownedBy.kind} "${entry.ownedBy.key}" and which that package already contributes; the package's own `
|
|
301
|
+
+ 'contribution is used. Remove the re-declaration: an installed module contributes itself, and the application binds it in its scope.';
|
|
302
|
+
}
|
|
257
303
|
/** What discovery found for one listed package (#1676) — see {@link ProviderPackageListingStatus}. */
|
|
258
304
|
function describeListedProviderPackage(packageName, packageTargets, packageFindings) {
|
|
259
305
|
if (packageTargets.ownPackageNames.has(packageName))
|
|
@@ -386,7 +432,7 @@ export async function resolveProviderComplianceProfiles(input) {
|
|
|
386
432
|
* discovery and the real validation they exist to check.
|
|
387
433
|
*/
|
|
388
434
|
export async function resolveValidatedSaasProviderContributions(input) {
|
|
389
|
-
const { contributions, unreadableOwners, augmentations, systemOfRecordFacetModules, listedProviderPackages } = await discoverSaasProviderCompanionContributions(input);
|
|
435
|
+
const { contributions, redeclaredContributions, unreadableOwners, augmentations, systemOfRecordFacetModules, listedProviderPackages } = await discoverSaasProviderCompanionContributions(input);
|
|
390
436
|
validateDiscoveredSaasProviderContributions({
|
|
391
437
|
saasConfig: input.saasConfig,
|
|
392
438
|
discoveredContributions: contributions,
|
|
@@ -403,7 +449,10 @@ export async function resolveValidatedSaasProviderContributions(input) {
|
|
|
403
449
|
.filter((listed) => listed.status === ProviderPackageListingStatus.ADMITTED)
|
|
404
450
|
.map(({ packageName, packageVersion }) => ({ packageName, ...(packageVersion === undefined ? {} : { packageVersion }) }))
|
|
405
451
|
.sort((left, right) => left.packageName.localeCompare(right.packageName)),
|
|
406
|
-
advisories:
|
|
452
|
+
advisories: [
|
|
453
|
+
...redeclaredContributions.map(describeRedeclaredProviderContribution),
|
|
454
|
+
...validateProviderSharedConnections({ saasConfig: input.saasConfig, discoveredContributions: contributions }).advisories,
|
|
455
|
+
],
|
|
407
456
|
};
|
|
408
457
|
}
|
|
409
458
|
/**
|