-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
130 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const fs = require("node:fs/promises"); | ||
const { createClient } = require("edgedb"); | ||
|
||
const client = createClient("_localdev"); | ||
|
||
(async function () { | ||
const OAuthProviders = await client.query(` | ||
with providers := ( | ||
select schema::ObjectType | ||
filter .bases.name = 'ext::auth::OAuthProviderConfig' | ||
) | ||
select ( | ||
select providers.properties filter .name = 'name' | ||
).default`); | ||
|
||
await fs.writeFile( | ||
"./src/consts.ts", | ||
`// AUTOGENERATED - Run \`yarn gen-consts\` to re-generate. | ||
export const builtinOAuthProviderNames = [ | ||
${OAuthProviders.sort() | ||
.map((provider) => ` ${provider.replace(/^'|'$/g, '"')},`) | ||
.join("\n")} | ||
] as const; | ||
export type BuiltinOAuthProviderNames = | ||
(typeof builtinOAuthProviderNames)[number]; | ||
export const builtinLocalProviderNames = [ | ||
"builtin::local_emailpassword", | ||
] as const; | ||
export type BuiltinLocalProviderNames = | ||
(typeof builtinLocalProviderNames)[number]; | ||
` | ||
); | ||
|
||
console.log('Generated into "src/consts.ts"'); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// AUTOGENERATED - Run `yarn gen-consts` to re-generate. | ||
|
||
export const builtinOAuthProviderNames = [ | ||
"builtin::oauth_apple", | ||
"builtin::oauth_azure", | ||
"builtin::oauth_github", | ||
"builtin::oauth_google", | ||
] as const; | ||
export type BuiltinOAuthProviderNames = | ||
(typeof builtinOAuthProviderNames)[number]; | ||
|
||
export const builtinLocalProviderNames = [ | ||
"builtin::local_emailpassword", | ||
] as const; | ||
export type BuiltinLocalProviderNames = | ||
(typeof builtinLocalProviderNames)[number]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from "./core"; | ||
export * from "./pkce"; | ||
export * from "./consts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters