@lowdefy/api 0.0.0-experimental-20260608135213 → 0.0.0-experimental-20260610101734
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/index.js
CHANGED
|
@@ -17,9 +17,9 @@ import callEndpoint from './routes/endpoints/callEndpoint.js';
|
|
|
17
17
|
import callRequest from './routes/request/callRequest.js';
|
|
18
18
|
import createApiContext from './context/createApiContext.js';
|
|
19
19
|
import createSessionCallback from './routes/auth/callbacks/createSessionCallback.js';
|
|
20
|
+
import getAuthConfig from './routes/auth/getAuthConfig.js';
|
|
20
21
|
import getHomeAndMenus from './routes/rootConfig/getHomeAndMenus.js';
|
|
21
|
-
import getNextAuthConfig from './routes/auth/getNextAuthConfig.js';
|
|
22
22
|
import getPageConfig from './routes/page/getPageConfig.js';
|
|
23
23
|
import getRootConfig from './routes/rootConfig/getRootConfig.js';
|
|
24
24
|
import logClientError from './routes/log/logClientError.js';
|
|
25
|
-
export { callAgent, callEndpoint, callRequest, createApiContext, createSessionCallback,
|
|
25
|
+
export { callAgent, callEndpoint, callRequest, createApiContext, createSessionCallback, getAuthConfig, getHomeAndMenus, getPageConfig, getRootConfig, logClientError };
|
|
@@ -20,11 +20,8 @@
|
|
|
20
20
|
};
|
|
21
21
|
function createLogger({ logger }) {
|
|
22
22
|
return {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (error) {
|
|
26
|
-
error.code = code;
|
|
27
|
-
}
|
|
23
|
+
// Auth.js v5 logger contract: error(error), warn(code), debug(message, metadata).
|
|
24
|
+
error: (error)=>{
|
|
28
25
|
logger.error(error);
|
|
29
26
|
},
|
|
30
27
|
warn: (code)=>{
|
|
@@ -19,10 +19,10 @@ import createCallbacks from './callbacks/createCallbacks.js';
|
|
|
19
19
|
import createEvents from './events/createEvents.js';
|
|
20
20
|
import createLogger from './createLogger.js';
|
|
21
21
|
import createProviders from './createProviders.js';
|
|
22
|
-
const
|
|
22
|
+
const authConfigCache = {};
|
|
23
23
|
let initialized = false;
|
|
24
|
-
function
|
|
25
|
-
if (initialized) return
|
|
24
|
+
function getAuthConfig({ appMeta, authJson, logger, plugins, secrets }) {
|
|
25
|
+
if (initialized) return authConfigCache;
|
|
26
26
|
const operatorsParser = new ServerParser({
|
|
27
27
|
lowdefyApp: appMeta,
|
|
28
28
|
operators: {
|
|
@@ -40,36 +40,42 @@ function getNextAuthConfig({ appMeta, authJson, logger, plugins, secrets }) {
|
|
|
40
40
|
if (operatorErrors.length > 0) {
|
|
41
41
|
throw operatorErrors[0];
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
authConfigCache.adapter = createAdapter({
|
|
44
44
|
authConfig,
|
|
45
45
|
logger,
|
|
46
46
|
plugins
|
|
47
47
|
});
|
|
48
|
-
|
|
48
|
+
authConfigCache.callbacks = createCallbacks({
|
|
49
49
|
authConfig,
|
|
50
50
|
logger,
|
|
51
51
|
plugins
|
|
52
52
|
});
|
|
53
|
-
|
|
53
|
+
authConfigCache.events = createEvents({
|
|
54
54
|
authConfig,
|
|
55
55
|
logger,
|
|
56
56
|
plugins
|
|
57
57
|
});
|
|
58
|
-
|
|
58
|
+
authConfigCache.logger = createLogger({
|
|
59
59
|
logger
|
|
60
60
|
});
|
|
61
|
-
|
|
61
|
+
authConfigCache.providers = createProviders({
|
|
62
62
|
authConfig,
|
|
63
63
|
logger,
|
|
64
64
|
plugins
|
|
65
65
|
});
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
authConfigCache.debug = authConfig.debug ?? logger?.isLevelEnabled('debug') === true;
|
|
67
|
+
authConfigCache.pages = authConfig.authPages;
|
|
68
|
+
authConfigCache.session = authConfig.session;
|
|
69
|
+
authConfigCache.theme = authConfig.theme;
|
|
70
|
+
authConfigCache.cookies = authConfig?.advanced?.cookies;
|
|
71
|
+
// Auth.js v5 reads AUTH_SECRET from env but not NEXTAUTH_SECRET — map the
|
|
72
|
+
// v4 variable here so existing deployments keep working without env changes.
|
|
73
|
+
authConfigCache.secret = process.env.AUTH_SECRET ?? process.env.NEXTAUTH_SECRET;
|
|
74
|
+
// Self-hosted servers run behind arbitrary proxies; derive URLs from request
|
|
75
|
+
// headers (v4 derived them from NEXTAUTH_URL, aliased to AUTH_URL at startup).
|
|
76
|
+
authConfigCache.trustHost = true;
|
|
77
|
+
authConfigCache.basePath = '/api/auth';
|
|
72
78
|
initialized = true;
|
|
73
|
-
return
|
|
79
|
+
return authConfigCache;
|
|
74
80
|
}
|
|
75
|
-
export default
|
|
81
|
+
export default getAuthConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/api",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-20260610101734",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"dist/*"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@lowdefy/ajv": "0.0.0-experimental-
|
|
38
|
-
"@lowdefy/errors": "0.0.0-experimental-
|
|
39
|
-
"@lowdefy/helpers": "0.0.0-experimental-
|
|
40
|
-
"@lowdefy/node-utils": "0.0.0-experimental-
|
|
41
|
-
"@lowdefy/nunjucks": "0.0.0-experimental-
|
|
42
|
-
"@lowdefy/operators": "0.0.0-experimental-
|
|
43
|
-
"@lowdefy/operators-js": "0.0.0-experimental-
|
|
37
|
+
"@lowdefy/ajv": "0.0.0-experimental-20260610101734",
|
|
38
|
+
"@lowdefy/errors": "0.0.0-experimental-20260610101734",
|
|
39
|
+
"@lowdefy/helpers": "0.0.0-experimental-20260610101734",
|
|
40
|
+
"@lowdefy/node-utils": "0.0.0-experimental-20260610101734",
|
|
41
|
+
"@lowdefy/nunjucks": "0.0.0-experimental-20260610101734",
|
|
42
|
+
"@lowdefy/operators": "0.0.0-experimental-20260610101734",
|
|
43
|
+
"@lowdefy/operators-js": "0.0.0-experimental-20260610101734"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@jest/globals": "28.1.3",
|