@hamak/smart-data-dico 1.8.1 → 1.8.2
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/backend/dist/server.mjs +21 -23
- package/bin/cli.js +1 -0
- package/package.json +1 -1
package/backend/dist/server.mjs
CHANGED
|
@@ -99846,7 +99846,7 @@ async function auth(provider, options2) {
|
|
|
99846
99846
|
throw error48;
|
|
99847
99847
|
}
|
|
99848
99848
|
}
|
|
99849
|
-
async function authInternal(provider, { serverUrl
|
|
99849
|
+
async function authInternal(provider, { serverUrl, authorizationCode, scope, resourceMetadataUrl, fetchFn }) {
|
|
99850
99850
|
const cachedState = await provider.discoveryState?.();
|
|
99851
99851
|
let resourceMetadata;
|
|
99852
99852
|
let authorizationServerUrl;
|
|
@@ -99861,7 +99861,7 @@ async function authInternal(provider, { serverUrl: serverUrl2, authorizationCode
|
|
|
99861
99861
|
metadata = cachedState.authorizationServerMetadata ?? await discoverAuthorizationServerMetadata(authorizationServerUrl, { fetchFn });
|
|
99862
99862
|
if (!resourceMetadata) {
|
|
99863
99863
|
try {
|
|
99864
|
-
resourceMetadata = await discoverOAuthProtectedResourceMetadata(
|
|
99864
|
+
resourceMetadata = await discoverOAuthProtectedResourceMetadata(serverUrl, { resourceMetadataUrl: effectiveResourceMetadataUrl }, fetchFn);
|
|
99865
99865
|
} catch {
|
|
99866
99866
|
}
|
|
99867
99867
|
}
|
|
@@ -99874,7 +99874,7 @@ async function authInternal(provider, { serverUrl: serverUrl2, authorizationCode
|
|
|
99874
99874
|
});
|
|
99875
99875
|
}
|
|
99876
99876
|
} else {
|
|
99877
|
-
const serverInfo = await discoverOAuthServerInfo(
|
|
99877
|
+
const serverInfo = await discoverOAuthServerInfo(serverUrl, { resourceMetadataUrl: effectiveResourceMetadataUrl, fetchFn });
|
|
99878
99878
|
authorizationServerUrl = serverInfo.authorizationServerUrl;
|
|
99879
99879
|
metadata = serverInfo.authorizationServerMetadata;
|
|
99880
99880
|
resourceMetadata = serverInfo.resourceMetadata;
|
|
@@ -99885,7 +99885,7 @@ async function authInternal(provider, { serverUrl: serverUrl2, authorizationCode
|
|
|
99885
99885
|
authorizationServerMetadata: metadata
|
|
99886
99886
|
});
|
|
99887
99887
|
}
|
|
99888
|
-
const resource = await selectResourceURL(
|
|
99888
|
+
const resource = await selectResourceURL(serverUrl, provider, resourceMetadata);
|
|
99889
99889
|
const resolvedScope = scope || resourceMetadata?.scopes_supported?.join(" ") || provider.clientMetadata.scope;
|
|
99890
99890
|
let clientInformation = await Promise.resolve(provider.clientInformation());
|
|
99891
99891
|
if (!clientInformation) {
|
|
@@ -99971,8 +99971,8 @@ function isHttpsUrl(value) {
|
|
|
99971
99971
|
return false;
|
|
99972
99972
|
}
|
|
99973
99973
|
}
|
|
99974
|
-
async function selectResourceURL(
|
|
99975
|
-
const defaultResource = resourceUrlFromServerUrl(
|
|
99974
|
+
async function selectResourceURL(serverUrl, provider, resourceMetadata) {
|
|
99975
|
+
const defaultResource = resourceUrlFromServerUrl(serverUrl);
|
|
99976
99976
|
if (provider.validateResourceURL) {
|
|
99977
99977
|
return await provider.validateResourceURL(defaultResource, resourceMetadata?.resource);
|
|
99978
99978
|
}
|
|
@@ -100021,8 +100021,8 @@ function extractFieldFromWwwAuth(response, fieldName) {
|
|
|
100021
100021
|
}
|
|
100022
100022
|
return null;
|
|
100023
100023
|
}
|
|
100024
|
-
async function discoverOAuthProtectedResourceMetadata(
|
|
100025
|
-
const response = await discoverMetadataWithFallback(
|
|
100024
|
+
async function discoverOAuthProtectedResourceMetadata(serverUrl, opts, fetchFn = fetch) {
|
|
100025
|
+
const response = await discoverMetadataWithFallback(serverUrl, "oauth-protected-resource", fetchFn, {
|
|
100026
100026
|
protocolVersion: opts?.protocolVersion,
|
|
100027
100027
|
metadataUrl: opts?.resourceMetadataUrl
|
|
100028
100028
|
});
|
|
@@ -100065,8 +100065,8 @@ async function tryMetadataDiscovery(url2, protocolVersion, fetchFn = fetch) {
|
|
|
100065
100065
|
function shouldAttemptFallback(response, pathname) {
|
|
100066
100066
|
return !response || response.status >= 400 && response.status < 500 && pathname !== "/";
|
|
100067
100067
|
}
|
|
100068
|
-
async function discoverMetadataWithFallback(
|
|
100069
|
-
const issuer = new URL(
|
|
100068
|
+
async function discoverMetadataWithFallback(serverUrl, wellKnownType, fetchFn, opts) {
|
|
100069
|
+
const issuer = new URL(serverUrl);
|
|
100070
100070
|
const protocolVersion = opts?.protocolVersion ?? LATEST_PROTOCOL_VERSION;
|
|
100071
100071
|
let url2;
|
|
100072
100072
|
if (opts?.metadataUrl) {
|
|
@@ -100142,18 +100142,18 @@ async function discoverAuthorizationServerMetadata(authorizationServerUrl, { fet
|
|
|
100142
100142
|
}
|
|
100143
100143
|
return void 0;
|
|
100144
100144
|
}
|
|
100145
|
-
async function discoverOAuthServerInfo(
|
|
100145
|
+
async function discoverOAuthServerInfo(serverUrl, opts) {
|
|
100146
100146
|
let resourceMetadata;
|
|
100147
100147
|
let authorizationServerUrl;
|
|
100148
100148
|
try {
|
|
100149
|
-
resourceMetadata = await discoverOAuthProtectedResourceMetadata(
|
|
100149
|
+
resourceMetadata = await discoverOAuthProtectedResourceMetadata(serverUrl, { resourceMetadataUrl: opts?.resourceMetadataUrl }, opts?.fetchFn);
|
|
100150
100150
|
if (resourceMetadata.authorization_servers && resourceMetadata.authorization_servers.length > 0) {
|
|
100151
100151
|
authorizationServerUrl = resourceMetadata.authorization_servers[0];
|
|
100152
100152
|
}
|
|
100153
100153
|
} catch {
|
|
100154
100154
|
}
|
|
100155
100155
|
if (!authorizationServerUrl) {
|
|
100156
|
-
authorizationServerUrl = String(new URL("/",
|
|
100156
|
+
authorizationServerUrl = String(new URL("/", serverUrl));
|
|
100157
100157
|
}
|
|
100158
100158
|
const authorizationServerMetadata = await discoverAuthorizationServerMetadata(authorizationServerUrl, { fetchFn: opts?.fetchFn });
|
|
100159
100159
|
return {
|
|
@@ -156981,13 +156981,13 @@ async function resolveProjectPrefixAtRef(ref) {
|
|
|
156981
156981
|
logger.warn(`Could not resolve git repo root: ${e}`);
|
|
156982
156982
|
return null;
|
|
156983
156983
|
}
|
|
156984
|
-
const
|
|
156984
|
+
const candidates = [];
|
|
156985
156985
|
const rel = path6.relative(repoRoot, config.dataDir);
|
|
156986
156986
|
const primary = !rel || rel === "." || rel.startsWith("..") ? "" : rel.replace(/\\/g, "/") + "/";
|
|
156987
|
-
|
|
156988
|
-
if (primary !== "data-dictionaries/")
|
|
156989
|
-
if (primary !== "")
|
|
156990
|
-
for (const prefix of
|
|
156987
|
+
candidates.push(primary);
|
|
156988
|
+
if (primary !== "data-dictionaries/") candidates.push("data-dictionaries/");
|
|
156989
|
+
if (primary !== "") candidates.push("");
|
|
156990
|
+
for (const prefix of candidates) {
|
|
156991
156991
|
const marker21 = await readFileAtRef(ref, `${prefix}dico.config.json`);
|
|
156992
156992
|
if (marker21 !== null) return prefix;
|
|
156993
156993
|
}
|
|
@@ -162317,18 +162317,16 @@ mountFrameworkRoutes().catch((err) => {
|
|
|
162317
162317
|
logger.warn(`Failed to mount framework routes: ${err}`);
|
|
162318
162318
|
});
|
|
162319
162319
|
if (config.isProduction) {
|
|
162320
|
-
const serverUrl = eval("import.meta.url");
|
|
162321
|
-
const serverDir = path13.dirname(new URL(serverUrl).pathname);
|
|
162322
162320
|
const candidates = [
|
|
162323
|
-
|
|
162324
|
-
// npm package (
|
|
162321
|
+
process.env.SDD_FRONTEND_DIST || "",
|
|
162322
|
+
// npm package (set by bin/cli.js)
|
|
162325
162323
|
path13.join(process.cwd(), "public"),
|
|
162326
162324
|
// Docker (copied to public/)
|
|
162327
162325
|
path13.join(process.cwd(), "..", "frontend", "dist"),
|
|
162328
162326
|
// monorepo dev
|
|
162329
162327
|
path13.join(process.cwd(), "frontend", "dist")
|
|
162330
162328
|
// alt layout
|
|
162331
|
-
];
|
|
162329
|
+
].filter(Boolean);
|
|
162332
162330
|
const publicDir = candidates.find((d) => {
|
|
162333
162331
|
try {
|
|
162334
162332
|
return fs5.statSync(d).isDirectory();
|
package/bin/cli.js
CHANGED