Skip to content

Commit

Permalink
🤖 Merge PR DefinitelyTyped#69735 Node auth users settings update by @…
Browse files Browse the repository at this point in the history
  • Loading branch information
randyn committed Jun 25, 2024
1 parent a58d9a8 commit fc5c7b7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion types/node-red__runtime/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ declare namespace runtime {
strategy: Strategy;
options: object;
};
users: UsernamePermissions[];
users: UsernamePermissions[] | ((username: string) => Promise<UsernamePermissions | null>);
}
| undefined;

Expand Down
29 changes: 29 additions & 0 deletions types/node-red__runtime/node-red__runtime-tests.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
import runtime = require("@node-red/runtime");
import editorApi from "@node-red/editor-api";
import { Server } from "https";

async function runtimeTests() {
const httpServer = new Server();
runtime.init(
{
adminAuth: {
type: "strategy",
strategy: {
name: "customStrategy",
label: "Custom Strategy",
icon: "path/to/icon.png",
strategy: {
authenticate: () => {},
},
options: {},
},
users: async (username) => {
return {
username,
permissions: ["*"],
};
},
},
uiPort: 18880,
uiHost: "localhost",
},
httpServer,
editorApi,
);
await runtime.start();
await runtime.stop();

Expand Down

0 comments on commit fc5c7b7

Please sign in to comment.