omc-core 0.4.53 → 0.4.54
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/cloudpivot-auth.js +20 -1
- package/package.json +1 -1
package/dist/cloudpivot-auth.js
CHANGED
|
@@ -183,7 +183,16 @@ export function cloudPivotTenantHeaders(engineCode) {
|
|
|
183
183
|
const code = engineCode?.trim();
|
|
184
184
|
return code ? { "x-lowcode-enginecode": code } : {};
|
|
185
185
|
}
|
|
186
|
-
|
|
186
|
+
/**
|
|
187
|
+
* Fetch and decode the public system config WITHOUT requiring a pcServerUrl.
|
|
188
|
+
*
|
|
189
|
+
* AI-Platform deployments answer a valid `systemVersion` while `pcServerUrl`
|
|
190
|
+
* is `null`. Version evidence and login need only this payload, so reading it
|
|
191
|
+
* must not be coupled to authoritative-origin resolution (live 2026-10-17:
|
|
192
|
+
* the resolver threw, the caller swallowed it, version became undefined and
|
|
193
|
+
* every write failed closed with version-family-evidence-missing).
|
|
194
|
+
*/
|
|
195
|
+
export async function fetchCloudPivotSystemConfig(baseUrl, signal, fetchImpl = fetch, tenantHeaders = {}) {
|
|
187
196
|
const response = await fetchImpl(new URL("/api/public/system/config", baseUrl), { signal, headers: { Accept: "application/json", ...tenantHeaders } });
|
|
188
197
|
if (!response.ok)
|
|
189
198
|
throw new CloudPivotAuthenticationError(`CloudPivot returned HTTP ${response.status} for /api/public/system/config.`);
|
|
@@ -201,6 +210,16 @@ export async function resolveCloudPivotAuthoritativeOrigin(baseUrl, signal, fetc
|
|
|
201
210
|
const system = envelopeData(body);
|
|
202
211
|
if (!isRecord(system))
|
|
203
212
|
throw new CloudPivotAuthenticationError("CloudPivot returned an unsupported /api/public/system/config payload.");
|
|
213
|
+
return system;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Resolve the authoritative origin from the public system config. Deliberately
|
|
217
|
+
* strict: an invalid/absent `pcServerUrl` still fails loudly so a misconfigured
|
|
218
|
+
* deployment is never silently downgraded. Callers that only need version
|
|
219
|
+
* evidence or login must use `fetchCloudPivotSystemConfig` instead.
|
|
220
|
+
*/
|
|
221
|
+
export async function resolveCloudPivotAuthoritativeOrigin(baseUrl, signal, fetchImpl = fetch, tenantHeaders = {}) {
|
|
222
|
+
const system = await fetchCloudPivotSystemConfig(baseUrl, signal, fetchImpl, tenantHeaders);
|
|
204
223
|
const pcServerUrl = optionalString(system, ["pcServerUrl"]);
|
|
205
224
|
if (!pcServerUrl || !URL.canParse(pcServerUrl))
|
|
206
225
|
throw new CloudPivotAuthenticationError("CloudPivot public system config is missing a valid pcServerUrl.");
|